summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2005-09-01 21:19:10 +0000
committerTim Angus <tim@ngus.net>2005-09-01 21:19:10 +0000
commite7939256c27f42cbdec1a3648482563118c628d1 (patch)
treea08ef8b324187a0e4372c42dedebda6c043f6bb5 /src/game/g_buildable.c
parent843544049f06b2b60bbf4e0f6964aa7a36924ffd (diff)
* Reworked how weapon changes are performed, fixing bugs in the process
* Weapon now drops momentarily when reloading * The stage kill counters are now incremented for structure kills if players did more then 50% of the total damage
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 21a3d059..fef7697c 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -1457,12 +1457,12 @@ void ATrapper_Think( gentity_t *self )
/*
================
-HRpt_Think
+HRepeater_Think
Think for human power repeater
================
*/
-void HRpt_Think( gentity_t *self )
+void HRepeater_Think( gentity_t *self )
{
int i;
qboolean reactor = qfalse;
@@ -1499,43 +1499,20 @@ void HRpt_Think( gentity_t *self )
/*
================
-HRpt_Use
+HRepeater_Use
Use for human power repeater
================
*/
-void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
+void HRepeater_Use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
- int maxAmmo, maxClips;
- weapon_t weapon;
- playerState_t *ps = &activator->client->ps;
-
- weapon = ps->weapon;
-
if( self->health <= 0 )
return;
if( !self->spawned )
return;
- if( activator->client->lastRefilTime + ENERGY_REFIL_TIME > level.time )
- return;
-
- if( !BG_FindUsesEnergyForWeapon( weapon ) )
- return;
-
- if( !BG_WeaponIsFull( weapon, ps->stats, ps->ammo, ps->powerups ) )
- {
- 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 );
-
- G_AddEvent( activator, EV_RPTUSE_SOUND, 0 );
- activator->client->lastRefilTime = level.time;
- }
+ G_GiveClientMaxAmmo( self, qtrue );
}
@@ -2717,14 +2694,14 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
case BA_H_REACTOR:
built->think = HReactor_Think;
built->die = HSpawn_Die;
- built->use = HRpt_Use;
+ built->use = HRepeater_Use;
built->powered = built->active = qtrue;
break;
case BA_H_REPEATER:
- built->think = HRpt_Think;
+ built->think = HRepeater_Think;
built->die = HSpawn_Die;
- built->use = HRpt_Use;
+ built->use = HRepeater_Use;
built->count = -1;
break;