Skip to content

Commit

Permalink
Ignore breakables when determining mantelability
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyLobo committed Nov 3, 2018
1 parent 37840ff commit a749d11
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions mp/src/game/shared/sdk/sdk_gamemovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2502,6 +2502,17 @@ inline void CSDKGameMovement::TraceBBox(const Vector& start, const Vector& end,
TraceBBox(start, end, mins, maxs, pm, PlayerSolidMask(), pExtraShouldHitCheckFn);
}

static bool ShouldHitFuncIgnoreBreakables(IHandleEntity *pHandleEntity, int contentsMask) {
CBaseEntity *pEntity = EntityFromEntityHandle(pHandleEntity);
if (!pEntity)
return true;

if (pEntity->GetHealth() == 0)
return true;

return false;
}

bool CSDKGameMovement::CheckMantel()
{
trace_t tr;
Expand Down Expand Up @@ -2537,15 +2548,15 @@ bool CSDKGameMovement::CheckMantel()
/*Then probe forward for free space*/
pr1 = pr2;
pr2 = pr1 + dir*4;
TraceBBox (pr1, pr2, vecMins, vecMaxs, tr);
TraceBBox (pr1, pr2, vecMins, vecMaxs, tr, &ShouldHitFuncIgnoreBreakables);
if (tr.fraction < 1)
/*Not enough space to stand on for potential ledge, or too far down wall*/
return false;

/*Find ground to stand on*/
pr1 = pr2;
pr2[2] -= da_acro_mantel_height.GetFloat ();
TraceBBox (pr1, pr2, vecMins, vecMaxs, tr);
TraceBBox (pr1, pr2, vecMins, vecMaxs, tr, &ShouldHitFuncIgnoreBreakables);
if (tr.fraction == 1)
return false;

Expand All @@ -2558,15 +2569,15 @@ bool CSDKGameMovement::CheckMantel()
/*Then check whether we have enough vertical space to stand on the ledge*/
pr1 = pr2 = tr.endpos;
pr2.z += 4;
TraceBBox(pr1, pr2, VEC_HULL_MIN, VEC_HULL_MAX, tr);
TraceBBox(pr1, pr2, VEC_HULL_MIN, VEC_HULL_MAX, tr, &ShouldHitFuncIgnoreBreakables);

if (tr.fraction < 1 || tr.allsolid || tr.startsolid)
/*Blocked by ceiling*/
return false;

pr1 = mv->GetAbsOrigin();
pr2 = pr1 + dir*4;
TraceBBox (pr1, pr2, vecMins, vecMaxs, tr);
TraceBBox (pr1, pr2, vecMins, vecMaxs, tr, &ShouldHitFuncIgnoreBreakables);

// Only mantel with steep planes.
if (tr.plane.normal.z > 0.3)
Expand Down

0 comments on commit a749d11

Please sign in to comment.