From 8ee003187800b7ce7561090a8d7f9e66b920d88a Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 25 Mar 2002 00:58:16 +0000 Subject: Partial client side flamer effect --- src/cgame/cg_ents.c | 5 +++-- src/cgame/cg_weapons.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 560dbbf2..3b378fde 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -289,7 +289,7 @@ static void CG_Missile( centity_t *cent ) break; case WP_FLAMER: - { +/* { fraction = ( ( cg.time - s1->pos.trTime ) / FIREBALL_LIFETIME ); if( fraction > 1.0f ) @@ -303,7 +303,8 @@ static void CG_Missile( centity_t *cent ) ent.customShader = cgs.media.flameShader[ index ]; trap_R_AddRefEntityToScene( &ent ); return; - } + }*/ + return; break; default: diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 089df54f..56232a7f 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -979,6 +979,40 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) { } +/* +=============== +CG_FlameTrail +=============== +*/ +static void CG_FlameTrail( centity_t *cent, vec3_t origin ) +{ + vec3_t forward; + vec3_t muzzlePoint; + + if( cent->currentState.weapon != WP_FLAMER ) + return; + + if( cent->currentState.clientNum == cg.predictedPlayerState.clientNum ) + { + AngleVectors( cg.refdefViewAngles, forward, NULL, NULL ); + VectorCopy( cg.predictedPlayerState.origin, muzzlePoint ); + } + else + { + AngleVectors( cent->lerpAngles, forward, NULL, NULL ); + VectorCopy( cent->lerpOrigin, muzzlePoint ); + } + + // FIXME: crouch + muzzlePoint[2] += DEFAULT_VIEWHEIGHT; + + VectorMA( muzzlePoint, 8.0f, forward, muzzlePoint ); + VectorScale( forward, 300.0f, forward ); + + CG_LaunchSprite( muzzlePoint, forward, vec3_origin, 0.1f, 0.0f, 48.0f, 192.0f, 64.0f, rand( ) % 360, cg.time, FIREBALL_LIFETIME, cgs.media.smokePuffShader, qfalse, qfalse ); +} + + /* =============== CG_SpawnRailTrail @@ -1214,6 +1248,8 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent cent->currentState.number != cg.predictedPlayerState.clientNum ) { // add lightning bolt CG_LightningBolt( nonPredictedCent, flash.origin ); + + CG_FlameTrail( nonPredictedCent, flash.origin ); // add rail trail CG_SpawnRailTrail( cent, flash.origin ); @@ -1269,9 +1305,11 @@ void CG_AddViewWeapon( playerState_t *ps ) { if ( cg.predictedPlayerState.eFlags & EF_FIRING ) { // special hack for lightning gun... + // TA: and flamer VectorCopy( cg.refdef.vieworg, origin ); VectorMA( origin, -8, cg.refdef.viewaxis[2], origin ); CG_LightningBolt( &cg_entities[ps->clientNum], origin ); + CG_FlameTrail( &cg_entities[ps->clientNum], origin ); } return; } -- cgit