Shared: Give the rest of the weapons an empty clicking sound.

This commit is contained in:
Marco Cawthorne 2022-08-06 11:30:41 -07:00
parent cf9b3353bb
commit 7bb5660f09
Signed by: eukara
GPG key ID: CE2032F0A2882A22
7 changed files with 100 additions and 57 deletions

View file

@ -15,26 +15,26 @@
*/
/* game flags */
#define GF_SEMI_TOGGLED (1<<0)
#define GF_FLASHLIGHT (1<<1)
#define GF_EGONBEAM (1<<2)
#define GF_UNUSED4 (1<<3)
#define GF_UNUSED5 (1<<4)
#define GF_UNUSED6 (1<<5)
#define GF_UNUSED7 (1<<6)
#define GF_UNUSED8 (1<<7)
#define GF_UNUSED9 (1<<8)
#define GF_UNUSED10 (1<<9)
#define GF_UNUSED11 (1<<10)
#define GF_UNUSED12 (1<<11)
#define GF_UNUSED13 (1<<12)
#define GF_UNUSED14 (1<<14)
#define GF_UNUSED15 (1<<16)
#define GF_UNUSED16 (1<<13)
#define GF_UNUSED17 (1<<17)
#define GF_UNUSED18 (1<<18)
#define GF_UNUSED19 (1<<19)
#define GF_UNUSED20 (1<<20)
#define GF_UNUSED21 (1<<21)
#define GF_UNUSED22 (1<<22)
#define GF_UNUSED23 (1<<23)
#define GF_SEMI_TOGGLED (int)(1<<0)
#define GF_FLASHLIGHT (int)(1<<1)
#define GF_EGONBEAM (int)(1<<2)
#define GF_UNUSED4 (int)(1<<3)
#define GF_UNUSED5 (int)(1<<4)
#define GF_UNUSED6 (int)(1<<5)
#define GF_UNUSED7 (int)(1<<6)
#define GF_UNUSED8 (int)(1<<7)
#define GF_UNUSED9 (int)(1<<8)
#define GF_UNUSED10 (int)(1<<9)
#define GF_UNUSED11 (int)(1<<10)
#define GF_UNUSED12 (int)(1<<11)
#define GF_UNUSED13 (int)(1<<12)
#define GF_UNUSED14 (int)(1<<14)
#define GF_UNUSED15 (int)(1<<16)
#define GF_UNUSED16 (int)(1<<13)
#define GF_UNUSED17 (int)(1<<17)
#define GF_UNUSED18 (int)(1<<18)
#define GF_UNUSED19 (int)(1<<19)
#define GF_UNUSED20 (int)(1<<20)
#define GF_UNUSED21 (int)(1<<21)
#define GF_UNUSED22 (int)(1<<22)
#define GF_UNUSED23 (int)(1<<23)

View file

