summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoman Tetelman <kevlarman@gmail.com>2009-10-03 11:51:14 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:24 +0000
commitb1d56b466ca3b70bd6927f854cc7a8455d435699 (patch)
tree43fa2a361ed69f96eb1a70a55e45d949a83d8b05 /src
parent8ae9cc0583992f15b63ed4f62a063e46676df607 (diff)
Partially unrevert Risujin's walljump changes (r147):
* Marauders can now jump off of sloped walls
Diffstat (limited to 'src')
-rw-r--r--src/game/bg_pmove.c79
1 files changed, 42 insertions, 37 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index cf80bc5f..fa025530 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -623,15 +623,46 @@ PM_CheckWallJump
*/
static qboolean PM_CheckWallJump( void )
{
- vec3_t dir, forward, right;
+ vec3_t dir, forward, right, movedir, point;
vec3_t refNormal = { 0.0f, 0.0f, 1.0f };
float normalFraction = 1.5f;
float cmdFraction = 1.0f;
float upFraction = 1.5f;
+ trace_t trace;
+ ProjectPointOnPlane( movedir, pml.forward, refNormal );
+ VectorNormalize( movedir );
+
+ if( pm->cmd.forwardmove < 0 )
+ VectorNegate( movedir, movedir );
+
+ //allow strafe transitions
+ if( pm->cmd.rightmove )
+ {
+ VectorCopy( pml.right, movedir );
+
+ if( pm->cmd.rightmove < 0 )
+ VectorNegate( movedir, movedir );
+ }
+
+ //trace into direction we are moving
+ VectorMA( pm->ps->origin, 0.25f, movedir, point );
+ pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask );
+
+ if( trace.fraction < 1.0f &&
+ !( trace.surfaceFlags & ( SURF_SKY | SURF_SLICK ) ) )
+ {
+ if( !VectorCompare( trace.plane.normal, pm->ps->grapplePoint ) )
+ {
+ VectorCopy( trace.plane.normal, pm->ps->grapplePoint );
+ }
+ }
+ else
+ return;
+
if( pm->ps->pm_flags & PMF_RESPAWNED )
return qfalse; // don't allow jump until all buttons are up
-
+
if( pm->cmd.upmove < 10 )
// not holding jump
return qfalse;
@@ -709,15 +740,20 @@ static qboolean PM_CheckWallJump( void )
return qtrue;
}
+/*
+=============
+PM_CheckJump
+=============
+*/
static qboolean PM_CheckJump( void )
{
vec3_t normal;
- if( BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude == 0.0f )
+ if( pm->ps->groundEntityNum == ENTITYNUM_NONE )
return qfalse;
- if( BG_ClassHasAbility( pm->ps->stats[ STAT_CLASS ], SCA_WALLJUMPER ) )
- return PM_CheckWallJump( );
+ if( BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude == 0.0f )
+ return qfalse;
//can't jump and pounce at the same time
if( ( pm->ps->weapon == WP_ALEVEL3 ||
@@ -1155,6 +1191,7 @@ static void PM_AirMove( void )
float scale;
usercmd_t cmd;
+ PM_CheckWallJump( );
PM_Friction( );
fmove = pm->cmd.forwardmove;
@@ -2236,38 +2273,6 @@ static void PM_GroundTrace( void )
pml.groundPlane = qfalse;
pml.walking = qfalse;
- if( BG_ClassHasAbility( pm->ps->stats[ STAT_CLASS ], SCA_WALLJUMPER ) )
- {
- ProjectPointOnPlane( movedir, pml.forward, refNormal );
- VectorNormalize( movedir );
-
- if( pm->cmd.forwardmove < 0 )
- VectorNegate( movedir, movedir );
-
- //allow strafe transitions
- if( pm->cmd.rightmove )
- {
- VectorCopy( pml.right, movedir );
-
- if( pm->cmd.rightmove < 0 )
- VectorNegate( movedir, movedir );
- }
-
- //trace into direction we are moving
- VectorMA( pm->ps->origin, 0.25f, movedir, point );
- pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, point, pm->ps->clientNum, pm->tracemask );
-
- if( trace.fraction < 1.0f &&
- !( trace.surfaceFlags & ( SURF_SKY | SURF_SLICK ) ) )
- {
- if( !VectorCompare( trace.plane.normal, pm->ps->grapplePoint ) )
- {
- VectorCopy( trace.plane.normal, pm->ps->grapplePoint );
- PM_CheckWallJump( );
- }
- }
- }
-
return;
}
}