diff --git a/dlls/gearbox/shockroach.cpp b/dlls/gearbox/shockroach.cpp index 0aacfe21..4d3bf59a 100644 --- a/dlls/gearbox/shockroach.cpp +++ b/dlls/gearbox/shockroach.cpp @@ -76,10 +76,12 @@ void CShockRoach::Spawn() Precache(); SET_MODEL(ENT(pev), "models/w_shock_rifle.mdl"); + UTIL_SetOrigin(pev, pev->origin); pev->solid = SOLID_SLIDEBOX; - pev->movetype = MOVETYPE_STEP; + pev->movetype = MOVETYPE_FLY; m_bloodColor = BLOOD_COLOR_GREEN; + pev->effects = 0; pev->health = gSkillData.sroachHealth; pev->view_ofs = Vector(0, 0, 20);// position of the eyes relative to monster's origin. @@ -148,22 +150,25 @@ void CShockRoach::LeapTouch(CBaseEntity *pOther) //========================================================= // PrescheduleThink //========================================================= -void CShockRoach::PrescheduleThink(void) +void CShockRoach::MonsterThink(void) { - // explode when ready - if (!m_fRoachSolid && m_flBirthTime + 0.2 >= gpGlobals->time) { + float lifeTime = (gpGlobals->time - m_flBirthTime); + if (lifeTime >= 0.2) + { + pev->movetype = MOVETYPE_STEP; + } + if (!m_fRoachSolid && lifeTime >= 2.0 ) { m_fRoachSolid = TRUE; - UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 24)); + UTIL_SetSize(pev, Vector(-12, -12, 0), Vector(12, 12, 4)); } - // explode when ready - if (gpGlobals->time >= m_flBirthTime + gSkillData.sroachLifespan) + if (lifeTime >= gSkillData.sroachLifespan) { pev->health = -1; Killed(pev, 0); return; } - CHeadCrab::PrescheduleThink(); + CHeadCrab::MonsterThink(); } //========================================================= @@ -218,6 +223,8 @@ void CShockRoach::StartTask(Task_t *pTask) int CShockRoach::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) { + if ( gpGlobals->time - m_flBirthTime < 2.0 ) + flDamage = 0.0; // Skip headcrab's TakeDamage to avoid unwanted immunity to acid. return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType ); } diff --git a/dlls/gearbox/shockroach.h b/dlls/gearbox/shockroach.h index 6a60834a..fc511d59 100644 --- a/dlls/gearbox/shockroach.h +++ b/dlls/gearbox/shockroach.h @@ -29,7 +29,7 @@ public: void DeathSound(void); void IdleSound(void); void AlertSound(void); - void PrescheduleThink(void); + void MonsterThink(void); void StartTask(Task_t* pTask); int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ); diff --git a/dlls/gearbox/strooper.cpp b/dlls/gearbox/strooper.cpp index 03122bce..70ff289f 100644 --- a/dlls/gearbox/strooper.cpp +++ b/dlls/gearbox/strooper.cpp @@ -134,7 +134,7 @@ public: void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); virtual int SizeForGrapple() { return GRAPPLE_LARGE; } - void DropShockRoach(); + void DropShockRoach(bool gibbed); int Save(CSave &save); int Restore(CRestore &restore); @@ -212,7 +212,7 @@ void CStrooper::GibMonster(void) { if (GetBodygroup(GUN_GROUP) != GUN_NONE) { - DropShockRoach(); + DropShockRoach(true); } EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "common/bodysplat.wav", 1, ATTN_NORM ); @@ -299,7 +299,7 @@ void CStrooper::HandleAnimEvent(MonsterEvent_t *pEvent) { if (GetBodygroup(GUN_GROUP) != GUN_NONE) { - DropShockRoach(); + DropShockRoach(false); } } break; @@ -586,7 +586,7 @@ void CStrooper::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDi CSquadMonster::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType); } -void CStrooper::DropShockRoach() +void CStrooper::DropShockRoach(bool gibbed) { Vector vecGunPos; Vector vecGunAngles; @@ -594,19 +594,37 @@ void CStrooper::DropShockRoach() GetAttachment(0, vecGunPos, vecGunAngles); SetBodygroup(GUN_GROUP, GUN_NONE); - Vector vecDropAngles = vecGunAngles; + Vector vecDropAngles; // Remove any pitch. vecDropAngles.x = 0; + vecDropAngles.y = vecGunAngles.y; vecDropAngles.z = 0; Vector vecPos = pev->origin; - vecPos.z += 32; + if (gibbed) + vecPos.z += 32; + else + vecPos.z += 48; // now spawn a shockroach. CBaseEntity* roach = CBaseEntity::Create( "monster_shockroach", vecPos, vecDropAngles ); - if (ShouldFadeOnDeath()) - roach->pev->spawnflags |= SF_MONSTER_FADECORPSE; + if (roach) + { + if (ShouldFadeOnDeath()) + roach->pev->spawnflags |= SF_MONSTER_FADECORPSE; + if (gibbed) + { + roach->pev->velocity = Vector(RANDOM_FLOAT(-100.0f, 100.0f), RANDOM_FLOAT(-100.0f, 100.0f), RANDOM_FLOAT(200.0f, 300.0f)); + roach->pev->avelocity = Vector(0, RANDOM_FLOAT(200.0f, 300.0f), 0); + } + else + { + roach->pev->velocity = Vector(RANDOM_FLOAT(-20.0f, 20.0f) , RANDOM_FLOAT(-20.0f, 20.0f), RANDOM_FLOAT(20.0f, 30.0f)); + roach->pev->avelocity = Vector(0, RANDOM_FLOAT(20.0f, 40.0f), 0); + } + + } }