Fun: Make TraceLine a post forward

Reason: as it is it breaks plugins hooking TraceLine because of the original game call is being superceded and other modules can't catch it. It looks like it's this way from the very start fun module has been introduced 13 years ago before. Fakemeta module comes a little later.
This commit is contained in:
Arkshine 2017-03-06 11:21:57 +01:00
parent 3fba7ca567
commit 1e3832a942
2 changed files with 5 additions and 6 deletions

View File

@ -510,10 +510,8 @@ int ClientConnect(edict_t *pPlayer, const char *pszName, const char *pszAddress,
RETURN_META_VALUE(MRES_IGNORED, 0);
}
void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shooter, TraceResult *ptr)
void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *shooter, TraceResult *ptr)
{
TRACE_LINE(v1, v2, fNoMonsters, shooter, ptr);
if (ptr->pHit && (ptr->pHit->v.flags & (FL_CLIENT | FL_FAKECLIENT))
&& shooter && (shooter->v.flags & (FL_CLIENT | FL_FAKECLIENT)) )
{
@ -523,10 +521,11 @@ void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shoot
if (!(Players[shooterIndex].GetBodyHits(targetIndex) & (1 << ptr->iHitgroup)))
{
ptr->flFraction = 1.0;
RETURN_META(MRES_HANDLED);
}
}
RETURN_META(MRES_SUPERCEDE);
RETURN_META(MRES_IGNORED);
}
void OnAmxxAttach()

View File

@ -232,7 +232,7 @@
// #define FN_SetOrigin SetOrigin
// #define FN_EmitSound EmitSound
// #define FN_EmitAmbientSound EmitAmbientSound
#define FN_TraceLine TraceLine
// #define FN_TraceLine TraceLine
// #define FN_TraceToss TraceToss
// #define FN_TraceMonsterHull TraceMonsterHull
// #define FN_TraceHull TraceHull
@ -378,7 +378,7 @@
// #define FN_SetOrigin_Post SetOrigin_Post
// #define FN_EmitSound_Post EmitSound_Post
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
// #define FN_TraceLine_Post TraceLine_Post
#define FN_TraceLine_Post TraceLine_Post
// #define FN_TraceToss_Post TraceToss_Post
// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post
// #define FN_TraceHull_Post TraceHull_Post