summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_active.c156
-rw-r--r--src/game/g_buildable.c2
-rw-r--r--src/game/g_client.c1
-rw-r--r--src/game/g_combat.c1
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/tremulous.h4
6 files changed, 79 insertions, 87 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 68939ce6..b00bbc97 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -720,88 +720,6 @@ void ClientTimerActions( gentity_t *ent, int msec )
0, damage, 0, MOD_POISON );
}
- //replenish alien health
- if( client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS &&
- level.surrenderTeam != TEAM_ALIENS )
- {
- int entityList[ MAX_GENTITIES ];
- vec3_t range = { LEVEL4_REGEN_RANGE, LEVEL4_REGEN_RANGE, LEVEL4_REGEN_RANGE };
- vec3_t mins, maxs;
- int i, num;
- gentity_t *boostEntity;
- float modifier = 1.0f, new_modifier;
- qboolean creep;
-
- VectorAdd( client->ps.origin, range, maxs );
- VectorSubtract( client->ps.origin, range, mins );
-
- num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
- for( i = 0; i < num; i++ )
- {
- boostEntity = &g_entities[ entityList[ i ] ];
-
- new_modifier = 0.0f;
- if( boostEntity->s.eType == ET_BUILDABLE &&
- boostEntity->s.modelindex == BA_A_BOOSTER &&
- boostEntity->spawned && boostEntity->health > 0 &&
- G_FindOvermind( boostEntity ) )
- new_modifier = BOOSTER_REGEN_MOD;
- else if( boostEntity->client && boostEntity->health > 0 &&
- boostEntity->client->pers.teamSelection == TEAM_ALIENS )
- {
- if( boostEntity->client->pers.classSelection == PCL_ALIEN_LEVEL1_UPG )
- new_modifier = LEVEL1_UPG_REGEN_MOD;
- else if( boostEntity->client->pers.classSelection == PCL_ALIEN_LEVEL1 )
- new_modifier = LEVEL1_REGEN_MOD;
- }
- if( new_modifier > modifier )
- modifier = new_modifier;
- }
-
- creep = G_FindCreep( ent );
-
- // Transmit heal rate to the client so the HUD can display it properly
- client->ps.stats[ STAT_STATE ] &= ~( SS_HEALING_2X | SS_HEALING_3X );
- if( modifier >= 3.0f )
- client->ps.stats[ STAT_STATE ] |= SS_HEALING_3X;
- else if( modifier >= 2.0f )
- client->ps.stats[ STAT_STATE ] |= SS_HEALING_2X;
- if( creep || modifier != 1.0f )
- client->ps.stats[ STAT_STATE ] |= SS_HEALING_ACTIVE;
- else
- client->ps.stats[ STAT_STATE ] &= ~SS_HEALING_ACTIVE;
-
- if( ent->health > 0 &&
- ent->health < client->ps.stats[ STAT_MAX_HEALTH ] &&
- ( ent->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time )
- {
- if( modifier == 1.0f && !creep )
- {
- if( ( ent->lastRegenTime + ALIEN_REGEN_NOCREEP_TIME ) < level.time )
- {
- ent->health +=
- BG_Class( client->ps.stats[ STAT_CLASS ] )->regenRate;
- ent->lastRegenTime = level.time;
- }
- }
- else
- {
- ent->health += modifier *
- BG_Class( client->ps.stats[ STAT_CLASS ] )->regenRate;
- ent->lastRegenTime = level.time;
- }
- }
-
- if( ent->health >= client->ps.stats[ STAT_MAX_HEALTH ] )
- {
- int i;
- ent->health = client->ps.stats[ STAT_MAX_HEALTH ];
- for( i = 0; i < MAX_CLIENTS; i++ )
- ent->credits[ i ] = 0;
- }
-
- }
-
// turn off life support when a team admits defeat
if( client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS &&
level.surrenderTeam == TEAM_ALIENS )
@@ -1480,6 +1398,80 @@ void ClientThink_real( gentity_t *ent )
}
}
+ // Replenish alien health
+ while( ent->nextRegenTime < level.time )
+ {
+ int regenRate = BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->regenRate;
+
+ if( ent->nextRegenTime < 0 || regenRate == 0 )
+ {
+ ent->nextRegenTime = -1;
+ break; // no regen
+ }
+
+ if( level.surrenderTeam != ent->client->pers.teamSelection )
+ {
+ int entityList[ MAX_GENTITIES ];
+ int i, num;
+ vec3_t range, mins, maxs;
+ float modifier = 1.0f;
+
+ VectorSet( range, REGEN_BOOST_RANGE, REGEN_BOOST_RANGE,
+ REGEN_BOOST_RANGE );
+ VectorAdd( ent->client->ps.origin, range, maxs );
+ VectorSubtract( ent->client->ps.origin, range, mins );
+
+ num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
+ for( i = 0; i < num; i++ )
+ {
+ gentity_t *boost = &g_entities[ entityList[ i ] ];
+
+ if( modifier < BOOSTER_REGEN_MOD && boost->s.eType == ET_BUILDABLE &&
+ boost->s.modelindex == BA_A_BOOSTER && boost->spawned &&
+ boost->health > 0 && level.overmindPresent )
+ {
+ modifier = BOOSTER_REGEN_MOD;
+ continue;
+ }
+
+ if( boost->s.eType == ET_PLAYER && boost->client &&
+ boost->client->pers.teamSelection ==
+ ent->client->pers.teamSelection && boost->health > 0 )
+ {
+ class_t class = boost->client->ps.stats[ STAT_CLASS ];
+ if( class == PCL_ALIEN_LEVEL1 && modifier < LEVEL1_REGEN_MOD )
+ modifier = LEVEL1_REGEN_MOD;
+ else if( class == PCL_ALIEN_LEVEL1_UPG &&
+ modifier < LEVEL1_UPG_REGEN_MOD )
+ modifier = LEVEL1_UPG_REGEN_MOD;
+ }
+ }
+
+ // Transmit heal rate to the client so it can be displayed on the HUD
+ ent->client->ps.stats[ STAT_STATE ] |= SS_HEALING_ACTIVE;
+ ent->client->ps.stats[ STAT_STATE ] &= ~( SS_HEALING_2X | SS_HEALING_3X );
+ if( modifier == 1.0f && !G_FindCreep( ent ) )
+ {
+ ent->client->ps.stats[ STAT_STATE ] &= ~SS_HEALING_ACTIVE;
+ modifier /= 3.0f;
+ }
+ else if( modifier >= 3.0f )
+ ent->client->ps.stats[ STAT_STATE ] |= SS_HEALING_3X;
+ else if( modifier >= 2.0f )
+ ent->client->ps.stats[ STAT_STATE ] |= SS_HEALING_2X;
+
+ ent->health += 1;
+ // if at max health, clear damage counters
+ if( ent->health >= ent->client->ps.stats[ STAT_MAX_HEALTH ] )
+ {
+ ent->health = ent->client->ps.stats[ STAT_MAX_HEALTH ];
+ for( i = 0; i < MAX_CLIENTS; i++ )
+ ent->credits[ i ] = 0;
+ }
+ ent->nextRegenTime += 1000 / ( regenRate * modifier );
+ }
+ }
+
if( BG_InventoryContainsUpgrade( UP_GRENADE, client->ps.stats ) &&
BG_UpgradeIsActive( UP_GRENADE, client->ps.stats ) )
{
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 5580bd88..af3ee8ec 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -2389,8 +2389,6 @@ void G_QueueBuildPoints( gentity_t *self )
{
gentity_t *killer = NULL;
- G_Printf( "G_QueueBuildPoints( %s )\n", BG_TeamName( self->buildableTeam ) );
-
if( self->killedBy != ENTITYNUM_NONE )
killer = &g_entities[ self->killedBy ];
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 8b9beb5d..10445e5e 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1581,6 +1581,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
client->respawnTime = level.time;
client->lastKillTime = level.time;
+ ent->nextRegenTime = level.time;
client->inactivityTime = level.time + g_inactivity.integer * 1000;
client->latched_buttons = 0;
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 5cb879f1..753ff673 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -1125,6 +1125,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
targ->client->ps.stats[ STAT_HEALTH ] = targ->health;
targ->lastDamageTime = level.time;
+ targ->nextRegenTime = level.time + ALIEN_REGEN_DAMAGE_TIME;
// add to the attackers "account" on the target
if( attacker->client && attacker != targ && !OnSameTeam( targ, attacker ) )
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 8720c91c..d74982c5 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -242,7 +242,7 @@ struct gentity_s
int suicideTime; // when the client will suicide
int lastDamageTime;
- int lastRegenTime;
+ int nextRegenTime;
qboolean zapping; // adv maurader is zapping
qboolean wasZapping; // adv maurader was zapping
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index dced83e5..7aac077c 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -115,7 +115,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define LEVEL4_CLAW_HEIGHT 20.0f
#define LEVEL4_CLAW_REPEAT 750
#define LEVEL4_CLAW_K_SCALE 1.0f
-#define LEVEL4_REGEN_RANGE 200.0f
#define LEVEL4_TRAMPLE_DMG ADM(111)
#define LEVEL4_TRAMPLE_SPEED 2.0f
@@ -338,6 +337,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define ALIENSENSE_RANGE 1000.0f
+#define REGEN_BOOST_RANGE 200.0f
#define ALIEN_POISON_TIME 10000
#define ALIEN_POISON_DMG 5
@@ -345,7 +345,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define ALIEN_SPAWN_REPEAT_TIME 10000
-#define ALIEN_REGEN_DAMAGE_TIME 2000 //msec since damage that regen starts again
+#define ALIEN_REGEN_DAMAGE_TIME 1500 //msec since damage that regen starts again
#define ALIEN_REGEN_NOCREEP_TIME 3000 //msec between regen off creep
#define ALIEN_MAX_FRAGS 9