mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor GAME_COMMAND_REMOVE_WALL to game action.
This commit is contained in:
parent
5284b67546
commit
b0f7435e9d
|
@ -510,14 +510,7 @@ static void window_sign_small_mouseup(rct_window *w, rct_widgetindex widgetIndex
|
||||||
tile_element++;
|
tile_element++;
|
||||||
}
|
}
|
||||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||||
game_do_command(
|
wall_remove(x, y, tile_element->base_height, tile_element_get_direction(tile_element), GAME_COMMAND_FLAG_APPLY);
|
||||||
x,
|
|
||||||
1 | (tile_element->GetDirection() << 8),
|
|
||||||
y,
|
|
||||||
(tile_element->base_height << 8) | tile_element->GetDirection(),
|
|
||||||
GAME_COMMAND_REMOVE_WALL,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
break;
|
break;
|
||||||
case WIDX_SIGN_TEXT:
|
case WIDX_SIGN_TEXT:
|
||||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE){
|
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE){
|
||||||
|
|
|
@ -66,7 +66,7 @@ enum GAME_COMMAND
|
||||||
GAME_COMMAND_SET_PARK_ENTRANCE_FEE, // GA
|
GAME_COMMAND_SET_PARK_ENTRANCE_FEE, // GA
|
||||||
GAME_COMMAND_SET_STAFF_COLOUR, // GA
|
GAME_COMMAND_SET_STAFF_COLOUR, // GA
|
||||||
GAME_COMMAND_PLACE_WALL,
|
GAME_COMMAND_PLACE_WALL,
|
||||||
GAME_COMMAND_REMOVE_WALL,
|
GAME_COMMAND_REMOVE_WALL, // GA
|
||||||
GAME_COMMAND_PLACE_LARGE_SCENERY,
|
GAME_COMMAND_PLACE_LARGE_SCENERY,
|
||||||
GAME_COMMAND_REMOVE_LARGE_SCENERY,
|
GAME_COMMAND_REMOVE_LARGE_SCENERY,
|
||||||
GAME_COMMAND_SET_CURRENT_LOAN, // GA
|
GAME_COMMAND_SET_CURRENT_LOAN, // GA
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "RideDemolishAction.hpp"
|
#include "RideDemolishAction.hpp"
|
||||||
#include "PlacePeepSpawnAction.hpp"
|
#include "PlacePeepSpawnAction.hpp"
|
||||||
#include "MazeSetTrackAction.hpp"
|
#include "MazeSetTrackAction.hpp"
|
||||||
|
#include "WallRemoveAction.hpp"
|
||||||
|
|
||||||
#pragma region PlaceParkEntranceAction
|
#pragma region PlaceParkEntranceAction
|
||||||
money32 place_park_entrance(sint16 x, sint16 y, sint16 z, uint8 direction)
|
money32 place_park_entrance(sint16 x, sint16 y, sint16 z, uint8 direction)
|
||||||
|
@ -344,3 +345,36 @@
|
||||||
Guard::Assert(false, "GAME_COMMAND_SET_MAZE_TRACK DEPRECATED");
|
Guard::Assert(false, "GAME_COMMAND_SET_MAZE_TRACK DEPRECATED");
|
||||||
}
|
}
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma region RemoveWall
|
||||||
|
money32 wall_remove(sint16 x, sint16 y, uint8 baseHeight, uint8 direction, uint8 flags)
|
||||||
|
{
|
||||||
|
auto gameAction = WallRemoveAction(x, y, baseHeight, direction);
|
||||||
|
gameAction.SetFlags(flags);
|
||||||
|
|
||||||
|
// FIXME: The callee should probably use the game action directly
|
||||||
|
// once everything is compiled as cpp.
|
||||||
|
money32 cost = 0;
|
||||||
|
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||||
|
{
|
||||||
|
auto res = GameActions::Execute(&gameAction);
|
||||||
|
cost = res->Cost;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto res = GameActions::Query(&gameAction);
|
||||||
|
cost = res->Cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cost;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* rct2: 0x006E5597
|
||||||
|
*/
|
||||||
|
void game_command_remove_wall(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp)
|
||||||
|
{
|
||||||
|
Guard::Assert(false, "GAME_COMMAND_REMOVE_WALL DEPRECATED");
|
||||||
|
}
|
||||||
|
#pragma endregion
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "SignSetNameAction.hpp"
|
#include "SignSetNameAction.hpp"
|
||||||
#include "ParkSetNameAction.hpp"
|
#include "ParkSetNameAction.hpp"
|
||||||
#include "BannerSetNameAction.hpp"
|
#include "BannerSetNameAction.hpp"
|
||||||
|
#include "WallRemoveAction.hpp"
|
||||||
|
|
||||||
namespace GameActions
|
namespace GameActions
|
||||||
{
|
{
|
||||||
|
@ -54,5 +55,6 @@ namespace GameActions
|
||||||
Register<SignSetNameAction>();
|
Register<SignSetNameAction>();
|
||||||
Register<ParkSetNameAction>();
|
Register<ParkSetNameAction>();
|
||||||
Register<BannerSetNameAction>();
|
Register<BannerSetNameAction>();
|
||||||
|
Register<WallRemoveAction>();
|
||||||
}
|
}
|
||||||
} // namespace GameActions
|
} // namespace GameActions
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
|
||||||
|
/*****************************************************************************
|
||||||
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||||
|
*
|
||||||
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||||
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* A full copy of the GNU General Public License can be found in licence.txt
|
||||||
|
*****************************************************************************/
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../core/MemoryStream.h"
|
||||||
|
#include "../localisation/StringIds.h"
|
||||||
|
#include "GameAction.h"
|
||||||
|
|
||||||
|
#include "../Cheats.h"
|
||||||
|
#include "../interface/Window.h"
|
||||||
|
#include "../world/Wall.h"
|
||||||
|
|
||||||
|
struct WallRemoveAction : public GameActionBase<GAME_COMMAND_REMOVE_WALL, GameActionResult>
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
sint32 _x;
|
||||||
|
sint32 _y;
|
||||||
|
uint8 _baseHeight;
|
||||||
|
uint8 _direction;
|
||||||
|
|
||||||
|
public:
|
||||||
|
WallRemoveAction() {}
|
||||||
|
WallRemoveAction(sint16 x, sint16 y, uint8 baseHeight, uint8 direction) :
|
||||||
|
_x(x),
|
||||||
|
_y(y),
|
||||||
|
_baseHeight(baseHeight),
|
||||||
|
_direction(direction)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16 GetActionFlags() const override
|
||||||
|
{
|
||||||
|
return GameAction::GetActionFlags();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Serialise(DataSerialiser& stream) override
|
||||||
|
{
|
||||||
|
GameAction::Serialise(stream);
|
||||||
|
|
||||||
|
stream << _x << _y << _baseHeight << _direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameActionResult::Ptr Query() const override
|
||||||
|
{
|
||||||
|
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||||
|
res->Cost = 0;
|
||||||
|
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||||
|
|
||||||
|
if (!map_is_location_valid(_x, _y))
|
||||||
|
{
|
||||||
|
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||||
|
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
|
||||||
|
if (!isGhost &&
|
||||||
|
!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) &&
|
||||||
|
!gCheatsSandboxMode &&
|
||||||
|
!map_is_location_owned(_x, _y, _baseHeight * 8))
|
||||||
|
{
|
||||||
|
res->Error = GA_ERROR::NOT_OWNED;
|
||||||
|
res->ErrorMessage = STR_CANT_REMOVE_THIS;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
rct_tile_element * wallElement = GetFirstWallElementAt(_x, _y, _baseHeight, _direction, isGhost);
|
||||||
|
if (wallElement == nullptr)
|
||||||
|
{
|
||||||
|
// NOTE: There seems to be some oddities with calling code currently trying to
|
||||||
|
// delete the same thing multiple times.
|
||||||
|
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||||
|
res->ErrorMessage = STR_NONE;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
res->Cost = 0;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameActionResult::Ptr Execute() const override
|
||||||
|
{
|
||||||
|
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||||
|
res->Cost = 0;
|
||||||
|
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||||
|
|
||||||
|
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
|
||||||
|
|
||||||
|
rct_tile_element * wallElement = GetFirstWallElementAt(_x, _y, _baseHeight, _direction, isGhost);
|
||||||
|
if (wallElement == nullptr)
|
||||||
|
{
|
||||||
|
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||||
|
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
res->Position.x = _x + 16;
|
||||||
|
res->Position.y = _y + 16;
|
||||||
|
res->Position.z = tile_element_height(res->Position.x, res->Position.y);
|
||||||
|
|
||||||
|
tile_element_remove_banner_entry(wallElement);
|
||||||
|
map_invalidate_tile_zoom1(_x, _y, wallElement->base_height * 8, (wallElement->base_height * 8) + 72);
|
||||||
|
tile_element_remove(wallElement);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
rct_tile_element * GetFirstWallElementAt(sint32 x, sint32 y, uint8 baseZ, uint8 direction, bool isGhost) const
|
||||||
|
{
|
||||||
|
rct_tile_element * tileElement = map_get_first_element_at(x / 32, y / 32);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (tile_element_get_type(tileElement) != TILE_ELEMENT_TYPE_WALL) continue;
|
||||||
|
if (tileElement->base_height != baseZ) continue;
|
||||||
|
if ((tile_element_get_direction(tileElement)) != direction) continue;
|
||||||
|
if (tile_element_is_ghost(tileElement) != isGhost) continue;
|
||||||
|
return tileElement;
|
||||||
|
} while (!tile_element_is_last_for_tile(tileElement++));
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
};
|
|
@ -30,9 +30,10 @@
|
||||||
#include "../world/Map.h"
|
#include "../world/Map.h"
|
||||||
#include "../world/Scenery.h"
|
#include "../world/Scenery.h"
|
||||||
#include "../world/LargeScenery.h"
|
#include "../world/LargeScenery.h"
|
||||||
|
#include "../world/Park.h"
|
||||||
#include "../world/Sprite.h"
|
#include "../world/Sprite.h"
|
||||||
#include "../world/Surface.h"
|
#include "../world/Surface.h"
|
||||||
#include "../world/Park.h"
|
#include "../world/Wall.h"
|
||||||
#include "Viewport.h"
|
#include "Viewport.h"
|
||||||
#include "Window_internal.h"
|
#include "Window_internal.h"
|
||||||
#include "../Context.h"
|
#include "../Context.h"
|
||||||
|
@ -514,15 +515,7 @@ static void viewport_interaction_remove_park_wall(rct_tile_element *tileElement,
|
||||||
context_open_detail_window(WD_SIGN_SMALL, tileElement->properties.wall.banner_index);
|
context_open_detail_window(WD_SIGN_SMALL, tileElement->properties.wall.banner_index);
|
||||||
} else {
|
} else {
|
||||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||||
game_do_command(
|
wall_remove(x, y, tileElement->base_height, tile_element_get_direction(tileElement), GAME_COMMAND_FLAG_APPLY);
|
||||||
x,
|
|
||||||
GAME_COMMAND_FLAG_APPLY,
|
|
||||||
y,
|
|
||||||
tile_element_get_direction(tileElement) | (tileElement->base_height << 8),
|
|
||||||
GAME_COMMAND_REMOVE_WALL,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "../world/Scenery.h"
|
#include "../world/Scenery.h"
|
||||||
#include "../world/SmallScenery.h"
|
#include "../world/SmallScenery.h"
|
||||||
#include "../world/Surface.h"
|
#include "../world/Surface.h"
|
||||||
|
#include "../world/Wall.h"
|
||||||
|
|
||||||
struct map_backup
|
struct map_backup
|
||||||
{
|
{
|
||||||
|
@ -859,14 +860,7 @@ track_design_place_scenery(rct_td6_scenery_element * scenery_start, sint32 origi
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE_WALLS:
|
case OBJECT_TYPE_WALLS:
|
||||||
z = (scenery->z * 8 + originZ) / 8;
|
z = (scenery->z * 8 + originZ) / 8;
|
||||||
game_do_command(
|
wall_remove(mapCoord.x, mapCoord.y, z, (rotation + scenery->flags) & TILE_ELEMENT_DIRECTION_MASK, flags);
|
||||||
mapCoord.x,
|
|
||||||
flags,
|
|
||||||
mapCoord.y,
|
|
||||||
(z << 8) | ((rotation + scenery->flags) & 0x3),
|
|
||||||
GAME_COMMAND_REMOVE_WALL,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
break;
|
break;
|
||||||
case OBJECT_TYPE_PATHS:
|
case OBJECT_TYPE_PATHS:
|
||||||
z = (scenery->z * 8 + originZ) / 8;
|
z = (scenery->z * 8 + originZ) / 8;
|
||||||
|
|
|
@ -1100,6 +1100,7 @@ restart_from_beginning:
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
|
|
||||||
totalCost += cost;
|
totalCost += cost;
|
||||||
|
|
||||||
if (flags & 1)
|
if (flags & 1)
|
||||||
goto restart_from_beginning;
|
goto restart_from_beginning;
|
||||||
} break;
|
} break;
|
||||||
|
@ -1116,25 +1117,26 @@ restart_from_beginning:
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
|
|
||||||
totalCost += cost;
|
totalCost += cost;
|
||||||
|
|
||||||
if (flags & 1)
|
if (flags & 1)
|
||||||
goto restart_from_beginning;
|
goto restart_from_beginning;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TILE_ELEMENT_TYPE_WALL:
|
case TILE_ELEMENT_TYPE_WALL:
|
||||||
if (clear & (1 << 0)) {
|
if (clear & (1 << 0)) {
|
||||||
sint32 eax = x * 32;
|
cost = wall_remove(x * 32, y * 32, tileElement->base_height, tile_element_get_direction(tileElement), flags);
|
||||||
sint32 ebx = flags;
|
|
||||||
sint32 ecx = y * 32;
|
|
||||||
sint32 edx = (tileElement->base_height << 8) | (tile_element_get_direction(tileElement));
|
|
||||||
sint32 edi = 0, ebp = 0;
|
|
||||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_WALL, edi, ebp);
|
|
||||||
|
|
||||||
if (cost == MONEY32_UNDEFINED)
|
if (cost == MONEY32_UNDEFINED)
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
|
|
||||||
totalCost += cost;
|
totalCost += cost;
|
||||||
|
|
||||||
|
// NOTE (12/10/2017): This will get us stuck in an infinite loop because game actions are queued
|
||||||
|
// it seems to be trying to remove the same thing over and over.
|
||||||
|
// Leaving this here for reference.
|
||||||
|
/*
|
||||||
if (flags & 1)
|
if (flags & 1)
|
||||||
goto restart_from_beginning;
|
goto restart_from_beginning;
|
||||||
|
*/
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
||||||
|
@ -1150,6 +1152,7 @@ restart_from_beginning:
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
|
|
||||||
totalCost += cost;
|
totalCost += cost;
|
||||||
|
|
||||||
if (flags & 1)
|
if (flags & 1)
|
||||||
goto restart_from_beginning;
|
goto restart_from_beginning;
|
||||||
|
|
||||||
|
@ -3762,15 +3765,7 @@ static void clear_element_at(sint32 x, sint32 y, rct_tile_element **elementPtr)
|
||||||
break;
|
break;
|
||||||
case TILE_ELEMENT_TYPE_WALL:
|
case TILE_ELEMENT_TYPE_WALL:
|
||||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||||
game_do_command(
|
wall_remove(x, y, tile_element_get_direction(element), element->base_height, GAME_COMMAND_FLAG_APPLY);
|
||||||
x,
|
|
||||||
GAME_COMMAND_FLAG_APPLY,
|
|
||||||
y,
|
|
||||||
tile_element_get_direction(element) | (element->base_height << 8),
|
|
||||||
GAME_COMMAND_REMOVE_WALL,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
||||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "Park.h"
|
#include "Park.h"
|
||||||
#include "Scenery.h"
|
#include "Scenery.h"
|
||||||
#include "SmallScenery.h"
|
#include "SmallScenery.h"
|
||||||
|
#include "Wall.h"
|
||||||
|
|
||||||
uint8 gWindowSceneryActiveTabIndex;
|
uint8 gWindowSceneryActiveTabIndex;
|
||||||
uint16 gWindowSceneryTabSelections[20];
|
uint16 gWindowSceneryTabSelections[20];
|
||||||
|
@ -244,14 +245,8 @@ void scenery_remove_ghost_tool_placement(){
|
||||||
|
|
||||||
if (gSceneryGhostType & SCENERY_ENTRY_FLAG_2){
|
if (gSceneryGhostType & SCENERY_ENTRY_FLAG_2){
|
||||||
gSceneryGhostType &= ~SCENERY_ENTRY_FLAG_2;
|
gSceneryGhostType &= ~SCENERY_ENTRY_FLAG_2;
|
||||||
game_do_command(
|
const sint32 flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_PATH_SCENERY;
|
||||||
x,
|
wall_remove(x, y, gSceneryGhostWallRotation, z, flags);
|
||||||
105 | (gSceneryTileElementType << 8),
|
|
||||||
y,
|
|
||||||
gSceneryGhostWallRotation |(z << 8),
|
|
||||||
GAME_COMMAND_REMOVE_WALL,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gSceneryGhostType & SCENERY_ENTRY_FLAG_3){
|
if (gSceneryGhostType & SCENERY_ENTRY_FLAG_3){
|
||||||
|
|
|
@ -577,67 +577,6 @@ static money32 WallPlace(uint8 wallType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static rct_tile_element * GetFirstWallElementAt(sint32 x, sint32 y, uint8 baseZ, uint8 direction, bool isGhost)
|
|
||||||
{
|
|
||||||
rct_tile_element * tileElement = map_get_first_element_at(x / 32, y / 32);
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL) continue;
|
|
||||||
if (tileElement->base_height != baseZ) continue;
|
|
||||||
if ((tile_element_get_direction(tileElement)) != direction) continue;
|
|
||||||
if (tile_element_is_ghost(tileElement) != isGhost) continue;
|
|
||||||
return tileElement;
|
|
||||||
}
|
|
||||||
while (!tile_element_is_last_for_tile(tileElement++));
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static money32 WallRemove(sint16 x, sint16 y, uint8 baseHeight, uint8 direction, uint8 flags)
|
|
||||||
{
|
|
||||||
if (!map_is_location_valid(x, y))
|
|
||||||
{
|
|
||||||
return MONEY32_UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
|
||||||
bool isGhost = (flags & GAME_COMMAND_FLAG_GHOST) != 0;
|
|
||||||
if (!isGhost &&
|
|
||||||
game_is_paused() &&
|
|
||||||
!gCheatsBuildInPauseMode)
|
|
||||||
{
|
|
||||||
gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
|
|
||||||
return MONEY32_UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isGhost &&
|
|
||||||
!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) &&
|
|
||||||
!gCheatsSandboxMode &&
|
|
||||||
!map_is_location_owned(x, y, baseHeight * 8))
|
|
||||||
{
|
|
||||||
return MONEY32_UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
rct_tile_element * wallElement = GetFirstWallElementAt(x, y, baseHeight, direction, isGhost);
|
|
||||||
if (!(flags & GAME_COMMAND_FLAG_APPLY) || (wallElement == nullptr))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gGameCommandNestLevel == 1 && !isGhost)
|
|
||||||
{
|
|
||||||
LocationXYZ16 coord;
|
|
||||||
coord.x = x + 16;
|
|
||||||
coord.y = y + 16;
|
|
||||||
coord.z = tile_element_height(coord.x, coord.y);
|
|
||||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
|
||||||
}
|
|
||||||
|
|
||||||
tile_element_remove_banner_entry(wallElement);
|
|
||||||
map_invalidate_tile_zoom1(x, y, wallElement->base_height * 8, (wallElement->base_height * 8) + 72);
|
|
||||||
tile_element_remove(wallElement);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static money32 WallSetColour(sint16 x,
|
static money32 WallSetColour(sint16 x,
|
||||||
sint16 y,
|
sint16 y,
|
||||||
uint8 baseHeight,
|
uint8 baseHeight,
|
||||||
|
@ -851,27 +790,6 @@ money32 wall_place(sint32 type,
|
||||||
return ebx;
|
return ebx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* rct2: 0x006E5597
|
|
||||||
*/
|
|
||||||
void game_command_remove_wall(sint32 * eax,
|
|
||||||
sint32 * ebx,
|
|
||||||
sint32 * ecx,
|
|
||||||
sint32 * edx,
|
|
||||||
[[maybe_unused]] sint32 * esi,
|
|
||||||
[[maybe_unused]] sint32 * edi,
|
|
||||||
[[maybe_unused]] sint32 * ebp)
|
|
||||||
{
|
|
||||||
*ebx = WallRemove(
|
|
||||||
*eax & 0xFFFF,
|
|
||||||
*ecx & 0xFFFF,
|
|
||||||
(*edx >> 8) & 0xFF,
|
|
||||||
*edx & 0xFF,
|
|
||||||
*ebx & 0xFF
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006E56B5
|
* rct2: 0x006E56B5
|
||||||
|
|
|
@ -35,3 +35,4 @@ void wall_set_tertiary_colour(rct_tile_element * tileElement, colour_t colour);
|
||||||
uint8 wall_get_animation_frame(const rct_tile_element * fenceElement);
|
uint8 wall_get_animation_frame(const rct_tile_element * fenceElement);
|
||||||
void wall_set_animation_frame(rct_tile_element * wallElement, uint8 frameNum);
|
void wall_set_animation_frame(rct_tile_element * wallElement, uint8 frameNum);
|
||||||
|
|
||||||
|
money32 wall_remove(sint16 x, sint16 y, uint8 baseHeight, uint8 direction, uint8 flags);
|
||||||
|
|
Loading…
Reference in New Issue