diff options
author | Tim Angus <tim@ngus.net> | 2005-07-19 02:41:01 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-07-19 02:41:01 +0000 |
commit | e6cee5e1d9d160cf84e963fceda0261bbf563990 (patch) | |
tree | b7e9af1561e45b802bb3973be83cb96d213945b7 /src | |
parent | 5dbd741da16c5ab40969f1169b14781deb03ed38 (diff) |
* Added a sound to buying ammo
* Anticamp doesn't kick in unless you actually receive ammo
* Mass driver spawn clips now matches max clips (wtf?)
Diffstat (limited to 'src')
-rw-r--r-- | src/game/bg_misc.c | 18 | ||||
-rw-r--r-- | src/game/bg_public.h | 1 | ||||
-rw-r--r-- | src/game/g_buildable.c | 3 | ||||
-rw-r--r-- | src/game/g_cmds.c | 17 | ||||
-rw-r--r-- | src/game/tremulous.h | 2 |
5 files changed, 34 insertions, 7 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 15361e64..08484549 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -4797,6 +4797,24 @@ void BG_PackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clip /* ======================== +BG_WeaponIsFull + +Check if a weapon has full ammo +======================== +*/ +qboolean BG_WeaponIsFull( weapon_t weapon, int ammo[ ], int ammo2[ ] ) +{ + int maxAmmo, maxClips; + int quan, clips; + + BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips ); + BG_UnpackAmmoArray( weapon, ammo, ammo2, &quan, &clips, NULL ); + + return ( maxAmmo == quan ) && ( maxClips == clips ); +} + +/* +======================== BG_AddWeaponToInventory Give a player a weapon diff --git a/src/game/bg_public.h b/src/game/bg_public.h index f72f5791..0ac09d26 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1078,6 +1078,7 @@ typedef struct //TA: void BG_UnpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ); void BG_PackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips ); +qboolean BG_WeaponIsFull( weapon_t weapon, int ammo[ ], int ammo2[ ] ); void BG_AddWeaponToInventory( int weapon, int stats[ ] ); void BG_RemoveWeaponFromInventory( int weapon, int stats[ ] ); qboolean BG_InventoryContainsWeapon( int weapon, int stats[ ] ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 3d6e58a0..c9079f39 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1520,7 +1520,8 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) if( !BG_FindUsesEnergyForWeapon( weapon ) ) return; - if( !other->client->campingAtTheArmoury ) + if( !other->client->campingAtTheArmoury && + !BG_WeaponIsFull( weapon, ps->ammo, ps->powerups ) ) { BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 3a0c2612..384c9240 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1453,7 +1453,7 @@ static void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo ) if( !ent->client->campingAtTheArmoury || !ent->client->firedWeapon ) { - qboolean weaponType; + qboolean weaponType, successfullyBought = qfalse; for( i = WP_NONE; i < WP_NUM_WEAPONS; i++ ) { @@ -1463,8 +1463,8 @@ static void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo ) weaponType = !BG_FindUsesEnergyForWeapon( i ); if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) && - weaponType && - !BG_FindInfinteAmmoForWeapon( i ) ) + weaponType && !BG_FindInfinteAmmoForWeapon( i ) && + !BG_WeaponIsFull( i, ent->client->ps.ammo, ent->client->ps.powerups ) ) { BG_FindAmmoForWeapon( i, &quan, &clips, &maxClips ); @@ -1476,14 +1476,21 @@ static void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo ) if( BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) ) quan = (int)( (float)quan * BATTPACK_MODIFIER ); } + else + G_AddEvent( ent, EV_CHANGE_WEAPON, 0 ); BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, quan, clips, maxClips ); + + successfullyBought = qtrue; } } - ent->client->lastBoughtAmmoTime = level.time; - ent->client->campingAtTheArmoury = qtrue; + if( successfullyBought ) + { + ent->client->lastBoughtAmmoTime = level.time; + ent->client->campingAtTheArmoury = qtrue; + } } else { diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 0ee771e0..2416dff9 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -354,7 +354,7 @@ #define MDRIVER_PRICE 350 #define MDRIVER_CLIPSIZE 5 -#define MDRIVER_SPAWNCLIPS 2 +#define MDRIVER_SPAWNCLIPS 3 #define MDRIVER_MAXCLIPS 3 #define MDRIVER_DMG HDM(35) #define MDRIVER_REPEAT 1000 |