diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-06-29 00:52:09 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-06-29 16:40:28 +0200 |
commit | 0918eb3bcdefd0d6ee4bd573b761454c99f032f6 (patch) | |
tree | dd1bd0bfe5348ad3b4860f11b7d3dcbb6db9ca3c /src/game/g_weapon.c | |
parent | 93d2e4414ee25e417ee0d2ca0248448002ea4d5b (diff) |
Initial implementation of new grenades.
Diffstat (limited to 'src/game/g_weapon.c')
-rw-r--r-- | src/game/g_weapon.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 0925973..265358a 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -80,7 +80,12 @@ void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo ) for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { qboolean energyWeapon; - + + if( i == WP_GRENADE ) + { + continue; + } + energyWeapon = BG_Weapon( i )->usesEnergy; if( !BG_InventoryContainsWeapon( i, ent->client->ps.stats ) || BG_Weapon( i )->infiniteAmmo || @@ -626,9 +631,20 @@ GRENADE void throwGrenade( gentity_t *ent ) { + int fuse_left; + G_CombatStats_Fire( ent, CSW_GRENADE, GRENADE_DAMAGE ); - launch_grenade( ent, muzzle, forward ); + fuse_left = GRENADE_FUSE_TIME - ent->client->ps.stats[ STAT_MISC ]; + + if( fuse_left < 0 ) + { + fuse_left = 0; + } + + launch_grenade( ent, muzzle, forward, fuse_left ); + + ent->client->ps.stats[ STAT_MISC ] = 0; } /* @@ -937,7 +953,7 @@ void CheckCkitRepair( gentity_t *ent ) int bHealth; if( ent->client->ps.weaponTime > 0 || - ent->client->ps.stats[ STAT_MISC ] > 0 ) + ent->client->ps.stats[ STAT_BUILD_TIMER ] > 0 ) return; BG_GetClientViewOrigin( &ent->client->ps, viewOrigin ); @@ -997,7 +1013,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu ) if( buildable > BA_NONE ) { - if( ent->client->ps.stats[ STAT_MISC ] > 0 ) + if( ent->client->ps.stats[ STAT_BUILD_TIMER ] > 0 ) { G_AddEvent( ent, EV_BUILD_DELAY, ent->client->ps.clientNum ); return; @@ -1007,7 +1023,7 @@ void buildFire( gentity_t *ent, dynMenu_t menu ) { if( !g_cheats.integer ) { - ent->client->ps.stats[ STAT_MISC ] += + ent->client->ps.stats[ STAT_BUILD_TIMER ] += BG_Buildable( buildable )->buildTime; } |