mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 10:51:58 -05:00
Implement #5855: Display source game in missing obj window
This commit is contained in:
parent
f5923dbe99
commit
fab8efbe2a
6 changed files with 66 additions and 21 deletions
|
@ -4439,6 +4439,7 @@ STR_6127 :File: {STRING}
|
|||
STR_6128 :The file could not be loaded as some of the objects referenced in it are missing or corrupt. A list of these objects is given below.
|
||||
STR_6129 :Copy selected item to clipboard
|
||||
STR_6130 :Copy entire list to clipboard
|
||||
STR_6131 :Object source
|
||||
|
||||
#############
|
||||
# Scenarios #
|
||||
|
|
|
@ -3799,6 +3799,7 @@ enum {
|
|||
STR_OBJECT_ERROR_WINDOW_EXPLANATION = 6128,
|
||||
STR_COPY_SELECTED = 6129,
|
||||
STR_COPY_ALL = 6130,
|
||||
STR_OBJECT_SOURCE = 6131,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
#include "drawing/drawing.h"
|
||||
|
||||
// First 0xF of rct_object_entry->flags
|
||||
typedef enum{
|
||||
typedef enum
|
||||
{
|
||||
OBJECT_TYPE_RIDE,
|
||||
OBJECT_TYPE_SMALL_SCENERY,
|
||||
OBJECT_TYPE_LARGE_SCENERY,
|
||||
|
@ -33,9 +34,10 @@ typedef enum{
|
|||
OBJECT_TYPE_PARK_ENTRANCE,
|
||||
OBJECT_TYPE_WATER,
|
||||
OBJECT_TYPE_SCENARIO_TEXT
|
||||
}OBJECT_TYPE;
|
||||
} OBJECT_TYPE;
|
||||
|
||||
typedef enum{
|
||||
typedef enum
|
||||
{
|
||||
OBJECT_SELECTION_FLAG_SELECTED = (1 << 0),
|
||||
OBJECT_SELECTION_FLAG_2 = (1 << 1),
|
||||
OBJECT_SELECTION_FLAG_IN_USE = (1 << 2),
|
||||
|
@ -44,7 +46,15 @@ typedef enum{
|
|||
OBJECT_SELECTION_FLAG_6 = (1 << 5),
|
||||
OBJECT_SELECTION_FLAG_7 = (1 << 6),
|
||||
OBJECT_SELECTION_FLAG_8 = (1 << 7),
|
||||
}OBJECT_SELECTION_FLAGS;
|
||||
} OBJECT_SELECTION_FLAGS;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OBJECT_SOURCE_CUSTOM,
|
||||
OBJECT_SOURCE_WACKY_WORLDS,
|
||||
OBJECT_SOURCE_TIME_TWISTER,
|
||||
OBJECT_SOURCE_RCT2 = 8
|
||||
} OBJECT_SOURCE_GAME;
|
||||
|
||||
#define OBJECT_ENTRY_GROUP_COUNT 11
|
||||
#define OBJECT_ENTRY_COUNT 721
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <unordered_set>
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "FootpathItemObject.h"
|
||||
#include "LargeSceneryObject.h"
|
||||
#include "Object.h"
|
||||
|
@ -232,6 +233,22 @@ public:
|
|||
return objects;
|
||||
}
|
||||
|
||||
static rct_string_id GetObjectSourceGameString(const rct_object_entry * entry)
|
||||
{
|
||||
uint8 source = (entry->flags & 0xF0) >> 4;
|
||||
switch (source)
|
||||
{
|
||||
case OBJECT_SOURCE_RCT2:
|
||||
return STR_ROLLERCOASTER_TYCOON_2_DROPDOWN;
|
||||
case OBJECT_SOURCE_WACKY_WORLDS:
|
||||
return STR_OBJECT_FILTER_WW;
|
||||
case OBJECT_SOURCE_TIME_TWISTER:
|
||||
return STR_OBJECT_FILTER_TT;
|
||||
default:
|
||||
return STR_OBJECT_FILTER_CUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
sint32 FindSpareSlot(uint8 objectType)
|
||||
{
|
||||
|
@ -648,4 +665,9 @@ extern "C"
|
|||
objectManager->UnloadAll();
|
||||
}
|
||||
}
|
||||
|
||||
rct_string_id object_manager_get_source_game_string(const rct_object_entry * entry)
|
||||
{
|
||||
return ObjectManager::GetObjectSourceGameString(entry);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,12 +66,13 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
void * object_manager_get_loaded_object_by_index(size_t index);
|
||||
void * object_manager_get_loaded_object(const rct_object_entry * entry);
|
||||
uint8 object_manager_get_loaded_object_entry_index(const void * loadedObject);
|
||||
void * object_manager_load_object(const rct_object_entry * entry);
|
||||
void object_manager_unload_objects(const rct_object_entry * entries, size_t count);
|
||||
void object_manager_unload_all_objects();
|
||||
void * object_manager_get_loaded_object_by_index(size_t index);
|
||||
void * object_manager_get_loaded_object(const rct_object_entry * entry);
|
||||
uint8 object_manager_get_loaded_object_entry_index(const void * loadedObject);
|
||||
void * object_manager_load_object(const rct_object_entry * entry);
|
||||
void object_manager_unload_objects(const rct_object_entry * entries, size_t count);
|
||||
void object_manager_unload_all_objects();
|
||||
rct_string_id object_manager_get_source_game_string(const rct_object_entry * entry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -27,25 +27,31 @@ enum WINDOW_OBJECT_LOAD_ERROR_WIDGET_IDX {
|
|||
WIDX_TITLE,
|
||||
WIDX_CLOSE,
|
||||
WIDX_COLUMN_OBJECT_NAME,
|
||||
WIDX_COLUMN_OBJECT_SOURCE,
|
||||
WIDX_COLUMN_OBJECT_TYPE,
|
||||
WIDX_SCROLL,
|
||||
WIDX_COPY_CURRENT,
|
||||
WIDX_COPY_ALL
|
||||
};
|
||||
|
||||
#define WW 400
|
||||
#define WW 450
|
||||
#define WH 400
|
||||
#define WW_LESS_PADDING (WW - 5)
|
||||
#define NAME_COL_LEFT 4
|
||||
#define SOURCE_COL_LEFT ((WW_LESS_PADDING / 4) + 1)
|
||||
#define TYPE_COL_LEFT (5 * WW_LESS_PADDING / 8 + 1)
|
||||
#define LIST_ITEM_HEIGHT 10
|
||||
|
||||
rct_widget window_object_load_error_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, // Background
|
||||
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_OBJECT_LOAD_ERROR_TITLE, STR_WINDOW_TITLE_TIP }, // Title bar
|
||||
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close button
|
||||
{ WWT_13, 0, 4, (WW - 5) / 3, 57, 68, STR_OBJECT_NAME, STR_NONE }, // 'Object name' header
|
||||
{ WWT_13, 0, (WW - 5) / 3 + 1, WW - 5 - 1, 57, 68, STR_OBJECT_TYPE, STR_NONE }, // 'Object type' header
|
||||
{ WWT_SCROLL, 0, 4, WW - 5, 68, WH - 40, SCROLL_VERTICAL, STR_NONE }, // Scrollable list area
|
||||
{ WWT_CLOSEBOX, 0, 20, 200, WW - 32, WW - 12, STR_COPY_SELECTED, STR_NONE }, // Copy selected btn
|
||||
{ WWT_CLOSEBOX, 0, 200, 370, WW - 32, WW - 12, STR_COPY_ALL, STR_NONE }, // Copy all btn
|
||||
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, // Background
|
||||
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_OBJECT_LOAD_ERROR_TITLE, STR_WINDOW_TITLE_TIP }, // Title bar
|
||||
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // Close button
|
||||
{ WWT_13, 0, NAME_COL_LEFT, SOURCE_COL_LEFT - 1, 57, 68, STR_OBJECT_NAME, STR_NONE }, // 'Object name' header
|
||||
{ WWT_13, 0, SOURCE_COL_LEFT, TYPE_COL_LEFT - 1, 57, 68, STR_OBJECT_SOURCE, STR_NONE }, // 'Object source' header
|
||||
{ WWT_13, 0, TYPE_COL_LEFT, WW_LESS_PADDING - 1, 57, 68, STR_OBJECT_TYPE, STR_NONE }, // 'Object type' header
|
||||
{ WWT_SCROLL, 0, 4, WW_LESS_PADDING, 68, WH - 40, SCROLL_VERTICAL, STR_NONE }, // Scrollable list area
|
||||
{ WWT_CLOSEBOX, 0, 45, 225, WH - 32, WH - 12, STR_COPY_SELECTED, STR_NONE }, // Copy selected btn
|
||||
{ WWT_CLOSEBOX, 0, 225, 395, WH - 32, WH - 12, STR_COPY_ALL, STR_NONE }, // Copy all btn
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
|
@ -316,10 +322,14 @@ static void window_object_load_error_scrollpaint(rct_window *w, rct_drawpixelinf
|
|||
gfx_fill_rect(dpi, 0, y, list_width, y + LIST_ITEM_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000);
|
||||
|
||||
// Draw the actual object entry's name...
|
||||
gfx_draw_string(dpi, strndup(invalid_entries[i].name, 8), COLOUR_DARK_GREEN, 5, y);
|
||||
gfx_draw_string(dpi, strndup(invalid_entries[i].name, 8), COLOUR_DARK_GREEN, NAME_COL_LEFT, y);
|
||||
|
||||
// ... source game ...
|
||||
rct_string_id sourceStringId = object_manager_get_source_game_string(&invalid_entries[i]);
|
||||
gfx_draw_string_left(dpi, sourceStringId, NULL, COLOUR_DARK_GREEN, SOURCE_COL_LEFT, y);
|
||||
|
||||
// ... and type
|
||||
rct_string_id type = get_object_type_string(&invalid_entries[i]);
|
||||
gfx_draw_string_left(dpi, type, NULL, COLOUR_DARK_GREEN, (WW - 5) / 3 + 1, y);
|
||||
gfx_draw_string_left(dpi, type, NULL, COLOUR_DARK_GREEN, TYPE_COL_LEFT, y);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue