Compare commits
4 commits
master
...
implant2-s
| Author | SHA1 | Date | |
|---|---|---|---|
| 6de5824395 | |||
| 3327e9680c | |||
| 009dc313d4 | |||
| 0602b6ad4b |
5 changed files with 86 additions and 20 deletions
|
|
@ -51,6 +51,10 @@ typedef struct {
|
||||||
vec3_t previous_origin;
|
vec3_t previous_origin;
|
||||||
vec3_t previous_velocity;
|
vec3_t previous_velocity;
|
||||||
int previous_waterlevel;
|
int previous_waterlevel;
|
||||||
|
|
||||||
|
// QL step jump context flag — set before calling PM_Jump
|
||||||
|
// from PM_StepSlideMove to get additive velocity instead of flat set
|
||||||
|
qboolean isStepJump;
|
||||||
} pml_t;
|
} pml_t;
|
||||||
|
|
||||||
extern pmove_t *pm;
|
extern pmove_t *pm;
|
||||||
|
|
@ -77,6 +81,8 @@ void PM_ClipVelocity( vec3_t in, vec3_t normal, vec3_t out, float overbounce );
|
||||||
void PM_AddTouchEnt( int entityNum );
|
void PM_AddTouchEnt( int entityNum );
|
||||||
void PM_AddEvent( int newEvent );
|
void PM_AddEvent( int newEvent );
|
||||||
|
|
||||||
|
qboolean PM_CanJump( void );
|
||||||
|
void PM_Jump( void );
|
||||||
qboolean PM_SlideMove( qboolean gravity );
|
qboolean PM_SlideMove( qboolean gravity );
|
||||||
void PM_StepSlideMove( qboolean gravity );
|
void PM_StepSlideMove( qboolean gravity );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -353,32 +353,71 @@ static void PM_SetMovementDir( void ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
PM_CheckJump
|
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 qboolean PM_CheckJump( void ) {
|
/*
|
||||||
|
=============
|
||||||
|
PM_CanJump
|
||||||
|
|
||||||
|
Returns qtrue if a jump would succeed right now.
|
||||||
|
Checks both player state AND input (upmove >= 10).
|
||||||
|
Used by PM_StepSlideMove to decide whether stepping
|
||||||
|
up stairs should trigger a jump.
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
qboolean PM_CanJump( void ) {
|
||||||
if ( pm->ps->pm_flags & PMF_RESPAWNED ) {
|
if ( pm->ps->pm_flags & PMF_RESPAWNED ) {
|
||||||
return qfalse; // don't allow jump until all buttons are up
|
return qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pm->ps->pm_type != PM_NORMAL ) {
|
||||||
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pm->cmd.upmove < 10 ) {
|
if ( pm->cmd.upmove < 10 ) {
|
||||||
// not holding jump
|
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
// must wait for jump to be released
|
// QL: 100ms minimum delay between jumps.
|
||||||
if ( pm->ps->pm_flags & PMF_JUMP_HELD ) {
|
// Prevents same-frame double-fires. Step jumps launch the player
|
||||||
// clear upmove so cmdscale doesn't lower running speed
|
// high enough (~400ms airtime) that the next stair collision
|
||||||
pm->cmd.upmove = 0;
|
// naturally exceeds this threshold.
|
||||||
|
if ( pm->cmd.serverTime - pm->ps->lastJumpTime < 100 ) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PM_Jump( void ) {
|
||||||
pml.groundPlane = qfalse; // jumping away
|
pml.groundPlane = qfalse; // jumping away
|
||||||
pml.walking = qfalse;
|
pml.walking = qfalse;
|
||||||
pm->ps->pm_flags |= PMF_JUMP_HELD;
|
pm->ps->pm_flags |= PMF_JUMP_HELD;
|
||||||
|
|
||||||
pm->ps->groundEntityNum = ENTITYNUM_NONE;
|
pm->ps->groundEntityNum = ENTITYNUM_NONE;
|
||||||
|
|
||||||
|
if ( pml.isStepJump ) {
|
||||||
|
// QL step jump: additive velocity, preserving existing upward motion.
|
||||||
|
// This launches the player high enough to skip several stairs,
|
||||||
|
// so the next collision is >100ms away and the cooldown works.
|
||||||
|
pm->ps->velocity[2] += JUMP_VELOCITY;
|
||||||
|
if ( pm->ps->velocity[2] < JUMP_VELOCITY ) {
|
||||||
pm->ps->velocity[2] = JUMP_VELOCITY;
|
pm->ps->velocity[2] = JUMP_VELOCITY;
|
||||||
|
}
|
||||||
|
if ( pm->ps->velocity[2] > 700 ) {
|
||||||
|
pm->ps->velocity[2] = 700;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Normal ground jump: flat velocity set (Q3 behavior)
|
||||||
|
pm->ps->velocity[2] = JUMP_VELOCITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
pm->ps->lastJumpTime = pm->cmd.serverTime;
|
||||||
PM_AddEvent( EV_JUMP );
|
PM_AddEvent( EV_JUMP );
|
||||||
|
|
||||||
if ( pm->cmd.forwardmove >= 0 ) {
|
if ( pm->cmd.forwardmove >= 0 ) {
|
||||||
|
|
@ -388,6 +427,23 @@ static qboolean PM_CheckJump( void ) {
|
||||||
PM_ForceLegsAnim( LEGS_JUMPB );
|
PM_ForceLegsAnim( LEGS_JUMPB );
|
||||||
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
|
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
PM_CheckJump
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static qboolean PM_CheckJump( void ) {
|
||||||
|
if ( !PM_CanJump() ) {
|
||||||
|
return qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QL autohop: no PMF_JUMP_HELD gate here.
|
||||||
|
// The Pmove() outer loop forces upmove=20 when
|
||||||
|
// PMF_JUMP_HELD is set, allowing continuous bunny hopping.
|
||||||
|
|
||||||
|
PM_Jump();
|
||||||
|
|
||||||
return qtrue;
|
return qtrue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,15 +246,9 @@ void PM_StepSlideMove( qboolean gravity ) {
|
||||||
return; // we got exactly where we wanted to go first try
|
return; // we got exactly where we wanted to go first try
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(start_o, down);
|
// QL pm_airSteps: allow step-ups with upward velocity.
|
||||||
down[2] -= STEPSIZE;
|
// Q3 blocked step-ups during jumps unless ground was directly below.
|
||||||
pm->trace (&trace, start_o, pm->mins, pm->maxs, down, pm->ps->clientNum, pm->tracemask);
|
// This prevented smooth stair traversal while bunny-hopping.
|
||||||
VectorSet(up, 0, 0, 1);
|
|
||||||
// never step up when you still have up velocity
|
|
||||||
if ( pm->ps->velocity[2] > 0 && (trace.fraction == 1.0 ||
|
|
||||||
DotProduct(trace.plane.normal, up) < 0.7)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
VectorCopy (pm->ps->origin, down_o);
|
VectorCopy (pm->ps->origin, down_o);
|
||||||
VectorCopy (pm->ps->velocity, down_v);
|
VectorCopy (pm->ps->velocity, down_v);
|
||||||
|
|
@ -285,9 +279,15 @@ void PM_StepSlideMove( qboolean gravity ) {
|
||||||
if ( !trace.allsolid ) {
|
if ( !trace.allsolid ) {
|
||||||
VectorCopy (trace.endpos, pm->ps->origin);
|
VectorCopy (trace.endpos, pm->ps->origin);
|
||||||
}
|
}
|
||||||
|
// QL: only clip velocity to step surface when moving INTO it.
|
||||||
|
// Skip clip when velocity is already moving away (preserves
|
||||||
|
// upward momentum through stair steps during bunny-hopping).
|
||||||
if ( trace.fraction < 1.0 ) {
|
if ( trace.fraction < 1.0 ) {
|
||||||
|
float vdotn = DotProduct( pm->ps->velocity, trace.plane.normal );
|
||||||
|
if ( vdotn < 0 || fabs( vdotn ) < 0.001f ) {
|
||||||
PM_ClipVelocity( pm->ps->velocity, trace.plane.normal, pm->ps->velocity, OVERCLIP );
|
PM_ClipVelocity( pm->ps->velocity, trace.plane.normal, pm->ps->velocity, OVERCLIP );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// if the down trace can trace back to the original position directly, don't step
|
// if the down trace can trace back to the original position directly, don't step
|
||||||
|
|
|
||||||
|
|
@ -1212,6 +1212,9 @@ typedef struct playerState_s {
|
||||||
int pmove_framecount; // FIXME: don't transmit over the network
|
int pmove_framecount; // FIXME: don't transmit over the network
|
||||||
int jumppad_frame;
|
int jumppad_frame;
|
||||||
int entityEventSequence;
|
int entityEventSequence;
|
||||||
|
|
||||||
|
// QL additions
|
||||||
|
int lastJumpTime; // serverTime of last jump, for 100ms cooldown
|
||||||
} playerState_t;
|
} playerState_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1147,7 +1147,8 @@ netField_t playerStateFields[] =
|
||||||
{ PSF(grapplePoint[1]), 0 },
|
{ PSF(grapplePoint[1]), 0 },
|
||||||
{ PSF(grapplePoint[2]), 0 },
|
{ PSF(grapplePoint[2]), 0 },
|
||||||
{ PSF(jumppad_ent), 10 },
|
{ PSF(jumppad_ent), 10 },
|
||||||
{ PSF(loopSound), 16 }
|
{ PSF(loopSound), 16 },
|
||||||
|
{ PSF(lastJumpTime), 32 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue