From c8a3562b43f395650a319b793de10b9af9f91d83 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Thu, 7 Nov 2024 19:39:44 +0300 Subject: [PATCH] Remove IsMachine. Add HasFlesh --- dlls/apache.cpp | 2 +- dlls/cbase.h | 2 +- dlls/client.cpp | 3 +-- dlls/crowbar.cpp | 2 +- dlls/knife.cpp | 4 ++-- dlls/pipewrench.cpp | 4 ++-- dlls/sound.cpp | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dlls/apache.cpp b/dlls/apache.cpp index 25b71e662..9ee37a9d8 100644 --- a/dlls/apache.cpp +++ b/dlls/apache.cpp @@ -43,7 +43,7 @@ class CApache : public CBaseMonster void Precache( void ); void KeyValue(KeyValueData* pkvd); int DefaultClassify( void ) { return CLASS_HUMAN_MILITARY; } - bool IsMachine() { return true; } + bool HasFlesh() { return false; } const char* DefaultDisplayName() { return "Apache"; } const char* ReverseRelationshipModel() { return "models/apachef.mdl"; } int BloodColor( void ) { return DONT_BLEED; } diff --git a/dlls/cbase.h b/dlls/cbase.h index 2c8f9dfc4..301f0412a 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -421,7 +421,7 @@ class CBaseEntity virtual CBasePlayerAmmo* MyAmmoPointer() {return NULL;} virtual bool IsAlienMonster() { return false; } - virtual bool IsMachine() { return DefaultClassify() == CLASS_MACHINE; } + virtual bool HasFlesh() { return DefaultClassify() != CLASS_NONE && DefaultClassify() != CLASS_MACHINE; } virtual float InputByMonster(CBaseMonster* pMonster) { return 0.0f; } virtual NODE_LINKENT HandleLinkEnt(int afCapMask, bool nodeQueryStatic) { return NLE_PROHIBIT; } diff --git a/dlls/client.cpp b/dlls/client.cpp index ed75ff229..b29af4a6e 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1472,8 +1472,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h } if( ( Entity = CBaseEntity::Instance( ent )) - && Entity->DefaultClassify() != CLASS_NONE - && Entity->DefaultClassify() != CLASS_MACHINE ) + && Entity->HasFlesh() ) { SetBits( state->eflags, EFLAG_FLESH_SOUND ); } diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index e00b679f3..8f3a3ad74 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -246,7 +246,7 @@ int CCrowbar::Swing( int fFirst ) } ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); - if( pEntity->DefaultClassify() != CLASS_NONE && !pEntity->IsMachine() ) + if( pEntity->HasFlesh() ) { // play thwack or smack sound switch( RANDOM_LONG( 0, 2 ) ) diff --git a/dlls/knife.cpp b/dlls/knife.cpp index 2902a870d..b322eff5e 100644 --- a/dlls/knife.cpp +++ b/dlls/knife.cpp @@ -238,7 +238,7 @@ int CKnife::Swing(int fFirst) } ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev ); - if( pEntity->DefaultClassify() != CLASS_NONE && !pEntity->IsMachine() ) + if( pEntity->HasFlesh() ) { // play thwack or smack sound switch( RANDOM_LONG( 0, 1 ) ) @@ -373,7 +373,7 @@ void CKnife::Stab() if (pEntity) { - if (pEntity->DefaultClassify() != CLASS_NONE && !pEntity->IsMachine()) + if (pEntity->HasFlesh()) { // play thwack or smack sound switch( RANDOM_LONG(0,1) ) diff --git a/dlls/pipewrench.cpp b/dlls/pipewrench.cpp index 8d68ab121..0000c3b00 100644 --- a/dlls/pipewrench.cpp +++ b/dlls/pipewrench.cpp @@ -244,7 +244,7 @@ int CPipeWrench::Swing(int fFirst) ApplyMultiDamage(m_pPlayer->pev, m_pPlayer->pev); - if ( pEntity->DefaultClassify() != CLASS_NONE && !pEntity->IsMachine() ) + if ( pEntity->HasFlesh() ) { // play thwack or smack sound switch( RANDOM_LONG(0,2) ) @@ -381,7 +381,7 @@ void CPipeWrench::BigSwing(void) if (pEntity) { - if (pEntity->DefaultClassify() != CLASS_NONE && !pEntity->IsMachine()) + if (pEntity->HasFlesh()) { // play thwack or smack sound switch( RANDOM_LONG(0,1) ) diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 652a1ea11..0745cbf3b 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -1821,7 +1821,7 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in chTextureType = 0; - if( pEntity && pEntity->DefaultClassify() != CLASS_NONE && !pEntity->IsMachine() ) + if( pEntity && pEntity->HasFlesh() ) // hit body chTextureType = CHAR_TEX_FLESH; else