Extract PM_Jump from PM_CheckJump (QL-style refactor)

Separate the jump execution (velocity, event, animation) from the
gate logic (respawn check, upmove threshold, jump-held check).
This prepares the code for QL features that need to trigger jumps
from contexts other than the normal ground jump path (step jump,
double jump, etc). No behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
serge_shubin 2026-03-21 04:31:49 +08:00
parent b9a0ada275
commit 0602b6ad4b

View file

@ -351,6 +351,33 @@ static void PM_SetMovementDir( void ) {
} }
/*
=============
PM_Jump
Applies jump velocity, event, and animation.
Extracted from PM_CheckJump so it can be called
from other contexts (step jump, double jump, etc).
=============
*/
static void PM_Jump( void ) {
pml.groundPlane = qfalse; // jumping away
pml.walking = qfalse;
pm->ps->pm_flags |= PMF_JUMP_HELD;
pm->ps->groundEntityNum = ENTITYNUM_NONE;
pm->ps->velocity[2] = JUMP_VELOCITY;
PM_AddEvent( EV_JUMP );
if ( pm->cmd.forwardmove >= 0 ) {
PM_ForceLegsAnim( LEGS_JUMP );
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
} else {
PM_ForceLegsAnim( LEGS_JUMPB );
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
}
/* /*
============= =============
PM_CheckJump PM_CheckJump
@ -373,21 +400,7 @@ static qboolean PM_CheckJump( void ) {
return qfalse; return qfalse;
} }
pml.groundPlane = qfalse; // jumping away PM_Jump();
pml.walking = qfalse;
pm->ps->pm_flags |= PMF_JUMP_HELD;
pm->ps->groundEntityNum = ENTITYNUM_NONE;
pm->ps->velocity[2] = JUMP_VELOCITY;
PM_AddEvent( EV_JUMP );
if ( pm->cmd.forwardmove >= 0 ) {
PM_ForceLegsAnim( LEGS_JUMP );
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
} else {
PM_ForceLegsAnim( LEGS_JUMPB );
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
return qtrue; return qtrue;
} }