Browse Source

Add shocktrooper eye blinking. Adjust attack, health, reload and size.

opforfixed
Roman Chistokhodov 7 years ago
parent
commit
b8178cf0a0
  1. 67
      dlls/gearbox/strooper.cpp

67
dlls/gearbox/strooper.cpp

@ -112,6 +112,7 @@ class CStrooper : public CHGrunt
{ {
public: public:
void Spawn(void); void Spawn(void);
void MonsterThink();
void Precache(void); void Precache(void);
int Classify(void); int Classify(void);
void HandleAnimEvent(MonsterEvent_t *pEvent); void HandleAnimEvent(MonsterEvent_t *pEvent);
@ -134,6 +135,9 @@ public:
static TYPEDESCRIPTION m_SaveData[]; static TYPEDESCRIPTION m_SaveData[];
BOOL m_fRightClaw; BOOL m_fRightClaw;
float m_rechargeTime;
float m_blinkTime;
float m_eyeChangeTime;
static const char *pGruntSentences[]; static const char *pGruntSentences[];
}; };
@ -143,6 +147,9 @@ LINK_ENTITY_TO_CLASS(monster_shocktrooper, CStrooper);
TYPEDESCRIPTION CStrooper::m_SaveData[] = TYPEDESCRIPTION CStrooper::m_SaveData[] =
{ {
DEFINE_FIELD(CStrooper, m_fRightClaw, FIELD_BOOLEAN), DEFINE_FIELD(CStrooper, m_fRightClaw, FIELD_BOOLEAN),
DEFINE_FIELD(CStrooper, m_rechargeTime, FIELD_TIME),
DEFINE_FIELD(CStrooper, m_blinkTime, FIELD_TIME),
DEFINE_FIELD(CStrooper, m_eyeChangeTime, FIELD_TIME),
}; };
IMPLEMENT_SAVERESTORE(CStrooper, CHGrunt); IMPLEMENT_SAVERESTORE(CStrooper, CHGrunt);
@ -336,8 +343,8 @@ void CStrooper::HandleAnimEvent(MonsterEvent_t *pEvent)
case STROOPER_AE_BURST1: case STROOPER_AE_BURST1:
{ {
//Shoot(); if (m_hEnemy)
{
Vector vecGunPos; Vector vecGunPos;
Vector vecGunAngles; Vector vecGunAngles;
@ -350,28 +357,25 @@ void CStrooper::HandleAnimEvent(MonsterEvent_t *pEvent)
WRITE_COORD( vecGunPos.z ); WRITE_COORD( vecGunPos.z );
WRITE_SHORT( iStrooperMuzzleFlash ); // model WRITE_SHORT( iStrooperMuzzleFlash ); // model
WRITE_BYTE( 4 ); // size * 10 WRITE_BYTE( 4 ); // size * 10
WRITE_BYTE( 196 ); // brightness WRITE_BYTE( 128 ); // brightness
MESSAGE_END(); MESSAGE_END();
if (m_hEnemy) Vector vecShootOrigin = GetGunPosition();
{ Vector vecShootDir = ShootAtEnemy( vecShootOrigin );
vecGunAngles = (m_hEnemy->EyePosition() - vecGunPos).Normalize(); vecGunAngles = UTIL_VecToAngles(vecShootDir);
}
else
{
vecGunAngles = (m_vecEnemyLKP - vecGunPos).Normalize();
}
CBaseEntity *pShock = CBaseEntity::Create("shock_beam", vecGunPos, pev->angles, edict()); CBaseEntity *pShock = CBaseEntity::Create("shock_beam", vecShootOrigin, vecGunAngles, edict());
vecGunAngles.z += RANDOM_FLOAT( -0.05, 0 ); vecGunAngles.z += RANDOM_FLOAT( -0.05, 0 );
pShock->pev->velocity = vecGunAngles * 2000; pShock->pev->velocity = vecShootDir * 2000;
pShock->pev->nextthink = gpGlobals->time; pShock->pev->nextthink = gpGlobals->time;
m_cAmmoLoaded--;
SetBlending( 0, vecGunAngles.x );
// Play fire sound. // Play fire sound.
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM); EMIT_SOUND(ENT(pev), CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM);
CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3); CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3);
} }
}
break; break;
case STROOPER_AE_KICK: case STROOPER_AE_KICK:
@ -419,13 +423,13 @@ void CStrooper::Spawn()
Precache(); Precache();
SET_MODEL(ENT(pev), "models/strooper.mdl"); SET_MODEL(ENT(pev), "models/strooper.mdl");
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX); UTIL_SetSize( pev, Vector(-24, -24, 0), Vector(24, 24, 72) );
pev->solid = SOLID_SLIDEBOX; pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP; pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN; m_bloodColor = BLOOD_COLOR_GREEN;
pev->effects = 0; pev->effects = 0;
pev->health = gSkillData.strooperHealth; pev->health = gSkillData.strooperHealth * 2.5;
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE; m_MonsterState = MONSTERSTATE_NONE;
m_flNextGrenadeCheck = gpGlobals->time + 1; m_flNextGrenadeCheck = gpGlobals->time + 1;
@ -445,17 +449,46 @@ void CStrooper::Spawn()
pev->weapons = STROOPER_SHOCKRIFLE | STROOPER_HANDGRENADE; pev->weapons = STROOPER_SHOCKRIFLE | STROOPER_HANDGRENADE;
} }
m_cClipSize = SHOCKRIFLE_MAX_CLIP; m_cClipSize = gSkillData.strooperMaxCharge;
m_cAmmoLoaded = m_cClipSize; m_cAmmoLoaded = m_cClipSize;
m_fRightClaw = FALSE; m_fRightClaw = FALSE;
CTalkMonster::g_talkWaitTime = 0; CTalkMonster::g_talkWaitTime = 0;
m_rechargeTime = gpGlobals->time + gSkillData.strooperRchgSpeed;
m_blinkTime = gpGlobals->time + RANDOM_FLOAT(3.0f, 7.0f);
MonsterInit(); MonsterInit();
} }
void CStrooper::MonsterThink()
{
if (m_cAmmoLoaded < m_cClipSize)
{
if (m_rechargeTime < gpGlobals->time)
{
m_cAmmoLoaded++;
m_rechargeTime = gpGlobals->time + gSkillData.strooperRchgSpeed;
}
}
if (m_blinkTime <= gpGlobals->time && pev->skin == 0) {
pev->skin = 1;
m_blinkTime = gpGlobals->time + RANDOM_FLOAT(3.0f, 7.0f);
m_eyeChangeTime = gpGlobals->time + 0.1;
}
if (pev->skin != 0) {
if (m_eyeChangeTime <= gpGlobals->time) {
m_eyeChangeTime = gpGlobals->time + 0.1;
pev->skin++;
if (pev->skin > 3) {
pev->skin = 0;
}
}
}
CHGrunt::MonsterThink();
}
//========================================================= //=========================================================
// Precache - precaches all resources this monster needs // Precache - precaches all resources this monster needs
//========================================================= //=========================================================

Loading…
Cancel
Save