From c15da4370ac85f748339024c2fe4f75a31078751 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 7 Jun 2015 12:45:55 +0200 Subject: [PATCH] Added cheat to edit land ownership settings in-game --- data/language/english_uk.txt | 5 ++++- src/interface/window.h | 3 +++ src/localisation/string_ids.h | 4 ++++ src/windows/cheats.c | 10 +++++++++- src/windows/map.c | 19 ++++++++++++++++--- src/world/climate.c | 6 +++++- 6 files changed, 41 insertions(+), 6 deletions(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 43e7180185..e8ebe8f5e2 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3610,4 +3610,7 @@ STR_5273 :{SMALLFONT}{BLACK}Large Scenery STR_5274 :{SMALLFONT}{BLACK}Footpath STR_5275 :Search for Objects STR_5276 :Enter the name of an object to search for -STR_5277 :Clear \ No newline at end of file +STR_5277 :Clear +STR_5278 :Editable land rights +STR_5279 :Normal map window +STR_5280 :{SMALLFONT}{BLACK}Allow editing land ownership settings through the Map window diff --git a/src/interface/window.h b/src/interface/window.h index bb0a51021b..f7163bb8fe 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -616,6 +616,9 @@ void window_cancel_textbox(); void window_update_textbox_caret(); void window_update_textbox(); +//Cheat: in-game land ownership editor +void toggle_ingame_land_ownership_editor(); + #ifdef _MSC_VER #define window_get_register(w) \ __asm mov w, esi diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index fc9a687f5a..864ca85da6 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -1476,6 +1476,10 @@ enum { STR_GIANT_SCREENSHOT = 5260, + STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR = 5278, + STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR_DISABLE = 5279, + STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR_TIP = 5280, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 }; diff --git a/src/windows/cheats.c b/src/windows/cheats.c index 651da0fd72..a5989c3300 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -72,6 +72,7 @@ enum WINDOW_CHEATS_WIDGET_IDX { WIDX_REMOVE_LITTER, WIDX_WIN_SCENARIO, WIDX_UNLOCK_ALL_PRICES, + WIDX_INGAME_LAND_OWNERSHIP_EDITOR, WIDX_RENEW_RIDES = 8, WIDX_REMOVE_SIX_FLAGS, WIDX_MAKE_DESTRUCTIBLE, @@ -154,6 +155,7 @@ static rct_widget window_cheats_misc_widgets[] = { { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(5), HPL(5), STR_CHEAT_REMOVE_LITTER, STR_NONE}, // Remove litter { WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(0), HPL(0), STR_CHEAT_WIN_SCENARIO, STR_NONE}, // Win scenario { WWT_CHECKBOX, 1, XPL(0), OWPL, YPL(8),OHPL(8), STR_CHEAT_UNLOCK_PRICES, STR_NONE}, // Unlock all prices + { WWT_CLOSEBOX, 1, XPL(1), WPL(1), YPL(5), HPL(5), STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR,STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR_TIP},// In-game land ownership editor { WIDGETS_END }, }; static rct_widget window_cheats_rides_widgets[] = { @@ -329,7 +331,7 @@ static void* window_cheats_page_events[] = { 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_NAUSEA_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_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_UNLOCK_ALL_PRICES), + (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_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_UNLOCK_ALL_PRICES) | (1 << WIDX_INGAME_LAND_OWNERSHIP_EDITOR), (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) | (1 << WIDX_DISABLE_BRAKES_FAILURE) | (1 << WIDX_DISABLE_ALL_BREAKDOWNS) }; @@ -654,6 +656,12 @@ static void window_cheats_misc_mouseup() window_invalidate_by_class(WC_RIDE); window_invalidate_by_class(WC_PARK_INFORMATION); break; + case WIDX_INGAME_LAND_OWNERSHIP_EDITOR: + toggle_ingame_land_ownership_editor(); + w->widgets[widgetIndex].image = w->widgets[widgetIndex].image == STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR ? STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR_DISABLE : STR_CHEAT_INGAME_LAND_OWNERSHIP_EDITOR; + // To prevent tools from staying active after disabling cheat + window_close_by_class(WC_MAP); + break; } } diff --git a/src/windows/map.c b/src/windows/map.c index 89c2d02e8c..1865f3bc11 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -136,6 +136,10 @@ static void* window_map_events[] = { window_map_scrollpaint }; +// Cheat: in-game land ownership editor +int g_ingame_land_ownership_editor; +extern void toggle_ingame_land_ownership_editor(); + /** * * rct2: 0x0068C88A @@ -542,7 +546,8 @@ static void window_map_invalidate() w->widgets[WIDX_CLOSE].right = w->width - 2 - 11 + 10; w->widgets[WIDX_MAP].right = w->width - 4; - if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)) + if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || + g_ingame_land_ownership_editor) w->widgets[WIDX_MAP].bottom = w->height - 1 - 72; else if (w->selected_tab == 1) w->widgets[WIDX_MAP].bottom = w->height - 1 - 44; @@ -588,7 +593,8 @@ static void window_map_invalidate() - if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)) { + if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || + g_ingame_land_ownership_editor) { // scenario editor: build park entrance selected, show rotate button if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP && @@ -678,7 +684,8 @@ static void window_map_paint() w->y + w->widgets[WIDX_PEOPLE_STARTING_POSITION].top + 18, 0); } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)) { + if (!((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) + || g_ingame_land_ownership_editor)) { // render the map legend if (w->selected_tab != 0) { x = w->x + 4; @@ -978,3 +985,9 @@ static void window_map_center_on_view_point() w_map->scrolls[0].v_top = dx; widget_scroll_update_thumbs(w_map, WIDX_MAP); } + +// In-game land ownership editor cheat +void toggle_ingame_land_ownership_editor() +{ + g_ingame_land_ownership_editor = !g_ingame_land_ownership_editor; +} diff --git a/src/world/climate.c b/src/world/climate.c index d687c1e5ff..79e231c2da 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -84,6 +84,10 @@ int climate_celsius_to_fahrenheit(int celsius) return (celsius * 29) / 16 + 32; } +// cheats +extern int g_climate_locked; +extern void toggle_climate_lock(); + /** * Set climate and determine start weather. * rct2: 0x006C45ED @@ -489,4 +493,4 @@ static const rct_weather_transition* climate_transitions[] = { climate_cold_transitions }; -#pragma endregion \ No newline at end of file +#pragma endregion