Skip to content

Commit 5bb2762

Browse files
committed
Merge full player movement unstuck code from HL25 Update.
1 parent 35f1388 commit 5bb2762

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

pm_shared/pm_shared.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,10 @@ int PM_FlyMove( void )
946946

947947
// modify original_velocity so it parallels all of the clip planes
948948
//
949-
if( pmove->movetype == MOVETYPE_WALK && ( ( pmove->onground == -1 ) || ( pmove->friction != 1 ) ) ) // relfect player velocity
949+
// reflect player velocity
950+
// Only give this a try for first impact plane because you can get yourself stuck in an acute corner by jumping in place
951+
// and pressing forward and nobody was really using this bounce/reflection feature anyway...
952+
if( numplanes == 1 && pmove->movetype == MOVETYPE_WALK && ( ( pmove->onground == -1 ) || ( pmove->friction != 1 )))
950953
{
951954
for( i = 0; i < numplanes; i++ )
952955
{
@@ -2860,6 +2863,15 @@ void PM_CheckParamters( void )
28602863
pmove->maxspeed = min( maxspeed, pmove->maxspeed );
28612864
}
28622865

2866+
// Slow down, I'm pulling it! (a box maybe) but only when I'm standing on ground
2867+
//
2868+
// JoshA: Moved this to CheckParamters rather than working on the velocity,
2869+
// as otherwise it affects every integration step incorrectly.
2870+
if( ( pmove->onground != -1 ) && ( pmove->cmd.buttons & IN_USE ))
2871+
{
2872+
pmove->maxspeed *= 1.0f / 3.0f;
2873+
}
2874+
28632875
if( ( spd != 0.0f ) && ( spd > pmove->maxspeed ) )
28642876
{
28652877
float fRatio = pmove->maxspeed / spd;
@@ -2980,7 +2992,11 @@ void PM_PlayerMove( qboolean server )
29802992
{
29812993
if( PM_CheckStuck() )
29822994
{
2983-
return; // Can't move, we're stuck
2995+
// Let the user try to duck to get unstuck
2996+
PM_Duck();
2997+
2998+
if( PM_CheckStuck() )
2999+
return; // Can't move, we're stuck
29843000
}
29853001
}
29863002

@@ -3026,12 +3042,6 @@ void PM_PlayerMove( qboolean server )
30263042
}
30273043
}
30283044

3029-
// Slow down, I'm pulling it! (a box maybe) but only when I'm standing on ground
3030-
if( ( pmove->onground != -1 ) && ( pmove->cmd.buttons & IN_USE ) )
3031-
{
3032-
VectorScale( pmove->velocity, 0.3, pmove->velocity );
3033-
}
3034-
30353045
// Handle movement
30363046
switch( pmove->movetype )
30373047
{

0 commit comments

Comments
 (0)