add FTRACE_KNIFE flag (#817)

* trace flags

* remove unused flags

* add FTRACE_KNIFE flag
This commit is contained in:
Hamdi 2023-07-11 03:57:50 +01:00 committed by GitHub
parent 6da11fa4dd
commit e1d1c11992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -100,6 +100,7 @@
// Starting from BIT(16) to reserve space for more flags for Engine
#define FTRACE_BULLET BIT(16)
#define FTRACE_FLASH BIT(17)
#define FTRACE_KNIFE BIT(18)
// walkmove modes
#define WALKMOVE_NORMAL 0 // normal walkmove

View File

@ -129,6 +129,9 @@ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, fl
distance = 1e6f;
vecHullEnd = vecSrc + ((vecHullEnd - vecSrc) * 2);
#ifdef REGAMEDLL_ADD
gpGlobals->trace_flags = FTRACE_KNIFE;
#endif
UTIL_TraceLine(vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace);
if (tmpTrace.flFraction < 1.0f)
@ -147,6 +150,9 @@ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, fl
vecEnd.y = vecHullEnd.y + minmaxs[j][1];
vecEnd.z = vecHullEnd.z + minmaxs[k][2];
#ifdef REGAMEDLL_ADD
gpGlobals->trace_flags = FTRACE_KNIFE;
#endif
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace);
if (tmpTrace.flFraction < 1.0f)
@ -274,11 +280,21 @@ BOOL CKnife::Swing(BOOL fFirst)
vecSrc = m_pPlayer->GetGunPosition();
vecEnd = vecSrc + gpGlobals->v_forward * KnifeSwingDistance();
#ifdef REGAMEDLL_ADD
gpGlobals->trace_flags = FTRACE_KNIFE;
#endif
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);
if (tr.flFraction >= 1.0f)
{
#ifdef REGAMEDLL_ADD
gpGlobals->trace_flags = FTRACE_KNIFE;
#endif
UTIL_TraceHull(vecSrc, vecEnd, dont_ignore_monsters, head_hull, m_pPlayer->edict(), &tr);
#ifdef REGAMEDLL_ADD
// We manually reset it because Engine doesn't unlike TraceLine
gpGlobals->trace_flags = 0;
#endif
if (tr.flFraction < 1.0f)
{
@ -457,11 +473,21 @@ BOOL CKnife::Stab(BOOL fFirst)
vecSrc = m_pPlayer->GetGunPosition();
vecEnd = vecSrc + gpGlobals->v_forward * KnifeStabDistance();
#ifdef REGAMEDLL_ADD
gpGlobals->trace_flags = FTRACE_KNIFE;
#endif
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, m_pPlayer->edict(), &tr);
if (tr.flFraction >= 1.0f)
{
#ifdef REGAMEDLL_ADD
gpGlobals->trace_flags = FTRACE_KNIFE;
#endif
UTIL_TraceHull(vecSrc, vecEnd, dont_ignore_monsters, head_hull, m_pPlayer->edict(), &tr);
#ifdef REGAMEDLL_ADD
// We manually reset it because Engine doesn't unlike TraceLine
gpGlobals->trace_flags = 0;
#endif
if (tr.flFraction < 1.0f)
{