summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-07-03 03:08:56 +0000
committerTim Angus <tim@ngus.net>2001-07-03 03:08:56 +0000
commit29cd16eaf0c6ca52b63ea4645cf206c5f8b7d791 (patch)
tree83dd4679d41b2b8a6bacde989f973eba4a507722
parente34d763c41d92804b4bd81417427b3b172d3994a (diff)
Finished new turrets, fixed a few bugs notably the freeze-when-shot-by-turret bug
-rw-r--r--src/cgame/cg_buildable.c2
-rw-r--r--src/cgame/cg_ents.c4
-rw-r--r--src/cgame/cg_event.c2
-rw-r--r--src/cgame/cg_local.h2
-rw-r--r--src/cgame/cg_syscalls.c4
-rw-r--r--src/cgame/cg_weapons.c31
-rw-r--r--src/game/bg_misc.c4
-rw-r--r--src/game/g_buildable.c232
-rw-r--r--src/game/g_missile.c29
-rw-r--r--src/game/g_weapon.c101
10 files changed, 217 insertions, 194 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index ec7d2858..0bba94ec 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -189,7 +189,7 @@ static void CG_RunBuildableLerpFrame( buildable_t buildable, lerpFrame_t *lf, in
// see if the animation sequence is switching
if ( newAnimation != lf->animationNumber || !lf->animation ) {
- CG_SetLerpFrameAnimation( buildable, lf, newAnimation );
+ CG_SetBuildableLerpFrameAnimation( buildable, lf, newAnimation );
}
// if we have passed the current frame, move it to
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 3b66aad6..1c36c2f8 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -409,6 +409,10 @@ static void CG_Missile( centity_t *cent ) {
BG_EvaluateTrajectoryDelta( &cent->currentState.pos, cg.time, velocity );
+ //TA: FIXME: hack until i figure out why trap_S_ALS has a problem with velocity`
+ if( s1->weapon == WP_PLASMAGUN )
+ VectorClear( velocity );
+
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, velocity, weapon->missileSound );
}
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 61a3abe0..a9fa5138 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -937,7 +937,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
ByteToDir( es->eventParm, dir );
CG_MissileHitWall( es->weapon, es->clientNum, position, dir, IMPACTSOUND_DEFAULT );
}
- CG_RailTrail( ci, es->origin2, es->pos.trBase );
+ CG_RailTrail( es->origin2, es->pos.trBase );
break;
case EV_BULLET_HIT_WALL:
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index fc009a62..ce615221 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1349,7 +1349,7 @@ void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum )
void CG_ShotgunFire( entityState_t *es );
void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
-void CG_RailTrail( clientInfo_t *ci, vec3_t start, vec3_t end );
+void CG_RailTrail( vec3_t start, vec3_t end );
void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi );
void CG_AddViewWeapon (playerState_t *ps);
void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent );
diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c
index 5c4722ca..818a21d5 100644
--- a/src/cgame/cg_syscalls.c
+++ b/src/cgame/cg_syscalls.c
@@ -247,6 +247,10 @@ void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g
syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
}
+void trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b ) {
+ syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
+}
+
void trap_R_RenderScene( const refdef_t *fd ) {
syscall( CG_R_RENDERSCENE, fd );
}
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 470d1603..a3a3d315 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -183,7 +183,8 @@ static void CG_ShotgunEjectBrass( centity_t *cent ) {
CG_RailTrail
==========================
*/
-void CG_RailTrail( clientInfo_t *ci, vec3_t start, vec3_t end ) {
+void CG_RailTrail( vec3_t start, vec3_t end )
+{
localEntity_t *le;
refEntity_t *re;
@@ -209,9 +210,9 @@ void CG_RailTrail( clientInfo_t *ci, vec3_t start, vec3_t end ) {
re->origin[2] -= 8;
re->oldorigin[2] -= 8;
- le->color[0] = ci->color[0] * 0.75;
- le->color[1] = ci->color[1] * 0.75;
- le->color[2] = ci->color[2] * 0.75;
+ le->color[0] = 0.75f;
+ le->color[1] = 0.75f;
+ le->color[2] = 0.75f;
le->color[3] = 1.0f;
AxisClear( re->axis );
@@ -238,9 +239,9 @@ void CG_RailTrail( clientInfo_t *ci, vec3_t start, vec3_t end ) {
re->origin[2] -= 8;
re->oldorigin[2] -= 8;
- le->color[0] = ci->color[0] * 0.75;
- le->color[1] = ci->color[1] * 0.75;
- le->color[2] = ci->color[2] * 0.75;
+ le->color[0] = 0.75f;
+ le->color[1] = 0.75f;
+ le->color[2] = 0.75f;
le->color[3] = 1.0f;
AxisClear( re->axis );
@@ -830,18 +831,16 @@ Origin will be the exact tag point, which is slightly
different than the muzzle point used for determining hits.
===============
*/
-static void CG_SpawnRailTrail( centity_t *cent, vec3_t origin ) {
- clientInfo_t *ci;
-
- if ( cent->currentState.weapon != WP_RAILGUN ) {
+static void CG_SpawnRailTrail( centity_t *cent, vec3_t origin )
+{
+ if ( cent->currentState.weapon != WP_RAILGUN )
return;
- }
- if ( !cent->pe.railgunFlash ) {
+
+ if ( !cent->pe.railgunFlash )
return;
- }
+
cent->pe.railgunFlash = qtrue;
- ci = &cgs.clientinfo[ cent->currentState.clientNum ];
- CG_RailTrail( ci, origin, cent->pe.railgunImpact );
+ CG_RailTrail( origin, cent->pe.railgunImpact );
}
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index afa3170f..075eae90 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -388,7 +388,7 @@ gitem_t bg_itemlist[] =
/*QUAKED weapon_railgun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
*/
- /*{
+ {
"weapon_railgun",
"sound/misc/w_pkup.wav",
{ "models/weapons2/railgun/railgun.md3",
@@ -400,7 +400,7 @@ gitem_t bg_itemlist[] =
WP_RAILGUN,
"",
""
- },*/
+ },
/*QUAKED weapon_plasmagun (.3 .3 1) (-16 -16 -16) (16 16 16) suspended
*/
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 7fc04063..6178a6f3 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -436,22 +436,6 @@ qboolean hdef1_trackenemy( gentity_t *self )
return qfalse;
}
-/*
-================
-hdef1_fireonemeny
-
-Used by HDef1_Think to fire at enemy
-================
-*/
-void hdef1_fireonenemy( gentity_t *self )
-{
- vec3_t aimVector;
-
- AngleVectors( self->s.angles2, aimVector, NULL, NULL );
- fire_plasma( self, self->s.pos.trBase, aimVector );
- self->count = level.time + HDEF1_FIRINGSPEED;
-}
-
#define HDEF2_RANGE 300 //maximum range
#define HDEF2_ANGULARSPEED 20 //degrees/think ~= 200deg/sec
#define HDEF2_FIRINGSPEED 50 //time between projectiles
@@ -509,25 +493,9 @@ qboolean hdef2_trackenemy( gentity_t *self )
return qfalse;
}
-/*
-================
-hdef2_fireonemeny
-
-Used by HDef1_Think to fire at enemy
-================
-*/
-void hdef2_fireonenemy( gentity_t *self )
-{
- vec3_t aimVector;
-
- AngleVectors( self->s.angles2, aimVector, NULL, NULL );
- fire_plasma( self, self->s.pos.trBase, aimVector );
- self->count = level.time + HDEF2_FIRINGSPEED;
-}
-
#define HDEF3_RANGE 1500 //maximum range
#define HDEF3_ANGULARSPEED 2 //degrees/think ~= 200deg/sec
-#define HDEF3_FIRINGSPEED 1500 //time between projectiles
+#define HDEF3_FIRINGSPEED 4000 //time between projectiles
#define HDEF3_ACCURACYTOLERANCE HDEF3_ANGULARSPEED / 2 //angular difference for turret to fire
#define HDEF3_VERTICALCAP 15 //+/- maximum pitch
@@ -586,28 +554,25 @@ qboolean hdef3_trackenemy( gentity_t *self )
/*
================
-hdef3_fireonemeny
+hdef_fireonemeny
-Used by HDef1_Think to fire at enemy
+Used by HDef_Think to fire at enemy
================
*/
-void hdef3_fireonenemy( gentity_t *self )
+void hdef_fireonenemy( gentity_t *self, int firespeed )
{
- vec3_t aimVector;
-
- AngleVectors( self->s.angles2, aimVector, NULL, NULL );
- fire_plasma( self, self->s.pos.trBase, aimVector );
- self->count = level.time + HDEF3_FIRINGSPEED;
+ FireWeapon( self );
+ self->count = level.time + firespeed;
}
/*
================
-hdef1_checktarget
+hdef_checktarget
-Used by HDef1_Think to check enemies for validity
+Used by HDef_Think to check enemies for validity
================
*/
-qboolean hdef1_checktarget( gentity_t *self, gentity_t *target, int range )
+qboolean hdef_checktarget( gentity_t *self, gentity_t *target, int range )
{
vec3_t distance;
trace_t trace;
@@ -643,12 +608,12 @@ qboolean hdef1_checktarget( gentity_t *self, gentity_t *target, int range )
/*
================
-hdef1_findenemy
+hdef_findenemy
-Used by HDef1_Think to locate enemy gentities
+Used by HDef_Think to locate enemy gentities
================
*/
-void hdef1_findenemy( gentity_t *ent, int range )
+void hdef_findenemy( gentity_t *ent, int range )
{
gentity_t *target;
@@ -656,7 +621,7 @@ void hdef1_findenemy( gentity_t *ent, int range )
for (; target < &g_entities[ level.num_entities ]; target++)
{
- if( !hdef1_checktarget( ent, target, range ) )
+ if( !hdef_checktarget( ent, target, range ) )
continue;
ent->enemy = target;
@@ -669,14 +634,39 @@ void hdef1_findenemy( gentity_t *ent, int range )
/*
================
-HDef1_Think
+HDef_Think
think function for Human Defense
================
*/
-void HDef1_Think( gentity_t *self )
+void HDef_Think( gentity_t *self )
{
- self->nextthink = level.time + 50;
+ int range, firespeed;
+
+ switch( self->s.clientNum )
+ {
+ case BA_H_DEF1:
+ range = HDEF1_RANGE;
+ firespeed = HDEF1_FIRINGSPEED;
+ self->nextthink = level.time + 50;
+ break;
+
+ case BA_H_DEF2:
+ range = HDEF2_RANGE;
+ firespeed = HDEF2_FIRINGSPEED;
+ self->nextthink = level.time + 50;
+ break;
+
+ case BA_H_DEF3:
+ range = HDEF3_RANGE;
+ firespeed = HDEF3_FIRINGSPEED;
+ self->nextthink = level.time + 150;
+ break;
+
+ default:
+ Com_Printf( S_COLOR_YELLOW "WARNING: Unknown turret type in think\n" );
+ break;
+ }
self->powered = findPower( self );
@@ -686,36 +676,26 @@ void HDef1_Think( gentity_t *self )
return;
}
+ if( !hdef_checktarget( self, self->enemy, range ) )
+ hdef_findenemy( self, range );
+ if( !self->enemy )
+ return;
+
switch( self->s.clientNum )
{
case BA_H_DEF1:
- if( !hdef1_checktarget( self, self->enemy, HDEF1_RANGE ) )
- hdef1_findenemy( self, HDEF1_RANGE );
- if( !self->enemy )
- return;
-
if( hdef1_trackenemy( self ) && ( self->count < level.time ) )
- hdef1_fireonenemy( self );
+ hdef_fireonenemy( self, firespeed );
break;
case BA_H_DEF2:
- if( !hdef1_checktarget( self, self->enemy, HDEF2_RANGE ) )
- hdef1_findenemy( self, HDEF2_RANGE );
- if( !self->enemy )
- return;
-
if( hdef2_trackenemy( self ) && ( self->count < level.time ) )
- hdef2_fireonenemy( self );
+ hdef_fireonenemy( self, firespeed );
break;
case BA_H_DEF3:
- if( !hdef1_checktarget( self, self->enemy, HDEF3_RANGE ) )
- hdef1_findenemy( self, HDEF3_RANGE );
- if( !self->enemy )
- return;
-
if( hdef3_trackenemy( self ) && ( self->count < level.time ) )
- hdef3_fireonenemy( self );
+ hdef_fireonenemy( self, firespeed );
break;
default:
@@ -874,6 +854,8 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
if( level.humanBuildPoints - BG_FindBuildPointsForBuildable( buildable ) < 0 )
reason = IBE_NOPOWER;
+ closestPower = g_entities + 1; //FIXME
+
for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ )
{
if( !Q_stricmp( tempent->classname, "team_human_reactor" ) ||
@@ -889,12 +871,12 @@ itemBuildError_t itemFits( gentity_t *ent, buildable_t buildable, int distance )
}
}
- if( !(( !Q_stricmp( closestPower->classname, "team_human_reactor" ) &&
- minDistance <= REACTOR_BASESIZE ) ||
- ( !Q_stricmp( closestPower->classname, "team_human_repeater" ) &&
- minDistance <= REPEATER_BASESIZE &&
- ( ( buildable == BA_H_SPAWN && closestPower->powered ) ||
- ( closestPower->powered && closestPower->active ) ) ) )
+ if( !( ( !Q_stricmp( closestPower->classname, "team_human_reactor" ) &&
+ minDistance <= REACTOR_BASESIZE ) ||
+ ( !Q_stricmp( closestPower->classname, "team_human_repeater" ) &&
+ minDistance <= REPEATER_BASESIZE &&
+ ( ( buildable == BA_H_SPAWN && closestPower->powered ) ||
+ ( closestPower->powered && closestPower->active ) ) ) )
)
{
if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER )
@@ -977,46 +959,68 @@ gentity_t *Build_Item( gentity_t *ent, buildable_t buildable, int distance ) {
built->nextthink = BG_FindNextThinkForBuildable( buildable );
- if( buildable == BA_D_SPAWN )
- {
- built->die = DSpawn_Die;
- built->think = DSpawn_Think;
- }
- else if( buildable == BA_D_DEF1 )
- {
- built->die = DDef1_Die;
- built->think = DDef1_Think;
- }
- else if( buildable == BA_D_HIVEMIND )
- {
- built->die = DSpawn_Die;
- }
- else if( buildable == BA_H_SPAWN )
- {
- built->die = HSpawn_Die;
- built->think = HSpawn_Think;
- }
- else if( buildable == BA_H_DEF1 || buildable == BA_H_DEF2 || buildable == BA_H_DEF3 )
- {
- built->die = HSpawn_Die;
- built->think = HDef1_Think;
- built->enemy = NULL;
- }
- else if( buildable == BA_H_MCU )
- {
- built->think = HMCU_Think;
- built->die = HSpawn_Die;
- built->use = HMCU_Activate;
- }
- else if( buildable == BA_H_REACTOR )
- {
- built->die = HSpawn_Die;
- built->powered = qtrue;
- }
- else if( buildable == BA_H_REPEATER )
+ //things that vary for each buildable that aren't in the dbase
+ switch( buildable )
{
- built->think = HRpt_Think;
- built->die = HSpawn_Die;
+ case BA_D_SPAWN:
+ built->die = DSpawn_Die;
+ built->think = DSpawn_Think;
+ break;
+
+ case BA_D_DEF1:
+ built->die = DDef1_Die;
+ built->think = DDef1_Think;
+ break;
+
+ case BA_D_HIVEMIND:
+ built->die = DSpawn_Die;
+ break;
+
+ case BA_H_SPAWN:
+ built->die = HSpawn_Die;
+ built->think = HSpawn_Think;
+ break;
+
+ case BA_H_DEF1:
+ built->die = HSpawn_Die;
+ built->think = HDef_Think;
+ built->enemy = NULL;
+ built->s.weapon = WP_PLASMAGUN;
+ break;
+
+ case BA_H_DEF2:
+ built->die = HSpawn_Die;
+ built->think = HDef_Think;
+ built->enemy = NULL;
+ built->s.weapon = WP_MACHINEGUN;
+ break;
+
+ case BA_H_DEF3:
+ built->die = HSpawn_Die;
+ built->think = HDef_Think;
+ built->enemy = NULL;
+ built->s.weapon = WP_RAILGUN;
+ break;
+
+ case BA_H_MCU:
+ built->think = HMCU_Think;
+ built->die = HSpawn_Die;
+ built->use = HMCU_Activate;
+ break;
+
+ case BA_H_REACTOR:
+ built->die = HSpawn_Die;
+ built->powered = qtrue;
+ break;
+
+ case BA_H_REPEATER:
+ built->think = HRpt_Think;
+ built->die = HSpawn_Die;
+ break;
+
+ default:
+ //erk
+ break;
}
built->takedamage = qtrue;
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index 7aa86cc5..13b05997 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -85,13 +85,13 @@ void G_ExplodeMissile( gentity_t *ent ) {
ent->freeAfterEvent = qtrue;
- // splash damage
+/* // splash damage
if ( ent->splashDamage ) {
if( G_RadiusDamage( ent->r.currentOrigin, ent->parent, ent->splashDamage, ent->splashRadius, ent
, ent->splashMethodOfDeath ) ) {
g_entities[ent->r.ownerNum].client->accuracy_hits++;
}
- }
+ }*/
trap_LinkEntity( ent );
}
@@ -232,42 +232,45 @@ void G_RunMissile( gentity_t *ent ) {
BG_EvaluateTrajectory( &ent->s.pos, level.time, origin );
// if this missile bounced off an invulnerability sphere
- if ( ent->target_ent ) {
+ if ( ent->target_ent )
+ {
passent = ent->target_ent->s.number;
}
- else {
+ else
+ {
// ignore interactions with the missile owner
passent = ent->r.ownerNum;
}
// trace a line from the previous position to the current position
trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, passent, ent->clipmask );
- if ( tr.startsolid || tr.allsolid ) {
+ if( tr.startsolid || tr.allsolid )
+ {
// 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;
}
- else {
+ else
VectorCopy( tr.endpos, ent->r.currentOrigin );
- }
trap_LinkEntity( ent );
- if ( tr.fraction != 1 ) {
+ if( tr.fraction != 1 )
+ {
// never explode or bounce on sky
- if ( tr.surfaceFlags & SURF_NOIMPACT ) {
+ if ( tr.surfaceFlags & SURF_NOIMPACT )
+ {
// If grapple, reset owner
- if (ent->parent && ent->parent->client && ent->parent->client->hook == ent) {
+ if (ent->parent && ent->parent->client && ent->parent->client->hook == ent)
ent->parent->client->hook = NULL;
- }
+
G_FreeEntity( ent );
return;
}
G_MissileImpact( ent, &tr );
- if ( ent->s.eType != ET_MISSILE ) {
+ if ( ent->s.eType != ET_MISSILE )
return; // exploded
- }
}
// check think function after bouncing
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 0f06a19b..c4268deb 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -354,6 +354,23 @@ void Weapon_RocketLauncher_Fire (gentity_t *ent) {
// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
}
+/*
+======================================================================
+
+PLASMAGUN
+
+======================================================================
+*/
+
+void Weapon_Plasma_Fire (gentity_t *ent) {
+ gentity_t *m;
+
+ m = fire_plasma (ent, muzzle, forward);
+ m->damage *= s_quadFactor;
+ m->splashDamage *= s_quadFactor;
+
+// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
+}
/*
======================================================================
@@ -388,7 +405,8 @@ weapon_railgun_fire
=================
*/
#define MAX_RAIL_HITS 4
-void weapon_railgun_fire (gentity_t *ent) {
+void weapon_railgun_fire( gentity_t *ent )
+{
vec3_t end;
trace_t trace;
gentity_t *tent;
@@ -408,31 +426,30 @@ void weapon_railgun_fire (gentity_t *ent) {
unlinked = 0;
hits = 0;
passent = ent->s.number;
- do {
+
+ do
+ {
trap_Trace (&trace, muzzle, NULL, NULL, end, passent, MASK_SHOT );
- if ( trace.entityNum >= ENTITYNUM_MAX_NORMAL ) {
+ if ( trace.entityNum >= ENTITYNUM_MAX_NORMAL )
break;
- }
+
traceEnt = &g_entities[ trace.entityNum ];
- if ( traceEnt->takedamage ) {
- if( LogAccuracyHit( traceEnt, ent ) ) {
- hits++;
- }
- G_Damage (traceEnt, ent, ent, forward, trace.endpos, damage, 0, MOD_RAILGUN);
- }
- if ( trace.contents & CONTENTS_SOLID ) {
+ if ( traceEnt->takedamage )
+ G_Damage( traceEnt, ent, ent, forward, trace.endpos, damage, 0, MOD_RAILGUN );
+
+ if ( trace.contents & CONTENTS_SOLID )
break; // we hit something solid enough to stop the beam
- }
+
// unlink this entity, so the next trace will go past it
trap_UnlinkEntity( traceEnt );
unlinkedEntities[unlinked] = traceEnt;
unlinked++;
- } while ( unlinked < MAX_RAIL_HITS );
+ }
+ while ( unlinked < MAX_RAIL_HITS );
// link back in any entities we unlinked
- for ( i = 0 ; i < unlinked ; i++ ) {
+ for ( i = 0 ; i < unlinked ; i++ )
trap_LinkEntity( unlinkedEntities[i] );
- }
// the final trace endpos will be the terminal point of the rail trail
@@ -447,35 +464,15 @@ void weapon_railgun_fire (gentity_t *ent) {
VectorCopy( muzzle, tent->s.origin2 );
// move origin a bit to come closer to the drawn gun muzzle
- VectorMA( tent->s.origin2, 4, right, tent->s.origin2 );
- VectorMA( tent->s.origin2, -1, up, tent->s.origin2 );
+ VectorMA( tent->s.origin2, 16, up, tent->s.origin2 );
// no explosion at end if SURF_NOIMPACT, but still make the trail
- if ( trace.surfaceFlags & SURF_NOIMPACT ) {
+ if ( trace.surfaceFlags & SURF_NOIMPACT )
tent->s.eventParm = 255; // don't make the explosion at the end
- } else {
+ else
tent->s.eventParm = DirToByte( trace.plane.normal );
- }
+
tent->s.clientNum = ent->s.clientNum;
-
- // give the shooter a reward sound if they have made two railgun hits in a row
- if ( hits == 0 ) {
- // complete miss
- ent->client->accurateCount = 0;
- } else {
- // check for "impressive" reward sound
- ent->client->accurateCount += hits;
- if ( ent->client->accurateCount >= 2 ) {
- ent->client->accurateCount -= 2;
- ent->client->ps.persistant[PERS_IMPRESSIVE_COUNT]++;
- // add the sprite over the player's head
- //ent->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP );
- ent->client->ps.eFlags |= EF_AWARD_IMPRESSIVE;
- ent->client->rewardTime = level.time + REWARD_SPRITE_TIME;
- }
- ent->client->accuracy_hits++;
- }
-
}
@@ -769,15 +766,24 @@ void FireWeapon( gentity_t *ent ) {
s_quadFactor = 1;
}
- // track shots taken for accuracy tracking. Grapple is not a weapon and gauntet is just not tracked
- if( ent->s.weapon != WP_GRAPPLING_HOOK && ent->s.weapon != WP_GAUNTLET ) {
- ent->client->accuracy_shots++;
- }
+ if( ent->client )
+ {
+ // track shots taken for accuracy tracking. Grapple is not a weapon and gauntet is just not tracked
+ if( ent->s.weapon != WP_GRAPPLING_HOOK && ent->s.weapon != WP_GAUNTLET ) {
+ ent->client->accuracy_shots++;
+ }
- // set aiming directions
- AngleVectors (ent->client->ps.viewangles, forward, right, up);
+ // set aiming directions
+ AngleVectors (ent->client->ps.viewangles, forward, right, up);
+
+ CalcMuzzlePoint( ent, forward, right, up, muzzle );
+ }
+ else
+ {
+ AngleVectors( ent->s.angles2, forward, right, up );
- CalcMuzzlePoint( ent, forward, right, up, muzzle );
+ VectorCopy( ent->s.pos.trBase, muzzle );
+ }
// fire the specific weapon
switch( ent->s.weapon ) {
@@ -809,6 +815,9 @@ void FireWeapon( gentity_t *ent ) {
case WP_FLAMER:
Weapon_Flamer_Fire( ent );
break;
+ case WP_PLASMAGUN:
+ Weapon_Plasma_Fire( ent );
+ break;
case WP_RAILGUN:
weapon_railgun_fire( ent );
break;