Removal of LocationXY and simplify

This commit is contained in:
duncanspumpkin 2019-12-12 09:58:27 +00:00
parent 6b5be4765d
commit 6b72b0992d
6 changed files with 11 additions and 21 deletions

View File

@ -1257,16 +1257,13 @@ static void window_map_place_park_entrance_tool_update(ScreenCoordsXY screenCoor
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT | MAP_SELECT_FLAG_ENABLE_ARROW; gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT | MAP_SELECT_FLAG_ENABLE_ARROW;
map_invalidate_map_selection_tiles(); map_invalidate_map_selection_tiles();
if (gParkEntranceGhostExists && parkEntrancePosition.x == gParkEntranceGhostPosition.x if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition)
&& parkEntrancePosition.y == gParkEntranceGhostPosition.y
&& parkEntrancePosition.direction == gParkEntranceGhostDirection)
{ {
return; return;
} }
park_entrance_remove_ghost(); park_entrance_remove_ghost();
park_entrance_place_ghost( park_entrance_place_ghost(parkEntrancePosition);
parkEntrancePosition.x, parkEntrancePosition.y, parkEntrancePosition.z / 16, parkEntrancePosition.direction);
} }
/** /**

View File

@ -21,25 +21,21 @@
#include "WallRemoveAction.hpp" #include "WallRemoveAction.hpp"
#pragma region PlaceParkEntranceAction #pragma region PlaceParkEntranceAction
/** /**
* *
* rct2: 0x00666F4E * rct2: 0x00666F4E
*/ */
money32 park_entrance_place_ghost(int32_t x, int32_t y, int32_t z, int32_t direction) money32 park_entrance_place_ghost(CoordsXYZD entranceLoc)
{ {
park_entrance_remove_ghost(); park_entrance_remove_ghost();
auto gameAction = PlaceParkEntranceAction({ x, y, z * 16, (Direction)direction }); auto gameAction = PlaceParkEntranceAction(entranceLoc);
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST); gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
auto result = GameActions::Execute(&gameAction); auto result = GameActions::Execute(&gameAction);
if (result->Error == GA_ERROR::OK) if (result->Error == GA_ERROR::OK)
{ {
gParkEntranceGhostPosition.x = x; gParkEntranceGhostPosition = entranceLoc;
gParkEntranceGhostPosition.y = y;
gParkEntranceGhostPosition.z = z;
gParkEntranceGhostDirection = direction;
gParkEntranceGhostExists = true; gParkEntranceGhostExists = true;
} }
return result->Cost; return result->Cost;

View File

@ -30,7 +30,7 @@ enum DUCK_STATE
}; };
constexpr const int32_t DUCK_MAX_STATES = 5; constexpr const int32_t DUCK_MAX_STATES = 5;
static constexpr const LocationXY16 DuckMoveOffset[] = static constexpr const CoordsXY DuckMoveOffset[] =
{ {
{ -1, 0 }, { -1, 0 },
{ 0, 1 }, { 0, 1 },

View File

@ -29,8 +29,7 @@
#include <algorithm> #include <algorithm>
bool gParkEntranceGhostExists = false; bool gParkEntranceGhostExists = false;
LocationXYZ16 gParkEntranceGhostPosition = { 0, 0, 0 }; CoordsXYZD gParkEntranceGhostPosition = { 0, 0, 0, 0 };
uint8_t gParkEntranceGhostDirection = 0;
std::vector<CoordsXYZD> gParkEntrances; std::vector<CoordsXYZD> gParkEntrances;
CoordsXYZD gRideEntranceExitGhostPosition; CoordsXYZD gRideEntranceExitGhostPosition;
@ -56,8 +55,7 @@ void park_entrance_remove_ghost()
if (gParkEntranceGhostExists) if (gParkEntranceGhostExists)
{ {
gParkEntranceGhostExists = false; gParkEntranceGhostExists = false;
auto parkEntranceRemoveAction = ParkEntranceRemoveAction( auto parkEntranceRemoveAction = ParkEntranceRemoveAction(gParkEntranceGhostPosition);
{ gParkEntranceGhostPosition.x, gParkEntranceGhostPosition.y, gParkEntranceGhostPosition.z * 16 });
parkEntranceRemoveAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED); parkEntranceRemoveAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
GameActions::Execute(&parkEntranceRemoveAction); GameActions::Execute(&parkEntranceRemoveAction);
} }

View File

@ -29,8 +29,7 @@ assert_struct_size(rct_entrance_type, 8);
struct TileElement; struct TileElement;
extern bool gParkEntranceGhostExists; extern bool gParkEntranceGhostExists;
extern LocationXYZ16 gParkEntranceGhostPosition; extern CoordsXYZD gParkEntranceGhostPosition;
extern uint8_t gParkEntranceGhostDirection;
#define MAX_PARK_ENTRANCES 4 #define MAX_PARK_ENTRANCES 4
@ -42,7 +41,7 @@ extern CoordsXYZD gRideEntranceExitGhostPosition;
extern uint8_t gRideEntranceExitGhostStationIndex; extern uint8_t gRideEntranceExitGhostStationIndex;
void park_entrance_remove_ghost(); void park_entrance_remove_ghost();
money32 park_entrance_place_ghost(int32_t x, int32_t y, int32_t z, int32_t direction); money32 park_entrance_place_ghost(CoordsXYZD entranceLoc);
void reset_park_entrance(); void reset_park_entrance();
void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement); void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement);

View File

@ -16,7 +16,7 @@
#include "Map.h" #include "Map.h"
#include "Sprite.h" #include "Sprite.h"
static constexpr const LocationXY16 _moneyEffectMoveOffset[] = { { 1, -1 }, { 1, 1 }, { -1, 1 }, { -1, -1 } }; static constexpr const CoordsXY _moneyEffectMoveOffset[] = { { 1, -1 }, { 1, 1 }, { -1, 1 }, { -1, -1 } };
bool rct_sprite::IsMoneyEffect() bool rct_sprite::IsMoneyEffect()
{ {