diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 32 | ||||
-rw-r--r-- | src/game/bg_misc.c | 2 | ||||
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_missile.c | 307 | ||||
-rw-r--r-- | src/game/g_weapon.c | 2 |
7 files changed, 177 insertions, 171 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 48dcac5a..86cb73e3 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1230,6 +1230,7 @@ extern vmCvar_t cg_drawSurfNormal; extern vmCvar_t cg_debugAlloc; extern vmCvar_t cg_wwSmoothTime; extern vmCvar_t cg_wwFollow; +extern vmCvar_t cg_zsortLEs; //TA: hack to get class an carriage through to UI module extern vmCvar_t ui_currentClass; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 9103a361..4f5da5a8 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -181,6 +181,7 @@ vmCvar_t cg_drawSurfNormal; vmCvar_t cg_debugAlloc; vmCvar_t cg_wwSmoothTime; vmCvar_t cg_wwFollow; +vmCvar_t cg_zsortLEs; //TA: hack to get class an carriage through to UI module vmCvar_t ui_currentClass; @@ -270,6 +271,7 @@ static cvarTable_t cvarTable[] = { { &cg_debugAlloc, "cg_debugAlloc", "0", 0 }, { &cg_wwSmoothTime, "cg_wwSmoothTime", "300", CVAR_ARCHIVE }, { &cg_wwFollow, "cg_wwFollow", "1", CVAR_ARCHIVE|CVAR_USERINFO }, + { &cg_zsortLEs, "cg_zsortLEs", "1", CVAR_ARCHIVE }, { &ui_currentClass, "ui_currentClass", "0", 0 }, { &ui_carriage, "ui_carriage", "", 0 }, diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 2d86fcfd..fe6dfe98 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -986,8 +986,9 @@ CG_FlameTrail */ static void CG_FlameTrail( centity_t *cent, vec3_t origin ) { - vec3_t forward; + vec3_t forward, right, up; vec3_t muzzlePoint; + vec3_t velocity; if( cent->currentState.weapon != WP_FLAMER ) return; @@ -998,23 +999,27 @@ static void CG_FlameTrail( centity_t *cent, vec3_t origin ) if( cent->currentState.clientNum == cg.predictedPlayerState.clientNum && !cg.renderingThirdPerson ) { - AngleVectors( cg.refdefViewAngles, forward, NULL, NULL ); - VectorCopy( cg.predictedPlayerState.origin, muzzlePoint ); + AngleVectors( cg.refdefViewAngles, forward, right, up ); + VectorCopy( cg.refdef.vieworg, muzzlePoint ); + VectorMA( cg.predictedPlayerState.velocity, FIREBALL_SPEED, forward, velocity ); } else { - AngleVectors( cent->lerpAngles, forward, NULL, NULL ); + AngleVectors( cent->lerpAngles, forward, right, up ); VectorCopy( cent->lerpOrigin, muzzlePoint ); - } - - // FIXME: crouch - muzzlePoint[ 2 ] += DEFAULT_VIEWHEIGHT; - VectorMA( muzzlePoint, 14.0f, forward, muzzlePoint ); - VectorScale( forward, FIREBALL_SPEED, forward ); + //FIXME: this is gonna look weird when crouching + muzzlePoint[ 2 ] += DEFAULT_VIEWHEIGHT; + VectorMA( cent->currentState.pos.trDelta, FIREBALL_SPEED, forward, velocity ); + } - CG_LaunchSprite( muzzlePoint, forward, vec3_origin, - 0.1f, 0.0f, 40.0f, 255.0f, 192.0f, + //FIXME: tweak these numbers when (if?) the flamer model is done + VectorMA( muzzlePoint, 24.0f, forward, muzzlePoint ); + VectorMA( muzzlePoint, 6.0f, right, muzzlePoint ); + VectorMA( muzzlePoint, -6.0f, up, muzzlePoint ); + + CG_LaunchSprite( muzzlePoint, velocity, vec3_origin, + 0.1f, 4.0f, 40.0f, 255.0f, 192.0f, rand( ) % 360, cg.time, FIREBALL_LIFETIME, cgs.media.flameShader[ 0 ], qfalse, qfalse ); @@ -1217,7 +1222,8 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent } // add the flash - if ( ( weaponNum == WP_TESLAGEN ) && ( nonPredictedCent->currentState.eFlags & EF_FIRING ) ) + if ( ( weaponNum == WP_TESLAGEN || weaponNum == WP_FLAMER ) && + ( nonPredictedCent->currentState.eFlags & EF_FIRING ) ) { // continuous flash } else { diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index a241f3dc..a6f3eb48 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2055,7 +2055,7 @@ weaponAttributes_t bg_weapons[ ] = 0, //int maxClips; qfalse, //int infiniteAmmo; qfalse, //int usesEnergy; - 40, //int repeatRate; + 150, //int repeatRate; 0, //int reloadTime; qfalse, //qboolean hasAltMode; qfalse, //qboolean synced; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 553cea05..50e6b212 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -321,7 +321,7 @@ typedef enum { //TA: needed client side to size sprites #define FIREBALL_LIFETIME 1000.0f #define FIREBALL_SPEED 200.0f -#define FIREBALL_GAP 10 //basically as fast as possible yet regular +#define FIREBALL_GAP 15 //basically as fast as possible yet regular typedef enum { diff --git a/src/game/g_missile.c b/src/game/g_missile.c index 7ce12c13..193c7404 100644 --- a/src/game/g_missile.c +++ b/src/game/g_missile.c @@ -16,7 +16,7 @@ #include "g_local.h" -#define MISSILE_PRESTEP_TIME 50 +#define MISSILE_PRESTEP_TIME 50 /* ================ @@ -25,28 +25,28 @@ G_BounceMissile ================ */ void G_BounceMissile( gentity_t *ent, trace_t *trace ) { - vec3_t velocity; - float dot; - int hitTime; - - // reflect the velocity on the trace plane - hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction; - BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity ); - dot = DotProduct( velocity, trace->plane.normal ); - VectorMA( velocity, -2*dot, trace->plane.normal, ent->s.pos.trDelta ); - - if ( ent->s.eFlags & EF_BOUNCE_HALF ) { - VectorScale( ent->s.pos.trDelta, 0.65, ent->s.pos.trDelta ); - // check for stop - if ( trace->plane.normal[2] > 0.2 && VectorLength( ent->s.pos.trDelta ) < 40 ) { - G_SetOrigin( ent, trace->endpos ); - return; - } - } - - VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin); - VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase ); - ent->s.pos.trTime = level.time; + vec3_t velocity; + float dot; + int hitTime; + + // reflect the velocity on the trace plane + hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction; + BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity ); + dot = DotProduct( velocity, trace->plane.normal ); + VectorMA( velocity, -2*dot, trace->plane.normal, ent->s.pos.trDelta ); + + if ( ent->s.eFlags & EF_BOUNCE_HALF ) { + VectorScale( ent->s.pos.trDelta, 0.65, ent->s.pos.trDelta ); + // check for stop + if ( trace->plane.normal[2] > 0.2 && VectorLength( ent->s.pos.trDelta ) < 40 ) { + G_SetOrigin( ent, trace->endpos ); + return; + } + } + + VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin); + VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase ); + ent->s.pos.trTime = level.time; } @@ -96,36 +96,36 @@ G_MissileImpact ================ */ void G_MissileImpact( gentity_t *ent, trace_t *trace ) { - gentity_t *other; - qboolean hitClient = qfalse; - - other = &g_entities[trace->entityNum]; - - // check for bounce - if ( !other->takedamage && - ( ent->s.eFlags & ( EF_BOUNCE | EF_BOUNCE_HALF ) ) ) { - G_BounceMissile( ent, trace ); - G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 ); - return; - } - - // impact damage - if (other->takedamage) { - // FIXME: wrong damage direction? - if ( ent->damage ) { - vec3_t velocity; - - BG_EvaluateTrajectoryDelta( &ent->s.pos, level.time, velocity ); - if ( VectorLength( velocity ) == 0 ) { - velocity[2] = 1; // stepped on a grenade - } - G_Damage (other, ent, &g_entities[ent->r.ownerNum], velocity, - ent->s.origin, ent->damage, - 0, ent->methodOfDeath); - } - } - - if( !strcmp( ent->classname, "lockblob" ) ) + gentity_t *other; + qboolean hitClient = qfalse; + + other = &g_entities[trace->entityNum]; + + // check for bounce + if ( !other->takedamage && + ( ent->s.eFlags & ( EF_BOUNCE | EF_BOUNCE_HALF ) ) ) { + G_BounceMissile( ent, trace ); + G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 ); + return; + } + + // impact damage + if (other->takedamage) { + // FIXME: wrong damage direction? + if ( ent->damage ) { + vec3_t velocity; + + BG_EvaluateTrajectoryDelta( &ent->s.pos, level.time, velocity ); + if ( VectorLength( velocity ) == 0 ) { + velocity[2] = 1; // stepped on a grenade + } + G_Damage (other, ent, &g_entities[ent->r.ownerNum], velocity, + ent->s.origin, ent->damage, + 0, ent->methodOfDeath); + } + } + + if( !strcmp( ent->classname, "lockblob" ) ) { if( other->client && other->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { @@ -135,38 +135,38 @@ void G_MissileImpact( gentity_t *ent, trace_t *trace ) { } } - // is it cheaper in bandwidth to just remove this ent and create a new - // one, rather than changing the missile into the explosion? + // is it cheaper in bandwidth to just remove this ent and create a new + // one, rather than changing the missile into the explosion? - if ( other->takedamage && other->client ) { - G_AddEvent( ent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) ); - ent->s.otherEntityNum = other->s.number; + if ( other->takedamage && other->client ) { + G_AddEvent( ent, EV_MISSILE_HIT, DirToByte( trace->plane.normal ) ); + ent->s.otherEntityNum = other->s.number; } else if( trace->surfaceFlags & SURF_METALSTEPS ) { G_AddEvent( ent, EV_MISSILE_MISS_METAL, DirToByte( trace->plane.normal ) ); - } else { - G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) ); - } + } else { + G_AddEvent( ent, EV_MISSILE_MISS, DirToByte( trace->plane.normal ) ); + } - ent->freeAfterEvent = qtrue; + ent->freeAfterEvent = qtrue; - // change over to a normal entity right at the point of impact - ent->s.eType = ET_GENERAL; + // change over to a normal entity right at the point of impact + ent->s.eType = ET_GENERAL; - SnapVectorTowards( trace->endpos, ent->s.pos.trBase ); // save net bandwidth + SnapVectorTowards( trace->endpos, ent->s.pos.trBase ); // save net bandwidth - G_SetOrigin( ent, trace->endpos ); + G_SetOrigin( ent, trace->endpos ); - // splash damage (doesn't apply to person directly hit) - if ( ent->splashDamage ) { - if( G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius, - other, ent->splashMethodOfDeath ) ) { - if( !hitClient ) { + // splash damage (doesn't apply to person directly hit) + if ( ent->splashDamage ) { + if( G_RadiusDamage( trace->endpos, ent->parent, ent->splashDamage, ent->splashRadius, + other, ent->splashMethodOfDeath ) ) { + if( !hitClient ) { g_entities[ent->r.ownerNum].client->accuracy_hits++; - } - } - } + } + } + } - trap_LinkEntity( ent ); + trap_LinkEntity( ent ); } @@ -178,12 +178,12 @@ G_RunMissile */ void G_RunMissile( gentity_t *ent ) { - vec3_t origin; - trace_t tr; + vec3_t origin; + trace_t tr; int passent; - // get current position - BG_EvaluateTrajectory( &ent->s.pos, level.time, origin ); + // get current position + BG_EvaluateTrajectory( &ent->s.pos, level.time, origin ); // if this missile bounced off an invulnerability sphere if ( ent->target_ent ) @@ -202,33 +202,33 @@ void G_RunMissile( gentity_t *ent ) { // make sure the tr.entityNum is set to the entity we're stuck in trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, ent->r.currentOrigin, passent, ent->clipmask ); - tr.fraction = 0; - } + tr.fraction = 0; + } else VectorCopy( tr.endpos, ent->r.currentOrigin ); - trap_LinkEntity( ent ); + trap_LinkEntity( ent ); - if( tr.fraction != 1 ) + if( tr.fraction != 1 ) { - // never explode or bounce on sky - if ( tr.surfaceFlags & SURF_NOIMPACT ) + // never explode or bounce on sky + if ( tr.surfaceFlags & SURF_NOIMPACT ) { - // If grapple, reset owner + // If grapple, reset owner if (ent->parent && ent->parent->client && ent->parent->client->hook == ent) - ent->parent->client->hook = NULL; + ent->parent->client->hook = NULL; - G_FreeEntity( ent ); - return; - } + G_FreeEntity( ent ); + return; + } - G_MissileImpact( ent, &tr ); - if ( ent->s.eType != ET_MISSILE ) - return; // exploded - } + G_MissileImpact( ent, &tr ); + if ( ent->s.eType != ET_MISSILE ) + return; // exploded + } - // check think function after bouncing - G_RunThink( ent ); + // check think function after bouncing + G_RunThink( ent ); } @@ -242,38 +242,37 @@ fire_flamer */ gentity_t *fire_flamer( gentity_t *self, vec3_t start, vec3_t dir ) { - gentity_t *bolt; - - VectorNormalize (dir); - - bolt = G_Spawn(); - bolt->classname = "flame"; - bolt->nextthink = level.time + FIREBALL_LIFETIME; - bolt->think = G_ExplodeMissile; - bolt->s.eType = ET_MISSILE; - bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; - bolt->s.weapon = WP_FLAMER; - bolt->r.ownerNum = self->s.number; - bolt->parent = self; - bolt->damage = 5; - bolt->splashDamage = 5; - bolt->splashRadius = 45; - bolt->methodOfDeath = MOD_FLAMER; - bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; - bolt->clipmask = MASK_SHOT; + gentity_t *bolt; + + VectorNormalize (dir); + + bolt = G_Spawn(); + bolt->classname = "flame"; + bolt->nextthink = level.time + FIREBALL_LIFETIME; + bolt->think = G_ExplodeMissile; + bolt->s.eType = ET_MISSILE; + bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; + bolt->s.weapon = WP_FLAMER; + bolt->r.ownerNum = self->s.number; + bolt->parent = self; + bolt->damage = 5; + bolt->splashDamage = 5; + bolt->splashRadius = 45; + bolt->methodOfDeath = MOD_FLAMER; + bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; + bolt->clipmask = MASK_SHOT; bolt->target_ent = NULL; - bolt->s.pos.trType = TR_LINEAR; - 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, FIREBALL_SPEED, bolt->s.pos.trDelta ); - /*SnapVector( bolt->s.pos.trDelta ); // save net bandwidth*/ + bolt->s.pos.trType = TR_LINEAR; + bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame + VectorCopy( start, bolt->s.pos.trBase ); + VectorMA( self->client->ps.velocity, FIREBALL_SPEED, dir, bolt->s.pos.trDelta ); + SnapVector( bolt->s.pos.trDelta ); // save net bandwidth - VectorCopy (start, bolt->r.currentOrigin); + VectorCopy (start, bolt->r.currentOrigin); - return bolt; -} + return bolt; +} //============================================================================= @@ -301,8 +300,8 @@ gentity_t *fire_plasma( gentity_t *self, vec3_t start, vec3_t dir ) bolt->damage = 20; bolt->splashDamage = 15; bolt->splashRadius = 20; - //bolt->methodOfDeath = MOD_FLAMER; - //bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; + //bolt->methodOfDeath = MOD_FLAMER; + //bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; bolt->clipmask = MASK_SHOT; bolt->target_ent = NULL; @@ -341,8 +340,8 @@ gentity_t *fire_pulseRifle( gentity_t *self, vec3_t start, vec3_t dir ) bolt->damage = 20; bolt->splashDamage = 0; bolt->splashRadius = 0; - //bolt->methodOfDeath = MOD_FLAMER; - //bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; + //bolt->methodOfDeath = MOD_FLAMER; + //bolt->splashMethodOfDeath = MOD_FLAMER_SPLASH; bolt->clipmask = MASK_SHOT; bolt->target_ent = NULL; @@ -366,34 +365,34 @@ fire_lockblob */ gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir ) { - gentity_t *bolt; - - VectorNormalize ( dir ); - - bolt = G_Spawn( ); - bolt->classname = "lockblob"; - bolt->nextthink = level.time + 15000; - bolt->think = G_ExplodeMissile; - bolt->s.eType = ET_MISSILE; - bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; - bolt->s.weapon = WP_LOCKBLOB_LAUNCHER; - bolt->r.ownerNum = self->s.number; - bolt->parent = self; - bolt->damage = 0; - bolt->splashDamage = 0; - bolt->splashRadius = 0; - bolt->methodOfDeath = MOD_ROCKET; - bolt->splashMethodOfDeath = MOD_ROCKET_SPLASH; - bolt->clipmask = MASK_SHOT; + gentity_t *bolt; + + VectorNormalize ( dir ); + + bolt = G_Spawn( ); + bolt->classname = "lockblob"; + bolt->nextthink = level.time + 15000; + bolt->think = G_ExplodeMissile; + bolt->s.eType = ET_MISSILE; + bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN; + bolt->s.weapon = WP_LOCKBLOB_LAUNCHER; + bolt->r.ownerNum = self->s.number; + bolt->parent = self; + bolt->damage = 0; + bolt->splashDamage = 0; + bolt->splashRadius = 0; + bolt->methodOfDeath = MOD_ROCKET; + bolt->splashMethodOfDeath = MOD_ROCKET_SPLASH; + bolt->clipmask = MASK_SHOT; bolt->target_ent = NULL; - bolt->s.pos.trType = TR_LINEAR; - bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame - VectorCopy( start, bolt->s.pos.trBase ); - VectorScale( dir, 500, bolt->s.pos.trDelta ); - SnapVector( bolt->s.pos.trDelta ); // save net bandwidth - VectorCopy (start, bolt->r.currentOrigin); + bolt->s.pos.trType = TR_LINEAR; + bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame + VectorCopy( start, bolt->s.pos.trBase ); + VectorScale( dir, 500, bolt->s.pos.trDelta ); + SnapVector( bolt->s.pos.trDelta ); // save net bandwidth + VectorCopy (start, bolt->r.currentOrigin); - return bolt; + return bolt; } diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 1b1fcf33..cf1a0beb 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -225,8 +225,6 @@ void flamerFire( gentity_t *ent ) gentity_t *m; m = fire_flamer( ent, muzzle, forward ); - - //VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics } /* |