Skip to content

Commit

Permalink
'Desired skin color' parameter for human grunts
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Aug 1, 2024
1 parent 94f5fc8 commit 494facf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
28 changes: 25 additions & 3 deletions dlls/hgrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,17 @@ void CHGrunt::SpawnHelper(const char* modelName, int health, int bloodColor)
m_HackedGunPos = Vector( 0, 0, 55 );
}

void CHGrunt::KeyValue(KeyValueData *pkvd)
{
if( FStrEq(pkvd->szKeyName, "desired_skin" ) )
{
m_desiredSkin = atoi( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else
CFollowingMonster::KeyValue( pkvd );
}

void CHGrunt::Spawn()
{
SpawnHelper("models/hgrunt.mdl", gSkillData.hgruntHealth);
Expand All @@ -1018,10 +1029,21 @@ void CHGrunt::Spawn()
}
m_cAmmoLoaded = m_cClipSize;

if( RANDOM_LONG( 0, 99 ) < 80 )
pev->skin = 0; // light skin
if (m_desiredSkin == 1)
{
pev->skin = 0;
}
else if (m_desiredSkin == 2)
{
pev->skin = 1;
}
else
pev->skin = 1; // dark skin
{
if( RANDOM_LONG( 0, 99 ) < 80 )
pev->skin = 0; // light skin
else
pev->skin = 1; // dark skin
}

if( FBitSet( pev->weapons, HGRUNT_SHOTGUN ) )
{
Expand Down
3 changes: 2 additions & 1 deletion dlls/hgrunt.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef enum
class CHGrunt : public CFollowingMonster
{
public:
void KeyValue(KeyValueData* pkvd);
void Spawn( void );
void Precache( void );
void SetYawSpeed( void );
Expand Down Expand Up @@ -134,7 +135,7 @@ class CHGrunt : public CFollowingMonster

int m_iSentence;


short m_desiredSkin;
protected:
virtual void OnBecomingLeader();

Expand Down
6 changes: 6 additions & 0 deletions fgd/halflife.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -5125,6 +5125,12 @@
80 : "pipetoss"
81 : "plunger"
]
desired_skin(Choices) : "Desired skin color" =
[
0 : "Default"
1 : "Light"
2 : "Dark"
]
]
@PointClass base(Monster, TalkMonster, Sequence) size(-16 -16 0, 16 16 72) studio("models/hgrunt_opfor.mdl") = monster_human_grunt_ally : "Human Grunt Ally (camo)"
[
Expand Down

0 comments on commit 494facf

Please sign in to comment.