Added semi-standardized custom model support to several NPCs

This commit is contained in:
Blixibon 2021-03-07 12:03:32 -06:00
parent 92866ca2fa
commit 251725c987
10 changed files with 31 additions and 26 deletions

View File

@ -98,6 +98,11 @@ extern bool AIStrongOpt( void );
#ifdef MAPBASE
// Defines Mapbase's extended NPC response system usage.
#define EXPANDED_RESPONSE_SYSTEM_USAGE
// Use the model keyvalue if it is defined
#define DefaultOrCustomModel(defaultModel) GetModelName() != NULL_STRING ? STRING(GetModelName()) : defaultModel
#else
#define DefaultOrCustomModel() defaultModel
#endif
#ifdef EXPANDED_RESPONSE_SYSTEM_USAGE

View File

@ -277,17 +277,17 @@ void CNPC_Antlion::Spawn( void )
#ifdef HL2_EPISODIC
if ( IsWorker() )
{
SetModel( ANTLION_WORKER_MODEL );
SetModel( DefaultOrCustomModel(ANTLION_WORKER_MODEL) );
AddSpawnFlags( SF_NPC_LONG_RANGE );
SetBloodColor( BLOOD_COLOR_ANTLION_WORKER );
}
else
{
SetModel( ANTLION_MODEL );
SetModel( DefaultOrCustomModel(ANTLION_MODEL) );
SetBloodColor( BLOOD_COLOR_ANTLION );
}
#else
SetModel( ANTLION_MODEL );
SetModel( DefaultOrCustomModel(ANTLION_MODEL) );
SetBloodColor( BLOOD_COLOR_YELLOW );
#endif // HL2_EPISODIC

View File

