From 7bebcd6b4a5a4e0e0a6fb91be30c4d226337e377 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Fri, 27 Oct 2017 20:45:34 +0500 Subject: [PATCH] Add monster_cleansuit_scientist and monsters corpses implementations. --- dlls/barney.cpp | 13 +++++++-- dlls/headcrab.cpp | 2 +- dlls/hgrunt.cpp | 13 +++++++-- dlls/scientist.cpp | 38 ++++++++++++++++++++---- dlls/zombie.cpp | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 128 insertions(+), 10 deletions(-) diff --git a/dlls/barney.cpp b/dlls/barney.cpp index 3fc5aef0..ef55f42a 100644 --- a/dlls/barney.cpp +++ b/dlls/barney.cpp @@ -800,14 +800,23 @@ void CDeadBarney::KeyValue( KeyValueData *pkvd ) } LINK_ENTITY_TO_CLASS( monster_barney_dead, CDeadBarney ) +LINK_ENTITY_TO_CLASS( monster_civ_barney_dead, CDeadBarney ) //========================================================= // ********** DeadBarney SPAWN ********** //========================================================= void CDeadBarney::Spawn() { - PRECACHE_MODEL( "models/barney.mdl" ); - SET_MODEL( ENT( pev ), "models/barney.mdl" ); + if( FClassnameIs( pev, "monster_civ_barney_dead" ) ) + { + PRECACHE_MODEL( "models/dead_barney.mdl" ); + SET_MODEL( ENT( pev ), "models/dead_barney.mdl" ); + } + else + { + PRECACHE_MODEL( "models/barney.mdl" ); + SET_MODEL( ENT( pev ), "models/barney.mdl" ); + } pev->effects = 0; pev->yaw_speed = 8; diff --git a/dlls/headcrab.cpp b/dlls/headcrab.cpp index 7a65a639..c59d8c42 100644 --- a/dlls/headcrab.cpp +++ b/dlls/headcrab.cpp @@ -189,7 +189,7 @@ void CHeadCrab::SetYawSpeed( void ) if( FClassnameIs( pev, "monster_xenocrab" ) ) { - pev->yaw_speed = RANDOM_LONG( 80, 90 ); + ys = RANDOM_LONG( 80, 90 ); } else { diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 4cb85c2c..94e9fcb1 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -2425,14 +2425,23 @@ void CDeadHGrunt::KeyValue( KeyValueData *pkvd ) } LINK_ENTITY_TO_CLASS( monster_hgrunt_dead, CDeadHGrunt ) +LINK_ENTITY_TO_CLASS( monster_human_grunt_ally_dead, CDeadHGrunt ) //========================================================= // ********** DeadHGrunt SPAWN ********** //========================================================= void CDeadHGrunt::Spawn( void ) { - PRECACHE_MODEL( "models/hgrunt.mdl" ); - SET_MODEL( ENT( pev ), "models/hgrunt.mdl" ); + if( FClassnameIs( pev, "monster_human_grunt_ally_dead" ) ) + { + PRECACHE_MODEL( "models/hgrunt_opfor.mdl" ); + SET_MODEL( ENT( pev ), "models/hgrunt_opfor.mdl" ); + } + else + { + PRECACHE_MODEL( "models/hgrunt.mdl" ); + SET_MODEL( ENT( pev ), "models/hgrunt.mdl" ); + } pev->effects = 0; pev->yaw_speed = 8; diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 7e94b286..f571b2ef 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -119,6 +119,7 @@ private: }; LINK_ENTITY_TO_CLASS( monster_scientist, CScientist ) +LINK_ENTITY_TO_CLASS( monster_cleansuit_scientist, CScientist ) TYPEDESCRIPTION CScientist::m_SaveData[] = { @@ -639,7 +640,11 @@ void CScientist::Spawn( void ) { Precache(); - SET_MODEL( ENT( pev ), "models/scientist.mdl" ); + if( FClassnameIs( pev, "monster_cleansuit_scientist" ) ) + SET_MODEL( ENT( pev ), "models/cleansuit_scientist.mdl" ); + else + SET_MODEL( ENT( pev ), "models/scientist.mdl" ); + UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX ); pev->solid = SOLID_SLIDEBOX; @@ -676,7 +681,11 @@ void CScientist::Spawn( void ) //========================================================= void CScientist::Precache( void ) { - PRECACHE_MODEL( "models/scientist.mdl" ); + if( FClassnameIs( pev, "monster_cleansuit_scientist" ) ) + PRECACHE_MODEL( "models/cleansuit_scientist.mdl" ); + else + PRECACHE_MODEL( "models/scientist.mdl" ); + PRECACHE_SOUND( "scientist/sci_pain1.wav" ); PRECACHE_SOUND( "scientist/sci_pain2.wav" ); PRECACHE_SOUND( "scientist/sci_pain3.wav" ); @@ -1052,7 +1061,10 @@ MONSTERSTATE CScientist::GetIdealState( void ) } BOOL CScientist::CanHeal( void ) -{ +{ + if( FClassnameIs( pev, "monster_cleansuit_scientist" ) ) + return FALSE; + if( ( m_healTime > gpGlobals->time ) || ( m_hTargetEnt == 0 ) || ( m_hTargetEnt->pev->health > ( m_hTargetEnt->pev->max_health * 0.5 ) ) ) return FALSE; @@ -1120,15 +1132,31 @@ void CDeadScientist::KeyValue( KeyValueData *pkvd ) else CBaseMonster::KeyValue( pkvd ); } + LINK_ENTITY_TO_CLASS( monster_scientist_dead, CDeadScientist ) +LINK_ENTITY_TO_CLASS( monster_cleansuit_scientist_dead, CDeadScientist ) +LINK_ENTITY_TO_CLASS( monster_civ_scientist_dead, CDeadScientist ) // // ********** DeadScientist SPAWN ********** // void CDeadScientist::Spawn() { - PRECACHE_MODEL( "models/scientist.mdl" ); - SET_MODEL( ENT( pev ), "models/scientist.mdl" ); + if( FClassnameIs( pev, "monster_cleansuit_scientist_dead" ) ) + { + PRECACHE_MODEL( "models/cleansuit_scientist.mdl" ); + SET_MODEL( ENT( pev ), "models/cleansuit_scientist.mdl" ); + } + else if( FClassnameIs( pev, "monster_civ_scientist_dead" ) ) + { + PRECACHE_MODEL( "models/civ_scientist.mdl" ); + SET_MODEL( ENT( pev ), "models/civ_scientist.mdl" ); + } + else + { + PRECACHE_MODEL( "models/scientist.mdl" ); + SET_MODEL( ENT( pev ), "models/scientist.mdl" ); + } pev->effects = 0; pev->sequence = 0; diff --git a/dlls/zombie.cpp b/dlls/zombie.cpp index 27ff0ff7..6aa58f64 100644 --- a/dlls/zombie.cpp +++ b/dlls/zombie.cpp @@ -324,3 +324,75 @@ int CZombie::IgnoreConditions( void ) return iIgnore; } + +//========================================================= +// DEAD ZGRUNT PROP +//========================================================= +class CDeadZGrunt : public CBaseMonster +{ +public: + void Spawn(); + int Classify() { return CLASS_ALIEN_MONSTER; } + + void KeyValue( KeyValueData *pkvd ); + + int m_iPose;// which sequence to display -- temporary, don't need to save + static char *m_szPoses[2]; +}; + +char *CDeadZGrunt::m_szPoses[] = +{ + "dead_on_back", + "dead_on_stomach" +}; + +void CDeadZGrunt::KeyValue( KeyValueData *pkvd ) +{ + if( FStrEq( pkvd->szKeyName, "pose" ) ) + { + m_iPose = atoi( pkvd->szValue ); + pkvd->fHandled = TRUE; + } + else + CBaseMonster::KeyValue( pkvd ); +} + +LINK_ENTITY_TO_CLASS( monster_zombie_soldier_dead, CDeadZGrunt ) +LINK_ENTITY_TO_CLASS( monster_zgrunt_dead, CDeadZGrunt ) + +//========================================================= +// ********** DeadZGrunt SPAWN ********** +//========================================================= +void CDeadZGrunt::Spawn() +{ + if( FClassnameIs( pev, "monster_zgrunt_dead" ) ) + { + PRECACHE_MODEL( "models/zgrunt.mdl" ); + SET_MODEL( ENT( pev ), "models/zgrunt.mdl" ); + } + else + { + PRECACHE_MODEL( "models/zombie_soldier.mdl" ); + SET_MODEL( ENT( pev ), "models/zombie_soldier.mdl" ); + } + + pev->effects = 0; + pev->yaw_speed = 8; + pev->sequence = 0; + pev->body = 1; + m_bloodColor = BLOOD_COLOR_GREEN; + + pev->sequence = LookupSequence( m_szPoses[m_iPose] ); + + if( pev->sequence == -1 ) + { + ALERT( at_console, "Dead zombie soldier with bad pose\n" ); + pev->sequence = 0; + pev->effects = EF_BRIGHTFIELD; + } + + // Corpses have less health + pev->health = 8; + + MonsterInitDead(); +}