diff options
author | Tim Angus <tim@ngus.net> | 2001-05-07 16:09:41 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-05-07 16:09:41 +0000 |
commit | c24682b923c47083bfd83c7fd929f162c5b24f3b (patch) | |
tree | 022305dfb436b265bf092f81882d2da2732131e1 | |
parent | 63c14b02a7f7e44c5ee99a999bc0477cded7cb9a (diff) |
No weapon handled better.
-rw-r--r-- | src/cgame/cg_draw.c | 16 | ||||
-rw-r--r-- | src/cgame/cg_playerstate.c | 3 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 26 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 19 |
4 files changed, 42 insertions, 22 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 1c2067ca..a265a329 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -2119,19 +2119,21 @@ static void CG_DrawAmmoWarning( void ) { const char *s; int w; - if ( cg_drawAmmoWarning.integer == 0 ) { + //TA: hack + if( cg.snap->ps.weapon == WP_NONE ) + return; + + if ( cg_drawAmmoWarning.integer == 0 ) return; - } - if ( !cg.lowAmmoWarning ) { + if ( !cg.lowAmmoWarning ) return; - } - if ( cg.lowAmmoWarning == 2 ) { + if ( cg.lowAmmoWarning == 2 ) s = "OUT OF AMMO"; - } else { + else s = "LOW AMMO WARNING"; - } + w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; CG_DrawBigString(320 - w / 2, 64, s, 1.0F); } diff --git a/src/cgame/cg_playerstate.c b/src/cgame/cg_playerstate.c index 76e196a0..05c8805f 100644 --- a/src/cgame/cg_playerstate.c +++ b/src/cgame/cg_playerstate.c @@ -66,7 +66,8 @@ void CG_CheckAmmo( void ) { total += ammo * 200; break; } - if ( total >= 5000 || BG_infiniteAmmo( i ) ) { + if ( total >= 5000 || BG_infiniteAmmo( i ) ) + { cg.lowAmmoWarning = 0; return; } diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 318e227a..a6997290 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -934,7 +934,8 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent gun.renderfx = parent->renderfx; // set custom shading for railgun refire rate - if ( ps ) { + if ( ps ) + { if ( cg.predictedPlayerState.weapon == WP_RAILGUN && cg.predictedPlayerState.weaponstate == WEAPON_FIRING ) { float f; @@ -1075,6 +1076,10 @@ void CG_AddViewWeapon( playerState_t *ps ) { return; } + //TA: no weapon carried - can't draw it + if( ps->weapon == WP_NONE ) + return; + if ( ps->pm_type == PM_INTERMISSION ) { return; } @@ -1235,13 +1240,22 @@ void CG_DrawWeaponSelect( void ) { y += 20; } + + //TA: yuck! :) + if( y == 10 ) + { + trap_R_SetColor( NULL ); + return; + } // draw the selected name if( cg.weaponSelect <= 32 ) { - if ( cg_weapons[ cg.weaponSelect ].item ) { + if ( cg_weapons[ cg.weaponSelect ].item ) + { name = cg_weapons[ cg.weaponSelect ].item->pickup_name; - if ( name ) { + if ( name ) + { w = CG_DrawStrlen( name ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH - w ) / 2; CG_DrawBigStringColor(x, y - 22, name, color); @@ -1250,9 +1264,11 @@ void CG_DrawWeaponSelect( void ) { } else if( cg.weaponSelect > 32 ) { - if ( cg_upgrades[ cg.weaponSelect - 32 ].item ) { + if ( cg_upgrades[ cg.weaponSelect - 32 ].item ) + { name = cg_upgrades[ cg.weaponSelect - 32 ].item->pickup_name; - if ( name ) { + if ( name ) + { w = CG_DrawStrlen( name ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH - w ) / 2; CG_DrawBigStringColor(x, y - 22, name, color); 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; } |