Introduce SoundPitched_Send() as a way to bypass protocol limits, let blue
handle the other guns and applications. Probably warrants a rename to be specific to weapons.
This commit is contained in:
parent
9971b02e22
commit
d528573453
10 changed files with 86 additions and 14 deletions
|
@ -198,6 +198,9 @@ ClientGame_EventParse(float fHeader)
|
|||
//printfline("EVENT_TS::TEST HAPPENED");
|
||||
//clearscene();
|
||||
break;
|
||||
case EVENT_TS::SOUNDPITCHED:
|
||||
SoundPitched_Receive();
|
||||
break;
|
||||
/*
|
||||
//can this even happen ...?
|
||||
case EVENT_TS::DROP_WEAPON:
|
||||
|
|
|
@ -14,6 +14,7 @@ enum EVENT_TS{
|
|||
//TAGGG - NEW. Like EV_IMPACT but to paint a decal only.
|
||||
EV_PLACEDECAL,
|
||||
EV_IMPACT_MELEE,
|
||||
SOUNDPITCHED,
|
||||
TEST,
|
||||
};
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ effects.qc
|
|||
//TAGGG - NEW
|
||||
util.qc
|
||||
precache.qc
|
||||
sound_pitched.qc
|
||||
//fx_impact.h
|
||||
//pmove.c
|
||||
//animations.c
|
||||
|
|
63
src/shared/sound_pitched.qc
Normal file
63
src/shared/sound_pitched.qc
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SNDP_AK47,
|
||||
SNDP_AKIMBOCOLTS,
|
||||
SNDP_BARRETTM82,
|
||||
SNDP_M3_FIRE,
|
||||
SNDP_BERETTA,
|
||||
SNDP_BERETTA_SIL,
|
||||
} sfx_pitched_t;
|
||||
|
||||
|
||||
void
|
||||
SoundPitched_Send(entity ent, int id)
|
||||
{
|
||||
#ifdef SERVER
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EVENT_TS::SOUNDPITCHED);
|
||||
WriteEntity(MSG_MULTICAST, ent);
|
||||
WriteByte(MSG_MULTICAST, id);
|
||||
|
||||
msg_entity = ent;
|
||||
multicast(ent.origin, MULTICAST_PHS);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
/* TODO: add the rest */
|
||||
const string sfx_pitched_s[] =
|
||||
{
|
||||
"weapons/ak47/fire.wav",
|
||||
"weapons/gold/gold-fire.wav",
|
||||
"weapons/barrett/fire.wav",
|
||||
"weapons/m3/m3-fire.wav",
|
||||
"weapons/beretta/fire.wav",
|
||||
"weapons/beretta/fire-sil.wav"
|
||||
};
|
||||
|
||||
void
|
||||
SoundPitched_Receive(void)
|
||||
{
|
||||
entity ent = findfloat(world, entnum, readentitynum());
|
||||
int id = readbyte();
|
||||
|
||||
if (ent)
|
||||
sound(ent, CHAN_WEAPON, sfx_pitched_s[id], 1.0f, ATTN_NORM, 400, SOUNDFLAG_FOLLOW);
|
||||
}
|
||||
#endif
|
|
@ -180,8 +180,8 @@ w_ak47_primary(void)
|
|||
PLAY_CLICK_SOUND
|
||||
return;
|
||||
}
|
||||
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/ak47/fire.wav");
|
||||
|
||||
SoundPitched_Send(pl, SNDP_AK47); /* get around protocol limits */
|
||||
|
||||
if(!arg_thisWeapon.iIronSight){
|
||||
TS_Weapons_ViewAnimation(weaponseq_ak47::shoot, 31.0f/30.0f);
|
||||
|
|
|
@ -216,13 +216,16 @@ BOOLEAN weapon_AkimboColts_akimbo_attack(player localPlayer, weapondynamic_t arg
|
|||
|
||||
weapon_base_onAttack(localPlayer, ary_weaponData[WEAPON_ID::AkimboColts], arg_thisWeapon, effectiveAkimboChoice);
|
||||
|
||||
|
||||
#if 0
|
||||
if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/gold/gold-fire.wav");
|
||||
}
|
||||
if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/gold/gold-fire.wav");
|
||||
}
|
||||
#else
|
||||
SoundPitched_Send(pl, SNDP_AKIMBOCOLTS);
|
||||
#endif
|
||||
|
||||
|
||||
if(pl.akimboTest == 0 && !(finalAkimboChoice == BITS_AKIMBOCHOICE_BOTH)){
|
||||
|
|
|
@ -167,9 +167,9 @@ w_barrett_m82_primary(void)
|
|||
PLAY_CLICK_SOUND
|
||||
return;
|
||||
}
|
||||
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/barrett/fire.wav");
|
||||
|
||||
|
||||
SoundPitched_Send(pl, SNDP_BARRETTM82);
|
||||
|
||||
if(randomChoice < 0.5){
|
||||
TS_Weapons_ViewAnimation(weaponseq_barrett_m82::shoot, 31.0f/30.0f);
|
||||
}else{
|
||||
|
|
|
@ -193,7 +193,7 @@ w_benellim3_primary(void)
|
|||
// pump instead!
|
||||
pl.shotgunWaitingForPump = FALSE;
|
||||
|
||||
TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO);
|
||||
TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO);
|
||||
|
||||
// these pumps eject shells
|
||||
#ifdef CLIENT
|
||||
|
@ -220,7 +220,8 @@ w_benellim3_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/m3/m3-fire.wav");
|
||||
// TS_Weapons_PlaySoundDirect(pl, "weapons/m3/m3-fire.wav");
|
||||
SoundPitched_Send(pl, SNDP_M3_FIRE);
|
||||
|
||||
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
|
||||
TS_Weapons_ViewAnimation(weaponseq_benellim3::shootpump, (31.0f/35.0f) );
|
||||
|
|
|
@ -183,9 +183,9 @@ w_beretta_primary(void)
|
|||
|
||||
|
||||
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/beretta/fire.wav");
|
||||
SoundPitched_Send(pl, SNDP_BERETTA);
|
||||
} else {
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/beretta/fire-sil.wav");
|
||||
SoundPitched_Send(pl, SNDP_BERETTA_SIL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -242,16 +242,16 @@ BOOLEAN weapon_Beretta_akimbo_attack(player localPlayer, weapondynamic_t arg_thi
|
|||
|
||||
if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){
|
||||
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/beretta/fire.wav");
|
||||
SoundPitched_Send(pl, SNDP_BERETTA);
|
||||
} else {
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/beretta/fire-sil.wav");
|
||||
SoundPitched_Send(pl, SNDP_BERETTA_SIL);
|
||||
}
|
||||
}
|
||||
if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){
|
||||
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/beretta/fire.wav");
|
||||
SoundPitched_Send(pl, SNDP_BERETTA);
|
||||
} else {
|
||||
TS_Weapons_PlaySoundDirect(pl, "weapons/beretta/fire-sil.wav");
|
||||
SoundPitched_Send(pl, SNDP_BERETTA_SIL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue