From 959af0b130dfa29f74c34a60874a555c1dec2952 Mon Sep 17 00:00:00 2001 From: Wikot235 <149392035+Wikot235@users.noreply.github.com> Date: Sun, 5 Jan 2025 16:13:16 +0100 Subject: [PATCH] m_iMeleeReach now defaults to 55 --- sp/src/game/server/hl2/npc_BaseZombie.cpp | 6 +++++- sp/src/game/server/hl2/npc_BaseZombie.h | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/sp/src/game/server/hl2/npc_BaseZombie.cpp b/sp/src/game/server/hl2/npc_BaseZombie.cpp index 0799fcf6..6e389def 100644 --- a/sp/src/game/server/hl2/npc_BaseZombie.cpp +++ b/sp/src/game/server/hl2/npc_BaseZombie.cpp @@ -211,7 +211,7 @@ BEGIN_DATADESC( CNPC_BaseZombie ) DEFINE_FIELD( m_fIsTorso, FIELD_BOOLEAN ), #ifdef MAPBASE DEFINE_KEYFIELD( m_fIsHeadless, FIELD_BOOLEAN, "Headless" ), - DEFINE_KEYFIELD( m_flMeleeReach, FIELD_FLOAT, "MeleeReach" ), + DEFINE_KEYFIELD( m_iMeleeReach, FIELD_INTEGER, "MeleeReach" ), #else DEFINE_FIELD( m_fIsHeadless, FIELD_BOOLEAN ), #endif @@ -257,6 +257,10 @@ CNPC_BaseZombie::CNPC_BaseZombie() // moan loop. m_iMoanSound = g_numZombies; +#ifdef MAPBASE + m_iMeleeReach = 55; +#endif + g_numZombies++; } diff --git a/sp/src/game/server/hl2/npc_BaseZombie.h b/sp/src/game/server/hl2/npc_BaseZombie.h index 16ca0db9..b515144f 100644 --- a/sp/src/game/server/hl2/npc_BaseZombie.h +++ b/sp/src/game/server/hl2/npc_BaseZombie.h @@ -20,6 +20,10 @@ #define ENVELOPE_CONTROLLER (CSoundEnvelopeController::GetController()) +#ifndef MAPBASE + #define ZOMBIE_MELEE_REACH 55 +#endif + extern int AE_ZOMBIE_ATTACK_RIGHT; extern int AE_ZOMBIE_ATTACK_LEFT; extern int AE_ZOMBIE_ATTACK_BOTH; @@ -42,8 +46,8 @@ extern int AE_ZOMBIE_POUND; #define ZOMBIE_BLOOD_BITE 3 #ifdef MAPBASE -#define SF_ZOMBIE_NO_TORSO ( 1 << 15 ) -#define SF_ZOMBIE_NO_HEADCRAB_SPAWN ( 1 << 16 ) + #define SF_ZOMBIE_NO_TORSO ( 1 << 15 ) + #define SF_ZOMBIE_NO_HEADCRAB_SPAWN ( 1 << 16 ) #endif @@ -140,7 +144,14 @@ public: } int MeleeAttack1Conditions ( float flDot, float flDist ); - virtual float GetClawAttackRange() const { return m_flMeleeReach; } + virtual float GetClawAttackRange() const + { +#ifdef MAPBASE + return m_iMeleeReach; +#else + return ZOMBIE_MELEE_REACH; +#endif + } // No range attacks int RangeAttack1Conditions ( float flDot, float flDist ) { return( 0 ); } @@ -256,7 +267,9 @@ protected: float m_flNextFlinch; - float m_flMeleeReach; +#ifdef MAPBASE + int m_iMeleeReach; +#endif bool m_bHeadShot; // Used to determine the survival of our crab beyond our death.