# HG changeset patch # User Adam Kaminski # Date 1644163138 18000 # Sun Feb 06 10:58:58 2022 -0500 # Node ID fab0c73eb12dceadc03474d5e352fa82e76c849c # Parent a81bb124128c22b8bf7b99c5dc00af0d74ab99d9 Fixed: players appeared jittery when standing on lifts moving downward in online games. diff -r a81bb124128c -r fab0c73eb12d src/cl_main.cpp --- a/src/cl_main.cpp Sun Feb 06 10:38:24 2022 -0500 +++ b/src/cl_main.cpp Sun Feb 06 10:58:58 2022 -0500 @@ -3799,6 +3799,19 @@ // [BB] But don't just set the position, but also properly set floorz and ceilingz, etc. CLIENT_MoveThing( player->mo, x, y, z ); + // [AK] Did the server tell us this player is supposed to be on the ground? If so, move + // them to the floor of whatever sector they're in. + if ( flags & PLAYER_ONGROUND ) + { + // [AK] In some cases, especially when the player is standing on the edge of a moving lift, + // their floorz might be messed up and lower than it actually is, so we have to fix it. + player->mo->floorz = player->mo->Sector->floorplane.ZatPoint( player->mo->x, player->mo->y ); + player->mo->ceilingz = player->mo->Sector->ceilingplane.ZatPoint( player->mo->x, player->mo->y ); + P_FindFloorCeiling( player->mo, false ); + + player->mo->z = player->mo->floorz; + } + // [AK] Calculate how much this player's angle changed. player->mo->AngleDelta = angle - player->mo->angle; diff -r a81bb124128c -r fab0c73eb12d src/network.h --- a/src/network.h Sun Feb 06 10:38:24 2022 -0500 +++ b/src/network.h Sun Feb 06 10:58:58 2022 -0500 @@ -92,6 +92,7 @@ PLAYER_SENDVELX = 1 << 4, PLAYER_SENDVELY = 1 << 5, PLAYER_SENDVELZ = 1 << 6, + PLAYER_ONGROUND = 1 << 7, }; /* [BB] This is not used anywhere anymore. diff -r a81bb124128c -r fab0c73eb12d src/sv_commands.cpp --- a/src/sv_commands.cpp Sun Feb 06 10:38:24 2022 -0500 +++ b/src/sv_commands.cpp Sun Feb 06 10:58:58 2022 -0500 @@ -313,6 +313,12 @@ if ( players[ulPlayer].mo->velz ) ulPlayerFlags |= PLAYER_SENDVELZ; + // [AK] Check if the player is touching the ground. This tells clients to clamp the player onto + // the floor of whatever sector they end up in. This fixes players appearing jittery on lifts + // that are moving downward. + if ( players[ulPlayer].mo->z <= players[ulPlayer].mo->floorz ) + ulPlayerFlags |= PLAYER_ONGROUND; + ServerCommands::MovePlayer fullCommand; fullCommand.SetPlayer ( &players[ulPlayer] ); fullCommand.SetFlags( ulPlayerFlags | PLAYER_VISIBLE );