• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revisión670e97c7ceeadfe7ca1325532f24279fd59fab2f (tree)
Tiempo2022-06-20 05:32:59
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Converted the player_t members: unlaggedX, unlaggedY, unlaggedZ, and restoreX, restoreY, restoreZ into TVector3<fixed_t> objects.

Cambiar Resumen

Diferencia incremental

diff -r ca8f78ef0a0a -r 670e97c7ceea src/d_player.h
--- a/src/d_player.h Tue Jun 07 15:23:50 2022 -0400
+++ b/src/d_player.h Sun Jun 19 16:32:59 2022 -0400
@@ -724,13 +724,9 @@
724724 bool bUnarmed;
725725
726726 // [Spleen] Store old information about the player for unlagged support
727- fixed_t unlaggedX[UNLAGGEDTICS];
728- fixed_t unlaggedY[UNLAGGEDTICS];
729- fixed_t unlaggedZ[UNLAGGEDTICS];
730-
731- fixed_t restoreX;
732- fixed_t restoreY;
733- fixed_t restoreZ;
727+ // [AK] Converted the position members into TVector3 objects.
728+ TVector3<fixed_t> unlaggedPos[UNLAGGEDTICS];
729+ TVector3<fixed_t> restorePos;
734730
735731 fixed_t restoreFloorZ;
736732 fixed_t restoreCeilingZ;
diff -r ca8f78ef0a0a -r 670e97c7ceea src/p_user.cpp
--- a/src/p_user.cpp Tue Jun 07 15:23:50 2022 -0400
+++ b/src/p_user.cpp Sun Jun 19 16:32:59 2022 -0400
@@ -522,12 +522,12 @@
522522 bSpawnTelefragged = p.bSpawnTelefragged;
523523 ulTime = p.ulTime;
524524 bUnarmed = p.bUnarmed;
525- memcpy(unlaggedX, &p.unlaggedX, sizeof( unlaggedX ));
526- memcpy(unlaggedY, &p.unlaggedY, sizeof( unlaggedY ));
527- memcpy(unlaggedZ, &p.unlaggedZ, sizeof( unlaggedZ ));
528- restoreX = p.restoreX;
529- restoreY = p.restoreY;
530- restoreZ = p.restoreZ;
525+
526+ // [AK] Copy the old positions for the unlagged.
527+ for ( unsigned int i = 0; i < UNLAGGEDTICS; i++ )
528+ unlaggedPos[i] = p.unlaggedPos[i];
529+
530+ restorePos = p.restorePos;
531531 restoreFloorZ = p.restoreFloorZ;
532532 restoreCeilingZ = p.restoreCeilingZ;
533533
diff -r ca8f78ef0a0a -r 670e97c7ceea src/unlagged.cpp
--- a/src/unlagged.cpp Tue Jun 07 15:23:50 2022 -0400
+++ b/src/unlagged.cpp Sun Jun 19 16:32:59 2022 -0400
@@ -176,9 +176,9 @@
176176 {
177177 if (playeringame[i] && players[i].mo && !players[i].bSpectating)
178178 {
179- players[i].restoreX = players[i].mo->x;
180- players[i].restoreY = players[i].mo->y;
181- players[i].restoreZ = players[i].mo->z;
179+ players[i].restorePos[0] = players[i].mo->x;
180+ players[i].restorePos[1] = players[i].mo->y;
181+ players[i].restorePos[2] = players[i].mo->z;
182182
183183 //Work around limitations of SetOrigin to prevent players
184184 //from getting stuck in ledges
@@ -190,11 +190,7 @@
190190 //to predict him
191191 if (players+i != actor->player)
192192 {
193- players[i].mo->SetOrigin(
194- players[i].unlaggedX[unlaggedIndex],
195- players[i].unlaggedY[unlaggedIndex],
196- players[i].unlaggedZ[unlaggedIndex]
197- );
193+ players[i].mo->SetOrigin( players[i].unlaggedPos[unlaggedIndex][0], players[i].unlaggedPos[unlaggedIndex][1], players[i].unlaggedPos[unlaggedIndex][2] );
198194 }
199195 else
200196 //However, the client sometimes mispredicts itself if it's on a moving sector.
@@ -279,21 +275,19 @@
279275 // Do not restore this player's position if the shot resulted in his direct teleportation.
280276 if ( players + i != actor->player )
281277 {
282- if ( players[i].mo->x != players[i].unlaggedX[unlaggedIndex] ||
283- players[i].mo->y != players[i].unlaggedY[unlaggedIndex] ||
284- players[i].mo->z != players[i].unlaggedZ[unlaggedIndex] )
278+ if ( players[i].mo->x != players[i].unlaggedPos[unlaggedIndex][0] ||
279+ players[i].mo->y != players[i].unlaggedPos[unlaggedIndex][1] ||
280+ players[i].mo->z != players[i].unlaggedPos[unlaggedIndex][2] )
285281 {
286282 continue;
287283 }
288284 }
289- else if ( actor->x != players[i].restoreX ||
290- actor->y != players[i].restoreY ||
291- actor->z != reconcilledZ )
285+ else if ( actor->x != players[i].restorePos[0] || actor->y != players[i].restorePos[1] || actor->z != reconcilledZ )
292286 {
293287 continue;
294288 }
295289
296- players[i].mo->SetOrigin( players[i].restoreX, players[i].restoreY, players[i].restoreZ );
290+ players[i].mo->SetOrigin( players[i].restorePos[0], players[i].restorePos[1], players[i].restorePos[2] );
297291 players[i].mo->floorz = players[i].restoreFloorZ;
298292 players[i].mo->ceilingz = players[i].restoreCeilingZ;
299293 }
@@ -319,9 +313,9 @@
319313 const int unlaggedIndex = gametic % UNLAGGEDTICS;
320314
321315 //record the player
322- player->unlaggedX[unlaggedIndex] = player->mo->x;
323- player->unlaggedY[unlaggedIndex] = player->mo->y;
324- player->unlaggedZ[unlaggedIndex] = player->mo->z;
316+ player->unlaggedPos[unlaggedIndex][0] = player->mo->x;
317+ player->unlaggedPos[unlaggedIndex][1] = player->mo->y;
318+ player->unlaggedPos[unlaggedIndex][2] = player->mo->z;
325319 }
326320
327321
@@ -339,9 +333,9 @@
339333
340334 for (int unlaggedIndex = 0; unlaggedIndex < UNLAGGEDTICS; ++unlaggedIndex)
341335 {
342- player->unlaggedX[unlaggedIndex] = player->mo->x;
343- player->unlaggedY[unlaggedIndex] = player->mo->y;
344- player->unlaggedZ[unlaggedIndex] = player->mo->z;
336+ player->unlaggedPos[unlaggedIndex][0] = player->mo->x;
337+ player->unlaggedPos[unlaggedIndex][1] = player->mo->y;
338+ player->unlaggedPos[unlaggedIndex][2] = player->mo->z;
345339 }
346340 }
347341
@@ -400,10 +394,7 @@
400394 const int unlaggedIndex = unlaggedGametic % UNLAGGEDTICS;
401395
402396 const player_t *hitPlayer = trace.Actor->player;
403-
404- hitOffset[0] = hitPlayer->restoreX - hitPlayer->unlaggedX[unlaggedIndex];
405- hitOffset[1] = hitPlayer->restoreY - hitPlayer->unlaggedY[unlaggedIndex];
406- hitOffset[2] = hitPlayer->restoreZ - hitPlayer->unlaggedZ[unlaggedIndex];
397+ hitOffset = hitPlayer->restorePos - hitPlayer->unlaggedPos[unlaggedIndex];
407398 }
408399 }
409400
@@ -455,9 +446,9 @@
455446 if ( ( ulPlayer == ulIdx ) || ( PLAYER_IsValidPlayer ( ulIdx ) == false ) || players[ulIdx].bSpectating )
456447 continue;
457448
458- pActor->x = players[ulIdx].unlaggedX[unlaggedIndex];
459- pActor->y = players[ulIdx].unlaggedY[unlaggedIndex];
460- pActor->z = players[ulIdx].unlaggedZ[unlaggedIndex];
449+ pActor->x = players[ulIdx].unlaggedPos[unlaggedIndex][0];
450+ pActor->y = players[ulIdx].unlaggedPos[unlaggedIndex][1];
451+ pActor->z = players[ulIdx].unlaggedPos[unlaggedIndex][2];
461452
462453 SERVERCOMMANDS_SpawnThingNoNetID( pActor, ulPlayer, SVCF_ONLYTHISCLIENT );
463454 }
Show on old repository browser