SERVER/CLIENT: Support for GamePad rumble

This commit is contained in:
cypress 2024-06-30 18:17:36 -07:00
parent fb31ead6cb
commit be9796f3f5
13 changed files with 236 additions and 124 deletions

View file

@ -210,22 +210,11 @@ int stopwatch_round_hr;
int stopwatch_round_isactive; int stopwatch_round_isactive;
float stopwatch_round_starttime; float stopwatch_round_starttime;
//controller buttons //
// GamePad Input Variables
/* //
reference: float GPButtonHeldBeginTime[24]; // Tracks time button down event is called, to track holding down for different actions.
0: A float last_input_deviceid; // The Device ID of the input hardware that last called CSQC_InputEvent, to target it directly.
1: B
2: X
3: Y
4: DPAD UP
5: DPAD DOWN
6: DPAD LEFT
7: DPAD RIGHT
*/
float GPActive[32];
float GPButtonHeldBeginTime[24];
string build_datetime; string build_datetime;
#define VERSION_STRING "v1.0" #define VERSION_STRING "v1.0"

View file

@ -923,6 +923,12 @@ void(float button, string key) setToBind =
noref float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent = noref float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent =
{ {
if (last_input_deviceid != devid)
print(sprintf("device id swapped to %d\n", last_input_deviceid));
last_input_deviceid = devid;
if (evtype == IE_KEYDOWN) { if (evtype == IE_KEYDOWN) {
switch (scanx) { switch (scanx) {
case K_GP_A: case K_GP_A:
@ -1068,45 +1074,12 @@ noref float(float evtype, float scanx, float chary, float devid) CSQC_InputEvent
return TRUE; return TRUE;
} }
} }
// Controller Menu Navigation
if (scanx == K_JOY2) {
GPActive[0] = TRUE;
}
if (scanx == K_JOY4) {
GPActive[1] = TRUE;
}
if (scanx == K_JOY1) {
GPActive[2] = TRUE;
}
} }
Input_Movecheck(scanx, 1); Input_Movecheck(scanx, 1);
return FALSE; return FALSE;
case IE_KEYUP: case IE_KEYUP:
// Controller Menu Navigation
if(in_menu != MENU_NONE) {
if (scanx == K_JOY2) {
GPActive[0] = FALSE;
}
if (scanx == K_JOY4) {
GPActive[1] = FALSE;
}
if (scanx == K_JOY1) {
GPActive[2] = FALSE;
}
}
Input_Movecheck(scanx, 0); Input_Movecheck(scanx, 0);
return FALSE; return FALSE;
case IE_MOUSEDELTA: case IE_MOUSEDELTA:
return FALSE; return FALSE;
@ -1192,6 +1165,9 @@ noref void() CSQC_Parse_Event =
screenflash_worktime = 0; screenflash_worktime = 0;
screenflash_starttime = time; screenflash_starttime = time;
break; break;
case CSQC_EVENT_RUMBLE:
gp_rumble(last_input_deviceid, readshort(), readshort(), readshort());
break;
case EVENT_WEAPONRECOIL: case EVENT_WEAPONRECOIL:
local vector rec; local vector rec;
rec_x = readcoord()/5; rec_x = readcoord()/5;

View file

@ -1089,15 +1089,6 @@ void(float index) Update_Button =
} }
}; };
float xd;
void() Controller_UpdateButton =
{
/*if (GPActive[0]) {
}*/
drawstring([0.025*g_width, 0.375*g_height, 0], ftos(GPActive[2]), [g_height * 0.020, g_height * 0.020, 1], [0.8,0.8,0.8], 1, 0);
}
float button_timer; float button_timer;
void(float index, float type) Button_Click = void(float index, float type) Button_Click =
{ {
@ -2188,9 +2179,4 @@ void() Draw_Menu =
{ {
Update_Button(i); Update_Button(i);
} }
// TODO - Controller Support
/*if (cvar("in_xinput")) {
Controller_UpdateButton();
}*/
}; };

