From d5ffaefdf087b1cb6a32d30c404947ffafea8295 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Fri, 26 Jun 2015 22:40:09 +0100 Subject: [PATCH] add better disable clearance cheat --- data/language/english_uk.txt | 3 ++ projects/openrct2.vcxproj | 2 ++ projects/openrct2.vcxproj.filters | 6 ++++ src/cheats.c | 12 +++++++ src/cheats.h | 9 ++++- src/interface/viewport_interaction.c | 2 +- src/localisation/string_ids.h | 3 ++ src/windows/cheats.c | 2 +- src/windows/footpath.c | 6 ++-- src/windows/map.c | 6 ++-- src/windows/top_toolbar.c | 50 +++++++++++++++++++++++--- src/world/footpath.c | 4 +-- src/world/map.c | 54 ++++++++++++++-------------- 13 files changed, 117 insertions(+), 42 deletions(-) create mode 100644 src/cheats.c diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 52f76a4c94..b2579a7875 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3788,6 +3788,9 @@ STR_5451 :Open cheats window STR_5452 :Toggle visibility of toolbars STR_5453 :Select another ride STR_5454 :Uncap FPS +STR_5455 :Disable clearance checks +STR_5456 :Disable support limits + STR_5458 :Rotate clockwise STR_5459 :Rotate anti-clockwise STR_5460 :Rotate view anti-clockwise diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 84309b2bcf..8a3eeebd10 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -26,6 +26,7 @@ + @@ -185,6 +186,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index d2f78bd6b4..a9d0659525 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -492,6 +492,9 @@ Source\Windows + + Source + @@ -719,5 +722,8 @@ Source\Interface + + Source + \ No newline at end of file diff --git a/src/cheats.c b/src/cheats.c new file mode 100644 index 0000000000..4719dad484 --- /dev/null +++ b/src/cheats.c @@ -0,0 +1,12 @@ +#include "cheats.h" + +bool gCheatsSandboxMode = false; +bool gCheatsDisableClearanceChecks = false; +bool gCheatsDisableSupportLimits = false; + +void cheats_reset() +{ + gCheatsSandboxMode = false; + gCheatsDisableClearanceChecks = false; + gCheatsDisableSupportLimits = false; +} diff --git a/src/cheats.h b/src/cheats.h index 2ef58d5260..c18038de1a 100644 --- a/src/cheats.h +++ b/src/cheats.h @@ -21,5 +21,12 @@ #ifndef _CHEATS_H_ #define _CHEATS_H_ -int gSandboxMode; +#include "common.h" + +extern bool gCheatsSandboxMode; +extern bool gCheatsDisableClearanceChecks; +extern bool gCheatsDisableSupportLimits; + +void cheats_reset(); + #endif diff --git a/src/interface/viewport_interaction.c b/src/interface/viewport_interaction.c index e9e5592fed..9cf87e2a6a 100644 --- a/src/interface/viewport_interaction.c +++ b/src/interface/viewport_interaction.c @@ -301,7 +301,7 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info return info->type; case VIEWPORT_INTERACTION_ITEM_PARK: - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode) + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) break; if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_ENTRANCE) diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index c3305bd1be..dc0ec63f9c 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -1783,6 +1783,9 @@ enum { STR_SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE = 5460, + STR_DISABLE_CLEARANCE_CHECKS = 5455, + STR_DISABLE_SUPPORT_LIMITS = 5456, + // 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 b9f870b85c..0fe18bd813 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -933,7 +933,7 @@ static void window_cheats_misc_mouseup(rct_window *w, int widgetIndex) window_invalidate_by_class(WC_PARK_INFORMATION); break; case WIDX_SANDBOX_MODE: - gSandboxMode = !gSandboxMode; + gCheatsSandboxMode = !gCheatsSandboxMode; w->widgets[widgetIndex].image = w->widgets[widgetIndex].image == STR_CHEAT_SANDBOX_MODE ? STR_CHEAT_SANDBOX_MODE_DISABLE : STR_CHEAT_SANDBOX_MODE; // To prevent tools from staying active after disabling cheat tool_cancel(); diff --git a/src/windows/footpath.c b/src/windows/footpath.c index c5bfd9586f..ed6fdaf397 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -209,7 +209,7 @@ void window_footpath_open() // If a restricted path was selected when the game is no longer in Sandbox mode, reset it pathId = RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, sint16); pathType = g_pathTypeEntries[pathId]; - if((pathType->flags & 4) && !gSandboxMode) { + if((pathType->flags & 4) && !gCheatsSandboxMode) { RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, sint16) = 0; } @@ -343,7 +343,7 @@ static void window_footpath_dropdown(rct_window *w, int widgetIndex, int dropdow pathId = RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, sint16); } else { int flags = 4; - if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gSandboxMode) + if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) flags = 0; j = 0; @@ -581,7 +581,7 @@ static void window_footpath_show_footpath_types_dialog(rct_window *w, rct_widget numPathTypes = 0; flags = 4; // If the game is in sandbox mode, also show paths that are normally restricted to the scenario editor, but not their queues (since these usually shouldn't have one) - if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || (gSandboxMode && !showQueues)) + if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || (gCheatsSandboxMode && !showQueues)) flags = 0; for (i = 0; i < 16; i++) { diff --git a/src/windows/map.c b/src/windows/map.c index 3cc06577be..d19a11a47a 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -698,7 +698,7 @@ static void window_map_invalidate(rct_window *w) 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) || gSandboxMode) + if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) w->widgets[WIDX_MAP].bottom = w->height - 1 - 72; else if (w->selected_tab == PAGE_RIDES) w->widgets[WIDX_MAP].bottom = w->height - 1 - 44; @@ -742,7 +742,7 @@ static void window_map_invalidate(rct_window *w) w->widgets[i].type = WWT_EMPTY; } - if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gSandboxMode) { + if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) { // scenario editor: build park entrance selected, show rotate button if ( (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && @@ -813,7 +813,7 @@ static void window_map_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_sprite(dpi, 0x0B6E0190A, x, y, 0); } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { // Render the map legend if (w->selected_tab == PAGE_RIDES) { x = w->x + 4; diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 1006bcf4f8..78b1efe83f 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "../addresses.h" +#include "../cheats.h" #include "../config.h" #include "../editor.h" #include "../game.h" @@ -101,6 +102,12 @@ typedef enum { DDIDX_OBJECT_SELECTION = 2 } TOP_TOOLBAR_DEBUG_DDIDX; +enum { + DDIDX_CHEATS, + DDIDX_DISABLE_CLEARANCE_CHECKS = 2, + DDIDX_DISABLE_SUPPORT_LIMITS +}; + #pragma region Toolbar_widget_ordering // from left to right @@ -311,9 +318,6 @@ static void window_top_toolbar_mouseup(rct_window *w, int widgetIndex) case WIDX_RESEARCH: window_research_open(); break; - case WIDX_CHEATS: - window_cheats_open(); - break; } } @@ -390,6 +394,28 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg gDropdownItemsChecked |= (1 << 11); #endif break; + case WIDX_CHEATS: + gDropdownItemsFormat[0] = 1156; + gDropdownItemsFormat[1] = 0; + gDropdownItemsFormat[2] = 1156; + gDropdownItemsFormat[3] = 1156; + gDropdownItemsArgs[0] = 5217; + gDropdownItemsArgs[2] = STR_DISABLE_CLEARANCE_CHECKS; + gDropdownItemsArgs[3] = STR_DISABLE_SUPPORT_LIMITS; + window_dropdown_show_text( + w->x + widget->left, + w->y + widget->top, + widget->bottom - widget->top + 1, + w->colours[0] | 0x80, + 0, + 4 + ); + if (gCheatsDisableClearanceChecks) + gDropdownItemsChecked |= (1 << DDIDX_DISABLE_CLEARANCE_CHECKS); + if (gCheatsDisableSupportLimits) + gDropdownItemsChecked |= (1 << DDIDX_DISABLE_SUPPORT_LIMITS); + RCT2_GLOBAL(0x009DEBA2, uint16) = 0; + break; case WIDX_VIEW_MENU: top_toolbar_init_view_menu(w, widget); break; @@ -410,7 +436,7 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg w->colours[1] | 0x80, 0, numItems - ); + ); RCT2_GLOBAL(0x009DEBA2, uint16) = 0; break; case WIDX_FASTFORWARD: @@ -426,7 +452,7 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg } /** - * + * * rct2: 0x0066C9EA */ static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int dropdownIndex) @@ -476,6 +502,20 @@ static void window_top_toolbar_dropdown(rct_window *w, int widgetIndex, int drop #endif } break; + case WIDX_CHEATS: + if (dropdownIndex == -1) dropdownIndex = RCT2_GLOBAL(0x009DEBA2, uint16); + switch (dropdownIndex) { + case DDIDX_CHEATS: + window_cheats_open(); + break; + case DDIDX_DISABLE_CLEARANCE_CHECKS: + gCheatsDisableClearanceChecks = !gCheatsDisableClearanceChecks; + break; + case DDIDX_DISABLE_SUPPORT_LIMITS: + gCheatsDisableSupportLimits = !gCheatsDisableSupportLimits; + break; + } + break; case WIDX_VIEW_MENU: top_toolbar_view_menu_dropdown(dropdownIndex); break; diff --git a/src/world/footpath.c b/src/world/footpath.c index 7bfdcd40ff..c62b1ca0f8 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -337,7 +337,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int return MONEY32_UNDEFINED; } - if (!((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gSandboxMode) && !map_is_location_owned(x, y, z * 8)) + if (!((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(x, y, z * 8)) return MONEY32_UNDEFINED; if (slope & 8) { @@ -391,7 +391,7 @@ money32 footpath_remove_real(int x, int y, int z, int flags) footpath_remove_litter(x, y, z * 8); } - if (!((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gSandboxMode) && !map_is_location_owned(x, y, z * 8)) + if (!((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(x, y, z * 8)) return MONEY32_UNDEFINED; mapElement = map_get_footpath_element(x / 32, y / 32, z); diff --git a/src/world/map.c b/src/world/map.c index 0f7b5c7f6e..85b9c42d59 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -690,7 +690,7 @@ void game_command_remove_scenery(int* eax, int* ebx, int* ecx, int* edx, int* es return; } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !(*ebx & 0x40) && !gSandboxMode) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !(*ebx & 0x40) && !gCheatsSandboxMode) { // Check if allowed to remove item if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_TREE_REMOVAL) { if (entry->small_scenery.height > 64) { @@ -808,7 +808,7 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i currentTile.y += firstTile.y; currentTile.z += firstTile.z; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode){ + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode){ if (!map_is_location_owned(currentTile.x, currentTile.y, currentTile.z)){ *ebx = MONEY32_UNDEFINED; return; @@ -873,7 +873,7 @@ void game_command_remove_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi *ebx = MONEY32_UNDEFINED; return; } - if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode && !map_is_location_owned(x, y, z - 16)){ + if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(x, y, z - 16)){ *ebx = MONEY32_UNDEFINED; return; } @@ -918,7 +918,7 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16; RCT2_GLOBAL(0x009DEA60, uint16) = y + 16; RCT2_GLOBAL(0x009DEA62, uint16) = z; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode){ + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode){ if (!map_is_location_owned(x, y, z)){ *ebx = MONEY32_UNDEFINED; return; @@ -969,7 +969,7 @@ void game_command_set_fence_colour(int* eax, int* ebx, int* ecx, int* edx, int* RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16; RCT2_GLOBAL(0x009DEA60, uint16) = y + 16; RCT2_GLOBAL(0x009DEA62, uint16) = z; - if((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || map_is_location_in_park(x, y) || gSandboxMode){ + if((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || map_is_location_in_park(x, y) || gCheatsSandboxMode){ rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32); while(map_element_get_type(map_element) != MAP_ELEMENT_TYPE_FENCE || map_element->base_height != base_height || @@ -1094,7 +1094,7 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed x3 += x2; y3 += y2; z3 += z2; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode){ + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode){ if (!map_is_location_owned(x3, y3, z3)){ *ebx = MONEY32_UNDEFINED; return; @@ -1138,7 +1138,7 @@ void game_command_set_banner_colour(int* eax, int* ebx, int* ecx, int* edx, int* RCT2_GLOBAL(0x009DEA60, uint16) = y + 16; RCT2_GLOBAL(0x009DEA62, uint16) = z; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode){ + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode){ if (!map_is_location_owned(x, y, z - 16)){ *ebx = MONEY32_UNDEFINED; return; @@ -1346,7 +1346,7 @@ money32 map_change_surface_style(int x0, int y0, int x1, int y1, uint8 surfaceSt return (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) ? 0 : cost; } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode && RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { cost += RCT2_GLOBAL(0x009E32B4, uint32); return (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) ? 0 : cost; } @@ -1356,7 +1356,7 @@ money32 map_change_surface_style(int x0, int y0, int x1, int y1, uint8 surfaceSt if (x > 0x1FFF) continue; if (y > 0x1FFF) continue; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { if (!map_is_location_in_park(x, y)) continue; } @@ -1464,7 +1464,7 @@ static money32 sub_66397F(int flags, int x, int y, int height, int style, int se return MONEY32_UNDEFINED; } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; return MONEY32_UNDEFINED; @@ -1494,7 +1494,7 @@ static money32 sub_66397F(int flags, int x, int y, int height, int style, int se return MONEY32_UNDEFINED; } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode) { + if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { if (!map_is_location_in_park(x, y)) { return MONEY32_UNDEFINED; } @@ -1924,7 +1924,7 @@ void game_command_remove_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, *ebx = MONEY32_UNDEFINED; return; } - if(!(*ebx & 0x40) && !(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode && !map_is_location_owned(x, y, base_height * 8)){ + if(!(*ebx & 0x40) && !(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(x, y, base_height * 8)){ *ebx = MONEY32_UNDEFINED; return; } @@ -1982,7 +1982,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, return; } } - if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode && !map_is_location_owned(x, y, base_height * 16)){ + if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(x, y, base_height * 16)){ *ebx = MONEY32_UNDEFINED; return; } @@ -2093,7 +2093,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi if(F64EC8 == 0){ F64EC8 = base_height2; } - if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gSandboxMode && !map_is_location_owned(x, y, F64EC8)){ + if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(x, y, F64EC8)){ *ebx = MONEY32_UNDEFINED; return; } @@ -2107,7 +2107,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi while(map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SURFACE){ map_element++; } - if(map_element->properties.surface.terrain & 0x1F){ + if(!gCheatsDisableClearanceChecks && (map_element->properties.surface.terrain & 0x1F)){ int water_height = ((map_element->properties.surface.terrain & 0x1F) * 16) - 1; if(water_height > F64EC8){ RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CANT_BUILD_THIS_UNDERWATER; @@ -2115,7 +2115,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi return; } } - if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18)){ + if(!gCheatsDisableClearanceChecks && !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18)){ if(F64F1D != 0){ RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CAN_ONLY_BUILD_THIS_ON_LAND; *ebx = MONEY32_UNDEFINED; @@ -2129,7 +2129,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi } } } - if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE) || z != 0 || F64F1D != 0 || !(map_element->properties.surface.slope & 0x1F)){ + if(gCheatsDisableClearanceChecks || !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE) || z != 0 || F64F1D != 0 || !(map_element->properties.surface.slope & 0x1F)){ if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18 || z == 0){ l_6E0B78: ; int bp = quadrant; @@ -2171,7 +2171,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi RCT2_GLOBAL(0x00F64F22, uint16) = x; RCT2_GLOBAL(0x00F64F24, uint16) = y; RCT2_GLOBAL(0x00F64F1E, uint32) = (uint32)(ebx - 1); //0x006E0D6E uses [F64F1E+4] to read ebx value - if(map_can_construct_with_clear_at(x, y, zLow, zHigh, (void*)0x006E0D6E, bl)){ + if(gCheatsDisableClearanceChecks || map_can_construct_with_clear_at(x, y, zLow, zHigh, (void*)0x006E0D6E, bl)){ RCT2_GLOBAL(0x00F64F14, uint8) = RCT2_GLOBAL(0x00F1AD60, uint8) & 0x3; if(*ebx & GAME_COMMAND_FLAG_APPLY){ int flags = (bl & 0xf); @@ -2282,7 +2282,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && - !(flags & (1 << 7)) && !gSandboxMode){ + !(flags & (1 << 7)) && !gCheatsSandboxMode){ if (position.z == 0){ if (!map_is_location_in_park(position.x, position.y)){ @@ -2435,7 +2435,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } RCT2_GLOBAL(0x00141F722, uint8) += fence->wall.height; - if (!(flags & (1 << 7))){ + if (!(flags & (1 << 7)) && !gCheatsDisableClearanceChecks){ if (!sub_6E5C1A(fence, position.x, position.y, edge, RCT2_GLOBAL(0x00141F721, uint8), RCT2_GLOBAL(0x00141F722, uint8))) { *ebx = MONEY32_UNDEFINED; return; @@ -2625,13 +2625,15 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in RCT2_GLOBAL(0x00F43892, sint16) = x2; RCT2_GLOBAL(0x00F43894, sint16) = y2; RCT2_GLOBAL(0x00F43896, uint32) = (uint32)(ebx - 3); // this is how ebx flags var is passed to 0x006B8D88 - if(map_can_construct_with_clear_at(x2, y2, zLow, zHigh, (void*)0x006B8D88, bl)){ + if(gCheatsDisableClearanceChecks || map_can_construct_with_clear_at(x2, y2, zLow, zHigh, (void*)0x006B8D88, bl)){ if(!(RCT2_GLOBAL(0x00F1AD60, uint8) & 4) && !(RCT2_GLOBAL(0x00F1AD60, uint8) & 2)){ int b = RCT2_GLOBAL(0x00F1AD60, uint8) & 0x3; - if(RCT2_GLOBAL(0x00F64F14, uint8) && !(RCT2_GLOBAL(0x00F64F14, uint8) & b)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND; - *ebx = MONEY32_UNDEFINED; - return; + if (!gCheatsDisableClearanceChecks) { + if (RCT2_GLOBAL(0x00F64F14, uint8) && !(RCT2_GLOBAL(0x00F64F14, uint8) & b)){ + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND; + *ebx = MONEY32_UNDEFINED; + return; + } } RCT2_GLOBAL(0x00F64F14, uint8) = b; if(x2 >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) || y2 >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16)){ @@ -2639,7 +2641,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in *ebx = MONEY32_UNDEFINED; return; } - if((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || map_is_location_owned(x2, y2, zLow * 8) || gSandboxMode){ + if((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || map_is_location_owned(x2, y2, zLow * 8) || gCheatsSandboxMode){ if(*ebx & GAME_COMMAND_FLAG_APPLY){ if(!(*ebx & 0x40)){ footpath_remove_litter(x2, y2, zLow * 8);