From 2b7142e49f4a142d7252410da606cb1b5d6ea05f Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 15 Nov 2014 18:22:06 +0000 Subject: [PATCH] attempt to fix #566 and other bugs, also refactor some footpath related functions --- projects/openrct2.vcxproj | 2 + projects/openrct2.vcxproj.filters | 8 ++- src/input.c | 5 +- src/interface/viewport.h | 2 +- src/interface/viewport_interaction.c | 103 ++++++++++++++------------- src/windows/footpath.c | 38 +++++----- src/world/footpath.c | 66 +++++++++++++++++ src/world/footpath.h | 38 ++++++++++ 8 files changed, 186 insertions(+), 76 deletions(-) create mode 100644 src/world/footpath.c create mode 100644 src/world/footpath.h diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 5469d23c44..36f12f5fdb 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -149,6 +149,7 @@ + @@ -210,6 +211,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index b1d0f73016..0c3c203548 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -378,7 +378,6 @@ Source\Windows - Source\Drawing @@ -446,6 +445,10 @@ Source\Interface + + + Source\World + @@ -649,5 +652,8 @@ Source\Interface + + Source\World + \ No newline at end of file diff --git a/src/input.c b/src/input.c index e2ed86e9db..4600842d16 100644 --- a/src/input.c +++ b/src/input.c @@ -253,10 +253,7 @@ static void game_handle_input_mouse(int x, int y, int state) } else if (state == 4) { input_viewport_drag_end(); if (RCT2_GLOBAL(0x009DE540, sint16) < 500) { - viewport_interaction_right_click( - RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_X, sint16), - RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, sint16) - ); + viewport_interaction_right_click(x, y); } } break; diff --git a/src/interface/viewport.h b/src/interface/viewport.h index 0519976250..10dc86f7b5 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -98,7 +98,7 @@ void get_map_coordinates_from_pos(int screenX, int screenY, int flags, int *x, i int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *info); int viewport_interaction_left_over(int x, int y); int viewport_interaction_left_click(int x, int y); -int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapElement, int *outX, int *outY); +int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info *info); int viewport_interaction_right_over(int x, int y); int viewport_interaction_right_click(int x, int y); diff --git a/src/interface/viewport_interaction.c b/src/interface/viewport_interaction.c index 0c545260e8..1a7cd711c9 100644 --- a/src/interface/viewport_interaction.c +++ b/src/interface/viewport_interaction.c @@ -25,6 +25,7 @@ #include "../ride/ride_data.h" #include "../scenario.h" #include "../world/banner.h" +#include "../world/footpath.h" #include "../world/map.h" #include "../world/scenery.h" #include "../world/sprite.h" @@ -51,11 +52,11 @@ int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info * // No click input for title screen or scenario editor or track manager if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER)) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; // if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) && s6Info->var_000 != 6) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; get_map_coordinates_from_pos(x, y, 0xFF79, &info->x, &info->y, &info->type, &info->mapElement); mapElement = info->mapElement; @@ -150,30 +151,32 @@ int viewport_interaction_left_click(int x, int y) * * rct2: 0x006EDE88 */ -int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapElement, int *outX, int *outY) +int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info *info) { rct_s6_info *s6Info = (rct_s6_info*)0x00141F570; rct_map_element *mapElement; + rct_sprite *sprite; rct_scenery_entry *sceneryEntry; rct_banner *banner; rct_ride *ride; - int i, stationIndex, outZ; + int i, stationIndex; // No click input for title screen or track manager if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_MANAGER)) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; // if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) && s6Info->var_000 != 6) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; - get_map_coordinates_from_pos(x, y, 9, outX, outY, &outZ, &mapElement); - *outMapElement = mapElement; + get_map_coordinates_from_pos(x, y, 9, &info->x, &info->y, &info->type, &info->mapElement); + mapElement = info->mapElement; + sprite = (rct_sprite*)mapElement; - switch (outZ) { + switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SPRITE: if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) || mapElement->type != 0) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; mapElement += 6; ride = GET_RIDE(mapElement->type); @@ -182,17 +185,17 @@ int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapEl RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->name; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint32) = ride->name_arguments; } - return 2; + return info->type; case VIEWPORT_INTERACTION_ITEM_RIDE: if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; if ((mapElement->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_PATH) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; ride = GET_RIDE(mapElement->properties.track.ride_index); if (ride->status != RIDE_STATUS_CLOSED) - return 0; + return info->type; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1163; @@ -203,11 +206,11 @@ int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapEl RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 1333; } else { if (!sub_664F72(x, y, mapElement->base_height << 4)) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->name; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint32) = ride->name_arguments; - return 3; + return info->type; } if (ride->num_stations > 1) @@ -223,14 +226,14 @@ int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapEl stationIndex--; stationIndex++; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 12, uint16) = stationIndex; - return 3; + return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = g_wallSceneryEntries[mapElement->properties.scenery.type]; if (sceneryEntry->wall.var_0D != 255) { RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1163; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; - return 9; + return info->type; } break; @@ -239,7 +242,7 @@ int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapEl if (sceneryEntry->large_scenery.var_11 != 255) { RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1163; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; - return 10; + return info->type; } break; @@ -249,26 +252,26 @@ int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapEl RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1163; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; - return 12; + return info->type; } if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & 0x48) != 0x48) if (window_find_by_class(WC_RIDE_CONSTRUCTION) == NULL && window_find_by_class(WC_FOOTPATH) == NULL) - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; - switch (outZ) { + switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SCENERY: sceneryEntry = g_smallSceneryEntries[mapElement->properties.scenery.type]; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; - return 5; + return info->type; case VIEWPORT_INTERACTION_ITEM_FOOTPATH: RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 1425; if (mapElement->type & 1) RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 1426; - return 6; + return info->type; case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM: sceneryEntry = g_pathBitSceneryEntries[mapElement->properties.scenery.age & 0x0F]; @@ -279,40 +282,40 @@ int viewport_interaction_get_item_right(int x, int y, rct_map_element **outMapEl } else { RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; } - return 7; + return info->type; case VIEWPORT_INTERACTION_ITEM_PARK: if (RCT2_ADDRESS_SCREEN_FLAGS & SCREEN_FLAGS_SCENARIO_EDITOR) - return 0; + break; if ((mapElement->type & MAP_ELEMENT_TYPE_MASK) != MAP_ELEMENT_TYPE_ENTRANCE) - return 0; + break; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 3192; - return 8; + return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = g_wallSceneryEntries[mapElement->properties.scenery.type]; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; - return 9; + return info->type; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: sceneryEntry = g_largeSceneryEntries[mapElement->properties.scenery.type & 0x3FF]; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; - return 10; + return info->type; } - return 0; + return info->type = VIEWPORT_INTERACTION_ITEM_NONE; } int viewport_interaction_right_over(int x, int y) { - rct_map_element *mapElement; + viewport_interaction_info info; - return viewport_interaction_get_item_right(x, y, &mapElement, &x, &y) != 0; + return viewport_interaction_get_item_right(x, y, &info) != 0; } /** @@ -321,39 +324,39 @@ int viewport_interaction_right_over(int x, int y) */ int viewport_interaction_right_click(int x, int y) { - rct_map_element *mapElement; + viewport_interaction_info info; - switch (viewport_interaction_get_item_right(x, y, &mapElement, &x, &y)) { - case 0: + switch (viewport_interaction_get_item_right(x, y, &info)) { + case VIEWPORT_INTERACTION_ITEM_NONE: return 0; - break; - case 2: - if (mapElement->type == 0) - RCT2_CALLPROC_X(0x006B4857, x, 0, y, (int)mapElement, 0, 0, 0); + + case VIEWPORT_INTERACTION_ITEM_SPRITE: + if (info.mapElement->type == 0) + RCT2_CALLPROC_X(0x006B4857, info.x, 0, info.y, (int)info.sprite, 0, 0, 0); break; case VIEWPORT_INTERACTION_ITEM_RIDE: - ride_modify(mapElement, x, y); + ride_modify(info.mapElement, info.x, info.y); break; case VIEWPORT_INTERACTION_ITEM_SCENERY: - viewport_interaction_remove_scenery(mapElement, x, y); + viewport_interaction_remove_scenery(info.mapElement, info.x, info.y); break; case VIEWPORT_INTERACTION_ITEM_FOOTPATH: - viewport_interaction_remove_footpath(mapElement, x, y); + viewport_interaction_remove_footpath(info.mapElement, info.x, info.y); break; case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM: - viewport_interaction_remove_footpath_item(mapElement, x, y); + viewport_interaction_remove_footpath_item(info.mapElement, info.x, info.y); break; case VIEWPORT_INTERACTION_ITEM_PARK: - viewport_interaction_remove_park_entrance(mapElement, x, y); + viewport_interaction_remove_park_entrance(info.mapElement, info.x, info.y); break; case VIEWPORT_INTERACTION_ITEM_WALL: - viewport_interaction_remove_park_wall(mapElement, x, y); + viewport_interaction_remove_park_wall(info.mapElement, info.x, info.y); break; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: - viewport_interaction_remove_large_scenery(mapElement, x, y); + viewport_interaction_remove_large_scenery(info.mapElement, info.x, info.y); break; case VIEWPORT_INTERACTION_ITEM_BANNER: - window_banner_open(mapElement->properties.banner.index); + window_banner_open(info.mapElement->properties.banner.index); break; } @@ -392,13 +395,13 @@ static void viewport_interaction_remove_footpath(rct_map_element *mapElement, in w = window_find_by_class(WC_FOOTPATH); if (w != NULL) - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); mapElement2 = TILE_MAP_ELEMENT_POINTER((y / 32) * 256 + (x / 32)); do { if ((mapElement2->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_PATH && mapElement2->base_height == z) { RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_FOOTPATH_FROM_HERE; - game_do_command(x, 1, y, z, GAME_COMMAND_REMOVE_PATH, 0, 0); + footpath_remove(x, y, z, 1); } } while (!((mapElement2++)->flags & MAP_ELEMENT_FLAG_LAST_TILE)); } diff --git a/src/windows/footpath.c b/src/windows/footpath.c index b9d6bf111b..a857e58866 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -22,13 +22,14 @@ #include "../addresses.h" #include "../audio/audio.h" #include "../game.h" -#include "../input.h" -#include "../world/map.h" #include "../localisation/localisation.h" +#include "../input.h" #include "../sprites.h" -#include "../interface/viewport.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../interface/viewport.h" +#include "../world/footpath.h" +#include "../world/map.h" #include "dropdown.h" enum { @@ -42,14 +43,6 @@ enum { SELECTED_PATH_TYPE_QUEUE }; -typedef struct { - uint16 pad_00; - uint32 image; // 0x02 - uint32 pad_06; - uint8 pad_0A; - uint8 flags; // 0x0B -} rct_path_type; - enum WINDOW_FOOTPATH_WIDGET_IDX { WIDX_BACKGROUND, WIDX_TITLE, @@ -226,7 +219,7 @@ static void window_footpath_close() window_get_register(w); - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); viewport_set_visibility(0); RCT2_CALLPROC_EBPSAFE(0x0068AB1B); RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2; @@ -261,7 +254,7 @@ static void window_footpath_mouseup() _window_footpath_cost = 0x80000000; tool_cancel(); - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); RCT2_CALLPROC_EBPSAFE(0x0068AB1B); RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2; RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND; @@ -276,7 +269,7 @@ static void window_footpath_mouseup() _window_footpath_cost = 0x80000000; tool_cancel(); - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); RCT2_CALLPROC_EBPSAFE(0x0068AB1B); RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2; RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL; @@ -372,7 +365,7 @@ static void window_footpath_dropdown() // Set selected path id RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, sint16) = pathId; - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); _window_footpath_cost = 0x80000000; window_invalidate(w); } @@ -620,7 +613,7 @@ static void window_footpath_set_provisional_path_at_point(int x, int y) if (z == 0) { RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~1; - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); } else { // Check for change if ((RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_FLAGS, uint8) & 2) && RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_X, uint16) == x && RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_Y, uint16) == y && RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_Z, uint8) == mapElement->base_height) @@ -634,7 +627,7 @@ static void window_footpath_set_provisional_path_at_point(int x, int y) RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, uint16) = x; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, uint16) = y; - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); // Set provisional path slope = RCT2_ADDRESS(0x0098D8B4, uint8)[mapElement->properties.surface.slope & 0x1F]; @@ -687,7 +680,7 @@ static void window_footpath_place_path_at_point(int x, int y) if (RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) != 0) return; - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); get_map_coordinates_from_pos(x, y, 0xFFDE, &x, &y, &z, &mapElement); if (z == 0) @@ -737,7 +730,7 @@ static void window_footpath_remove() // RCT2_CALLPROC_EBPSAFE(0x006A7863); _window_footpath_cost = MONEY32_UNDEFINED; - RCT2_CALLPROC_EBPSAFE(0x006A7831); + sub_6A7831(); x = RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_X, uint16) / 32; y = RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Y, uint16) / 32; @@ -793,7 +786,12 @@ loc_6A78EF: // Remove path RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, uint16) = STR_CANT_REMOVE_FOOTPATH_FROM_HERE; - game_do_command(RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_X, uint16), 1, RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Y, uint16), mapElement->base_height, GAME_COMMAND_REMOVE_PATH, 0, 0); + footpath_remove( + RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_X, uint16), + RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Y, uint16), + mapElement->base_height, + 1 + ); // Move selection edge ^= 2; diff --git a/src/world/footpath.c b/src/world/footpath.c new file mode 100644 index 0000000000..5622226a72 --- /dev/null +++ b/src/world/footpath.c @@ -0,0 +1,66 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of 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. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#include "../addresses.h" +#include "../game.h" +#include "footpath.h" +#include "map.h" + +void footpath_remove(int x, int y, int z, int flags) +{ + game_do_command(x, flags, y, z, GAME_COMMAND_REMOVE_PATH, 0, 0); +} + +/** + * + * rct2: 0x006A7FFF + */ +void sub_6A7FFF() +{ + if (RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_FLAGS, uint8) & (1 << 1)) { + RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_FLAGS, uint8) &= ~(1 << 1); + + footpath_remove( + RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_X, uint16), + RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_Y, uint16), + RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_Z, uint16), + 41 + ); + } +} + +/** + * + * rct2: 0x006A7831 + */ +void sub_6A7831() +{ + if (RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_FLAGS, uint8) & (1 << 0)) { + RCT2_GLOBAL(RCT2_ADDRESS_PROVISIONAL_PATH_FLAGS, uint8) &= ~(1 << 0); + + RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint8) &= ~(1 << 2); + map_invalidate_tile_full( + RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_X, uint16), + RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Y, uint16) + ); + } else { + sub_6A7FFF(); + } +} \ No newline at end of file diff --git a/src/world/footpath.h b/src/world/footpath.h new file mode 100644 index 0000000000..7fb2986296 --- /dev/null +++ b/src/world/footpath.h @@ -0,0 +1,38 @@ +/***************************************************************************** + * Copyright (c) 2014 Ted John + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * This file is part of 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. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *****************************************************************************/ + +#ifndef _WORLD_FOOTPATH_H_ +#define _WORLD_FOOTPATH_H_ + +#include "../common.h" + +typedef struct { + uint16 pad_00; + uint32 image; // 0x02 + uint32 pad_06; + uint8 pad_0A; + uint8 flags; // 0x0B +} rct_path_type; + +void footpath_remove(int x, int y, int z, int flags); +void sub_6A7FFF(); +void sub_6A7831(); + +#endif