mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-24 05:34:18 +00:00
Update voltigore
This commit is contained in:
parent
dd526379c4
commit
ce39b99e71
@ -26,10 +26,11 @@
|
||||
#include "decals.h"
|
||||
#include "soundent.h"
|
||||
#include "game.h"
|
||||
#include "weapons.h"
|
||||
|
||||
#define VOLTIGORE_SPRINT_DIST 256 // how close the voltigore has to get before starting to sprint and refusing to swerve
|
||||
|
||||
#define VOLTIGORE_MAX_BEAMS 12
|
||||
#define VOLTIGORE_MAX_BEAMS 8
|
||||
|
||||
#define VOLTIGORE_CLASSNAME "monster_alien_voltigore"
|
||||
#define VOLTIGORE_BABY_CLASSNAME "monster_alien_babyvoltigore"
|
||||
@ -39,10 +40,10 @@
|
||||
#define VOLTIGORE_ZAP_BLUE 255
|
||||
#define VOLTIGORE_ZAP_BEAM "sprites/lgtning.spr"
|
||||
#define VOLTIGORE_ZAP_NOISE 80
|
||||
#define VOLTIGORE_ZAP_WIDTH 40
|
||||
#define VOLTIGORE_ZAP_WIDTH 30
|
||||
#define VOLTIGORE_ZAP_BRIGHTNESS 255
|
||||
#define VOLTIGORE_ZAP_DISTANCE 512
|
||||
#define VOLTIGORE_GLOW_SCALE 1.0f
|
||||
#define VOLTIGORE_GLOW_SCALE 0.75f
|
||||
#define VOLTIGORE_GIB_COUNT 9
|
||||
#define VOLTIGORE_GLOW_SPRITE "sprites/blueflare2.spr"
|
||||
|
||||
@ -68,8 +69,8 @@ public:
|
||||
void Spawn(void);
|
||||
|
||||
static void Shoot(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity);
|
||||
void Touch(CBaseEntity *pOther);
|
||||
void EXPORT BeamThink(void);
|
||||
void EXPORT BallTouch(CBaseEntity *pOther);
|
||||
void EXPORT FlyThink(void);
|
||||
|
||||
virtual int Save(CSave &save);
|
||||
virtual int Restore(CRestore &restore);
|
||||
@ -112,7 +113,7 @@ void CVoltigoreEnergyBall::Spawn(void)
|
||||
|
||||
pev->solid = SOLID_BBOX;
|
||||
pev->rendermode = kRenderTransAdd;
|
||||
pev->renderamt = 220;
|
||||
pev->renderamt = 255;
|
||||
|
||||
SET_MODEL(ENT(pev), VOLTIGORE_GLOW_SPRITE);
|
||||
pev->frame = 0;
|
||||
@ -135,14 +136,15 @@ void CVoltigoreEnergyBall::Shoot(entvars_t *pevOwner, Vector vecStart, Vector ve
|
||||
pEnergyBall->pev->velocity = vecVelocity;
|
||||
pEnergyBall->pev->owner = ENT(pevOwner);
|
||||
|
||||
pEnergyBall->SetThink(&CVoltigoreEnergyBall::BeamThink);
|
||||
pEnergyBall->SetTouch(&CVoltigoreEnergyBall::BallTouch);
|
||||
pEnergyBall->SetThink(&CVoltigoreEnergyBall::FlyThink);
|
||||
pEnergyBall->pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Purpose:
|
||||
//=========================================================
|
||||
void CVoltigoreEnergyBall::Touch(CBaseEntity *pOther)
|
||||
void CVoltigoreEnergyBall::BallTouch(CBaseEntity *pOther)
|
||||
{
|
||||
if (m_timeToDie) {
|
||||
return;
|
||||
@ -157,17 +159,18 @@ void CVoltigoreEnergyBall::Touch(CBaseEntity *pOther)
|
||||
}
|
||||
else
|
||||
{
|
||||
pOther->TakeDamage(pev, VARS( pev->owner ), gSkillData.voltigoreDmgBeam, DMG_SHOCK);
|
||||
pOther->TakeDamage(pev, VARS( pev->owner ), gSkillData.voltigoreDmgBeam, DMG_SHOCK|DMG_ALWAYSGIB);
|
||||
}
|
||||
pev->velocity = Vector(0,0,0);
|
||||
|
||||
m_timeToDie = gpGlobals->time + 0.3;
|
||||
ResetTouch();
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// Purpose:
|
||||
//=========================================================
|
||||
void CVoltigoreEnergyBall::BeamThink(void)
|
||||
void CVoltigoreEnergyBall::FlyThink(void)
|
||||
{
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
if (m_timeToDie)
|
||||
@ -628,26 +631,18 @@ void CVoltigore::HandleAnimEvent(MonsterEvent_t *pEvent)
|
||||
case VOLTIGORE_AE_THROW:
|
||||
{
|
||||
// SOUND HERE!
|
||||
Vector vecSpitOffset;
|
||||
Vector vecSpitDir;
|
||||
|
||||
UTIL_MakeVectors(pev->angles);
|
||||
|
||||
// !!!HACKHACK - the spot at which the spit originates (in front of the mouth) was measured in 3ds and hardcoded here.
|
||||
// we should be able to read the position of bones at runtime for this info.
|
||||
vecSpitOffset = (gpGlobals->v_right * 8 + gpGlobals->v_forward * 37 + gpGlobals->v_up * 23);
|
||||
vecSpitOffset = (pev->origin + vecSpitOffset);
|
||||
vecSpitDir = ((m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs) - vecSpitOffset).Normalize();
|
||||
|
||||
vecSpitDir.x += RANDOM_FLOAT(-0.01, 0.01);
|
||||
vecSpitDir.y += RANDOM_FLOAT(-0.01, 0.01);
|
||||
vecSpitDir.z += RANDOM_FLOAT(-0.01, 0);
|
||||
|
||||
Vector vecSpitOrigin, vecAngles;
|
||||
GetAttachment(3, vecSpitOrigin, vecAngles);
|
||||
vecSpitDir = ShootAtEnemy(vecSpitOrigin);
|
||||
|
||||
// do stuff for this event.
|
||||
//AttackSound();
|
||||
|
||||
CVoltigoreEnergyBall::Shoot(pev, vecSpitOffset, vecSpitDir * 1000);
|
||||
CVoltigoreEnergyBall::Shoot(pev, vecSpitOrigin, vecSpitDir * 1000);
|
||||
|
||||
// turn the beam glow off.
|
||||
DestroyBeams();
|
||||
@ -665,12 +660,19 @@ void CVoltigore::HandleAnimEvent(MonsterEvent_t *pEvent)
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack(120, gSkillData.voltigoreDmgPunch, DMG_CLUB);
|
||||
if (pHurt)
|
||||
{
|
||||
pHurt->pev->punchangle.z = -15;
|
||||
pHurt->pev->punchangle.x = 15;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -150;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100;
|
||||
if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT))
|
||||
{
|
||||
pHurt->pev->punchangle.z = -15;
|
||||
pHurt->pev->punchangle.x = 15;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -150;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100;
|
||||
}
|
||||
|
||||
EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM);
|
||||
|
||||
Vector vecArmPos, vecArmAng;
|
||||
GetAttachment( 0, vecArmPos, vecArmAng );
|
||||
SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood.
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -685,11 +687,18 @@ void CVoltigore::HandleAnimEvent(MonsterEvent_t *pEvent)
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack(120, gSkillData.voltigoreDmgPunch, DMG_CLUB);
|
||||
if (pHurt)
|
||||
{
|
||||
pHurt->pev->punchangle.x = 20;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 150;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100;
|
||||
if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT))
|
||||
{
|
||||
pHurt->pev->punchangle.x = 20;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 150;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100;
|
||||
}
|
||||
|
||||
EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM);
|
||||
|
||||
Vector vecArmPos, vecArmAng;
|
||||
GetAttachment( 0, vecArmPos, vecArmAng );
|
||||
SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood.
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -814,7 +823,8 @@ Schedule_t slVoltigoreRangeAttack1[] =
|
||||
bits_COND_NEW_ENEMY |
|
||||
bits_COND_ENEMY_DEAD |
|
||||
bits_COND_HEAVY_DAMAGE |
|
||||
bits_COND_ENEMY_OCCLUDED |
|
||||
// Attack animation is quite long, so it's better to not stop it when enemy hides
|
||||
//bits_COND_ENEMY_OCCLUDED |
|
||||
bits_COND_NO_AMMO_LOADED,
|
||||
0,
|
||||
"Voltigore Range Attack1"
|
||||
@ -1041,7 +1051,7 @@ void CVoltigore::Killed(entvars_t *pevAttacker, int iGib)
|
||||
WRITE_SHORT( m_beamTexture );
|
||||
WRITE_BYTE( 0 ); // framestart
|
||||
WRITE_BYTE( 10 ); // framerate
|
||||
WRITE_BYTE( RANDOM_LONG( 10, 15 ) ); // life
|
||||
WRITE_BYTE( RANDOM_LONG( 8, 10 ) ); // life
|
||||
WRITE_BYTE( VOLTIGORE_ZAP_WIDTH ); // width
|
||||
WRITE_BYTE( VOLTIGORE_ZAP_NOISE ); // noise
|
||||
WRITE_BYTE( VOLTIGORE_ZAP_RED ); // r, g, b
|
||||
@ -1151,7 +1161,7 @@ void CVoltigore::UpdateBeams()
|
||||
void CVoltigore::CreateGlow()
|
||||
{
|
||||
m_pBeamGlow = CSprite::SpriteCreate(VOLTIGORE_GLOW_SPRITE, pev->origin, FALSE);
|
||||
m_pBeamGlow->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation);
|
||||
m_pBeamGlow->SetTransparency(kRenderTransAdd, 255, 255, 255, 0, kRenderFxNoDissipation);
|
||||
m_pBeamGlow->SetAttachment(edict(), 4);
|
||||
m_pBeamGlow->SetScale(VOLTIGORE_GLOW_SCALE);
|
||||
}
|
||||
@ -1263,12 +1273,19 @@ void CBabyVoltigore::HandleAnimEvent(MonsterEvent_t* pEvent)
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack(70, gSkillData.babyVoltigoreDmgPunch, DMG_CLUB | DMG_ALWAYSGIB);
|
||||
if (pHurt)
|
||||
{
|
||||
pHurt->pev->punchangle.z = -10;
|
||||
pHurt->pev->punchangle.x = 10;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -100;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50;
|
||||
if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT))
|
||||
{
|
||||
pHurt->pev->punchangle.z = -10;
|
||||
pHurt->pev->punchangle.x = 10;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -100;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50;
|
||||
}
|
||||
|
||||
EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM);
|
||||
|
||||
Vector vecArmPos, vecArmAng;
|
||||
GetAttachment( 0, vecArmPos, vecArmAng );
|
||||
SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood.
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1282,11 +1299,18 @@ void CBabyVoltigore::HandleAnimEvent(MonsterEvent_t* pEvent)
|
||||
CBaseEntity *pHurt = CheckTraceHullAttack(70, gSkillData.babyVoltigoreDmgPunch, DMG_CLUB | DMG_ALWAYSGIB);
|
||||
if (pHurt)
|
||||
{
|
||||
pHurt->pev->punchangle.x = 15;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 100;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50;
|
||||
if (FBitSet(pHurt->pev->flags, FL_MONSTER|FL_CLIENT))
|
||||
{
|
||||
pHurt->pev->punchangle.x = 15;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 100;
|
||||
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 50;
|
||||
}
|
||||
|
||||
EMIT_SOUND(ENT(pev), CHAN_VOICE, RANDOM_SOUND_ARRAY(pMeleeHitSounds), RANDOM_FLOAT(0.8, 0.9), ATTN_NORM);
|
||||
|
||||
Vector vecArmPos, vecArmAng;
|
||||
GetAttachment( 0, vecArmPos, vecArmAng );
|
||||
SpawnBlood( vecArmPos, pHurt->BloodColor(), 25 );// a little surface blood.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user