Skip to content

Commit

Permalink
make wallrunning take stamina
Browse files Browse the repository at this point in the history
  • Loading branch information
DolceTriade committed Dec 19, 2015
1 parent 967fa28 commit ec08f93
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/shared/bg_pmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ec08f93

Please sign in to comment.