From 28e8b4e12b9bae306ff54b8307e99c230c3b2b19 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Wed, 3 Oct 2018 12:03:18 +0200 Subject: [PATCH] Modify game_command_remove_scenery to take unshifted scenery quadrant --- src/openrct2-ui/interface/ViewportInteraction.cpp | 2 +- src/openrct2-ui/windows/TopToolbar.cpp | 2 +- src/openrct2/network/Network.cpp | 2 +- src/openrct2/ride/TrackDesign.cpp | 7 ++----- src/openrct2/world/Map.cpp | 2 +- src/openrct2/world/Scenery.cpp | 4 ++-- src/openrct2/world/Scenery.h | 2 +- src/openrct2/world/SmallScenery.cpp | 2 +- 8 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index c8cb601990..437938f21b 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -467,7 +467,7 @@ static void viewport_interaction_remove_scenery(rct_tile_element* tileElement, i { gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( - x, (tileElement->type << 8) | GAME_COMMAND_FLAG_APPLY, y, + x, (tileElement->AsSmallScenery()->GetSceneryQuadrant() << 8) | GAME_COMMAND_FLAG_APPLY, y, (tileElement->AsSmallScenery()->GetEntryIndex() << 8) | tileElement->base_height, GAME_COMMAND_REMOVE_SCENERY, 0, 0); } diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 9454d5a624..9184caa03a 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -2416,7 +2416,7 @@ static money32 try_place_ghost_scenery( tileElement = gSceneryTileElement; gSceneryGhostPosition.z = tileElement->base_height; - gSceneryTileElementType = tileElement->type; + gSceneryQuadrant = tileElement->AsSmallScenery()->GetSceneryQuadrant(); if (gSceneryGroundFlags & ELEMENT_IS_UNDERGROUND) { // Set underground on diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index ac1315e281..ab3f006e00 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -28,7 +28,7 @@ // This string specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "1" +#define NETWORK_STREAM_VERSION "2" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static rct_peep* _pickup_peep = nullptr; diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index f76fce801d..54406e5e23 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -816,9 +816,6 @@ static int32_t track_design_place_scenery( uint8_t quadrant = (scenery->flags >> 2) + _currentTrackPieceDirection; quadrant &= 3; - // So called because it mirrors the SmallSceneryElement->type byte. - uint8_t typeByte = rotation | (quadrant << 6) | TILE_ELEMENT_TYPE_SMALL_SCENERY; - rct_scenery_entry* small_scenery = get_small_scenery_entry(entry_index); if (!(!scenery_small_entry_has_flag(small_scenery, SMALL_SCENERY_FLAG_FULL_TILE) && scenery_small_entry_has_flag(small_scenery, SMALL_SCENERY_FLAG_DIAGONAL)) @@ -827,12 +824,12 @@ static int32_t track_design_place_scenery( SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE | SMALL_SCENERY_FLAG_THREE_QUARTERS)) { - typeByte &= ~TILE_ELEMENT_QUADRANT_MASK; + quadrant = 0; } z = (scenery->z * 8 + originZ) / 8; game_do_command( - mapCoord.x, flags | typeByte << 8, mapCoord.y, (entry_index << 8) | z, GAME_COMMAND_REMOVE_SCENERY, + mapCoord.x, flags | quadrant << 8, mapCoord.y, (entry_index << 8) | z, GAME_COMMAND_REMOVE_SCENERY, 0, 0); break; } diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 386ffcf157..f8a3f5e4dc 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -1094,7 +1094,7 @@ restart_from_beginning: if (clear & (1 << 0)) { int32_t eax = x * 32; - int32_t ebx = (tileElement->type << 8) | flags; + int32_t ebx = (tileElement->AsSmallScenery()->GetSceneryQuadrant() << 8) | flags; int32_t ecx = y * 32; int32_t edx = (tileElement->AsSmallScenery()->GetEntryIndex() << 8) | (tileElement->base_height); int32_t edi = 0, ebp = 0; diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index d990e12a72..697c8f201b 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -38,7 +38,7 @@ colour_t gWindowSceneryTertiaryColour; bool gWindowSceneryEyedropperEnabled; rct_tile_element* gSceneryTileElement; -uint8_t gSceneryTileElementType; +uint8_t gSceneryQuadrant; money32 gSceneryPlaceCost; int16_t gSceneryPlaceObject; @@ -187,7 +187,7 @@ void scenery_remove_ghost_tool_placement() uint8_t flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_GHOST; game_do_command( - x, flags | (gSceneryTileElementType << 8), y, z | (gSceneryPlaceObject << 8), GAME_COMMAND_REMOVE_SCENERY, 0, 0); + x, flags | (gSceneryQuadrant << 8), y, z | (gSceneryPlaceObject << 8), GAME_COMMAND_REMOVE_SCENERY, 0, 0); } if (gSceneryGhostType & SCENERY_ENTRY_FLAG_1) diff --git a/src/openrct2/world/Scenery.h b/src/openrct2/world/Scenery.h index 6404d64158..e8157ded05 100644 --- a/src/openrct2/world/Scenery.h +++ b/src/openrct2/world/Scenery.h @@ -266,7 +266,7 @@ extern colour_t gWindowSceneryTertiaryColour; extern bool gWindowSceneryEyedropperEnabled; extern rct_tile_element* gSceneryTileElement; -extern uint8_t gSceneryTileElementType; +extern uint8_t gSceneryQuadrant; extern money32 gSceneryPlaceCost; extern int16_t gSceneryPlaceObject; diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index 0ebfd08a11..579a5920c0 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -420,7 +420,7 @@ void game_command_remove_scenery( [[maybe_unused]] int32_t* ebp) { *ebx = SmallSceneryRemove( - *eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, ((*ebx >> 8) & 0xFF) >> 6, (*edx >> 8) & 0xFF, *ebx & 0xFF); + *eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, ((*ebx >> 8) & 0xFF), (*edx >> 8) & 0xFF, *ebx & 0xFF); } /**