diff options
author | John Ellis <johne@verizon.net> | 2010-11-14 15:41:17 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:43 +0000 |
commit | 9e56da44d1dfa0e61b19c2fad0db8a40f658e9ef (patch) | |
tree | 2b250626ef3149119de2c9ee9dda39306d6f6efc /src | |
parent | 344bde640278d92c1cae2802e72ba6d866d25006 (diff) |
* (bug 4759) Make trigger_ammo use the primary weapon so that
holding a blaster does not subtract ammo. ( thanks Teapot )
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_trigger.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index df17ff18..65bf1bd1 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -1083,6 +1083,7 @@ trigger_ammo_touch void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) { int maxClips, maxAmmo; + weapon_t weapon; if( !other->client ) return; @@ -1096,10 +1097,11 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) if( other->client->ps.weaponstate != WEAPON_READY ) return; - if( BG_Weapon( other->client->ps.weapon )->usesEnergy && self->spawnflags & 2 ) + weapon = BG_PrimaryWeapon( other->client->ps.stats ); + if( BG_Weapon( weapon )->usesEnergy && self->spawnflags & 2 ) return; - if( !BG_Weapon( other->client->ps.weapon )->usesEnergy && self->spawnflags & 4 ) + if( !BG_Weapon( weapon )->usesEnergy && self->spawnflags & 4 ) return; if( self->spawnflags & 1 ) @@ -1107,8 +1109,8 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) else self->timestamp = level.time + FRAMETIME; - maxAmmo = BG_Weapon( other->client->ps.weapon )->maxAmmo; - maxClips = BG_Weapon( other->client->ps.weapon )->maxClips; + maxAmmo = BG_Weapon( weapon )->maxAmmo; + maxClips = BG_Weapon( weapon )->maxClips; if( ( other->client->ps.ammo + self->damage ) > maxAmmo ) { |