From 6375ea5504586c8964f832cfb63a525046cd70fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mu=C3=B1oz?= Date: Mon, 10 Jul 2023 20:01:53 -0400 Subject: [PATCH] Little code cleaning: g_vecAttackDir (#831) * Tiny code cleaning * Skip REGAMEDLL_FIXES * UTIL_BloodDrips: remove useless `direction` param * Fix test demo (RANDOM_FLOAT inside UTIL_RandomBloodVector should be called for testdemo) --------- Co-authored-by: Sergey Shorokhov Co-authored-by: s1lentq --- regamedll/dlls/effects.cpp | 6 ++++-- regamedll/dlls/player.cpp | 2 +- regamedll/dlls/util.cpp | 2 +- regamedll/dlls/util.h | 2 +- regamedll/dlls/weapons.cpp | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/regamedll/dlls/effects.cpp b/regamedll/dlls/effects.cpp index 16cc2e6a..f934edd4 100644 --- a/regamedll/dlls/effects.cpp +++ b/regamedll/dlls/effects.cpp @@ -1737,10 +1737,12 @@ Vector CBlood::BloodPosition(CBaseEntity *pActivator) void CBlood::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { + const Vector direction = Direction(); + if (pev->spawnflags & SF_BLOOD_STREAM) - UTIL_BloodStream(BloodPosition(pActivator), Direction(), (Color() == BLOOD_COLOR_RED) ? 70 : Color(), int(BloodAmount())); + UTIL_BloodStream(BloodPosition(pActivator), direction, (Color() == BLOOD_COLOR_RED) ? 70 : Color(), int(BloodAmount())); else - UTIL_BloodDrips(BloodPosition(pActivator), Direction(), Color(), int(BloodAmount())); + UTIL_BloodDrips(BloodPosition(pActivator), Color(), int(BloodAmount())); if (pev->spawnflags & SF_BLOOD_DECAL) { diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index cfc27492..92a0d69e 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6596,7 +6596,7 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse) TraceResult tr; Vector dir(0, 0, 1); - UTIL_BloodDrips(pev->origin, dir, BLOOD_COLOR_RED, 2000); + UTIL_BloodDrips(pev->origin, BLOOD_COLOR_RED, 2000); for (int r = 1; r < 4; r++) { diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index d508ed6e..6b2fda0c 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -1056,7 +1056,7 @@ void UTIL_BloodStream(const Vector &origin, const Vector &direction, int color, MESSAGE_END(); } -void UTIL_BloodDrips(const Vector &origin, const Vector &direction, int color, int amount) +void UTIL_BloodDrips(const Vector &origin, int color, int amount) { if (!UTIL_ShouldShowBlood(color)) return; diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index baeea363..9ed3f40e 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -262,7 +262,7 @@ bool UTIL_IsMasterTriggered(string_t sMaster, CBaseEntity *pActivator); BOOL UTIL_ShouldShowBlood(int color); int UTIL_PointContents(const Vector &vec); void UTIL_BloodStream(const Vector &origin, const Vector &direction, int color, int amount); -void UTIL_BloodDrips(const Vector &origin, const Vector &direction, int color, int amount); +void UTIL_BloodDrips(const Vector &origin, int color, int amount); Vector UTIL_RandomBloodVector(); void UTIL_BloodDecalTrace(TraceResult *pTrace, int bloodColor); void UTIL_DecalTrace(TraceResult *pTrace, int decalNumber); diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 9606e79c..ac9aaea9 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -112,7 +112,7 @@ void AddMultiDamage(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamag void SpawnBlood(Vector vecSpot, int bloodColor, float flDamage) { - UTIL_BloodDrips(vecSpot, g_vecAttackDir, bloodColor, int(flDamage)); + UTIL_BloodDrips(vecSpot, bloodColor, int(flDamage)); } NOXREF int DamageDecal(CBaseEntity *pEntity, int bitsDamageType)