diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-21 00:58:49 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-21 00:58:49 +1000 |
commit | 4b0bc220e4da1173f742a4973939b139bef562db (patch) | |
tree | 0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/game/StarToolUser.cpp | |
parent | 607be749451aa40e3619e7ceab0927d1fcec8233 (diff) |
Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
Diffstat (limited to 'source/game/StarToolUser.cpp')
-rw-r--r-- | source/game/StarToolUser.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source/game/StarToolUser.cpp b/source/game/StarToolUser.cpp index 6c0cdf2..e0e32a8 100644 --- a/source/game/StarToolUser.cpp +++ b/source/game/StarToolUser.cpp @@ -38,10 +38,11 @@ ToolUser::ToolUser() addNetElement(&m_primaryItemActiveNetState); addNetElement(&m_altItemActiveNetState); - m_primaryFireTimerNetState.setFixedPointBase(WorldTimestep); - m_altFireTimerNetState.setFixedPointBase(WorldTimestep); - m_primaryTimeFiringNetState.setFixedPointBase(WorldTimestep); - m_altTimeFiringNetState.setFixedPointBase(WorldTimestep); + float fixedPointBase = 1.f / 60.f; + m_primaryFireTimerNetState.setFixedPointBase(fixedPointBase); + m_altFireTimerNetState.setFixedPointBase(fixedPointBase); + m_primaryTimeFiringNetState.setFixedPointBase(fixedPointBase); + m_altTimeFiringNetState.setFixedPointBase(fixedPointBase); auto interpolateTimer = [](double offset, double min, double max) -> double { if (max > min) @@ -369,7 +370,7 @@ bool ToolUser::queryShieldHit(DamageSource const& source) const { return false; } -void ToolUser::tick(bool shifting, HashSet<MoveControlType> const& moves) { +void ToolUser::tick(float dt, bool shifting, HashSet<MoveControlType> const& moves) { if (auto toolUserItem = as<ToolUserItem>(m_primaryHandItem.get())) { FireMode fireMode = FireMode::None; if (!m_suppress.get()) { @@ -378,7 +379,7 @@ void ToolUser::tick(bool shifting, HashSet<MoveControlType> const& moves) { else if (m_fireAlt && m_primaryHandItem.get()->twoHanded()) fireMode = FireMode::Alt; } - toolUserItem->update(fireMode, shifting, moves); + toolUserItem->update(dt, fireMode, shifting, moves); } if (!m_primaryHandItem.get() || !m_primaryHandItem.get()->twoHanded()) { @@ -386,7 +387,7 @@ void ToolUser::tick(bool shifting, HashSet<MoveControlType> const& moves) { FireMode fireMode = FireMode::None; if (!m_suppress.get() && m_fireAlt) fireMode = FireMode::Primary; - toolUserItem->update(fireMode, shifting, moves); + toolUserItem->update(dt, fireMode, shifting, moves); } } |