• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revisionab089e2fed3119ad9ed98363fa8ef46a76f59c9e (tree)
Time2022-02-07 00:58:58
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Fixed: players appeared jittery when standing on lifts moving downward in online games.

Change Summary

Incremental Difference

diff -r 80c5ad0147c9 -r ab089e2fed31 src/cl_main.cpp
--- a/src/cl_main.cpp Wed Feb 09 11:38:51 2022 -0500
+++ b/src/cl_main.cpp Sun Feb 06 10:58:58 2022 -0500
@@ -3799,6 +3799,19 @@
37993799 // [BB] But don't just set the position, but also properly set floorz and ceilingz, etc.
38003800 CLIENT_MoveThing( player->mo, x, y, z );
38013801
3802+ // [AK] Did the server tell us this player is supposed to be on a moving lift? If so, move
3803+ // them to the floor of whatever sector they're in.
3804+ if ( flags & PLAYER_ONLIFT )
3805+ {
3806+ // [AK] When the player is standing on the edge of a moving lift, their floorz might be
3807+ // messed up and lower than it actually is, so we have to fix it.
3808+ player->mo->floorz = player->mo->Sector->floorplane.ZatPoint( player->mo->x, player->mo->y );
3809+ player->mo->ceilingz = player->mo->Sector->ceilingplane.ZatPoint( player->mo->x, player->mo->y );
3810+ P_FindFloorCeiling( player->mo, false );
3811+
3812+ player->mo->z = player->mo->floorz;
3813+ }
3814+
38023815 // [AK] Calculate how much this player's angle changed.
38033816 player->mo->AngleDelta = angle - player->mo->angle;
38043817
diff -r 80c5ad0147c9 -r ab089e2fed31 src/network.h
--- a/src/network.h Wed Feb 09 11:38:51 2022 -0500
+++ b/src/network.h Sun Feb 06 10:58:58 2022 -0500
@@ -92,6 +92,7 @@
9292 PLAYER_SENDVELX = 1 << 4,
9393 PLAYER_SENDVELY = 1 << 5,
9494 PLAYER_SENDVELZ = 1 << 6,
95+ PLAYER_ONLIFT = 1 << 7,
9596 };
9697
9798 /* [BB] This is not used anywhere anymore.
diff -r 80c5ad0147c9 -r ab089e2fed31 src/sv_commands.cpp
--- a/src/sv_commands.cpp Wed Feb 09 11:38:51 2022 -0500
+++ b/src/sv_commands.cpp Sun Feb 06 10:58:58 2022 -0500
@@ -313,6 +313,11 @@
313313 if ( players[ulPlayer].mo->velz )
314314 ulPlayerFlags |= PLAYER_SENDVELZ;
315315
316+ // [AK] Check if the player is standing on a moving lift. This tells clients to clamp the player onto
317+ // the floor of whatever sector they end up in, making them not appeary jittery on lifts moving downward.
318+ if (( players[ulPlayer].mo->z <= players[ulPlayer].mo->floorz ) && ( players[ulPlayer].mo->floorsector->floordata ))
319+ ulPlayerFlags |= PLAYER_ONLIFT;
320+
316321 ServerCommands::MovePlayer fullCommand;
317322 fullCommand.SetPlayer ( &players[ulPlayer] );
318323 fullCommand.SetFlags( ulPlayerFlags | PLAYER_VISIBLE );
Show on old repository browser