Permalink
Browse files

Walljumps no longer cost stamina. Modify walljump detection logic

  • Loading branch information...
DolceTriade committed Dec 21, 2015
1 parent 26e6a24 commit dae82378110be30b897af074bd457ccec6ae8c1a
Showing with 13 additions and 7 deletions.
  1. +13 −7 src/shared/bg_pmove.cpp
@@ -1177,13 +1177,11 @@ PM_CheckWallRun
*/
static bool PM_CheckWallRun()
{
int cost;
float jumpMag;
Vec3 forward, origin, velocity, normal;
Vec3 dir, origin, velocity, normal;
vec3_t trace_end;
trace_t trace;

cost = BG_Class( pm->ps->stats[ STAT_CLASS ] )->staminaJumpCost;
jumpMag = BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude;

if ( !( BG_Class( pm->ps->stats[ STAT_CLASS ] )->abilities & SCA_WALLRUNNER ) )
@@ -1198,13 +1196,22 @@ static bool PM_CheckWallRun()
if ( pm->ps->pm_flags & PMF_TIME_WALLJUMP )
return false;

if ( pm->ps->stats[ STAT_STAMINA ] < cost )
if ( !pm->cmd.forwardmove && !pm->cmd.rightmove )
return false;

origin = Vec3::Load( pm->ps->origin );
forward = Vec3::Load( pml.forward );

( origin + forward * 32 ).Store( trace_end );
if ( pm->cmd.rightmove )
{
dir = Vec3::Load( pml.right );
dir *= pm->cmd.rightmove < 0 ? -1 : 1;
}
else
{
dir = Vec3::Load( pml.forward );
dir *= pm->cmd.forwardmove < 0 ? -1 : 1;
}
( origin + dir * 0.25f ).Store( trace_end );
pm->trace( &trace, pm->ps->origin, pm->mins, pm->maxs, trace_end,
pm->ps->clientNum, pm->tracemask, 0);

@@ -1225,7 +1232,6 @@ static bool PM_CheckWallRun()
pm->ps->pm_flags |= PMF_JUMP_HELD;

pm->ps->groundEntityNum = ENTITYNUM_NONE;
pm->ps->stats[ STAT_STAMINA ] -= cost;

normal = Vec3::Load( trace.plane.normal );
velocity = Vec3::Load( pm->ps->velocity );

0 comments on commit dae8237

Please sign in to comment.