From 02ba2413854f93f8b0b91bcc25280d8e1a05720d Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 16 May 2015 17:16:09 +0200 Subject: [PATCH] Add cheat option for lift hills up to 410 km/h, fix a comment and some spaces --- data/language/english_uk.txt | 1 + src/config.c | 10 ++++++++-- src/config.h | 6 ++++++ src/windows/cheats.c | 21 ++++++++++++++++++--- src/windows/ride.c | 9 ++++++++- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index ac35126d2a..71c1a8c607 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3470,3 +3470,4 @@ STR_5133 :{SMALLFONT}{BLACK}Adjust smaller area of land rights STR_5134 :{SMALLFONT}{BLACK}Adjust larger area of land rights STR_5135 :{SMALLFONT}{BLACK}Buy land rights and construction rights STR_5136 :Land rights +STR_5137 :Allow lift hill speeds up to {VELOCITY} diff --git a/src/config.c b/src/config.c index 5580ca2ee2..a55a50ce28 100644 --- a/src/config.c +++ b/src/config.c @@ -165,7 +165,7 @@ config_property_definition _generalDefinitions[] = { config_property_definition _interfaceDefinitions[] = { { offsetof(interface_configuration, toolbar_show_finances), "toolbar_show_finances", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, toolbar_show_research), "toolbar_show_research", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, - { offsetof(interface_configuration, allow_subtype_switching), "allow_subtype_switching", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, + { offsetof(interface_configuration, allow_subtype_switching), "allow_subtype_switching", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, rct1_colour_scheme), "rct1_colour_scheme", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, }; @@ -177,10 +177,15 @@ config_property_definition _soundDefinitions[] = { { offsetof(sound_configuration, ride_music), "ride_music", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, }; +config_property_definition _cheatDefinitions[] = { + { offsetof(cheat_configuration, fast_lift_hill), "fast_lift_hill", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, +}; + config_section_definition _sectionDefinitions[] = { { &gConfigGeneral, "general", _generalDefinitions, countof(_generalDefinitions) }, { &gConfigInterface, "interface", _interfaceDefinitions, countof(_interfaceDefinitions) }, - { &gConfigSound, "sound", _soundDefinitions, countof(_soundDefinitions) } + { &gConfigSound, "sound", _soundDefinitions, countof(_soundDefinitions) }, + { &gConfigCheat, "cheat", _cheatDefinitions, countof(_cheatDefinitions) } }; #pragma endregion @@ -188,6 +193,7 @@ config_section_definition _sectionDefinitions[] = { general_configuration gConfigGeneral; interface_configuration gConfigInterface; sound_configuration gConfigSound; +cheat_configuration gConfigCheat; bool config_open(const utf8string path); bool config_save(const utf8string path); diff --git a/src/config.h b/src/config.h index 3511678ef4..4a82891924 100644 --- a/src/config.h +++ b/src/config.h @@ -146,6 +146,11 @@ typedef struct { uint8 ride_music; } sound_configuration; +typedef struct { + uint8 fast_lift_hill; +} cheat_configuration; + + typedef struct { uint8 key; uint8 modifier; @@ -154,6 +159,7 @@ typedef struct { extern general_configuration gConfigGeneral; extern interface_configuration gConfigInterface; extern sound_configuration gConfigSound; +extern cheat_configuration gConfigCheat; extern uint16 gShortcutKeys[SHORTCUT_COUNT]; diff --git a/src/windows/cheats.c b/src/windows/cheats.c index 1dd89339a8..758de298f1 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "../addresses.h" +#include "../config.h" #include "../game.h" #include "../interface/widget.h" #include "../interface/window.h" @@ -73,7 +74,8 @@ enum WINDOW_CHEATS_WIDGET_IDX { WIDX_RENEW_RIDES = 8, WIDX_REMOVE_SIX_FLAGS, WIDX_MAKE_DESTRUCTIBLE, - WIDX_FIX_ALL + WIDX_FIX_ALL, + WIDX_FAST_LIFT_HILL }; #pragma region MEASUREMENTS @@ -86,10 +88,14 @@ enum WINDOW_CHEATS_WIDGET_IDX { #define YOS TAB_HEIGHT + YSPA //Y offset ofrom top (includes tabs height) #define BTNW 110 //button width #define BTNH 16 //button height +#define OPTW 220 //Option (checkbox) width (two colums) +#define OPTH 10 //Option (checkbox) height (two colums) #define YPL(ROW) YOS + ((BTNH + YSPA) * ROW) #define HPL(ROW) YPL(ROW) + BTNH +#define OHPL(ROW) YPL(ROW) + OPTH #define XPL(COL) XOS + ((BTNW + XSPA) * COL) #define WPL(COL) XPL(COL) + BTNW +#define OWPL XPL(0) + OPTW #define TXTO 3 //text horizontal offset from button left (for button text) #pragma endregion @@ -118,7 +124,7 @@ static rct_widget window_cheats_guests_widgets[] = { { WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2462 }, // tab 3 { WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, 2462}, // tab 4 { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), 2764, STR_NONE}, // happy guests - { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(3), HPL(3), 2765, STR_NONE}, // happy guests + { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(3), HPL(3), 2765, STR_NONE}, // large tram { WIDGETS_END }, }; @@ -162,6 +168,7 @@ static rct_widget window_cheats_rides_widgets[] = { { WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(0), HPL(0), 5124, STR_NONE}, // Remove flags { WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(1), HPL(1), 5125, STR_NONE}, // Make destructable { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), 5132, STR_NONE }, // Fix all rides + { WWT_CHECKBOX, 2, XPL(0), OWPL, YPL(8),OHPL(8), 5137, STR_NONE }, // 410 km/h lift hill { WIDGETS_END }, }; @@ -320,7 +327,7 @@ static uint32 window_cheats_page_enabled_widgets[] = { (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HIGH_MONEY) | (1 << WIDX_PARK_ENTRANCE_FEE), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HAPPY_GUESTS) | (1 << WIDX_TRAM_GUESTS), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_FREEZE_CLIMATE) | (1 << WIDX_OPEN_CLOSE_PARK) | (1 << WIDX_DECREASE_GAME_SPEED) | (1 << WIDX_INCREASE_GAME_SPEED) | (1 << WIDX_ZERO_CLEARANCE) | (1 << WIDX_WEATHER_SUN) | (1 << WIDX_WEATHER_THUNDER) | (1 << WIDX_CLEAR_GRASS) | (1 << WIDX_MOWED_GRASS) | (1 << WIDX_WATER_PLANTS) | (1 << WIDX_FIX_VANDALISM) | (1 << WIDX_REMOVE_LITTER) | (1 << WIDX_WIN_SCENARIO), - (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_RENEW_RIDES) | (1 << WIDX_REMOVE_SIX_FLAGS) | (1 << WIDX_MAKE_DESTRUCTIBLE) | (1 << WIDX_FIX_ALL) + (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_RENEW_RIDES) | (1 << WIDX_REMOVE_SIX_FLAGS) | (1 << WIDX_MAKE_DESTRUCTIBLE) | (1 << WIDX_FIX_ALL) | (1 << WIDX_FAST_LIFT_HILL) }; static void window_cheats_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w); @@ -663,6 +670,10 @@ static void window_cheats_rides_mouseup() case WIDX_FIX_ALL: cheat_fix_rides(); break; + case WIDX_FAST_LIFT_HILL: + gConfigCheat.fast_lift_hill ^= 1; + config_save_default(); + window_invalidate(w); } } @@ -696,6 +707,10 @@ static void window_cheats_invalidate() w->widgets[WIDX_OPEN_CLOSE_PARK].image = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_OPEN ? 2770 : 2769; break; + case WINDOW_CHEATS_PAGE_RIDES: + RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 255; + widget_set_checkbox_value(w, WIDX_FAST_LIFT_HILL, gConfigCheat.fast_lift_hill); + break; } // Set correct active tab diff --git a/src/windows/ride.c b/src/windows/ride.c index 585cc0bed4..4e3da25673 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -2877,6 +2877,7 @@ static void window_ride_operating_resize() static void window_ride_operating_mousedown(int widgetIndex, rct_window *w, rct_widget *widget) { rct_ride *ride = GET_RIDE(w->number); + uint8 max_lift_hill_speed; switch (widgetIndex) { case WIDX_MODE_TWEAK_INCREASE: @@ -2886,7 +2887,13 @@ static void window_ride_operating_mousedown(int widgetIndex, rct_window *w, rct_ window_ride_mode_tweak_decrease(w); break; case WIDX_LIFT_HILL_SPEED_INCREASE: - set_operating_setting(w->number, 8, min(ride->lift_hill_speed + 1, RCT2_GLOBAL(0x0097D7CA + (ride->type * 4), uint8))); + + if(gConfigCheat.fast_lift_hill) + max_lift_hill_speed = 255; + else + max_lift_hill_speed = RCT2_GLOBAL(0x0097D7CA + (ride->type * 4), uint8); + + set_operating_setting(w->number, 8, min(ride->lift_hill_speed + 1, max_lift_hill_speed)); break; case WIDX_LIFT_HILL_SPEED_DECREASE: set_operating_setting(w->number, 8, max(RCT2_GLOBAL(0x0097D7C9 + (ride->type * 4), uint8), ride->lift_hill_speed - 1));