Skip to content

Commit b1f65f0

Browse files
Improved custom model support on most NPCs
Co-authored-by: Maestra Fenix <fenixmaestro@gmail.com>
1 parent 4194540 commit b1f65f0

13 files changed

+30
-31
lines changed

sp/src/game/server/hl2/npc_PoisonZombie.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ END_DATADESC()
256256
//-----------------------------------------------------------------------------
257257
void CNPC_PoisonZombie::Precache( void )
258258
{
259-
PrecacheModel("models/zombie/poison.mdl");
259+
PrecacheModel( DefaultOrCustomModel( "models/zombie/poison.mdl" ) );
260260

261261
PrecacheScriptSound( "NPC_PoisonZombie.Die" );
262262
PrecacheScriptSound( "NPC_PoisonZombie.ThrowWarn" );
@@ -509,7 +509,7 @@ void CNPC_PoisonZombie::SetZombieModel( void )
509509
}
510510
else
511511
{
512-
SetModel( "models/zombie/poison.mdl" );
512+
SetModel( DefaultOrCustomModel( "models/zombie/poison.mdl" ) );
513513
SetHullType(HULL_HUMAN);
514514
}
515515

sp/src/game/server/hl2/npc_antlion.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ void CNPC_Antlion::Precache( void )
472472
#ifdef HL2_EPISODIC
473473
if ( IsWorker() )
474474
{
475-
PrecacheModel( ANTLION_WORKER_MODEL );
476-
PropBreakablePrecacheAll( MAKE_STRING( ANTLION_WORKER_MODEL ) );
475+
PrecacheModel( DefaultOrCustomModel( ANTLION_WORKER_MODEL ) );
476+
PropBreakablePrecacheAll( MAKE_STRING( DefaultOrCustomModel( ANTLION_WORKER_MODEL ) ) );
477477
UTIL_PrecacheOther( "grenade_spit" );
478478
PrecacheParticleSystem( "blood_impact_antlion_worker_01" );
479479
PrecacheParticleSystem( "antlion_gib_02" );
@@ -482,8 +482,8 @@ void CNPC_Antlion::Precache( void )
482482
else
483483
#endif // HL2_EPISODIC
484484
{
485-
PrecacheModel( ANTLION_MODEL );
486-
PropBreakablePrecacheAll( MAKE_STRING( ANTLION_MODEL ) );
485+
PrecacheModel( DefaultOrCustomModel( ANTLION_MODEL ) );
486+
PropBreakablePrecacheAll( MAKE_STRING( DefaultOrCustomModel( ANTLION_MODEL ) ) );
487487
PrecacheParticleSystem( "blood_impact_antlion_01" );
488488
PrecacheParticleSystem( "AntlionGib" );
489489
}

sp/src/game/server/hl2/npc_combinecamera.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ CNPC_CombineCamera::~CNPC_CombineCamera()
275275
//-----------------------------------------------------------------------------
276276
void CNPC_CombineCamera::Precache()
277277
{
278-
PrecacheModel(COMBINE_CAMERA_MODEL);
278+
PrecacheModel( DefaultOrCustomModel( COMBINE_CAMERA_MODEL ) );
279279
PrecacheModel(COMBINE_CAMERA_GLOW_SPRITE);
280280
PrecacheModel(COMBINE_CAMERA_FLASH_SPRITE);
281281

@@ -304,8 +304,7 @@ void CNPC_CombineCamera::Precache()
304304
void CNPC_CombineCamera::Spawn()
305305
{
306306
Precache();
307-
308-
SetModel(COMBINE_CAMERA_MODEL);
307+
SetModel( DefaultOrCustomModel( COMBINE_CAMERA_MODEL ) );
309308

310309
m_pEyeFlash = CSprite::SpriteCreate(COMBINE_CAMERA_FLASH_SPRITE, GetLocalOrigin(), FALSE);
311310
m_pEyeFlash->SetTransparency(kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation);

sp/src/game/server/hl2/npc_combinedropship.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ CNPC_CombineDropship::~CNPC_CombineDropship(void)
921921
void CNPC_CombineDropship::Spawn( void )
922922
{
923923
Precache( );
924-
SetModel( "models/combine_dropship.mdl" );
924+
SetModel( DefaultOrCustomModel( "models/combine_dropship.mdl" ) );
925925

926926
#ifdef _XBOX
927927
AddEffects( EF_NOSHADOW );
@@ -1188,7 +1188,7 @@ void CNPC_CombineDropship::Activate( void )
11881188
void CNPC_CombineDropship::Precache( void )
11891189
{
11901190
// Models
1191-
PrecacheModel("models/combine_dropship.mdl");
1191+
PrecacheModel( DefaultOrCustomModel( "models/combine_dropship.mdl" ) );
11921192
switch ( m_iCrateType )
11931193
{
11941194
case CRATE_SOLDIER:

sp/src/game/server/hl2/npc_combinegunship.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,11 @@ void CNPC_CombineGunship::Spawn( void )
564564

565565
if ( HasSpawnFlags( SF_GUNSHIP_USE_CHOPPER_MODEL ) )
566566
{
567-
SetModel( "models/combine_helicopter.mdl" );
567+
SetModel( DefaultOrCustomModel( "models/combine_helicopter.mdl" ) );
568568
}
569569
else
570570
{
571-
SetModel( "models/gunship.mdl" );
571+
SetModel( DefaultOrCustomModel( "models/gunship.mdl" ) );
572572
}
573573

574574
ExtractBbox( SelectHeaviestSequence( ACT_GUNSHIP_PATROL ), m_cullBoxMins, m_cullBoxMaxs );
@@ -690,12 +690,12 @@ void CNPC_CombineGunship::Precache( void )
690690
{
691691
if ( HasSpawnFlags( SF_GUNSHIP_USE_CHOPPER_MODEL ) )
692692
{
693-
PrecacheModel( "models/combine_helicopter.mdl" );
693+
PrecacheModel( DefaultOrCustomModel( "models/combine_helicopter.mdl" ) );
694694
Chopper_PrecacheChunks( this );
695695
}
696696
else
697697
{
698-
PrecacheModel("models/gunship.mdl");
698+
PrecacheModel( DefaultOrCustomModel( "models/gunship.mdl" ) );
699699
}
700700

701701
PrecacheModel("sprites/lgtning.vmt");
@@ -725,7 +725,7 @@ void CNPC_CombineGunship::Precache( void )
725725
g_iGunshipEffectIndex = PrecacheModel( "sprites/physbeam.vmt" );
726726
}
727727

728-
PropBreakablePrecacheAll( MAKE_STRING("models/gunship.mdl") );
728+
PropBreakablePrecacheAll( MAKE_STRING( DefaultOrCustomModel( "models/gunship.mdl" ) ) );
729729

730730
BaseClass::Precache();
731731
}

sp/src/game/server/hl2/npc_dog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void CNPC_Dog::Spawn( void )
455455

456456
BaseClass::Spawn();
457457

458-
SetModel( "models/dog.mdl" );
458+
SetModel( DefaultOrCustomModel( "models/dog.mdl" ) );
459459

460460
SetHullType( HULL_WIDE_HUMAN );
461461
SetHullSizeNormal();
@@ -638,7 +638,7 @@ void CNPC_Dog::PullObject( bool bMantain )
638638
//-----------------------------------------------------------------------------
639639
void CNPC_Dog::Precache( void )
640640
{
641-
PrecacheModel( "models/dog.mdl" );
641+
PrecacheModel( DefaultOrCustomModel( "models/dog.mdl" ) );
642642

643643
PrecacheScriptSound( "Weapon_PhysCannon.Launch" );
644644

sp/src/game/server/hl2/npc_fastzombie.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ static const char *s_pLegsModel = "models/gibs/fast_zombie_legs.mdl";
396396
//-----------------------------------------------------------------------------
397397
void CFastZombie::Precache( void )
398398
{
399-
PrecacheModel("models/zombie/fast.mdl");
399+
PrecacheModel( DefaultOrCustomModel( "models/zombie/fast.mdl" ) );
400400
#ifdef HL2_EPISODIC
401401
PrecacheModel("models/zombie/Fast_torso.mdl");
402402
PrecacheScriptSound( "NPC_FastZombie.CarEnter1" );
@@ -773,7 +773,7 @@ void CFastZombie::SetZombieModel( void )
773773
}
774774
else
775775
{
776-
SetModel( "models/zombie/fast.mdl" );
776+
SetModel( DefaultOrCustomModel( "models/zombie/fast.mdl" ) );
777777
SetHullType(HULL_HUMAN);
778778
}
779779

sp/src/game/server/hl2/npc_fisherman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ END_DATADESC()
133133
//-----------------------------------------------------------------------------
134134
void CNPC_Fisherman::SelectModel()
135135
{
136-
SetModelName( AllocPooledString( FISHERMAN_MODEL ) );
136+
SetModelName( AllocPooledString( DefaultOrCustomModel( FISHERMAN_MODEL ) ) );
137137
}
138138

139139
//-----------------------------------------------------------------------------

sp/src/game/server/hl2/npc_gman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void CNPC_GMan::Spawn()
9797

9898
BaseClass::Spawn();
9999

100-
SetModel( "models/gman.mdl" );
100+
SetModel( DefaultOrCustomModel( "models/gman.mdl" ) );
101101

102102
SetHullType(HULL_HUMAN);
103103
SetHullSizeNormal();
@@ -123,7 +123,7 @@ void CNPC_GMan::Spawn()
123123
//-----------------------------------------------------------------------------
124124
void CNPC_GMan::Precache()
125125
{
126-
PrecacheModel( "models/gman.mdl" );
126+
PrecacheModel( DefaultOrCustomModel( "models/gman.mdl" ) );
127127

128128
BaseClass::Precache();
129129
}

sp/src/game/server/hl2/npc_monk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Activity CNPC_Monk::NPC_TranslateActivity( Activity eNewActivity )
299299
//-----------------------------------------------------------------------------
300300
void CNPC_Monk::Precache()
301301
{
302-
PrecacheModel( "models/Monk.mdl" );
302+
PrecacheModel( DefaultOrCustomModel( "models/Monk.mdl" ) );
303303

304304
PrecacheScriptSound( "NPC_Citizen.FootstepLeft" );
305305
PrecacheScriptSound( "NPC_Citizen.FootstepRight" );
@@ -317,7 +317,7 @@ void CNPC_Monk::Spawn()
317317

318318
BaseClass::Spawn();
319319

320-
SetModel( "models/Monk.mdl" );
320+
SetModel( DefaultOrCustomModel( "models/Monk.mdl" ) );
321321

322322
SetHullType(HULL_HUMAN);
323323
SetHullSizeNormal();

0 commit comments

Comments
 (0)