diff --git a/Source/Globals.h b/Source/Globals.h index 06b68ca6..22df69b2 100644 --- a/Source/Globals.h +++ b/Source/Globals.h @@ -228,8 +228,9 @@ enum { #define INPUT_BUTTON5 16 #define INPUT_BUTTON6 32 -#define FL_USERELEASED 8192 -#define FL_CROUCHING 16384 +#define FL_USERELEASED 8192 +#define FL_CROUCHING 16384 +#define FL_SEMI_TOGGLED 32768 float clamp(float d, float imin, float imax) { float t; diff --git a/Source/Server/Input.c b/Source/Server/Input.c index 9cf721eb..7e1e69b4 100644 --- a/Source/Server/Input.c +++ b/Source/Server/Input.c @@ -42,6 +42,8 @@ void Input_Handle( void ) { Weapon_Reload( self.weapon ); } else if ( self.button5 ) { Weapon_SecondaryAttack( self.weapon ); + } else { + Weapon_Release(); } if ( self.button6 ) { diff --git a/Source/Shared/WeaponBase.c b/Source/Shared/WeaponBase.c index d95298e8..27da550a 100644 --- a/Source/Shared/WeaponBase.c +++ b/Source/Shared/WeaponBase.c @@ -101,6 +101,10 @@ float OpenCSGunBase_PrimaryFire( void ) { return FALSE; } + if ( wptTable[ self.weapon ].fWeaponType == TYPE_SEMI ) { + self.flags = self.flags - ( self.flags & FL_SEMI_TOGGLED ); + } + OpenCSGunBase_AccuracyCalc(); TraceAttack_FireBullets( wptTable[ self.weapon ].iBullets ); diff --git a/Source/Shared/Weapons.c b/Source/Shared/Weapons.c index d54da846..6048339e 100644 --- a/Source/Shared/Weapons.c +++ b/Source/Shared/Weapons.c @@ -76,6 +76,8 @@ void Weapon_PrimaryAttack( float fWeapon ) { if ( self.fAttackFinished > time ) { return; } + if ( !( self.flags & FL_SEMI_TOGGLED ) ) + return; #endif wpnFuncTable[ fWeapon ].vPrimary(); @@ -102,6 +104,10 @@ void Weapon_Reload( float fWeapon ) { } #ifdef SSQC +void Weapon_Release( void ) { + self.flags = self.flags | FL_SEMI_TOGGLED; +} + void Weapon_Switch( int iSlot ) { float fWeapon;