summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-08-31 03:15:00 +0000
committerTim Angus <tim@ngus.net>2005-08-31 03:15:00 +0000
commitf40ad7c74f940dd0274cd0a82248a5a4e8846eac (patch)
tree1e045cd77b9fba27a2f967544df24bbd2f475885 /src/game/g_buildable.c
parent426a6d2269d5087ed6a83fe271f23e2e3b12d6f6 (diff)
* Reimplemented how buildables play damage sounds to not use the event system
* Reworked the ammo/clips packing system to remove the confusion of concepts * Marauder lightning now requires aim, does damage over time and chains to other entities * Implemented the Medkit -- a means for a human to restore health and cure poison in the field * "Disable Build Warnings" replaced with "Disable Warning Dialogs" and improved * Disabled client side ET_MISSILE collision * Sped spectator move speed up * Implemented "step down" physics for all characters; no more jumping down stairs * Re-adjusted step time values * Increased frequency with which the Acid Tube deals damage * G_RadiusSelectiveDamage no longer applies locational damage * Moved some speed adjustment code into prediction; should prevent some prediction misses * Tyrant can no longer charge up forever and must pass a specific minimum charge level * Wrapped all calls to trap_SendServerCommand in order to circumvent the q3amsgboom.cfg exploit * Implemented command queueing for commands sent to clients in order to prevent overflows even sv_floodProtect is off, but not by dropping commands * Added LOS check to creep slowing * Overmind now only complains if there are 0 spawns * Spawns can no longer be built when there is no Overmind/Reactor * The spawn closest to the point of death is chosen preferably if available * Evolving no longer restores all health * "give weapons" and "give ammo" cheats removed * Fixed restoration of energy weapons bug * When selling the battery pack, max ammo is given * Fixed a bug where locational damage could sometimes scale damage to 0 * Added stage information to the end of game stats * Hacked around trap_LinkEntity to allow missiles to have a bounding box displayed * Added G_ClosestEnt * Reduced Dragoon spitball damage from 120 to 110 * Reduced Tyrant claw damage from 120 to 100 * Reduced Tyrant charge damage from 160 to 110 * Increased Barricade regeneration rate from 12 to 14 * Increased Overmind health from 500 to 750 * Decreased Overmind regeneration rate from 10 to 6 * Doubled Blaster speed from 700 to 1400 * Reduced Painsaw damage from 18 to 15 * Reduced Painsaw range from 48.0 to 40.0 * Reduced Grenade price from 300 to 200 * Reduced Shotgun repeat rate from 1200 to 1000 * Increased Shotgun damage from 6 to 7 * Increased Mass driver damage from 35 to 38 * Increased Chaingun damage from 5 to 6 * Reduced Flamer repeat rate from 300 to 200 * Extended Flamer range * Increased ammo on all human weapons * Reduced splashdamage on MG Turrets * Moved build directory from tremulous to tremulous-dev
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c80
1 files changed, 43 insertions, 37 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 47815cb5..21a3d059 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -319,7 +319,7 @@ static qboolean findOvermind( gentity_t *self )
continue;
//if entity is an overmind calculate the distance to it
- if( ent->s.modelindex == BA_A_OVERMIND && ent->spawned )
+ if( ent->s.modelindex == BA_A_OVERMIND && ent->spawned && ent->health > 0 )
{
self->overmindNode = ent;
return qtrue;
@@ -424,19 +424,20 @@ creepSlow
Set any nearby humans' SS_CREEPSLOWED flag
================
*/
-static void creepSlow( buildable_t buildable, vec3_t origin )
+static void creepSlow( gentity_t *self )
{
- int entityList[ MAX_GENTITIES ];
- vec3_t range;
- vec3_t mins, maxs;
- int i, num;
- gentity_t *enemy;
- float creepSize = (float)BG_FindCreepSizeForBuildable( buildable );
+ int entityList[ MAX_GENTITIES ];
+ vec3_t range;
+ vec3_t mins, maxs;
+ int i, num;
+ gentity_t *enemy;
+ buildable_t buildable = self->s.modelindex;
+ float creepSize = (float)BG_FindCreepSizeForBuildable( buildable );
VectorSet( range, creepSize, creepSize, creepSize );
- VectorAdd( origin, range, maxs );
- VectorSubtract( origin, range, mins );
+ VectorAdd( self->s.origin, range, maxs );
+ VectorSubtract( self->s.origin, range, mins );
//find humans
num = trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES );
@@ -445,7 +446,8 @@ static void creepSlow( buildable_t buildable, vec3_t origin )
enemy = &g_entities[ entityList[ i ] ];
if( enemy->client && enemy->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS &&
- enemy->client->ps.groundEntityNum != ENTITYNUM_NONE )
+ enemy->client->ps.groundEntityNum != ENTITYNUM_NONE &&
+ G_Visible( self, enemy ) )
{
enemy->client->ps.stats[ STAT_STATE ] |= SS_CREEPSLOWED;
enemy->client->lastCreepSlowTime = level.time;
@@ -642,7 +644,7 @@ void ASpawn_Think( gentity_t *self )
}
}
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
}
@@ -709,7 +711,7 @@ void AOvermind_Think( gentity_t *self )
}
//low on spawns
- if( level.numAlienSpawns <= 1 && level.time > self->overmindSpawnsTimer )
+ if( level.numAlienSpawns <= 0 && level.time > self->overmindSpawnsTimer )
{
self->overmindSpawnsTimer = level.time + OVERMIND_SPAWNS_PERIOD;
G_BroadcastEvent( EV_OVERMIND_SPAWNS, 0 );
@@ -731,8 +733,10 @@ void AOvermind_Think( gentity_t *self )
self->lastHealth = self->health;
}
+ else
+ self->overmindSpawnsTimer = level.time + OVERMIND_SPAWNS_PERIOD;
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
}
@@ -829,7 +833,7 @@ void ABarricade_Think( gentity_t *self )
return;
}
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
}
@@ -874,7 +878,7 @@ void AAcidTube_Damage( gentity_t *self )
self->splashRadius, self, self->splashMethodOfDeath, PTE_ALIENS );
}
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
}
@@ -926,7 +930,7 @@ void AAcidTube_Think( gentity_t *self )
}
}
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
}
@@ -1002,7 +1006,7 @@ void AHive_Think( gentity_t *self )
}
}
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
}
@@ -1166,7 +1170,7 @@ void AHovel_Think( gentity_t *self )
G_setIdleBuildableAnim( self, BANIM_IDLE1 );
}
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
self->nextthink = level.time + 200;
}
@@ -1242,7 +1246,7 @@ Called when an alien touches a booster
*/
void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace )
{
- int ammo, clips, maxClips;
+ int maxAmmo, maxClips;
gclient_t *client = other->client;
if( !self->spawned )
@@ -1262,8 +1266,8 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace )
return;
//restore ammo, if any
- BG_FindAmmoForWeapon( client->ps.weapon, &ammo, &clips, &maxClips );
- BG_PackAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips );
+ BG_FindAmmoForWeapon( client->ps.weapon, &maxAmmo, &maxClips );
+ BG_PackAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips );
if( !( client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) )
{
@@ -1418,7 +1422,7 @@ void ATrapper_Think( gentity_t *self )
int range = BG_FindRangeForBuildable( self->s.modelindex );
int firespeed = BG_FindFireSpeedForBuildable( self->s.modelindex );
- creepSlow( self->s.modelindex, self->s.origin );
+ creepSlow( self );
self->nextthink = level.time + BG_FindNextThinkForBuildable( self->s.modelindex );
@@ -1520,14 +1524,14 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
if( !BG_FindUsesEnergyForWeapon( weapon ) )
return;
- if( !BG_WeaponIsFull( weapon, ps->ammo, ps->powerups ) )
+ if( !BG_WeaponIsFull( weapon, ps->stats, ps->ammo, ps->powerups ) )
{
- BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips );
+ BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );
if( BG_InventoryContainsUpgrade( UP_BATTPACK, ps->stats ) )
maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );
- BG_PackAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips, maxClips );
+ BG_PackAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips );
G_AddEvent( activator, EV_RPTUSE_SOUND, 0 );
activator->client->lastRefilTime = level.time;
@@ -1737,6 +1741,8 @@ void HMedistat_Think( gentity_t *self )
self->active = qtrue;
}
}
+ else if( !BG_InventoryContainsUpgrade( UP_MEDKIT, player->client->ps.stats ) )
+ BG_AddUpgradeToInventory( UP_MEDKIT, player->client->ps.stats );
}
}
}
@@ -1754,7 +1760,15 @@ void HMedistat_Think( gentity_t *self )
if( self->enemy->client && self->enemy->client->ps.stats[ STAT_STATE ] & SS_POISONED )
self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_POISONED;
+ if( self->enemy->client && self->enemy->client->ps.stats[ STAT_STATE ] & SS_MEDKIT_ACTIVE )
+ self->enemy->client->ps.stats[ STAT_STATE ] &= ~SS_MEDKIT_ACTIVE;
+
self->enemy->health++;
+
+ //if they're completely healed, give them a medkit
+ if( self->enemy->health >= self->enemy->client->ps.stats[ STAT_MAX_HEALTH ] &&
+ !BG_InventoryContainsUpgrade( UP_MEDKIT, self->enemy->client->ps.stats ) )
+ BG_AddUpgradeToInventory( UP_MEDKIT, self->enemy->client->ps.stats );
}
}
}
@@ -2347,7 +2361,8 @@ void G_BuildableThink( gentity_t *ent, int msec )
if( !ent->spawned )
ent->health += (int)( ceil( (float)bHealth / (float)( bTime * 0.001 ) ) );
- else if( ent->health > 0 && ent->health < bHealth && bRegen )
+ else if( ent->biteam == BIT_ALIENS && ent->health > 0 && ent->health < bHealth &&
+ bRegen && ( ent->lastDamageTime + ALIEN_REGEN_DAMAGE_TIME ) < level.time )
ent->health += bRegen;
if( ent->health > bHealth )
@@ -2498,12 +2513,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
//if none found...
if( i >= level.num_entities && buildable != BA_A_OVERMIND )
- {
- if( buildable == BA_A_SPAWN )
- reason = IBE_SPWNWARN;
- else
- reason = IBE_NOOVERMIND;
- }
+ reason = IBE_NOOVERMIND;
//can we only have one of these?
if( BG_FindUniqueTestForBuildable( buildable ) )
@@ -2532,10 +2542,6 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance
//tell player to build a repeater to provide power
if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER )
reason = IBE_REPEATER;
-
- //warn that the current spawn will not be externally powered
- if( buildable == BA_H_SPAWN )
- reason = IBE_TNODEWARN;
}
//this buildable requires a DCC