summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_active.c8
-rw-r--r--src/game/g_buildable.c26
-rw-r--r--src/game/g_client.c1
3 files changed, 14 insertions, 21 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 492ab015..3ae9c561 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1367,13 +1367,9 @@ void ClientThink_real( gentity_t *ent )
if( ent->client->lastKillTime + FREEKILL_PERIOD < level.time )
{
if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- G_AddCreditToClient( ent->client, FREEKILL_ALIEN, qtrue );
- }
+ G_AddCreditToClient( ent->client, FREEKILL_ALIEN, qtrue );
else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- G_AddCreditToClient( ent->client, FREEKILL_HUMAN, qtrue );
- }
+ G_AddCreditToClient( ent->client, FREEKILL_HUMAN, qtrue );
ent->client->lastKillTime = level.time;
}
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 6245e7ac..92599d38 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1285,7 +1285,7 @@ ADef_fireonemeny
Used by ADef2_Think to fire at enemy
================
*/
-void ADef_FireOnEnemy( gentity_t *self, int firespeed )
+void ADef_FireOnEnemy( gentity_t *self, int firespeed, float range )
{
vec3_t dirToTarget;
vec3_t halfAcceleration, thirdJerk;
@@ -1295,24 +1295,22 @@ void ADef_FireOnEnemy( gentity_t *self, int firespeed )
VectorScale( self->enemy->acceleration, 1.0f / 2.0f, halfAcceleration );
VectorScale( self->enemy->jerk, 1.0f / 3.0f, thirdJerk );
- //O( time ) - worst case O( time ) = 250 iterations
+ //O( time ) - worst case O( time ) = ( range * 1000 ) / speed
for( i = 0; (float)( i * LOCKBLOB_SPEED ) / 1000.0f < distanceToTarget; i++ )
{
float time = (float)i / 1000.0f;
- if( i > 250 )
+ if( i > ( ( (float)range * 1000.0f ) / LOCKBLOB_SPEED ) )
{
+ VectorSubtract( self->enemy->s.pos.trBase, self->s.pos.trBase, dirToTarget );
+ distanceToTarget = VectorLength( dirToTarget );
+
G_LogPrintf( "ADef_FireOnEnemy failed.\n"
- " %dth iteration\n"
- " enemy location: %v\n"
- " enemy accleration: %v\n"
- " enemy jerk: %v\n"
- " base location: %v\n",
- i,
- self->enemy->s.pos.trBase,
- self->enemy->acceleration,
- self->enemy->jerk,
- self->s.pos.trBase );
+ " %dth iteration\n enemy location: %v\n"
+ " enemy accleration: %v\n enemy jerk: %v\n"
+ " base location: %v\n distanceToTarget: %f\n",
+ i, self->enemy->s.pos.trBase, self->enemy->acceleration,
+ self->enemy->jerk, self->s.pos.trBase, distanceToTarget );
return;
}
@@ -1443,7 +1441,7 @@ void ATrapper_Think( gentity_t *self )
//if we are pointing at our target and we can fire shoot it
if( self->count < level.time )
- ADef_FireOnEnemy( self, firespeed );
+ ADef_FireOnEnemy( self, firespeed, range );
}
}
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 23fca525..5ca073b8 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1477,7 +1477,6 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
client->ps.pm_time = 100;
client->respawnTime = level.time;
- client->lastKillTime = level.time;
client->inactivityTime = level.time + g_inactivity.integer * 1000;
client->latched_buttons = 0;