Skip to content

Commit

Permalink
fix multi-packet updates
Browse files Browse the repository at this point in the history
entities would flicker between the current and a very old state
  • Loading branch information
wootguy committed Sep 1, 2023
1 parent 4333065 commit 1323556
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/sventv/SvenTV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,7 @@ bool SvenTV::applyDelta(const Packet& packet, bool isBaseline) {
reader.read(&baselineId, 2);
reader.read(&fragmentId, 2);

//println("Apply delta %d frag %d", updateId, fragmentId);

// swap edict lists
if (!isBaseline) {
netedict* temp = lastedicts;
lastedicts = edicts;
edicts = temp;
}
//logf("Apply delta %d frag %d%s\n", updateId, fragmentId, isBaseline ? " (BASELINE)" : "");

int loop = -1;
while (1) {
Expand Down Expand Up @@ -206,6 +199,7 @@ bool SvenTV::applyDelta(const Packet& packet, bool isBaseline) {
if (!isBaseline) {
// calculating current state from baseline and this delta packet
ed = &edicts[fullIndex];
lastedicts[fullIndex] = *ed;
*ed = baselines[fullIndex]; // undo previous deltas, restart from baseline
}

Expand Down

0 comments on commit 1323556

Please sign in to comment.