diff --git a/src/gfx.cpp b/src/gfx.cpp index 8409e7a86a..c62453c3c8 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1238,6 +1238,11 @@ void DoPaletteAnimations() } } +void GameLoopPaletteAnimations() +{ + if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations(); +} + /** * Determine a contrasty text colour for a coloured background. * @param background Background colour. diff --git a/src/gfx_func.h b/src/gfx_func.h index 714c105094..70c0ea4569 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -44,6 +44,7 @@ #include "string_type.h" void GameLoop(); +void GameLoopPaletteAnimations(); void CreateConsole(); diff --git a/src/openttd.cpp b/src/openttd.cpp index 574901a57e..e8f2f6baf5 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -88,7 +88,6 @@ void CallLandscapeTick(); void IncreaseDate(); -void DoPaletteAnimations(); void MusicLoop(); void ResetMusic(); void CallWindowGameTickEvent(); @@ -1911,8 +1910,6 @@ void GameLoop() StateGameLoop(); } - if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations(); - InputLoop(); SoundDriver::GetInstance()->MainLoop(); diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 05926564b6..a12061f1e8 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -513,6 +513,7 @@ void VideoDriver_Allegro::MainLoop() if (old_shift_pressed != _shift_pressed) HandleShiftChanged(); GameLoop(); + GameLoopPaletteAnimations(); UpdateWindows(); CheckPaletteAnim(); diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm index 001f44ad8b..2d6b0d8c81 100644 --- a/src/video/cocoa/event.mm +++ b/src/video/cocoa/event.mm @@ -654,7 +654,10 @@ void QZ_GameLoop() _cocoa_subdriver->Draw(true); CSleep(1); - for (int i = 0; i < 2; i++) GameLoop(); + for (int i = 0; i < 2; i++) { + GameLoop(); + GameLoopPaletteAnimations(); + } UpdateWindows(); QZ_CheckPaletteAnim(); @@ -702,6 +705,7 @@ void QZ_GameLoop() if (old_shift_pressed != _shift_pressed) HandleShiftChanged(); GameLoop(); + GameLoopPaletteAnimations(); UpdateWindows(); QZ_CheckPaletteAnim(); diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index ac7d38bb7f..7d97b8c113 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -299,6 +299,7 @@ void VideoDriver_Dedicated::MainLoop() next_tick = cur_ticks + MILLISECONDS_PER_TICK; GameLoop(); + GameLoopPaletteAnimations(); UpdateWindows(); } diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index 25aa2e6cb9..9d62a135dd 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -48,11 +48,13 @@ void VideoDriver_Null::MainLoop() if (this->until_exit) { while (!_exit_game) { GameLoop(); + GameLoopPaletteAnimations(); UpdateWindows(); } } else { for (int i = 0; i < this->ticks; i++) { GameLoop(); + GameLoopPaletteAnimations(); UpdateWindows(); } } diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index 44df458465..13f41501ba 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -1087,6 +1087,8 @@ void VideoDriver_SDL::MainLoop() if (_draw_mutex != nullptr) draw_lock.lock(); + GameLoopPaletteAnimations(); + UpdateWindows(); _local_palette = _cur_palette; } else { diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 9f3d975570..9735235a46 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -755,6 +755,8 @@ void VideoDriver_SDL::MainLoop() if (_draw_mutex != nullptr) draw_lock.lock(); + GameLoopPaletteAnimations(); + UpdateWindows(); _local_palette = _cur_palette; } else { diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 26a665bdb8..fbbf7fbfc8 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -1268,6 +1268,7 @@ void VideoDriver_Win32::MainLoop() if (_draw_threaded) draw_lock.unlock(); GameLoop(); if (_draw_threaded) draw_lock.lock(); + GameLoopPaletteAnimations(); if (_force_full_redraw) MarkWholeScreenDirty();