View file

@ -637,6 +637,9 @@ void() zombie_attack2 =
DamageHandler (self.enemy, self, 40, DMG_TYPE_ZOMBIESWIPE); DamageHandler (self.enemy, self, 40, DMG_TYPE_ZOMBIESWIPE);
else else
DamageHandler (self.enemy, self, 50, DMG_TYPE_ZOMBIESWIPE); DamageHandler (self.enemy, self, 50, DMG_TYPE_ZOMBIESWIPE);
// Getting hit by Zombies triggers a GamePad rumble.
nzp_rumble(self.enemy, 1000, 1200, 75);
} }
} }
else return; else return;

View file

@ -265,6 +265,22 @@ void(entity target, float color, float duration, float type) nzp_screenflash =
} }
}; };
//
// nzp_rumble(target, low_frequency, high_frequency, duration)
// FTE equivalent of the nzp_rumble builtin.
//
void(entity target, float low_frequency, float high_frequency, float duration) nzp_rumble =
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, CSQC_EVENT_RUMBLE);
WriteShort(MSG_MULTICAST, low_frequency);
WriteShort(MSG_MULTICAST, high_frequency);
WriteShort(MSG_MULTICAST, duration);
msg_entity = target;
multicast('0 0 0', MULTICAST_ONE);
};
#endif // FTE #endif // FTE
void(float count) UpdatePlayerCount = { void(float count) UpdatePlayerCount = {

View file

@ -474,6 +474,9 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra
while(distance_y > 10 || distance_y < -10) { while(distance_y > 10 || distance_y < -10) {
distance_y /= 2; distance_y /= 2;
} }
// Give a heavy rumble for feedback of being in explosion vicinity.
nzp_rumble(ent, 1400, 2000, 200);
// apply // apply
ent.punchangle_x = distance_x; ent.punchangle_x = distance_x;

View file

@ -276,6 +276,7 @@ void (entity who, string name)
void (entity who, float version) nzp_setdoubletapver = #506; void (entity who, float version) nzp_setdoubletapver = #506;
void (entity who, float color, float duration, float type) nzp_screenflash = #507; void (entity who, float color, float duration, float type) nzp_screenflash = #507;
void (entity who, float state) nzp_lockviewmodel = #508; void (entity who, float state) nzp_lockviewmodel = #508;
void (entity who, float low_frequency, float high_frequency, float duration) nzp_rumble = #509;
// //
// constants // constants

View file

@ -114,7 +114,7 @@ void() PAnim_EnterDive3 =[ 4, PAnim_EnterDive4 ] {self.frame = 206;}
void() PAnim_EnterDive4 =[ 5, SUB_Null ] {self.frame = 207;} void() PAnim_EnterDive4 =[ 5, SUB_Null ] {self.frame = 207;}
// Flop from Dive // Flop from Dive
void() PAnim_Flop =[ 1, PAnim_Flop1 ] {self.frame = 208; self.tp_anim_time = time + 1;} void() PAnim_Flop =[ 1, PAnim_Flop1 ] {self.frame = 208; self.tp_anim_time = time + 1; nzp_rumble(self, 1000, 1200, 75);}
void() PAnim_Flop1 =[ 2, PAnim_Flop2 ] {self.frame = 209;} void() PAnim_Flop1 =[ 2, PAnim_Flop2 ] {self.frame = 209;}
void() PAnim_Flop2 =[ 3, PAnim_Flop3 ] {self.frame = 210;} void() PAnim_Flop2 =[ 3, PAnim_Flop3 ] {self.frame = 210;}
void() PAnim_Flop3 =[ 4, SUB_Null ] {self.frame = 211;} void() PAnim_Flop3 =[ 4, SUB_Null ] {self.frame = 211;}

View file

@ -124,6 +124,8 @@ void() Betty_Drop =
self.animend = W_PlayTakeOut; self.animend = W_PlayTakeOut;
self.callfuncat = 0; self.callfuncat = 0;
self.isBuying = false; self.isBuying = false;
nzp_rumble(self, 1000, 1200, 75);
} }
// //

