Permalink
Browse files

make wallrunning take stamina

  • Loading branch information...
DolceTriade committed Dec 19, 2015
1 parent 967fa28 commit ec08f9379100f4d2c5c0fbaf8b1f71e87c471c7e
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/shared/bg_pmove.cpp
@@ -1179,14 +1179,22 @@ static bool PM_CheckWallRun()
{
vec3_t dir, movedir, point;
trace_t trace;
int cost = BG_Class( pm->ps->stats[ STAT_CLASS ] )->staminaJumpCost;

static const vec3_t refNormal = { 0.0f, 0.0f, 1.0f };

// Make sure we can wall run
if ( !( BG_Class( pm->ps->stats[ STAT_CLASS ] )->abilities & SCA_WALLRUNNER ) )
{
return false;
}

// not enough stamina
if ( pm->ps->stats[ STAT_STAMINA ] < cost )
{
return false;
}

ProjectPointOnPlane( movedir, pml.forward, refNormal );
VectorNormalize( movedir );

@@ -1259,6 +1267,7 @@ static bool PM_CheckWallRun()
VectorSubtract( dir, pm->ps->velocity, pm->ps->velocity );
VectorNegate( pm->ps->velocity, pm->ps->velocity );
pm->ps->velocity[ 2 ] += BG_Class( pm->ps->stats[ STAT_CLASS ] )->jumpMagnitude;
pm->ps->stats[ STAT_STAMINA ] -= cost;

PM_AddEvent( EV_JUMP );
PM_PlayJumpingAnimation();

0 comments on commit ec08f93

Please sign in to comment.