From 8efe699754944d91f11ec8a1e4945556180a23cf Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 18 May 2016 00:00:08 +0100 Subject: [PATCH] integrate gMapTooltipFormatArgs --- src/addresses.h | 3 +- src/input.c | 2 +- src/interface/viewport_interaction.c | 100 ++++++++++++++++----------- src/localisation/localisation.c | 1 + src/localisation/localisation.h | 11 ++- src/peep/peep.c | 22 +++--- src/ride/ride.c | 59 ++++++++-------- src/ride/vehicle.c | 16 ++--- src/windows/map_tooltip.c | 15 ++-- 9 files changed, 129 insertions(+), 100 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 1b5be7bf2b..d95538a745 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -43,8 +43,6 @@ // translate between scroll positions for drawing #define RCT2_ADDRESS_SCROLLING_MODE_POSITIONS 0x00992FB8 -#define RCT2_ADDRESS_MAP_TOOLTIP_ARGS 0x009A9808 - #define RCT2_ADDRESS_APP_PATH 0x009AA214 #define RCT2_ADDRESS_CONFIG_FLAGS 0x009AAC74 @@ -470,6 +468,7 @@ #define RCT2_ADDRESS_DPI_LINE_LENGTH_GLOBAL 0x9ABDB0 //uint16 width+pitch #define RCT2_ADDRESS_LAND_TOOL_SIZE 0x009A9800 #define RCT2_ADDRESS_SAVE_PROMPT_MODE 0x009A9802 +#define RCT2_ADDRESS_MAP_TOOLTIP_ARGS 0x009A9808 #define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS 0x009AA00D #define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG 0x009AB4C6 #define RCT2_ADDRESS_NAUSEA_THRESHOLDS 0x00982390 //uint16 diff --git a/src/input.c b/src/input.c index 28132c0f38..e22d7f6110 100644 --- a/src/input.c +++ b/src/input.c @@ -1061,7 +1061,7 @@ void process_mouse_over(int x, int y) int ebx, esi, edi, ebp; cursorId = CURSOR_ARROW; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, sint16) = -1; + set_map_tooltip_format_arg(0, sint16, -1); window = window_find_from_point(x, y); if (window != NULL) { diff --git a/src/interface/viewport_interaction.c b/src/interface/viewport_interaction.c index c6c0ac8cbf..dd7daef1ae 100644 --- a/src/interface/viewport_interaction.c +++ b/src/interface/viewport_interaction.c @@ -20,6 +20,7 @@ #include "../localisation/localisation.h" #include "../ride/ride.h" #include "../ride/ride_data.h" +#include "../ride/track.h" #include "../scenario.h" #include "../world/banner.h" #include "../world/footpath.h" @@ -82,8 +83,8 @@ int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info * ride_set_map_tooltip(mapElement); break; case VIEWPORT_INTERACTION_ITEM_PARK: - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = gParkName; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint32) = gParkNameArgs; + set_map_tooltip_format_arg(0, uint16, gParkName); + set_map_tooltip_format_arg(2, uint32, gParkNameArgs); break; default: info->type = VIEWPORT_INTERACTION_ITEM_NONE; @@ -194,9 +195,9 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info mapElement += 6; ride = get_ride(mapElement->type); if (ride->status == RIDE_STATUS_CLOSED) { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1163; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint32) = ride->name_arguments; + set_map_tooltip_format_arg(0, uint16, 1163); + set_map_tooltip_format_arg(2, uint16, ride->name); + set_map_tooltip_format_arg(4, uint32, ride->name_arguments); } return info->type; @@ -210,42 +211,59 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info if (ride->status != RIDE_STATUS_CLOSED) return info->type; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1163; + set_map_tooltip_format_arg(0, uint16, 1163); if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_ENTRANCE) { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = - mapElement->properties.track.type == ENTRANCE_TYPE_RIDE_ENTRANCE ? 1335 : 1337; - } else if (mapElement->properties.track.type == 1 || mapElement->properties.track.type == 2 || mapElement->properties.track.type == 3) { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 1333; + rct_string_id stringId; + if (mapElement->properties.track.type == ENTRANCE_TYPE_RIDE_ENTRANCE) { + if (ride->num_stations > 1) { + stringId = 1336; + } else { + stringId = 1335; + } + } else { + if (ride->num_stations > 1) { + stringId = 1338; + } else { + stringId = 1337; + } + } + set_map_tooltip_format_arg(2, uint16, stringId); + } else if (track_element_is_station(mapElement)) { + rct_string_id stringId; + if (ride->num_stations > 1) { + stringId = 1334; + } else { + stringId = 1333; + } + set_map_tooltip_format_arg(2, uint16, stringId); } else { - if (!gCheatsSandboxMode && !map_is_location_owned(info->x, info->y, mapElement->base_height << 4)) + if (!gCheatsSandboxMode && !map_is_location_owned(info->x, info->y, mapElement->base_height << 4)) { 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; + set_map_tooltip_format_arg(2, uint16, ride->name); + set_map_tooltip_format_arg(4, uint32, ride->name_arguments); return info->type; } - if (ride->num_stations > 1) - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16)++; - - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 6, uint32) = ride->name_arguments; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 10, uint16) = RideNameConvention[ride->type].station_name + 2; + set_map_tooltip_format_arg(4, uint16, ride->name); + set_map_tooltip_format_arg(6, uint32, ride->name_arguments); + set_map_tooltip_format_arg(10, uint16, RideNameConvention[ride->type].station_name + 2); stationIndex = map_get_station(mapElement); for (i = stationIndex; i >= 0; i--) if (ride->station_starts[i] == 0xFFFF) stationIndex--; stationIndex++; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 12, uint16) = stationIndex; + set_map_tooltip_format_arg(12, uint16, stationIndex); return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = get_wall_entry(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; + set_map_tooltip_format_arg(0, uint16, 1163); + set_map_tooltip_format_arg(2, uint16, sceneryEntry->name); return info->type; } break; @@ -253,8 +271,8 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF); 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; + set_map_tooltip_format_arg(0, uint16, 1163); + set_map_tooltip_format_arg(2, uint16, sceneryEntry->name); return info->type; } break; @@ -263,8 +281,8 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info banner = &gBanners[mapElement->properties.banner.index]; sceneryEntry = get_banner_entry(banner->type); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1163; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; + set_map_tooltip_format_arg(0, uint16, 1163); + set_map_tooltip_format_arg(2, uint16, sceneryEntry->name); return info->type; } @@ -277,25 +295,25 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SCENERY: sceneryEntry = get_small_scenery_entry(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; + set_map_tooltip_format_arg(0, uint16, 1164); + set_map_tooltip_format_arg(2, uint16, sceneryEntry->name); 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; + set_map_tooltip_format_arg(0, uint16, 1164); + set_map_tooltip_format_arg(2, uint16, 1425); if (mapElement->type & 1) - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 1426; + set_map_tooltip_format_arg(2, uint16, 1426); return info->type; case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM: sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(mapElement)); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164; + set_map_tooltip_format_arg(0, uint16, 1164); if (mapElement->flags & 0x20) { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 3124; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint16) = sceneryEntry->name; + set_map_tooltip_format_arg(2, uint16, 3124); + set_map_tooltip_format_arg(4, uint16, sceneryEntry->name); } else { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = sceneryEntry->name; + set_map_tooltip_format_arg(2, uint16, sceneryEntry->name); } return info->type; @@ -306,20 +324,20 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_ENTRANCE) break; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 3192; + set_map_tooltip_format_arg(0, uint16, 1164); + set_map_tooltip_format_arg(2, uint16, 3192); return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = get_wall_entry(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; + set_map_tooltip_format_arg(0, uint16, 1164); + set_map_tooltip_format_arg(2, uint16, sceneryEntry->name); return info->type; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(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; + set_map_tooltip_format_arg(0, uint16, 1164); + set_map_tooltip_format_arg(2, uint16, sceneryEntry->name); return info->type; } diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index a04e38552c..fc632365fe 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -31,6 +31,7 @@ #include "localisation.h" uint8 gCommonFormatArgs[80]; +uint8 gMapTooltipFormatArgs[40]; #pragma region Format codes diff --git a/src/localisation/localisation.h b/src/localisation/localisation.h index b1f04f157e..29770ea46f 100644 --- a/src/localisation/localisation.h +++ b/src/localisation/localisation.h @@ -62,12 +62,17 @@ extern const char *real_names[1024]; extern utf8 *gUserStrings; extern uint8 gCommonFormatArgs[80]; +extern uint8 gMapTooltipFormatArgs[40]; -static inline void set_format_arg_body(size_t offset, uintptr_t value, size_t size) +static inline void set_format_arg_body(uint8 *args, size_t offset, uintptr_t value, size_t size) { - memcpy(gCommonFormatArgs + offset, &value, size); + memcpy(args + offset, &value, size); } -#define set_format_arg(offset, type, value) set_format_arg_body(offset, (uintptr_t)value, sizeof(type)) +#define set_format_arg(offset, type, value) \ + set_format_arg_body(gCommonFormatArgs, offset, (uintptr_t)value, sizeof(type)) + +#define set_map_tooltip_format_arg(offset, type, value) \ + set_format_arg_body(gMapTooltipFormatArgs, offset, (uintptr_t)value, sizeof(type)) #endif diff --git a/src/peep/peep.c b/src/peep/peep.c index da0a9dc36b..b6821ad0c4 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -6724,24 +6724,24 @@ static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type){ void peep_set_map_tooltip(rct_peep *peep) { if (peep->type == PEEP_TYPE_GUEST) { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = peep->peep_flags & PEEP_FLAGS_TRACKING ? 1450 : 1449; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint32) = get_peep_face_sprite_small(peep); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 6, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 8, uint32) = peep->id; + set_map_tooltip_format_arg(0, uint16, peep->peep_flags & PEEP_FLAGS_TRACKING ? 1450 : 1449); + set_map_tooltip_format_arg(2, uint32, get_peep_face_sprite_small(peep)); + set_map_tooltip_format_arg(6, uint16, peep->name_string_idx); + set_map_tooltip_format_arg(8, uint32, peep->id); uint32 arg0, arg1; get_arguments_from_action(peep, &arg0, &arg1); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 12, uint32) = arg0; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 16, uint32) = arg1; + set_map_tooltip_format_arg(12, uint32, arg0); + set_map_tooltip_format_arg(16, uint32, arg1); } else { - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1451; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint32) = peep->id; + set_map_tooltip_format_arg(0, uint16, 1451); + set_map_tooltip_format_arg(2, uint16, peep->name_string_idx); + set_map_tooltip_format_arg(4, uint32, peep->id); uint32 arg0, arg1; get_arguments_from_action(peep, &arg0, &arg1); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 8, uint32) = arg0; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 12, uint32) = arg1; + set_map_tooltip_format_arg(8, uint32, arg0); + set_map_tooltip_format_arg(12, uint32, arg1); } } diff --git a/src/ride/ride.c b/src/ride/ride.c index 33e6b8372f..edf1a565a5 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -3239,14 +3239,14 @@ static void ride_track_set_map_tooltip(rct_map_element *mapElement) rideIndex = mapElement->properties.track.ride_index; ride = get_ride(rideIndex); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 2215; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint32) = ride->name_arguments; + set_map_tooltip_format_arg(0, uint16, 2215); + set_map_tooltip_format_arg(2, uint16, ride->name); + set_map_tooltip_format_arg(4, uint32, ride->name_arguments); int arg0, arg1; ride_get_status(rideIndex, &arg0, &arg1); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 8, uint16) = (uint16)arg0; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 10, uint32) = arg1; + set_map_tooltip_format_arg(8, uint16, (uint16)arg0); + set_map_tooltip_format_arg(10, uint32, arg1); } static void ride_station_set_map_tooltip(rct_map_element *mapElement) @@ -3262,17 +3262,17 @@ static void ride_station_set_map_tooltip(rct_map_element *mapElement) if (ride->station_starts[i] == 0xFFFF) stationIndex--; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 2215; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->num_stations <= 1 ? 1333 : 1334; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 6, uint32) = ride->name_arguments; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 10, uint16) = RideNameConvention[ride->type].station_name + 2; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 12, uint16) = stationIndex + 1; + set_map_tooltip_format_arg(0, uint16, 2215); + set_map_tooltip_format_arg(2, uint16, ride->num_stations <= 1 ? 1333 : 1334); + set_map_tooltip_format_arg(4, uint16, ride->name); + set_map_tooltip_format_arg(6, uint32, ride->name_arguments); + set_map_tooltip_format_arg(10, uint16, RideNameConvention[ride->type].station_name + 2); + set_map_tooltip_format_arg(12, uint16, stationIndex + 1); int arg0, arg1; ride_get_status(rideIndex, &arg0, &arg1); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 14, uint16) = (uint16)arg0; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 16, uint32) = arg1; + set_map_tooltip_format_arg(14, uint16, (uint16)arg0); + set_map_tooltip_format_arg(16, uint32, arg1); } static void ride_entrance_set_map_tooltip(rct_map_element *mapElement) @@ -3295,18 +3295,19 @@ static void ride_entrance_set_map_tooltip(rct_map_element *mapElement) if (ride->entrances[stationIndex] != 0xFFFF) queueLength = ride->queue_length[stationIndex]; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 2215; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->num_stations <= 1 ? 1335 : 1336; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 6, uint32) = ride->name_arguments; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 12, uint16) = stationIndex + 1; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 14, uint16) = - queueLength == 0 ? - 1201 : - queueLength == 1 ? - 1202 : - 1203; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 16, uint16) = queueLength; + set_map_tooltip_format_arg(0, uint16, 2215); + set_map_tooltip_format_arg(2, uint16, ride->num_stations <= 1 ? 1335 : 1336); + set_map_tooltip_format_arg(4, uint16, ride->name); + set_map_tooltip_format_arg(6, uint32, ride->name_arguments); + set_map_tooltip_format_arg(12, uint16, stationIndex + 1); + if (queueLength == 0) { + set_map_tooltip_format_arg(14, uint16, 1201); + } else if (queueLength == 1) { + set_map_tooltip_format_arg(14, uint16, 1202); + } else { + set_map_tooltip_format_arg(14, uint16, 1203); + } + set_map_tooltip_format_arg(16, uint16, queueLength); } else { // Get the station stationIndex = map_get_station(mapElement); @@ -3314,10 +3315,10 @@ static void ride_entrance_set_map_tooltip(rct_map_element *mapElement) if (ride->station_starts[i] == 0xFFFF) stationIndex--; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = ride->num_stations <= 1 ? 1337 : 1338; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint32) = ride->name_arguments; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 10, uint16) = stationIndex + 1; + set_map_tooltip_format_arg(0, uint16, ride->num_stations <= 1 ? 1337 : 1338); + set_map_tooltip_format_arg(2, uint16, ride->name); + set_map_tooltip_format_arg(4, uint32, ride->name_arguments); + set_map_tooltip_format_arg(10, uint16, stationIndex + 1); } } diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index dfbb446b02..135924fa36 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -5046,17 +5046,17 @@ void vehicle_set_map_toolbar(rct_vehicle *vehicle) if (ride->vehicles[vehicleIndex] == vehicle->sprite_index) break; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 2215; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 1165; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 4, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 6, uint32) = ride->name_arguments; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 10, uint16) = RideNameConvention[ride->type].vehicle_name + 2; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 12, uint16) = vehicleIndex + 1; + set_map_tooltip_format_arg(0, uint16, 2215); + set_map_tooltip_format_arg(2, uint16, 1165); + set_map_tooltip_format_arg(4, uint16, ride->name); + set_map_tooltip_format_arg(6, uint32, ride->name_arguments); + set_map_tooltip_format_arg(10, uint16, RideNameConvention[ride->type].vehicle_name + 2); + set_map_tooltip_format_arg(12, uint16, vehicleIndex + 1); int arg0, arg1; ride_get_status(vehicle->ride, &arg0, &arg1); - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 14, uint16) = (uint16)arg0; - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 16, uint32) = (uint16)arg1; + set_map_tooltip_format_arg(14, uint16, (uint16)arg0); + set_map_tooltip_format_arg(16, uint32, (uint16)arg1); } rct_vehicle *vehicle_get_head(rct_vehicle *vehicle) diff --git a/src/windows/map_tooltip.c b/src/windows/map_tooltip.c index 861fc2eb24..3c86e00ac3 100644 --- a/src/windows/map_tooltip.c +++ b/src/windows/map_tooltip.c @@ -88,9 +88,11 @@ void window_map_tooltip_update_visibility() _lastCursorY = cursorY; // Show or hide tooltip - if ( - _cursorHoldDuration < 25 || - RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, sint16) == -1 || + rct_string_id stringId; + memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id)); + + if (_cursorHoldDuration < 25 || + stringId == STR_NONE || (gInputPlaceObjectModifier & 3) || window_find_by_class(WC_ERROR) != NULL ) { @@ -144,8 +146,11 @@ static void window_map_tooltip_update(rct_window *w) */ static void window_map_tooltip_paint(rct_window *w, rct_drawpixelinfo *dpi) { - if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, rct_string_id) == STR_NONE) + rct_string_id stringId; + memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id)); + if (stringId == STR_NONE) { return; + } - gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_MAP_TOOLTIP_ARGS, w->x + (w->width / 2), w->y + (w->height / 2), w->width, 1162, 0); + gfx_draw_string_centred_wrapped(dpi, gMapTooltipFormatArgs, w->x + (w->width / 2), w->y + (w->height / 2), w->width, 1162, 0); }