mirror of
https://github.com/minetest/minetest.git
synced 2024-12-24 15:12:23 +01:00
Extract updatePauseState from Game::run (#13893)
This commit is contained in:
parent
6026003508
commit
62eb6cfed0
@ -788,6 +788,7 @@ protected:
|
||||
void updateCameraDirection(CameraOrientation *cam, float dtime);
|
||||
void updateCameraOrientation(CameraOrientation *cam, float dtime);
|
||||
void updatePlayerControl(const CameraOrientation &cam);
|
||||
void updatePauseState();
|
||||
void step(f32 dtime);
|
||||
void processClientEvents(CameraOrientation *cam);
|
||||
void updateCamera(f32 dtime);
|
||||
@ -1238,23 +1239,12 @@ void Game::run()
|
||||
cam_view.camera_pitch) * m_cache_cam_smoothing;
|
||||
updatePlayerControl(cam_view);
|
||||
|
||||
{
|
||||
bool was_paused = m_is_paused;
|
||||
m_is_paused = simple_singleplayer_mode && g_menumgr.pausesGame();
|
||||
updatePauseState();
|
||||
if (m_is_paused)
|
||||
dtime = 0.0f;
|
||||
|
||||
if (!was_paused && m_is_paused) {
|
||||
pauseAnimation();
|
||||
sound_manager->pauseAll();
|
||||
} else if (was_paused && !m_is_paused) {
|
||||
resumeAnimation();
|
||||
sound_manager->resumeAll();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_is_paused)
|
||||
else
|
||||
step(dtime);
|
||||
|
||||
processClientEvents(&cam_view_target);
|
||||
updateDebugState();
|
||||
updateCamera(dtime);
|
||||
@ -2696,6 +2686,20 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
|
||||
//tt.stop();
|
||||
}
|
||||
|
||||
void Game::updatePauseState()
|
||||
{
|
||||
bool was_paused = this->m_is_paused;
|
||||
this->m_is_paused = this->simple_singleplayer_mode && g_menumgr.pausesGame();
|
||||
|
||||
if (!was_paused && this->m_is_paused) {
|
||||
this->pauseAnimation();
|
||||
this->sound_manager->pauseAll();
|
||||
} else if (was_paused && !this->m_is_paused) {
|
||||
this->resumeAnimation();
|
||||
this->sound_manager->resumeAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void Game::step(f32 dtime)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user