mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 05:23:04 +01:00
Merge pull request #8339 from ZehMatt/realtime-ticks
Use real time ticks for UI effects.
This commit is contained in:
@@ -91,6 +91,12 @@ void GameState::Update()
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t realtimeTicksElapsed = gCurrentDeltaTime / GAME_UPDATE_TIME_MS;
|
||||
realtimeTicksElapsed = std::clamp<uint32_t>(realtimeTicksElapsed, 1, GAME_MAX_UPDATES);
|
||||
|
||||
// We use this variable to always advance ticks in normal speed.
|
||||
gCurrentRealTimeTicks += realtimeTicksElapsed;
|
||||
|
||||
// Determine how many times we need to update the game
|
||||
if (gGameSpeed > 1)
|
||||
{
|
||||
@@ -98,8 +104,7 @@ void GameState::Update()
|
||||
}
|
||||
else
|
||||
{
|
||||
numUpdates = gTicksSinceLastUpdate / GAME_UPDATE_TIME_MS;
|
||||
numUpdates = std::clamp<uint32_t>(numUpdates, 1, GAME_MAX_UPDATES);
|
||||
numUpdates = realtimeTicksElapsed;
|
||||
}
|
||||
|
||||
if (network_get_mode() == NETWORK_MODE_CLIENT && network_get_status() == NETWORK_STATUS_CONNECTED
|
||||
@@ -163,7 +168,7 @@ void GameState::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 (gCurrentTicks % 4 == 0)
|
||||
if (gCurrentRealTimeTicks % 4 == 0)
|
||||
gWindowMapFlashingFlags ^= (1 << 15);
|
||||
|
||||
// Handle guest map flashing
|
||||
|
||||
Reference in New Issue
Block a user