diff --git a/src/input.c b/src/input.c index 4a97219c64..72e06ee4af 100644 --- a/src/input.c +++ b/src/input.c @@ -34,6 +34,7 @@ #include "windows/dropdown.h" #include "world/map.h" #include "world/sprite.h" +#include "world/scenery.h" POINT _dragPosition; @@ -814,38 +815,76 @@ static void game_handle_input_mouse(int x, int y, int state) if (RCT2_GLOBAL(0x009DE540, sint16) < 500) { // Right click { - int eax, ebx, ecx, edx, esi, edi, ebp; + int eax, ebx, ecx, esi, edi, ebp; + rct_map_element* map_element; + rct_scenery_entry* scenery_entry; eax = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_X, sint16); ebx = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, sint16); - RCT2_CALLFUNC_X(0x006EDE88, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); + RCT2_CALLFUNC_X(0x006EDE88, &eax, &ebx, &ecx, (int*)&map_element, &esi, &edi, &ebp); switch (ebx & 0xFF) { case 2: - if (*((uint8*)edx) == 0) - RCT2_CALLPROC_X(0x006B4857, eax, 0, ecx, edx, 0, 0, 0); + if (map_element->type == 0) + RCT2_CALLPROC_X(0x006B4857, eax, 0, ecx, (int)map_element, 0, 0, 0); break; case 3: - RCT2_CALLPROC_X(0x006CC056, eax, 0, ecx, edx, 0, 0, 0); + RCT2_CALLPROC_X(0x006CC056, eax, 0, ecx, (int)map_element, 0, 0, 0); break; case 5: - RCT2_CALLPROC_X(0x006E08D2, eax, 0, ecx, edx, 0, 0, 0); + RCT2_CALLPROC_X(0x006E08D2, eax, 0, ecx, (int)map_element, 0, 0, 0); break; case 6: - RCT2_CALLPROC_X(0x006A614A, eax, 0, ecx, edx, 0, 0, 0); + RCT2_CALLPROC_X(0x006A614A, eax, 0, ecx, (int)map_element, 0, 0, 0); break; case 7: - RCT2_CALLPROC_X(0x006A61AB, eax, 0, ecx, edx, 0, 0, 0); + RCT2_CALLPROC_X(0x006A61AB, eax, 0, ecx, (int)map_element, 0, 0, 0); break; case 8: - RCT2_CALLPROC_X(0x00666C0E, eax, 0, ecx, edx, 0, 0, 0); + RCT2_CALLPROC_X(0x00666C0E, eax, 0, ecx, (int)map_element, 0, 0, 0); break; case 9: - RCT2_CALLPROC_X(0x006E57A9, eax, 0, ecx, edx, 0, 0, 0); + //0x006e57a9 + scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope]; + if (scenery_entry->wall.var_0D != 0xFF){ + RCT2_CALLPROC_X(0x6E5F52, map_element->properties.fence.item[0], 0, 0, 0, 0, 0, 0); + } + else{ + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = 1158; + game_do_command( + eax, + 1, + ecx, + (map_element->type & 0x3) | (map_element->base_height << 8), + GAME_COMMAND_42, + 0, + 0); + } break; case 10: - RCT2_CALLPROC_X(0x006B88DC, eax, 0, ecx, edx, 0, 0, 0); + //0x006B88DC + ebx = map_element->properties.scenerymultiple.type; + ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8; + scenery_entry = g_largeSceneryEntries[ebx]; + + if (scenery_entry->large_scenery.var_11 != 0xFF){ + int id = (map_element->type & 0xC0) | + ((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) | + ((map_element->properties.scenerymultiple.colour[1] & 0xE0) >> 5); + RCT2_CALLPROC_X(0x6B9559, id, 0, 0, 0, 0, 0, 0); + } + else{ + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = 1158; + game_do_command( + eax, + 1 | ((map_element->type & 0x3) << 8), + ecx, + map_element->base_height | ((map_element->properties.scenerymultiple.index >> 2) << 8), + GAME_COMMAND_44, + 0, + 0); + } break; case 12: - RCT2_CALLPROC_X(0x006BA233, eax, 0, ecx, edx, 0, 0, 0); + window_banner_open(map_element->properties.banner.index); break; default: break; diff --git a/src/world/map.h b/src/world/map.h index 394063d6e6..9b9fadf384 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -31,42 +31,42 @@ typedef struct { } rct_map_element_surface_properties; typedef struct { - uint8 type; - uint8 additions; - uint8 edges; - uint8 addition_status; + uint8 type; //4 + uint8 additions; //5 + uint8 edges; //6 + uint8 addition_status; //7 } rct_map_element_path_properties; typedef struct { - uint8 type; - uint8 sequence; - uint8 colour; - uint8 ride_index; + uint8 type; //4 + uint8 sequence; //5 + uint8 colour; //6 + uint8 ride_index; //7 } rct_map_element_track_properties; typedef struct { - uint8 type; - uint8 age; - uint8 colour; - uint8 unused; + uint8 type; //4 + uint8 age; //5 + uint8 colour; //6 + uint8 unused; //7 } rct_map_element_scenery_properties; typedef struct { - uint8 type; - uint8 index; - uint8 path_type; - uint8 ride_index; + uint8 type; //4 + uint8 index; //5 + uint8 path_type; //6 + uint8 ride_index; //7 } rct_map_element_entrance_properties; typedef struct { - uint8 slope; - uint8 item[3]; + uint8 slope; //4 + uint8 item[3]; //5 } rct_map_element_fence_properties; typedef struct { - uint8 type; - uint8 index; - uint8 colour[2]; + uint8 type; //4 + uint8 index; //5 + uint8 colour[2]; //6 } rct_map_element_scenerymultiple_properties; typedef struct { diff --git a/src/world/scenery.h b/src/world/scenery.h index 44f7f27081..e87c490634 100644 --- a/src/world/scenery.h +++ b/src/world/scenery.h @@ -61,6 +61,7 @@ typedef struct { uint16 price; // 0x08 uint8 pad_0A[6]; uint8 scenery_tab_id; // 0x10 + uint8 var_11; } rct_large_scenery_entry; @@ -71,6 +72,7 @@ typedef struct { uint8 flags2; // 0x09 uint16 price; // 0x0A uint8 scenery_tab_id; // 0x0C + uint8 var_0D; } rct_wall_scenery_entry; typedef enum {