Shared: WEAPON_PYTHON, WEAPON_EGON, WEAPON_GAUSS, WEAPON_MP5, WEAPON_SHOTGUN and WEAPON_SNARK no longer allow for firing underwater.

This commit is contained in:
Marco Cawthorne 2022-08-05 14:10:04 -07:00
parent e373af4ca5
commit 51e9a7d851
Signed by: eukara
GPG key ID: CE2032F0A2882A22
8 changed files with 104 additions and 33 deletions

View file

@ -82,9 +82,12 @@ void
HUD_DrawWeaponSelect_Trigger(void)
{
player pl = (player)pSeat->m_ePlayer;
if (pl.activeweapon != pSeat->m_iHUDWeaponSelected)
sendevent("PlayerSwitchWeapon", "i", pSeat->m_iHUDWeaponSelected);
pl.activeweapon = pSeat->m_iHUDWeaponSelected;
sendevent("PlayerSwitchWeapon", "i", pSeat->m_iHUDWeaponSelected);
sound(pSeat->m_ePlayer, CHAN_ITEM, "common/wpn_select.wav", 0.5f, ATTN_NONE);
pSeat->m_iHUDWeaponSelected = pSeat->m_flHUDWeaponSelectTime = 0;
}

View file

@ -115,12 +115,11 @@ 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.0)
return;
}
/* Ammo check */
if (pl.ammo_uranium <= 0) {
if ((pl.ammo_uranium <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
w_egon_release(pl);
return;
}

View file

@ -48,6 +48,7 @@ void w_gauss_precache(void)
precache_sound("weapons/electro5.wav");
precache_sound("weapons/electro6.wav");
precache_sound("weapons/gauss2.wav");
Sound_Precache("weapon_gauss.empty");
#else
precache_sound("ambience/pulsemachine.wav");
precache_model("models/v_gauss.mdl");
@ -116,7 +117,7 @@ void w_gauss_fire(player pl, int one)
}
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self, iDamage, WEAPON_GAUSS, DMG_ELECTRO);
Damage_Apply(trace_ent, pl, iDamage, WEAPON_GAUSS, DMG_ELECTRO);
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
}
@ -144,7 +145,7 @@ void w_gauss_fire(player pl, int one)
traceline(src, endpos, FALSE, pl);
iLoop--;
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self, iDamage, WEAPON_GAUSS, DMG_ELECTRO);
Damage_Apply(trace_ent, pl, iDamage, WEAPON_GAUSS, DMG_ELECTRO);
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
}
}
@ -153,12 +154,17 @@ void w_gauss_fire(player pl, int one)
void w_gauss_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.ammo_uranium < 2) {
if ((pl.ammo_uranium < 2) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_gauss.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
@ -171,7 +177,7 @@ void w_gauss_primary(player pl)
pl.ammo_uranium -= 2;
if (self.flags & FL_CROUCHING)
if (pl.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTGAUSS, 0.43f);
else
Animation_PlayerTop(pl, ANIM_SHOOTGAUSS, 0.43f);
@ -198,7 +204,7 @@ void w_gauss_release(player pl)
} else if (pl.mode_tempstate == 2) {
Weapons_ViewAnimation(pl, GAUSS_FIRE1);
if (self.flags & FL_CROUCHING)
if (pl.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTGAUSS, 0.43f);
else
Animation_PlayerTop(pl, ANIM_SHOOTGAUSS, 0.43f);
@ -235,9 +241,20 @@ void w_gauss_release(player pl)
void w_gauss_secondary(player pl)
{
if (pl.w_attack_next) {
if (pl.w_attack_next > 0.0)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
/* Ammo check */
if ((pl.ammo_uranium <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_gauss.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
pl.w_attack_next = 0.1f;
/* Ammo check */
@ -311,7 +328,7 @@ void w_gauss_crosshair(player pl)
float w_gauss_aimanim(player pl)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMGAUSS : ANIM_AIMGAUSS;
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMGAUSS : ANIM_AIMGAUSS;
}
void w_gauss_hudpic(player pl, int selected, vector pos, float a)

View file

@ -89,6 +89,7 @@ w_mp5_precache(void)
#ifdef SERVER
Sound_Precache("weapon_mp5.shoot");
Sound_Precache("weapon_mp5.gl");
Sound_Precache("weapon_mp5.empty");
precache_model("models/w_9mmar.mdl");
precache_model("models/grenade.mdl");
#else
@ -162,13 +163,17 @@ w_mp5_holster(player pl)
void
w_mp5_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.mp5_mag <= 0) {
if ((pl.mp5_mag <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
@ -216,13 +221,17 @@ w_mp5_primary(player pl)
void
w_mp5_secondary(player pl)
{
if (pl.w_attack_next > 0.0) {
if (pl.w_attack_next > 0.0)
return;
if (pl.gflags & GF_SEMI_TOGGLED)
return;
}
if (pl.ammo_m203_grenade <= 0) {
/* Ammo check */
if ((pl.ammo_m203_grenade <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}

View file

@ -51,6 +51,7 @@ w_python_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_357.shoot");
Sound_Precache("weapon_357.empty");
Sound_Precache("weapon_357.reload");
precache_model("models/w_357.mdl");
#else
@ -127,13 +128,17 @@ w_python_holster(player pl)
void
w_python_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.python_mag <= 0) {
if ((pl.python_mag <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_357.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}

View file

@ -82,6 +82,7 @@ void w_shotgun_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_shotgun.single");
Sound_Precache("weapon_shotgun.empty");
Sound_Precache("weapon_shotgun.double");
Sound_Precache("weapon_shotgun.reload");
Sound_Precache("weapon_shotgun.cock");
@ -177,6 +178,17 @@ w_shotgun_reload(player pl)
void
w_shotgun_primary(player pl)
{
if (pl.gflags & GF_SEMI_TOGGLED)
return;
/* Ammo check */
if ((pl.shotgun_mag <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
if (pl.w_attack_next) {
w_shotgun_release(pl);
@ -232,6 +244,17 @@ w_shotgun_primary(player pl)
void
w_shotgun_secondary(player pl)
{
if (pl.gflags & GF_SEMI_TOGGLED)
return;
/* Ammo check */
if ((pl.shotgun_mag <= 1) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.empty");
#endif
pl.gflags |= GF_SEMI_TOGGLED;
return;
}
if (pl.w_attack_next) {
w_shotgun_release(pl);

View file

@ -184,14 +184,12 @@ void w_snark_deploy(void)
void w_snark_primary(player pl)
{
if (pl.w_attack_next > 0.0) {
if (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)
return;
}
/* Ammo check */
if (pl.ammo_snark <= 0) {
if (pl.w_attack_next > 0.0)
return;
if (pl.ammo_snark <= 0)
return;
}
pl.ammo_snark--;

View file

@ -7,6 +7,10 @@ weapon_357.shoot
sample weapons/357_shot2.wav
distshader weapon_357.shoot_dist
}
weapon_357.empty
{
sample weapons/357_cock1.wav
}
weapon_357.shoot_dist
{
volume 0.1
@ -115,6 +119,10 @@ weapon_mp5.gl
alerts
sample weapons/glauncher.wav
}
weapon_mp5.empty
{
sample weapons/357_cock1.wav
}
weapon_satchel.bounce
{
@ -159,6 +167,10 @@ weapon_shotgun.double
sample weapons/dbarrel1.wav
distshader weapon_shotgun.distance
}
weapon_shotgun.empty
{
sample weapons/357_cock1.wav
}
weapon_shotgun.distance
{
volume 0.15
@ -198,3 +210,8 @@ weapon_snark.hunt
sample squeek/sqk_hunt2.wav
sample squeek/sqk_hunt3.wav
}
weapon_gauss.empty
{
sample weapons/357_cock1.wav
}