• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revisión91b0645a4f75c78f6a7eb30d8e6b5ec3a14e751a (tree)
Tiempo2022-06-20 05:49:26
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Unlagged now restores a player's old height when reconciling them.

Cambiar Resumen

Diferencia incremental

diff -r 670e97c7ceea -r 91b0645a4f75 src/d_player.h
--- a/src/d_player.h Sun Jun 19 16:32:59 2022 -0400
+++ b/src/d_player.h Sun Jun 19 16:49:26 2022 -0400
@@ -728,6 +728,10 @@
728728 TVector3<fixed_t> unlaggedPos[UNLAGGEDTICS];
729729 TVector3<fixed_t> restorePos;
730730
731+ // [AK] We should also store the player's old height for unlagged.
732+ fixed_t unlaggedHeight[UNLAGGEDTICS];
733+ fixed_t restoreHeight;
734+
731735 fixed_t restoreFloorZ;
732736 fixed_t restoreCeilingZ;
733737
diff -r 670e97c7ceea -r 91b0645a4f75 src/unlagged.cpp
--- a/src/unlagged.cpp Sun Jun 19 16:32:59 2022 -0400
+++ b/src/unlagged.cpp Sun Jun 19 16:49:26 2022 -0400
@@ -191,6 +191,10 @@
191191 if (players+i != actor->player)
192192 {
193193 players[i].mo->SetOrigin( players[i].unlaggedPos[unlaggedIndex][0], players[i].unlaggedPos[unlaggedIndex][1], players[i].unlaggedPos[unlaggedIndex][2] );
194+
195+ // [AK] We only need to restore the heights of the other players except the shooter.
196+ players[i].restoreHeight = players[i].mo->height;
197+ players[i].mo->height = players[i].unlaggedHeight[unlaggedIndex];
194198 }
195199 else
196200 //However, the client sometimes mispredicts itself if it's on a moving sector.
@@ -272,9 +276,13 @@
272276 {
273277 if (playeringame[i] && players[i].mo && !players[i].bSpectating)
274278 {
275- // Do not restore this player's position if the shot resulted in his direct teleportation.
276279 if ( players + i != actor->player )
277280 {
281+ // [AK] Always restore their height unless it changed during reconciliation (e.g. the player died).
282+ if ( players[i].mo->height == players[i].unlaggedHeight[unlaggedIndex] )
283+ players[i].mo->height = players[i].restoreHeight;
284+
285+ // Do not restore this player's position if the shot resulted in his direct teleportation.
278286 if ( players[i].mo->x != players[i].unlaggedPos[unlaggedIndex][0] ||
279287 players[i].mo->y != players[i].unlaggedPos[unlaggedIndex][1] ||
280288 players[i].mo->z != players[i].unlaggedPos[unlaggedIndex][2] )
@@ -316,6 +324,7 @@
316324 player->unlaggedPos[unlaggedIndex][0] = player->mo->x;
317325 player->unlaggedPos[unlaggedIndex][1] = player->mo->y;
318326 player->unlaggedPos[unlaggedIndex][2] = player->mo->z;
327+ player->unlaggedHeight[unlaggedIndex] = player->mo->height;
319328 }
320329
321330
@@ -336,6 +345,7 @@
336345 player->unlaggedPos[unlaggedIndex][0] = player->mo->x;
337346 player->unlaggedPos[unlaggedIndex][1] = player->mo->y;
338347 player->unlaggedPos[unlaggedIndex][2] = player->mo->z;
348+ player->unlaggedHeight[unlaggedIndex] = player->mo->height;
339349 }
340350 }
341351
Show on old repository browser