View file

@ -88,7 +88,11 @@ void () W2_Frame_Update =
} }
} }
} }
PlayWeaponSound(self.weapon, self.weapon2_anim_type, FALSE, self.weapon2frame);
if (PlayWeaponSound(self.weapon, self.weapon2_anim_type, FALSE, self.weapon2frame)) {
// Slight rumble because we triggered a weapon sound
nzp_rumble(self, 1000, 1200, 75);
}
return; return;
} }
else else
@ -151,11 +155,17 @@ void () W_Frame_Update =
} }
} }
} }
PlayWeaponSound(self.weapon, self.weapon_anim_type, FALSE, self.weaponframe);
if (PlayWeaponSound(self.weapon, self.weapon_anim_type, FALSE, self.weaponframe)) {
// Slight rumble because we triggered a weapon sound
nzp_rumble(self, 1000, 1200, 75);
}
// FIXME: We need a way to play sounds at specific frames for any viewmodel, not just weapons // FIXME: We need a way to play sounds at specific frames for any viewmodel, not just weapons
if (self.weaponmodel == "models/weapons/grenade/v_betty.mdl" && self.weaponframe == 9) if (self.weaponmodel == "models/weapons/grenade/v_betty.mdl" && self.weaponframe == 9) {
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/prime.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "sounds/weapons/grenade/prime.wav", 1, ATTN_NORM);
nzp_rumble(self, 1000, 1200, 75);
}
return; return;
} }
else else

View file