@ -44,6 +44,7 @@ w_crossbow_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_crossbow.fire");
Sound_Precache("weapon_crossbow.empty");
Sound_Precache("weapon_crossbow.hit");
Sound_Precache("weapon_crossbow.hitbody");
Sound_Precache("weapon_crossbow.reload");
@ -166,12 +167,17 @@ void Crossbolt_Touch(void) {
void
w_crossbow_primary(player pl)
{
if (pl.w_attack_next > 0.0) {
if (pl.w_attack_next > 0.0)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
}
/* ammo check */
if (pl.crossbow_mag <= 0) {
if ((pl.crossbow_mag <= 0i) ? true : false) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_crossbow.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}

View file

@ -57,6 +57,7 @@ void w_egon_precache(void)
precache_sound("weapons/egon_run3.wav");
precache_sound("weapons/egon_off1.wav");
precache_model("models/w_egon.mdl");
Sound_Precache("weapon_egon.empty");
#else
TRAIL_EGONBEAM = particleeffectnum("weapon_egon.beam");
precache_model("models/v_egon.mdl");
@ -115,11 +116,20 @@ void w_egon_release(player pl);
void w_egon_primary(player pl)
{
if (pl.w_attack_next > 0.0)
if (pl.w_attack_next > 0.0f) {
return;
}
if (pl.gflags & GF_SEMI_TOGGLED) {
w_egon_release(pl);
return;
}
/* Ammo check */
if ((pl.ammo_uranium <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
if ((pl.ammo_uranium <= 0i) ? true : false || pl.WaterLevel() >= WATERLEVEL_SUBMERGED) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_egon.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
w_egon_release(pl);
return;
}

View file

@ -84,6 +84,7 @@ w_glock_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_glock.fire");
Sound_Precache("weapon_glock.empty");
precache_model("models/w_9mmhandgun.mdl");
precache_model("models/shell.mdl");
#else
@ -154,13 +155,17 @@ w_glock_holster(player pl)
void
w_glock_primary(player pl)
{
if (pl.w_attack_next > 0.0) {
if (pl.w_attack_next > 0.0)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
}
/* ammo check */
if (!pl.glock_mag) {
if ((pl.glock_mag <= 0i) ? true : false) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
@ -195,13 +200,17 @@ w_glock_primary(player pl)
void
w_glock_secondary(player pl)
{
if (pl.w_attack_next > 0) {
if (pl.w_attack_next > 0.0)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
}
/* ammo check */
if (!pl.glock_mag) {
if ((pl.glock_mag <= 0i) ? true : false) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}

View file

@ -163,13 +163,13 @@ w_mp5_holster(player pl)
void
w_mp5_primary(player pl)
{
if (pl.w_attack_next > 0.0)
if (pl.w_attack_next > 0.0f)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
/* Ammo check */
if ((pl.mp5_mag <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
if ((pl.mp5_mag <= 0i) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty");
#endif
@ -209,7 +209,7 @@ w_mp5_primary(player pl)
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.shoot");
#endif
if (self.flags & FL_CROUCHING)
if (pl.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTMP5, 0.1f);
else
Animation_PlayerTop(pl, ANIM_SHOOTMP5, 0.1f);
@ -221,13 +221,13 @@ w_mp5_primary(player pl)
void
w_mp5_secondary(player pl)
{
if (pl.w_attack_next > 0.0)
if (pl.w_attack_next > 0.0f)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
/* Ammo check */
if ((pl.ammo_m203_grenade <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
if ((pl.ammo_m203_grenade <= 0i) ? true : false || pl.WaterLevel() >= WATERLEVEL_SUBMERGED) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty");
#endif
@ -254,11 +254,11 @@ w_mp5_secondary(player pl)
Weapons_MakeVectors(pl);
entity gren = spawn();
setmodel(gren, "models/grenade.mdl");
setorigin(gren, Weapons_GetCameraPos(pl) + (v_forward * 16));
gren.owner = self;
gren.velocity = v_forward * 800;
setorigin(gren, Weapons_GetCameraPos(pl) + (v_forward * 16.0f));
gren.owner = pl;
gren.velocity = v_forward * 800.0f;
gren.angles = vectoangles(gren.velocity);
gren.avelocity[0] = random(-100, -500);
gren.avelocity[0] = random(-100.0f, -500.0f);
gren.gravity = 0.5f;
gren.movetype = MOVETYPE_BOUNCE;
//gren.flags |= FL_LAGGEDMOVE;
@ -268,10 +268,10 @@ w_mp5_secondary(player pl)
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.gl");
#endif
Weapons_ViewPunchAngle(pl, [-10,0,0]);
Weapons_ViewPunchAngle(pl, [-10.0f, 0.0f, 0.0f]);
Weapons_ViewAnimation(pl, MP5_GRENADE);
if (self.flags & FL_CROUCHING)
if (pl.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTMP5, 0.45f);
else
Animation_PlayerTop(pl, ANIM_SHOOTMP5, 0.45f);
@ -388,7 +388,7 @@ w_mp5_crosshair(player pl)
float
w_mp5_aimanim(player pl)
{
return self.flags & ANIM_CR_AIMMP5 ? ANIM_CR_AIMCROWBAR : ANIM_AIMMP5;
return pl.flags & ANIM_CR_AIMMP5 ? ANIM_CR_AIMCROWBAR : ANIM_AIMMP5;
}
void

View file

@ -41,6 +41,7 @@ void w_rpg_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_rpg.shoot");
Sound_Precache("weapon_rpg.empty");
precache_model("models/w_rpg.mdl");
precache_model("models/rpgrocket.mdl");
#else
@ -100,12 +101,17 @@ void w_rpg_holster(player pl)
void w_rpg_primary(player pl)
{
if (pl.w_attack_next > 0.0) {
if (pl.w_attack_next > 0.0)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
}
/* Ammo check */
if (pl.rpg_mag <= 0) {
/* ammo check */
if ((pl.rpg_mag <= 0i) ? true : false) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_rpg.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
@ -172,7 +178,6 @@ void w_rpg_primary(player pl)
void w_rpg_reload(player pl)
{
if (pl.w_attack_next > 0) {
return;
}
@ -204,7 +209,6 @@ void w_rpg_reload(player pl)
void w_rpg_release(player pl)
{
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.rpg_mag == 0 && pl.ammo_rocket > 0) {

View file

@ -1,5 +1,3 @@
weapon_357.shoot
{
alerts
@ -27,6 +25,10 @@ weapon_crossbow.fire
alerts
sample weapons/xbow_fire1.wav
}
weapon_crossbow.empty
{
sample weapons/357_cock1.wav
}
weapon_crossbow.hit
{
@ -69,6 +71,10 @@ weapon_glock.fire
alerts
sample weapons/pl_gun3.wav
}
weapon_glock.empty
{
sample weapons/357_cock1.wav
}
weapon_handgrenade.bounce
{
@ -153,6 +159,10 @@ weapon_rpg.shoot
alerts
sample weapons/rocketfire1.wav
}
weapon_rpg.empty
{
sample weapons/357_cock1.wav
}
weapon_shotgun.single
{
@ -210,8 +220,12 @@ weapon_snark.hunt
sample squeek/sqk_hunt2.wav
sample squeek/sqk_hunt3.wav
}
weapon_gauss.empty
{
sample weapons/357_cock1.wav
}
weapon_egon.empty
{
sample weapons/357_cock1.wav
}