diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-28 00:20:22 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-28 00:20:22 +1000 |
commit | 152af876550ec63bac9d7aa27b1994268c80f878 (patch) | |
tree | ec1ca9b7f013252505ad719990900a64cc3afc35 /source/game/StarWorldClient.cpp | |
parent | 2496789ea7632556486560f80590d5ba7f8da0f5 (diff) |
Fix broken regex, make game timestep non-const
Diffstat (limited to 'source/game/StarWorldClient.cpp')
-rw-r--r-- | source/game/StarWorldClient.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp index 3e91779..3a3fe39 100644 --- a/source/game/StarWorldClient.cpp +++ b/source/game/StarWorldClient.cpp @@ -32,6 +32,7 @@ WorldClient::WorldClient(PlayerPtr mainPlayer) { m_clientConfig = assets->json("/client.config"); m_currentStep = 0; + m_currentServerStep = 0.0; m_fullBright = false; m_worldDimTimer = GameTimer(m_clientConfig.getFloat("worldDimTime")); m_worldDimTimer.setDone(); @@ -463,10 +464,15 @@ void WorldClient::render(WorldRenderData& renderData, unsigned bufferTiles) { for (size_t y = 0; y < ySize; ++y) { auto& tile = column[y]; - Vec3F light = materialDatabase->radiantLight(tile.foreground, tile.foregroundMod); - light += liquidsDatabase->radiantLight(tile.liquid) * tile.liquid.level; + Vec3F light; + if (tile.foreground != EmptyMaterialId || tile.foregroundMod != NoModId) + light += materialDatabase->radiantLight(tile.foreground, tile.foregroundMod); + + if (tile.liquid.liquid != EmptyLiquidId && tile.liquid.level != 0.0f) + light += liquidsDatabase->radiantLight(tile.liquid); if (tile.foregroundLightTransparent) { - light += materialDatabase->radiantLight(tile.background, tile.backgroundMod); + if (tile.background != EmptyMaterialId || tile.backgroundMod != NoModId) + light += materialDatabase->radiantLight(tile.background, tile.backgroundMod); if (tile.backgroundLightTransparent && pos[1] + y > undergroundLevel) light += environmentLight; } @@ -758,7 +764,8 @@ void WorldClient::handleIncomingPackets(List<PacketPtr> const& packets) { tryGiveMainPlayerItem(itemDatabase->item(giveItem->item)); } else if (auto stepUpdate = as<StepUpdatePacket>(packet)) { - m_interpolationTracker.receiveStepUpdate(stepUpdate->remoteStep); + m_currentServerStep = ((double)stepUpdate->remoteStep * (WorldTimestep / ServerWorldTimestep)); + m_interpolationTracker.receiveStepUpdate(m_currentServerStep); } else if (auto environmentUpdatePacket = as<EnvironmentUpdatePacket>(packet)) { m_sky->readUpdate(environmentUpdatePacket->skyDelta); @@ -893,7 +900,8 @@ void WorldClient::update() { } ++m_currentStep; - m_interpolationTracker.update(m_currentStep); + //m_interpolationTracker.update(m_currentStep); + m_interpolationTracker.update(Time::monotonicTime()); List<WorldAction> triggeredActions; eraseWhere(m_timers, [&triggeredActions](pair<int, WorldAction>& timer) { @@ -1464,6 +1472,7 @@ void WorldClient::clearWorld() { } m_currentStep = 0; + m_currentServerStep = 0.0; m_inWorld = false; m_clientId.reset(); |