Skip to content

Commit e740599

Browse files
committed
game_session: Run pausing logic near end of update function
Fixes a weird camera shift and tux getting jolted around after unpause Signed-off-by: Swagtoy <me@ow.swag.toys>
1 parent 6f41c8e commit e740599

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/supertux/game_session.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ GameSession::on_escape_press(bool force_quick_respawn)
367367
int textscrollers = m_currentsector->get_object_count<TextScroller>([](const TextScroller& ts) {
368368
return !ts.is_fading();
369369
});
370-
370+
371371
if (textscrollers) {
372372
return;
373373
}
@@ -610,16 +610,6 @@ GameSession::update(float dt_sec, const Controller& controller)
610610
// design choice, if you prefer it not to animate when paused, add `if (!m_game_pause)`).
611611
m_level->m_stats.update_timers(dt_sec);
612612

613-
// Unpause the game if the menu has been closed.
614-
if (m_game_pause && !MenuManager::instance().is_active()) {
615-
ScreenManager::current()->set_speed(m_speed_before_pause);
616-
SoundManager::current()->resume_music();
617-
SoundManager::current()->resume_sounds();
618-
assert(m_currentsector != nullptr);
619-
m_currentsector->play_looping_sounds();
620-
m_game_pause = false;
621-
}
622-
623613
check_end_conditions();
624614

625615
const auto& players = m_currentsector->get_players();
@@ -758,6 +748,17 @@ GameSession::update(float dt_sec, const Controller& controller)
758748
} else if (music_object.get_music_type() != LEVEL_MUSIC) {
759749
music_object.play_music(LEVEL_MUSIC);
760750
}
751+
752+
// Unpause the game if the menu has been closed.
753+
if (m_game_pause && !MenuManager::instance().is_active()) {
754+
ScreenManager::current()->set_speed(m_speed_before_pause);
755+
SoundManager::current()->resume_music();
756+
SoundManager::current()->resume_sounds();
757+
assert(m_currentsector != nullptr);
758+
m_currentsector->play_looping_sounds();
759+
m_game_pause = false;
760+
}
761+
761762
if (reset_button) {
762763
reset_button = false;
763764
reset_level();

0 commit comments

Comments
 (0)