diff options
author | Tim Angus <tim@ngus.net> | 2002-03-25 04:56:46 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-03-25 04:56:46 +0000 |
commit | 358bb181276c0811acd0ae4f4453d4584059c4de (patch) | |
tree | 9461d4c4e8f2672f01518bbf590ecfec1d742de6 /src | |
parent | 8ee003187800b7ce7561090a8d7f9e66b920d88a (diff) |
Client side flamer effects
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_ents.c | 16 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 24 | ||||
-rw-r--r-- | src/game/bg_public.h | 4 | ||||
-rw-r--r-- | src/game/g_missile.c | 4 |
5 files changed, 25 insertions, 27 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 3b378fde..d6e8595b 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -289,21 +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 ) - fraction = 1.0f; - - ent.reType = RT_SPRITE; - ent.radius = fraction * 32; - ent.rotation = s1->generic1; - - index = (int)( fraction * 31 ); - ent.customShader = cgs.media.flameShader[ index ]; - trap_R_AddRefEntityToScene( &ent ); - return; - }*/ + //TA: don't actually display the missile (use the particle engine) return; break; diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 5eab45c4..48dcac5a 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -186,7 +186,9 @@ typedef struct centity_s { lerpFrame_t lerpFrame; - buildableAnimNumber_t buildableAnim; //TA: persistant anim number + //TA: + buildableAnimNumber_t buildableAnim; //persistant anim number + int flamerTime; //limit flameball count } centity_t; diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 56232a7f..2d86fcfd 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -986,13 +986,17 @@ CG_FlameTrail */ static void CG_FlameTrail( centity_t *cent, vec3_t origin ) { - vec3_t forward; - vec3_t muzzlePoint; + vec3_t forward; + vec3_t muzzlePoint; if( cent->currentState.weapon != WP_FLAMER ) return; - if( cent->currentState.clientNum == cg.predictedPlayerState.clientNum ) + //not time for the next ball yet + if( cg.time < cent->flamerTime ) + return; + + if( cent->currentState.clientNum == cg.predictedPlayerState.clientNum && !cg.renderingThirdPerson ) { AngleVectors( cg.refdefViewAngles, forward, NULL, NULL ); VectorCopy( cg.predictedPlayerState.origin, muzzlePoint ); @@ -1004,12 +1008,18 @@ static void CG_FlameTrail( centity_t *cent, vec3_t origin ) } // FIXME: crouch - muzzlePoint[2] += DEFAULT_VIEWHEIGHT; + muzzlePoint[ 2 ] += DEFAULT_VIEWHEIGHT; + + VectorMA( muzzlePoint, 14.0f, forward, muzzlePoint ); + VectorScale( forward, FIREBALL_SPEED, forward ); - VectorMA( muzzlePoint, 8.0f, forward, muzzlePoint ); - VectorScale( forward, 300.0f, forward ); + CG_LaunchSprite( muzzlePoint, forward, vec3_origin, + 0.1f, 0.0f, 40.0f, 255.0f, 192.0f, + rand( ) % 360, cg.time, FIREBALL_LIFETIME, + cgs.media.flameShader[ 0 ], qfalse, qfalse ); - 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 ); + //set next ball time + cent->flamerTime = cg.time + FIREBALL_GAP; } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 26fbd152..08ab9cea 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -319,7 +319,9 @@ typedef enum { } holdable_t; //TA: needed client side to size sprites -#define FIREBALL_LIFETIME 800.0f +#define FIREBALL_LIFETIME 1000.0f +#define FIREBALL_SPEED 200.0f +#define FIREBALL_GAP 10 //basically as fast as possible yet regular typedef enum { diff --git a/src/game/g_missile.c b/src/game/g_missile.c index aa4116c8..7ce12c13 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -254,8 +254,6 @@ gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir ) bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; bolt->s.weapon = WP_FLAMER; bolt->r.ownerNum = self->s.number; - //random rotation for the flame sprite - bolt->s.generic1 = rand( ) % 360; bolt->parent = self; bolt->damage = 5; bolt->splashDamage = 5; @@ -269,7 +267,7 @@ gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir ) bolt->s.pos.trTime = level.time - ( MISSILE_PRESTEP_TIME / 2 ); // move a bit on the very first frame VectorCopy( start, bolt->s.pos.trBase ); //VectorMA( self->client->ps.velocity, 300, dir, bolt->s.pos.trDelta ); - VectorScale( dir, 300, bolt->s.pos.trDelta ); + VectorScale( dir, FIREBALL_SPEED, bolt->s.pos.trDelta ); /*SnapVector( bolt->s.pos.trDelta ); // save net bandwidth*/ VectorCopy (start, bolt->r.currentOrigin); |