diff options
author | Tim Angus <tim@ngus.net> | 2005-09-01 21:19:10 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-09-01 21:19:10 +0000 |
commit | e7939256c27f42cbdec1a3648482563118c628d1 (patch) | |
tree | a08ef8b324187a0e4372c42dedebda6c043f6bb5 /src/cgame | |
parent | 843544049f06b2b60bbf4e0f6964aa7a36924ffd (diff) |
* Reworked how weapon changes are performed, fixing bugs in the process
* Weapon now drops momentarily when reloading
* The stage kill counters are now incremented for structure kills if players did more then 50% of the total damage
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_event.c | 7 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 1 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 78 |
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 =============== */ |