diff --git a/src/addresses.h b/src/addresses.h index 7269fbd960..664b517ed7 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -489,8 +489,6 @@ #define RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS 0x013CE9A4 #define RCT2_ADDRESS_NEXT_FREE_MAP_ELEMENT 0x0140E9A4 -#define RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT 0x0141E9AC -#define RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE 0x0141E9AE #define RCT2_ADDRESS_CURRENT_ROTATION 0x0141E9E0 @@ -616,6 +614,9 @@ #define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG 0x009AB4C6 #define RCT2_ADDRESS_NAUSEA_THRESHOLDS 0x00982390 //uint16 +#define RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT 0x0141E9AC +#define RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE 0x0141E9AE + #define RCT2_ADDRESS_WINDOW_LIST 0x01420078 #define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8 diff --git a/src/editor.c b/src/editor.c index 6b279347d7..1ec2ecd4a8 100644 --- a/src/editor.c +++ b/src/editor.c @@ -591,24 +591,24 @@ int editor_check_object_selection() if (!isTrackDesignerManager) { if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_PATHS)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_AT_LEAST_ONE_PATH_OBJECT_MUST_BE_SELECTED; + gGameCommandErrorText = STR_AT_LEAST_ONE_PATH_OBJECT_MUST_BE_SELECTED; return OBJECT_TYPE_PATHS; } } if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_RIDE)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_AT_LEAST_ONE_RIDE_OBJECT_MUST_BE_SELECTED; + gGameCommandErrorText = STR_AT_LEAST_ONE_RIDE_OBJECT_MUST_BE_SELECTED; return OBJECT_TYPE_RIDE; } if (!isTrackDesignerManager) { if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_PARK_ENTRANCE)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_PARK_ENTRANCE_TYPE_MUST_BE_SELECTED; + gGameCommandErrorText = STR_PARK_ENTRANCE_TYPE_MUST_BE_SELECTED; return OBJECT_TYPE_PARK_ENTRANCE; } if (!editor_check_object_group_at_least_one_selected(OBJECT_TYPE_WATER)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_WATER_TYPE_MUST_BE_SELECTED; + gGameCommandErrorText = STR_WATER_TYPE_MUST_BE_SELECTED; return OBJECT_TYPE_WATER; } } @@ -624,7 +624,7 @@ bool editor_check_park() { int parkSize = park_calculate_size(); if (parkSize == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_PARK_MUST_OWN_SOME_LAND; + gGameCommandErrorText = STR_PARK_MUST_OWN_SOME_LAND; return false; } @@ -633,7 +633,7 @@ bool editor_check_park() break; if (i == 3) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NO_PARK_ENTRANCES; + gGameCommandErrorText = STR_NO_PARK_ENTRANCES; return false; } } @@ -649,11 +649,11 @@ bool editor_check_park() switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0)) { case FOOTPATH_SEARCH_NOT_FOUND: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_PARK_ENTRANCE_WRONG_DIRECTION_OR_NO_PATH; + gGameCommandErrorText = STR_PARK_ENTRANCE_WRONG_DIRECTION_OR_NO_PATH; return false; case FOOTPATH_SEARCH_INCOMPLETE: case FOOTPATH_SEARCH_TOO_COMPLEX: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_PARK_ENTRANCE_PATH_INCOMPLETE_OR_COMPLEX; + gGameCommandErrorText = STR_PARK_ENTRANCE_PATH_INCOMPLETE_OR_COMPLEX; return false; case FOOTPATH_SEARCH_SUCCESS: // Run the search again and unown the path @@ -663,7 +663,7 @@ bool editor_check_park() } if (gPeepSpawns[0].x == 0xFFFF && gPeepSpawns[1].x == 0xFFFF) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_PEEP_SPAWNS_NOT_SET; + gGameCommandErrorText = STR_PEEP_SPAWNS_NOT_SET; return false; } diff --git a/src/game.c b/src/game.c index c150845b25..0cd73fada0 100644 --- a/src/game.c +++ b/src/game.c @@ -79,6 +79,9 @@ GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = { }; int game_command_playerid = -1; +rct_string_id gGameCommandErrorTitle; +rct_string_id gGameCommandErrorText; + int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback) { for (int i = 0; i < countof(game_command_callback_table); i++ ) { @@ -410,7 +413,7 @@ static int game_check_affordability(int cost) RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = cost; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 827; + gGameCommandErrorText = 827; return MONEY32_UNDEFINED; } @@ -450,7 +453,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int * } flags = *ebx; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0xFFFF; + gGameCommandErrorText = 0xFFFF; // Increment nest count RCT2_GLOBAL(0x009A8C28, uint8)++; @@ -559,7 +562,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int * // Show error window if (RCT2_GLOBAL(0x009A8C28, uint8) == 0 && (flags & GAME_COMMAND_FLAG_APPLY) && RCT2_GLOBAL(0x0141F568, uint8) == RCT2_GLOBAL(0x013CA740, uint8) && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(flags & GAME_COMMAND_FLAG_NETWORKED)) - window_error_open(RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16), RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); + window_error_open(gGameCommandErrorTitle, gGameCommandErrorText); return MONEY32_UNDEFINED; } @@ -729,7 +732,7 @@ int game_load_sv6(SDL_RWops* rw) log_error("invalid checksum"); RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_FILE_CONTAINS_INVALID_DATA; + gGameCommandErrorTitle = STR_FILE_CONTAINS_INVALID_DATA; return 0; } @@ -909,7 +912,7 @@ bool game_load_save(const utf8 *path) if (rw == NULL) { log_error("unable to open %s", path); RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_FILE_CONTAINS_INVALID_DATA; + gGameCommandErrorTitle = STR_FILE_CONTAINS_INVALID_DATA; return false; } diff --git a/src/game.h b/src/game.h index 80fa4472d9..c9f31f4658 100644 --- a/src/game.h +++ b/src/game.h @@ -117,6 +117,9 @@ int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback); GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(int index); extern int game_command_playerid; +extern rct_string_id gGameCommandErrorTitle; +extern rct_string_id gGameCommandErrorText; + extern GAME_COMMAND_POINTER* new_game_command_table[66]; extern int gGameSpeed; diff --git a/src/interface/viewport_interaction.c b/src/interface/viewport_interaction.c index f391423be7..60f8310a38 100644 --- a/src/interface/viewport_interaction.c +++ b/src/interface/viewport_interaction.c @@ -392,7 +392,7 @@ int viewport_interaction_right_click(int x, int y) */ static void viewport_interaction_remove_scenery(rct_map_element *mapElement, int x, int y) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, (mapElement->type << 8) | 1, @@ -423,7 +423,7 @@ static void viewport_interaction_remove_footpath(rct_map_element *mapElement, in mapElement2 = map_get_first_element_at(x / 32, y / 32); do { if (map_element_get_type(mapElement2) == MAP_ELEMENT_TYPE_PATH && mapElement2->base_height == z) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_FOOTPATH_FROM_HERE; + gGameCommandErrorTitle = STR_CANT_REMOVE_FOOTPATH_FROM_HERE; footpath_remove(x, y, z, 1); break; } @@ -442,7 +442,7 @@ static void viewport_interaction_remove_footpath_item(rct_map_element *mapElemen if (mapElement->type & 1) type |= 0x80; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, ((mapElement->properties.path.type & 7) << 8) | 1, @@ -471,7 +471,7 @@ void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, int y -= TileDirectionDelta[rotation].y; break; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command(x, GAME_COMMAND_FLAG_APPLY, y, mapElement->base_height / 2, GAME_COMMAND_REMOVE_PARK_ENTRANCE, 0, 0); } @@ -487,7 +487,7 @@ static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, i if (sceneryEntry->wall.var_0D != 0xFF){ window_sign_small_open(mapElement->properties.fence.item[0]); } else { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, GAME_COMMAND_FLAG_APPLY, @@ -516,7 +516,7 @@ static void viewport_interaction_remove_large_scenery(rct_map_element *mapElemen ((mapElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5); window_sign_open(id); } else { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, 1 | ((mapElement->type & 0x3) << 8), diff --git a/src/localisation/user.c b/src/localisation/user.c index 7e56d214a0..f4d0b8ce4e 100644 --- a/src/localisation/user.c +++ b/src/localisation/user.c @@ -19,13 +19,14 @@ *****************************************************************************/ #include "../addresses.h" -#include "localisation.h" +#include "../game.h" #include "../ride/ride.h" #include "../util/util.h" +#include "localisation.h" utf8 *gUserStrings = (char*)0x0135A8F4; -static bool user_string_exists(const char *text); +static bool user_string_exists(const utf8 *text); /** * @@ -46,7 +47,7 @@ rct_string_id user_string_allocate(int base, const utf8 *text) bool allowDuplicates = base & 0x80; if (!allowDuplicates && user_string_exists(text)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CHOSEN_NAME_IN_USE_ALREADY; + gGameCommandErrorText = STR_CHOSEN_NAME_IN_USE_ALREADY; return 0; } @@ -58,7 +59,7 @@ rct_string_id user_string_allocate(int base, const utf8 *text) safe_strcpy(userString, text, USER_STRING_MAX_LENGTH); return 0x8000 + (i | highBits); } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_MANY_NAMES_DEFINED; + gGameCommandErrorText = STR_TOO_MANY_NAMES_DEFINED; return 0; } diff --git a/src/management/finance.c b/src/management/finance.c index 324fae0d1e..e1781a2aa9 100644 --- a/src/management/finance.c +++ b/src/management/finance.c @@ -301,13 +301,13 @@ void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int* RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_INTEREST * 4; if (newLoan > currentLoan) { if (newLoan > RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_BANK_REFUSES_TO_INCREASE_LOAN; + gGameCommandErrorText = STR_BANK_REFUSES_TO_INCREASE_LOAN; *ebx = MONEY32_UNDEFINED; return; } } else { if (loanDifference > money) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_NOT_ENOUGH_CASH_AVAILABLE; + gGameCommandErrorText = STR_NOT_ENOUGH_CASH_AVAILABLE; *ebx = MONEY32_UNDEFINED; return; } diff --git a/src/management/marketing.c b/src/management/marketing.c index 1d4eddab54..73546a8055 100644 --- a/src/management/marketing.c +++ b/src/management/marketing.c @@ -145,7 +145,7 @@ void marketing_set_guest_campaign(rct_peep *peep, int campaign) void marketing_start_campaign(int type, int rideOrItem, int numWeeks) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_START_MARKETING_CAMPAIGN; + gGameCommandErrorTitle = STR_CANT_START_MARKETING_CAMPAIGN; game_do_command(0, (numWeeks << 8) | GAME_COMMAND_FLAG_APPLY, 0, (rideOrItem << 8) | type, GAME_COMMAND_START_MARKETING_CAMPAIGN, 0, 0); } @@ -168,7 +168,7 @@ void game_command_start_campaign(int* eax, int* ebx, int* ecx, int* edx, int* es RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_MARKETING * 4; if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 3048; + gGameCommandErrorText = 3048; *ebx = MONEY32_UNDEFINED; return; } diff --git a/src/network/network.cpp b/src/network/network.cpp index 2a2df3039d..3467d5e93c 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -2243,12 +2243,12 @@ void game_command_set_player_group(int* eax, int* ebx, int* ecx, int* edx, int* return; } if (player->flags & NETWORK_PLAYER_FLAG_ISSERVER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_CHANGE_GROUP_THAT_THE_HOST_BELONGS_TO; + gGameCommandErrorTitle = STR_CANT_CHANGE_GROUP_THAT_THE_HOST_BELONGS_TO; *ebx = MONEY32_UNDEFINED; return; } if (groupid == 0 && fromgroup && fromgroup->id != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_SET_TO_THIS_GROUP; + gGameCommandErrorTitle = STR_CANT_SET_TO_THIS_GROUP; *ebx = MONEY32_UNDEFINED; return; } @@ -2281,13 +2281,13 @@ void game_command_modify_groups(int *eax, int *ebx, int *ecx, int *edx, int *esi }break; case 1:{ // remove group if (groupid == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_THIS_GROUP_CANNOT_BE_MODIFIED; + gGameCommandErrorTitle = STR_THIS_GROUP_CANNOT_BE_MODIFIED; *ebx = MONEY32_UNDEFINED; return; } for (auto it = gNetwork.player_list.begin(); it != gNetwork.player_list.end(); it++) { if((*it)->group == groupid) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_GROUP_THAT_PLAYERS_BELONG_TO; + gGameCommandErrorTitle = STR_CANT_REMOVE_GROUP_THAT_PLAYERS_BELONG_TO; *ebx = MONEY32_UNDEFINED; return; } @@ -2301,7 +2301,7 @@ void game_command_modify_groups(int *eax, int *ebx, int *ecx, int *edx, int *esi bool all = *edx & 1; bool allvalue = (*edx >> 1) & 1; if (groupid == 0) { // cant change admin group permissions - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_THIS_GROUP_CANNOT_BE_MODIFIED; + gGameCommandErrorTitle = STR_THIS_GROUP_CANNOT_BE_MODIFIED; *ebx = MONEY32_UNDEFINED; return; } @@ -2310,7 +2310,7 @@ void game_command_modify_groups(int *eax, int *ebx, int *ecx, int *edx, int *esi if (player && !all) { mygroup = gNetwork.GetGroupByID(player->group); if (!mygroup || (mygroup && !mygroup->CanPerformAction(index))) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_MODIFY_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF; + gGameCommandErrorTitle = STR_CANT_MODIFY_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF; *ebx = MONEY32_UNDEFINED; return; } @@ -2353,8 +2353,8 @@ void game_command_modify_groups(int *eax, int *ebx, int *ecx, int *edx, int *esi } if (newName[0] == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_GROUP; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_INVALID_GROUP_NAME; + gGameCommandErrorTitle = STR_CANT_RENAME_GROUP; + gGameCommandErrorText = STR_INVALID_GROUP_NAME; *ebx = MONEY32_UNDEFINED; return; } @@ -2368,7 +2368,7 @@ void game_command_modify_groups(int *eax, int *ebx, int *ecx, int *edx, int *esi }break; case 4:{ // set default group if (groupid == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_SET_TO_THIS_GROUP; + gGameCommandErrorTitle = STR_CANT_SET_TO_THIS_GROUP; *ebx = MONEY32_UNDEFINED; return; } @@ -2388,7 +2388,7 @@ void game_command_kick_player(int *eax, int *ebx, int *ecx, int *edx, int *esi, uint8 playerid = (uint8)*eax; NetworkPlayer* player = gNetwork.GetPlayerByID(playerid); if (player && player->flags & NETWORK_PLAYER_FLAG_ISSERVER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_KICK_THE_HOST; + gGameCommandErrorTitle = STR_CANT_KICK_THE_HOST; *ebx = MONEY32_UNDEFINED; return; } diff --git a/src/peep/peep.c b/src/peep/peep.c index d2be079fd1..02e01f4acf 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -10486,7 +10486,7 @@ money32 set_peep_name(int flags, int state, uint16 sprite_index, uint8* text_1, return 0; if (*fullText == '\0') { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 1455; + gGameCommandErrorText = 1455; return MONEY32_UNDEFINED; } diff --git a/src/peep/staff.c b/src/peep/staff.c index 16f36389c2..b943148848 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -93,7 +93,7 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, if (RCT2_GLOBAL(0x13573C8, uint16) < 0x190) { *ebx = MONEY32_UNDEFINED; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TOO_MANY_PEOPLE_IN_GAME; + gGameCommandErrorText = STR_TOO_MANY_PEOPLE_IN_GAME; return; } @@ -105,7 +105,7 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, if (i == STAFF_MAX_COUNT) { *ebx = MONEY32_UNDEFINED; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TOO_MANY_STAFF_IN_GAME; + gGameCommandErrorText = STR_TOO_MANY_STAFF_IN_GAME; return; } @@ -120,7 +120,7 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, if (newPeep == NULL) { *ebx = MONEY32_UNDEFINED; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TOO_MANY_PEOPLE_IN_GAME; + gGameCommandErrorText = STR_TOO_MANY_PEOPLE_IN_GAME; return; } @@ -420,7 +420,7 @@ void update_staff_colour(uint8 staffType, uint16 colour) */ uint16 hire_new_staff_member(uint8 staffType) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_HIRE_NEW_STAFF; + gGameCommandErrorTitle = STR_CANT_HIRE_NEW_STAFF; int eax, ebx, ecx, edx, esi, edi, ebp; ecx = edx = esi = edi = ebp = 0; diff --git a/src/ride/ride.c b/src/ride/ride.c index bdac1bff44..abdf76404b 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -891,7 +891,7 @@ int ride_create_ride(ride_list_item listItem) esi = 0; ebp = 0; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 0x3DC; + gGameCommandErrorTitle = 0x3DC; esi = GAME_COMMAND_CREATE_RIDE; game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); @@ -3708,12 +3708,12 @@ static money32 ride_set_setting(uint8 rideIndex, uint8 setting, uint8 value, uin switch (setting) { case RIDE_SETTING_MODE: if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING; + gGameCommandErrorText = STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING; return MONEY32_UNDEFINED; } if (ride->status != RIDE_STATUS_CLOSED) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_MUST_BE_CLOSED_FIRST; + gGameCommandErrorText = STR_MUST_BE_CLOSED_FIRST; return MONEY32_UNDEFINED; } @@ -3815,7 +3815,7 @@ static money32 ride_set_setting(uint8 rideIndex, uint8 setting, uint8 value, uin break; case RIDE_SETTING_NUM_CIRCUITS: if (ride->lifecycle_flags & RIDE_LIFECYCLE_CABLE_LIFT && value > 1) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_MULTICIRCUIT_NOT_POSSIBLE_WITH_CABLE_LIFT_HILL; + gGameCommandErrorText = STR_MULTICIRCUIT_NOT_POSSIBLE_WITH_CABLE_LIFT_HILL; return MONEY32_UNDEFINED; } @@ -3878,17 +3878,17 @@ int ride_mode_check_valid_station_numbers(rct_ride *ride) case RIDE_MODE_POWERED_LAUNCH: case RIDE_MODE_LIM_POWERED_LAUNCH: if (no_stations <= 1) return 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_UNABLE_TO_OPERATE_WITH_MORE_THAN_ONE_STATION_IN_THIS_MODE; + gGameCommandErrorText = STR_UNABLE_TO_OPERATE_WITH_MORE_THAN_ONE_STATION_IN_THIS_MODE; return 0; case RIDE_MODE_SHUTTLE: if (no_stations >= 2) return 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_UNABLE_TO_OPERATE_WITH_LESS_THAN_TWO_STATIONS_IN_THIS_MODE; + gGameCommandErrorText = STR_UNABLE_TO_OPERATE_WITH_LESS_THAN_TWO_STATIONS_IN_THIS_MODE; return 0; } if (ride->type == RIDE_TYPE_GO_KARTS || ride->type == RIDE_TYPE_MINI_GOLF){ if (no_stations <= 1) return 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_UNABLE_TO_OPERATE_WITH_MORE_THAN_ONE_STATION_IN_THIS_MODE; + gGameCommandErrorText = STR_UNABLE_TO_OPERATE_WITH_MORE_THAN_ONE_STATION_IN_THIS_MODE; return 0; } @@ -3909,14 +3909,14 @@ int ride_mode_check_station_present(rct_ride* ride){ } if (stationIndex == -1) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_NOT_YET_CONSTRUCTED; + gGameCommandErrorText = STR_NOT_YET_CONSTRUCTED; if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_NO_TRACK)) return -1; if (ride->type == RIDE_TYPE_MAZE) return -1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_REQUIRES_A_STATION_PLATFORM; + gGameCommandErrorText = STR_REQUIRES_A_STATION_PLATFORM; return -1; } @@ -3958,12 +3958,12 @@ int ride_check_for_entrance_exit(int rideIndex) } if (entrance == 0){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_ENTRANCE_NOT_YET_BUILT; + gGameCommandErrorText = STR_ENTRANCE_NOT_YET_BUILT; return 0; } if (exit == 0){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_EXIT_NOT_YET_BUILT; + gGameCommandErrorText = STR_EXIT_NOT_YET_BUILT; return 0; } @@ -4020,17 +4020,17 @@ int ride_check_block_brakes(rct_xy_element *input, rct_xy_element *output) if (it.current.element->properties.track.type == 216) { type = it.last.element->properties.track.type; if (type == 1) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_STATION; + gGameCommandErrorText = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_STATION; *output = it.current; return 0; } if (type == 216) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_EACH_OTHER; + gGameCommandErrorText = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_EACH_OTHER; *output = it.current; return 0; } if ((it.last.element->type & 0x80) && type != 209 && type != 210) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_THE_TOP_OF_THIS_LIFT_HILL; + gGameCommandErrorText = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_THE_TOP_OF_THIS_LIFT_HILL; *output = it.current; return 0; } @@ -4038,7 +4038,7 @@ int ride_check_block_brakes(rct_xy_element *input, rct_xy_element *output) } if (!it.looped) { // Not sure why this is the case... - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_STATION; + gGameCommandErrorText = STR_BLOCK_BRAKES_CANNOT_BE_USED_DIRECTLY_AFTER_STATION; *output = it.last; return 0; } @@ -4696,7 +4696,7 @@ bool ride_create_vehicles(rct_ride *ride, int rideIndex, rct_xy_element *element // Check if there are enough free sprite slots for all the vehicles int totalCars = ride->num_vehicles * ride->num_cars_per_train; if (totalCars > sub_69ED9E()) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_UNABLE_TO_CREATE_ENOUGH_VEHICLES; + gGameCommandErrorText = STR_UNABLE_TO_CREATE_ENOUGH_VEHICLES; return false; } @@ -4827,7 +4827,7 @@ static bool ride_initialise_cable_lift_track(rct_ride *ride, bool isApplying) xy = ride->station_starts[stationIndex]; if (xy != 0xFFFF) break; if (stationIndex == 3) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CABLE_LIFT_HILL_MUST_START_IMMEDIATELY_AFTER_STATION; + gGameCommandErrorText = STR_CABLE_LIFT_HILL_MUST_START_IMMEDIATELY_AFTER_STATION; return false; } } @@ -4896,7 +4896,7 @@ static bool ride_initialise_cable_lift_track(rct_ride *ride, bool isApplying) state = STATE_REST_OF_TRACK; break; default: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CABLE_LIFT_HILL_MUST_START_IMMEDIATELY_AFTER_STATION; + gGameCommandErrorText = STR_CABLE_LIFT_HILL_MUST_START_IMMEDIATELY_AFTER_STATION; return false; } break; @@ -4924,17 +4924,17 @@ bool ride_create_cable_lift(int rideIndex, bool isApplying) if (ride->mode != RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED && ride->mode != RIDE_MODE_CONTINUOUS_CIRCUIT ) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CABLE_LIFT_UNABLE_TO_WORK_IN_THIS_OPERATING_MODE; + gGameCommandErrorText = STR_CABLE_LIFT_UNABLE_TO_WORK_IN_THIS_OPERATING_MODE; return false; } if (ride->num_circuits > 1) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_MULTICIRCUIT_NOT_POSSIBLE_WITH_CABLE_LIFT_HILL; + gGameCommandErrorText = STR_MULTICIRCUIT_NOT_POSSIBLE_WITH_CABLE_LIFT_HILL; return false; } if (sub_69ED9E() <= 5) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_UNABLE_TO_CREATE_ENOUGH_VEHICLES; + gGameCommandErrorText = STR_UNABLE_TO_CREATE_ENOUGH_VEHICLES; return false; } @@ -5145,7 +5145,7 @@ int ride_is_valid_for_test(int rideIndex, int goingToBeOpen, int isApplying) ) { if (ride_find_track_gap(&trackElement, &problematicTrackElement) && (!gConfigGeneral.test_unfinished_tracks || ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_IS_NOT_A_COMPLETE_CIRCUIT; + gGameCommandErrorText = STR_TRACK_IS_NOT_A_COMPLETE_CIRCUIT; loc_6B528A(&problematicTrackElement); return 0; } @@ -5164,14 +5164,14 @@ int ride_is_valid_for_test(int rideIndex, int goingToBeOpen, int isApplying) if (ride->subtype != 255) { rct_ride_entry *rideType = get_ride_entry(ride->subtype); if (rideType->flags & RIDE_ENTRY_FLAG_NO_INVERSIONS) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; + gGameCommandErrorText = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; if (ride_check_track_contains_inversions(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; } } if (rideType->flags & RIDE_ENTRY_FLAG_NO_BANKED_TRACK) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; + gGameCommandErrorText = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; if (ride_check_track_contains_banked(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; @@ -5181,17 +5181,17 @@ int ride_is_valid_for_test(int rideIndex, int goingToBeOpen, int isApplying) if (ride->mode == RIDE_MODE_STATION_TO_STATION) { if (!ride_find_track_gap(&trackElement, &problematicTrackElement)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; + gGameCommandErrorText = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; return 0; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_STATION_NOT_LONG_ENOUGH; + gGameCommandErrorText = STR_STATION_NOT_LONG_ENOUGH; if (!ride_check_station_length(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; + gGameCommandErrorText = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; if (!ride_check_start_and_end_is_station(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; @@ -5276,7 +5276,7 @@ int ride_is_valid_for_open(int rideIndex, int goingToBeOpen, int isApplying) ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED ) { if (ride_find_track_gap(&trackElement, &problematicTrackElement)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_IS_NOT_A_COMPLETE_CIRCUIT; + gGameCommandErrorText = STR_TRACK_IS_NOT_A_COMPLETE_CIRCUIT; loc_6B528A(&problematicTrackElement); return 0; } @@ -5295,14 +5295,14 @@ int ride_is_valid_for_open(int rideIndex, int goingToBeOpen, int isApplying) if (ride->subtype != 255) { rct_ride_entry *rideType = get_ride_entry(ride->subtype); if (rideType->flags & RIDE_ENTRY_FLAG_NO_INVERSIONS) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; + gGameCommandErrorText = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; if (ride_check_track_contains_inversions(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; } } if (rideType->flags & RIDE_ENTRY_FLAG_NO_BANKED_TRACK) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; + gGameCommandErrorText = STR_TRACK_UNSUITABLE_FOR_TYPE_OF_TRAIN; if (ride_check_track_contains_banked(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; @@ -5312,17 +5312,17 @@ int ride_is_valid_for_open(int rideIndex, int goingToBeOpen, int isApplying) if (ride->mode == RIDE_MODE_STATION_TO_STATION) { if (!ride_find_track_gap(&trackElement, &problematicTrackElement)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; + gGameCommandErrorText = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; return 0; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_STATION_NOT_LONG_ENOUGH; + gGameCommandErrorText = STR_STATION_NOT_LONG_ENOUGH; if (!ride_check_station_length(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; + gGameCommandErrorText = STR_RIDE_MUST_START_AND_END_WITH_STATIONS; if (!ride_check_start_and_end_is_station(&trackElement, &problematicTrackElement)) { loc_6B528A(&problematicTrackElement); return 0; @@ -5457,7 +5457,7 @@ void game_command_set_ride_status(int *eax, int *ebx, int *ecx, int *edx, int *e void ride_set_name(int rideIndex, const char *name) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_RIDE_ATTRACTION; + gGameCommandErrorTitle = STR_CANT_RENAME_RIDE_ATTRACTION; game_do_command(1, (rideIndex << 8) | 1, 0, *((int*)(name + 0)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name + 8)), *((int*)(name + 4))); game_do_command(2, (rideIndex << 8) | 1, 0, *((int*)(name + 12)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name + 20)), *((int*)(name + 16))); game_do_command(0, (rideIndex << 8) | 1, 0, *((int*)(name + 24)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name + 32)), *((int*)(name + 28))); @@ -5515,7 +5515,7 @@ void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi } if (newName[0] == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_INVALID_RIDE_ATTRACTION_NAME; + gGameCommandErrorText = STR_INVALID_RIDE_ATTRACTION_NAME; *ebx = MONEY32_UNDEFINED; return; } @@ -5846,7 +5846,7 @@ foundRideEntry: return MONEY32_UNDEFINED; } if (rideIndex == -1) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_MANY_RIDES; + gGameCommandErrorText = STR_TOO_MANY_RIDES; return MONEY32_UNDEFINED; } *outRideIndex = rideIndex; @@ -6204,7 +6204,7 @@ void game_command_demolish_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z; } if(!(*ebx & 0x40) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; }else{ @@ -7174,7 +7174,7 @@ bool ride_select_forwards_from_back() money32 ride_remove_track_piece(int x, int y, int z, int direction, int type) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS; if (network_get_mode() == NETWORK_MODE_CLIENT) { game_command_callback = game_command_callback_ride_remove_track_piece; @@ -7194,11 +7194,11 @@ bool ride_are_all_possible_entrances_and_exits_built(rct_ride *ride) for (int i = 0; i < 4; i++) { if (ride->station_starts[i] == 0xFFFF) continue; if (ride->entrances[i] == 0xFFFF) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_ENTRANCE_NOT_YET_BUILT; + gGameCommandErrorText = STR_ENTRANCE_NOT_YET_BUILT; return false; } if (ride->exits[i] == 0xFFFF) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_EXIT_NOT_YET_BUILT; + gGameCommandErrorText = STR_EXIT_NOT_YET_BUILT; return false; } } @@ -7532,7 +7532,7 @@ void ride_update_max_vehicles(int rideIndex) void ride_set_ride_entry(int rideIndex, int rideEntry) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_SET_VEHICLE_TYPE_FAIL; + gGameCommandErrorTitle = STR_RIDE_SET_VEHICLE_TYPE_FAIL; game_do_command( 0, GAME_COMMAND_FLAG_APPLY | (RIDE_SET_VEHICLES_COMMAND_TYPE_RIDE_ENTRY << 8), @@ -7546,7 +7546,7 @@ void ride_set_ride_entry(int rideIndex, int rideEntry) void ride_set_num_vehicles(int rideIndex, int numVehicles) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_SET_VEHICLE_SET_NUM_TRAINS_FAIL; + gGameCommandErrorTitle = STR_RIDE_SET_VEHICLE_SET_NUM_TRAINS_FAIL; game_do_command( 0, GAME_COMMAND_FLAG_APPLY | (RIDE_SET_VEHICLES_COMMAND_TYPE_NUM_TRAINS << 8), @@ -7560,7 +7560,7 @@ void ride_set_num_vehicles(int rideIndex, int numVehicles) void ride_set_num_cars_per_vehicle(int rideIndex, int numCarsPerVehicle) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_SET_VEHICLE_SET_NUM_CARS_PER_TRAIN_FAIL; + gGameCommandErrorTitle = STR_RIDE_SET_VEHICLE_SET_NUM_CARS_PER_TRAIN_FAIL; game_do_command( 0, GAME_COMMAND_FLAG_APPLY | (RIDE_SET_VEHICLES_COMMAND_TYPE_NUM_CARS_PER_TRAIN << 8), @@ -7632,12 +7632,12 @@ money32 ride_set_vehicles(uint8 rideIndex, uint8 setting, uint8 value, uint32 fl RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_RIDE_RUNNING_COSTS * 4; if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING; + gGameCommandErrorText = STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING; return MONEY32_UNDEFINED; } if (ride->status != RIDE_STATUS_CLOSED) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_MUST_BE_CLOSED_FIRST; + gGameCommandErrorText = STR_MUST_BE_CLOSED_FIRST; return MONEY32_UNDEFINED; } @@ -8049,7 +8049,7 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio } if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } @@ -8069,12 +8069,12 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio } if (RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & ELEMENT_IS_UNDERWATER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } if (z > 1952) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } } else { @@ -8090,12 +8090,12 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio return MONEY32_UNDEFINED; } if (ride->status != RIDE_STATUS_CLOSED) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_MUST_BE_CLOSED_FIRST; + gGameCommandErrorText = STR_MUST_BE_CLOSED_FIRST; return MONEY32_UNDEFINED; } if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NOT_ALLOWED_TO_MODIFY_STATION; + gGameCommandErrorText = STR_NOT_ALLOWED_TO_MODIFY_STATION; return MONEY32_UNDEFINED; } @@ -8109,7 +8109,7 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio if (is_exit) { if (ride->exits[station_num] != 0xFFFF) { if (flags & GAME_COMMAND_FLAG_GHOST) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 0; + gGameCommandErrorText = 0; return MONEY32_UNDEFINED; } @@ -8119,7 +8119,7 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio } } else if (ride->entrances[station_num] != 0xFFFF) { if (flags & GAME_COMMAND_FLAG_GHOST) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 0; + gGameCommandErrorText = 0; return MONEY32_UNDEFINED; } @@ -8167,12 +8167,12 @@ money32 place_ride_entrance_or_exit(sint16 x, sint16 y, sint16 z, uint8 directio } if (RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & ELEMENT_IS_UNDERWATER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } if (z / 8 > 244){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } @@ -8252,13 +8252,13 @@ money32 remove_ride_entrance_or_exit(sint16 x, sint16 y, uint8 rideIndex, uint8 if (!(flags & GAME_COMMAND_FLAG_GHOST)){ if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } } if (ride->status != RIDE_STATUS_CLOSED){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_MUST_BE_CLOSED_FIRST; + gGameCommandErrorText = STR_MUST_BE_CLOSED_FIRST; return MONEY32_UNDEFINED; } @@ -8342,7 +8342,7 @@ void ride_set_to_default_inspection_interval(int rideIndex) uint8 defaultInspectionInterval = gConfigGeneral.default_inspection_interval; if (ride->inspection_interval != defaultInspectionInterval) { if (defaultInspectionInterval <= RIDE_INSPECTION_NEVER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_CHANGE_OPERATING_MODE; + gGameCommandErrorTitle = STR_CANT_CHANGE_OPERATING_MODE; game_do_command(0, (defaultInspectionInterval << 8) | 1, 0, (5 << 8) | rideIndex, GAME_COMMAND_SET_RIDE_SETTING, 0, 0); } } diff --git a/src/ride/track.c b/src/ride/track.c index 65b9a090c8..a4ea6fffd3 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -1230,7 +1230,7 @@ int track_place_scenery(rct_track_scenery* scenery_start, uint8 rideIndex, int o if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 0xE9; if (RCT2_GLOBAL(0x00F440D4, uint8) == 1)bl = 0x80; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE; + gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE; cost = game_do_command( mapCoord.x, @@ -1289,7 +1289,7 @@ int track_place_scenery(rct_track_scenery* scenery_start, uint8 rideIndex, int o if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 105; if (RCT2_GLOBAL(0x00F440D4, uint8) == 1)bl = 0; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_BUILD_PARK_ENTRANCE_HERE; + gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE; cost = game_do_command( mapCoord.x, @@ -1329,7 +1329,7 @@ int track_place_scenery(rct_track_scenery* scenery_start, uint8 rideIndex, int o if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 105; if (RCT2_GLOBAL(0x00F440D4, uint8) == 1)bl = 0; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; cost = game_do_command(mapCoord.x, bl | (bh << 8), mapCoord.y, z | (entry_index << 8), GAME_COMMAND_PLACE_PATH_FROM_TRACK, 0, 0); } else{ @@ -1458,7 +1458,7 @@ int track_place_maze(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac rotation += maze->unk_2; rotation &= 3; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; bl = 1; if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 0x69; @@ -1477,7 +1477,7 @@ int track_place_maze(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac rotation += maze->unk_2; rotation &= 3; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; bl = 1; if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 0x69; @@ -1499,7 +1499,7 @@ int track_place_maze(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 0x69; if (RCT2_GLOBAL(0x00F440D4, uint8) == 1)bl = 0; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; cost = game_do_command(mapCoord.x, bl | (maze_entry & 0xFF) << 8, mapCoord.y, rideIndex | (maze_entry & 0xFF00), GAME_COMMAND_PLACE_MAZE_DESIGN, z, 0); break; @@ -1674,7 +1674,7 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 105; if (RCT2_GLOBAL(0x00F440D4, uint8) == 1)bl = 0; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; money32 cost = game_do_command(x, bl | (rotation << 8), y, edx, GAME_COMMAND_PLACE_TRACK, edi, 0); RCT2_GLOBAL(0x00F440D5, money32) += cost; @@ -1880,7 +1880,7 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac if (RCT2_GLOBAL(0x00F440D4, uint8) == 4)bl = 105; if (RCT2_GLOBAL(0x00F440D4, uint8) == 1)bl = 0; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; money32 cost = game_do_command(x, bl | (rotation << 8), y, rideIndex | (is_exit << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, di, 0); RCT2_GLOBAL(0x00F440D5, money32) += cost; @@ -1899,7 +1899,7 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac z += RCT2_GLOBAL(0x00F44146, sint16); z /= 16; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; money32 cost = game_do_command(x, 0 | (rotation << 8), y, z | (is_exit << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, -1, 0); RCT2_GLOBAL(0x00F440D5, money32) += cost; @@ -2305,7 +2305,7 @@ int track_rename(const char *text) case '*': case '?': // Invalid characters - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS; + gGameCommandErrorText = STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS; return 0; } txt_chr++; @@ -2321,7 +2321,7 @@ int track_rename(const char *text) substitute_path(old_path, RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), &RCT2_ADDRESS(RCT2_ADDRESS_TRACK_LIST, char)[128 * w->track_list.var_482]); if (!platform_file_move(old_path, new_path)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED; + gGameCommandErrorText = STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED; return 0; } @@ -2350,7 +2350,7 @@ int track_delete() substitute_path(path, RCT2_ADDRESS(RCT2_ADDRESS_TRACKS_PATH, char), &RCT2_ADDRESS(RCT2_ADDRESS_TRACK_LIST, char)[128 * w->track_list.var_482]); if (!platform_file_delete(path)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED; + gGameCommandErrorText = STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED; return 0; } @@ -2522,7 +2522,7 @@ int maze_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* track_ } if (map_found == 0){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; + gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return 0; } @@ -2551,7 +2551,7 @@ int maze_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* track_ maze++; if (maze >= RCT2_ADDRESS(0x009DA151, rct_maze_element)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; + gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return 0; } } while (!map_element_is_last_for_tile(map_element++)); @@ -2564,7 +2564,7 @@ int maze_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* track_ uint16 location = ride->entrances[0]; if (location == 0xFFFF){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; + gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return 0; } @@ -2595,7 +2595,7 @@ int maze_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* track_ location = ride->exits[0]; if (location == 0xFFFF){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; + gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return 0; } @@ -2669,7 +2669,7 @@ int tracked_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* tra track_begin_end trackBeginEnd; if (!ride_try_get_origin_element(rideIndex, &trackElement)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; + gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return 0; } @@ -2698,7 +2698,7 @@ int tracked_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* tra RCT2_GLOBAL(0x00F4414D, uint8) = direction; if (sub_6C683D(&trackElement.x, &trackElement.y, &z, direction, track_type, 0, &trackElement.element, 0)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; + gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return 0; } @@ -2869,7 +2869,7 @@ int tracked_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* tra z /= 8; if (z > 127 || z < -126){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; + gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return 0; } @@ -3033,22 +3033,22 @@ int save_track_design(uint8 rideIndex){ rct_ride* ride = get_ride(rideIndex); if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED)){ - window_error_open(STR_CANT_SAVE_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); + window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return 0; } if (ride->ratings.excitement == (ride_rating)0xFFFF){ - window_error_open(STR_CANT_SAVE_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); + window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return 0; } if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_TRACK)) { - window_error_open(STR_CANT_SAVE_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); + window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return 0; } if (!ride_to_td6(rideIndex)){ - window_error_open(STR_CANT_SAVE_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); + window_error_open(STR_CANT_SAVE_TRACK_DESIGN, gGameCommandErrorText); return 0; } @@ -3261,7 +3261,7 @@ void game_command_place_track_design(int* eax, int* ebx, int* ecx, int* edx, int if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)){ if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -3275,7 +3275,7 @@ void game_command_place_track_design(int* eax, int* ebx, int* ecx, int* edx, int entry_index = 0xFF; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CREATE_NEW_RIDE_ATTRACTION; + gGameCommandErrorTitle = STR_CANT_CREATE_NEW_RIDE_ATTRACTION; int rideIndex = 0; { int _eax = 0, @@ -3326,10 +3326,10 @@ void game_command_place_track_design(int* eax, int* ebx, int* ecx, int* edx, int if (cost == MONEY32_UNDEFINED || !(flags & GAME_COMMAND_FLAG_APPLY)){ - rct_string_id error_reason = RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id); + rct_string_id error_reason = gGameCommandErrorText; game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, rideIndex, GAME_COMMAND_DEMOLISH_RIDE, 0, 0); *ebx = cost; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = error_reason; + gGameCommandErrorText = error_reason; RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION * 4; RCT2_GLOBAL(0x00F44121, money32) = cost; return; @@ -3414,7 +3414,7 @@ money32 place_maze_design(uint8 flags, uint8 rideIndex, uint16 mazeEntry, sint16 if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)) { if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } } @@ -3440,7 +3440,7 @@ money32 place_maze_design(uint8 flags, uint8 rideIndex, uint16 mazeEntry, sint16 uint8 supportHeight = (supportZ - mapElement->base_height) / 2; uint8 maxSupportHeight = RideData5[RIDE_TYPE_MAZE].max_height; if (supportHeight > maxSupportHeight) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH_FOR_SUPPORTS; + gGameCommandErrorText = STR_TOO_HIGH_FOR_SUPPORTS; return MONEY32_UNDEFINED; } } @@ -3460,11 +3460,11 @@ money32 place_maze_design(uint8 flags, uint8 rideIndex, uint16 mazeEntry, sint16 uint8 elctgaw = RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8); if (elctgaw & ELEMENT_IS_UNDERWATER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } if (elctgaw & ELEMENT_IS_UNDERGROUND) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; return MONEY32_UNDEFINED; } } @@ -4119,7 +4119,7 @@ static bool track_add_station_element(int x, int y, int z, int direction, int ri rct_ride *ride = get_ride(rideIndex); if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_3)) { if (ride->num_stations >= 4) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE; + gGameCommandErrorText = STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE; return false; } if (flags & GAME_COMMAND_FLAG_APPLY) { @@ -4187,12 +4187,12 @@ static bool track_add_station_element(int x, int y, int z, int direction, int ri } while (stationElement != NULL); if (stationX0 == stationX1 && stationY0 == stationY1 && ride->num_stations >= 4) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE; + gGameCommandErrorText = STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE; return false; } if (stationLength > 12) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_STATION_PLATFORM_TOO_LONG; + gGameCommandErrorText = STR_STATION_PLATFORM_TOO_LONG; return false; } @@ -4318,7 +4318,7 @@ static bool track_remove_station_element(int x, int y, int z, int direction, int (removeX != stationX1 || removeY != stationY1) && ride->num_stations >= 4 ) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE; + gGameCommandErrorText = STR_NO_MORE_STATIONS_ALLOWED_ON_THIS_RIDE; return false; } else { return true; @@ -4426,7 +4426,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in RCT2_GLOBAL(0x00F44068, uint32) = rideTypeFlags; if ((ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) && type == 1) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NOT_ALLOWED_TO_MODIFY_STATION; + gGameCommandErrorText = STR_NOT_ALLOWED_TO_MODIFY_STATION; return MONEY32_UNDEFINED; } if (!sub_68B044()) { @@ -4434,7 +4434,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in } if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED)) { if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } } @@ -4444,18 +4444,18 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in } else { if (type == TRACK_ELEM_ON_RIDE_PHOTO) { if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_ONLY_ONE_ON_RIDE_PHOTO_PER_RIDE; + gGameCommandErrorText = STR_ONLY_ONE_ON_RIDE_PHOTO_PER_RIDE; return MONEY32_UNDEFINED; } } else if (type == TRACK_ELEM_CABLE_LIFT_HILL) { if (ride->lifecycle_flags & RIDE_LIFECYCLE_16) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_ONLY_ONE_CABLE_LIFT_HILL_PER_RIDE; + gGameCommandErrorText = STR_ONLY_ONE_CABLE_LIFT_HILL_PER_RIDE; return MONEY32_UNDEFINED; } } if ((edx_flags & (1 << 0)) && !(enabledTrackPieces & (1ULL << TRACK_LIFT_HILL_STEEP))) { if (RCT2_ADDRESS(0x0099423C, uint16)[type] & 0x400) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_STEEP_FOR_LIFT_HILL; + gGameCommandErrorText = STR_TOO_STEEP_FOR_LIFT_HILL; return MONEY32_UNDEFINED; } } @@ -4493,7 +4493,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in z = originZ + trackBlock->z; if (!map_is_location_owned(x, y, z) && !gCheatsSandboxMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_LAND_NOT_OWNED_BY_PARK; + gGameCommandErrorText = STR_LAND_NOT_OWNED_BY_PARK; return MONEY32_UNDEFINED; } } @@ -4503,12 +4503,12 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in RCT2_ADDRESS(0x0099423C, uint16); if (trackFlags[type] & 0x100) { if ((originZ & 0x0F) != 8) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 954; + gGameCommandErrorText = 954; return MONEY32_UNDEFINED; } } else { if ((originZ & 0x0F) != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 954; + gGameCommandErrorText = 954; return MONEY32_UNDEFINED; } } @@ -4563,7 +4563,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in trackpieceZ = z; if (z < 16) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_LOW; + gGameCommandErrorText = STR_TOO_LOW; return MONEY32_UNDEFINED; } @@ -4580,7 +4580,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in clearanceZ = (clearanceZ / 8) + baseZ; if (clearanceZ >= 255) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } @@ -4614,7 +4614,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in bh = RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & 3; if (RCT2_GLOBAL(RCT2_ADDRESS_ABOVE_GROUND_FLAGS, uint8) != 0 && (RCT2_GLOBAL(RCT2_ADDRESS_ABOVE_GROUND_FLAGS, uint8) & bh) == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND; + gGameCommandErrorText = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND; return MONEY32_UNDEFINED; } @@ -4622,7 +4622,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in if (rideTypeFlags & RIDE_TYPE_FLAG_FLAT_RIDE) { if (RCT2_ADDRESS(0x0099443C, uint16)[type] & 0x200) { if (RCT2_GLOBAL(RCT2_ADDRESS_ABOVE_GROUND_FLAGS, uint8) & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; return MONEY32_UNDEFINED; } } @@ -4630,7 +4630,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in else { if (RCT2_ADDRESS(0x0099423C, uint16)[type] & 0x200) { if (RCT2_GLOBAL(RCT2_ADDRESS_ABOVE_GROUND_FLAGS, uint8) & TRACK_ELEMENT_LOCATION_IS_UNDERGROUND) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; return MONEY32_UNDEFINED; } } @@ -4639,7 +4639,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in if (rideTypeFlags & RIDE_TYPE_FLAG_FLAT_RIDE) { if (RCT2_ADDRESS(0x0099443C, uint16)[type] & 1) { if (!(RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & ELEMENT_IS_UNDERWATER)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } } @@ -4647,14 +4647,14 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in else { if (RCT2_ADDRESS(0x0099423C, uint16)[type] & 1) { if (RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & ELEMENT_IS_UNDERWATER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } } } if (RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & ELEMENT_IS_UNDERWATER) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } @@ -4663,19 +4663,19 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in uint8 water_height = 2 * (mapElement->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK); if (water_height == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ON_WATER; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_WATER; return MONEY32_UNDEFINED; } if (water_height != baseZ) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ON_WATER; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_WATER; return MONEY32_UNDEFINED; } water_height -= 2; if (water_height == mapElement->base_height) { bh = mapElement->properties.surface.slope & 0x0F; if (bh == 7 || bh == 11 || bh == 13 || bh == 14) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ON_WATER; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_WATER; return MONEY32_UNDEFINED; } } @@ -4722,7 +4722,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in } ride_height /= 2; if (ride_height > maxHeight && !(RCT2_GLOBAL(0x009D8150, uint8) & 1)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH_FOR_SUPPORTS; + gGameCommandErrorText = STR_TOO_HIGH_FOR_SUPPORTS; return MONEY32_UNDEFINED; } } @@ -4926,7 +4926,7 @@ money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 originY, } if (!(flags & (1 << 3)) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } @@ -4972,7 +4972,7 @@ money32 track_remove(uint8 type, uint8 sequence, sint16 originX, sint16 originY, } if (mapElement->flags & (1 << 6)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_YOU_ARE_NOT_ALLOWED_TO_REMOVE_THIS_SECTION; + gGameCommandErrorText = STR_YOU_ARE_NOT_ALLOWED_TO_REMOVE_THIS_SECTION; return MONEY32_UNDEFINED; } @@ -5265,7 +5265,7 @@ money32 set_maze_track(uint16 x, uint8 flags, uint8 direction, uint16 y, uint8 r heightDifference = heightDifference >> 1; if (heightDifference > RideData5[RIDE_TYPE_MAZE].max_height) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH_FOR_SUPPORTS; + gGameCommandErrorText = STR_TOO_HIGH_FOR_SUPPORTS; return MONEY32_UNDEFINED; } } diff --git a/src/windows/demolish_ride_prompt.c b/src/windows/demolish_ride_prompt.c index 892d3d12e0..ded5544632 100644 --- a/src/windows/demolish_ride_prompt.c +++ b/src/windows/demolish_ride_prompt.c @@ -111,7 +111,7 @@ static void window_ride_demolish_mouseup(rct_window *w, int widgetIndex) { switch (widgetIndex) { case WIDX_DEMOLISH: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_DEMOLISH_RIDE; + gGameCommandErrorTitle = STR_CANT_DEMOLISH_RIDE; game_do_command(0, 1, 0, w->number, GAME_COMMAND_DEMOLISH_RIDE, 0, 0); break; case WIDX_CANCEL: diff --git a/src/windows/editor_bottom_toolbar.c b/src/windows/editor_bottom_toolbar.c index ec420f64d7..5afcb5e643 100644 --- a/src/windows/editor_bottom_toolbar.c +++ b/src/windows/editor_bottom_toolbar.c @@ -21,6 +21,7 @@ #include "../addresses.h" #include "../audio/audio.h" #include "../config.h" +#include "../game.h" #include "../editor.h" #include "../input.h" #include "../scenario.h" @@ -226,7 +227,7 @@ bool window_editor_bottom_toolbar_check_object_selection() return true; } - window_error_open(STR_INVALID_SELECTION_OF_OBJECTS, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); + window_error_open(STR_INVALID_SELECTION_OF_OBJECTS, gGameCommandErrorText); w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION); if (w != NULL) { // Click tab with missing object @@ -290,7 +291,7 @@ void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up() { window_editor_inventions_list_open(); g_editor_step = EDITOR_STEP_INVENTIONS_LIST_SET_UP; } else { - window_error_open(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); + window_error_open(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, gGameCommandErrorText); } gfx_invalidate_screen(); @@ -327,7 +328,7 @@ void window_editor_bottom_toolbar_jump_forward_to_save_scenario() rct_s6_info *s6Info = (rct_s6_info*)0x0141F570; if (!scenario_prepare_for_save()) { - window_error_open(STR_UNABLE_TO_SAVE_SCENARIO_FILE, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id)); + window_error_open(STR_UNABLE_TO_SAVE_SCENARIO_FILE, gGameCommandErrorText); gfx_invalidate_screen(); return; } diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index 2baec032a9..360afa13ad 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -1016,7 +1016,7 @@ static void window_editor_object_selection_scroll_mousedown(rct_window *w, int s STR_UNABLE_TO_SELECT_THIS_OBJECT : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT; - window_error_open(error_title, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); + window_error_open(error_title, gGameCommandErrorText); return; } @@ -1707,7 +1707,7 @@ void reset_required_object_flags(){ * object. */ void set_object_selection_error(uint8 is_master_object, rct_string_id error_msg){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = error_msg; + gGameCommandErrorText = error_msg; if (!is_master_object){ reset_selected_object_count_and_size(); } diff --git a/src/windows/finances.c b/src/windows/finances.c index 26311266fd..12814bbf0b 100644 --- a/src/windows/finances.c +++ b/src/windows/finances.c @@ -601,13 +601,13 @@ static void window_finances_summary_mousedown(int widgetIndex, rct_window*w, rct switch (widgetIndex) { case WIDX_LOAN_INCREASE: newLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) + MONEY(1000, 00); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_BORROW_ANY_MORE_MONEY; + gGameCommandErrorTitle = STR_CANT_BORROW_ANY_MORE_MONEY; finance_set_loan(newLoan); break; case WIDX_LOAN_DECREASE: if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) > 0) { newLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) - MONEY(1000, 00); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_PAY_BACK_LOAN; + gGameCommandErrorTitle = STR_CANT_PAY_BACK_LOAN; finance_set_loan(newLoan); } break; diff --git a/src/windows/footpath.c b/src/windows/footpath.c index 46564f0de5..6e40f18d8a 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -767,7 +767,7 @@ static void window_footpath_place_path_at_point(int x, int y) selectedType = (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_TYPE, uint8) << 7) + RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, uint8); // Try and place path - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_BUILD_FOOTPATH_HERE; + gGameCommandErrorTitle = STR_CANT_BUILD_FOOTPATH_HERE; cost = footpath_place(selectedType, x, y, z, presentType, GAME_COMMAND_FLAG_APPLY); if (cost == MONEY32_UNDEFINED) { @@ -841,7 +841,7 @@ static void window_footpath_construct() footpath_get_next_path_info(&type, &x, &y, &z, &slope); // Try to place the path at the desired location - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 0x498; + gGameCommandErrorTitle = 0x498; money32 cost = footpath_place(type, x, y, z, slope, 0); if (cost != MONEY32_UNDEFINED) { @@ -856,7 +856,7 @@ static void window_footpath_construct() } // Actually place the path now - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 0x498; + gGameCommandErrorTitle = 0x498; cost = footpath_place(type, x, y, z, slope, GAME_COMMAND_FLAG_APPLY); if (cost != MONEY32_UNDEFINED) { @@ -922,7 +922,7 @@ static void footpath_remove_map_element(rct_map_element *mapElement) } // Remove path - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_REMOVE_FOOTPATH_FROM_HERE; + gGameCommandErrorTitle = STR_CANT_REMOVE_FOOTPATH_FROM_HERE; footpath_remove( RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_FROM_Y, uint16), diff --git a/src/windows/guest.c b/src/windows/guest.c index 6f56af5c45..facbf0bb80 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -1158,7 +1158,7 @@ void window_guest_overview_text_input(rct_window *w, int widgetIndex, char *text if (text == NULL) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_NAME_GUEST; + gGameCommandErrorTitle = STR_CANT_NAME_GUEST; game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, *((int*)(text + 0)), GAME_COMMAND_SET_PEEP_NAME, *((int*)(text + 8)), *((int*)(text + 4))); game_do_command(2, GAME_COMMAND_FLAG_APPLY, w->number, *((int*)(text + 12)), GAME_COMMAND_SET_PEEP_NAME, *((int*)(text + 20)), *((int*)(text + 16))); game_do_command(0, GAME_COMMAND_FLAG_APPLY, w->number, *((int*)(text + 24)), GAME_COMMAND_SET_PEEP_NAME, *((int*)(text + 32)), *((int*)(text + 28))); @@ -1246,8 +1246,8 @@ void window_guest_overview_tool_down(rct_window* w, int widgetIndex, int x, int } if (!map_can_construct_at(tile_x, tile_y, dest_z / 8, (dest_z / 8) + 1, 15)){ - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x3A5 ){ - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x49B){ + if (gGameCommandErrorText != 0x3A5 ){ + if (gGameCommandErrorText != 0x49B){ window_error_open(0x785, -1); return; } diff --git a/src/windows/map.c b/src/windows/map.c index 95e6bc513a..d17a41673a 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -465,7 +465,7 @@ static void window_map_tooldrag(rct_window* w, int widgetIndex, int x, int y) switch (widgetIndex) { case WIDX_SET_LAND_RIGHTS: if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 0; + gGameCommandErrorTitle = 0; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, uint16), GAME_COMMAND_FLAG_APPLY, @@ -557,7 +557,7 @@ static void window_map_scrollmousedown(rct_window *w, int scrollIndex, int x, in RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, uint16) = mapY + size; map_invalidate_selection_rect(); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CHANGE_LAND_TYPE; + gGameCommandErrorTitle = STR_CANT_CHANGE_LAND_TYPE; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), GAME_COMMAND_FLAG_APPLY, @@ -584,7 +584,7 @@ static void window_map_scrollmousedown(rct_window *w, int scrollIndex, int x, in RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, uint16) = mapY + size; map_invalidate_selection_rect(); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 0; + gGameCommandErrorTitle = 0; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, uint16), GAME_COMMAND_FLAG_APPLY, @@ -1276,7 +1276,7 @@ static void window_map_place_park_entrance_tool_down(int x, int y) if (mapX == (sint16)0x8000) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_BUILD_PARK_ENTRANCE_HERE; + gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE; price = game_do_command( mapX, GAME_COMMAND_FLAG_APPLY | (direction << 8), diff --git a/src/windows/maze_construction.c b/src/windows/maze_construction.c index 3b304e0c4f..17118831fc 100644 --- a/src/windows/maze_construction.c +++ b/src/windows/maze_construction.c @@ -363,7 +363,7 @@ static void window_maze_construction_entrance_tooldown(int x, int y, rct_window* uint8 rideIndex = RCT2_GLOBAL(0x00F44192, uint8); uint8 is_exit = RCT2_GLOBAL(0x00F44191, uint8); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = is_exit ? 1144 : 1145; + gGameCommandErrorTitle = is_exit ? 1144 : 1145; money32 cost = game_do_command( x, @@ -497,7 +497,7 @@ static void window_maze_construction_construct(int direction) break; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; money32 cost = game_do_command( x, flags | (direction << 8), diff --git a/src/windows/park.c b/src/windows/park.c index 7529258a6f..8a442f5ed2 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -710,10 +710,10 @@ static void window_park_entrance_dropdown(rct_window *w, int widgetIndex, int dr dropdownIndex = gDropdownHighlightedIndex; if (dropdownIndex != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1724; + gGameCommandErrorTitle = 1724; park_set_open(1); } else { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1723; + gGameCommandErrorTitle = 1723; park_set_open(0); } } @@ -830,7 +830,7 @@ static void window_park_entrance_tooldown(rct_window* w, int widgetIndex, int x, case WIDX_BUY_LAND_RIGHTS: if (LandRightsMode) { if (x != (sint16)0x8000) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 0x6BD; // Can't buy land... + gGameCommandErrorTitle = 0x6BD; // Can't buy land... game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), 1, @@ -844,7 +844,7 @@ static void window_park_entrance_tooldown(rct_window* w, int widgetIndex, int x, } else { if (x != (sint16)0x8000) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 0x6C0; // Can't buy construction rights here... + gGameCommandErrorTitle = 0x6C0; // Can't buy construction rights here... game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), 1, @@ -873,7 +873,7 @@ static void window_park_entrance_tooldrag(rct_window* w, int widgetIndex, int x, case WIDX_BUY_LAND_RIGHTS: if (LandRightsMode) { if (x != (sint16)0x8000) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 0x6BD; // Can't buy land... + gGameCommandErrorTitle = 0x6BD; // Can't buy land... game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), 1, @@ -887,7 +887,7 @@ static void window_park_entrance_tooldrag(rct_window* w, int widgetIndex, int x, } else { if (x != (sint16)0x8000) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = 0x6C0; // Can't buy construction rights here... + gGameCommandErrorTitle = 0x6C0; // Can't buy construction rights here... game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), 1, diff --git a/src/windows/ride.c b/src/windows/ride.c index efd50c8e7c..2d38002fb2 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -1723,15 +1723,15 @@ static void window_ride_main_mouseup(rct_window *w, int widgetIndex) switch (widgetIndex - WIDX_CLOSE_LIGHT) { case 0: status = RIDE_STATUS_CLOSED; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CLOSE; + gGameCommandErrorTitle = STR_CANT_CLOSE; break; case 1: status = RIDE_STATUS_TESTING; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_TEST; + gGameCommandErrorTitle = STR_CANT_TEST; break; case 2: status = RIDE_STATUS_OPEN; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_OPEN; + gGameCommandErrorTitle = STR_CANT_OPEN; break; } @@ -1964,15 +1964,15 @@ static void window_ride_main_dropdown(rct_window *w, int widgetIndex, int dropdo switch (dropdownIndex) { case 0: status = RIDE_STATUS_CLOSED; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CLOSE; + gGameCommandErrorTitle = STR_CANT_CLOSE; break; case 1: status = RIDE_STATUS_TESTING; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_TEST; + gGameCommandErrorTitle = STR_CANT_TEST; break; case 2: status = RIDE_STATUS_OPEN; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_OPEN; + gGameCommandErrorTitle = STR_CANT_OPEN; break; } @@ -2769,7 +2769,7 @@ static void window_ride_vehicle_scrollpaint(rct_window *w, rct_drawpixelinfo *dp static void set_operating_setting(int rideNumber, uint8 setting, uint8 value) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_CHANGE_OPERATING_MODE; + gGameCommandErrorTitle = STR_CANT_CHANGE_OPERATING_MODE; game_do_command(0, (value << 8) | 1, 0, (setting << 8) | rideNumber, GAME_COMMAND_SET_RIDE_SETTING, 0, 0); } @@ -2777,25 +2777,25 @@ static void window_ride_mode_tweak_set(rct_window *w, uint8 value) { rct_ride *ride = get_ride(w->number); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1362; + gGameCommandErrorTitle = 1362; if (ride->mode == RIDE_MODE_STATION_TO_STATION) - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1361; + gGameCommandErrorTitle = 1361; if (ride->mode == RIDE_MODE_RACE) - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1738; + gGameCommandErrorTitle = 1738; if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13)) - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1746; + gGameCommandErrorTitle = 1746; if (ride->mode == RIDE_MODE_BUMPERCAR) - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1751; + gGameCommandErrorTitle = 1751; if (ride->mode == RIDE_MODE_SWING) - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1768; + gGameCommandErrorTitle = 1768; if (ride->mode == RIDE_MODE_ROTATION) - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1868; + gGameCommandErrorTitle = 1868; if ( ride->mode == RIDE_MODE_ROTATION || ride->mode == RIDE_MODE_FORWARD_ROTATION || ride->mode == RIDE_MODE_BACKWARD_ROTATION ) - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1868; + gGameCommandErrorTitle = 1868; set_operating_setting(w->number, RIDE_SETTING_OPERATION_OPTION, value); } @@ -3527,7 +3527,7 @@ static void window_ride_maintenance_dropdown(rct_window *w, int widgetIndex, int switch (widgetIndex) { case WIDX_INSPECTION_INTERVAL_DROPDOWN: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_CHANGE_OPERATING_MODE; + gGameCommandErrorTitle = STR_CANT_CHANGE_OPERATING_MODE; game_do_command(0, (dropdownIndex << 8) | 1, 0, (5 << 8) | w->number, GAME_COMMAND_SET_RIDE_SETTING, 0, 0); break; @@ -4463,7 +4463,7 @@ static void window_ride_toggle_music(rct_window *w) int activateMusic = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) ? 0 : 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_CHANGE_OPERATING_MODE; + gGameCommandErrorTitle = STR_CANT_CHANGE_OPERATING_MODE; game_do_command(0, (activateMusic << 8) | 1, 0, (6 << 8) | w->number, GAME_COMMAND_SET_RIDE_SETTING, 0, 0); } @@ -4569,7 +4569,7 @@ static void window_ride_music_dropdown(rct_window *w, int widgetIndex, int dropd ride = get_ride(w->number); musicStyle = window_ride_current_music_style_order[dropdownIndex]; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_CHANGE_OPERATING_MODE; + gGameCommandErrorTitle = STR_CANT_CHANGE_OPERATING_MODE; game_do_command(0, (musicStyle << 8) | 1, 0, (7 << 8) | w->number, GAME_COMMAND_SET_RIDE_SETTING, 0, 0); } diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 250f47317f..5ff15e5888 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -1610,7 +1610,7 @@ static void window_ride_construction_construct(rct_window *w) } } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; RCT2_GLOBAL(0x00F44074, money32) = game_do_command( x, (GAME_COMMAND_FLAG_APPLY) | (trackDirection << 8), @@ -3786,7 +3786,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY) RCT2_GLOBAL(0x009A8C29, uint8) |= 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; + gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; RCT2_GLOBAL(0x00F44074, money32) = game_do_command( _currentTrackBeginX, GAME_COMMAND_FLAG_APPLY | (4 << 8), @@ -3799,7 +3799,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY) RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; if (RCT2_GLOBAL(0x00F44074, money32) == MONEY32_UNDEFINED) { - rct_string_id errorText = RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id); + rct_string_id errorText = gGameCommandErrorText; z -= 8; if ( errorText == STR_NOT_ENOUGH_CASH_REQUIRES || @@ -3852,7 +3852,7 @@ void ride_construction_tooldown_construct(int screenX, int screenY) RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; if (RCT2_GLOBAL(0x00F44074, money32) == MONEY32_UNDEFINED) { - rct_string_id errorText = RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id); + rct_string_id errorText = gGameCommandErrorText; z -= 8; if ( errorText == STR_NOT_ENOUGH_CASH_REQUIRES || @@ -3923,7 +3923,7 @@ static void ride_construction_tooldown_entrance_exit(int screenX, int screenY) if (RCT2_GLOBAL(0x00F44194, uint8) == 255) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = (RCT2_GLOBAL(0x00F44191, uint8) == 0) ? + gGameCommandErrorTitle = (RCT2_GLOBAL(0x00F44191, uint8) == 0) ? STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION : STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION; diff --git a/src/windows/sign.c b/src/windows/sign.c index 3adf295347..78cee54d0f 100644 --- a/src/windows/sign.c +++ b/src/windows/sign.c @@ -509,7 +509,7 @@ static void window_sign_small_mouseup(rct_window *w, int widgetIndex) } map_element++; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, 1 | ((map_element->type & 0x3) << 8), diff --git a/src/windows/staff.c b/src/windows/staff.c index bc5209998a..d25fdd3839 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -1167,8 +1167,8 @@ void window_staff_overview_tool_down(rct_window* w, int widgetIndex, int x, int } if (!map_can_construct_at(tile_x, tile_y, dest_z / 8, (dest_z / 8) + 1, 15)){ - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x3A5){ - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x49B){ + if (gGameCommandErrorText != 0x3A5){ + if (gGameCommandErrorText != 0x49B){ window_error_open(0x785, -1); return; } @@ -1242,7 +1242,7 @@ void window_staff_overview_text_input(rct_window *w, int widgetIndex, char *text if (text == NULL) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_NAME_STAFF_MEMBER; + gGameCommandErrorTitle = STR_CANT_NAME_STAFF_MEMBER; game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, *((int*)(text + 0)), GAME_COMMAND_SET_PEEP_NAME, *((int*)(text + 8)), *((int*)(text + 4))); game_do_command(2, GAME_COMMAND_FLAG_APPLY, w->number, *((int*)(text + 12)), GAME_COMMAND_SET_PEEP_NAME, *((int*)(text + 20)), *((int*)(text + 16))); game_do_command(0, GAME_COMMAND_FLAG_APPLY, w->number, *((int*)(text + 24)), GAME_COMMAND_SET_PEEP_NAME, *((int*)(text + 32)), *((int*)(text + 28))); diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index e73bc4332f..26e627ccd3 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -917,7 +917,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){ SMALL_SCENERY_FLAG10))) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS; + gGameCommandErrorTitle = STR_CANT_REPAINT_THIS; game_do_command( grid_x, 1 | (map_element->type << 8), @@ -938,7 +938,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){ WALL_SCENERY_FLAG2))) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS; + gGameCommandErrorTitle = STR_CANT_REPAINT_THIS; game_do_command( grid_x, 1 | (window_scenery_primary_colour << 8), @@ -958,7 +958,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){ (1 << 0))) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS; + gGameCommandErrorTitle = STR_CANT_REPAINT_THIS; game_do_command( grid_x, 1 | ((map_element->type & MAP_ELEMENT_DIRECTION_MASK) << 8), @@ -979,7 +979,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){ (1 << 0))) return; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REPAINT_THIS; + gGameCommandErrorTitle = STR_CANT_REPAINT_THIS; game_do_command( grid_x, 1, @@ -1501,7 +1501,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w int flags = GAME_COMMAND_FLAG_APPLY | (parameter_1 & 0xFF00); RCT2_GLOBAL(0x009A8C29, uint8) |= 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE; + gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE; int cost = game_do_command( cur_grid_x, flags, @@ -1521,8 +1521,8 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w } if ( - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES || - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_CAN_ONLY_BUILD_THIS_ON_WATER + gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES || + gGameCommandErrorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER ) { break; } @@ -1533,7 +1533,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w if (success) { successfulPlacements++; } else { - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES) { + if (gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES) { break; } } @@ -1551,7 +1551,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w { int flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_7 | (parameter_1 & 0xFF00); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE; + gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE; int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_PATH, parameter_3, 0); if (cost != MONEY32_UNDEFINED) { audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16)); @@ -1572,7 +1572,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY; RCT2_GLOBAL(0x009A8C29, uint8) |= 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_BUILD_PARK_ENTRANCE_HERE; + gGameCommandErrorTitle = STR_CANT_BUILD_PARK_ENTRANCE_HERE; int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_FENCE, RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16), RCT2_GLOBAL(0x00F64F15, uint16)); RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; @@ -1583,8 +1583,8 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w } if ( - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES || - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_CAN_ONLY_BUILD_THIS_ON_WATER + gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES || + gGameCommandErrorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER ) { break; } @@ -1609,7 +1609,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY; RCT2_GLOBAL(0x009A8C29, uint8) |= 1; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE; + gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE; int cost = game_do_command(gridX, flags, gridY, parameter_2, GAME_COMMAND_PLACE_LARGE_SCENERY, parameter_3, RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16)); RCT2_GLOBAL(0x009A8C29, uint8) &= ~1; @@ -1620,8 +1620,8 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w } if ( - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_NOT_ENOUGH_CASH_REQUIRES || - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == STR_CAN_ONLY_BUILD_THIS_ON_WATER + gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES || + gGameCommandErrorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER ) { break; } @@ -1636,7 +1636,7 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w { int flags = (parameter_1 & 0xFF00) | GAME_COMMAND_FLAG_APPLY; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_POSITION_THIS_HERE; + gGameCommandErrorTitle = STR_CANT_POSITION_THIS_HERE; registers regs = { .eax = gridX, .ebx = flags, @@ -2562,7 +2562,7 @@ static void window_top_toolbar_tool_down(rct_window* w, int widgetIndex, int x, if (!RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0)) break; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE; + gGameCommandErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), @@ -2577,7 +2577,7 @@ static void window_top_toolbar_tool_down(rct_window* w, int widgetIndex, int x, break; case WIDX_LAND: if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16)&(1 << 0)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CHANGE_LAND_TYPE; + gGameCommandErrorTitle = STR_CANT_CHANGE_LAND_TYPE; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), 1, @@ -2615,7 +2615,7 @@ money32 selection_raise_land(uint8 flags) uint32 xBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) << 16); uint32 yBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) << 16); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_RAISE_LAND_HERE; + gGameCommandErrorTitle = STR_CANT_RAISE_LAND_HERE; if (gLandMountainMode) { return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_EDIT_LAND_SMOOTH, 1, yBounds); } else { @@ -2637,7 +2637,7 @@ money32 selection_lower_land(uint8 flags) uint32 xBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) << 16); uint32 yBounds = (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) & 0xFFFF) | (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) << 16); - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_LOWER_LAND_HERE; + gGameCommandErrorTitle = STR_CANT_LOWER_LAND_HERE; if (gLandMountainMode) { return game_do_command(centreX, flags, centreY, xBounds, GAME_COMMAND_EDIT_LAND_SMOOTH, 0xFFFF, yBounds); } else { @@ -2711,7 +2711,7 @@ void window_top_toolbar_water_tool_drag(short x, short y) if (y <= dx) { gInputDragLastY += dx; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_RAISE_WATER_LEVEL_HERE; + gGameCommandErrorTitle = STR_CANT_RAISE_WATER_LEVEL_HERE; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), @@ -2733,7 +2733,7 @@ void window_top_toolbar_water_tool_drag(short x, short y) if (y >= dx) { gInputDragLastY += dx; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_LOWER_WATER_LEVEL_HERE; + gGameCommandErrorTitle = STR_CANT_LOWER_WATER_LEVEL_HERE; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), @@ -2765,7 +2765,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, int widgetIndex, int x, if (!RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) & (1 << 0)) break; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE; + gGameCommandErrorTitle = STR_UNABLE_TO_REMOVE_ALL_SCENERY_FROM_HERE; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), @@ -2782,7 +2782,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, int widgetIndex, int x, // Custom setting to only change land style instead of raising or lowering land if (gLandPaintMode) { if (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16)&(1 << 0)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_CHANGE_LAND_TYPE; + gGameCommandErrorTitle = STR_CANT_CHANGE_LAND_TYPE; game_do_command( RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16), 1, diff --git a/src/windows/track_manage.c b/src/windows/track_manage.c index 0f8f87ea1e..ccf5ee1420 100644 --- a/src/windows/track_manage.c +++ b/src/windows/track_manage.c @@ -19,12 +19,13 @@ *****************************************************************************/ #include "../addresses.h" +#include "../game.h" +#include "../interface/themes.h" #include "../interface/widget.h" #include "../interface/window.h" #include "../localisation/localisation.h" #include "../ride/track.h" #include "error.h" -#include "../interface/themes.h" #pragma region Widgets @@ -223,7 +224,7 @@ static void window_track_manage_textinput(rct_window *w, int widgetIndex, char * window_close_by_class(WC_TRACK_DELETE_PROMPT); window_close(w); } else { - window_error_open(STR_CANT_RENAME_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); + window_error_open(STR_CANT_RENAME_TRACK_DESIGN, gGameCommandErrorText); } } @@ -285,7 +286,7 @@ static void window_track_delete_prompt_mouseup(rct_window *w, int widgetIndex) if (track_delete()) window_close_by_class(WC_MANAGE_TRACK_DESIGN); else - window_error_open(STR_CANT_DELETE_TRACK_DESIGN, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16)); + window_error_open(STR_CANT_DELETE_TRACK_DESIGN, gGameCommandErrorText); break; } } diff --git a/src/windows/track_place.c b/src/windows/track_place.c index 0567f9722e..4a5e497f48 100644 --- a/src/windows/track_place.c +++ b/src/windows/track_place.c @@ -557,7 +557,7 @@ static void window_track_place_tooldown(rct_window* w, int widgetIndex, int x, i } // Check if player did not have enough funds - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) == 827) + if (gGameCommandErrorText == 827) break; mapZ += 8; diff --git a/src/world/banner.c b/src/world/banner.c index f244ead699..ce1b02ae41 100644 --- a/src/world/banner.c +++ b/src/world/banner.c @@ -56,7 +56,7 @@ int create_new_banner(uint8 flags) } if (banner_index == MAX_BANNERS){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_MANY_BANNERS_IN_GAME; + gGameCommandErrorText = STR_TOO_MANY_BANNERS_IN_GAME; return BANNER_NULL; } diff --git a/src/world/footpath.c b/src/world/footpath.c index 4a262feb34..aeb9b3957e 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -163,7 +163,7 @@ static money32 footpath_element_insert(int type, int x, int y, int z, int slope, RCT2_GLOBAL(0x00F3EFA4, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8); if (!gCheatsDisableClearanceChecks && (RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & ELEMENT_IS_UNDERWATER)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } @@ -219,22 +219,22 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement uint16 unk6 = scenery_entry->path_bit.var_06; if ((unk6 & 0x80) && (mapElement->properties.path.type & 4)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH; + gGameCommandErrorText = STR_CANT_BUILD_THIS_ON_SLOPED_FOOTPATH; return MONEY32_UNDEFINED; } if ((unk6 & 0x40) && footpath_element_is_queue(mapElement)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANNOT_PLACE_THESE_ON_QUEUE_LINE_AREA; + gGameCommandErrorText = STR_CANNOT_PLACE_THESE_ON_QUEUE_LINE_AREA; return MONEY32_UNDEFINED; } if (!(unk6 & 0x30) && (mapElement->properties.path.edges & 0x0F) == 0x0F) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NONE; + gGameCommandErrorText = STR_NONE; return MONEY32_UNDEFINED; } if ((unk6 & 0x100) && !footpath_element_is_queue(mapElement)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA; + gGameCommandErrorText = STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA; return MONEY32_UNDEFINED; } @@ -248,7 +248,7 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement if (flags & GAME_COMMAND_FLAG_GHOST) { // Check if there is something on the path already if (footpath_element_has_path_scenery(mapElement)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NONE; + gGameCommandErrorText = STR_NONE; return MONEY32_UNDEFINED; } @@ -309,7 +309,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z * 8; if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } @@ -320,7 +320,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int RCT2_GLOBAL(0x00F3EFA4, uint8) = 0; if (x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP; + gGameCommandErrorText = STR_OFF_EDGE_OF_MAP; return MONEY32_UNDEFINED; } @@ -328,17 +328,17 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int return MONEY32_UNDEFINED; if (slope & 8) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_LAND_SLOPE_UNSUITABLE; + gGameCommandErrorText = STR_LAND_SLOPE_UNSUITABLE; return MONEY32_UNDEFINED; } if (z < 2) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_LOW; + gGameCommandErrorText = STR_TOO_LOW; return MONEY32_UNDEFINED; } if (z > 248) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } @@ -386,7 +386,7 @@ money32 footpath_remove_real(int x, int y, int z, int flags) RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z * 8; if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } @@ -446,7 +446,7 @@ static money32 footpath_place_from_track(int type, int x, int y, int z, int slop RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z * 8; if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } @@ -464,12 +464,12 @@ static money32 footpath_place_from_track(int type, int x, int y, int z, int slop return MONEY32_UNDEFINED; if (z < 2) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_LOW; + gGameCommandErrorText = STR_TOO_LOW; return MONEY32_UNDEFINED; } if (z > 248) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } @@ -492,7 +492,7 @@ static money32 footpath_place_from_track(int type, int x, int y, int z, int slop RCT2_GLOBAL(0x00F3EFA4, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8); if (!gCheatsDisableClearanceChecks && (RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & ELEMENT_IS_UNDERWATER)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER; return MONEY32_UNDEFINED; } diff --git a/src/world/map.c b/src/world/map.c index d0c48b4b3a..682e2e540b 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -661,7 +661,7 @@ int map_is_location_owned(int x, int y, int z) } } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_LAND_NOT_OWNED_BY_PARK; + gGameCommandErrorText = STR_LAND_NOT_OWNED_BY_PARK; return 0; } @@ -681,7 +681,7 @@ int map_is_location_in_park(int x, int y) return 1; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_LAND_NOT_OWNED_BY_PARK; + gGameCommandErrorText = STR_LAND_NOT_OWNED_BY_PARK; return 0; } @@ -726,7 +726,7 @@ void game_command_remove_scenery(int* eax, int* ebx, int* ecx, int* edx, int* es RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = base_height * 8; if (!(flags & GAME_COMMAND_FLAG_GHOST) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -735,7 +735,7 @@ void game_command_remove_scenery(int* eax, int* ebx, int* ecx, int* edx, int* es // Check if allowed to remove item if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_TREE_REMOVAL) { if (entry->small_scenery.height > 64) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; + gGameCommandErrorText = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; *ebx = MONEY32_UNDEFINED; return; } @@ -804,7 +804,7 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_LANDSCAPING * 4; if (!(flags & GAME_COMMAND_FLAG_GHOST) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -954,7 +954,7 @@ void game_command_remove_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z; if(!(flags & GAME_COMMAND_FLAG_GHOST) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -1392,7 +1392,7 @@ money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, int flags) totalCost += cost; } } else { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_LAND_NOT_OWNED_BY_PARK; + gGameCommandErrorText = STR_LAND_NOT_OWNED_BY_PARK; } } } @@ -1601,37 +1601,37 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl rct_map_element *mapElement; if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; return MONEY32_UNDEFINED; } if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; + gGameCommandErrorText = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; return MONEY32_UNDEFINED; } } if (x > RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16) || y > RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP; + gGameCommandErrorText = STR_OFF_EDGE_OF_MAP; return MONEY32_UNDEFINED; } if (height < 2) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_LOW; + gGameCommandErrorText = STR_TOO_LOW; return MONEY32_UNDEFINED; } if (height > 62) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } else if (height == 62 && (style & 0x1F) != 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } if (height == 60 && (style & 0x10)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; return MONEY32_UNDEFINED; } @@ -1686,7 +1686,7 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl int zDelta = mapElement->clearance_height - height; if(zDelta >= 0 && zDelta/2 > maxHeight) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_SUPPORTS_CANT_BE_EXTENDED; + gGameCommandErrorText = STR_SUPPORTS_CANT_BE_EXTENDED; return MONEY32_UNDEFINED; } }while(!map_element_is_last_for_tile(mapElement++)); @@ -2570,30 +2570,30 @@ void game_command_set_water_height(int* eax, int* ebx, int* ecx, int* edx, int* RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, sint16) = y + 16; RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint32) = base_height * 8; if(RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; + gGameCommandErrorText = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; *ebx = MONEY32_UNDEFINED; return; } if(base_height < 2){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TOO_LOW; + gGameCommandErrorText = STR_TOO_LOW; *ebx = MONEY32_UNDEFINED; return; } if(base_height >= 58){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TOO_HIGH; + gGameCommandErrorText = STR_TOO_HIGH; *ebx = MONEY32_UNDEFINED; return; } if(x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16) || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16)){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_OFF_EDGE_OF_MAP; + gGameCommandErrorText = STR_OFF_EDGE_OF_MAP; *ebx = MONEY32_UNDEFINED; return; } @@ -2624,7 +2624,7 @@ void game_command_set_water_height(int* eax, int* ebx, int* ecx, int* edx, int* if (gCheatsDisableClearanceChecks || map_can_construct_at(x, y, zLow, zHigh, 0xFF)) { if(map_element->type & 0x40){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0; + gGameCommandErrorText = 0; *ebx = MONEY32_UNDEFINED; return; } @@ -2658,7 +2658,7 @@ void game_command_remove_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_LANDSCAPING * 4; if(!(*ebx & 0x40) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -2714,7 +2714,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = base_height * 16; RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_LANDSCAPING * 4; if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -2749,7 +2749,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, } while (!map_element_is_last_for_tile(map_element++)); if (pathFound == false) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS; + gGameCommandErrorText = STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS; *ebx = MONEY32_UNDEFINED; return; } @@ -2772,7 +2772,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, if ((map_element->properties.banner.position & 0x3) != edge) continue; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_BANNER_SIGN_IN_THE_WAY; + gGameCommandErrorText = STR_BANNER_SIGN_IN_THE_WAY; *ebx = MONEY32_UNDEFINED; return; } while (!map_element_is_last_for_tile(map_element++)); @@ -2961,20 +2961,20 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi if(!gCheatsDisableClearanceChecks && (map_element->properties.surface.terrain & 0x1F)){ int water_height = ((map_element->properties.surface.terrain & 0x1F) * 16) - 1; if(water_height > F64EC8){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER; *ebx = MONEY32_UNDEFINED; return; } } if(!gCheatsDisableClearanceChecks && !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18)){ if(F64F1D != 0){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CAN_ONLY_BUILD_THIS_ON_LAND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; *ebx = MONEY32_UNDEFINED; return; } if(map_element->properties.surface.terrain & 0x1F){ if(((map_element->properties.surface.terrain & 0x1F) * 16) > F64EC8){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CAN_ONLY_BUILD_THIS_ON_LAND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; *ebx = MONEY32_UNDEFINED; return; } @@ -3063,21 +3063,21 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi }else{ if(F64F1D == 0){ if((map_element->properties.surface.terrain & 0x1F) || (map_element->base_height * 8) != F64EC8){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_LEVEL_LAND_REQUIRED; + gGameCommandErrorText = STR_LEVEL_LAND_REQUIRED; }else{ goto l_6E0B78; } }else{ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CAN_ONLY_BUILD_THIS_ON_LAND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; } } }else{ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_LEVEL_LAND_REQUIRED; + gGameCommandErrorText = STR_LEVEL_LAND_REQUIRED; } } } }else{ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; } *ebx = MONEY32_UNDEFINED; } @@ -3196,7 +3196,7 @@ static bool map_place_fence_check_obstruction(rct_scenery_entry *wall, int x, in RCT2_GLOBAL(0x0141F725, uint8) = 0; RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) = 1; if (map_is_location_at_edge(x, y)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP; + gGameCommandErrorText = STR_OFF_EDGE_OF_MAP; return false; } @@ -3290,7 +3290,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -3342,14 +3342,14 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, water_height *= 16; if (position.z < water_height){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANT_BUILD_THIS_UNDERWATER; + gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER; *ebx = MONEY32_UNDEFINED; return; } } if (position.z / 8 < map_element->base_height){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; *ebx = MONEY32_UNDEFINED; return; } @@ -3360,7 +3360,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, new_base_height += 2; if (map_element->properties.surface.slope & (1 << new_edge)){ if (position.z / 8 < new_base_height){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; *ebx = MONEY32_UNDEFINED; return; } @@ -3373,7 +3373,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, if (map_element->properties.surface.slope & (1 << new_edge)){ new_base_height += 2; if (position.z / 8 < new_base_height){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; *ebx = MONEY32_UNDEFINED; return; } @@ -3386,7 +3386,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, new_edge = (edge + 3) & 3; if (map_element->properties.surface.slope & (1 << new_edge)){ if (position.z / 8 < new_base_height){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; *ebx = MONEY32_UNDEFINED; return; } @@ -3399,7 +3399,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, if (map_element->properties.surface.slope & (1 << new_edge)){ new_base_height += 2; if (position.z / 8 < new_base_height){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND; *ebx = MONEY32_UNDEFINED; return; } @@ -3439,7 +3439,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, RCT2_GLOBAL(0x00141F722, uint8) = position.z / 8; if (bp & 0xC0){ if (fence->wall.flags & WALL_SCENERY_FLAG3){ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 3133; + gGameCommandErrorText = 3133; *ebx = MONEY32_UNDEFINED; return; } @@ -3551,7 +3551,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in RCT2_GLOBAL(0x00F4389A, money32) = 0; if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 && !gCheatsBuildInPauseMode) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; return; } @@ -3682,7 +3682,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in int b = RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) & 0x3; if (!gCheatsDisableClearanceChecks) { if (RCT2_GLOBAL(0x00F64F14, uint8) && !(RCT2_GLOBAL(0x00F64F14, uint8) & b)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND; + gGameCommandErrorText = STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND; *ebx = MONEY32_UNDEFINED; return; } @@ -3690,7 +3690,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in RCT2_GLOBAL(0x00F64F14, uint8) = b; if (curTile.x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) || curTile.y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_OFF_EDGE_OF_MAP; + gGameCommandErrorText = STR_OFF_EDGE_OF_MAP; *ebx = MONEY32_UNDEFINED; return; } @@ -3949,7 +3949,7 @@ int sub_68B044() if (RCT2_GLOBAL(RCT2_ADDRESS_NEXT_FREE_MAP_ELEMENT, rct_map_element*) <= RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS_END, rct_map_element)) return 1; else{ - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 894; + gGameCommandErrorText = 894; return 0; } } @@ -4066,7 +4066,7 @@ static void map_obstruction_set_error_text(rct_map_element *mapElement) break; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = errorStringId; + gGameCommandErrorText = errorStringId; } /** @@ -4083,7 +4083,7 @@ int map_can_construct_with_clear_at(int x, int y, int zLow, int zHigh, CLEAR_FUN { RCT2_GLOBAL(RCT2_ADDRESS_ELEMENT_LOCATION_COMPARED_TO_GROUND_AND_WATER, uint8) = 1; if (x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16) || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16) || x < 32 || y < 32) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP; + gGameCommandErrorText = STR_OFF_EDGE_OF_MAP; return false; } rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32); @@ -4108,7 +4108,7 @@ int map_can_construct_with_clear_at(int x, int y, int zLow, int zHigh, CLEAR_FUN int al = zHigh - map_element->base_height; if (al >= 0) { if (al > 18) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_LOCAL_AUTHORITY_WONT_ALLOW_CONSTRUCTION_ABOVE_TREE_HEIGHT; + gGameCommandErrorText = STR_LOCAL_AUTHORITY_WONT_ALLOW_CONSTRUCTION_ABOVE_TREE_HEIGHT; return false; } } @@ -4170,7 +4170,7 @@ int map_can_construct_with_clear_at(int x, int y, int zLow, int zHigh, CLEAR_FUN } } if (map_element != (rct_map_element*)0xFFFFFFF) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_CANNOT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_WATER; + gGameCommandErrorText = STR_CANNOT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_WATER; } return false; } @@ -4501,7 +4501,7 @@ static void sub_68AE2A(int x, int y) viewport_interaction_remove_park_entrance(mapElement, x, y); break; case MAP_ELEMENT_TYPE_FENCE: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, GAME_COMMAND_FLAG_APPLY, @@ -4513,7 +4513,7 @@ static void sub_68AE2A(int x, int y) ); break; case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, (GAME_COMMAND_FLAG_APPLY) | (mapElement->type & MAP_ELEMENT_DIRECTION_MASK), @@ -4525,7 +4525,7 @@ static void sub_68AE2A(int x, int y) ); break; case MAP_ELEMENT_TYPE_BANNER: - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_REMOVE_THIS; + gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; game_do_command( x, GAME_COMMAND_FLAG_APPLY, @@ -4916,7 +4916,7 @@ money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint8 direc } if (x <= 32 || y <= 32 || x >= (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16) - 32) || y >= (RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16) - 32)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 3215; + gGameCommandErrorText = 3215; return MONEY32_UNDEFINED; } @@ -4929,7 +4929,7 @@ money32 place_park_entrance(int flags, sint16 x, sint16 y, sint16 z, uint8 direc } if (entranceNum == -1) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = 3227; + gGameCommandErrorText = 3227; return MONEY32_UNDEFINED; } @@ -5124,7 +5124,7 @@ void game_command_set_banner_name(int* eax, int* ebx, int* ecx, int* edx, int* e window_invalidate(w); } } else { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 2984; + gGameCommandErrorText = 2984; *ebx = MONEY32_UNDEFINED; return; } @@ -5177,7 +5177,7 @@ void game_command_set_sign_name(int* eax, int* ebx, int* ecx, int* edx, int* esi banner->flags &= ~(BANNER_FLAG_2); gfx_invalidate_screen(); } else { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 2984; + gGameCommandErrorText = 2984; *ebx = MONEY32_UNDEFINED; return; } @@ -5204,7 +5204,7 @@ void game_command_set_sign_name(int* eax, int* ebx, int* ecx, int* edx, int* esi void game_command_set_banner_style(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp) { if ((*ecx >= MAX_BANNERS) || (*ecx < 0)) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_INVALID_SELECTION_OF_OBJECTS; + gGameCommandErrorText = STR_INVALID_SELECTION_OF_OBJECTS; *ebx = MONEY32_UNDEFINED; return; } @@ -5269,7 +5269,7 @@ void game_command_set_banner_style(int* eax, int* ebx, int* ecx, int* edx, int* window_invalidate(w); } } else { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 2984; + gGameCommandErrorText = 2984; *ebx = MONEY32_UNDEFINED; return; } @@ -5323,7 +5323,7 @@ void game_command_set_sign_style(int* eax, int* ebx, int* ecx, int* edx, int* es } else { // large sign rct_map_element *mapElement = banner_get_map_element(bannerId); if (mapElement == NULL || map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 2984; + gGameCommandErrorText = 2984; *ebx = MONEY32_UNDEFINED; return; } diff --git a/src/world/park.c b/src/world/park.c index 0369a0021c..1ec9193511 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -746,7 +746,7 @@ void update_park_fences(int x, int y) if (fence_required) { // As map_is_location_in_park sets the error text // will require to back it up. - rct_string_id previous_error = RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id); + rct_string_id previous_error = gGameCommandErrorText; if (map_is_location_in_park(x - 32, y)){ newOwnership |= 0x8; } @@ -763,7 +763,7 @@ void update_park_fences(int x, int y) newOwnership |= 0x1; } - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = previous_error; + gGameCommandErrorText = previous_error; } } @@ -853,7 +853,7 @@ void game_command_remove_park_entrance(int *eax, int *ebx, int *ecx, int *edx, i void park_set_name(const char *name) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_PARK; + gGameCommandErrorTitle = STR_CANT_RENAME_PARK; game_do_command(1, GAME_COMMAND_FLAG_APPLY, 0, *((int*)(name + 0)), GAME_COMMAND_SET_PARK_NAME, *((int*)(name + 8)), *((int*)(name + 4))); game_do_command(2, GAME_COMMAND_FLAG_APPLY, 0, *((int*)(name + 12)), GAME_COMMAND_SET_PARK_NAME, *((int*)(name + 20)), *((int*)(name + 16))); game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, *((int*)(name + 24)), GAME_COMMAND_SET_PARK_NAME, *((int*)(name + 32)), *((int*)(name + 28))); @@ -895,14 +895,14 @@ void game_command_set_park_name(int *eax, int *ebx, int *ecx, int *edx, int *esi } if (newName[0] == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_INVALID_RIDE_ATTRACTION_NAME; + gGameCommandErrorText = STR_INVALID_RIDE_ATTRACTION_NAME; *ebx = MONEY32_UNDEFINED; return; } newUserStringId = user_string_allocate(4, newName); if (newUserStringId == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_INVALID_NAME_FOR_PARK; + gGameCommandErrorText = STR_INVALID_NAME_FOR_PARK; *ebx = MONEY32_UNDEFINED; return; } @@ -932,7 +932,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) { } if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 || (surfaceElement->properties.surface.ownership & OWNERSHIP_AVAILABLE) == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 1726; // Land not for sale! + gGameCommandErrorText = 1726; // Land not for sale! return MONEY32_UNDEFINED; } if (flags & GAME_COMMAND_FLAG_APPLY) { @@ -960,7 +960,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) { } if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 || (surfaceElement->properties.surface.ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) == 0) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 1727; // Construction rights not for sale! + gGameCommandErrorText = 1727; // Construction rights not for sale! return MONEY32_UNDEFINED; } @@ -997,12 +997,12 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) { } if (x <= 32 || y <= 32) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 3215; + gGameCommandErrorText = 3215; return MONEY32_UNDEFINED; } if (x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) - 32 || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) - 32) { - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 3215; + gGameCommandErrorText = 3215; return MONEY32_UNDEFINED; } @@ -1065,7 +1065,7 @@ int map_buy_land_rights(int x0, int y0, int x1, int y1, int setting, int flags) // Game command modified to accept selection size totalCost = 0; - RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0 || gCheatsBuildInPauseMode) { for (y = y0; y <= y1; y += 32) { for (x = x0; x <= x1; x += 32) {