summaryrefslogtreecommitdiff
path: root/src/game/bg_pmove.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-05-07 16:09:41 +0000
committerTim Angus <tim@ngus.net>2001-05-07 16:09:41 +0000
commitc24682b923c47083bfd83c7fd929f162c5b24f3b (patch)
tree022305dfb436b265bf092f81882d2da2732131e1 /src/game/bg_pmove.c
parent63c14b02a7f7e44c5ee99a999bc0477cded7cb9a (diff)
No weapon handled better.
Diffstat (limited to 'src/game/bg_pmove.c')
-rw-r--r--src/game/bg_pmove.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 395b1983..440d4030 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -2042,11 +2042,11 @@ PM_BeginWeaponChange
===============
*/
static void PM_BeginWeaponChange( int weapon ) {
- if ( weapon <= WP_NONE || weapon >= WP_NUM_WEAPONS ) {
+ if ( weapon < WP_NONE || weapon >= WP_NUM_WEAPONS ) {
return;
}
- if ( !BG_gotWeapon( weapon, pm->ps->stats ) ) {
+ if ( !BG_gotWeapon( weapon, pm->ps->stats ) && weapon != WP_NONE ) {
return;
}
@@ -2164,10 +2164,15 @@ static void PM_Weapon( void ) {
pm->ps->weaponTime -= pml.msec;
}
+ //TA: if we haven't got the weapon
+ if( !BG_gotWeapon( pm->ps->weapon, pm->ps->stats ) && pm->ps->weapon != WP_NONE )
+ PM_BeginWeaponChange( WP_NONE );
+
// check for weapon change
// can't change if weapon is firing, but can change
// again if lowering or raising
- if ( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING ) {
+ if ( pm->ps->weaponTime <= 0 || pm->ps->weaponstate != WEAPON_FIRING )
+ {
//TA: must press use to switch weapons
if( pm->cmd.buttons & BUTTON_USE_HOLDABLE )
{
@@ -2176,7 +2181,7 @@ static void PM_Weapon( void ) {
if( pm->cmd.weapon <= 32 )
{
//if trying to select a weapon, select it
- if ( pm->ps->weapon != pm->cmd.weapon )
+ if( pm->ps->weapon != pm->cmd.weapon )
PM_BeginWeaponChange( pm->cmd.weapon );
}
else if( pm->cmd.weapon > 32 )
@@ -2185,13 +2190,9 @@ static void PM_Weapon( void ) {
if( BG_gotItem( pm->cmd.weapon - 32, pm->ps->stats ) ) //sanity check
{
if( BG_activated( pm->cmd.weapon - 32, pm->ps->stats ) )
- {
BG_deactivateItem( pm->cmd.weapon - 32, pm->ps->stats );
- }
else
- {
BG_activateItem( pm->cmd.weapon - 32, pm->ps->stats );
- }
}
}
pm->ps->pm_flags |= PMF_USE_ITEM_HELD;
@@ -2200,7 +2201,7 @@ static void PM_Weapon( void ) {
else
pm->ps->pm_flags &= ~PMF_USE_ITEM_HELD;
}
-
+
if ( pm->ps->weaponTime > 0 ) {
return;
}