diff --git a/src/addresses.h b/src/addresses.h index d3fdbbc2f8..bec3cb6bf8 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -456,8 +456,6 @@ #define RCT2_ADDRESS_AUDIO_INFO 0x01425B40 -#define RCT2_ADDRESS_COMMON_FORMAT_ARGS 0x013CE952 - #define RCT2_ADDRESS_STAFF_MODE_ARRAY 0x013CA672 #pragma endregion @@ -605,6 +603,8 @@ #define RCT2_ADDRESS_SCENERY_TOOL_CTRL_PRESSED 0x00F64F12 #define RCT2_ADDRESS_SCENERY_TOOL_SHIFT_PRESSED 0x00F64F13 +#define RCT2_ADDRESS_COMMON_FORMAT_ARGS 0x013CE952 + #define RCT2_ADDRESS_NEXT_FREE_MAP_ELEMENT 0x0140E9A4 #define RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT 0x0141E9AC diff --git a/src/drawing/scrolling_text.c b/src/drawing/scrolling_text.c index 7bee4f98af..6ca785bc53 100644 --- a/src/drawing/scrolling_text.c +++ b/src/drawing/scrolling_text.c @@ -91,8 +91,8 @@ static int scrolling_text_get_matching_or_oldest(rct_string_id stringId, uint16 // If exact match return the matching index if ( scrollText->string_id == stringId && - scrollText->string_args_0 == RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) && - scrollText->string_args_1 == RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) && + scrollText->string_args_0 == get_format_arg(0, uint32) && + scrollText->string_args_1 == get_format_arg(4, uint32) && scrollText->position == scroll && scrollText->mode == scrollingMode ) { @@ -144,8 +144,8 @@ int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrolling // Setup scrolling text rct_draw_scroll_text* scrollText = &gDrawScrollTextList[scrollIndex]; scrollText->string_id = stringId; - scrollText->string_args_0 = RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32); - scrollText->string_args_1 = RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32); + scrollText->string_args_0 = get_format_arg(0, uint32); + scrollText->string_args_1 = get_format_arg(4, uint32); scrollText->position = scroll; scrollText->mode = scrollingMode; scrollText->id = RCT2_GLOBAL(RCT2_ADDRESS_DRAW_SCROLL_NEXT_ID, uint32); @@ -168,7 +168,7 @@ int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrolling void scrolling_text_set_bitmap_for_sprite(utf8 *text, int scroll, uint8 *bitmap, sint16 *scrollPositionOffsets) { - uint8 characterColour = scrolling_text_get_colour(RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 7, uint8)); + uint8 characterColour = scrolling_text_get_colour(get_format_arg(7, uint8)); utf8 *ch = text; while (true) { @@ -244,7 +244,7 @@ void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, si *dstCh = 0; if (colour == 0) { - colour = scrolling_text_get_colour(RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 7, uint8)); + colour = scrolling_text_get_colour(get_format_arg(7, uint8)); } else { colour = RCT2_GLOBAL(0x009FF048, uint8*)[(colour - FORMAT_COLOUR_CODE_START) * 4]; } diff --git a/src/game.c b/src/game.c index ec5695a66a..1cc54bb213 100644 --- a/src/game.c +++ b/src/game.c @@ -414,7 +414,7 @@ static int game_check_affordability(int cost) if (RCT2_GLOBAL(0x141F568, uint8) & 0xF0)return cost; if (cost <= (sint32)(DECRYPT_MONEY(gCashEncrypted)))return cost; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = cost; + set_format_arg(0, uint32, cost); gGameCommandErrorText = STR_NOT_ENOUGH_CASH_REQUIRES; return MONEY32_UNDEFINED; diff --git a/src/interface/graph.c b/src/interface/graph.c index 5a59c11925..e3c49bfe5d 100644 --- a/src/interface/graph.c +++ b/src/interface/graph.c @@ -31,8 +31,8 @@ static void graph_draw_months_uint8(rct_drawpixelinfo *dpi, uint8 *history, int for (i = count - 1; i >= 0; i--) { if (history[i] != 0 && history[i] != 255 && yearOver32 % 4 == 0) { // Draw month text - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = ((yearOver32 / 4) + 8) % 8 + STR_MONTH_SHORT_MAR; - gfx_draw_string_centred(dpi, 2222, x, y - 10, 0, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + set_format_arg(0, uint32, ((yearOver32 / 4) + 8) % 8 + STR_MONTH_SHORT_MAR); + gfx_draw_string_centred(dpi, 2222, x, y - 10, 0, gCommonFormatArgs); // Draw month mark gfx_fill_rect(dpi, x, y, x, y + 3, 10); diff --git a/src/interface/screenshot.c b/src/interface/screenshot.c index e3e3c8ca5f..0b0e4555ac 100644 --- a/src/interface/screenshot.c +++ b/src/interface/screenshot.c @@ -87,7 +87,7 @@ static int screenshot_get_next_path(char *path, int format) int i; for (i = 1; i < 1000; i++) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = i; + set_format_arg(0, uint16, i); // Glue together path and filename sprintf(path, "%sSCR%d%s", screenshotPath, i, _screenshot_format_extension[format]); @@ -249,7 +249,7 @@ void screenshot_giant() // Show user that screenshot saved successfully rct_string_id stringId = 3165; strcpy((char*)language_get_string(stringId), path_get_filename(path)); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = stringId; + set_format_arg(0, uint16, stringId); window_error_open(STR_SCREENSHOT_SAVED_AS, -1); } diff --git a/src/interface/widget.c b/src/interface/widget.c index d66f6b4a75..eac3ecc77b 100644 --- a/src/interface/widget.c +++ b/src/interface/widget.c @@ -403,7 +403,7 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge gfx_draw_string_left_clipped( dpi, stringId, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, colour, l + 1, t, @@ -416,7 +416,7 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge gfx_draw_string_centred_clipped( dpi, stringId, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, colour, (w->x + w->x + widget->left + widget->right + 1) / 2 - 1, t, @@ -448,7 +448,7 @@ static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) if (widget_is_disabled(w, widgetIndex)) colour |= 0x40; - gfx_draw_string_left_clipped(dpi, widget->image, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, colour, l + 1, t, r - l); + gfx_draw_string_left_clipped(dpi, widget->image, gCommonFormatArgs, colour, l + 1, t, r - l); } /** @@ -523,7 +523,7 @@ static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg uint8 colour = w->colours[widget->colour] & 0x7F; if (widget_is_disabled(w, widgetIndex)) colour |= 0x40; - gfx_draw_string_left(dpi, widget->image, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, colour, l, t); + gfx_draw_string_left(dpi, widget->image, gCommonFormatArgs, colour, l, t); textRight = l + gfx_get_string_width((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER) + 1; } @@ -622,7 +622,7 @@ static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widge width -= 10; } l += width / 2; - gfx_draw_string_centred_clipped(dpi, widget->image, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 34, l, t, width); + gfx_draw_string_centred_clipped(dpi, widget->image, gCommonFormatArgs, 34, l, t, width); } /** @@ -662,7 +662,7 @@ static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg if (widget_is_disabled(w, widgetIndex)) colour |= 0x40; - gfx_draw_string_centred_clipped(dpi, widget->image, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, colour, l, t, widget->right - widget->left - 2); + gfx_draw_string_centred_clipped(dpi, widget->image, gCommonFormatArgs, colour, l, t, widget->right - widget->left - 2); } /** @@ -702,7 +702,7 @@ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg colour |= 0x40; } - gfx_draw_string_left_centred(dpi, (rct_string_id)widget->image, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, colour, l + 14, yMid); + gfx_draw_string_left_centred(dpi, (rct_string_id)widget->image, gCommonFormatArgs, colour, l + 14, yMid); } /** diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index d11bc9c887..a04e38552c 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -30,6 +30,8 @@ #include "date.h" #include "localisation.h" +uint8 gCommonFormatArgs[80]; + #pragma region Format codes typedef struct format_code_token { @@ -864,11 +866,10 @@ void error_string_quit(int error, rct_string_id format) RCT2_GLOBAL(0x9E2DA0, uint32) = 1; char* error_string = RCT2_ADDRESS(0x1424080, char); - void* args = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void); *error_string = 0; if (format != 0xFFFF){ - format_string(error_string, format, args); + format_string(error_string, format, gCommonFormatArgs); } RCT2_GLOBAL(0x9E2D9C, uint32) = 1; rct2_exit(); diff --git a/src/localisation/localisation.h b/src/localisation/localisation.h index 324b0816c6..44dc730b41 100644 --- a/src/localisation/localisation.h +++ b/src/localisation/localisation.h @@ -61,5 +61,9 @@ extern const char real_name_initials[16]; extern const char *real_names[1024]; extern utf8 *gUserStrings; +extern uint8 gCommonFormatArgs[80]; + +#define get_format_arg(offset, type) (*((type*)&gCommonFormatArgs[(offset)])) +#define set_format_arg(offset, type, value) ((*((type*)&gCommonFormatArgs[(offset)])) = (value)) #endif diff --git a/src/management/marketing.c b/src/management/marketing.c index 73f9fa1936..4daa1d965b 100644 --- a/src/management/marketing.c +++ b/src/management/marketing.c @@ -95,10 +95,10 @@ void marketing_update() // This sets the string parameters for the marketing types that have an argument. if (campaign == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign == ADVERTISING_CAMPAIGN_RIDE) { rct_ride* ride = get_ride(campaignItem); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); } else if (campaign == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ShopItemStringIds[campaignItem].plural; + set_format_arg(0, uint16, ShopItemStringIds[campaignItem].plural); } if (gConfigNotifications.park_marketing_campaign_finished) { diff --git a/src/management/news_item.c b/src/management/news_item.c index 0e3b3fef34..e7cbc44f0a 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -266,7 +266,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int * void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc) { utf8 *buffer = (char*)0x0141EF68; - void *args = (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS; + void *args = gCommonFormatArgs; format_string(buffer, string_id, args); // overflows possible? news_item_add_to_queue_raw(type, buffer, assoc); diff --git a/src/management/research.c b/src/management/research.c index 21d0b5e5d1..f23bf8ec58 100644 --- a/src/management/research.c +++ b/src/management/research.c @@ -19,6 +19,7 @@ #include "../game.h" #include "../interface/window.h" #include "../localisation/date.h" +#include "../localisation/localisation.h" #include "../localisation/string_ids.h" #include "../management/finance.h" #include "../scenario.h" @@ -209,8 +210,8 @@ void research_finish_item(sint32 entryIndex) // I don't think 0x009AC06C is ever not 0, so probably redundant if (RCT2_GLOBAL(0x009AC06C, uint8) == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) ? - rideEntry->name : base_ride_type + 2; + set_format_arg(0, rct_string_id, ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) ? + rideEntry->name : base_ride_type + 2); if (!gSilentResearch) { if (gConfigNotifications.ride_researched) { news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE, entryIndex); @@ -229,7 +230,7 @@ void research_finish_item(sint32 entryIndex) // I don't think 0x009AC06C is ever not 0, so probably redundant if (RCT2_GLOBAL(0x009AC06C, uint8) == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = scenerySetEntry->name; + set_format_arg(0, rct_string_id, scenerySetEntry->name); if (!gSilentResearch) { if (gConfigNotifications.ride_researched) { news_item_add_to_queue(NEWS_ITEM_RESEARCH, STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE, entryIndex); diff --git a/src/object_list.c b/src/object_list.c index e26c35720b..7414c5a8e1 100644 --- a/src/object_list.c +++ b/src/object_list.c @@ -497,7 +497,7 @@ void set_load_objects_fail_reason() { rct_string_id expansionNameId; - rct_object_entry* object = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_object_entry); + rct_object_entry* object = get_format_arg(0, rct_object_entry*); int expansion = (object->flags & 0xFF) >> 4; if (expansion == 0 @@ -573,7 +573,7 @@ bool object_load_entries(rct_object_entry* entries) // Load the obect if (!object_load_chunk(entryGroupIndex, &entries[i], NULL)) { log_error("failed to load entry: %.8s", entries[i].name); - memcpy((char*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, &entries[i], sizeof(rct_object_entry)); + memcpy(gCommonFormatArgs, &entries[i], sizeof(rct_object_entry)); loadFailed = true; } } diff --git a/src/paint/map_element/banner.c b/src/paint/map_element/banner.c index 9d20ff49ab..7cded1eaed 100644 --- a/src/paint/map_element/banner.c +++ b/src/paint/map_element/banner.c @@ -77,19 +77,19 @@ void banner_paint(uint8 direction, int height, rct_map_element* map_element) uint16 scrollingMode = banner_scenery->banner.scrolling_mode; scrollingMode += direction; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32_t) = 0; + set_format_arg(0, uint32, 0); + set_format_arg(4, uint32_t, 0); rct_string_id string_id = STR_NO_ENTRY; if (!(gBanners[map_element->properties.banner.index].flags & BANNER_FLAG_NO_ENTRY)) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gBanners[map_element->properties.banner.index].string_idx; + set_format_arg(0, uint16, gBanners[map_element->properties.banner.index].string_idx); string_id = STR_BANNER_TEXT; } if (gConfigGeneral.upper_case_banners) { - format_string_to_upper(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char), string_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void)); + format_string_to_upper(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char), string_id, gCommonFormatArgs); } else { - format_string(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char), string_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void)); + format_string(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char), string_id, gCommonFormatArgs); } gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY; diff --git a/src/paint/map_element/entrance.c b/src/paint/map_element/entrance.c index 47c8a27b40..fb76af8c38 100644 --- a/src/paint/map_element/entrance.c +++ b/src/paint/map_element/entrance.c @@ -117,25 +117,25 @@ void ride_entrance_exit_paint(uint8 direction, int height, rct_map_element* map_ !(map_element->flags & MAP_ELEMENT_FLAG_GHOST) && map_element->properties.entrance.ride_index != 0xFF){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = 0; + set_format_arg(0, uint32, 0); + set_format_arg(4, uint32, 0); rct_string_id string_id = STR_RIDE_ENTRANCE_CLOSED; if (ride->status == RIDE_STATUS_OPEN && !(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, rct_string_id) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, rct_string_id, ride->name); + set_format_arg(2, uint32, ride->name_arguments); string_id = STR_RIDE_ENTRANCE_NAME; } utf8 entrance_string[MAX_PATH]; if (gConfigGeneral.upper_case_banners) { - format_string_to_upper(entrance_string, string_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void)); + format_string_to_upper(entrance_string, string_id, gCommonFormatArgs); } else { - format_string(entrance_string, string_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void)); + format_string(entrance_string, string_id, gCommonFormatArgs); } gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY; @@ -209,21 +209,21 @@ void park_entrance_paint(uint8 direction, int height, rct_map_element* map_eleme break; rct_string_id park_text_id = 1730; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = 0; + set_format_arg(0, uint32, 0); + set_format_arg(4, uint32, 0); if (gParkFlags & PARK_FLAGS_PARK_OPEN){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = gParkName; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs; + set_format_arg(0, rct_string_id, gParkName); + set_format_arg(2, uint32, gParkNameArgs); park_text_id = 1731; } utf8 park_name[MAX_PATH]; if (gConfigGeneral.upper_case_banners) { - format_string_to_upper(park_name, park_text_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void)); + format_string_to_upper(park_name, park_text_id, gCommonFormatArgs); } else { - format_string(park_name, park_text_id, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void)); + format_string(park_name, park_text_id, gCommonFormatArgs); } gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY; diff --git a/src/peep/peep.c b/src/peep/peep.c index 88d9ee4b26..a510ff8d05 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -1340,8 +1340,8 @@ void peep_update_falling(rct_peep* peep){ if (peep->action == PEEP_ACTION_DROWNING) return; if (gConfigNotifications.guest_died) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); news_item_add_to_queue(NEWS_ITEM_BLANK, STR_NEWS_ITEM_GUEST_DROWNED, peep->x | (peep->y << 16)); } @@ -2127,10 +2127,10 @@ static void peep_update_ride_sub_state_2_enter_ride(rct_peep* peep, rct_ride* ri } if (peep->peep_flags & PEEP_FLAGS_TRACKING){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + set_format_arg(6, uint16, ride->name); + set_format_arg(8, uint32, ride->name_arguments); rct_string_id msg_string; if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE)) @@ -3180,10 +3180,10 @@ static void peep_update_ride_sub_state_18(rct_peep* peep){ peep_on_enter_or_exit_ride(peep, peep->current_ride, 1); if (peep->peep_flags & PEEP_FLAGS_TRACKING){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + set_format_arg(6, uint16, ride->name); + set_format_arg(8, uint32, ride->name_arguments); if (gConfigNotifications.guest_left_ride) { news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_LEFT_RIDE_X, peep->sprite_index); @@ -6899,10 +6899,10 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m peep->sub_state = 11; peep->time_in_queue = 0; if (peep->peep_flags & PEEP_FLAGS_TRACKING){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, rct_string_id) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(0, rct_string_id, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + set_format_arg(6, rct_string_id, ride->name); + set_format_arg(8, uint32, ride->name_arguments); if (gConfigNotifications.guest_queuing_for_ride) { news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index); } @@ -6945,8 +6945,8 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m peep->var_37 = 0; if (peep->peep_flags & PEEP_FLAGS_TRACKING){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, rct_string_id, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); if (gConfigNotifications.guest_left_park) { news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_LEFT_PARK, peep->sprite_index); } @@ -7280,10 +7280,10 @@ static int peep_interact_with_path(rct_peep* peep, sint16 x, sint16 y, rct_map_e peep->destination_tolerence = 2; peep->time_in_queue = 0; if (peep->peep_flags & PEEP_FLAGS_TRACKING){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, rct_string_id) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(0, rct_string_id, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + set_format_arg(6, rct_string_id, ride->name); + set_format_arg(8, uint32, ride->name_arguments); if (gConfigNotifications.guest_queuing_for_ride) { news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index); } @@ -7353,10 +7353,10 @@ static int peep_interact_with_shop(rct_peep* peep, sint16 x, sint16 y, rct_map_e peep->time_on_ride = 0; ride->cur_num_customers++; if (peep->peep_flags & PEEP_FLAGS_TRACKING){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, rct_string_id) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(0, rct_string_id, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + set_format_arg(6, rct_string_id, ride->name); + set_format_arg(8, uint32, ride->name_arguments); rct_string_id string_id = ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE) ? STR_PEEP_TRACKING_PEEP_IS_IN_X : STR_PEEP_TRACKING_PEEP_IS_ON_X; if (gConfigNotifications.guest_used_facility) { news_item_add_to_queue(NEWS_ITEM_PEEP_ON_RIDE, string_id, peep->sprite_index); @@ -9023,9 +9023,9 @@ loc_69B221: peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; peep_update_sprite_type(peep); if (peep->peep_flags & PEEP_FLAGS_TRACKING) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS,uint16) = peep->name_string_idx; - RCT2_GLOBAL((RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2), uint32) = peep->id; - RCT2_GLOBAL((RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6), uint16) = (shopItem >= 32 ? STR_SHOP_ITEM_INDEFINITE_PHOTO2 + (shopItem - 32) : STR_SHOP_ITEM_INDEFINITE_BALLOON + shopItem); + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + set_format_arg(6, uint16, (shopItem >= 32 ? STR_SHOP_ITEM_INDEFINITE_PHOTO2 + (shopItem - 32) : STR_SHOP_ITEM_INDEFINITE_BALLOON + shopItem)); if (gConfigNotifications.guest_bought_item) { news_item_add_to_queue(2, STR_PEEP_TRACKING_NOTIFICATION_BOUGHT_X, peep->sprite_index); } @@ -10457,10 +10457,10 @@ money32 set_peep_name(int flags, int state, uint16 sprite_index, uint8* text_1, return 0; rct_peep* peep = GET_PEEP(sprite_index); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = peep->id; + set_format_arg(0, uint32, peep->id); utf8* curName = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, utf8); rct_string_id curId = peep->name_string_idx; - format_string(curName, curId, RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void)); + format_string(curName, curId, gCommonFormatArgs); if (strcmp(curName, fullText) == 0) return 0; diff --git a/src/ride/ride.c b/src/ride/ride.c index faa33bf10a..361bdddfee 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -889,15 +889,15 @@ static int ride_check_if_construction_allowed(rct_ride *ride) return 0; } if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(6, uint16, ride->name); + set_format_arg(8, uint32, ride->name_arguments); window_error_open(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING); return 0; } if (ride->status != RIDE_STATUS_CLOSED) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(6, uint16, ride->name); + set_format_arg(8, uint32, ride->name_arguments); window_error_open(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST); return 0; } @@ -1746,8 +1746,8 @@ int ride_modify(rct_xy_element *input) return 0; if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(6, uint16, ride->name); + set_format_arg(8, uint32, ride->name_arguments); window_error_open(STR_CANT_START_CONSTRUCTION_ON, STR_LOCAL_AUTHORITY_FORBIDS_DEMOLITION_OR_MODIFICATIONS_TO_THIS_RIDE); return 0; } @@ -2367,8 +2367,8 @@ void ride_breakdown_add_news_item(int rideIndex) { rct_ride *ride = get_ride(rideIndex); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); if (gConfigNotifications.ride_broken_down) { news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_BROKEN_DOWN, rideIndex); } @@ -2396,8 +2396,8 @@ static void ride_breakdown_status_update(int rideIndex) ride->mechanic_status != RIDE_MECHANIC_STATUS_FIXING && ride->mechanic_status != RIDE_MECHANIC_STATUS_4 ) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); if (gConfigNotifications.ride_warnings) { news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_IS_STILL_NOT_FIXED, rideIndex); } @@ -2965,8 +2965,8 @@ rct_ride_measurement *ride_get_measurement(int rideIndex, rct_string_id *message if (message != NULL) *message = 0; return measurement; } else { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = RideNameConvention[ride->type].vehicle_name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = RideNameConvention[ride->type].station_name; + set_format_arg(0, uint16, RideNameConvention[ride->type].vehicle_name); + set_format_arg(2, uint16, RideNameConvention[ride->type].station_name); if (message != NULL) *message = STR_DATA_LOGGING_WILL_START_WHEN_NEXT_LEAVES; return NULL; } @@ -3140,8 +3140,8 @@ static void ride_entrance_exit_connected(rct_ride* ride, int ride_idx) continue; if (entrance != 0xFFFF && !ride_entrance_exit_is_reachable(entrance, ride, i)) { // name of ride is parameter of the format string - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); if (gConfigNotifications.ride_warnings) { news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride_idx); } @@ -3150,8 +3150,8 @@ static void ride_entrance_exit_connected(rct_ride* ride, int ride_idx) if (exit != 0xFFFF && !ride_entrance_exit_is_reachable(exit, ride, i)) { // name of ride is parameter of the format string - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); if (gConfigNotifications.ride_warnings) { news_item_add_to_queue(1, STR_EXIT_NOT_CONNECTED, ride_idx); } @@ -3218,8 +3218,8 @@ static void ride_shop_connected(rct_ride* ride, int ride_idx) } // Name of ride is parameter of the format string - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); if (gConfigNotifications.ride_warnings) { news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride_idx); } @@ -8397,8 +8397,8 @@ void ride_crash(uint8 rideIndex, uint8 vehicleIndex) } } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, rct_string_id) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, rct_string_id, ride->name); + set_format_arg(2, uint32, ride->name_arguments); if (gConfigNotifications.ride_crashed) { news_item_add_to_queue(NEWS_ITEM_RIDE, STR_RIDE_HAS_CRASHED, rideIndex); } diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 1f844920af..d4caa95fb5 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -2526,7 +2526,7 @@ static void vehicle_check_if_missing(rct_vehicle* vehicle) { ride->lifecycle_flags |= RIDE_LIFECYCLE_11; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) + get_format_arg(0, rct_string_id) = RCT2_ADDRESS(0x0097C98E, rct_string_id)[ride->type * 4] + 6; uint8 vehicleIndex = 0; @@ -2534,10 +2534,10 @@ static void vehicle_check_if_missing(rct_vehicle* vehicle) { if (ride->vehicles[vehicleIndex] == vehicle->sprite_index) break; vehicleIndex++; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = vehicleIndex; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, rct_string_id) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint32) = ride->name_arguments; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 10, rct_string_id) = + set_format_arg(2, uint16, vehicleIndex); + set_format_arg(4, rct_string_id, ride->name); + set_format_arg(6, uint32, ride->name_arguments); + get_format_arg(10, rct_string_id) = RCT2_ADDRESS(0x0097C98E, rct_string_id)[ride->type * 4 + 2]; news_item_add_to_queue(NEWS_ITEM_RIDE, 2218, vehicle->ride); @@ -4094,7 +4094,7 @@ static void vehicle_kill_all_passengers(rct_vehicle* vehicle) { } rct_ride* ride = get_ride(vehicle->ride); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = numFatalities; + set_format_arg(0, uint16, numFatalities); uint8 crashType = numFatalities == 0 ? RIDE_CRASH_TYPE_NO_FATALITIES : @@ -4104,8 +4104,8 @@ static void vehicle_kill_all_passengers(rct_vehicle* vehicle) { ride->last_crash_type = crashType; if (numFatalities != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = ride->name_arguments; + set_format_arg(2, uint16, ride->name); + set_format_arg(4, uint32, ride->name_arguments); news_item_add_to_queue(NEWS_ITEM_RIDE, STR_X_PEOPLE_DIED_ON_X, vehicle->ride); if (RCT2_GLOBAL(0x135882E, uint16) < 500) { diff --git a/src/windows/cheats.c b/src/windows/cheats.c index ddfa441491..ac01305632 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -780,10 +780,10 @@ static void window_cheats_invalidate(rct_window *w) switch (w->page) { case WINDOW_CHEATS_PAGE_MONEY: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = 50000; + set_format_arg(0, int, 50000); break; case WINDOW_CHEATS_PAGE_GUESTS: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = 10000; + set_format_arg(0, int, 10000); widget_set_checkbox_value(w, WIDX_GUEST_IGNORE_RIDE_INTENSITY, gCheatsIgnoreRideIntensity); widget_set_checkbox_value(w, WIDX_DISABLE_VANDALISM, gCheatsDisableVandalism); widget_set_checkbox_value(w, WIDX_DISABLE_LITTERING, gCheatsDisableLittering); @@ -798,7 +798,7 @@ static void window_cheats_invalidate(rct_window *w) widget_set_checkbox_value(w, WIDX_NEVERENDING_MARKETING, gCheatsNeverendingMarketing); break; case WINDOW_CHEATS_PAGE_RIDES: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 255; + set_format_arg(0, uint16, 255); widget_set_checkbox_value(w, WIDX_FAST_LIFT_HILL, gCheatsFastLiftHill); widget_set_checkbox_value(w, WIDX_DISABLE_BRAKES_FAILURE, gCheatsDisableBrakesFailure); widget_set_checkbox_value(w, WIDX_DISABLE_ALL_BREAKDOWNS, gCheatsDisableAllBreakdowns); @@ -829,8 +829,8 @@ static void window_cheats_paint(rct_window *w, rct_drawpixelinfo *dpi) window_cheats_draw_tab_images(dpi, w); if (w->page == WINDOW_CHEATS_PAGE_MONEY){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = CHEATS_MONEY_INCREMENT; - gfx_draw_string_left(dpi, STR_CHEAT_5K_MONEY_TIP, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO); + set_format_arg(0, money32, CHEATS_MONEY_INCREMENT); + gfx_draw_string_left(dpi, STR_CHEAT_5K_MONEY_TIP, gCommonFormatArgs, 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO); gfx_draw_string_left(dpi, STR_CHEAT_CLEAR_LOAN_TIP, NULL, 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO); } else if(w->page == WINDOW_CHEATS_PAGE_MISC){ diff --git a/src/windows/demolish_ride_prompt.c b/src/windows/demolish_ride_prompt.c index 16316a4bcd..7800bbd231 100644 --- a/src/windows/demolish_ride_prompt.c +++ b/src/windows/demolish_ride_prompt.c @@ -132,11 +132,11 @@ static void window_ride_demolish_paint(rct_window *w, rct_drawpixelinfo *dpi) rct_ride* ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); int x = w->x + WW / 2; int y = w->y + (WH / 2) - 3; - gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, WW - 4, STR_DEMOLISH_RIDE_ID, 0); + gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, WW - 4, STR_DEMOLISH_RIDE_ID, 0); } diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c index 4a75319f76..1e4f46a743 100644 --- a/src/windows/editor_inventions_list.c +++ b/src/windows/editor_inventions_list.c @@ -675,7 +675,7 @@ static void window_editor_inventions_list_scrollmouseover(rct_window *w, int scr */ static void window_editor_inventions_list_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 3159; + set_format_arg(0, uint16, 3159); } /** diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index d3c801c9ed..6496fa9409 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -1070,11 +1070,11 @@ static void window_editor_object_selection_tooltip(rct_window* w, int widgetInde case WIDX_TAB_9: case WIDX_TAB_10: case WIDX_TAB_11: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = + get_format_arg(0, rct_string_id) = STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS + (widgetIndex - WIDX_TAB_1); break; default: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = STR_LIST; + set_format_arg(0, rct_string_id, STR_LIST); break; } } @@ -1118,7 +1118,7 @@ static void window_editor_object_selection_invalidate(rct_window *w) w->pressed_widgets &= ~(1 << WIDX_ADVANCED); // Set window title and buttons - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS + w->selected_tab; + set_format_arg(0, rct_string_id, STR_OBJECT_SELECTION_RIDE_VEHICLES_ATTRACTIONS + w->selected_tab); if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { w->widgets[WIDX_TITLE].image = STR_TRACK_DESIGNS_MANAGER_SELECT_RIDE_TYPE; w->widgets[WIDX_INSTALL_TRACK].type = WWT_DROPDOWN_BUTTON; @@ -1293,9 +1293,9 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) totalSelectable = 4; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = numSelected; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = totalSelectable; - gfx_draw_string_left(dpi, 3164, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, numSelected); + set_format_arg(2, uint16, totalSelectable); + gfx_draw_string_left(dpi, 3164, gCommonFormatArgs, 0, x, y); } rct_stex_entry* stex_entry = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TEXT_TEMP_CHUNK, rct_stex_entry*); @@ -1309,11 +1309,11 @@ static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinf 0x30 ); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&_filter_string; + set_format_arg(0, uint32, (uint32)&_filter_string); gfx_draw_string_left_clipped( dpi, 1170, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, w->colours[1], w->x + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].left + 1, w->y + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].top, @@ -1879,9 +1879,8 @@ static int window_editor_object_selection_select_object(uint8 bh, int flags, rct } if (bh != 0 && !(flags&(1 << 1))){ - uint32* arguments = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32); object_create_identifier_name((char*)0x009BC95A, installedObject); - *arguments = (uint32)0x009BC95A; + set_format_arg(0, uint32, 0x009BC95A); set_object_selection_error(bh, 3172); return 0; } diff --git a/src/windows/editor_objective_options.c b/src/windows/editor_objective_options.c index 99ea9960cc..478d743f5d 100644 --- a/src/windows/editor_objective_options.c +++ b/src/windows/editor_objective_options.c @@ -399,7 +399,7 @@ static void window_editor_objective_options_main_mouseup(rct_window *w, int widg window_editor_objective_options_set_page(w, widgetIndex - WIDX_TAB_1); break; case WIDX_PARK_NAME: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = gParkNameArgs; + set_format_arg(16, uint32, gParkNameArgs); window_text_input_open(w, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, gParkName, 0, 32); break; case WIDX_SCENARIO_NAME: @@ -985,12 +985,12 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi width = w->widgets[WIDX_PARK_NAME].left - 16; if (stex != NULL) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = stex->park_name; + set_format_arg(0, uint16, stex->park_name); } else { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = gParkName; + set_format_arg(0, uint16, gParkName); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs; - gfx_draw_string_left_clipped(dpi, 3298, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, width); + set_format_arg(2, uint32, gParkNameArgs); + gfx_draw_string_left_clipped(dpi, 3298, gCommonFormatArgs, 0, x, y, width); // Scenario name x = w->x + 8; @@ -998,13 +998,13 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi width = w->widgets[WIDX_SCENARIO_NAME].left - 16; if (stex != NULL) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = stex->scenario_name; + set_format_arg(0, uint16, stex->scenario_name); } else { safe_strcpy((char*)0x009BC677, s6Info->name, 64); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 3165; + set_format_arg(0, uint16, 3165); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs; - gfx_draw_string_left_clipped(dpi, 3300, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, width); + set_format_arg(2, uint32, gParkNameArgs); + gfx_draw_string_left_clipped(dpi, 3300, gCommonFormatArgs, 0, x, y, width); // Scenario details label x = w->x + 8; @@ -1017,13 +1017,13 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi width = w->widgets[WIDX_DETAILS].left - 4; if (stex != NULL) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = stex->details; + set_format_arg(0, uint16, stex->details); } else { safe_strcpy((char*)0x009BC677, s6Info->details, 256); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 3165; + set_format_arg(0, uint16, 3165); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs; - gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, width, 1191, 0); + set_format_arg(2, uint32, gParkNameArgs); + gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, width, 1191, 0); // Scenario category label x = w->x + 8; diff --git a/src/windows/error.c b/src/windows/error.c index 827ab16d0a..5a9c90db95 100644 --- a/src/windows/error.c +++ b/src/windows/error.c @@ -77,25 +77,23 @@ static uint16 _window_error_num_lines; void window_error_open(rct_string_id title, rct_string_id message) { utf8 *dst; - char *args; int numLines, fontHeight, x, y, width, height, maxY; rct_window *w; window_close_by_class(WC_ERROR); dst = _window_error_text; - args = (char*)RCT2_ADDRESS_COMMON_FORMAT_ARGS; // Format the title dst = utf8_write_codepoint(dst, FORMAT_BLACK); if (title != STR_NONE) { - format_string(dst, title, args); + format_string(dst, title, gCommonFormatArgs); dst = get_string_end(dst); } // Format the message if (message != STR_NONE) { dst = utf8_write_codepoint(dst, FORMAT_NEWLINE); - format_string(dst, message, args); + format_string(dst, message, gCommonFormatArgs); dst = get_string_end(dst); } diff --git a/src/windows/finances.c b/src/windows/finances.c index 25ef2b9ed7..c2efe7be57 100644 --- a/src/windows/finances.c +++ b/src/windows/finances.c @@ -636,7 +636,7 @@ static void window_finances_summary_invalidate(rct_window *w) } window_finances_set_pressed_tab(w); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, money32) = gBankLoan; + set_format_arg(6, money32, gBankLoan); } /** @@ -678,12 +678,12 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) continue; // Month heading - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_FINANCES_SUMMARY_MONTH_HEADING; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = monthyear; + set_format_arg(0, uint16, STR_FINANCES_SUMMARY_MONTH_HEADING); + set_format_arg(2, uint16, monthyear); draw_string_right_underline( dpi, monthyear == currentMonthYear ? 1193 : 1191, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, 0, x + 80, y - 1 @@ -730,8 +730,8 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) // Loan and interest rate gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_LOAN, NULL, 0, w->x + 4, w->y + 229); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gBankLoanInterestRate; - gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, w->x + 156, w->y + 229); + set_format_arg(0, uint16, gBankLoanInterestRate); + gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, gCommonFormatArgs, 0, w->x + 156, w->y + 229); // Current cash money32 currentCash = DECRYPT_MONEY(gCashEncrypted); @@ -748,8 +748,8 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) lastMonthProfit += RCT2_GLOBAL(0x013578A0, money32); lastMonthProfit += RCT2_GLOBAL(0x013578A4, money32); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = lastMonthProfit; - gfx_draw_string_left(dpi, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, w->x + 280, w->y + 229); + set_format_arg(0, money32, lastMonthProfit); + gfx_draw_string_left(dpi, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, gCommonFormatArgs, 0, w->x + 280, w->y + 229); } else { // Park value and company value gfx_draw_string_left(dpi, STR_PARK_VALUE_LABEL, &gParkValue, 0, w->x + 280, w->y + 229); @@ -1179,24 +1179,24 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp continue; noCampaignsActive = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gParkName; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs; + set_format_arg(0, uint16, gParkName); + set_format_arg(2, uint32, gParkNameArgs); // Set special parameters switch (i) { case ADVERTISING_CAMPAIGN_RIDE_FREE: case ADVERTISING_CAMPAIGN_RIDE: ride = get_ride(gMarketingCampaignRideIndex[i]); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); break; case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ShopItemStringIds[gMarketingCampaignRideIndex[i]].plural; + set_format_arg(0, uint16, ShopItemStringIds[gMarketingCampaignRideIndex[i]].plural); break; } // Advertisement - gfx_draw_string_left_clipped(dpi, STR_VOUCHERS_FOR_FREE_ENTRY_TO + i, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x + 4, y, 296); + gfx_draw_string_left_clipped(dpi, STR_VOUCHERS_FOR_FREE_ENTRY_TO + i, gCommonFormatArgs, 0, x + 4, y, 296); // Duration weeksRemaining = (gMarketingCampaignDaysLeft[i] % 128); diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index 8075e70577..37bb362ac7 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -217,18 +217,18 @@ static void window_game_bottom_toolbar_tooltip(rct_window* w, int widgetIndex, r switch (widgetIndex) { case WIDX_MONEY: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = gCurrentProfit; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = gParkValue; + set_format_arg(0, int, gCurrentProfit); + set_format_arg(4, int, gParkValue); break; case WIDX_PARK_RATING: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = gParkRating; + set_format_arg(0, short, gParkRating); break; case WIDX_DATE: month = gDateMonthsElapsed & 7; day = ((gDateMonthTicks * days_in_month[month]) >> 16) & 0xFF; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = STR_DATE_DAY_1 + day; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, short) = STR_MONTH_MARCH + month; + set_format_arg(0, short, STR_DATE_DAY_1 + day); + set_format_arg(2, short, STR_MONTH_MARCH + month); break; } } @@ -378,13 +378,13 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r // Draw money if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = DECRYPT_MONEY(gCashEncrypted); + set_format_arg(0, int, DECRYPT_MONEY(gCashEncrypted)); gfx_draw_string_centred( dpi, - (RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) < 0 ? 1391 : 1390), + (get_format_arg(0, int) < 0 ? 1391 : 1390), x, y - 3, (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_MONEY ? COLOUR_WHITE : w->colours[0] & 0x7F), - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS + gCommonFormatArgs ); y += 7; } @@ -453,16 +453,16 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, int day = ((gDateMonthTicks * days_in_month[month]) >> 16) & 0xFF; rct_string_id stringId = DateFormatStringFormatIds[gConfigGeneral.date_format]; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = STR_DATE_DAY_1 + day; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, short) = month; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, short) = year; + set_format_arg(0, short, STR_DATE_DAY_1 + day); + set_format_arg(2, short, month); + set_format_arg(4, short, year); gfx_draw_string_centred( dpi, stringId, x, y, (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_DATE ? COLOUR_WHITE : w->colours[0] & 0x7F), - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS + gCommonFormatArgs ); // Temperature @@ -475,8 +475,8 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, temperature = climate_celsius_to_fahrenheit(temperature); format = STR_FAHRENHEIT_VALUE; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = temperature; - gfx_draw_string_left(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y + 6); + set_format_arg(0, short, temperature); + gfx_draw_string_left(dpi, format, gCommonFormatArgs, 0, x, y + 6); x += 30; // Current weather diff --git a/src/windows/guest.c b/src/windows/guest.c index f38c7d916d..9948d33f9b 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -1007,13 +1007,13 @@ void window_guest_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) uint32 argument1, argument2; rct_peep* peep = GET_PEEP(w->number); get_arguments_from_action(peep, &argument1, &argument2); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = argument2; + set_format_arg(0, uint32, argument1); + set_format_arg(4, uint32, argument2); rct_widget* widget = &w->widgets[WIDX_ACTION_LBL]; int x = (widget->left + widget->right) / 2 + w->x; int y = w->y + widget->top - 1; int width = widget->right - widget->left; - gfx_draw_string_centred_clipped(dpi, 1191, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, width); + gfx_draw_string_centred_clipped(dpi, 1191, gCommonFormatArgs, 0, x, y, width); // Draw the marquee thought widget = &w->widgets[WIDX_MARQUEE]; @@ -1043,12 +1043,12 @@ void window_guest_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) get_arguments_from_thought(peep->thoughts[i], &argument1, &argument2); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = argument2; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint16) = 0; + set_format_arg(0, uint32, argument1); + set_format_arg(4, uint32, argument2); + set_format_arg(8, uint16, 0); x = widget->right - widget->left - w->list_information_type; - gfx_draw_string_left(&dpi_marquee, 1193, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, 0); + gfx_draw_string_left(&dpi_marquee, 1193, gCommonFormatArgs, 0, x, 0); } /** @@ -1068,8 +1068,8 @@ void window_guest_overview_invalidate(rct_window *w) w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1); rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS,uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2,uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); w->pressed_widgets &= ~(1<peep_flags & PEEP_FLAGS_TRACKING){ @@ -1367,8 +1367,8 @@ void window_guest_stats_invalidate(rct_window *w) w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1); rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); window_guest_stats_widgets[WIDX_BACKGROUND].right = w->width - 1; window_guest_stats_widgets[WIDX_BACKGROUND].bottom = w->height - 1; @@ -1433,7 +1433,7 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) int y = w->y + window_guest_rides_widgets[WIDX_PAGE_BACKGROUND].top + 4; //Happiness - gfx_draw_string_left(dpi, 1662, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 1662, gCommonFormatArgs, 0, x, y); int happiness = peep->happiness; if (happiness < 10)happiness = 10; @@ -1445,7 +1445,7 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) //Energy y += 10; - gfx_draw_string_left(dpi, 1664, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 1664, gCommonFormatArgs, 0, x, y); int energy = ((peep->energy - 32) * 85) / 32; ebp = 14; @@ -1457,7 +1457,7 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) //Hunger y += 10; - gfx_draw_string_left(dpi, 1665, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 1665, gCommonFormatArgs, 0, x, y); int hunger = peep->hunger; if (hunger > 190) hunger = 190; @@ -1476,7 +1476,7 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) //Thirst y += 10; - gfx_draw_string_left(dpi, 1666, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 1666, gCommonFormatArgs, 0, x, y); int thirst = peep->thirst; if (thirst > 190) thirst = 190; @@ -1495,7 +1495,7 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) //Nausea y += 10; - gfx_draw_string_left(dpi, 1663, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 1663, gCommonFormatArgs, 0, x, y); int nausea = peep->nausea - 32; @@ -1511,7 +1511,7 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) //Bathroom y += 10; - gfx_draw_string_left(dpi, 1667, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 1667, gCommonFormatArgs, 0, x, y); int bathroom = peep->bathroom - 32; if (bathroom > 210) bathroom = 210; @@ -1533,8 +1533,8 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) int eax = gScenarioTicks; eax -= peep->time_in_park; eax >>= 11; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = eax & 0xFFFF; - gfx_draw_string_left(dpi, 1458, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, eax & 0xFFFF); + gfx_draw_string_left(dpi, 1458, gCommonFormatArgs, 0, x, y); } y += 19; @@ -1546,22 +1546,22 @@ void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) // Intensity int intensity = peep->intensity / 16; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = intensity; + set_format_arg(0, uint16, intensity); int string_id = 1658; if (peep->intensity & 0xF){ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->intensity & 0xF; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = intensity; + set_format_arg(0, uint16, peep->intensity & 0xF); + set_format_arg(2, uint16, intensity); string_id = 1659; if (intensity == 15) string_id = 1660; } - gfx_draw_string_left(dpi, string_id, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x + 4, y); + gfx_draw_string_left(dpi, string_id, gCommonFormatArgs, 0, x + 4, y); // Nausea tolerance y += 10; int nausea_tolerance = peep->nausea_tolerance & 0x3; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = nausea_tolerance + 2368; - gfx_draw_string_left(dpi, 1661, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, nausea_tolerance + 2368); + gfx_draw_string_left(dpi, 1661, gCommonFormatArgs, 0, x, y); } /** @@ -1616,7 +1616,7 @@ void window_guest_rides_update(rct_window *w) */ void window_guest_rides_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } /** @@ -1692,8 +1692,8 @@ void window_guest_rides_invalidate(rct_window *w) w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1); rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); window_guest_rides_widgets[WIDX_BACKGROUND].right = w->width - 1; window_guest_rides_widgets[WIDX_BACKGROUND].bottom = w->height - 1; @@ -1744,10 +1744,10 @@ void window_guest_rides_paint(rct_window *w, rct_drawpixelinfo *dpi) ride_string_arguments = ride->name_arguments; ride_string_id = ride->name; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride_string_id; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride_string_arguments; + set_format_arg(0, uint16, ride_string_id); + set_format_arg(2, uint32, ride_string_arguments); - gfx_draw_string_left_clipped(dpi, 3093, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, w->width - 14); + gfx_draw_string_left_clipped(dpi, 3093, gCommonFormatArgs, 0, x, y, w->width - 14); } /** @@ -1819,8 +1819,8 @@ void window_guest_finance_invalidate(rct_window *w) rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); window_guest_finance_widgets[WIDX_BACKGROUND].right = w->width - 1; window_guest_finance_widgets[WIDX_BACKGROUND].bottom = w->height - 1; @@ -1858,63 +1858,63 @@ void window_guest_finance_paint(rct_window *w, rct_drawpixelinfo *dpi) int y = w->y + window_guest_finance_widgets[WIDX_PAGE_BACKGROUND].top + 4; // Cash in pocket - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = peep->cash_in_pocket; - gfx_draw_string_left(dpi, 1457, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, money32, peep->cash_in_pocket); + gfx_draw_string_left(dpi, 1457, gCommonFormatArgs, 0, x, y); // Cash spent y += 10; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = peep->cash_spent; - gfx_draw_string_left(dpi, 1456, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, money32, peep->cash_spent); + gfx_draw_string_left(dpi, 1456, gCommonFormatArgs, 0, x, y); y += 20; gfx_fill_rect_inset(dpi, x, y - 6, x + 179, y - 5, w->colours[1], 32); // Paid to enter - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = peep->paid_to_enter; - gfx_draw_string_left(dpi, 2296, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, money32, peep->paid_to_enter); + gfx_draw_string_left(dpi, 2296, gCommonFormatArgs, 0, x, y); // Paid on rides y += 10; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = peep->paid_on_rides; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = peep->no_of_rides; + set_format_arg(0, money32, peep->paid_on_rides); + set_format_arg(4, uint16, peep->no_of_rides); if (peep->no_of_rides != 1){ - gfx_draw_string_left(dpi, 2298, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2298, gCommonFormatArgs, 0, x, y); } else{ - gfx_draw_string_left(dpi, 2297, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2297, gCommonFormatArgs, 0, x, y); } // Paid on food y += 10; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = peep->paid_on_food; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = peep->no_of_food; + set_format_arg(0, money32, peep->paid_on_food); + set_format_arg(4, uint16, peep->no_of_food); if (peep->no_of_food != 1){ - gfx_draw_string_left(dpi, 2300, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2300, gCommonFormatArgs, 0, x, y); } else{ - gfx_draw_string_left(dpi, 2299, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2299, gCommonFormatArgs, 0, x, y); } // Paid on drinks y += 10; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = peep->paid_on_drink; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = peep->no_of_drinks; + set_format_arg(0, money32, peep->paid_on_drink); + set_format_arg(4, uint16, peep->no_of_drinks); if (peep->no_of_drinks != 1){ - gfx_draw_string_left(dpi, 2302, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2302, gCommonFormatArgs, 0, x, y); } else{ - gfx_draw_string_left(dpi, 2301, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2301, gCommonFormatArgs, 0, x, y); } // Paid on souvenirs y += 10; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, money32) = peep->paid_on_souvenirs; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = peep->no_of_souvenirs; + set_format_arg(0, money32, peep->paid_on_souvenirs); + set_format_arg(4, uint16, peep->no_of_souvenirs); if (peep->no_of_souvenirs != 1){ - gfx_draw_string_left(dpi, 2304, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2304, gCommonFormatArgs, 0, x, y); } else{ - gfx_draw_string_left(dpi, 2303, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, 2303, gCommonFormatArgs, 0, x, y); } } @@ -1962,8 +1962,8 @@ void window_guest_thoughts_invalidate(rct_window *w) rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); window_guest_thoughts_widgets[WIDX_BACKGROUND].right = w->width - 1; window_guest_thoughts_widgets[WIDX_BACKGROUND].bottom = w->height - 1; @@ -2009,14 +2009,14 @@ void window_guest_thoughts_paint(rct_window *w, rct_drawpixelinfo *dpi) uint32 argument1, argument2; get_arguments_from_thought(*thought, &argument1, &argument2); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = argument2; + set_format_arg(0, uint32, argument1); + set_format_arg(4, uint32, argument2); int width = window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].right - window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].left - 8; - y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, width, 1191, 0); + y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, width, 1191, 0); // If this is the last visable line end drawing. if (y > w->y + window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].bottom - 32) return; @@ -2068,8 +2068,8 @@ void window_guest_inventory_invalidate(rct_window *w) rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); window_guest_inventory_widgets[WIDX_BACKGROUND].right = w->width - 1; window_guest_inventory_widgets[WIDX_BACKGROUND].bottom = w->height - 1; @@ -2189,7 +2189,7 @@ void window_guest_inventory_paint(rct_window *w, rct_drawpixelinfo *dpi) if (y >= maxY) break; if (!peep_has_item(peep, item)) continue; - void *args = (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS; + void *args = gCommonFormatArgs; rct_string_id stringId = window_guest_inventory_format_item(peep, item, (uint8*)args); y += gfx_draw_string_left_wrapped(dpi, args, x, y, itemNameWidth, stringId, 0); numItems++; diff --git a/src/windows/guest_list.c b/src/windows/guest_list.c index a976bcac5c..f911221574 100644 --- a/src/windows/guest_list.c +++ b/src/windows/guest_list.c @@ -541,7 +541,7 @@ static void window_guest_list_scrollmouseover(rct_window *w, int scrollIndex, in */ static void window_guest_list_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } /** @@ -626,8 +626,8 @@ static void window_guest_list_paint(rct_window *w, rct_drawpixelinfo *dpi) if (_window_guest_list_selected_tab == PAGE_INDIVIDUAL) { x = w->x + 4; y = w->y + window_guest_list_widgets[WIDX_GUEST_LIST].bottom + 2; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, sint16) = w->var_492; - gfx_draw_string_left(dpi, (w->var_492 == 1 ? 1755 : 1754), (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, sint16, w->var_492); + gfx_draw_string_left(dpi, (w->var_492 == 1 ? 1755 : 1754), gCommonFormatArgs, 0, x, y); } } @@ -678,9 +678,9 @@ static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, } // Guest name - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; - gfx_draw_string_left_clipped(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 0, y - 1, 113); + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, 0, 0, y - 1, 113); switch (_window_guest_list_selected_view) { case VIEW_ACTIONS: @@ -695,9 +695,9 @@ static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, get_arguments_from_action(peep, &argument_1, &argument_2); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument_1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = argument_2; - gfx_draw_string_left_clipped(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 133, y - 1, 314); + set_format_arg(0, uint32, argument_1); + set_format_arg(4, uint32, argument_2); + gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, 0, 133, y - 1, 314); break; case VIEW_THOUGHTS: // For each thought @@ -712,9 +712,9 @@ static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, get_arguments_from_thought(peep->thoughts[j], &argument_1, &argument_2); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument_1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = argument_2; - gfx_draw_string_left_clipped(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 118, y - 1, 329); + set_format_arg(0, uint32, argument_1); + set_format_arg(4, uint32, argument_2); + gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, 0, 118, y - 1, 329); break; } break; @@ -750,14 +750,14 @@ static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, gfx_draw_sprite(dpi, _window_guest_list_groups_guest_faces[i * 56 + j] + 5486, j * 8, y + 9, 0); // Draw action - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = _window_guest_list_groups_argument_1[i]; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = _window_guest_list_groups_argument_2[i]; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 10, uint32) = numGuests; - gfx_draw_string_left_clipped(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 0, y - 1, 414); + set_format_arg(0, uint32, _window_guest_list_groups_argument_1[i]); + set_format_arg(4, uint32, _window_guest_list_groups_argument_2[i]); + set_format_arg(10, uint32, numGuests); + gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, 0, 0, y - 1, 414); // Draw guest count - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint16) = STR_GUESTS_COUNT_COMMA_SEP; - gfx_draw_string_right(dpi, format, (void*)(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8), 0, 326, y - 1); + set_format_arg(8, uint16, STR_GUESTS_COUNT_COMMA_SEP); + gfx_draw_string_right(dpi, format, gCommonFormatArgs + 8, 0, 326, y - 1); } y += 21; } @@ -793,8 +793,8 @@ static int window_guest_list_is_peep_in_filter(rct_peep* peep) * Calculates a hash value (arguments) for comparing peep actions/thoughts * rct2: 0x0069B7EA * peep (esi) - * argument_1 (0x013CE952) (RCT2_ADDRESS_COMMON_FORMAT_ARGS) - * argument_2 (0x013CE954) (RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2) + * argument_1 (0x013CE952) gCommonFormatArgs + * argument_2 (0x013CE954) gCommonFormatArgs + 2 */ static void get_arguments_from_peep(rct_peep *peep, uint32 *argument_1, uint32* argument_2) { diff --git a/src/windows/install_track.c b/src/windows/install_track.c index 7a27cd9c32..5b2bb61c6d 100644 --- a/src/windows/install_track.c +++ b/src/windows/install_track.c @@ -288,9 +288,9 @@ static void window_install_track_paint(rct_window *w, rct_drawpixelinfo *dpi) } // Ride length - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 1345; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = td6->ride_length; - gfx_draw_string_left_clipped(dpi, STR_TRACK_LIST_RIDE_LENGTH, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, 214); + set_format_arg(0, uint16, 1345); + set_format_arg(2, uint16, td6->ride_length); + gfx_draw_string_left_clipped(dpi, STR_TRACK_LIST_RIDE_LENGTH, gCommonFormatArgs, 0, x, y, 214); y += 10; } @@ -344,9 +344,9 @@ static void window_install_track_paint(rct_window *w, rct_drawpixelinfo *dpi) if (td6->space_required_x != 0xFF) { // Space required - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = td6->space_required_x; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = td6->space_required_y; - gfx_draw_string_left(dpi, STR_TRACK_LIST_SPACE_REQUIRED, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, td6->space_required_x); + set_format_arg(2, uint16, td6->space_required_y); + gfx_draw_string_left(dpi, STR_TRACK_LIST_SPACE_REQUIRED, gCommonFormatArgs, 0, x, y); y += 10; } diff --git a/src/windows/land.c b/src/windows/land.c index 6be9d57f1e..d995b59eff 100644 --- a/src/windows/land.c +++ b/src/windows/land.c @@ -405,7 +405,7 @@ static void window_land_paint(rct_window *w, rct_drawpixelinfo *dpi) price += numTiles * 100; if (price != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, sint32) = price; - gfx_draw_string_centred(dpi, 986, x, y, 0, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + set_format_arg(0, sint32, price); + gfx_draw_string_centred(dpi, 986, x, y, 0, gCommonFormatArgs); } } diff --git a/src/windows/loadsave.c b/src/windows/loadsave.c index 319d4b437c..cde92e1877 100644 --- a/src/windows/loadsave.c +++ b/src/windows/loadsave.c @@ -478,7 +478,7 @@ static void window_loadsave_textinput(rct_window *w, int widgetIndex, char *text static void window_loadsave_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } static void window_loadsave_invalidate(rct_window *w) @@ -717,7 +717,7 @@ static void window_loadsave_select(rct_window *w, const char *path) if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0) strcat(newName, ".sv6"); if (title_sequence_save_exists(gCurrentTitleSequence, newName)) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&_listItems[w->selected_list_item].name; + set_format_arg(0, uint32, (uint32)&_listItems[w->selected_list_item].name); window_text_input_open(w, WIDX_SCROLL, 5435, 5404, 1170, (uint32)_listItems[w->selected_list_item].name, TITLE_SEQUENCE_MAX_SAVE_LENGTH - 1); } else { diff --git a/src/windows/map.c b/src/windows/map.c index c3f11a7b06..27748edf1d 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -639,7 +639,7 @@ static void window_map_textinput(rct_window *w, int widgetIndex, char *text) */ static void window_map_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = 3157; + set_format_arg(0, short, 3157); } /** @@ -927,7 +927,7 @@ static void window_map_show_default_scenario_editor_buttons(rct_window *w) { w->widgets[WIDX_MAP_SIZE_SPINNER].type = WWT_SPINNER; w->widgets[WIDX_MAP_SIZE_SPINNER_UP].type = WWT_DROPDOWN_BUTTON; w->widgets[WIDX_MAP_SIZE_SPINNER_DOWN].type = WWT_DROPDOWN_BUTTON; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = gMapSize - 2; + set_format_arg(2, uint16, gMapSize - 2); } static void window_map_inputsize_land(rct_window *w) diff --git a/src/windows/maze_construction.c b/src/windows/maze_construction.c index 724b65e7dc..b01c7e1860 100644 --- a/src/windows/maze_construction.c +++ b/src/windows/maze_construction.c @@ -419,8 +419,8 @@ static void window_maze_construction_invalidate(rct_window *w) rct_ride *ride = get_ride(_currentRideIndex); // Set window title arguments - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, rct_string_id) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint32) = ride->name_arguments; + set_format_arg(4, rct_string_id, ride->name); + set_format_arg(6, uint32, ride->name_arguments); } /** diff --git a/src/windows/multiplayer.c b/src/windows/multiplayer.c index 1ad960f8f7..01e29f979a 100644 --- a/src/windows/multiplayer.c +++ b/src/windows/multiplayer.c @@ -428,11 +428,11 @@ static void window_multiplayer_players_scrollpaint(rct_window *w, rct_drawpixeli // Draw last action int action = network_get_player_last_action(i, 2000); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_ACTION_NA; + set_format_arg(0, uint16, STR_ACTION_NA); if (action != -999) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = network_get_action_name_string_id(action); + set_format_arg(0, uint16, network_get_action_name_string_id(action)); } - gfx_draw_string_left_clipped(dpi, 1191, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 256, y - 1, 100); + gfx_draw_string_left_clipped(dpi, 1191, gCommonFormatArgs, 0, 256, y - 1, 100); // Draw ping lineCh = buffer; @@ -610,11 +610,11 @@ static void window_multiplayer_groups_paint(rct_window *w, rct_drawpixelinfo *dp lineCh = buffer; lineCh = utf8_write_codepoint(lineCh, FORMAT_WINDOW_COLOUR_2); strcpy(lineCh, network_get_group_name(group)); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, const char *) = buffer; + set_format_arg(0, const char *, buffer); gfx_draw_string_centred_clipped( dpi, STR_STRING, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, 0, w->x + (widget->left + widget->right - 11) / 2, w->y + widget->top, @@ -639,11 +639,11 @@ static void window_multiplayer_groups_paint(rct_window *w, rct_drawpixelinfo *dp lineCh = buffer; lineCh = utf8_write_codepoint(lineCh, FORMAT_WINDOW_COLOUR_2); strcpy(lineCh, network_get_group_name(group)); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, const char *) = buffer; + set_format_arg(0, const char *, buffer); gfx_draw_string_centred_clipped( dpi, STR_STRING, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, 0, w->x + (widget->left + widget->right - 11) / 2, w->y + widget->top, @@ -680,8 +680,8 @@ static void window_multiplayer_groups_scrollpaint(rct_window *w, rct_drawpixelin } // Draw action name - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = network_get_action_name_string_id(i); - gfx_draw_string_left(dpi, 1193, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 10, y - 1); + set_format_arg(0, uint16, network_get_action_name_string_id(i)); + gfx_draw_string_left(dpi, 1193, gCommonFormatArgs, 0, 10, y - 1); } y += 10; } diff --git a/src/windows/new_campaign.c b/src/windows/new_campaign.c index 36f3f5c6a8..4c31f583d4 100644 --- a/src/windows/new_campaign.c +++ b/src/windows/new_campaign.c @@ -342,7 +342,7 @@ static void window_new_campaign_invalidate(rct_window *w) if (w->campaign.ride_id != SELECTED_RIDE_UNDEFINED) { rct_ride *ride = get_ride(w->campaign.ride_id); window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].image = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = ride->name_arguments; + set_format_arg(0, uint32, ride->name_arguments); } break; case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE: diff --git a/src/windows/new_ride.c b/src/windows/new_ride.c index cc88ecdc70..8c0897000d 100644 --- a/src/windows/new_ride.c +++ b/src/windows/new_ride.c @@ -713,7 +713,7 @@ static void window_new_ride_scrollmouseover(rct_window *w, int scrollIndex, int */ static void window_new_ride_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 3159; + set_format_arg(0, uint16, 3159); } /** @@ -865,9 +865,9 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli rideDescription = item.type + 512; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, rct_string_id) = rideName; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, rct_string_id) = rideDescription; - gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, width, 1690, 0); + set_format_arg(0, rct_string_id, rideName); + set_format_arg(2, rct_string_id, rideDescription); + gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, width, 1690, 0); // Number of designs available if (ride_type_has_flag(item.type, RIDE_TYPE_FLAG_HAS_TRACK)) { diff --git a/src/windows/news.c b/src/windows/news.c index 7040b8bf40..c0b6d762ce 100644 --- a/src/windows/news.c +++ b/src/windows/news.c @@ -250,7 +250,7 @@ static void window_news_scrollmousedown(rct_window *w, int scrollIndex, int x, i */ static void window_news_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 3159; + set_format_arg(0, uint16, 3159); } /** @@ -291,9 +291,9 @@ static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int s gfx_fill_rect_inset(dpi, -1, y, 383, y + 41, w->colours[1], 0x24); // Date text - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_DATE_DAY_1 + newsItem->day - 1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = STR_MONTH_MARCH + (newsItem->month_year % 8); - gfx_draw_string_left(dpi, 2235, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 2, 4, y); + set_format_arg(0, uint16, STR_DATE_DAY_1 + newsItem->day - 1); + set_format_arg(2, uint16, STR_MONTH_MARCH + (newsItem->month_year % 8)); + gfx_draw_string_left(dpi, 2235, gCommonFormatArgs, 2, 4, y); // Item text utf8 buffer[400]; diff --git a/src/windows/options.c b/src/windows/options.c index a4a499bc68..9425f9cfa5 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -1318,9 +1318,9 @@ static void window_options_invalidate(rct_window *w) switch (w->page) { case WINDOW_OPTIONS_PAGE_DISPLAY: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint16) = (uint16)gConfigGeneral.fullscreen_width; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 18, uint16) = (uint16)gConfigGeneral.fullscreen_height; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 12, uint16) = 2773 + gConfigGeneral.fullscreen_mode; + set_format_arg(16, uint16, (uint16)gConfigGeneral.fullscreen_width); + set_format_arg(18, uint16, (uint16)gConfigGeneral.fullscreen_height); + set_format_arg(12, uint16, 2773 + gConfigGeneral.fullscreen_mode); // disable resolution dropdown on "Fullscreen (desktop)" if (gConfigGeneral.fullscreen_mode == 2){ @@ -1385,7 +1385,7 @@ static void window_options_invalidate(rct_window *w) case WINDOW_OPTIONS_PAGE_CULTURE: // currency: pounds, dollars, etc. (10 total) - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 12, uint16) = CurrencyDescriptors[gConfigGeneral.currency_format].stringId; + set_format_arg(12, uint16, CurrencyDescriptors[gConfigGeneral.currency_format].stringId); // distance: metric / imperial / si { @@ -1396,14 +1396,14 @@ static void window_options_invalidate(rct_window *w) case MEASUREMENT_FORMAT_METRIC: stringId = STR_METRIC; break; case MEASUREMENT_FORMAT_SI: stringId = STR_SI; break; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 14, uint16) = stringId; + set_format_arg(14, uint16, stringId); } // temperature: celsius/fahrenheit - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 20, uint16) = STR_CELSIUS + gConfigGeneral.temperature_format; + set_format_arg(20, uint16, STR_CELSIUS + gConfigGeneral.temperature_format); // height: units/real values - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = gConfigGeneral.show_height_as_units ? STR_UNITS : STR_REAL_VALUES; + set_format_arg(6, uint16, gConfigGeneral.show_height_as_units ? STR_UNITS : STR_REAL_VALUES); window_options_culture_widgets[WIDX_LANGUAGE].type = WWT_DROPDOWN; window_options_culture_widgets[WIDX_LANGUAGE_DROPDOWN].type = WWT_DROPDOWN_BUTTON; @@ -1422,21 +1422,21 @@ static void window_options_invalidate(rct_window *w) case WINDOW_OPTIONS_PAGE_AUDIO: // sound devices if (gAudioCurrentDevice == -1 || gAudioDeviceCount == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_SOUND_NONE; + set_format_arg(0, uint16, STR_SOUND_NONE); } else { #ifndef __LINUX__ if (gAudioCurrentDevice == 0) - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 5510; + set_format_arg(0, uint16, 5510); else #endif // __LINUX__ - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 1170; + set_format_arg(0, uint16, 1170); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = (uint32)gAudioDevices[gAudioCurrentDevice].name; + set_format_arg(2, uint32, (uint32)gAudioDevices[gAudioCurrentDevice].name); } // music: on/off - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint16) = STR_OFF + gConfigSound.ride_music_enabled; + set_format_arg(8, uint16, STR_OFF + gConfigSound.ride_music_enabled); widget_set_checkbox_value(w, WIDX_SOUND_CHECKBOX, gConfigSound.sound_enabled); widget_set_checkbox_value(w, WIDX_MUSIC_CHECKBOX, gConfigSound.ride_music_enabled); @@ -1660,13 +1660,13 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) int activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); const utf8 * activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)activeThemeName; + set_format_arg(0, uint32, (uint32)activeThemeName); gfx_draw_string_left(dpi, 5238, NULL, w->colours[1], w->x + 10, w->y + window_options_controls_and_interface_widgets[WIDX_THEMES].top + 1); gfx_draw_string_left_clipped( dpi, 1170, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, w->colours[1], w->x + window_options_controls_and_interface_widgets[WIDX_THEMES].left + 1, w->y + window_options_controls_and_interface_widgets[WIDX_THEMES].top, @@ -1696,12 +1696,12 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi) w->y + window_options_misc_widgets[WIDX_AUTOSAVE].top ); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&gConfigTitleSequences.presets[gCurrentPreviewTitleSequence].name; + set_format_arg(0, uint32, (uint32)&gConfigTitleSequences.presets[gCurrentPreviewTitleSequence].name); gfx_draw_string_left(dpi, STR_TITLE_SEQUENCE, w, w->colours[1], w->x + 10, w->y + window_options_misc_widgets[WIDX_TITLE_SEQUENCE].top + 1); gfx_draw_string_left_clipped( dpi, 1170, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, w->colours[1], w->x + window_options_misc_widgets[WIDX_TITLE_SEQUENCE].left + 1, w->y + window_options_misc_widgets[WIDX_TITLE_SEQUENCE].top, diff --git a/src/windows/park.c b/src/windows/park.c index 8830d81a19..96ed6b8dc4 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -572,8 +572,8 @@ static void window_park_set_disabled_tabs(rct_window *w) static void window_park_prepare_window_title_text() { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gParkName; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs; + set_format_arg(0, uint16, gParkName); + set_format_arg(2, uint32, gParkNameArgs); } #pragma region Entrance page @@ -642,7 +642,7 @@ static void window_park_entrance_mouseup(rct_window *w, int widgetIndex) window_scroll_to_viewport(w); break; case WIDX_RENAME: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = gParkNameArgs; + set_format_arg(16, uint32, gParkNameArgs); window_text_input_open(w, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, gParkName, 0, 32); break; case WIDX_CLOSE_LIGHT: @@ -946,8 +946,8 @@ static void window_park_entrance_invalidate(rct_window *w) window_park_set_pressed_tab(w); // Set open / close park button state - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gParkName; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs; + set_format_arg(0, uint16, gParkName); + set_format_arg(2, uint32, gParkNameArgs); window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].image = park_is_open() ? SPR_OPEN : SPR_CLOSED; window_park_entrance_widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + !park_is_open() * 2 + widget_is_pressed(w, WIDX_CLOSE_LIGHT); window_park_entrance_widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + park_is_open() * 2 + widget_is_pressed(w, WIDX_OPEN_LIGHT); @@ -1030,13 +1030,13 @@ static void window_park_entrance_paint(rct_window *w, rct_drawpixelinfo *dpi) } // Draw park closed / open label - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = park_is_open() ? STR_PARK_OPEN : STR_PARK_CLOSED; + set_format_arg(0, uint16, park_is_open() ? STR_PARK_OPEN : STR_PARK_CLOSED); labelWidget = &window_park_entrance_widgets[WIDX_STATUS]; gfx_draw_string_centred_clipped( dpi, 1191, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, 0, w->x + (labelWidget->left + labelWidget->right) / 2, w->y + labelWidget->top, @@ -1466,7 +1466,7 @@ static void window_park_price_invalidate(rct_window *w) window_park_price_widgets[WIDX_DECREASE_PRICE].type = WWT_DROPDOWN_BUTTON; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint32) = gParkEntranceFee; + set_format_arg(6, uint32, gParkEntranceFee); window_park_price_widgets[WIDX_PRICE].image = gParkEntranceFee == 0 ? STR_FREE : 1429; window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_7); @@ -1585,21 +1585,21 @@ static void window_park_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL; parkSize = squaredmetres_to_squaredfeet(parkSize); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = parkSize; - gfx_draw_string_left(dpi, stringIndex, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint32, parkSize); + gfx_draw_string_left(dpi, stringIndex, gCommonFormatArgs, 0, x, y); y += 10; // Draw number of rides / attractions if (w->list_information_type != (uint16)-1) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = w->list_information_type; - gfx_draw_string_left(dpi, STR_NUMBER_OF_RIDES_LABEL, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint32, w->list_information_type); + gfx_draw_string_left(dpi, STR_NUMBER_OF_RIDES_LABEL, gCommonFormatArgs, 0, x, y); } y += 10; // Draw number of staff if (w->var_48C != -1) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = w->var_48C; - gfx_draw_string_left(dpi, STR_STAFF_LABEL, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint32, w->var_48C); + gfx_draw_string_left(dpi, STR_STAFF_LABEL, gCommonFormatArgs, 0, x, y); } y += 10; @@ -1745,8 +1745,8 @@ static void window_park_objective_paint(rct_window *w, rct_drawpixelinfo *dpi) x = w->x + window_park_objective_widgets[WIDX_PAGE_BACKGROUND].left + 4; y = w->y + window_park_objective_widgets[WIDX_PAGE_BACKGROUND].top + 7; safe_strcpy((char*)0x009BC677, gScenarioDetails, 256); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = 3165; - y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 222, 1191, 0); + set_format_arg(0, short, 3165); + y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 222, 1191, 0); y += 5; // Your objective: @@ -1754,11 +1754,11 @@ static void window_park_objective_paint(rct_window *w, rct_drawpixelinfo *dpi) y += 10; // Objective - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = gScenarioObjectiveNumGuests; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, short) = date_get_total_months(MONTH_OCTOBER, gScenarioObjectiveYear); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = gScenarioObjectiveCurrency; + set_format_arg(0, short, gScenarioObjectiveNumGuests); + set_format_arg(2, short, date_get_total_months(MONTH_OCTOBER, gScenarioObjectiveYear)); + set_format_arg(4, int, gScenarioObjectiveCurrency); - y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 221, 2385 + gScenarioObjectiveType, 0); + y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 221, 2385 + gScenarioObjectiveType, 0); y += 5; // Objective outcome @@ -1768,8 +1768,8 @@ static void window_park_objective_paint(rct_window *w, rct_drawpixelinfo *dpi) gfx_draw_string_left_wrapped(dpi, NULL, x, y, 222, 2789, 0); } else { // Objective completed - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = gScenarioCompletedCompanyValue; - gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 222, 2788, 0); + set_format_arg(0, int, gScenarioCompletedCompanyValue); + gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 222, 2788, 0); } } } diff --git a/src/windows/player.c b/src/windows/player.c index 4e427f5935..f1e109ff99 100644 --- a/src/windows/player.c +++ b/src/windows/player.c @@ -366,12 +366,12 @@ void window_player_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) lineCh = buffer; lineCh = utf8_write_codepoint(lineCh, FORMAT_WINDOW_COLOUR_2); strcpy(lineCh, network_get_group_name(groupindex)); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, const char *) = buffer; + set_format_arg(0, const char *, buffer); gfx_draw_string_centred_clipped( dpi, STR_STRING, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, 0, w->x + (widget->left + widget->right - 11) / 2, w->y + widget->top, @@ -383,8 +383,8 @@ void window_player_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) int x = w->x + 90; int y = w->y + 24; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_PING; - gfx_draw_string_left(dpi, STR_WINDOW_COLOUR_2_STRING, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, STR_PING); + gfx_draw_string_left(dpi, STR_WINDOW_COLOUR_2_STRING, gCommonFormatArgs, 0, x, y); char ping[64]; sprintf(ping, "%d ms", network_get_player_ping(player)); gfx_draw_string(dpi, ping, w->colours[2], x + 30, y); @@ -394,11 +394,11 @@ void window_player_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) y = w->y + w->height - 13; int width = w->width - 8; int lastaction = network_get_player_last_action(player, 0); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_ACTION_NA; + set_format_arg(0, uint16, STR_ACTION_NA); if (lastaction != -999) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = network_get_action_name_string_id(lastaction); + set_format_arg(0, uint16, network_get_action_name_string_id(lastaction)); } - gfx_draw_string_centred_clipped(dpi, STR_LAST_ACTION_RAN, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, width); + gfx_draw_string_centred_clipped(dpi, STR_LAST_ACTION_RAN, gCommonFormatArgs, 0, x, y, width); if (w->viewport != NULL && w->var_492 != -1) { window_draw_viewport(dpi, w); @@ -530,13 +530,13 @@ void window_player_statistics_paint(rct_window *w, rct_drawpixelinfo *dpi) int x = w->x + window_player_overview_widgets[WIDX_PAGE_BACKGROUND].left + 4; int y = w->y + window_player_overview_widgets[WIDX_PAGE_BACKGROUND].top + 4; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = network_get_player_commands_ran(player); - gfx_draw_string_left(dpi, STR_COMMANDS_RAN, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0,x, y); + set_format_arg(0, uint32, network_get_player_commands_ran(player)); + gfx_draw_string_left(dpi, STR_COMMANDS_RAN, gCommonFormatArgs, 0,x, y); y += 10; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = network_get_player_money_spent(player); - gfx_draw_string_left(dpi, STR_MONEY_SPENT, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0,x, y); + set_format_arg(0, uint32, network_get_player_money_spent(player)); + gfx_draw_string_left(dpi, STR_MONEY_SPENT, gCommonFormatArgs, 0,x, y); } static void window_player_set_page(rct_window* w, int page) @@ -649,8 +649,8 @@ static void window_player_update_title(rct_window* w) { int player = network_get_player_index((uint8)w->number); if (player != -1) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, const char *) = network_get_player_name(player); // set title caption to player name + set_format_arg(0, const char *, network_get_player_name(player)); // set title caption to player name } else { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, const char *) = ""; + set_format_arg(0, const char *, ""); } } diff --git a/src/windows/research.c b/src/windows/research.c index 13a7c2e399..35dee13374 100644 --- a/src/windows/research.c +++ b/src/windows/research.c @@ -336,8 +336,8 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 296, STR_RESEARCH_PROGRESS_LABEL, 0); y += 15; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_UNKNOWN; - gfx_draw_string_left(dpi, STR_RESEARCH_EXPECTED_LABEL, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, STR_UNKNOWN); + gfx_draw_string_left(dpi, STR_RESEARCH_EXPECTED_LABEL, gCommonFormatArgs, 0, x, y); } else { // Research type stringId = STR_RESEARCH_UNKNOWN; @@ -364,16 +364,16 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp y += 15; // Expected - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_UNKNOWN; + set_format_arg(0, uint16, STR_UNKNOWN); if (gResearchProgressStage != 0) { uint16 expectedDay = gResearchExpectedDay; if (expectedDay != 255) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 2289; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = STR_DATE_DAY_1 + expectedDay; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = STR_MONTH_MARCH + gResearchExpectedMonth; + set_format_arg(0, uint16, 2289); + set_format_arg(2, uint16, STR_DATE_DAY_1 + expectedDay); + set_format_arg(4, uint16, STR_MONTH_MARCH + gResearchExpectedMonth); } } - gfx_draw_string_left(dpi, STR_RESEARCH_EXPECTED_LABEL, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, STR_RESEARCH_EXPECTED_LABEL, gCommonFormatArgs, 0, x, y); } // Last development diff --git a/src/windows/ride.c b/src/windows/ride.c index 0615ec694b..fbb183644f 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -1666,7 +1666,7 @@ static void window_ride_rename(rct_window *w) rct_ride *ride; ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = ride->name_arguments; + set_format_arg(16, uint32, ride->name_arguments); window_text_input_open(w, WIDX_RENAME, STR_RIDE_ATTRACTION_NAME, STR_ENTER_NEW_NAME_FOR_THIS_RIDE_ATTRACTION, ride->name, ride->name_arguments, 32); } @@ -1733,8 +1733,8 @@ static void window_ride_main_mouseup(rct_window *w, int widgetIndex) break; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(6, uint16, ride->name); + set_format_arg(8, uint32, ride->name_arguments); ride_set_status(w->number, status); break; } @@ -1974,8 +1974,8 @@ static void window_ride_main_dropdown(rct_window *w, int widgetIndex, int dropdo break; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = ride->name_arguments; + set_format_arg(6, uint16, ride->name); + set_format_arg(8, uint32, ride->name_arguments); ride_set_status(w->number, status); break; } @@ -2070,8 +2070,8 @@ static void window_ride_main_invalidate(rct_window *w) if (ride->lifecycle_flags & (RIDE_LIFECYCLE_INDESTRUCTIBLE | RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK)) w->disabled_widgets |= (1 << 22); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); window_ride_main_widgets[WIDX_OPEN].image = SPR_CLOSED + ride->status; window_ride_main_widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + (ride->status == RIDE_STATUS_CLOSED) * 2 + widget_is_pressed(w, WIDX_CLOSE_LIGHT); @@ -2296,13 +2296,13 @@ static void window_ride_main_paint(rct_window *w, rct_drawpixelinfo *dpi) if (w->ride.view != 0) { stringId = RideNameConvention[ride->type].vehicle_name + 6; if (w->ride.view > ride->num_vehicles) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = w->ride.view - ride->num_vehicles; + set_format_arg(2, uint16, w->ride.view - ride->num_vehicles); stringId = RideNameConvention[ride->type].station_name + 6; } else { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = w->ride.view; + set_format_arg(2, uint16, w->ride.view); } } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = stringId; + set_format_arg(0, uint16, stringId); widget = &window_ride_main_widgets[WIDX_VIEW]; gfx_draw_string_centred( @@ -2311,15 +2311,15 @@ static void window_ride_main_paint(rct_window *w, rct_drawpixelinfo *dpi) w->x + (widget->left + widget->right - 11) / 2, w->y + widget->top, 0, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS + gCommonFormatArgs ); // Status widget = &window_ride_main_widgets[WIDX_STATUS]; gfx_draw_string_centred_clipped( dpi, - window_ride_get_status(w, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS), - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + window_ride_get_status(w, gCommonFormatArgs), + gCommonFormatArgs, 0, w->x + (widget->left + widget->right) / 2, w->y + widget->top, @@ -2522,8 +2522,8 @@ static void window_ride_vehicle_invalidate(rct_window *w) ride = get_ride(w->number); rideEntry = get_ride_entry_by_ride(ride); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); // Widget setup carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars; @@ -2565,12 +2565,12 @@ static void window_ride_vehicle_invalidate(rct_window *w) } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = carsPerTrain; + set_format_arg(6, uint16, carsPerTrain); stringId = RideNameConvention[ride->type].vehicle_name + 4; if (ride->num_vehicles > 1) stringId++; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint16) = stringId; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 10, uint16) = ride->num_vehicles; + set_format_arg(8, uint16, stringId); + set_format_arg(10, uint16, ride->num_vehicles); window_ride_anchor_border_widgets(w); window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10); @@ -3075,8 +3075,8 @@ static void window_ride_operating_invalidate(rct_window *w) ride = get_ride(w->number); rideEntry = get_ride_entry_by_ride(ride); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); // Widget setup w->pressed_widgets &= ~0x44700000; @@ -3087,7 +3087,7 @@ static void window_ride_operating_invalidate(rct_window *w) window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED].type = WWT_SPINNER; window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_INCREASE].type = WWT_DROPDOWN_BUTTON; window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_DECREASE].type = WWT_DROPDOWN_BUTTON; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 20, uint16) = ride->lift_hill_speed; + set_format_arg(20, uint16, ride->lift_hill_speed); } else { window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED_LABEL].type = WWT_EMPTY; window_ride_operating_widgets[WIDX_LIFT_HILL_SPEED].type = WWT_EMPTY; @@ -3101,7 +3101,7 @@ static void window_ride_operating_invalidate(rct_window *w) window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WWT_SPINNER; window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_INCREASE].type = WWT_DROPDOWN_BUTTON; window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_DECREASE].type = WWT_DROPDOWN_BUTTON; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 22, uint16) = ride->num_circuits; + set_format_arg(22, uint16, ride->num_circuits); } else { window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS_LABEL].type = WWT_EMPTY; window_ride_operating_widgets[WIDX_OPERATE_NUMBER_OF_CIRCUITS].type = WWT_EMPTY; @@ -3154,10 +3154,10 @@ static void window_ride_operating_invalidate(rct_window *w) window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_INCREASE].type = WWT_DROPDOWN_BUTTON; window_ride_operating_widgets[WIDX_MAXIMUM_LENGTH_DECREASE].type = WWT_DROPDOWN_BUTTON; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 10, uint16) = 1217; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 12, uint16) = ride->min_waiting_time; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 14, uint16) = 1217; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint16) = ride->max_waiting_time; + set_format_arg(10, uint16, 1217); + set_format_arg(12, uint16, ride->min_waiting_time); + set_format_arg(14, uint16, 1217); + set_format_arg(16, uint16, ride->max_waiting_time); if (ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD) w->pressed_widgets |= (1 << WIDX_LOAD_CHECKBOX); @@ -3187,25 +3187,25 @@ static void window_ride_operating_invalidate(rct_window *w) w->pressed_widgets |= (1 << WIDX_MAXIMUM_LENGTH_CHECKBOX); // Mode specific functionality - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 18, uint16) = ride->operation_option; + set_format_arg(18, uint16, ride->operation_option); switch (ride->mode) { case RIDE_MODE_POWERED_LAUNCH_PASSTROUGH: case RIDE_MODE_POWERED_LAUNCH: case RIDE_MODE_UPWARD_LAUNCH: case RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 18, uint16) = (ride->launch_speed * 9) / 4; + set_format_arg(18, uint16, (ride->launch_speed * 9) / 4); format = 1331; caption = STR_LAUNCH_SPEED; tooltip = STR_LAUNCH_SPEED_TIP; break; case RIDE_MODE_STATION_TO_STATION: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 18, uint16) = (ride->speed * 9) / 4; + set_format_arg(18, uint16, (ride->speed * 9) / 4); format = 1331; caption = STR_SPEED; tooltip = STR_SPEED_TIP; break; case RIDE_MODE_RACE: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 18, uint16) = ride->num_laps; + set_format_arg(18, uint16, ride->num_laps); format = 1736; caption = STR_NUMBER_OF_LAPS; tooltip = STR_NUMBER_OF_LAPS_TIP; @@ -3238,7 +3238,7 @@ static void window_ride_operating_invalidate(rct_window *w) if (format != 0) { if (ride->type == RIDE_TYPE_TWIST) - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 18, uint16) *= 3; + get_format_arg(18, uint16) *= 3; window_ride_operating_widgets[WIDX_MODE_TWEAK_LABEL].type = WWT_24; window_ride_operating_widgets[WIDX_MODE_TWEAK_LABEL].image = caption; @@ -3601,8 +3601,8 @@ static void window_ride_maintenance_invalidate(rct_window *w) window_ride_set_pressed_tab(w); rct_ride *ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); window_ride_maintenance_widgets[WIDX_INSPECTION_INTERVAL].image = STR_EVERY_10_MINUTES + ride->inspection_interval; @@ -3712,9 +3712,9 @@ static void window_ride_maintenance_paint(rct_window *w, rct_drawpixelinfo *dpi) } else { mechanicSprite = &(g_sprite_list[ride->mechanic].peep); if (peep_is_mechanic(mechanicSprite)) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = mechanicSprite->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = mechanicSprite->id; - gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x + 4, y, 280, stringId, 0); + set_format_arg(0, uint16, mechanicSprite->name_string_idx); + set_format_arg(2, uint32, mechanicSprite->id); + gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x + 4, y, 280, stringId, 0); } } } @@ -4090,8 +4090,8 @@ static void window_ride_colour_invalidate(rct_window *w) ride = get_ride(w->number); rideEntry = get_ride_entry_by_ride(ride); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); // Track colours int colourScheme = w->ride_colour; @@ -4206,10 +4206,10 @@ static void window_ride_colour_invalidate(rct_window *w) window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WWT_EMPTY; window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WWT_EMPTY; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = STR_ALL_VEHICLES_IN_SAME_COLOURS + vehicleColourSchemeType; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint16) = RideNameConvention[ride->type].vehicle_name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 10, uint16) = RideNameConvention[ride->type].vehicle_name + 2; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 12, uint16) = w->var_48C + 1; + set_format_arg( 6, uint16, STR_ALL_VEHICLES_IN_SAME_COLOURS + vehicleColourSchemeType); + set_format_arg( 8, uint16, RideNameConvention[ride->type].vehicle_name); + set_format_arg(10, uint16, RideNameConvention[ride->type].vehicle_name + 2); + set_format_arg(12, uint16, w->var_48C + 1); // Vehicle index if (vehicleColourSchemeType != 0) { window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_INDEX].type = WWT_DROPDOWN; @@ -4230,7 +4230,7 @@ static void window_ride_colour_invalidate(rct_window *w) window_ride_colour_widgets[WIDX_VEHICLE_ADDITIONAL_COLOUR_2].type = WWT_EMPTY; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 14, uint16) = STR_MAIN_COLOUR_SCHEME + colourScheme; + set_format_arg(14, uint16, STR_MAIN_COLOUR_SCHEME + colourScheme); window_ride_anchor_border_widgets(w); window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_10); @@ -4566,8 +4566,8 @@ static void window_ride_music_invalidate(rct_window *w) window_ride_set_pressed_tab(w); rct_ride *ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); // Set selected music window_ride_music_widgets[WIDX_MUSIC].image = STR_MUSIC_STYLE_START + ride->music; @@ -4847,8 +4847,8 @@ static void window_ride_measurements_invalidate(rct_window *w) window_ride_set_pressed_tab(w); rct_ride *ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN_NOT_POSSIBLE; window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].type = WWT_EMPTY; @@ -4913,15 +4913,15 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) { // Excitement - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = ride->excitement; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = STR_RATING_LOW + min(ride->excitement >> 8, 5); + set_format_arg(0, uint32, ride->excitement); + set_format_arg(4, uint16, STR_RATING_LOW + min(ride->excitement >> 8, 5)); stringId = ride->excitement == -1 ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE : STR_EXCITEMENT_RATING; - gfx_draw_string_left(dpi, stringId, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, 0, x, y); y += 10; // Intensity - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = ride->intensity; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = STR_RATING_LOW + min(ride->intensity >> 8, 5); + set_format_arg(0, uint32, ride->intensity); + set_format_arg(4, uint16, STR_RATING_LOW + min(ride->intensity >> 8, 5)); stringId = STR_INTENSITY_RATING; if (ride->excitement == -1) @@ -4929,14 +4929,14 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi else if (ride->intensity >= RIDE_RATING(10,00)) stringId = STR_INTENSITY_RATING_RED; - gfx_draw_string_left(dpi, stringId, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, 0, x, y); y += 10; // Nausea - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = ride->nausea; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = STR_RATING_LOW + min(ride->nausea >> 8, 5); + set_format_arg(0, uint32, ride->nausea); + set_format_arg(4, uint16, STR_RATING_LOW + min(ride->nausea >> 8, 5)); stringId = ride->excitement == -1 ? STR_NAUSEA_RATING_NOT_YET_AVAILABLE : STR_NAUSEA_RATING; - gfx_draw_string_left(dpi, stringId, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, 0, x, y); y += 20; // Horizontal rule @@ -4964,22 +4964,22 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi for (i = 0; i < ride->num_stations; i++) { time = ride->time[numTimes]; if (time != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0 + (numTimes * 4), uint16) = 1343; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2 + (numTimes * 4), uint16) = time; + set_format_arg(0 + (numTimes * 4), uint16, 1343); + set_format_arg(2 + (numTimes * 4), uint16, time); numTimes++; } } if (numTimes == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 1343; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = 0; + set_format_arg(0, uint16, 1343); + set_format_arg(2, uint16, 0); numTimes++; } RCT2_GLOBAL(0x013CE94E + (numTimes * 4), uint16) = 1342; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0 + (numTimes * 4), uint16) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2 + (numTimes * 4), uint16) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4 + (numTimes * 4), uint16) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6 + (numTimes * 4), uint16) = 0; - gfx_draw_string_left_clipped(dpi, STR_RIDE_TIME, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, 308); + set_format_arg(0 + (numTimes * 4), uint16, 0); + set_format_arg(2 + (numTimes * 4), uint16, 0); + set_format_arg(4 + (numTimes * 4), uint16, 0); + set_format_arg(6 + (numTimes * 4), uint16, 0); + gfx_draw_string_left_clipped(dpi, STR_RIDE_TIME, gCommonFormatArgs, 0, x, y, 308); y += 10; } @@ -4989,22 +4989,22 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi length = ride->length[numLengths]; if (length != 0) { length >>= 16; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0 + (numLengths * 4), uint16) = 1346; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2 + (numLengths * 4), uint16) = (length & 0xFFFF); + set_format_arg(0 + (numLengths * 4), uint16, 1346); + set_format_arg(2 + (numLengths * 4), uint16, (length & 0xFFFF)); numLengths++; } } if (numLengths == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 1346; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = 0; + set_format_arg(0, uint16, 1346); + set_format_arg(2, uint16, 0); numLengths++; } RCT2_GLOBAL(0x013CE94E + (numLengths * 4), uint16) = 1345; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0 + (numLengths * 4), uint16) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2 + (numLengths * 4), uint16) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4 + (numLengths * 4), uint16) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6 + (numLengths * 4), uint16) = 0; - gfx_draw_string_left_clipped(dpi, STR_RIDE_LENGTH, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, 308); + set_format_arg(0 + (numLengths * 4), uint16, 0); + set_format_arg(2 + (numLengths * 4), uint16, 0); + set_format_arg(4 + (numLengths * 4), uint16, 0); + set_format_arg(6 + (numLengths * 4), uint16, 0); + gfx_draw_string_left_clipped(dpi, STR_RIDE_LENGTH, gCommonFormatArgs, 0, x, y, 308); y += 10; if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_G_FORCES)) { @@ -5212,12 +5212,12 @@ static void window_ride_graphs_tooltip(rct_window* w, int widgetIndex, rct_strin rct_string_id message; if (widgetIndex == WIDX_GRAPH) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 3158; + set_format_arg(0, uint16, 3158); measurement = ride_get_measurement(w->number, &message); if (measurement != NULL && (measurement->flags & RIDE_MEASUREMENT_FLAG_RUNNING)) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = measurement->vehicle_index + 1; + set_format_arg(4, uint16, measurement->vehicle_index + 1); ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = RideNameConvention[ride->type].vehicle_name + 6; + set_format_arg(2, uint16, RideNameConvention[ride->type].vehicle_name + 6); } else { *stringId = message; } @@ -5248,8 +5248,8 @@ static void window_ride_graphs_invalidate(rct_window *w) ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); // Set pressed graph button type w->pressed_widgets &= ~(1 << WIDX_GRAPH_VELOCITY); @@ -5319,7 +5319,7 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi x = (widget->right - widget->left) / 2; y = (widget->bottom - widget->top) / 2 - 5; width = widget->right - widget->left - 2; - gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, width, stringId, 0); + gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, width, stringId, 0); return; } @@ -5690,8 +5690,8 @@ static void window_ride_income_invalidate(rct_window *w) window_ride_set_pressed_tab(w); rct_ride *ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); rideEntry = get_ride_entry_by_ride(ride); @@ -5711,7 +5711,7 @@ static void window_ride_income_invalidate(rct_window *w) window_ride_income_widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WWT_EMPTY; window_ride_income_widgets[WIDX_PRIMARY_PRICE].image = 1429; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, money32) = ride->price; + set_format_arg(6, money32, ride->price); if (ride->price == 0) window_ride_income_widgets[WIDX_PRIMARY_PRICE].image = STR_FREE; @@ -5764,7 +5764,7 @@ static void window_ride_income_invalidate(rct_window *w) // Set secondary item price window_ride_income_widgets[WIDX_SECONDARY_PRICE].image = 1799; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 10, money32) = ride->price_secondary; + set_format_arg(10, money32, ride->price_secondary); if (ride->price_secondary == 0) window_ride_income_widgets[WIDX_SECONDARY_PRICE].image = STR_FREE; } @@ -5941,8 +5941,8 @@ static void window_ride_customer_invalidate(rct_window *w) window_ride_set_pressed_tab(w); rct_ride *ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); window_ride_customer_widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WWT_FLATBTN; if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP)) { @@ -6022,9 +6022,9 @@ static void window_ride_customer_paint(rct_window *w, rct_drawpixelinfo *dpi) // Primary shop items sold shopItem = get_ride_entry_by_ride(ride)->shop_item; if (shopItem != SHOP_ITEM_NONE) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ShopItemStringIds[shopItem].plural; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->no_primary_items_sold; - gfx_draw_string_left(dpi, STR_ITEMS_SOLD, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, ShopItemStringIds[shopItem].plural); + set_format_arg(2, uint32, ride->no_primary_items_sold); + gfx_draw_string_left(dpi, STR_ITEMS_SOLD, gCommonFormatArgs, 0, x, y); y += 10; } @@ -6033,9 +6033,9 @@ static void window_ride_customer_paint(rct_window *w, rct_drawpixelinfo *dpi) RCT2_GLOBAL(0x0097D7CB + (ride->type * 4), uint8) : get_ride_entry_by_ride(ride)->shop_item_secondary; if (shopItem != SHOP_ITEM_NONE) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ShopItemStringIds[shopItem].plural; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->no_secondary_items_sold; - gfx_draw_string_left(dpi, STR_ITEMS_SOLD, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, ShopItemStringIds[shopItem].plural); + set_format_arg(2, uint32, ride->no_secondary_items_sold); + gfx_draw_string_left(dpi, STR_ITEMS_SOLD, gCommonFormatArgs, 0, x, y); y += 10; } diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 3b992a39e4..b8847a1244 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -2112,20 +2112,20 @@ static void window_ride_construction_invalidate(rct_window *w) if (stringId == STR_RAPIDS && ride->type == RIDE_TYPE_CAR_RIDE) stringId = STR_LOG_BUMPS; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = stringId; + set_format_arg(0, uint16, stringId); if (RCT2_GLOBAL(0x00F440D3, uint8) == 1) - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ((RCT2_GLOBAL(0x00F440CD, uint8) * 9) >> 2) & 0xFFFF; + set_format_arg(2, uint16, ((RCT2_GLOBAL(0x00F440CD, uint8) * 9) >> 2) & 0xFFFF); window_ride_construction_widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].image = STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_180 + _currentSeatRotationAngle; if (RCT2_GLOBAL(0x00F440D3, uint8) == 2) - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ((RCT2_GLOBAL(0x00F440CE, uint8) * 9) >> 2) & 0xFFFF; + set_format_arg(2, uint16, ((RCT2_GLOBAL(0x00F440CE, uint8) * 9) >> 2) & 0xFFFF); // Set window title arguments - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint32) = ride->name_arguments; + set_format_arg(4, uint16, ride->name); + set_format_arg(6, uint32, ride->name_arguments); } /** diff --git a/src/windows/ride_list.c b/src/windows/ride_list.c index 71f4bf46c0..71bac37203 100644 --- a/src/windows/ride_list.c +++ b/src/windows/ride_list.c @@ -424,7 +424,7 @@ static void window_ride_list_scrollmouseover(rct_window *w, int scrollIndex, int */ static void window_ride_list_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } /** @@ -537,43 +537,43 @@ static void window_ride_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, switch (_window_ride_list_information_type) { case INFORMATION_TYPE_STATUS: ride_get_status(w->list_item_positions[i], &formatSecondary, &argument); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = argument; + set_format_arg(2, sint32, argument); break; case INFORMATION_TYPE_POPULARITY: formatSecondary = STR_POPULARITY_UNKNOWN_LABEL; if (ride->popularity != 255) { formatSecondary = STR_POPULARITY_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride->popularity * 4; + set_format_arg(2, uint16, ride->popularity * 4); } break; case INFORMATION_TYPE_SATISFACTION: formatSecondary = STR_SATISFACTION_UNKNOWN_LABEL; if (ride->satisfaction != 255) { formatSecondary = STR_SATISFACTION_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride->satisfaction * 5; + set_format_arg(2, uint16, ride->satisfaction * 5); } break; case INFORMATION_TYPE_PROFIT: formatSecondary = 0; if (ride->profit != MONEY32_UNDEFINED) { formatSecondary = STR_PROFIT_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->profit; + set_format_arg(2, sint32, ride->profit); } break; case INFORMATION_TYPE_TOTAL_CUSTOMERS: formatSecondary = STR_RIDE_LIST_TOTAL_CUSTOMERS_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->total_customers; + set_format_arg(2, uint32, ride->total_customers); break; case INFORMATION_TYPE_TOTAL_PROFIT: formatSecondary = 0; if (ride->total_profit != MONEY32_UNDEFINED) { formatSecondary = STR_RIDE_LIST_TOTAL_PROFIT_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->total_profit; + set_format_arg(2, sint32, ride->total_profit); } break; case INFORMATION_TYPE_CUSTOMERS: formatSecondary = STR_RIDE_LIST_CUSTOMERS_PER_HOUR_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride_customers_per_hour(ride); + set_format_arg(2, uint32, ride_customers_per_hour(ride)); break; case INFORMATION_TYPE_AGE:; sint16 age = date_get_year(gDateMonthsElapsed - ride->build_date); @@ -582,52 +582,52 @@ static void window_ride_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, case 1: formatSecondary = STR_RIDE_LIST_BUILT_LAST_YEAR_LABEL; break; default: formatSecondary = STR_RIDE_LIST_BUILT_X_YEARS_AGO_LABEL; break; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint16) = age; + set_format_arg(2, sint16, age); break; case INFORMATION_TYPE_INCOME: formatSecondary = 0; if (ride->income_per_hour != MONEY32_UNDEFINED) { formatSecondary = STR_RIDE_LIST_INCOME_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->income_per_hour; + set_format_arg(2, sint32, ride->income_per_hour); } break; case INFORMATION_TYPE_RUNNING_COST: formatSecondary = STR_RIDE_LIST_RUNNING_COST_UNKNOWN; if (ride->upkeep_cost != (money16)0xFFFF) { formatSecondary = STR_RIDE_LIST_RUNNING_COST_LABEL; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, sint32) = ride->upkeep_cost * 16; + set_format_arg(2, sint32, ride->upkeep_cost * 16); } break; case INFORMATION_TYPE_QUEUE_LENGTH: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride_get_total_queue_length(ride); + set_format_arg(2, uint16, ride_get_total_queue_length(ride)); formatSecondary = STR_QUEUE_EMPTY; - if (RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) == 1) + if (get_format_arg(2, uint16) == 1) formatSecondary = STR_QUEUE_ONE_PERSON; - else if (RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) > 1) + else if (get_format_arg(2, uint16) > 1) formatSecondary = STR_QUEUE_PEOPLE; break; case INFORMATION_TYPE_QUEUE_TIME: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride_get_max_queue_time(ride); + set_format_arg(2, uint16, ride_get_max_queue_time(ride)); formatSecondary = STR_QUEUE_TIME_LABEL; - if (RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) > 1) + if (get_format_arg(2, uint16) > 1) formatSecondary = STR_QUEUE_TIME_PLURAL_LABEL; break; case INFORMATION_TYPE_RELIABILITY: // edx = RCT2_GLOBAL(0x009ACFA4 + (ride->var_001 * 4), uint32); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride->reliability >> 8; + set_format_arg(2, uint16, ride->reliability >> 8); formatSecondary = STR_RELIABILITY_LABEL; break; case INFORMATION_TYPE_DOWN_TIME: // edx = RCT2_GLOBAL(0x009ACFA4 + (ride->var_001 * 4), uint32); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride->downtime; + set_format_arg(2, uint16, ride->downtime); formatSecondary = STR_DOWN_TIME_LABEL; break; case INFORMATION_TYPE_GUESTS_FAVOURITE: formatSecondary = 0; if (RCT2_ADDRESS(0x0097C3AF, uint8)[ride->type] == PAGE_RIDES) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ride->guests_favourite; + set_format_arg(2, uint16, ride->guests_favourite); formatSecondary = ride->guests_favourite == 1 ? STR_GUESTS_FAVOURITE_LABEL : STR_GUESTS_FAVOURITE_PLURAL_LABEL; } break; @@ -637,8 +637,8 @@ static void window_ride_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, if (formatSecondary == STR_BROKEN_DOWN || formatSecondary == STR_CRASHED) format = 1192; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = formatSecondary; - gfx_draw_string_left_clipped(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 160, y - 1, 157); + set_format_arg(0, uint16, formatSecondary); + gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, 0, 160, y - 1, 157); y += 10; } } @@ -867,8 +867,8 @@ static void window_ride_list_close_all(rct_window *w) continue; if (ride->status == RIDE_STATUS_CLOSED) continue; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = w->scrolls[0].v_top; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = w->scrolls[0].v_bottom; + set_format_arg(6, uint16, w->scrolls[0].v_top); + set_format_arg(8, uint32, w->scrolls[0].v_bottom); ride_set_status(i, RIDE_STATUS_CLOSED); } @@ -884,8 +884,8 @@ static void window_ride_list_open_all(rct_window *w) continue; if (ride->status == RIDE_STATUS_OPEN) continue; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, uint16) = w->scrolls[0].v_top; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 8, uint32) = w->scrolls[0].v_bottom; + set_format_arg(6, uint16, w->scrolls[0].v_top); + set_format_arg(8, uint32, w->scrolls[0].v_bottom); ride_set_status(i, RIDE_STATUS_OPEN); } diff --git a/src/windows/scenery.c b/src/windows/scenery.c index ef85536709..a92ae6215d 100644 --- a/src/windows/scenery.c +++ b/src/windows/scenery.c @@ -867,7 +867,7 @@ void window_scenery_tooltip(rct_window* w, int widgetIndex, rct_string_id *strin { switch (widgetIndex) { case WIDX_SCENERY_LIST: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 3159; + set_format_arg(0, uint16, 3159); break; case WIDX_SCENERY_TAB_1: case WIDX_SCENERY_TAB_2: @@ -888,10 +888,10 @@ void window_scenery_tooltip(rct_window* w, int widgetIndex, rct_string_id *strin case WIDX_SCENERY_TAB_17: case WIDX_SCENERY_TAB_18: case WIDX_SCENERY_TAB_19: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = get_scenery_group_entry(widgetIndex - WIDX_SCENERY_TAB_1)->name; + set_format_arg(0, uint16, get_scenery_group_entry(widgetIndex - WIDX_SCENERY_TAB_1)->name); break; case WIDX_SCENERY_TAB_20: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = 1813; + set_format_arg(0, uint16, 1813); break; } } @@ -1072,16 +1072,16 @@ void window_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi) price = gSceneryPlaceCost; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = price; + set_format_arg(0, uint32, price); if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { // -14 - gfx_draw_string_right(dpi, STR_COST_LABEL, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, + gfx_draw_string_right(dpi, STR_COST_LABEL, gCommonFormatArgs, 0, w->x + w->width - 0x1A, w->y + w->height - 13); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = sceneryEntry->name; - gfx_draw_string_left_clipped(dpi, 0x4A7, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, + set_format_arg(0, uint16, sceneryEntry->name); + gfx_draw_string_left_clipped(dpi, 0x4A7, gCommonFormatArgs, 0, w->x + 3, w->y + w->height - 13, w->width - 19); } diff --git a/src/windows/server_list.c b/src/windows/server_list.c index 3d65a4b326..204df7e9d7 100644 --- a/src/windows/server_list.c +++ b/src/windows/server_list.c @@ -215,7 +215,7 @@ static void window_server_list_mouseup(rct_window *w, int widgetIndex) int serverIndex = w->selected_list_item; if (serverIndex >= 0 && serverIndex < _numServerEntries) { if (strcmp(_serverEntries[serverIndex].version, NETWORK_STREAM_ID) != 0 && strcmp(_serverEntries[serverIndex].version, "") != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void *) = _serverEntries[serverIndex].version; + set_format_arg(0, void *, _serverEntries[serverIndex].version); window_error_open(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION); break; } @@ -251,7 +251,7 @@ static void window_server_list_dropdown(rct_window *w, int widgetIndex, int drop switch (dropdownIndex) { case DDIDX_JOIN: if (strcmp(_serverEntries[serverIndex].version, NETWORK_STREAM_ID) != 0 && strcmp(_serverEntries[serverIndex].version, "") != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, void *) = _serverEntries[serverIndex].version; + set_format_arg(0, void *, _serverEntries[serverIndex].version); window_error_open(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION); break; } @@ -375,7 +375,7 @@ static void window_server_list_invalidate(rct_window *w) { colour_scheme_update(w); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, char *) = gVersion; + set_format_arg(0, char *, gVersion); window_server_list_widgets[WIDX_BACKGROUND].right = w->width - 1; window_server_list_widgets[WIDX_BACKGROUND].bottom = w->height - 1; window_server_list_widgets[WIDX_TITLE].right = w->width - 2; diff --git a/src/windows/server_start.c b/src/windows/server_start.c index e02160d547..1b8370367a 100644 --- a/src/windows/server_start.c +++ b/src/windows/server_start.c @@ -275,7 +275,7 @@ static void window_server_start_invalidate(rct_window *w) colour_scheme_update_by_class(w, WC_SERVER_LIST); widget_set_checkbox_value(w, WIDX_ADVERTISE_CHECKBOX, gConfigNetwork.advertise); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 18, uint16) = gConfigNetwork.maxplayers; + set_format_arg(18, uint16, gConfigNetwork.maxplayers); } static void window_server_start_paint(rct_window *w, rct_drawpixelinfo *dpi) diff --git a/src/windows/shortcut_key_change.c b/src/windows/shortcut_key_change.c index 1898b7ba59..33c4e81908 100644 --- a/src/windows/shortcut_key_change.c +++ b/src/windows/shortcut_key_change.c @@ -117,6 +117,6 @@ static void window_shortcut_change_paint(rct_window *w, rct_drawpixelinfo *dpi) int x = w->x + 125; int y = w->y + 30; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ShortcutStringIds[RCT2_GLOBAL(0x009DE511, uint8)]; - gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 242, 2785, RCT2_GLOBAL(0x9DEB8D, uint8)); + set_format_arg(0, uint16, ShortcutStringIds[RCT2_GLOBAL(0x009DE511, uint8)]); + gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, 242, 2785, RCT2_GLOBAL(0x9DEB8D, uint8)); } diff --git a/src/windows/shortcut_keys.c b/src/windows/shortcut_keys.c index fd696ccba1..d2c8689cbc 100644 --- a/src/windows/shortcut_keys.c +++ b/src/windows/shortcut_keys.c @@ -194,7 +194,7 @@ static void window_shortcut_paint(rct_window *w, rct_drawpixelinfo *dpi) */ static void window_shortcut_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } /** @@ -258,9 +258,9 @@ static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, i char *templateString = (char*)language_get_string(templateStringId); keyboard_shortcut_format_string(templateString, gShortcutKeys[i]); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_SHORTCUT_ENTRY_FORMAT; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ShortcutStringIds[i]; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint16) = templateStringId; - gfx_draw_string_left(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 0, y - 1); + set_format_arg(0, uint16, STR_SHORTCUT_ENTRY_FORMAT); + set_format_arg(2, uint16, ShortcutStringIds[i]); + set_format_arg(4, uint16, templateStringId); + gfx_draw_string_left(dpi, format, gCommonFormatArgs, 0, 0, y - 1); } } diff --git a/src/windows/sign.c b/src/windows/sign.c index f7c8892caa..47a7ac164a 100644 --- a/src/windows/sign.c +++ b/src/windows/sign.c @@ -254,7 +254,7 @@ static void window_sign_mouseup(rct_window *w, int widgetIndex) case WIDX_SIGN_TEXT: if (banner->flags&BANNER_FLAG_2){ rct_ride* ride = get_ride(banner->colour); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = ride->name_arguments; + set_format_arg(16, uint32, ride->name_arguments); string_id = ride->name; } else @@ -518,7 +518,7 @@ static void window_sign_small_mouseup(rct_window *w, int widgetIndex) case WIDX_SIGN_TEXT: if (banner->flags&BANNER_FLAG_2){ rct_ride* ride = get_ride(banner->colour); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = ride->name_arguments; + set_format_arg(16, uint32, ride->name_arguments); string_id = ride->name; } else diff --git a/src/windows/staff.c b/src/windows/staff.c index bb4cf8817d..9194012078 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -728,8 +728,8 @@ void window_staff_stats_invalidate(rct_window *w) rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); window_staff_stats_widgets[WIDX_BACKGROUND].right = w->width - 1; window_staff_stats_widgets[WIDX_BACKGROUND].bottom = w->height - 1; @@ -763,8 +763,8 @@ void window_staff_options_invalidate(rct_window *w) rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); switch (peep->staff_type){ case STAFF_TYPE_ENTERTAINER: @@ -838,8 +838,8 @@ void window_staff_overview_invalidate(rct_window *w) rct_peep* peep = GET_PEEP(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); window_staff_overview_widgets[WIDX_BACKGROUND].right = w->width - 1; window_staff_overview_widgets[WIDX_BACKGROUND].bottom = w->height - 1; @@ -902,13 +902,13 @@ void window_staff_overview_paint(rct_window *w, rct_drawpixelinfo *dpi) uint32 argument1, argument2; rct_peep* peep = GET_PEEP(w->number); get_arguments_from_action(peep, &argument1, &argument2); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = argument2; + set_format_arg(0, uint32, argument1); + set_format_arg(4, uint32, argument2); rct_widget* widget = &w->widgets[WIDX_BTM_LABEL]; int x = (widget->left + widget->right) / 2 + w->x; int y = w->y + widget->top; int width = widget->right - widget->left; - gfx_draw_string_centred_clipped(dpi, 1191, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, width); + gfx_draw_string_centred_clipped(dpi, 1191, gCommonFormatArgs, 0, x, y, width); } /** @@ -1044,11 +1044,9 @@ void window_staff_stats_paint(rct_window *w, rct_drawpixelinfo *dpi) int x = w->x + window_staff_stats_widgets[WIDX_RESIZE].left + 4; int y = w->y + window_staff_stats_widgets[WIDX_RESIZE].top + 4; - if (!(gParkFlags & PARK_FLAGS_NO_MONEY)){ - - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS,uint32) = RCT2_ADDRESS(0x992A00,uint16)[peep->staff_type]; - gfx_draw_string_left(dpi, 2349, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0,x, y); - + if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { + set_format_arg(0, uint32, RCT2_ADDRESS(0x00992A00, uint16)[peep->staff_type]); + gfx_draw_string_left(dpi, 2349, gCommonFormatArgs, 0, x, y); y += 10; } diff --git a/src/windows/staff_fire_prompt.c b/src/windows/staff_fire_prompt.c index 8d65d80cea..9f9f6902f1 100644 --- a/src/windows/staff_fire_prompt.c +++ b/src/windows/staff_fire_prompt.c @@ -134,11 +134,11 @@ static void window_staff_fire_paint(rct_window *w, rct_drawpixelinfo *dpi) rct_peep* peep = &g_sprite_list[w->number].peep; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); int x = w->x + WW / 2; int y = w->y + (WH / 2) - 3; - gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, WW - 4, STR_FIRE_STAFF_ID, 0); + gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, WW - 4, STR_FIRE_STAFF_ID, 0); } diff --git a/src/windows/staff_list.c b/src/windows/staff_list.c index 55119764ee..14fa4ddb0c 100644 --- a/src/windows/staff_list.c +++ b/src/windows/staff_list.c @@ -368,7 +368,7 @@ static void window_staff_list_tooldown(rct_window *w, int widgetIndex, int x, in rct_window *staffWindow = window_staff_open(closestPeep); window_event_dropdown_call(staffWindow, 11, 0); } else { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = STR_HANDYMAN_PLURAL + selectedPeepType; + set_format_arg(0, rct_string_id, STR_HANDYMAN_PLURAL + selectedPeepType); window_error_open(STR_NO_THING_IN_PARK_YET, STR_NONE); } } @@ -469,7 +469,7 @@ void window_staff_list_scrollmouseover(rct_window *w, int scrollIndex, int x, in */ void window_staff_list_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } /** @@ -584,8 +584,8 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi) } if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = RCT2_ADDRESS(0x00992A00, uint16)[selectedTab]; - gfx_draw_string_left(dpi, 1858, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, w->x + w->width - 155, w->y + 0x20); + set_format_arg(0, uint32, RCT2_ADDRESS(0x00992A00, uint16)[selectedTab]); + gfx_draw_string_left(dpi, 1858, gCommonFormatArgs, 0, w->x + w->width - 155, w->y + 0x20); } if (selectedTab < 3) { @@ -598,10 +598,10 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi) staffTypeStringId += 4; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = _window_staff_list_selected_type_count; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = staffTypeStringId; + set_format_arg(0, uint16, _window_staff_list_selected_type_count); + set_format_arg(2, uint16, staffTypeStringId); - gfx_draw_string_left(dpi, STR_STAFF_LIST_COUNTER, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, w->x + 4, window_staff_list_widgets[WIDX_STAFF_LIST_LIST].bottom + w->y + 2); + gfx_draw_string_left(dpi, STR_STAFF_LIST_COUNTER, gCommonFormatArgs, 0, w->x + 4, window_staff_list_widgets[WIDX_STAFF_LIST_LIST].bottom + w->y + 2); } /** @@ -634,14 +634,14 @@ void window_staff_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int sc format = (_quick_fire_mode ? 5299 : 1193); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = peep->id; - gfx_draw_string_left_clipped(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 0, y - 1, 107); + set_format_arg(0, uint16, peep->name_string_idx); + set_format_arg(2, uint32, peep->id); + gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, 0, 0, y - 1, 107); get_arguments_from_action(peep, &argument_1, &argument_2); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument_1; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = argument_2; - gfx_draw_string_left_clipped(dpi, format, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, 175, y - 1, 305); + set_format_arg(0, uint32, argument_1); + set_format_arg(4, uint32, argument_2); + gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, 0, 175, y - 1, 305); // True if a patrol path is set for the worker if (RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] & 2) { diff --git a/src/windows/themes.c b/src/windows/themes.c index 8bd598f1e4..f607a4f294 100644 --- a/src/windows/themes.c +++ b/src/windows/themes.c @@ -679,7 +679,7 @@ static void window_themes_textinput(rct_window *w, int widgetIndex, char *text) void window_themes_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } void window_themes_invalidate(rct_window *w) @@ -766,12 +766,12 @@ void window_themes_paint(rct_window *w, rct_drawpixelinfo *dpi) if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) { int activeAvailableThemeIndex = theme_manager_get_active_available_theme_index(); const utf8 * activeThemeName = theme_manager_get_available_theme_name(activeAvailableThemeIndex); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)activeThemeName; + set_format_arg(0, uint32, (uint32)activeThemeName); gfx_draw_string_left(dpi, 5238, NULL, w->colours[1], w->x + 10, w->y + window_themes_widgets[WIDX_THEMES_PRESETS].top + 1); gfx_draw_string_left_clipped( dpi, 1170, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, w->colours[1], w->x + window_themes_widgets[WIDX_THEMES_PRESETS].left + 1, w->y + window_themes_widgets[WIDX_THEMES_PRESETS].top, diff --git a/src/windows/tile_inspector.c b/src/windows/tile_inspector.c index 5e5c31aa00..47c1bb3422 100644 --- a/src/windows/tile_inspector.c +++ b/src/windows/tile_inspector.c @@ -514,27 +514,27 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi) // Draw column headers rct_widget *widget; if ((widget= &w->widgets[WIDX_COLUMN_TYPE])->type != WWT_EMPTY) { - gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_ELEMENT_TYPE, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); + gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_ELEMENT_TYPE, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); } if ((widget = &w->widgets[WIDX_COLUMN_BASEHEIGHT])->type != WWT_EMPTY) { - gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); + gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); } if ((widget = &w->widgets[WIDX_COLUMN_CLEARANCEHEIGHT])->type != WWT_EMPTY) { - gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); + gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); } if ((widget = &w->widgets[WIDX_COLUMN_GHOSTFLAG])->type != WWT_EMPTY) { - gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_GHOST_SHORT, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); + gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_GHOST_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); } if ((widget = &w->widgets[WIDX_COLUMN_BROKENFLAG])->type != WWT_EMPTY) { - gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_BROKEN_SHORT, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); + gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_BROKEN_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); } if ((widget = &w->widgets[WIDX_COLUMN_LASTFLAG])->type != WWT_EMPTY) { - gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_LAST_SHORT, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); + gfx_draw_string_left_clipped(dpi, STR_TILE_INSPECTOR_FLAG_LAST_SHORT, gCommonFormatArgs, w->colours[1], w->x + widget->left + 1, w->y + widget->top + 1, widget->right - widget->left); } // Draw coordinates diff --git a/src/windows/title_command_editor.c b/src/windows/title_command_editor.c index 4a5aa5e451..00b59db128 100644 --- a/src/windows/title_command_editor.c +++ b/src/windows/title_command_editor.c @@ -564,11 +564,11 @@ static void window_title_command_editor_paint(rct_window *w, rct_drawpixelinfo * ); } else { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&gConfigTitleSequences.presets[gCurrentTitleSequence].saves[command.saveIndex]; + set_format_arg(0, uint32, (uint32)&gConfigTitleSequences.presets[gCurrentTitleSequence].saves[command.saveIndex]); gfx_draw_string_left_clipped( dpi, 1170, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, w->colours[1], w->x + w->widgets[WIDX_INPUT].left + 1, w->y + w->widgets[WIDX_INPUT].top, diff --git a/src/windows/title_editor.c b/src/windows/title_editor.c index ff0d939e22..ef8e2f51e9 100644 --- a/src/windows/title_editor.c +++ b/src/windows/title_editor.c @@ -736,7 +736,7 @@ static void window_title_editor_textinput(rct_window *w, int widgetIndex, char * void window_title_editor_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } void window_title_editor_invalidate(rct_window *w) @@ -855,12 +855,12 @@ void window_title_editor_paint(rct_window *w, rct_drawpixelinfo *dpi) switch (w->selected_tab) { case WINDOW_TITLE_EDITOR_TAB_PRESETS: - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&gConfigTitleSequences.presets[gCurrentTitleSequence].name; + set_format_arg(0, uint32, (uint32)&gConfigTitleSequences.presets[gCurrentTitleSequence].name); gfx_draw_string_left(dpi, 5304, NULL, w->colours[1], w->x + 10, w->y + window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].top + 1); gfx_draw_string_left_clipped( dpi, 1170, - (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, + gCommonFormatArgs, w->colours[1], w->x + window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].left + 1, w->y + window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].top, @@ -907,16 +907,16 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&title->saves[i]; + set_format_arg(0, uint32, (uint32)&title->saves[i]); if (selected || hover) { - format_string(buffer, 1170, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + format_string(buffer, 1170, gCommonFormatArgs); } else { - format_string(buffer + 1, 1170, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + format_string(buffer + 1, 1170, gCommonFormatArgs); buffer[0] = FORMAT_BLACK; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&buffer; - gfx_draw_string_left(dpi, 1170, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], x + 5, y); + set_format_arg(0, uint32, (uint32)&buffer); + gfx_draw_string_left(dpi, 1170, gCommonFormatArgs, w->colours[1], x + 5, y); } } else if (w->selected_tab == WINDOW_TITLE_EDITOR_TAB_SCRIPT) { @@ -947,35 +947,35 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int commandName = 5416; error = true; } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&title->saves[command->saveIndex]; + set_format_arg(0, uint32, (uint32)&title->saves[command->saveIndex]); break; case TITLE_SCRIPT_LOADMM: commandName = 5414; break; case TITLE_SCRIPT_LOCATION: commandName = 5418; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = command->x; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = command->y; + set_format_arg(0, uint16, command->x); + set_format_arg(2, uint16, command->y); break; case TITLE_SCRIPT_ROTATE: commandName = 5420; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = command->rotations; + set_format_arg(0, uint16, command->rotations); break; case TITLE_SCRIPT_ZOOM: commandName = 5422; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = command->zoom; + set_format_arg(0, uint16, command->zoom); break; case TITLE_SCRIPT_SPEED: commandName = 5443; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = (uint16)(5142 + command->speed - 1); + set_format_arg(0, uint16, (uint16)(5142 + command->speed - 1)); break; case TITLE_SCRIPT_WAIT: commandName = 5424; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = command->seconds; + set_format_arg(0, uint16, command->seconds); break; case TITLE_SCRIPT_RESTART: commandName = 5425; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = command->zoom; + set_format_arg(0, uint16, command->zoom); break; case TITLE_SCRIPT_END: commandName = 5426; @@ -985,14 +985,14 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int } if ((selected || hover) && !error) { - format_string(buffer, commandName, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + format_string(buffer, commandName, gCommonFormatArgs); } else { - format_string(buffer + 1, commandName, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + format_string(buffer + 1, commandName, gCommonFormatArgs); buffer[0] = (error ? ((selected || hover) ? FORMAT_LIGHTPINK : FORMAT_RED) : FORMAT_BLACK); } - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&buffer; - gfx_draw_string_left(dpi, 1170, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, w->colours[1], x + 5, y); + set_format_arg(0, uint32, (uint32)&buffer); + gfx_draw_string_left(dpi, 1170, gCommonFormatArgs, w->colours[1], x + 5, y); } } } diff --git a/src/windows/title_scenarioselect.c b/src/windows/title_scenarioselect.c index d7ffcfd977..cb73374c08 100644 --- a/src/windows/title_scenarioselect.c +++ b/src/windows/title_scenarioselect.c @@ -370,11 +370,11 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi) y = (widget->top + widget->bottom) / 2 + w->y - 3; if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = STR_SCENARIO_CATEGORY_RCT1 + i; + set_format_arg(0, short, STR_SCENARIO_CATEGORY_RCT1 + i); } else { // old-style - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = ScenarioCategoryStringIds[i]; + set_format_arg(0, short, ScenarioCategoryStringIds[i]); } - gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 87, format, 10); + gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, 87, format, 10); } // Return if no scenario highlighted @@ -406,21 +406,21 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi) x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4; y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5; safe_strcpy((char*)0x009BC677, scenario->name, 64); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = 3165; // empty string - gfx_draw_string_centred_clipped(dpi, 1193, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x + 85, y, 170); + set_format_arg(0, short, 3165); // empty string + gfx_draw_string_centred_clipped(dpi, 1193, gCommonFormatArgs, 0, x + 85, y, 170); y += 15; // Scenario details safe_strcpy((char*)0x009BC677, scenario->details, 256); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = 3165; // empty string - y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 170, 1191, 0) + 5; + set_format_arg(0, short, 3165); // empty string + y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, 1191, 0) + 5; // Scenario objective - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = scenario->objective_type + STR_OBJECTIVE_NONE; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, short) = scenario->objective_arg_3; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, short) = date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, int) = scenario->objective_arg_2; - y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 170, STR_OBJECTIVE, 0) + 5; + set_format_arg(0, short, scenario->objective_type + STR_OBJECTIVE_NONE); + set_format_arg(2, short, scenario->objective_arg_3); + set_format_arg(4, short, date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1)); + set_format_arg(6, int, scenario->objective_arg_2); + y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_OBJECTIVE, 0) + 5; // Scenario score if (scenario->highscore != NULL) { @@ -429,9 +429,9 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi) completedByName = scenario->highscore->name; } safe_strcpy((char*)0x009BC677, completedByName, 64); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = 3165; // empty string - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, int) = scenario->highscore->company_value; - y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, 0); + set_format_arg(0, short, 3165); // empty string + set_format_arg(2, int, scenario->highscore->company_value); + y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, 0); } } @@ -493,9 +493,9 @@ static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo * completedByName = scenario->highscore->name; } safe_strcpy((char*)language_get_string(placeholderStringId), completedByName, 64); - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, rct_string_id) = 2793; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, rct_string_id) = placeholderStringId; - gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 11, 0, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + set_format_arg(0, rct_string_id, 2793); + set_format_arg(2, rct_string_id, placeholderStringId); + gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 11, 0, gCommonFormatArgs); } y += 24; diff --git a/src/windows/tooltip.c b/src/windows/tooltip.c index 4fc4ebf975..2dc50f6c22 100644 --- a/src/windows/tooltip.c +++ b/src/windows/tooltip.c @@ -89,7 +89,7 @@ void window_tooltip_show(rct_string_id id, int x, int y) RCT2_GLOBAL(0x0142006C, sint32) = -1; char* buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char); - format_string(buffer, id, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS); + format_string(buffer, id, gCommonFormatArgs); gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM; int tooltip_text_width; diff --git a/src/windows/track_list.c b/src/windows/track_list.c index b317c1ad13..68aa045271 100644 --- a/src/windows/track_list.c +++ b/src/windows/track_list.c @@ -308,7 +308,7 @@ static void window_track_list_scrollmouseover(rct_window *w, int scrollIndex, in */ static void window_track_list_tooltip(rct_window* w, int widgetIndex, rct_string_id *stringId) { - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_LIST; + set_format_arg(0, uint16, STR_LIST); } static void window_track_list_update(rct_window *w) @@ -337,7 +337,7 @@ static void window_track_list_invalidate(rct_window *w) if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(entry)) stringId = _window_track_list_item.type + 2; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = stringId; + set_format_arg(0, uint16, stringId); if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { window_track_list_widgets[WIDX_TITLE].image = STR_TRACK_DESIGNS; window_track_list_widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_RENAME_OR_DELETE_IT; @@ -475,9 +475,9 @@ static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi) } // Ride length - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 1345; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = td6->ride_length; - gfx_draw_string_left_clipped(dpi, STR_TRACK_LIST_RIDE_LENGTH, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, 214); + set_format_arg(0, uint16, 1345); + set_format_arg(2, uint16, td6->ride_length); + gfx_draw_string_left_clipped(dpi, STR_TRACK_LIST_RIDE_LENGTH, gCommonFormatArgs, 0, x, y, 214); y += 10; } @@ -531,9 +531,9 @@ static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi) if (td6->space_required_x != 0xFF) { // Space required - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = td6->space_required_x; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = td6->space_required_y; - gfx_draw_string_left(dpi, STR_TRACK_LIST_SPACE_REQUIRED, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y); + set_format_arg(0, uint16, td6->space_required_x); + set_format_arg(2, uint16, td6->space_required_y); + gfx_draw_string_left(dpi, STR_TRACK_LIST_SPACE_REQUIRED, gCommonFormatArgs, 0, x, y); y += 10; } @@ -591,9 +591,9 @@ static void window_track_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, } // Draw track name - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, rct_string_id) = STR_TRACK_LIST_NAME_FORMAT; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, utf8*) = _trackDesigns[i].name; - gfx_draw_string_left(dpi, stringId, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y - 1); + set_format_arg(0, rct_string_id, STR_TRACK_LIST_NAME_FORMAT); + set_format_arg(2, utf8*, _trackDesigns[i].name); + gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, 0, x, y - 1); } y += 10; } diff --git a/src/windows/viewport.c b/src/windows/viewport.c index b38cde4687..611fcf8f31 100644 --- a/src/windows/viewport.c +++ b/src/windows/viewport.c @@ -217,7 +217,7 @@ static void window_viewport_invalidate(rct_window *w) } // Set title - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = w->number; + set_format_arg(0, uint32, w->number); // Set disabled widgets w->disabled_widgets = 0; diff --git a/src/world/map.c b/src/world/map.c index fbdd261f31..75d61dfbe3 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -4046,13 +4046,13 @@ static void map_obstruction_set_error_text(rct_map_element *mapElement) case MAP_ELEMENT_TYPE_TRACK: ride = get_ride(mapElement->properties.track.ride_index); errorStringId = STR_X_IN_THE_WAY; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = ride->name; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; + set_format_arg(0, uint16, ride->name); + set_format_arg(2, uint32, ride->name_arguments); break; case MAP_ELEMENT_TYPE_SCENERY: sceneryEntry = get_small_scenery_entry(mapElement->properties.scenery.type); errorStringId = STR_X_IN_THE_WAY; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = sceneryEntry->name; + set_format_arg(0, uint16, sceneryEntry->name); break; case MAP_ELEMENT_TYPE_ENTRANCE: switch (mapElement->properties.entrance.type) { @@ -4070,12 +4070,12 @@ static void map_obstruction_set_error_text(rct_map_element *mapElement) case MAP_ELEMENT_TYPE_FENCE: sceneryEntry = get_wall_entry(mapElement->properties.scenery.type); errorStringId = STR_X_IN_THE_WAY; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = sceneryEntry->name; + set_format_arg(0, uint16, sceneryEntry->name); break; case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE: sceneryEntry = get_large_scenery_entry(mapElement->properties.scenery.type); errorStringId = STR_X_IN_THE_WAY; - RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = sceneryEntry->name; + set_format_arg(0, uint16, sceneryEntry->name); break; }