Remove game command

Correct the copyright

Include correct headers
This commit is contained in:
duncanspumpkin 2019-03-10 09:20:34 +00:00
parent c9332b4c5d
commit 9fc464a322
5 changed files with 9 additions and 149 deletions

View File

@ -1280,7 +1280,7 @@ GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = {
nullptr,
nullptr,
nullptr,
game_command_change_surface_style,
nullptr,
nullptr,
game_command_set_guest_name,
game_command_set_staff_name,

View File

@ -38,12 +38,12 @@ enum GAME_COMMAND
GAME_COMMAND_PLACE_PATH, // GA
GAME_COMMAND_PLACE_PATH_FROM_TRACK, // GA
GAME_COMMAND_REMOVE_PATH, // GA
GAME_COMMAND_CHANGE_SURFACE_STYLE,
GAME_COMMAND_SET_RIDE_PRICE, // GA
GAME_COMMAND_SET_GUEST_NAME, // GA
GAME_COMMAND_SET_STAFF_NAME, // GA
GAME_COMMAND_RAISE_LAND, // GA
GAME_COMMAND_LOWER_LAND, // GA
GAME_COMMAND_CHANGE_SURFACE_STYLE, // GA
GAME_COMMAND_SET_RIDE_PRICE, // GA
GAME_COMMAND_SET_GUEST_NAME, // GA
GAME_COMMAND_SET_STAFF_NAME, // GA
GAME_COMMAND_RAISE_LAND, // GA
GAME_COMMAND_LOWER_LAND, // GA
GAME_COMMAND_EDIT_LAND_SMOOTH,
GAME_COMMAND_RAISE_WATER, // GA
GAME_COMMAND_LOWER_WATER, // GA

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
* Copyright (c) 2014-2019 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
@ -10,6 +10,7 @@
#pragma once
#include "../Context.h"
#include "../OpenRCT2.h"
#include "../management/Finance.h"
#include "../object/ObjectManager.h"
#include "../object/TerrainEdgeObject.h"

View File

@ -877,145 +877,6 @@ void game_command_set_large_scenery_colour(
*ebx = 0;
}
/**
*
* rct2: 0x00663CCD
*/
static money32 map_change_surface_style(
int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint8_t surfaceStyle, uint8_t edgeStyle, uint8_t flags)
{
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
x0 = std::max(x0, 32);
y0 = std::max(y0, 32);
x1 = std::min(x1, (int32_t)gMapSizeMaxXY);
y1 = std::min(y1, (int32_t)gMapSizeMaxXY);
int32_t xMid, yMid;
xMid = (x0 + x1) / 2 + 16;
yMid = (y0 + y1) / 2 + 16;
int32_t heightMid = tile_element_height(xMid, yMid);
gCommandPosition.x = xMid;
gCommandPosition.y = yMid;
gCommandPosition.z = heightMid;
// Do nothing during pause
if (game_is_paused() && !gCheatsBuildInPauseMode)
{
return 0;
}
// Do nothing if not in editor, sandbox mode or landscaping is forbidden
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode
&& (gParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES))
{
return 0;
}
money32 surfaceCost = 0;
money32 edgeCost = 0;
for (int32_t x = x0; x <= x1; x += 32)
{
for (int32_t y = y0; y <= y1; y += 32)
{
if (x > 0x1FFF)
continue;
if (y > 0x1FFF)
continue;
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
{
if (!map_is_location_in_park({ x, y }))
continue;
}
auto surfaceElement = map_get_surface_element_at({ x, y })->AsSurface();
if (surfaceElement == nullptr)
{
continue;
}
if (surfaceStyle != 0xFF)
{
uint8_t cur_terrain = surfaceElement->GetSurfaceStyle();
if (surfaceStyle != cur_terrain)
{
// Prevent network-originated value of surfaceStyle from causing
// invalid access.
uint8_t style = surfaceStyle & 0x1F;
auto& objManager = GetContext()->GetObjectManager();
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_SURFACE, style));
if (surfaceObj != nullptr)
{
surfaceCost += surfaceObj->Price;
}
if (flags & GAME_COMMAND_FLAG_APPLY)
{
surfaceElement->SetSurfaceStyle(surfaceStyle);
map_invalidate_tile_full(x, y);
footpath_remove_litter(x, y, tile_element_height(x, y));
}
}
}
if (edgeStyle != 0xFF)
{
uint8_t currentEdge = surfaceElement->GetEdgeStyle();
if (edgeStyle != currentEdge)
{
edgeCost += 100;
if (flags & GAME_COMMAND_FLAG_APPLY)
{
surfaceElement->SetEdgeStyle(edgeStyle);
map_invalidate_tile_full(x, y);
}
}
}
if (flags & GAME_COMMAND_FLAG_APPLY)
{
if (surfaceElement->CanGrassGrow() && (surfaceElement->GetGrassLength() & 7) != GRASS_LENGTH_CLEAR_0)
{
surfaceElement->SetGrassLength(GRASS_LENGTH_CLEAR_0);
map_invalidate_tile_full(x, y);
}
}
}
}
if (flags & GAME_COMMAND_FLAG_APPLY && gGameCommandNestLevel == 1)
{
LocationXYZ16 coord;
coord.x = ((x0 + x1) / 2) + 16;
coord.y = ((y0 + y1) / 2) + 16;
coord.z = tile_element_height(coord.x, coord.y);
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
}
return (gParkFlags & PARK_FLAGS_NO_MONEY) ? 0 : surfaceCost + edgeCost;
}
/**
*
* rct2: 0x00663CCD
*/
void game_command_change_surface_style(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, [[maybe_unused]] int32_t* esi, int32_t* edi, int32_t* ebp)
{
*ebx = map_change_surface_style(
(int16_t)(*eax & 0xFFFF), (int16_t)(*ecx & 0xFFFF), (int16_t)(*edi & 0xFFFF), (int16_t)(*ebp & 0xFFFF), *edx & 0xFF,
(*edx & 0xFF00) >> 8, *ebx & 0xFF);
}
// 0x00981A1E
// Table of pre-calculated surface slopes (32) when raising the land tile for a given selection (5)
// 0x1F = new slope

View File

@ -202,8 +202,6 @@ void game_command_set_large_scenery_colour(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
void game_command_set_banner_colour(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
void game_command_change_surface_style(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
void game_command_smooth_land(int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
void game_command_place_banner(
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);