@ -100,6 +100,9 @@ void() ReturnWeaponModel =
W_SprintStart(); W_SprintStart();
W_ShowCrosshair(self); W_ShowCrosshair(self);
// Slight rumble whenever we pull our weapon out again.
nzp_rumble(self, 1000, 1200, 75);
} }
void() W_PlayTakeOut = void() W_PlayTakeOut =
@ -1113,6 +1116,9 @@ void(float side) W_Fire =
startframe = endframe = GetFrame(self.weapon, FIRE_HOLD); startframe = endframe = GetFrame(self.weapon, FIRE_HOLD);
} }
// Rumble the GamePad a fixed amount when we fire a weapon.
nzp_rumble(self, 1400, 2000, 200);
// Increment the amount of shots fired while downed // Increment the amount of shots fired while downed
if (self.downed == true) if (self.downed == true)
self.teslacount++; self.teslacount++;
@ -1442,6 +1448,7 @@ void() checkHold =
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/throw.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "sounds/weapons/grenade/throw.wav", 1, ATTN_NORM);
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = time + 0.4; self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = time + 0.4;
self.throw_delay = time + 0.9; self.throw_delay = time + 0.9;
nzp_rumble(self, 1000, 1200, 75);
} }
else else
{ {
@ -1476,6 +1483,8 @@ void() W_Grenade =
self.primary_grenades -= 1; self.primary_grenades -= 1;
self.reload_delay2 = self.fire_delay2 = self.throw_delay = self.reload_delay = self.fire_delay = time + 6; self.reload_delay2 = self.fire_delay2 = self.throw_delay = self.reload_delay = self.fire_delay = time + 6;
self.grenade_delay = time + 5; self.grenade_delay = time + 5;
nzp_rumble(self, 1000, 1200, 75);
} }
void(float wepnum) CheckButton = { void(float wepnum) CheckButton = {

View file

@ -77,20 +77,24 @@
// <byte> screenflash_duration // <byte> screenflash_duration
// <byte> screenflash_type // <byte> screenflash_type
#define EVENT_UPDATE 19 #define CSQC_EVENT_RUMBLE 19 // <short> low_frequency
#define EVENT_BLACKOUT 20 // <short> high_frequency
#define EVENT_WORLDDATA 21 // <short> duration
#define EVENT_PLAYERUPDATE 22
#define EVENT_REVIVEON 23 #define EVENT_UPDATE 20
#define EVENT_REVIVEOFF 24 #define EVENT_BLACKOUT 21
#define EVENT_REVIVECHANGE 25 #define EVENT_WORLDDATA 22
#define EVENT_WEAPONRECOIL 26 #define EVENT_PLAYERUPDATE 23
#define EVENT_GRENADEPULSE 27 #define EVENT_REVIVEON 24
#define EVENT_BETTYPROMPT 28 #define EVENT_REVIVEOFF 25
#define EVENT_CHATMESSAGE 29 #define EVENT_REVIVECHANGE 26
#define EVENT_DOUBLETAPUPDATE 30 #define EVENT_WEAPONRECOIL 27
#define EVENT_ENDGAME 31 #define EVENT_GRENADEPULSE 28
#define EVENT_MAPTYPE 32 #define EVENT_BETTYPROMPT 29
#define EVENT_CHATMESSAGE 30
#define EVENT_DOUBLETAPUPDATE 31
#define EVENT_ENDGAME 32
#define EVENT_MAPTYPE 33
// //
// Types of screen-flashes, global. // Types of screen-flashes, global.

View file

@ -3090,7 +3090,7 @@ float(float wep) EqualPapWeapon =
} }
} }
void (float wep, float anim_style, float dualwep, float curweaponframe) PlayWeaponSound = float(float wep, float anim_style, float dualwep, float curweaponframe) PlayWeaponSound =
{ {
if (anim_style == KNIFE) { if (anim_style == KNIFE) {
if (curweaponframe == 6) { if (curweaponframe == 6) {
@ -3106,22 +3106,30 @@ void (float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap
{ {
if (wep == W_KAR || wep == W_ARMAGEDDON || wep == W_KAR_SCOPE || wep == W_HEADCRACKER || wep == W_SPRING || wep == W_PULVERIZER) if (wep == W_KAR || wep == W_ARMAGEDDON || wep == W_KAR_SCOPE || wep == W_HEADCRACKER || wep == W_SPRING || wep == W_PULVERIZER)
{ {
if (curweaponframe == 6) if (curweaponframe == 6) {
sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM);
else if (curweaponframe == 7) return true;
}
else if (curweaponframe == 7) {
sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM);
else if (curweaponframe == 9) return true;
} else if (curweaponframe == 9) {
sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM);
else if (curweaponframe == 10) return true;
} else if (curweaponframe == 10) {
sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM);
return true;
}
} }
else if (wep == W_TRENCH || wep == W_GUT) else if (wep == W_TRENCH || wep == W_GUT)
{ {
if (curweaponframe == 7) if (curweaponframe == 7) {
sound (self ,5, "sounds/weapons/shotgun/pump.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/pump.wav", 1, ATTN_NORM);
return true;
}
} }
} else if (anim_style != RELOAD) { } else if (anim_style != RELOAD) {
return; return false;
} }
@ -3129,306 +3137,411 @@ void (float wep, float anim_style, float dualwep, float curweaponframe) PlayWeap
case W_COLT: case W_COLT:
if (curweaponframe == 5) { if (curweaponframe == 5) {
sound (self ,5, "sounds/weapons/colt/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/colt/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 12) { } else if (curweaponframe == 12) {
sound (self ,5, "sounds/weapons/colt/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/colt/magin.wav", 1, ATTN_NORM);
return true;
} else if(curweaponframe == 18) { } else if(curweaponframe == 18) {
sound (self ,5, "sounds/weapons/colt/slide.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/colt/slide.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_KAR: case W_KAR:
case W_ARMAGEDDON: case W_ARMAGEDDON:
case W_SPRING: case W_SPRING:
case W_PULVERIZER: case W_PULVERIZER:
if (curweaponframe == 15) { if (curweaponframe == 15) {
sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 16) { } else if (curweaponframe == 16) {
sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 20) { } else if (curweaponframe == 20) {
sound (self ,5, "sounds/weapons/boltaction/clipin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/clipin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 25) { } else if (curweaponframe == 25) {
sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 26) { } else if (curweaponframe == 26) {
sound (self ,5, "sounds/weapons/boltaction/clipoff.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/clipoff.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 27) { } else if (curweaponframe == 27) {
sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_THOMPSON: case W_THOMPSON:
case W_GIBS: case W_GIBS:
if (curweaponframe == 6) { if (curweaponframe == 6) {
sound (self ,5, "sounds/weapons/thomp/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/thomp/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 12) { } else if (curweaponframe == 12) {
sound (self ,5, "sounds/weapons/thomp/magin.wav", 1, ATTN_NORM);} sound (self ,5, "sounds/weapons/thomp/magin.wav", 1, ATTN_NORM);
else if (curweaponframe == 19) { return true;
} else if (curweaponframe == 19) {
sound (self ,5, "sounds/weapons/thomp/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/thomp/boltback.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_357: case W_357:
case W_KILLU: case W_KILLU:
if (curweaponframe == 5) { if (curweaponframe == 5) {
sound (self ,5, "sounds/weapons/357/open.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/357/open.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 9) { } else if (curweaponframe == 9) {
sound (self ,5, "sounds/weapons/357/out.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/357/out.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 15) { } else if (curweaponframe == 15) {
sound (self ,5, "sounds/weapons/357/in.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/357/in.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 20) { } else if (curweaponframe == 20) {
sound (self ,5, "sounds/weapons/357/close.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/357/close.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_BAR: case W_BAR:
case W_WIDOW: case W_WIDOW:
if (curweaponframe == 6 || curweaponframe == 31) { if (curweaponframe == 6 || curweaponframe == 31) {
sound (self ,5, "sounds/weapons/bar/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/bar/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 19 || curweaponframe == 29) { } else if (curweaponframe == 19 || curweaponframe == 29) {
sound (self ,5, "sounds/weapons/bar/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/bar/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 23) { } else if (curweaponframe == 23) {
sound (self ,5, "sounds/weapons/bar/maghit.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/bar/maghit.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_BROWNING: case W_BROWNING:
case W_ACCELERATOR: case W_ACCELERATOR:
if (curweaponframe == 6 || curweaponframe == 60) { if (curweaponframe == 6 || curweaponframe == 60) {
sound (self ,5, "sounds/weapons/browning/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/boltback.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 16 || curweaponframe == 69) { } else if (curweaponframe == 16 || curweaponframe == 69) {
sound (self ,5, "sounds/weapons/browning/topopen.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/topopen.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 21) { } else if (curweaponframe == 21) {
sound (self ,5, "sounds/weapons/browning/chainoff.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/chainoff.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 27) { } else if (curweaponframe == 27) {
sound (self ,5, "sounds/weapons/browning/chainon.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/chainon.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 30) { } else if (curweaponframe == 30) {
sound (self ,5, "sounds/weapons/browning/chainplace.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/chainplace.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 36) { } else if (curweaponframe == 36) {
sound (self ,5, "sounds/weapons/browning/topclose.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/topclose.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 41) { } else if (curweaponframe == 41) {
sound (self ,5, "sounds/weapons/browning/tophit.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/tophit.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 48) { } else if (curweaponframe == 48) {
sound (self ,5, "sounds/weapons/browning/boltforward.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/browning/boltforward.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_DB: case W_DB:
case W_SAWNOFF: case W_SAWNOFF:
case W_BORE: case W_BORE:
if (curweaponframe == 6) { if (curweaponframe == 6) {
sound (self ,5, "sounds/weapons/shotgun/open.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/open.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 12) { } else if (curweaponframe == 12) {
sound (self ,5, "sounds/weapons/shotgun/out.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/out.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 20) { } else if (curweaponframe == 20) {
sound (self ,5, "sounds/weapons/shotgun/in.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/in.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 26) { } else if (curweaponframe == 26) {
sound (self ,5, "sounds/weapons/shotgun/close.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/close.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_SNUFF: case W_SNUFF:
if (curweaponframe == 15) { if (curweaponframe == 15) {
sound (self ,5, "sounds/weapons/shotgun/open.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/open.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 23) { } else if (curweaponframe == 23) {
sound (self ,5, "sounds/weapons/shotgun/out.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/out.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 33) { } else if (curweaponframe == 33) {
sound (self ,5, "sounds/weapons/shotgun/in.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/in.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 40) { } else if (curweaponframe == 40) {
sound (self ,5, "sounds/weapons/shotgun/close.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/close.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_FG: case W_FG:
case W_IMPELLER: case W_IMPELLER:
if (curweaponframe == 6) { if (curweaponframe == 6) {
sound (self ,5, "sounds/weapons/fg42/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/fg42/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 14) { } else if (curweaponframe == 14) {
sound (self ,5, "sounds/weapons/fg42/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/fg42/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 23) { } else if (curweaponframe == 23) {
sound (self ,5, "sounds/weapons/fg42/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/fg42/boltback.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 26) { } else if (curweaponframe == 26) {
sound (self ,5, "sounds/weapons/fg42/boltforward.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/fg42/boltforward.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_GEWEHR: case W_GEWEHR:
case W_COMPRESSOR: case W_COMPRESSOR:
if (curweaponframe == 21) { if (curweaponframe == 21) {
sound (self ,5, "sounds/weapons/gewehr/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/gewehr/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 32) { } else if (curweaponframe == 32) {
sound (self ,5, "sounds/weapons/gewehr/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/gewehr/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 36) { } else if (curweaponframe == 36) {
sound (self ,5, "sounds/weapons/gewehr/maghit.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/gewehr/maghit.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 45) { } else if (curweaponframe == 45) {
sound (self ,5, "sounds/weapons/gewehr/boltrelease.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/gewehr/boltrelease.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_KAR_SCOPE: case W_KAR_SCOPE:
case W_HEADCRACKER: case W_HEADCRACKER:
case W_SPRING: case W_SPRING:
case W_PULVERIZER: case W_PULVERIZER:
if (curweaponframe == 15) { if (curweaponframe == 15) {
sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltup.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 16) { } else if (curweaponframe == 16) {
sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltback.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 20) { } else if (curweaponframe == 20) {
sound (self ,5, "sounds/weapons/boltaction/insert.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/insert.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 25) { } else if (curweaponframe == 25) {
sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltforward.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 27) { } else if (curweaponframe == 27) {
sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/boltaction/boltdown.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_M1: case W_M1:
case W_M1000: case W_M1000:
if (curweaponframe == 5 || curweaponframe == 25) { if (curweaponframe == 5 || curweaponframe == 25) {
sound (self ,5, "sounds/weapons/garand/clipout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/garand/clipout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 13) { } else if (curweaponframe == 13) {
sound (self ,5, "sounds/weapons/garand/clipin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/garand/clipin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 15) { } else if (curweaponframe == 15) {
sound (self ,5, "sounds/weapons/garand/boltrelease.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/garand/boltrelease.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 24) { } else if (curweaponframe == 24) {
sound (self ,5, "sounds/weapons/garand/clippush.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/garand/clippush.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_M1A1: case W_M1A1:
case W_WIDDER: case W_WIDDER:
if (curweaponframe == 6) { if (curweaponframe == 6) {
sound (self ,5, "sounds/weapons/m1carbine/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/m1carbine/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 14) { } else if (curweaponframe == 14) {
sound (self ,5, "sounds/weapons/m1carbine/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/m1carbine/magin.wav", 1, ATTN_NORM);
return true;
} else if(curweaponframe == 16) { } else if(curweaponframe == 16) {
sound (self ,5, "sounds/weapons/m1carbine/maghit.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/m1carbine/maghit.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 24) { } else if (curweaponframe == 24) {
sound (self ,5, "sounds/weapons/m1carbine/bolt.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/m1carbine/bolt.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_MP40: case W_MP40:
case W_AFTERBURNER: case W_AFTERBURNER:
if (curweaponframe == 7) { if (curweaponframe == 7) {
sound (self ,5, "sounds/weapons/mp40/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mp40/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 17) { } else if (curweaponframe == 17) {
sound (self ,5, "sounds/weapons/mp40/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mp40/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 25) { } else if (curweaponframe == 25) {
sound (self ,5, "sounds/weapons/mp40/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mp40/boltback.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_MP5K: case W_MP5K:
case W_KOLLIDER: case W_KOLLIDER:
if (curweaponframe == 16) { if (curweaponframe == 16) {
sound (self ,5, "sounds/weapons/mp5k/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mp5k/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 31) { } else if (curweaponframe == 31) {
sound (self ,5, "sounds/weapons/mp5k/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mp5k/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 39) { } else if (curweaponframe == 39) {
sound (self ,5, "sounds/weapons/mp5k/slap.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mp5k/slap.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_PANZER: case W_PANZER:
case W_LONGINUS: case W_LONGINUS:
if (curweaponframe == 12) { if (curweaponframe == 12) {
sound (self ,5, "sounds/weapons/panzer/move.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/panzer/move.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 16) { } else if (curweaponframe == 16) {
sound (self ,5, "sounds/weapons/panzer/insert.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/panzer/insert.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_MG: case W_MG:
case W_BARRACUDA: case W_BARRACUDA:
if (curweaponframe == 8) { if (curweaponframe == 8) {
sound (self ,5, "sounds/weapons/mg42/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mg42/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 19) { } else if (curweaponframe == 19) {
sound (self ,5, "sounds/weapons/mg42/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mg42/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 29) { } else if (curweaponframe == 29) {
sound (self ,5, "sounds/weapons/mg42/charge.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/mg42/charge.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_PPSH: case W_PPSH:
case W_REAPER: case W_REAPER:
if (curweaponframe == 8) { if (curweaponframe == 8) {
sound (self ,5, "sounds/weapons/ppsh/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ppsh/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 20) { } else if (curweaponframe == 20) {
sound (self ,5, "sounds/weapons/ppsh/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ppsh/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 22) { } else if (curweaponframe == 22) {
sound (self ,5, "sounds/weapons/ppsh/maghit.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ppsh/maghit.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 30) { } else if (curweaponframe == 30) {
sound (self ,5, "sounds/weapons/ppsh/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ppsh/boltback.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 33) { } else if (curweaponframe == 33) {
sound (self ,5, "sounds/weapons/ppsh/boltrelease.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ppsh/boltrelease.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_PTRS: case W_PTRS:
case W_PENETRATOR: case W_PENETRATOR:
if (curweaponframe == 7) { if (curweaponframe == 7) {
sound (self ,5, "sounds/weapons/ptrs/open.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ptrs/open.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 13 || curweaponframe == 31) { } else if (curweaponframe == 13 || curweaponframe == 31) {
sound (self ,5, "sounds/weapons/ptrs/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ptrs/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 21) { } else if (curweaponframe == 21) {
sound (self ,5, "sounds/weapons/ptrs/maghit.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ptrs/maghit.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 23) { } else if (curweaponframe == 23) {
sound (self ,5, "sounds/weapons/ptrs/close.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/ptrs/close.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_RAY: case W_RAY:
case W_PORTER: case W_PORTER:
if (curweaponframe == 10) { if (curweaponframe == 10) {
sound (self ,5, "sounds/weapons/raygun/open.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/raygun/open.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 19) { } else if (curweaponframe == 19) {
sound (self ,5, "sounds/weapons/raygun/out.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/raygun/out.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 33) { } else if (curweaponframe == 33) {
sound (self ,5, "sounds/weapons/raygun/in.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/raygun/in.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 41) { } else if (curweaponframe == 41) {
sound (self ,5, "sounds/weapons/raygun/close.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/raygun/close.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_STG: case W_STG:
case W_SPATZ: case W_SPATZ:
if (curweaponframe == 15) { if (curweaponframe == 15) {
sound (self ,5, "sounds/weapons/stg/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/stg/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 28) { } else if (curweaponframe == 28) {
sound (self ,5, "sounds/weapons/stg/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/stg/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 37) { } else if (curweaponframe == 37) {
sound (self ,5, "sounds/weapons/stg/boltback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/stg/boltback.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 41) { } else if (curweaponframe == 41) {
sound (self ,5, "sounds/weapons/stg/boltrelease.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/stg/boltrelease.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_TRENCH: case W_TRENCH:
case W_GUT: case W_GUT:
if (curweaponframe == 19) { if (curweaponframe == 19) {
sound (self ,5, "sounds/weapons/shotgun/insert.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/shotgun/insert.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_TYPE: case W_TYPE:
case W_SAMURAI: case W_SAMURAI:
if (curweaponframe == 6) { if (curweaponframe == 6) {
sound (self ,5, "sounds/weapons/type100/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/type100/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 15) { } else if (curweaponframe == 15) {
sound (self ,5, "sounds/weapons/type100/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/type100/magin.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe == 20) { } else if (curweaponframe == 20) {
sound (self ,5, "sounds/weapons/type100/boltpull.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/type100/boltpull.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_BIATCH: case W_BIATCH:
if (curweaponframe == 23) { if (curweaponframe == 23) {
sound (self ,5, "sounds/weapons/colt/magout.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/colt/magout.wav", 1, ATTN_NORM);
return true;
} else if (curweaponframe ==30) { } else if (curweaponframe ==30) {
sound (self ,5, "sounds/weapons/colt/magin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/colt/magin.wav", 1, ATTN_NORM);
return true;
} else if(curweaponframe == 36) { } else if(curweaponframe == 36) {
sound (self ,5, "sounds/weapons/biatch/slideback.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/biatch/slideback.wav", 1, ATTN_NORM);
return true;
} else if(curweaponframe == 42) { } else if(curweaponframe == 42) {
sound (self ,5, "sounds/weapons/biatch/sliderelease.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/biatch/sliderelease.wav", 1, ATTN_NORM);
return true;
} }
break; return false;
case W_TESLA: case W_TESLA:
case W_DG3: case W_DG3:
if (curweaponframe == 20) if (curweaponframe == 20) {
sound (self ,5, "sounds/weapons/tesla/switchoff.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/tesla/switchoff.wav", 1, ATTN_NORM);
else if (curweaponframe == 25) return true;
} else if (curweaponframe == 25) {
sound (self ,5, "sounds/weapons/tesla/pulllever.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/tesla/pulllever.wav", 1, ATTN_NORM);
else if (curweaponframe == 31) return true;
} else if (curweaponframe == 31) {
sound (self ,5, "sounds/weapons/tesla/glassbreak.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/tesla/glassbreak.wav", 1, ATTN_NORM);
else if (curweaponframe == 38) return true;
} else if (curweaponframe == 38) {
sound (self ,5, "sounds/weapons/tesla/clipin.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/tesla/clipin.wav", 1, ATTN_NORM);
else if (curweaponframe == 43) return true;
} else if (curweaponframe == 43) {
sound (self ,5, "sounds/weapons/tesla/clipoff.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/tesla/clipoff.wav", 1, ATTN_NORM);
else if (curweaponframe == 51) return true;
} else if (curweaponframe == 51) {
sound (self ,5, "sounds/weapons/tesla/switchon.wav", 1, ATTN_NORM); sound (self ,5, "sounds/weapons/tesla/switchon.wav", 1, ATTN_NORM);
break; return true;
}
return false;
case W_BK: case W_BK:
case W_KRAUS: case W_KRAUS:
if (curweaponframe == 41) if (curweaponframe == 41) {
sound(self, 5, "sounds/weapons/ballknife/insert.wav", 1, ATTN_NORM); sound(self, 5, "sounds/weapons/ballknife/insert.wav", 1, ATTN_NORM);
break; return true;
}
return false;
default:
return false;
} }
return false;
} }