From 9749d7d6028bc74dca474c39679d45007b13a9e5 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Thu, 23 Apr 2015 17:23:01 +0100 Subject: [PATCH] Added path bit placement Fixed bug in footpath_place_real that causes it to not place path bits. --- src/windows/top_toolbar.c | 16 ++++++++++++++-- src/world/footpath.c | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 82a4585c9b..6df891b040 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -1314,8 +1314,20 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window* w sound_play_panned(SOUND_ERROR, 0x8001, RCT2_GLOBAL(0x009DEA5E, uint16), RCT2_GLOBAL(0x009DEA60, uint16), RCT2_GLOBAL(0x009DEA62, uint16)); } else if (ebp >= 256){ - //6e2eda - RCT2_CALLPROC_X(0x6E2CC6, x, y, 0, widgetIndex, (int)w, 0, 0); + // Path Bits + int ebx = parameter_1; + ebx &= 0xFF00; + ebx |= 0x81; + + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = 1161; + + ebx = game_do_command(grid_x, ebx, grid_y, parameter_2, GAME_COMMAND_PLACE_PATH, parameter_3, 0); + + if (ebx == MONEY32_UNDEFINED){ + return; + } + + sound_play_panned(SOUND_PLACE_ITEM, 0x8001, RCT2_GLOBAL(0x009DEA5E, uint16), RCT2_GLOBAL(0x009DEA60, uint16), RCT2_GLOBAL(0x009DEA62, uint16)); } else{ //6e2d2d diff --git a/src/world/footpath.c b/src/world/footpath.c index 0b290c3366..756f9e63ad 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -289,7 +289,7 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement return RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY ? 0 : RCT2_GLOBAL(0x00F3EFD9, money32); } -static money32 footpath_place_real(int type, int x, int y, int z, int slope, int flags) +static money32 footpath_place_real(int type, int x, int y, int z, int slope, int flags, uint8 path_bit_type) { rct_map_element *mapElement; @@ -308,7 +308,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int RCT2_GLOBAL(0x00F3EFD9, money32) = 0; RCT2_GLOBAL(0x00F3EFA4, uint8) = 0; - RCT2_GLOBAL(0x00F3EF88, uint16) = 0; // di + RCT2_GLOBAL(0x00F3EF88, uint16) = path_bit_type; // di if (x >= RCT2_GLOBAL(0x01358830, uint16) || y >= RCT2_GLOBAL(0x01358830, uint16)) { RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP; @@ -394,7 +394,7 @@ void game_command_place_footpath(int *eax, int *ebx, int *ecx, int *edx, int *es if (*ebx & (1 << 5)) RCT2_CALLFUNC_X(0x006A61DE, eax, ebx, ecx, edx, esi, edi, ebp); else - *ebx = footpath_place_real((*edx >> 8) & 0xFF, *eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, (*ebx >> 8) & 0xFF, *ebx & 0xFF); + *ebx = footpath_place_real((*edx >> 8) & 0xFF, *eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, (*ebx >> 8) & 0xFF, *ebx & 0xFF, *edi & 0xFF); } /**