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/StarPlant.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/StarPlant.cpp')
-rw-r--r-- | source/game/StarPlant.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/game/StarPlant.cpp b/source/game/StarPlant.cpp index 4690722..d0c6efe 100644 --- a/source/game/StarPlant.cpp +++ b/source/game/StarPlant.cpp @@ -718,18 +718,18 @@ float Plant::branchRotation(float xPos, float rotoffset) const { return copysign(0.00117f, m_windLevel) * (std::sin(m_windTime + rotoffset + xPos / 10.0f) * intensity - intensity / 300.0f); } -void Plant::update(uint64_t) { - m_windTime += WorldTimestep; +void Plant::update(float dt, uint64_t) { + m_windTime += dt; m_windTime = std::fmod(m_windTime, 628.32f); m_windLevel = world()->windLevel(Vec2F(m_tilePosition)); if (isMaster()) { if (m_tileDamageStatus.damaged()) - m_tileDamageStatus.recover(m_tileDamageParameters, WorldTimestep); + m_tileDamageStatus.recover(m_tileDamageParameters, dt); } else { if (m_tileDamageStatus.damaged() && !m_tileDamageStatus.damageProtected()) { float damageEffectPercentage = m_tileDamageStatus.damageEffectPercentage(); - m_windTime += damageEffectPercentage * 10 * WorldTimestep; + m_windTime += damageEffectPercentage * 10 * dt; m_windLevel += damageEffectPercentage * 20; } |