Improve rubber banding effects of rewinders when going back to phone

This commit is contained in:
Benau 2019-11-23 12:52:38 +08:00
parent 84a7c282ee
commit 20ea7fe2ff
2 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#include "input/input_manager.hpp"
#include "modes/demo_world.hpp"
#include "modes/world.hpp"
#include "network/rewind_manager.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/debug.hpp"
#include "utils/profiler.hpp"
@ -188,6 +189,10 @@ bool EventHandler::OnEvent (const SEvent &event)
{
music_manager->resumeMusic();
SFXManager::get()->resumeAll();
// Improve rubber banding effects of rewinders when going
// back to phone, because the smooth timer is paused
if (World::getWorld() && RewindManager::isEnabled())
RewindManager::get()->resetSmoothNetworkBody();
}
}
else if (cmd == APP_CMD_LOW_MEMORY)

View File

@ -136,6 +136,10 @@ float MainLoop::getLimitedDt()
{
music_manager->resumeMusic();
SFXManager::get()->resumeAll();
// Improve rubber banding effects of rewinders when going
// back to phone, because the smooth timer is paused
if (World::getWorld() && RewindManager::isEnabled())
RewindManager::get()->resetSmoothNetworkBody();
}
}
}