@ -678,7 +678,7 @@ void CNPC_AntlionGuard::UpdateOnRemove( void )
//-----------------------------------------------------------------------------
void CNPC_AntlionGuard::Precache( void )
{
PrecacheModel( ANTLIONGUARD_MODEL );
PrecacheModel( DefaultOrCustomModel( ANTLIONGUARD_MODEL ) );
PrecacheScriptSound( "NPC_AntlionGuard.Shove" );
PrecacheScriptSound( "NPC_AntlionGuard.HitHard" );
@ -779,7 +779,7 @@ void CNPC_AntlionGuard::Spawn( void )
{
Precache();
SetModel( ANTLIONGUARD_MODEL );
SetModel( DefaultOrCustomModel( ANTLIONGUARD_MODEL ) );
// Switch our skin (for now), if we're the cavern guard
if ( m_bCavernBreed )

View File

@ -266,7 +266,7 @@ void CNPC_Barnacle::Spawn()
{
Precache( );
SetModel( "models/barnacle.mdl" );
SetModel( DefaultOrCustomModel( "models/barnacle.mdl" ) );
UTIL_SetSize( this, Vector(-16, -16, -40), Vector(16, 16, 0) );
SetSolid( SOLID_BBOX );
@ -2375,7 +2375,7 @@ const impactdamagetable_t &CNPC_Barnacle::GetPhysicsImpactDamageTable( void )
//=========================================================
void CNPC_Barnacle::Precache()
{
PrecacheModel("models/barnacle.mdl");
PrecacheModel( DefaultOrCustomModel( "models/barnacle.mdl" ) );
// Precache all gibs
for ( int i=0; i < ARRAYSIZE(m_szGibNames); i++ )

View File

@ -2433,7 +2433,7 @@ void CBaseHeadcrab::CreateDust( bool placeDecal )
//-----------------------------------------------------------------------------
void CHeadcrab::Precache( void )
{
PrecacheModel( "models/headcrabclassic.mdl" );
PrecacheModel( DefaultOrCustomModel( "models/headcrabclassic.mdl" ) );
PrecacheScriptSound( "NPC_HeadCrab.Gib" );
PrecacheScriptSound( "NPC_HeadCrab.Idle" );
@ -2455,7 +2455,7 @@ void CHeadcrab::Precache( void )
void CHeadcrab::Spawn( void )
{
Precache();
SetModel( "models/headcrabclassic.mdl" );
SetModel( DefaultOrCustomModel( "models/headcrabclassic.mdl" ) );
BaseClass::Spawn();
@ -2570,7 +2570,7 @@ END_DATADESC()
//-----------------------------------------------------------------------------
void CFastHeadcrab::Precache( void )
{
PrecacheModel( "models/headcrab.mdl" );
PrecacheModel( DefaultOrCustomModel( "models/headcrab.mdl" ) );
PrecacheScriptSound( "NPC_FastHeadcrab.Idle" );
PrecacheScriptSound( "NPC_FastHeadcrab.Alert" );
@ -2589,7 +2589,7 @@ void CFastHeadcrab::Precache( void )
void CFastHeadcrab::Spawn( void )
{
Precache();
SetModel( "models/headcrab.mdl" );
SetModel( DefaultOrCustomModel( "models/headcrab.mdl" ) );
BaseClass::Spawn();
@ -3089,7 +3089,7 @@ void CBlackHeadcrab::TelegraphSound( void )
void CBlackHeadcrab::Spawn( void )
{
Precache();
SetModel( "models/headcrabblack.mdl" );
SetModel( DefaultOrCustomModel( "models/headcrabblack.mdl" ) );
BaseClass::Spawn();
@ -3106,7 +3106,7 @@ void CBlackHeadcrab::Spawn( void )
//-----------------------------------------------------------------------------
void CBlackHeadcrab::Precache( void )
{
PrecacheModel( "models/headcrabblack.mdl" );
PrecacheModel( DefaultOrCustomModel( "models/headcrabblack.mdl" ) );
PrecacheScriptSound( "NPC_BlackHeadcrab.Telegraph" );
PrecacheScriptSound( "NPC_BlackHeadcrab.Attack" );

View File

@ -2193,9 +2193,9 @@ void CNPC_Manhack::Precache(void)
//
// Model.
//
PrecacheModel("models/manhack.mdl");
PrecacheModel( DefaultOrCustomModel( "models/manhack.mdl" ) );
PrecacheModel( MANHACK_GLOW_SPRITE );
PropBreakablePrecacheAll( MAKE_STRING("models/manhack.mdl") );
PropBreakablePrecacheAll( MAKE_STRING( DefaultOrCustomModel( "models/manhack.mdl" ) ) );
PrecacheScriptSound( "NPC_Manhack.Die" );
PrecacheScriptSound( "NPC_Manhack.Bat" );
@ -2389,7 +2389,7 @@ void CNPC_Manhack::Spawn(void)
AddSpawnFlags( SF_NPC_FADE_CORPSE );
#endif // _XBOX
SetModel( "models/manhack.mdl" );
SetModel( DefaultOrCustomModel( "models/manhack.mdl" ) );
SetHullType(HULL_TINY_CENTERED);
SetHullSizeNormal();

View File

@ -256,11 +256,11 @@ void CNPC_CScanner::Spawn(void)
if( m_bIsClawScanner )
{
SetModel( "models/shield_scanner.mdl");
SetModel( DefaultOrCustomModel( "models/shield_scanner.mdl" ) );
}
else
{
SetModel( "models/combine_scanner.mdl");
SetModel( DefaultOrCustomModel( "models/combine_scanner.mdl" ) );
}
m_iHealth = sk_scanner_health.GetFloat();
@ -565,7 +565,7 @@ void CNPC_CScanner::Precache(void)
// Model
if( m_bIsClawScanner )
{
PrecacheModel("models/shield_scanner.mdl");
PrecacheModel( DefaultOrCustomModel( "models/shield_scanner.mdl" ) );
PrecacheModel("models/gibs/Shield_Scanner_Gib1.mdl");
PrecacheModel("models/gibs/Shield_Scanner_Gib2.mdl");
@ -591,7 +591,7 @@ void CNPC_CScanner::Precache(void)
}
else
{
PrecacheModel("models/combine_scanner.mdl");
PrecacheModel( DefaultOrCustomModel( "models/combine_scanner.mdl" ) );
PrecacheModel("models/gibs/scanner_gib01.mdl" );
PrecacheModel("models/gibs/scanner_gib02.mdl" );

View File

@ -278,7 +278,7 @@ void CNPC_Stalker::Spawn( void )
{
Precache( );
SetModel( "models/stalker.mdl" );
SetModel( DefaultOrCustomModel( "models/stalker.mdl" ) );
SetHullType(HULL_HUMAN);
SetHullSizeNormal();
@ -321,7 +321,7 @@ void CNPC_Stalker::Spawn( void )
//-----------------------------------------------------------------------------
void CNPC_Stalker::Precache( void )
{
PrecacheModel("models/stalker.mdl");
PrecacheModel( DefaultOrCustomModel( "models/stalker.mdl" ) );
PrecacheModel("sprites/laser.vmt");
PrecacheModel("sprites/redglow1.vmt");

View File

@ -304,7 +304,7 @@ CNPC_CeilingTurret::~CNPC_CeilingTurret( void )
//-----------------------------------------------------------------------------
void CNPC_CeilingTurret::Precache( void )
{
PrecacheModel( CEILING_TURRET_MODEL );
PrecacheModel( DefaultOrCustomModel( CEILING_TURRET_MODEL ) );
PrecacheModel( CEILING_TURRET_GLOW_SPRITE );
// Activities
@ -347,7 +347,7 @@ void CNPC_CeilingTurret::Spawn( void )
{
Precache();
SetModel( CEILING_TURRET_MODEL );
SetModel( DefaultOrCustomModel( CEILING_TURRET_MODEL ) );
BaseClass::Spawn();

View File

@ -69,7 +69,7 @@ END_DATADESC()
void CNPC_GroundTurret::Precache( void )
{
PrecacheModel( GROUNDTURRET_BEAM_SPRITE );
PrecacheModel( "models/combine_turrets/ground_turret.mdl" );
PrecacheModel( DefaultOrCustomModel( "models/combine_turrets/ground_turret.mdl" ) );
PrecacheScriptSound( "NPC_CeilingTurret.Deploy" );
m_ShotSounds = PrecacheScriptSound( "NPC_FloorTurret.ShotSounds" );
@ -88,7 +88,7 @@ void CNPC_GroundTurret::Spawn( void )
{
Precache();
UTIL_SetModel( this, "models/combine_turrets/ground_turret.mdl" );
UTIL_SetModel( this, DefaultOrCustomModel( "models/combine_turrets/ground_turret.mdl" ) );
SetNavType( NAV_FLY );
SetSolid( SOLID_VPHYSICS );