diff --git a/src/dlls/agrunt.cpp b/src/dlls/agrunt.cpp index b27cc3f..34de414 100644 --- a/src/dlls/agrunt.cpp +++ b/src/dlls/agrunt.cpp @@ -184,13 +184,8 @@ void CMAGrunt :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec if (flDamage <= 0) flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated } - else - { - SpawnBlood(ptr->vecEndPos, BloodColor(), flDamage);// a little surface blood. - TraceBleed( flDamage, vecDir, ptr, bitsDamageType ); - } - - AddMultiDamage( pevAttacker, this->edict(), flDamage, bitsDamageType ); + + CMBaseMonster::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType); } //========================================================= @@ -537,7 +532,7 @@ void CMAGrunt :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.agruntHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/barney.cpp b/src/dlls/barney.cpp index c5252f7..b9c56a5 100644 --- a/src/dlls/barney.cpp +++ b/src/dlls/barney.cpp @@ -350,7 +350,7 @@ void CMBarney :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_RED; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_RED : m_bloodColor; pev->health = gSkillData.barneyHealth; pev->view_ofs = Vector ( 0, 0, 50 );// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_FULL; diff --git a/src/dlls/bigmomma.cpp b/src/dlls/bigmomma.cpp index 3604f54..9701eb4 100644 --- a/src/dlls/bigmomma.cpp +++ b/src/dlls/bigmomma.cpp @@ -609,7 +609,7 @@ void CMBigMomma :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->health = 150 * gSkillData.bigmommaHealthFactor; pev->view_ofs = Vector ( 0, 0, 128 );// position of the eyes relative to monster's origin. m_flFieldOfView = 0.3;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/bullsquid.cpp b/src/dlls/bullsquid.cpp index dc0855d..625fbb3 100644 --- a/src/dlls/bullsquid.cpp +++ b/src/dlls/bullsquid.cpp @@ -615,7 +615,7 @@ void CMBullsquid :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.bullsquidHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/cmbaseextra.h b/src/dlls/cmbaseextra.h index ba38d05..cabde6f 100644 --- a/src/dlls/cmbaseextra.h +++ b/src/dlls/cmbaseextra.h @@ -21,6 +21,7 @@ public: 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_iMonsterBlood;//blood color of spawned monsters. 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 fd424f4..c8e9180 100644 --- a/src/dlls/controller.cpp +++ b/src/dlls/controller.cpp @@ -308,7 +308,7 @@ void CMController :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_FLY; pev->flags |= FL_FLY; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->health = gSkillData.controllerHealth; pev->view_ofs = Vector( 0, 0, -2 );// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_FULL;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/gargantua.cpp b/src/dlls/gargantua.cpp index 644be51..a19cfa4 100644 --- a/src/dlls/gargantua.cpp +++ b/src/dlls/gargantua.cpp @@ -683,7 +683,7 @@ void CMGargantua :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->health = gSkillData.gargantuaHealth; //pev->view_ofs = Vector ( 0, 0, 96 );// taken from mdl file m_flFieldOfView = -0.2;// width of forward view cone ( as a dotproduct result ) @@ -1325,7 +1325,7 @@ void CMBabyGargantua::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->health = gSkillData.babygargHealth; //pev->view_ofs = Vector ( 0, 0, 96 );// taken from mdl file m_flFieldOfView = -0.2;// width of forward view cone ( as a dotproduct result ) diff --git a/src/dlls/gonome.cpp b/src/dlls/gonome.cpp index 2a4b2be..f165e9d 100644 --- a/src/dlls/gonome.cpp +++ b/src/dlls/gonome.cpp @@ -613,7 +613,7 @@ void CMGonome::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.gonomeHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/hassassin.cpp b/src/dlls/hassassin.cpp index e58c90b..5564354 100644 --- a/src/dlls/hassassin.cpp +++ b/src/dlls/hassassin.cpp @@ -220,7 +220,7 @@ void CMHAssassin :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_RED; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_RED : m_bloodColor; pev->effects = 0; pev->health = gSkillData.hassassinHealth; m_flFieldOfView = VIEW_FIELD_WIDE; // indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/headcrab.cpp b/src/dlls/headcrab.cpp index 2a23f65..df5b607 100644 --- a/src/dlls/headcrab.cpp +++ b/src/dlls/headcrab.cpp @@ -252,7 +252,7 @@ void CMHeadCrab :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.headcrabHealth; pev->view_ofs = Vector ( 0, 0, 20 );// position of the eyes relative to monster's origin. diff --git a/src/dlls/hgrunt.cpp b/src/dlls/hgrunt.cpp index e1ce35b..cd25b19 100644 --- a/src/dlls/hgrunt.cpp +++ b/src/dlls/hgrunt.cpp @@ -832,7 +832,7 @@ void CMHGrunt :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_RED; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_RED : m_bloodColor; pev->effects = 0; pev->health = gSkillData.hgruntHealth; m_flFieldOfView = VIEW_FIELD_FULL; // indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/houndeye.cpp b/src/dlls/houndeye.cpp index 98c51c9..e52c5c3 100644 --- a/src/dlls/houndeye.cpp +++ b/src/dlls/houndeye.cpp @@ -272,7 +272,7 @@ void CMHoundeye :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_YELLOW; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.houndeyeHealth; pev->yaw_speed = 5;//!!! should we put this in the monster's changeanim function since turn rates may vary with state/anim? diff --git a/src/dlls/hwgrunt.cpp b/src/dlls/hwgrunt.cpp index 8d85d4a..5bc94f0 100644 --- a/src/dlls/hwgrunt.cpp +++ b/src/dlls/hwgrunt.cpp @@ -199,7 +199,7 @@ void CMHWGrunt::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_RED; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_RED : m_bloodColor; pev->effects = 0; pev->health = gSkillData.hwgruntHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/islave.cpp b/src/dlls/islave.cpp index c8a64a7..c943161 100644 --- a/src/dlls/islave.cpp +++ b/src/dlls/islave.cpp @@ -421,7 +421,7 @@ void CMISlave :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.slaveHealth; pev->view_ofs = Vector ( 0, 0, 64 );// position of the eyes relative to monster's origin. diff --git a/src/dlls/massn.cpp b/src/dlls/massn.cpp index 685cdb0..d688c86 100644 --- a/src/dlls/massn.cpp +++ b/src/dlls/massn.cpp @@ -227,7 +227,7 @@ void CMMassn::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_RED; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_RED : m_bloodColor; pev->effects = 0; pev->health = gSkillData.massnHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/monster_config.cpp b/src/dlls/monster_config.cpp index a5468bc..dc6ed9a 100644 --- a/src/dlls/monster_config.cpp +++ b/src/dlls/monster_config.cpp @@ -728,6 +728,8 @@ void scan_extra_cfg(FILE *fp) { char *cmd = strtok(input, " "); char *value = strtok(NULL, " "); + if (value == NULL) + continue; // command with no value, skip // Remove all quotes from "value" char parse[128] = {0}; diff --git a/src/dlls/monstermaker.cpp b/src/dlls/monstermaker.cpp index 0768114..f61957b 100644 --- a/src/dlls/monstermaker.cpp +++ b/src/dlls/monstermaker.cpp @@ -65,6 +65,11 @@ void CMMonsterMaker :: KeyValue( KeyValueData *pkvd ) m_iszCustomModel = ALLOC_STRING(pkvd->szValue); pkvd->fHandled = TRUE; } + else if ( FStrEq(pkvd->szKeyName, "bloodcolor") ) + { + m_iMonsterBlood = atoi(pkvd->szValue); + pkvd->fHandled = TRUE; + } else CMBaseMonster::KeyValue( pkvd ); } @@ -124,7 +129,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 + pKVD keyvalue[MAX_KEYVALUES]; // 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 ) @@ -165,6 +170,13 @@ void CMMonsterMaker::MakeMonster( void ) strcpy(keyvalue[0].key, "model"); strcpy(keyvalue[0].value, STRING( m_iszCustomModel )); } + // Override monster blood color? + if ( m_iMonsterBlood ) + { + // setup blood keyvalue + strcpy(keyvalue[1].key, "bloodcolor"); + sprintf(keyvalue[1].value, "%i", m_iMonsterBlood ); + } // Attempt to spawn monster pent = spawn_monster(m_iMonsterIndex, pev->origin, pev->angles, createSF, keyvalue); diff --git a/src/dlls/monsters.cpp b/src/dlls/monsters.cpp index 18a181e..1b10c63 100644 --- a/src/dlls/monsters.cpp +++ b/src/dlls/monsters.cpp @@ -2626,6 +2626,23 @@ void CMBaseMonster :: KeyValue( KeyValueData *pkvd ) m_iClassifyOverride = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } + else if (FStrEq(pkvd->szKeyName, "bloodcolor")) + { + switch ( atoi( pkvd->szValue ) ) + { + case -1: m_bloodColor = DONT_BLEED; break; + case 1: m_bloodColor = BLOOD_COLOR_RED; break; + case 2: m_bloodColor = BLOOD_COLOR_YELLOW; break; + case 3: m_bloodColor = BLOOD_COLOR_BLUE; break; + case 4: m_bloodColor = BLOOD_COLOR_PINK; break; + case 5: m_bloodColor = BLOOD_COLOR_WHITE; break; + case 6: m_bloodColor = BLOOD_COLOR_ORANGE; break; + case 7: m_bloodColor = BLOOD_COLOR_BLACK; break; + case 8: m_bloodColor = BLOOD_COLOR_GREEN; break; + default: m_bloodColor = 0; break; // Invalid, set default + } + pkvd->fHandled = TRUE; + } else { CMBaseToggle::KeyValue( pkvd ); diff --git a/src/dlls/otis.cpp b/src/dlls/otis.cpp index cdf84af..989038e 100644 --- a/src/dlls/otis.cpp +++ b/src/dlls/otis.cpp @@ -142,7 +142,7 @@ void CMOtis::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_RED; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_RED : m_bloodColor; pev->health = gSkillData.otisHealth; pev->view_ofs = Vector(0, 0, 50);// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello diff --git a/src/dlls/pitdrone.cpp b/src/dlls/pitdrone.cpp index 1ad3b06..ced809d 100644 --- a/src/dlls/pitdrone.cpp +++ b/src/dlls/pitdrone.cpp @@ -570,7 +570,7 @@ void CMPitdrone::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.pitdroneHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/scientist.cpp b/src/dlls/scientist.cpp index e05ce3c..f6ccdec 100644 --- a/src/dlls/scientist.cpp +++ b/src/dlls/scientist.cpp @@ -601,7 +601,7 @@ void CMScientist :: Spawn( void ) pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_RED; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_RED : m_bloodColor; pev->health = gSkillData.scientistHealth; pev->view_ofs = Vector ( 0, 0, 50 );// position of the eyes relative to monster's origin. m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so scientists will notice player and say hello diff --git a/src/dlls/shockroach.cpp b/src/dlls/shockroach.cpp index b922984..4dfd93e 100644 --- a/src/dlls/shockroach.cpp +++ b/src/dlls/shockroach.cpp @@ -69,7 +69,7 @@ void CMShockRoach::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_FLY; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = BLOOD_COLOR_YELLOW; pev->effects = 0; pev->health = gSkillData.roachHealth; diff --git a/src/dlls/strooper.cpp b/src/dlls/strooper.cpp index 6d1b3ff..a2bfb01 100644 --- a/src/dlls/strooper.cpp +++ b/src/dlls/strooper.cpp @@ -367,7 +367,7 @@ void CMStrooper::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.strooperHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/stukabat.cpp b/src/dlls/stukabat.cpp index 9fe7228..479ce34 100644 --- a/src/dlls/stukabat.cpp +++ b/src/dlls/stukabat.cpp @@ -105,7 +105,7 @@ void CMStukabat :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_FLY; pev->flags |= FL_FLY; - m_bloodColor = BLOOD_COLOR_YELLOW; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->health = gSkillData.stukabatHealth; pev->view_ofs = Vector ( 0, 0, 22 );// position of the eyes relative to monster's origin. m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/util.h b/src/dlls/util.h index 997588a..87074d5 100644 --- a/src/dlls/util.h +++ b/src/dlls/util.h @@ -149,7 +149,12 @@ inline BOOL FStringNull(int iString) { return iString == iStringNull; } #define DONT_BLEED -1 #define BLOOD_COLOR_RED (BYTE)247 #define BLOOD_COLOR_YELLOW (BYTE)195 -#define BLOOD_COLOR_GREEN BLOOD_COLOR_YELLOW +#define BLOOD_COLOR_BLUE (BYTE)211 // custom colors +#define BLOOD_COLOR_PINK (BYTE)147 +#define BLOOD_COLOR_WHITE (BYTE)11 +#define BLOOD_COLOR_ORANGE (BYTE)231 +#define BLOOD_COLOR_BLACK (BYTE)49 // not 100% accurate but close enough +#define BLOOD_COLOR_GREEN (BYTE)181 // ^ typedef enum { diff --git a/src/dlls/voltigore.cpp b/src/dlls/voltigore.cpp index 4533d2b..1d04cc7 100644 --- a/src/dlls/voltigore.cpp +++ b/src/dlls/voltigore.cpp @@ -635,7 +635,7 @@ void CMVoltigore::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.voltigoreHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) @@ -1143,7 +1143,7 @@ void CMBabyVoltigore::Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->effects = 0; pev->health = gSkillData.babyVoltigoreHealth; m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) diff --git a/src/dlls/zombie.cpp b/src/dlls/zombie.cpp index 84d587e..6cd2c42 100644 --- a/src/dlls/zombie.cpp +++ b/src/dlls/zombie.cpp @@ -241,7 +241,7 @@ void CMZombie :: Spawn() pev->solid = SOLID_SLIDEBOX; pev->movetype = MOVETYPE_STEP; - m_bloodColor = BLOOD_COLOR_GREEN; + m_bloodColor = !m_bloodColor ? BLOOD_COLOR_YELLOW : m_bloodColor; pev->health = gSkillData.zombieHealth; pev->view_ofs = VEC_VIEW;// position of the eyes relative to monster's origin. m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )