Added semi-automatic fire

This commit is contained in:
Marco Hladik 2016-12-24 16:30:44 +01:00
parent 234b38bb44
commit 2b9aef8167
4 changed files with 15 additions and 2 deletions

View file

@ -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;

View file

@ -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 ) {

View file

@ -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 );

View file

@ -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;