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;
map_invalidate_map_selection_tiles();
if (gParkEntranceGhostExists && parkEntrancePosition.x == gParkEntranceGhostPosition.x
&& parkEntrancePosition.y == gParkEntranceGhostPosition.y
&& parkEntrancePosition.direction == gParkEntranceGhostDirection)
if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition)
{
return;
}
park_entrance_remove_ghost();
park_entrance_place_ghost(
parkEntrancePosition.x, parkEntrancePosition.y, parkEntrancePosition.z / 16, parkEntrancePosition.direction);
park_entrance_place_ghost(parkEntrancePosition);
}
/**

View File

@ -21,25 +21,21 @@
#include "WallRemoveAction.hpp"
#pragma region PlaceParkEntranceAction
/**
*
* 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();
auto gameAction = PlaceParkEntranceAction({ x, y, z * 16, (Direction)direction });
auto gameAction = PlaceParkEntranceAction(entranceLoc);
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
auto result = GameActions::Execute(&gameAction);
if (result->Error == GA_ERROR::OK)
{
gParkEntranceGhostPosition.x = x;
gParkEntranceGhostPosition.y = y;
gParkEntranceGhostPosition.z = z;
gParkEntranceGhostDirection = direction;
gParkEntranceGhostPosition = entranceLoc;
gParkEntranceGhostExists = true;
}
return result->Cost;

View File

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

View File

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

View File

@ -29,8 +29,7 @@ assert_struct_size(rct_entrance_type, 8);
struct TileElement;
extern bool gParkEntranceGhostExists;
extern LocationXYZ16 gParkEntranceGhostPosition;
extern uint8_t gParkEntranceGhostDirection;
extern CoordsXYZD gParkEntranceGhostPosition;
#define MAX_PARK_ENTRANCES 4
@ -42,7 +41,7 @@ extern CoordsXYZD gRideEntranceExitGhostPosition;
extern uint8_t gRideEntranceExitGhostStationIndex;
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 maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement);

View File

@ -16,7 +16,7 @@
#include "Map.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()
{