]> git.localhorst.tv Git - blank.git/blobdiff - src/client/net.cpp
use "forces" for entity control and RK4 integrator
[blank.git] / src / client / net.cpp
index 5c06bbe6a0c115f8952fd19c3315a3b7da8cfb59..73931f44c1825ba166a743cafd53c8e9747e4d7c 100644 (file)
@@ -332,10 +332,11 @@ void NetworkedInput::PushPlayerUpdate(int dt) {
                InventorySlot()
        );
        if (player_hist.size() < 16) {
-               player_hist.emplace_back(state, dt, packet);
+               player_hist.emplace_back(state, GetPlayer().GetEntity().TargetVelocity(), dt, packet);
        } else {
                auto entry = player_hist.begin();
                entry->state = state;
+               entry->tgt_vel = GetPlayer().GetEntity().TargetVelocity();
                entry->delta_t = dt;
                entry->packet = packet;
                player_hist.splice(player_hist.end(), player_hist, entry);
@@ -378,6 +379,7 @@ void NetworkedInput::MergePlayerCorrection(uint16_t seq, const EntityState &corr
        vector<WorldCollision> col;
        while (entry != end) {
                replay.Velocity(entry->state.velocity);
+               replay.TargetVelocity(entry->tgt_vel);
                replay.Update(entry->delta_t);
                if (GetWorld().Intersection(replay, col)) {
                        GetWorld().Resolve(replay, col);