Merge pull request #1773 from Gymnasiast/inventions-in-debug-menu

Add Inventions List and Scenario Options to the Debug menu, closes #1770
This commit is contained in:
Ted John 2015-08-12 15:35:01 +01:00
commit d368aa9941
11 changed files with 41 additions and 15 deletions

View File

@ -3827,3 +3827,5 @@ STR_5487 :{SMALLFONT}{BLACK}Show recent messages
STR_5488 :No entrance
STR_5489 :{SMALLFONT}{BLACK}Show only tracked guests
STR_5490 :Disable audio on focus loss
STR_5491 :Inventions list
STR_5492 :Scenario options

View File

@ -462,7 +462,7 @@ static int editor_read_s6(const char *path)
RCT2_GLOBAL(0x013573DC, uint32) = min(RCT2_GLOBAL(0x013573DC, uint32), 100000);
finance_reset_cash_to_initial();
sub_69E869();
finance_mark_loan_settings_as_legitimate();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = clamp(
MONEY(0,00),

View File

@ -776,7 +776,7 @@ int game_load_save(const char *path)
window_new_ride_init_vars();
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
if (RCT2_GLOBAL(0x0013587C4, uint32) == 0) // this check is not in scenario play
sub_69E869();
finance_mark_loan_settings_as_legitimate();
load_palette();
gfx_invalidate_screen();

View File

@ -2027,6 +2027,9 @@ enum {
STR_AUDIO_FOCUS = 5490,
STR_DEBUG_DROPDOWN_INVENTIONS_LIST = 5491,
STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS = 5492,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};

View File

@ -188,7 +188,7 @@ void finance_init() {
RCT2_GLOBAL(0x013587D8, uint16) = 0x3F;
sub_69E869();
finance_mark_loan_settings_as_legitimate();
}
/**
@ -243,9 +243,9 @@ void finance_update_daily_profit()
window_invalidate_by_class(WC_FINANCES);
}
void sub_69E869()
// This subroutine is used to mark loan changes as 'legitimate', to prevent cheat detection from incorrectly interfering
void finance_mark_loan_settings_as_legitimate()
{
// This subroutine is loan related and is used for cheat detection
sint32 value = 0x70093A;
value -= RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32);
value = ror32(value, 5);
@ -314,7 +314,7 @@ void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int*
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = newLoan;
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) = money;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(money);
sub_69E869();
finance_mark_loan_settings_as_legitimate();
window_invalidate_by_class(WC_FINANCES);
RCT2_GLOBAL(0x009A9804, uint16) |= 1;

View File

@ -61,7 +61,7 @@ void finance_reset_history();
void finance_init();
void finance_update_daily_profit();
void finance_shift_expenditure_table();
void sub_69E869();
void finance_mark_loan_settings_as_legitimate();
void finance_reset_cash_to_initial();
void finance_set_loan(money32 loan);
@ -71,4 +71,4 @@ money32 finance_get_maximum_loan();
money32 finance_get_current_cash();
void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
#endif
#endif

View File

@ -259,7 +259,7 @@ void rct1_fix_landscape()
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32)
);
finance_reset_cash_to_initial();
sub_69E869();
finance_mark_loan_settings_as_legitimate();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = clamp(
MONEY(0,00),

View File

@ -276,7 +276,7 @@ void scenario_begin()
RCT2_GLOBAL(0x013587D0, money32) = RCT2_GLOBAL(0x013573DC, money32) - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(RCT2_GLOBAL(0x013573DC, sint32));
sub_69E869(); // (loan related)
finance_mark_loan_settings_as_legitimate(); // (loan related)
strcpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, s6Info->details);
strcpy((char*)RCT2_ADDRESS_SCENARIO_NAME, s6Info->name);
@ -315,7 +315,7 @@ void scenario_begin()
RCT2_GLOBAL(RCT2_ADDRESS_TOTAL_ADMISSIONS, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, uint32) = 0;
RCT2_GLOBAL(0x013587D8, uint16) = 63;
sub_69E869(); // (loan related, called above already)
finance_mark_loan_settings_as_legitimate(); // (loan related, called above already)
park_reset_history();
finance_reset_history();
award_reset();

View File

@ -554,6 +554,13 @@ void window_editor_inventions_list_open()
*/
static void window_editor_inventions_list_close(rct_window *w)
{
// When used in-game (as a cheat)
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_EDITOR)) {
gSilentResearch = true;
sub_684AC3();
gSilentResearch = false;
}
sub_685A79();
}

View File

@ -485,7 +485,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) < MONEY(1000000,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) += MONEY(500,00);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
sub_69E869();
finance_mark_loan_settings_as_legitimate();
} else {
window_error_open(3248, STR_NONE);
}
@ -495,7 +495,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) > MONEY(0,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) -= MONEY(500,00);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
sub_69E869();
finance_mark_loan_settings_as_legitimate();
} else {
window_error_open(3249, STR_NONE);
}
@ -505,6 +505,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) < MONEY(5000000,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) += MONEY(1000,00);
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
finance_mark_loan_settings_as_legitimate();
} else {
window_error_open(3250, STR_NONE);
}
@ -514,6 +515,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) > MONEY(0,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) -= MONEY(1000,00);
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
finance_mark_loan_settings_as_legitimate();
} else {
window_error_open(3251, STR_NONE);
}
@ -523,6 +525,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
if (RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) < MONEY(5000000,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) += MONEY(1000,00);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = min(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
finance_mark_loan_settings_as_legitimate();
} else {
window_error_open(3252, STR_NONE);
}
@ -532,6 +535,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
if (RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) > MONEY(0,00)) {
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) -= MONEY(1000,00);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = min(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
finance_mark_loan_settings_as_legitimate();
} else {
window_error_open(3253, STR_NONE);
}

View File

@ -100,7 +100,9 @@ typedef enum {
typedef enum {
DDIDX_CONSOLE = 0,
DDIDX_TILE_INSPECTOR = 1,
DDIDX_OBJECT_SELECTION = 2
DDIDX_OBJECT_SELECTION = 2,
DDIDX_INVENTIONS_LIST = 3,
DDIDX_SCENARIO_OPTIONS = 4
} TOP_TOOLBAR_DEBUG_DDIDX;
enum {
@ -2845,6 +2847,8 @@ void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget) {
gDropdownItemsFormat[0] = STR_DEBUG_DROPDOWN_CONSOLE;
gDropdownItemsFormat[1] = STR_DEBUG_DROPDOWN_TILE_INSPECTOR;
gDropdownItemsFormat[2] = STR_DEBUG_DROPDOWN_OBJECT_SELECTION;
gDropdownItemsFormat[3] = STR_DEBUG_DROPDOWN_INVENTIONS_LIST;
gDropdownItemsFormat[4] = STR_DEBUG_DROPDOWN_SCENARIO_OPTIONS;
window_dropdown_show_text(
w->x + widget->left,
@ -2852,7 +2856,7 @@ void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget) {
widget->bottom - widget->top + 1,
w->colours[1] | 0x80,
0,
3
5
);
RCT2_GLOBAL(0x9DEBA2, uint16) = 0;
@ -2873,6 +2877,12 @@ void top_toolbar_debug_menu_dropdown(short dropdownIndex) {
window_close_all();
window_editor_object_selection_open();
break;
case DDIDX_INVENTIONS_LIST:
window_editor_inventions_list_open();
break;
case DDIDX_SCENARIO_OPTIONS:
window_editor_scenario_options_open();
break;
}
}
}