This is a fork of Zandronum Beta for TSPG.
Revisión | 2545939214ad0a8259a89655445869697be3e505 (tree) |
---|---|
Tiempo | 2021-11-28 01:14:22 |
Autor | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Fixed lagging clients still feeling jittery on their ends due to the skip correction.
@@ -178,6 +178,7 @@ | ||
178 | 178 | static void server_PrintWithIP( FString message, const NETADDRESS_s &address ); |
179 | 179 | static void server_PerformBacktrace( ULONG ulClient ); |
180 | 180 | static bool server_ShouldPerformBacktrace( ULONG ulClient ); |
181 | +static void server_FixZFromBacktrace( APlayerPawn *pmo, fixed_t oldFloorZ ); | |
181 | 182 | |
182 | 183 | // [RC] |
183 | 184 | #ifdef CREATE_PACKET_LOG |
@@ -7601,6 +7602,7 @@ | ||
7601 | 7602 | { |
7602 | 7603 | ULONG ulExtrapolateStartTic = pClient->LastMoveCMD->getClientTic( ); |
7603 | 7604 | ULONG ulNumExtrapolatedTics = pClient->ulExtrapolatedTics; |
7605 | + fixed_t oldFloorZ = 0; | |
7604 | 7606 | |
7605 | 7607 | pClient->bIsBacktracing = true; |
7606 | 7608 | pClient->ulExtrapolatedTics = 0; |
@@ -7633,6 +7635,13 @@ | ||
7633 | 7635 | |
7634 | 7636 | pClient->LastMoveCMD->process( ulClient ); |
7635 | 7637 | |
7638 | + // [AK] Now we have to tick this player's body and set the proper psprite settings. | |
7639 | + pmo->Tick( ); | |
7640 | + P_NewPspriteTick( &players[ulClient] ); | |
7641 | + | |
7642 | + pClient->lLastMoveTickProcess--; | |
7643 | + oldFloorZ = pmo->floorz; | |
7644 | + | |
7636 | 7645 | // [AK] Adjust the sector ceiling/floor heights for the next tic that we extrapolated the player. |
7637 | 7646 | // We don't have to do this on the last tic that we extrapolated the player. |
7638 | 7647 | if ( ulTic < ulNumExtrapolatedTics ) |
@@ -7644,11 +7653,12 @@ | ||
7644 | 7653 | sectors[i].floorplane.d = sectors[i].floorplane.unlaggedD[unlaggedIndex]; |
7645 | 7654 | sectors[i].ceilingplane.d = sectors[i].ceilingplane.unlaggedD[unlaggedIndex]; |
7646 | 7655 | } |
7656 | + | |
7657 | + // [AK] Make sure the player doesn't get stuck in the floor/ceiling in case they moved. | |
7658 | + server_FixZFromBacktrace( pmo, oldFloorZ ); | |
7647 | 7659 | } |
7648 | 7660 | } |
7649 | 7661 | |
7650 | - sector_t *pSector = pmo->Sector; | |
7651 | - | |
7652 | 7662 | // [AK] Restore the sector ceiling/floor heights back to what they were before the backtrace. |
7653 | 7663 | for ( int i = 0; i < numsectors; i++ ) |
7654 | 7664 | { |
@@ -7658,15 +7668,7 @@ | ||
7658 | 7668 | |
7659 | 7669 | // [AK] As a final measure, fix the player's floorz/ceilingz and to ensure that they don't |
7660 | 7670 | // get stuck in the floor/ceiling of whatever sector they're supposed to be in. |
7661 | - pmo->floorz = pSector->floorplane.ZatPoint( pmo->x, pmo->y ); | |
7662 | - pmo->ceilingz = pSector->ceilingplane.ZatPoint( pmo->x, pmo->y ); | |
7663 | - P_FindFloorCeiling( pmo, false ); | |
7664 | - | |
7665 | - if ( pmo->z + pmo->height > pmo->ceilingz ) | |
7666 | - pmo->z = pmo->ceilingz - pmo->height; | |
7667 | - | |
7668 | - if ( pmo->z < pmo->floorz ) | |
7669 | - pmo->z = pmo->floorz; | |
7671 | + server_FixZFromBacktrace( pmo, oldFloorZ ); | |
7670 | 7672 | |
7671 | 7673 | pmo->velx += pClient->backtraceThrust[0]; |
7672 | 7674 | pmo->vely += pClient->backtraceThrust[1]; |
@@ -7731,6 +7733,40 @@ | ||
7731 | 7733 | |
7732 | 7734 | //***************************************************************************** |
7733 | 7735 | // |
7736 | +static void server_FixZFromBacktrace( APlayerPawn *pmo, fixed_t oldFloorZ ) | |
7737 | +{ | |
7738 | + pmo->floorz = pmo->Sector->floorplane.ZatPoint( pmo->x, pmo->y ); | |
7739 | + pmo->ceilingz = pmo->Sector->ceilingplane.ZatPoint( pmo->x, pmo->y ); | |
7740 | + P_FindFloorCeiling( pmo, false ); | |
7741 | + | |
7742 | + if ( pmo->z + pmo->height > pmo->ceilingz ) | |
7743 | + pmo->z = pmo->ceilingz - pmo->height; | |
7744 | + | |
7745 | + if ( pmo->z < pmo->floorz ) | |
7746 | + { | |
7747 | + pmo->z = pmo->floorz; | |
7748 | + } | |
7749 | + else | |
7750 | + { | |
7751 | + // [AK] Check if the player should move with the floor if it moved, similarly to PIT_FloorDrop. | |
7752 | + if (( pmo->velz == 0 ) && (!( pmo->flags & MF_NOGRAVITY ) || ( pmo->z == oldFloorZ && !( pmo->flags & MF_NOLIFTDROP )))) | |
7753 | + { | |
7754 | + if (( pmo->flags & MF_NOGRAVITY) || ( pmo->flags5 & MF5_MOVEWITHSECTOR ) || | |
7755 | + ( pmo->Sector->Flags & SECF_FLOORDROP ) || ( pmo->z - pmo->floorz <= 9 * FRACUNIT )) | |
7756 | + { | |
7757 | + pmo->z = pmo->floorz; | |
7758 | + } | |
7759 | + } | |
7760 | + else if ( pmo->z != oldFloorZ && !( pmo->flags & MF_NOLIFTDROP )) | |
7761 | + { | |
7762 | + if (( pmo->flags & MF_NOGRAVITY ) && ( pmo->flags6 & MF6_RELATIVETOFLOOR )) | |
7763 | + pmo->z = pmo->z - oldFloorZ + pmo->floorz; | |
7764 | + } | |
7765 | + } | |
7766 | +} | |
7767 | + | |
7768 | +//***************************************************************************** | |
7769 | +// | |
7734 | 7770 | FString CLIENT_s::GetAccountName() const |
7735 | 7771 | { |
7736 | 7772 | if ( loggedIn ) |