Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarToolUser.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
commit4b0bc220e4da1173f742a4973939b139bef562db (patch)
tree0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/game/StarToolUser.cpp
parent607be749451aa40e3619e7ceab0927d1fcec8233 (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.cpp15
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);
}
}