mirror of https://github.com/OpenRCT2/OpenRCT2.git
Apply the cpp style guide
This commit is contained in:
parent
ffeb1fa527
commit
9725e6b647
|
@ -527,7 +527,7 @@ static void window_map_toolabort(rct_window *w, sint32 widgetIndex)
|
||||||
hide_construction_rights();
|
hide_construction_rights();
|
||||||
break;
|
break;
|
||||||
case WIDX_BUILD_PARK_ENTRANCE:
|
case WIDX_BUILD_PARK_ENTRANCE:
|
||||||
park_entrance_ghost();
|
park_entrance_remove_ghost();
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
hide_gridlines();
|
hide_gridlines();
|
||||||
hide_land_rights();
|
hide_land_rights();
|
||||||
|
@ -1244,7 +1244,7 @@ static void window_map_place_park_entrance_tool_update(sint32 x, sint32 y)
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||||
sub_666EEF(x, y, &mapX, &mapY, &mapZ, &direction);
|
sub_666EEF(x, y, &mapX, &mapY, &mapZ, &direction);
|
||||||
if (mapX == (sint16)-1) {
|
if (mapX == (sint16)-1) {
|
||||||
park_entrance_ghost();
|
park_entrance_remove_ghost();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1269,7 +1269,7 @@ static void window_map_place_park_entrance_tool_update(sint32 x, sint32 y)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
park_entrance_ghost();
|
park_entrance_remove_ghost();
|
||||||
gParkEntranceGhostPrice = park_entrance_place_ghost(mapX, mapY, mapZ, direction);
|
gParkEntranceGhostPrice = park_entrance_place_ghost(mapX, mapY, mapZ, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1317,7 +1317,7 @@ static void window_map_set_peep_spawn_tool_update(sint32 x, sint32 y)
|
||||||
*/
|
*/
|
||||||
static void window_map_place_park_entrance_tool_down(sint32 x, sint32 y)
|
static void window_map_place_park_entrance_tool_down(sint32 x, sint32 y)
|
||||||
{
|
{
|
||||||
park_entrance_ghost();
|
park_entrance_remove_ghost();
|
||||||
|
|
||||||
sint16 mapX, mapY, mapZ;
|
sint16 mapX, mapY, mapZ;
|
||||||
sint32 direction;
|
sint32 direction;
|
||||||
|
|
|
@ -35,8 +35,10 @@ money32 gParkEntranceGhostPrice;
|
||||||
|
|
||||||
rct_xyzd16 gParkEntrances[MAX_PARK_ENTRANCES];
|
rct_xyzd16 gParkEntrances[MAX_PARK_ENTRANCES];
|
||||||
|
|
||||||
static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, sint16 z, uint8 direction) {
|
static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, uint8 z, uint8 direction)
|
||||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode) {
|
{
|
||||||
|
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||||
|
{
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,53 +46,63 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, sint16 z, uin
|
||||||
|
|
||||||
gCommandPosition.x = x;
|
gCommandPosition.x = x;
|
||||||
gCommandPosition.y = y;
|
gCommandPosition.y = y;
|
||||||
// ??
|
gCommandPosition.z = z * 16;
|
||||||
gCommandPosition.z = (z & 0xFF) << 4;
|
|
||||||
|
|
||||||
if (!map_check_free_elements_and_reorganise(3)) {
|
if (!map_check_free_elements_and_reorganise(3))
|
||||||
|
{
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x <= 32 || y <= 32 || x >= (gMapSizeUnits - 32) || y >= (gMapSizeUnits - 32)) {
|
if (x <= 32 || y <= 32 || x >= (gMapSizeUnits - 32) || y >= (gMapSizeUnits - 32))
|
||||||
|
{
|
||||||
gGameCommandErrorText = STR_TOO_CLOSE_TO_EDGE_OF_MAP;
|
gGameCommandErrorText = STR_TOO_CLOSE_TO_EDGE_OF_MAP;
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 entranceNum = -1;
|
sint8 entranceNum = -1;
|
||||||
for (uint8 i = 0; i < MAX_PARK_ENTRANCES; ++i) {
|
for (uint8 i = 0; i < MAX_PARK_ENTRANCES; ++i)
|
||||||
if (gParkEntrances[i].x == MAP_LOCATION_NULL) {
|
{
|
||||||
|
if (gParkEntrances[i].x == MAP_LOCATION_NULL)
|
||||||
|
{
|
||||||
entranceNum = i;
|
entranceNum = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entranceNum == -1) {
|
if (entranceNum == -1)
|
||||||
|
{
|
||||||
gGameCommandErrorText = STR_ERR_TOO_MANY_PARK_ENTRANCES;
|
gGameCommandErrorText = STR_ERR_TOO_MANY_PARK_ENTRANCES;
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||||
|
{
|
||||||
gParkEntrances[entranceNum].x = x;
|
gParkEntrances[entranceNum].x = x;
|
||||||
gParkEntrances[entranceNum].y = y;
|
gParkEntrances[entranceNum].y = y;
|
||||||
gParkEntrances[entranceNum].z = (z & 0xFF) << 4;
|
gParkEntrances[entranceNum].z = z * 16;
|
||||||
gParkEntrances[entranceNum].direction = direction;
|
gParkEntrances[entranceNum].direction = direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
sint8 zLow = (z & 0xFF) * 2;
|
sint8 zLow = z * 2;
|
||||||
sint8 zHigh = zLow + 12;
|
sint8 zHigh = zLow + 12;
|
||||||
|
|
||||||
for (uint8 index = 0; index < 3; index++) {
|
for (uint8 index = 0; index < 3; index++)
|
||||||
if (index == 1) {
|
{
|
||||||
|
if (index == 1)
|
||||||
|
{
|
||||||
x += TileDirectionDelta[(direction - 1) & 0x3].x;
|
x += TileDirectionDelta[(direction - 1) & 0x3].x;
|
||||||
y += TileDirectionDelta[(direction - 1) & 0x3].y;
|
y += TileDirectionDelta[(direction - 1) & 0x3].y;
|
||||||
}
|
}
|
||||||
else if (index == 2) {
|
else if (index == 2)
|
||||||
|
{
|
||||||
x += TileDirectionDelta[(direction + 1) & 0x3].x * 2;
|
x += TileDirectionDelta[(direction + 1) & 0x3].x * 2;
|
||||||
y += TileDirectionDelta[(direction + 1) & 0x3].y * 2;
|
y += TileDirectionDelta[(direction + 1) & 0x3].y * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gCheatsDisableClearanceChecks) {
|
if (!gCheatsDisableClearanceChecks)
|
||||||
if (!map_can_construct_at(x, y, zLow, zHigh, 0xF)) {
|
{
|
||||||
|
if (!map_can_construct_at(x, y, zLow, zHigh, 0xF))
|
||||||
|
{
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,12 +110,17 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, sint16 z, uin
|
||||||
// Check that entrance element does not already exist at this location
|
// Check that entrance element does not already exist at this location
|
||||||
rct_map_element* entranceElement = map_get_park_entrance_element_at(x, y, zLow, false);
|
rct_map_element* entranceElement = map_get_park_entrance_element_at(x, y, zLow, false);
|
||||||
if (entranceElement != NULL)
|
if (entranceElement != NULL)
|
||||||
|
{
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(flags & GAME_COMMAND_FLAG_GHOST)) {
|
if (!(flags & GAME_COMMAND_FLAG_GHOST))
|
||||||
|
{
|
||||||
rct_map_element* surfaceElement = map_get_surface_element_at(x / 32, y / 32);
|
rct_map_element* surfaceElement = map_get_surface_element_at(x / 32, y / 32);
|
||||||
surfaceElement->properties.surface.ownership = 0;
|
surfaceElement->properties.surface.ownership = 0;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +129,8 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, sint16 z, uin
|
||||||
assert(newElement != NULL);
|
assert(newElement != NULL);
|
||||||
newElement->clearance_height = zHigh;
|
newElement->clearance_height = zHigh;
|
||||||
|
|
||||||
if (flags & GAME_COMMAND_FLAG_GHOST) {
|
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||||
|
{
|
||||||
newElement->flags |= MAP_ELEMENT_FLAG_GHOST;
|
newElement->flags |= MAP_ELEMENT_FLAG_GHOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,9 +138,10 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, sint16 z, uin
|
||||||
newElement->type |= direction;
|
newElement->type |= direction;
|
||||||
newElement->properties.entrance.index = index;
|
newElement->properties.entrance.index = index;
|
||||||
newElement->properties.entrance.type = ENTRANCE_TYPE_PARK_ENTRANCE;
|
newElement->properties.entrance.type = ENTRANCE_TYPE_PARK_ENTRANCE;
|
||||||
newElement->properties.entrance.path_type = gFootpathSelectedId & 0xFF;
|
newElement->properties.entrance.path_type = gFootpathSelectedId;
|
||||||
|
|
||||||
if (!(flags & GAME_COMMAND_FLAG_GHOST)) {
|
if (!(flags & GAME_COMMAND_FLAG_GHOST))
|
||||||
|
{
|
||||||
footpath_connect_edges(x, y, newElement, 1);
|
footpath_connect_edges(x, y, newElement, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +153,8 @@ static money32 ParkEntrancePlace(sint32 flags, sint16 x, sint16 y, sint16 z, uin
|
||||||
|
|
||||||
map_invalidate_tile(x, y, newElement->base_height * 8, newElement->clearance_height * 8);
|
map_invalidate_tile(x, y, newElement->base_height * 8, newElement->clearance_height * 8);
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0)
|
||||||
|
{
|
||||||
map_animation_create(MAP_ANIMATION_TYPE_PARK_ENTRANCE, x, y, zLow);
|
map_animation_create(MAP_ANIMATION_TYPE_PARK_ENTRANCE, x, y, zLow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +167,9 @@ static void ParkEntranceRemoveSegment(sint32 x, sint32 y, sint32 z)
|
||||||
|
|
||||||
mapElement = map_get_park_entrance_element_at(x, y, z, true);
|
mapElement = map_get_park_entrance_element_at(x, y, z, true);
|
||||||
if (mapElement == NULL)
|
if (mapElement == NULL)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
map_invalidate_tile(x, y, mapElement->base_height * 8, mapElement->clearance_height * 8);
|
map_invalidate_tile(x, y, mapElement->base_height * 8, mapElement->clearance_height * 8);
|
||||||
map_element_remove(mapElement);
|
map_element_remove(mapElement);
|
||||||
|
@ -158,7 +180,8 @@ static money32 ParkEntranceRemove(sint16 x, sint16 y, uint8 z, uint8 flags)
|
||||||
{
|
{
|
||||||
sint32 entranceIndex, direction;
|
sint32 entranceIndex, direction;
|
||||||
|
|
||||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode) {
|
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||||
|
{
|
||||||
return MONEY32_UNDEFINED;
|
return MONEY32_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,12 +190,14 @@ static money32 ParkEntranceRemove(sint16 x, sint16 y, uint8 z, uint8 flags)
|
||||||
gCommandPosition.y = y;
|
gCommandPosition.y = y;
|
||||||
gCommandPosition.z = z * 16;
|
gCommandPosition.z = z * 16;
|
||||||
|
|
||||||
if (!(flags & GAME_COMMAND_FLAG_APPLY)) {
|
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
entranceIndex = park_get_entrance_index(x, y, z * 16);
|
entranceIndex = park_get_entrance_index(x, y, z * 16);
|
||||||
if (entranceIndex == -1) {
|
if (entranceIndex == -1)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,12 +231,19 @@ extern "C"
|
||||||
*
|
*
|
||||||
* rct2: 0x006666E7
|
* rct2: 0x006666E7
|
||||||
*/
|
*/
|
||||||
void game_command_place_park_entrance(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp) {
|
void game_command_place_park_entrance(sint32* eax,
|
||||||
|
sint32* ebx,
|
||||||
|
sint32* ecx,
|
||||||
|
sint32* edx,
|
||||||
|
sint32* esi,
|
||||||
|
sint32* edi,
|
||||||
|
sint32* ebp)
|
||||||
|
{
|
||||||
*ebx = ParkEntrancePlace(
|
*ebx = ParkEntrancePlace(
|
||||||
*ebx & 0xFF,
|
*ebx & 0xFF,
|
||||||
*eax & 0xFFFF,
|
*eax & 0xFFFF,
|
||||||
*ecx & 0xFFFF,
|
*ecx & 0xFFFF,
|
||||||
*edx & 0xFFFF,
|
*edx & 0xFF,
|
||||||
(*ebx >> 8) & 0xFF);
|
(*ebx >> 8) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +251,13 @@ extern "C"
|
||||||
*
|
*
|
||||||
* rct2: 0x00666A63
|
* rct2: 0x00666A63
|
||||||
*/
|
*/
|
||||||
void game_command_remove_park_entrance(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp)
|
void game_command_remove_park_entrance(sint32 *eax,
|
||||||
|
sint32 *ebx,
|
||||||
|
sint32 *ecx,
|
||||||
|
sint32 *edx,
|
||||||
|
sint32 *esi,
|
||||||
|
sint32 *edi,
|
||||||
|
sint32 *ebp)
|
||||||
{
|
{
|
||||||
*ebx = ParkEntranceRemove(
|
*ebx = ParkEntranceRemove(
|
||||||
*eax & 0xFFFF,
|
*eax & 0xFFFF,
|
||||||
|
@ -232,9 +270,10 @@ extern "C"
|
||||||
*
|
*
|
||||||
* rct2: 0x00666F9E
|
* rct2: 0x00666F9E
|
||||||
*/
|
*/
|
||||||
void park_entrance_ghost()
|
void park_entrance_remove_ghost()
|
||||||
|
{
|
||||||
|
if (gParkEntranceGhostExists)
|
||||||
{
|
{
|
||||||
if (gParkEntranceGhostExists) {
|
|
||||||
gParkEntranceGhostExists = false;
|
gParkEntranceGhostExists = false;
|
||||||
game_do_command(
|
game_do_command(
|
||||||
gParkEntranceGhostPosition.x,
|
gParkEntranceGhostPosition.x,
|
||||||
|
@ -256,7 +295,7 @@ extern "C"
|
||||||
{
|
{
|
||||||
money32 result;
|
money32 result;
|
||||||
|
|
||||||
park_entrance_ghost();
|
park_entrance_remove_ghost();
|
||||||
result = game_do_command(
|
result = game_do_command(
|
||||||
x,
|
x,
|
||||||
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED |
|
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED |
|
||||||
|
@ -270,7 +309,9 @@ extern "C"
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
if (result != MONEY32_UNDEFINED) {
|
|
||||||
|
if (result != MONEY32_UNDEFINED)
|
||||||
|
{
|
||||||
gParkEntranceGhostPosition.x = x;
|
gParkEntranceGhostPosition.x = x;
|
||||||
gParkEntranceGhostPosition.y = y;
|
gParkEntranceGhostPosition.y = y;
|
||||||
gParkEntranceGhostPosition.z = z;
|
gParkEntranceGhostPosition.z = z;
|
||||||
|
@ -285,12 +326,12 @@ extern "C"
|
||||||
{
|
{
|
||||||
sint32 i;
|
sint32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_PARK_ENTRANCES; i++) {
|
for (i = 0; i < MAX_PARK_ENTRANCES; i++)
|
||||||
if (
|
{
|
||||||
x == gParkEntrances[i].x &&
|
if (x == gParkEntrances[i].x &&
|
||||||
y == gParkEntrances[i].y &&
|
y == gParkEntrances[i].y &&
|
||||||
z == gParkEntrances[i].z
|
z == gParkEntrances[i].z)
|
||||||
) {
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,7 +341,8 @@ extern "C"
|
||||||
|
|
||||||
void reset_park_entrance()
|
void reset_park_entrance()
|
||||||
{
|
{
|
||||||
for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++) {
|
for (sint32 i = 0; i < MAX_PARK_ENTRANCES; i++)
|
||||||
|
{
|
||||||
gParkEntrances[i].x = MAP_LOCATION_NULL;
|
gParkEntrances[i].x = MAP_LOCATION_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ extern money32 gParkEntranceGhostPrice;
|
||||||
|
|
||||||
extern rct_xyzd16 gParkEntrances[MAX_PARK_ENTRANCES];
|
extern rct_xyzd16 gParkEntrances[MAX_PARK_ENTRANCES];
|
||||||
|
|
||||||
void park_entrance_ghost();
|
void park_entrance_remove_ghost();
|
||||||
money32 park_entrance_place_ghost(sint32 x, sint32 y, sint32 z, sint32 direction);
|
money32 park_entrance_place_ghost(sint32 x, sint32 y, sint32 z, sint32 direction);
|
||||||
void reset_park_entrance();
|
void reset_park_entrance();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue