Added Disruptor-Effect to fx_phaser

Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
Harry Young 2011-12-03 15:59:57 +01:00
parent 491d98d1c2
commit 71435c116d
5 changed files with 69 additions and 2 deletions

View file

@ -1176,3 +1176,54 @@ void CG_ShowTrigger(centity_t *cent) {
}
}
//RPG-X | Harry Young | 03.12.2011
void FX_DisruptorFire2(vec3_t startpos, vec3_t endpos, vec3_t normal, qboolean impact, float scale)
{
refEntity_t beam;
//float size;
//vec3_t velocity;
//int sparks;
vec3_t rgb = { 1,0.9,0.6}, rgb2={1,0.3,0};
// Draw beam first.
memset( &beam, 0, sizeof( beam ) );
VectorCopy( startpos, beam.origin);
VectorCopy( endpos, beam.oldorigin );
beam.reType = RT_LINE;
beam.customShader = cgs.media.disruptorBeam;
AxisClear( beam.axis );
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
beam.shaderRGBA[3] = 0xff;
beam.data.line.width = scale + ( crandom() * 0.6f );
beam.data.line.stscale = 5.0;
trap_R_AddRefEntityToScene( &beam );
if (impact)
{
FX_AddQuad2( endpos, normal, (0.75f * scale) + random() * .75 + 1.0f, 0.0f, 0.5f, 0.0f, rgb, rgb2, rand() % 360, 300 + random() * 200,
cgs.media.disruptorStreak );
}
}
qboolean DisruptorFX_Think(localEntity_t *le) {
vec3_t dir;
qboolean impact = qfalse;
le->data.spawner.nextthink = cg.time;
VectorSubtract(le->data.spawner.dir, le->refEntity.origin, dir);
VectorNormalize(dir);
if(le->data.spawner.data2 == 1)
impact = qtrue;
FX_DisruptorFire2(le->refEntity.origin, le->data.spawner.dir, dir, impact, le->data.spawner.data1);
return qtrue;
}
void CG_DisruptorFX(centity_t *cent) {
localEntity_t *le;
le = FX_AddSpawner(cent->currentState.origin, cent->currentState.origin2, NULL, NULL, qfalse, 0, 0, cent->currentState.time2, DisruptorFX_Think, 10);
le->data.spawner.data1 = cent->currentState.angles[0];
le->data.spawner.data2 = cent->currentState.angles[2];
le->data.spawner.nextthink = cg.time + (int)cent->currentState.angles[1];
}

View file

@ -1422,6 +1422,12 @@ case EV_SHAKE_SOUND:
CG_PhaserFX(cent);
break;
case EV_FX_DISRUPTOR:
s = CG_ConfigString(CS_SOUNDS + es->time);
trap_S_StartSound(NULL, es->number, CHAN_VOICE, CG_CustomSound(es->number, s));
CG_DisruptorFX(cent);
break;
case EV_SET_CLOAK:
ci->silentCloak = es->eventParm;
break;

View file

@ -2041,6 +2041,7 @@ void CG_ElectricalExplosion( vec3_t start, vec3_t dir, float radius );
//RPG-X | GSIO01 | 09/05/2009
void CG_PhaserFX(centity_t *cent);
void CG_DisruptorFX(centity_t *cent); //RPG-X | Harry Young | 03.12.2011
void CG_TorpedoFX(centity_t *cent);
void CG_ParticleFire(vec3_t origin, int size);
void CG_ShowTrigger(centity_t *cent);

View file

@ -836,6 +836,7 @@ typedef enum {
//RPG-X | GSIO01 | 08/95/2009 adaptsound
EV_ADAPT_SOUND,
EV_FX_PHASER,
EV_FX_DISRUPTOR,
EV_SET_CLOAK,
EV_FX_TORPEDO,
EV_FOOTSTEP_GRASS,

View file

@ -861,7 +861,7 @@ void SP_fx_electrical_explosion( gentity_t *ent )
trap_LinkEntity( ent );
}
/*QUAKED fx_phaser (0 0 1) (-8 -8 -8) (8 8 8) NO_SOUND
/*QUAKED fx_phaser (0 0 1) (-8 -8 -8) (8 8 8) NO_SOUND DISRUPTOR
A phaser effect.
"target" endpoint
@ -876,7 +876,15 @@ A phaser effect.
void phaser_use(gentity_t *ent, gentity_t *other, gentity_t *activator) {
if(ent->count == PHASER_FX_UNLINKED)
return;
G_AddEvent(ent, EV_FX_PHASER, 0);
if(ent->spawnflags & 2)
{
G_AddEvent(ent, EV_FX_DISRUPTOR, 0);
}
else
{
G_AddEvent(ent, EV_FX_PHASER, 0);
}
}
void phaser_link(gentity_t *ent) {