From e44490dd26cc9b1d84f6bc27e95f8fa4a612421a Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Tue, 5 Nov 2019 03:40:21 +0500 Subject: [PATCH] Add monster_roy_dead implementation. --- dlls/redempt/roy.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/dlls/redempt/roy.cpp b/dlls/redempt/roy.cpp index bb9423ba..786037e0 100644 --- a/dlls/redempt/roy.cpp +++ b/dlls/redempt/roy.cpp @@ -389,3 +389,64 @@ void CRoy::DeclineFollowing( void ) { PlaySentence( "RO_POK", 2, VOL_NORM, ATTN_NORM ); } + +//========================================================= +// DEAD ROY PROP +// +// Designer selects a pose in worldcraft, 0 through num_poses-1 +// this value is added to what is selected as the 'first dead pose' +// among the monster's normal animations. All dead poses must +// appear sequentially in the model file. Be sure and set +// the m_iFirstPose properly! +// +//========================================================= +class CDeadRoy : public CBaseMonster +{ +public: + void Spawn( void ); + int Classify( void ) { return CLASS_PLAYER_ALLY; } + + void KeyValue( KeyValueData *pkvd ); + + int m_iPose;// which sequence to display -- temporary, don't need to save + static const char *m_szPoses[3]; +}; + +const char *CDeadRoy::m_szPoses[] = { "lying_on_back", "lying_on_side", "lying_on_stomach" }; + +void CDeadRoy::KeyValue( KeyValueData *pkvd ) +{ + if( FStrEq( pkvd->szKeyName, "pose" ) ) + { + m_iPose = atoi( pkvd->szValue ); + pkvd->fHandled = TRUE; + } + else + CBaseMonster::KeyValue( pkvd ); +} + +LINK_ENTITY_TO_CLASS( monster_roy_dead, CDeadRoy ) + +//========================================================= +// ********** DeadRoy SPAWN ********** +//========================================================= +void CDeadRoy::Spawn() +{ + PRECACHE_MODEL( "models/roy.mdl" ); + SET_MODEL( ENT( pev ), "models/roy.mdl" ); + + pev->effects = 0; + pev->yaw_speed = 8; + pev->sequence = 0; + m_bloodColor = BLOOD_COLOR_RED; + + pev->sequence = LookupSequence( m_szPoses[m_iPose] ); + if( pev->sequence == -1 ) + { + ALERT( at_console, "Dead roy with bad pose\n" ); + } + // Corpses have less health + pev->health = 8;//gSkillData.royHealth; + + MonsterInitDead(); +}