diff --git a/src/game.c b/src/game.c index 11cffbbe4a..d3624d3311 100644 --- a/src/game.c +++ b/src/game.c @@ -265,7 +265,7 @@ void game_update() } if (network_get_mode() == NETWORK_MODE_CLIENT && network_get_status() == NETWORK_STATUS_CONNECTED && network_get_authstatus() == NETWORK_AUTH_OK) { - if (network_get_server_tick() - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >= 10) { + if (network_get_server_tick() - gCurrentTicks >= 10) { // make sure client doesn't fall behind the server too much numUpdates += 10; } @@ -318,7 +318,7 @@ void game_update() // the flickering frequency is reduced by 4, compared to the original // it was done due to inability to reproduce original frequency // and decision that the original one looks too fast - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 4 == 0) + if (gCurrentTicks % 4 == 0) RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_MAP_FLASHING_FLAGS, uint16) ^= (1 << 15); // Handle guest map flashing @@ -347,12 +347,12 @@ void game_logic_update() /////////////////////////// network_update(); if (network_get_mode() == NETWORK_MODE_CLIENT && network_get_status() == NETWORK_STATUS_CONNECTED && network_get_authstatus() == NETWORK_AUTH_OK) { - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >= network_get_server_tick()) { + if (gCurrentTicks >= network_get_server_tick()) { // dont run past the server return; } } - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32)++; + gCurrentTicks++; RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32)++; RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, sint16)++; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, sint16) == 0) diff --git a/src/game.h b/src/game.h index c9f31f4658..9d7188c294 100644 --- a/src/game.h +++ b/src/game.h @@ -122,6 +122,8 @@ extern rct_string_id gGameCommandErrorText; extern GAME_COMMAND_POINTER* new_game_command_table[66]; +#define gCurrentTicks RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) + extern int gGameSpeed; extern float gDayNightCycle; extern bool gInUpdateCode; diff --git a/src/interface/viewport.c b/src/interface/viewport.c index e300d9487d..e793f63fac 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -22,6 +22,7 @@ #include "../config.h" #include "../drawing/drawing.h" #include "../drawing/supports.h" +#include "../game.h" #include "../input.h" #include "../localisation/localisation.h" #include "../ride/ride_data.h" @@ -1416,7 +1417,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0; uint16 string_width = gfx_get_string_width(entrance_string); - uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; + uint16 scroll = (gCurrentTicks / 2) % string_width; sub_98199C(scrolling_text_setup(string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 2, 2, height + style->height, get_current_rotation()); } @@ -1503,7 +1504,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0; uint16 string_width = gfx_get_string_width(park_name); - uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; + uint16 scroll = (gCurrentTicks / 2) % string_width; if (entrance->scrolling_mode == 0xFF) break; @@ -1763,7 +1764,7 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0; uint16 string_width = gfx_get_string_width(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char)); - uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width; + uint16 scroll = (gCurrentTicks / 2) % string_width; sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, get_current_rotation()); } diff --git a/src/localisation/date.c b/src/localisation/date.c index 50a754bce2..6e2cd7cc73 100644 --- a/src/localisation/date.c +++ b/src/localisation/date.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "../addresses.h" +#include "../game.h" #include "date.h" #include "string_ids.h" @@ -62,5 +63,5 @@ void date_reset() { RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) = MONTH_MARCH; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, sint16) = 0; - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) = 0; + gCurrentTicks = 0; } diff --git a/src/network/network.cpp b/src/network/network.cpp index 800fb84c6a..d2cd44823b 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -913,7 +913,7 @@ void Network::UpdateClient() ProcessGameCommandQueue(); // Check synchronisation - if (!_desynchronised && !CheckSRAND(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32), RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32))) { + if (!_desynchronised && !CheckSRAND(gCurrentTicks, RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32))) { _desynchronised = true; char str_desync[256]; format_string(str_desync, STR_MULTIPLAYER_DESYNC, NULL); @@ -1387,14 +1387,14 @@ void Network::Server_Send_CHAT(const char* text) void Network::Client_Send_GAMECMD(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 callback) { std::unique_ptr packet = std::move(NetworkPacket::Allocate()); - *packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << callback; + *packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)gCurrentTicks << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << callback; server_connection.QueuePacket(std::move(packet)); } void Network::Server_Send_GAMECMD(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 playerid, uint8 callback) { std::unique_ptr packet = std::move(NetworkPacket::Allocate()); - *packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << playerid << callback; + *packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)gCurrentTicks << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << playerid << callback; SendPacketToClients(*packet); } @@ -1402,7 +1402,7 @@ void Network::Server_Send_TICK() { last_tick_sent_time = SDL_GetTicks(); std::unique_ptr packet = std::move(NetworkPacket::Allocate()); - *packet << (uint32)NETWORK_COMMAND_TICK << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32); + *packet << (uint32)NETWORK_COMMAND_TICK << (uint32)gCurrentTicks << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32); SendPacketToClients(*packet); } @@ -1575,7 +1575,7 @@ void Network::ProcessPacket(NetworkConnection& connection, NetworkPacket& packet void Network::ProcessGameCommandQueue() { - while (game_command_queue.begin() != game_command_queue.end() && game_command_queue.begin()->tick == RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32)) { + while (game_command_queue.begin() != game_command_queue.end() && game_command_queue.begin()->tick == gCurrentTicks) { // run all the game commands at the current tick const GameCommand& gc = (*game_command_queue.begin()); if (GetPlayerID() == gc.playerid) { @@ -1777,7 +1777,7 @@ void Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pa if (game_load_network(rw)) { game_load_init(); game_command_queue.clear(); - server_tick = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32); + server_tick = gCurrentTicks; server_srand0_tick = 0; // window_network_status_open("Loaded new map from network"); _desynchronised = false; @@ -2451,7 +2451,7 @@ void network_set_password(const char* password) int network_get_mode() { return NETWORK_MODE_NONE; } int network_get_status() { return NETWORK_STATUS_NONE; } int network_get_authstatus() { return NETWORK_AUTH_NONE; } -uint32 network_get_server_tick() { return RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32); } +uint32 network_get_server_tick() { return gCurrentTicks; } void network_send_gamecmd(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 callback) {} void network_send_map() {} void network_update() {} diff --git a/src/peep/peep.c b/src/peep/peep.c index 73e528a171..c21e26e5d5 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -177,7 +177,7 @@ void peep_update_all() peep = &(g_sprite_list[spriteIndex].peep); spriteIndex = peep->next; - if ((i & 0x7F) != (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) { + if ((i & 0x7F) != (gCurrentTicks & 0x7F)) { peep_update(peep); } else { sub_68F41A(peep, i); @@ -399,7 +399,7 @@ static void sub_68F41A(rct_peep *peep, int index) return; } - if ((index & 0x1FF) == (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x1FF)){ + if ((index & 0x1FF) == (gCurrentTicks & 0x1FF)){ //RCT2_GLOBAL(0x00F1EDFE, uint32) = index; not needed all cases accounted for if (peep->peep_flags & PEEP_FLAGS_CROWDED){ @@ -504,7 +504,7 @@ static void sub_68F41A(rct_peep *peep, int index) peep_pick_ride_to_go_on(peep); } - if ((index & 0x3FF) == (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x3FF)){ + if ((index & 0x3FF) == (gCurrentTicks & 0x3FF)){ if (peep->outside_of_park == 0 && (peep->state == PEEP_STATE_WALKING || peep->state == PEEP_STATE_SITTING)){ @@ -4342,7 +4342,7 @@ static void peep_update_1(rct_peep* peep){ * rct2: 0x690009 */ static void peep_update_picked(rct_peep* peep){ - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x1F) return; + if (gCurrentTicks & 0x1F) return; peep->sub_state++; if (peep->sub_state == 13){ peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_HELP, 0xFF); @@ -5452,7 +5452,7 @@ static void peep_update_walking(rct_peep* peep){ } else if (peep_has_empty_container(peep)){ if ((!(peep->next_var_29 & 0x18)) && - ((peep->sprite_index & 0x1FF) == (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x1FF))&& + ((peep->sprite_index & 0x1FF) == (gCurrentTicks & 0x1FF))&& ((0xFFFF & scenario_rand()) <= 4096)){ uint8 pos_stnd = 0; diff --git a/src/peep/staff.c b/src/peep/staff.c index b943148848..31493a4ee8 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -739,7 +739,7 @@ static int staff_path_finding_handyman(rct_peep* peep) uint8 validDirections = staff_get_valid_patrol_directions(peep, peep->next_x, peep->next_y); if ((peep->staff_orders & STAFF_ORDERS_SWEEPING) && - ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) + peep->sprite_index) & 0xFFF) > 110) { + ((gCurrentTicks + peep->sprite_index) & 0xFFF) > 110) { litterDirection = staff_handyman_direction_to_nearest_litter(peep); } diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp index 1a857f28d1..1f5b8754a5 100644 --- a/src/rct1/S4Importer.cpp +++ b/src/rct1/S4Importer.cpp @@ -925,7 +925,7 @@ void S4Importer::ImportParkName() void S4Importer::ImportParkFlags() { // Date and srand - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) = _s4.ticks; + gCurrentTicks = _s4.ticks; RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32) = _s4.random_a; RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_1, uint32) = _s4.random_b; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) = _s4.month; diff --git a/src/ride/ride.c b/src/ride/ride.c index 55664ee8c9..c17fc52f9c 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -1943,7 +1943,7 @@ static void ride_update(int rideIndex) // Various things include news messages if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_DUE_INSPECTION)) - if (((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >> 1) & 255) == rideIndex) + if (((gCurrentTicks >> 1) & 255) == rideIndex) ride_breakdown_status_update(rideIndex); ride_inspection_update(ride); @@ -2039,7 +2039,7 @@ static void ride_spiral_slide_update(rct_ride *ride) rct_map_element *mapElement; rct_peep *peep; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) + if (gCurrentTicks & 3) return; if (ride->slide_in_use == 0) return; @@ -2095,7 +2095,7 @@ static void ride_inspection_update(rct_ride *ride) { int i; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 2047) + if (gCurrentTicks & 2047) return; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) return; @@ -2160,7 +2160,7 @@ static void ride_breakdown_update(int rideIndex) int breakdownReason, unreliabilityAccumulator; rct_ride *ride = get_ride(rideIndex); - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 255) + if (gCurrentTicks & 255) return; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) return; @@ -2168,7 +2168,7 @@ static void ride_breakdown_update(int rideIndex) if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) ride->downtime_history[0]++; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8191)) { + if (!(gCurrentTicks & 8191)) { int totalDowntime = ride->downtime_history[0] + ride->downtime_history[1] + @@ -2677,7 +2677,7 @@ static void ride_music_update(int rideIndex) // Oscillate parameters for a power cut effect when breaking down if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)) { if (ride->breakdown_reason_pending == BREAKDOWN_CONTROL_FAILURE) { - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 7)) + if (!(gCurrentTicks & 7)) if (ride->breakdown_sound_modifier != 255) ride->breakdown_sound_modifier++; } else { diff --git a/src/ride/station.c b/src/ride/station.c index 2b584b214a..b23aff115c 100644 --- a/src/ride/station.c +++ b/src/ride/station.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "../addresses.h" +#include "../game.h" #include "../scenario.h" #include "../world/sprite.h" #include "station.h" @@ -146,7 +147,7 @@ static void ride_update_station_normal(rct_ride *ride, int stationIndex) (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) || (ride->status == RIDE_STATUS_CLOSED && ride->num_riders == 0) ) { - if (time != 0 && time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 7)) + if (time != 0 && time != 127 && !(gCurrentTicks & 7)) time--; ride->station_depart[stationIndex] = time; @@ -156,7 +157,7 @@ static void ride_update_station_normal(rct_ride *ride, int stationIndex) ride->station_depart[stationIndex] |= STATION_DEPART_FLAG; ride_invalidate_station_start(ride, stationIndex, 1); } else { - if (time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 31)) + if (time != 127 && !(gCurrentTicks & 31)) time--; ride->station_depart[stationIndex] = time; diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index cdb733e76d..0b2ad10ac1 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -541,7 +541,7 @@ void vehicle_sounds_update() vehicle_sound->sound1_pan = vehicle_sound_params->pan_x; Mixer_Channel_Pan(vehicle_sound->sound1_channel, DStoMixerPan(vehicle_sound_params->pan_x)); } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) && vehicle_sound_params->frequency != vehicle_sound->sound1_freq) { + if (!(gCurrentTicks & 3) && vehicle_sound_params->frequency != vehicle_sound->sound1_freq) { vehicle_sound->sound1_freq = vehicle_sound_params->frequency; uint16 frequency = vehicle_sound_params->frequency; if (_soundParams[sprite->vehicle.sound1_id][1] & 2) { @@ -596,7 +596,7 @@ void vehicle_sounds_update() vehicle_sound->sound2_pan = vehicle_sound_params->pan_x; Mixer_Channel_Pan(vehicle_sound->sound2_channel, DStoMixerPan(vehicle_sound_params->pan_x)); } - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) && vehicle_sound_params->frequency != vehicle_sound->sound2_freq) { + if (!(gCurrentTicks & 3) && vehicle_sound_params->frequency != vehicle_sound->sound2_freq) { vehicle_sound->sound2_freq = vehicle_sound_params->frequency; if (!(_soundParams[sprite->vehicle.sound2_id][1] & 1)) { uint16 frequency = (vehicle_sound_params->frequency * 2) - 3248; @@ -3847,7 +3847,7 @@ static void vehicle_update_haunted_house_operating(rct_vehicle* vehicle) { return; if (vehicle->vehicle_sprite_type != 0) { - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 1) { + if (gCurrentTicks & 1) { vehicle->vehicle_sprite_type++; vehicle_invalidate(vehicle); @@ -4320,7 +4320,7 @@ static void vehicle_update_sound(rct_vehicle *vehicle) switch (vehicleEntry->sound_range) { case 3: screamId = vehicle->scream_sound_id; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) { + if (!(gCurrentTicks & 0x7F)) { if (vehicle->velocity < 0x40000 || vehicle->scream_sound_id != 255) goto loc_6D7A97; @@ -4336,7 +4336,7 @@ static void vehicle_update_sound(rct_vehicle *vehicle) case 4: screamId = vehicle->scream_sound_id; - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) { + if (!(gCurrentTicks & 0x7F)) { if (vehicle->velocity < 0x40000 || vehicle->scream_sound_id != 255) goto loc_6D7A97; @@ -5073,7 +5073,7 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) { vehicle->acceleration = 0; if (!(ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)) || ride->breakdown_reason_pending != BREAKDOWN_SAFETY_CUT_OUT) { - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 1 && + if (gCurrentTicks & 1 && vehicle->var_34 != 0) { if (vehicle->var_34 > 0) { @@ -6911,7 +6911,7 @@ loc_6DAEB9: if (regs.eax < RCT2_GLOBAL(0x00F64E08, sint32)) { vehicle->acceleration = -RCT2_GLOBAL(0x00F64E08, sint32) * 16; } - else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x0F)) { + else if (!(gCurrentTicks & 0x0F)) { if (RCT2_GLOBAL(0x00F64E2C, uint8) == 0) { RCT2_GLOBAL(0x00F64E2C, uint8)++; audio_play_sound_at_location(SOUND_51, vehicle->x, vehicle->y, vehicle->z); diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index 1c7d00044e..59918da071 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -20,6 +20,7 @@ #include "../addresses.h" #include "../config.h" +#include "../game.h" #include "../input.h" #include "../interface/themes.h" #include "../interface/widget.h" @@ -422,7 +423,7 @@ static void window_game_bottom_toolbar_draw_park_rating(rct_drawpixelinfo *dpi, bar_width = (factor * (90 + WIDTH_MOD)) / 256; gfx_fill_rect_inset(dpi, x, y + 1, x + (93 + WIDTH_MOD), y + 9, w->colours[1], 48); - if (!(colour & 0x80000000) || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 || (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8)) { + if (!(colour & 0x80000000) || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 || (gCurrentTicks & 8)) { if (bar_width > 2) gfx_fill_rect_inset(dpi, x + 2, y + 2, x + bar_width - 1, y + 8, colour & 0x7FFFFFFF, 0); } diff --git a/src/windows/guest.c b/src/windows/guest.c index 6bfbcc5eab..606caca1dc 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -1404,7 +1404,7 @@ void window_guest_stats_bars_paint(int value, int x, int y, rct_window *w, rct_d colour &= ~(1 << 0x1F); if (!blink_flag || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 || - (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8) == 0) + (gCurrentTicks & 8) == 0) { if (value <= 2) return; diff --git a/src/windows/ride.c b/src/windows/ride.c index 6a64669892..8d5fbdb1b2 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -3360,7 +3360,7 @@ static void window_ride_maintenance_draw_bar(rct_window *w, rct_drawpixelinfo *d gfx_fill_rect_inset(dpi, x, y, x + 149, y + 8, w->colours[1], 0x30); if (unk & (1u << 31)) { unk &= ~(1u << 31); - if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0 && (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8)) + if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0 && (gCurrentTicks & 8)) return; } diff --git a/src/world/climate.c b/src/world/climate.c index fd62f11735..2cd0ed2baa 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -150,7 +150,7 @@ void climate_update() RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16)--; - } else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) { + } else if (!(gCurrentTicks & 0x7F)) { if (temperature == target_temperature) { if (cur_gloom == next_gloom) { diff --git a/src/world/duck.c b/src/world/duck.c index 6218339b59..8bfc2d9acd 100644 --- a/src/world/duck.c +++ b/src/world/duck.c @@ -1,5 +1,6 @@ #include "../addresses.h" #include "../audio/audio.h" +#include "../game.h" #include "../localisation/date.h" #include "../scenario.h" #include "sprite.h" @@ -113,7 +114,7 @@ static void duck_invalidate(rct_duck *duck) */ static void duck_update_fly_to_water(rct_duck *duck) { - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) + if (gCurrentTicks & 3) return; duck->var_26++; @@ -167,7 +168,7 @@ static void duck_update_fly_to_water(rct_duck *duck) */ static void duck_update_swim(rct_duck *duck) { - if ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) + duck->sprite_index) & 3) + if ((gCurrentTicks + duck->sprite_index) & 3) return; uint32 randomNumber = scenario_rand(); @@ -261,7 +262,7 @@ static void duck_update_double_drink(rct_duck *duck) */ static void duck_update_fly_away(rct_duck *duck) { - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) + if (gCurrentTicks & 3) return; duck->var_26++; diff --git a/src/world/fountain.c b/src/world/fountain.c index f7ea3e78d8..6317acf8a5 100644 --- a/src/world/fountain.c +++ b/src/world/fountain.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "../addresses.h" +#include "../game.h" #include "../scenario.h" #include "fountain.h" #include "map.h" @@ -106,7 +107,7 @@ void jumping_fountain_begin(int type, int x, int y, rct_map_element *mapElement) int z = mapElement->base_height * 8; // Change pattern approximately every 51 seconds - int pattern = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >> 11) & 7; + int pattern = (gCurrentTicks >> 11) & 7; switch (pattern) { case PATTERN_CYCLIC_SQUARES: // 0, 1, 2, 3 diff --git a/src/world/map_animation.c b/src/world/map_animation.c index f930c0cd26..486a100ec7 100644 --- a/src/world/map_animation.c +++ b/src/world/map_animation.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "../addresses.h" +#include "../game.h" #include "../ride/ride.h" #include "../ride/ride_data.h" #include "../ride/track.h" @@ -194,7 +195,7 @@ static bool map_animation_invalidate_small_scenery(int x, int y, int baseZ) if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_IS_CLOCK) { // Peep, looking at scenery - if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x3FF) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0) { + if (!(gCurrentTicks & 0x3FF) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0) { int direction = mapElement->type & 3; int x2 = x - TileDirectionDelta[direction].x; int y2 = y - TileDirectionDelta[direction].y; @@ -458,7 +459,7 @@ static bool map_animation_invalidate_wall_door(int x, int y, int baseZ) rct_map_element *mapElement; rct_scenery_entry *sceneryEntry; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 1) + if (gCurrentTicks & 1) return false; bool wasInvalidated = false; diff --git a/src/world/park.c b/src/world/park.c index 4c20705a95..131925c50a 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -539,7 +539,7 @@ void park_update() return; // Every 5 seconds approximately - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 512 == 0) { + if (gCurrentTicks % 512 == 0) { gParkRating = calculate_park_rating(); gParkValue = calculate_park_value(); gCompanyValue = calculate_company_value();