summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_event.c7
-rw-r--r--src/cgame/cg_servercmds.c1
-rw-r--r--src/cgame/cg_weapons.c78
3 files changed, 43 insertions, 43 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 4ac8f984..64f23f52 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -672,13 +672,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.selectSound );
break;
- case EV_NEXT_WEAPON:
- DEBUGNAME( "EV_NEXT_WEAPON" );
-
- if( clientNum == cg.predictedPlayerState.clientNum )
- CG_NextWeapon_f( );
- break;
-
case EV_FIRE_WEAPON:
DEBUGNAME( "EV_FIRE_WEAPON" );
CG_FireWeapon( cent, WPM_PRIMARY );
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 90b74f8c..3f73fb75 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -1057,6 +1057,7 @@ static void CG_ServerCommand( void )
if( !strcmp( cmd, "weaponswitch" ) )
{
+ CG_Printf( "client weaponswitch\n" );
if( trap_Argc( ) == 2 )
{
cg.weaponSelect = atoi( CG_Argv( 1 ) );
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index c67eaa04..3f468b21 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -1312,6 +1312,42 @@ WEAPON SELECTION
==============================================================================
*/
+/*
+===============
+CG_WeaponSelectable
+===============
+*/
+static qboolean CG_WeaponSelectable( int i )
+{
+ int ammo, clips;
+
+ BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips );
+
+ //TA: this is a pain in the ass
+ //if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) )
+ // return qfalse;
+
+ if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) )
+ return qfalse;
+
+ return qtrue;
+}
+
+
+/*
+===============
+CG_UpgradeSelectable
+===============
+*/
+static qboolean CG_UpgradeSelectable( int i )
+{
+ if( !BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) )
+ return qfalse;
+
+ return qtrue;
+}
+
+
#define ICON_BORDER 4
/*
@@ -1342,6 +1378,12 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color )
if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 )
return;
+ // first make sure that whatever it selected is actually selectable
+ if( cg.weaponSelect <= 32 && !CG_WeaponSelectable( cg.weaponSelect ) )
+ CG_NextWeapon_f( );
+ else if( cg.weaponSelect > 32 && !CG_UpgradeSelectable( cg.weaponSelect ) )
+ CG_NextWeapon_f( );
+
// showing weapon select clears pickup item display, but not the blend blob
cg.itemPickupTime = 0;
@@ -1465,42 +1507,6 @@ void CG_DrawItemSelectText( rectDef_t *rect, float scale, int textStyle )
/*
===============
-CG_WeaponSelectable
-===============
-*/
-static qboolean CG_WeaponSelectable( int i )
-{
- int ammo, clips;
-
- BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips );
-
- //TA: this is a pain in the ass
- //if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) )
- // return qfalse;
-
- if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) )
- return qfalse;
-
- return qtrue;
-}
-
-
-/*
-===============
-CG_UpgradeSelectable
-===============
-*/
-static qboolean CG_UpgradeSelectable( int i )
-{
- if( !BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) )
- return qfalse;
-
- return qtrue;
-}
-
-
-/*
-===============
CG_NextWeapon_f
===============
*/