From d4ecb16bf7d99f1c668ebf5ed4a046c282630a30 Mon Sep 17 00:00:00 2001 From: Giegue Date: Fri, 24 Feb 2023 14:49:55 -0300 Subject: [PATCH] Add custom model support. --- src/dlls/apache.cpp | 2 +- src/dlls/barney.cpp | 2 +- src/dlls/bigmomma.cpp | 2 +- src/dlls/bullsquid.cpp | 2 +- src/dlls/cmbaseextra.h | 3 ++- src/dlls/controller.cpp | 2 +- src/dlls/dllapi.cpp | 3 +-- src/dlls/gargantua.cpp | 4 ++-- src/dlls/gonome.cpp | 2 +- src/dlls/hassassin.cpp | 2 +- src/dlls/headcrab.cpp | 4 ++-- src/dlls/hgrunt.cpp | 2 +- src/dlls/houndeye.cpp | 2 +- src/dlls/hwgrunt.cpp | 11 +---------- src/dlls/islave.cpp | 2 +- src/dlls/massn.cpp | 2 +- src/dlls/monster_api.cpp | 4 ++-- src/dlls/monster_config.cpp | 32 ++++++++++++++++++++++++++++++++ src/dlls/monstermaker.cpp | 16 +++++++++++++++- src/dlls/monsters.cpp | 5 +++++ src/dlls/otis.cpp | 2 +- src/dlls/pitdrone.cpp | 2 +- src/dlls/rgrunt.cpp | 2 +- src/dlls/scientist.cpp | 2 +- src/dlls/strooper.cpp | 2 +- src/dlls/stukabat.cpp | 2 +- src/dlls/turret.cpp | 6 +++--- src/dlls/voltigore.cpp | 4 ++-- src/dlls/zombie.cpp | 2 +- 29 files changed, 85 insertions(+), 43 deletions(-) diff --git a/src/dlls/apache.cpp b/src/dlls/apache.cpp index b1906b2..a5f68ea 100644 --- a/src/dlls/apache.cpp +++ b/src/dlls/apache.cpp @@ -35,7 +35,7 @@ void CMApache :: Spawn( void ) pev->movetype = MOVETYPE_FLY; pev->solid = SOLID_BBOX; - SET_MODEL(ENT(pev), "models/apache.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/apache.mdl")); UTIL_SetSize( pev, Vector( -32, -32, -64 ), Vector( 32, 32, 0 ) ); UTIL_SetOrigin( pev, pev->origin ); diff --git a/src/dlls/barney.cpp b/src/dlls/barney.cpp index 848f2d1..c5252f7 100644 --- a/src/dlls/barney.cpp +++ b/src/dlls/barney.cpp @@ -345,7 +345,7 @@ void CMBarney :: Spawn() // when a level is loaded, nobody will talk (time is reset to 0) TalkInit(); - SET_MODEL(ENT(pev), "models/barney.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/barney.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/bigmomma.cpp b/src/dlls/bigmomma.cpp index 48fbd08..f2f9f65 100644 --- a/src/dlls/bigmomma.cpp +++ b/src/dlls/bigmomma.cpp @@ -603,7 +603,7 @@ void CMBigMomma :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/big_mom.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/big_mom.mdl")); // UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) ); UTIL_SetSize( pev, Vector( -64, -64, 0 ), Vector( 64, 64, 128 ) ); diff --git a/src/dlls/bullsquid.cpp b/src/dlls/bullsquid.cpp index 783a58e..9064814 100644 --- a/src/dlls/bullsquid.cpp +++ b/src/dlls/bullsquid.cpp @@ -608,7 +608,7 @@ void CMBullsquid :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/bullsquid.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/bullsquid.mdl")); UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) ); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/cmbaseextra.h b/src/dlls/cmbaseextra.h index cb8e9c7..69ddd8b 100644 --- a/src/dlls/cmbaseextra.h +++ b/src/dlls/cmbaseextra.h @@ -20,7 +20,8 @@ public: void MakeMonster( void ); int m_iMonsterIndex;// index of the monster(s) that will be created. - + string_t m_iszCustomModel;// custom model that the monster will use. + int m_cNumMonsters;// max number of monsters this ent can create int m_iMaxLiveChildren;// max number of monsters that this maker may have out at one time. diff --git a/src/dlls/controller.cpp b/src/dlls/controller.cpp index 54cc85e..60f5fe9 100644 --- a/src/dlls/controller.cpp +++ b/src/dlls/controller.cpp @@ -302,7 +302,7 @@ void CMController :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/controller.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/controller.mdl")); UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 )); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/dllapi.cpp b/src/dlls/dllapi.cpp index c758f30..8f358fc 100644 --- a/src/dlls/dllapi.cpp +++ b/src/dlls/dllapi.cpp @@ -806,7 +806,6 @@ void world_precache(void) PRECACHE_MODEL ("models/w_grenade.mdl"); } - void MonsterCommand(void) { int index; @@ -1259,7 +1258,7 @@ int mmDispatchSpawn( edict_t *pent ) process_monster_precache_cfg(); process_monster_cfg(); - + // node support. -Giegue // init the WorldGraph. WorldGraph.InitGraph(); diff --git a/src/dlls/gargantua.cpp b/src/dlls/gargantua.cpp index 476cac6..8f79e7b 100644 --- a/src/dlls/gargantua.cpp +++ b/src/dlls/gargantua.cpp @@ -664,7 +664,7 @@ void CMGargantua :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/garg.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/garg.mdl")); UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) ); pev->solid = SOLID_SLIDEBOX; @@ -1327,7 +1327,7 @@ void CMBabyGargantua::Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/babygarg.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/babygarg.mdl")); UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) ); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/gonome.cpp b/src/dlls/gonome.cpp index 8075178..f534bdd 100644 --- a/src/dlls/gonome.cpp +++ b/src/dlls/gonome.cpp @@ -616,7 +616,7 @@ void CMGonome::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/gonome.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/gonome.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/hassassin.cpp b/src/dlls/hassassin.cpp index ae567ef..3546a6c 100644 --- a/src/dlls/hassassin.cpp +++ b/src/dlls/hassassin.cpp @@ -215,7 +215,7 @@ void CMHAssassin :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/hassassin.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/hassassin.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/headcrab.cpp b/src/dlls/headcrab.cpp index 4fd5116..2a23f65 100644 --- a/src/dlls/headcrab.cpp +++ b/src/dlls/headcrab.cpp @@ -247,7 +247,7 @@ void CMHeadCrab :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/headcrab.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/headcrab.mdl")); UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 24)); pev->solid = SOLID_SLIDEBOX; @@ -461,7 +461,7 @@ Schedule_t* CMHeadCrab :: GetScheduleOfType ( int Type ) void CMBabyCrab :: Spawn( void ) { CMHeadCrab::Spawn(); - SET_MODEL(ENT(pev), "models/baby_headcrab.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/baby_headcrab.mdl")); pev->rendermode = kRenderTransTexture; pev->renderamt = 192; UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 24)); diff --git a/src/dlls/hgrunt.cpp b/src/dlls/hgrunt.cpp index 532a496..1f97329 100644 --- a/src/dlls/hgrunt.cpp +++ b/src/dlls/hgrunt.cpp @@ -831,7 +831,7 @@ void CMHGrunt :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/hgrunt.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/hgrunt.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/houndeye.cpp b/src/dlls/houndeye.cpp index 65bae96..cf0ef2b 100644 --- a/src/dlls/houndeye.cpp +++ b/src/dlls/houndeye.cpp @@ -267,7 +267,7 @@ void CMHoundeye :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/houndeye.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/houndeye.mdl")); UTIL_SetSize(pev, Vector ( -16, -16, 0 ), Vector ( 16, 16, 36 ) ); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/hwgrunt.cpp b/src/dlls/hwgrunt.cpp index c3159b4..09888bd 100644 --- a/src/dlls/hwgrunt.cpp +++ b/src/dlls/hwgrunt.cpp @@ -202,7 +202,7 @@ void CMHWGrunt::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/hwgrunt.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/hwgrunt.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; @@ -816,50 +816,41 @@ Schedule_t* CMHWGrunt :: GetScheduleOfType ( int Type ) case SCHED_HWGRUNT_ELOF_FAIL: { // human grunt is unable to move to a position that allows him to attack the enemy. - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_HWGRUNT_ELOF_FAIL\n" ); return &slHWGruntELOFFail[ 0 ]; } break; case SCHED_HWGRUNT_ESTABLISH_LINE_OF_FIRE: { - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_HWGRUNT_ESTABLISH_LINE_OF_FIRE\n" ); return &slHWGruntEstablishLineOfFire[ 0 ]; } break; case SCHED_RANGE_ATTACK1: { // no pistols yet, always do standing attack - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_RANGE_ATTACK1\n" ); return &slHWGruntRangeAttack1B[ 0 ]; } case SCHED_COMBAT_FACE: { - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_COMBAT_FACE\n" ); return &slHWGruntCombatFace[ 0 ]; } case SCHED_HWGRUNT_WAIT_FACE_ENEMY: { - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_HWGRUNT_WAIT_FACE_ENEMY\n" ); return &slHWGruntWaitInCover[ 0 ]; } case SCHED_HWGRUNT_SWEEP: { - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_HWGRUNT_SWEEP\n" ); return &slHWGruntSweep[ 0 ]; } case SCHED_VICTORY_DANCE: { - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_VICTORY_DANCE\n" ); return &slHWGruntVictoryDance[ 0 ]; } case SCHED_HWGRUNT_SUPPRESS: { - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_HWGRUNT_SUPPRESS\n" ); return &slHWGruntSuppress[ 0 ]; } case SCHED_FAIL: { - UTIL_ClientPrintAll( HUD_PRINTTALK, "* DEBUG: SCHED_FAIL\n" ); if ( m_hEnemy != NULL ) { // grunt has an enemy, so pick a different default fail schedule most likely to help recover. diff --git a/src/dlls/islave.cpp b/src/dlls/islave.cpp index 37c8df3..7230429 100644 --- a/src/dlls/islave.cpp +++ b/src/dlls/islave.cpp @@ -416,7 +416,7 @@ void CMISlave :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/islave.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/islave.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/massn.cpp b/src/dlls/massn.cpp index 99a9965..aa08dc9 100644 --- a/src/dlls/massn.cpp +++ b/src/dlls/massn.cpp @@ -215,7 +215,7 @@ void CMMassn::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/massn.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/massn.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/monster_api.cpp b/src/dlls/monster_api.cpp index bdd0b25..1beda0a 100644 --- a/src/dlls/monster_api.cpp +++ b/src/dlls/monster_api.cpp @@ -56,8 +56,8 @@ static META_FUNCTIONS gMetaFunctionTable = plugin_info_t Plugin_info = { META_INTERFACE_VERSION, // interface version "MonsterMod", // name - "3.0-dev", // version - "15/02/2023", // date in DD/MM/YYYY format + "3.0", // version + "24/02/2023", // date in DD/MM/YYYY format "botman, Rick90, Giegue", // original authors + recreation by... "https://github.com/JulianR0/monstermod-redo", // url "MONSTER", // logtag diff --git a/src/dlls/monster_config.cpp b/src/dlls/monster_config.cpp index 21875af..8ea9ba0 100644 --- a/src/dlls/monster_config.cpp +++ b/src/dlls/monster_config.cpp @@ -240,6 +240,38 @@ void scan_monster_cfg(FILE *fp) monster_spawnpoint[monster_spawn_count].spawnflags = x; } } + else if (strcmp(data[i].key, "model") == 0) + { + if (monster) + { + // only applicable for normal monsters + if (strcmp(data[kvd_index-1].value, "monstermaker") != 0) + { + // precache the custom model here + PRECACHE_MODEL( data[i].value ); + + // the entity will need the keyvalue + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].key, data[i].key); + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].value, data[i].value); + } + } + } + else if (strcmp(data[i].key, "new_model") == 0) + { + if (monster) + { + // only applicable for monstermaket entity + if (strcmp(data[kvd_index-1].value, "monstermaker") == 0) + { + // precache the custom model + PRECACHE_MODEL( data[i].value ); + + // the entity will need the keyvalue as well + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].key, data[i].key); + strcpy(monster_spawnpoint[monster_spawn_count].keyvalue[i].value, data[i].value); + } + } + } else if (strcmp(data[i].key, "monstertype") == 0) { if (monster) diff --git a/src/dlls/monstermaker.cpp b/src/dlls/monstermaker.cpp index 1d707c5..256dffb 100644 --- a/src/dlls/monstermaker.cpp +++ b/src/dlls/monstermaker.cpp @@ -60,6 +60,11 @@ void CMMonsterMaker :: KeyValue( KeyValueData *pkvd ) } pkvd->fHandled = TRUE; } + else if ( FStrEq(pkvd->szKeyName, "new_model") ) + { + m_iszCustomModel = ALLOC_STRING(pkvd->szValue); + pkvd->fHandled = TRUE; + } else CMBaseMonster::KeyValue( pkvd ); } @@ -118,6 +123,7 @@ void CMMonsterMaker :: Precache( void ) void CMMonsterMaker::MakeMonster( void ) { edict_t *pent; + pKVD keyvalue[1]; // sometimes, i don't know what am i doing. -Giegue int createSF = SF_MONSTER_FALL_TO_GROUND; if ( m_iMaxLiveChildren > 0 && m_cLiveChildren >= m_iMaxLiveChildren ) @@ -151,8 +157,16 @@ void CMMonsterMaker::MakeMonster( void ) if ( pev->spawnflags & SF_MONSTERMAKER_MONSTERCLIP ) createSF |= SF_MONSTER_HITMONSTERCLIP; + // Monster is to have a custom model? + if ( !FStringNull( m_iszCustomModel ) ) + { + // setup model keyvalue + strcpy(keyvalue[0].key, "model"); + strcpy(keyvalue[0].value, STRING( m_iszCustomModel )); + } + // Attempt to spawn monster - pent = spawn_monster(m_iMonsterIndex, pev->origin, pev->angles, createSF, NULL); + pent = spawn_monster(m_iMonsterIndex, pev->origin, pev->angles, createSF, keyvalue); if ( pent == NULL ) { ALERT ( at_console, "NULL Ent in MonsterMaker!\n" ); diff --git a/src/dlls/monsters.cpp b/src/dlls/monsters.cpp index 0c2fb66..56759a4 100644 --- a/src/dlls/monsters.cpp +++ b/src/dlls/monsters.cpp @@ -2609,6 +2609,11 @@ void CMBaseMonster :: KeyValue( KeyValueData *pkvd ) m_iClassifyOverride = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } + else if (FStrEq(pkvd->szKeyName, "model")) + { + pev->model = ALLOC_STRING( pkvd->szValue ); + pkvd->fHandled = TRUE; + } else { CMBaseToggle::KeyValue( pkvd ); diff --git a/src/dlls/otis.cpp b/src/dlls/otis.cpp index 5de9f58..cdf84af 100644 --- a/src/dlls/otis.cpp +++ b/src/dlls/otis.cpp @@ -137,7 +137,7 @@ void CMOtis::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/otis.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/otis.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/pitdrone.cpp b/src/dlls/pitdrone.cpp index 4bc4009..7474803 100644 --- a/src/dlls/pitdrone.cpp +++ b/src/dlls/pitdrone.cpp @@ -563,7 +563,7 @@ void CMPitdrone::Spawn() { Precache(); - SET_MODEL( ENT(pev), "models/pit_drone.mdl" ); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/pit_drone.mdl")); UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 48)); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/rgrunt.cpp b/src/dlls/rgrunt.cpp index 7d307bf..4fe806d 100644 --- a/src/dlls/rgrunt.cpp +++ b/src/dlls/rgrunt.cpp @@ -312,7 +312,7 @@ void CMRGrunt::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/rgrunt.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/rgrunt.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/scientist.cpp b/src/dlls/scientist.cpp index 3398bb5..e05ce3c 100644 --- a/src/dlls/scientist.cpp +++ b/src/dlls/scientist.cpp @@ -596,7 +596,7 @@ void CMScientist :: Spawn( void ) // when a level is loaded, nobody will talk (time is reset to 0) TalkInit(); - SET_MODEL(ENT(pev), "models/scientist.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/scientist.mdl")); UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/strooper.cpp b/src/dlls/strooper.cpp index 76c8554..fc5a709 100644 --- a/src/dlls/strooper.cpp +++ b/src/dlls/strooper.cpp @@ -370,7 +370,7 @@ void CMStrooper::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/strooper.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/strooper.mdl")); UTIL_SetSize( pev, Vector(-24, -24, 0), Vector(24, 24, 72) ); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/stukabat.cpp b/src/dlls/stukabat.cpp index 0dc7635..9f841c1 100644 --- a/src/dlls/stukabat.cpp +++ b/src/dlls/stukabat.cpp @@ -99,7 +99,7 @@ void CMStukabat :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/stukabat.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/stukabat.mdl")); UTIL_SetSize( pev, Vector( -12, -12, 0 ), Vector( 12, 12, 24 ) ); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/turret.cpp b/src/dlls/turret.cpp index c7d97cd..b2239e0 100644 --- a/src/dlls/turret.cpp +++ b/src/dlls/turret.cpp @@ -121,7 +121,7 @@ void CMBaseTurret::Precache( ) void CMTurret::Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/turret.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/turret.mdl")); pev->health = gSkillData.turretHealth; m_HackedGunPos = Vector( 0, 0, 12.75 ); m_flMaxSpin = TURRET_MAXSPIN; @@ -161,7 +161,7 @@ void CMTurret::Precache() void CMMiniTurret::Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/miniturret.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/miniturret.mdl")); pev->health = gSkillData.miniturretHealth; m_HackedGunPos = Vector( 0, 0, 12.75 ); m_flMaxSpin = 0; @@ -1014,7 +1014,7 @@ void CMSentry::Precache() void CMSentry::Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/sentry.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/sentry.mdl")); pev->health = gSkillData.sentryHealth; m_HackedGunPos = Vector( 0, 0, 48 ); pev->view_ofs.z = 48; diff --git a/src/dlls/voltigore.cpp b/src/dlls/voltigore.cpp index cf8ed6c..8e030b6 100644 --- a/src/dlls/voltigore.cpp +++ b/src/dlls/voltigore.cpp @@ -626,7 +626,7 @@ void CMVoltigore::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/voltigore.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/voltigore.mdl")); UTIL_SetSize(pev, Vector(-80, -80, 0), Vector(80, 80, 90)); pev->solid = SOLID_SLIDEBOX; @@ -1132,7 +1132,7 @@ void CMBabyVoltigore::Spawn() { Precache(); - SET_MODEL(ENT(pev), "models/baby_voltigore.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/baby_voltigore.mdl")); UTIL_SetSize(pev, Vector(-32, -32, 0), Vector(32, 32, 36)); pev->solid = SOLID_SLIDEBOX; diff --git a/src/dlls/zombie.cpp b/src/dlls/zombie.cpp index a66901a..32b48cc 100644 --- a/src/dlls/zombie.cpp +++ b/src/dlls/zombie.cpp @@ -246,7 +246,7 @@ void CMZombie :: Spawn() { Precache( ); - SET_MODEL(ENT(pev), "models/zombie.mdl"); + SET_MODEL(ENT(pev), (!FStringNull( pev->model ) ? STRING( pev->model ) : "models/zombie.mdl")); UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX ); pev->solid = SOLID_SLIDEBOX;