Skip to content

Commit

Permalink
Weapon precaches
Browse files Browse the repository at this point in the history
  • Loading branch information
darkshade9 committed Oct 10, 2022
1 parent e0941a9 commit f496600
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 24 deletions.
12 changes: 6 additions & 6 deletions source/g_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ world_model_flags int copied to 'ent->s.effects' (see s.effects fo
IT_WEAPON,
NULL,
0,
"weapons/mk23fire.wav weapons/mk23in.wav weapons/mk23out.wav weapons/mk23slap.wav weapons/mk23slide.wav misc/click.wav weapons/machgf4b.wav weapons/blastf1a.wav",
"weapons/mk23fire.wav weapons/mk23fire1.wav weapons/mk23fire2.wav weapons/mk23fire3.wav weapons/mk23in.wav weapons/mk23out.wav weapons/mk23slap.wav weapons/mk23slide.wav misc/click.wav weapons/machgf4b.wav weapons/blastf1a.wav",
MK23_NUM}
,

Expand All @@ -1365,7 +1365,7 @@ world_model_flags int copied to 'ent->s.effects' (see s.effects fo
IT_WEAPON,
NULL,
0,
"weapons/mp5fire1.wav weapons/mp5in.wav weapons/mp5out.wav weapons/mp5slap.wav weapons/mp5slide.wav weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf5b.wav",
"weapons/mp5fire.wav weapons/mp5fire1.wav weapons/mp5fire2.wav weapons/mp5fire3.wav weapons/mp5in.wav weapons/mp5out.wav weapons/mp5slap.wav weapons/mp5slide.wav weapons/machgf1b.wav weapons/machgf2b.wav weapons/machgf3b.wav weapons/machgf5b.wav",
MP5_NUM}
,
{
Expand All @@ -1387,7 +1387,7 @@ world_model_flags int copied to 'ent->s.effects' (see s.effects fo
IT_WEAPON,
NULL,
0,
"weapons/m4a1fire.wav weapons/m4a1in.wav weapons/m4a1out.wav weapons/m4a1slide.wav weapons/rocklf1a.wav weapons/rocklr1b.wav",
"weapons/m4a1fire.wav weapons/m4a1fire1.wav weapons/m4a1fire2.wav weapons/m4a1in.wav weapons/m4a1out.wav weapons/m4a1slide.wav weapons/rocklf1a.wav weapons/rocklr1b.wav",
M4_NUM}
,
{
Expand All @@ -1409,7 +1409,7 @@ world_model_flags int copied to 'ent->s.effects' (see s.effects fo
IT_WEAPON,
NULL,
0,
"weapons/m3in.wav weapons/shotgr1b.wav weapons/shotgf1b.wav",
"weapons/m3in.wav weapons/shotgr1b.wav weapons/shotgf1b.wav weapons/shotgf1b1.wav weapons/shotgf1b2.wav",
M3_NUM}
,
{
Expand All @@ -1431,7 +1431,7 @@ world_model_flags int copied to 'ent->s.effects' (see s.effects fo
IT_WEAPON,
NULL,
0,
"weapons/cannon_fire.wav weapons/sshotf1b.wav weapons/cclose.wav weapons/cin.wav weapons/cout.wav weapons/copen.wav",
"weapons/cannon_fire.wav weapons/cannon_fire1.wav weapons/cannon_fire2.wav weapons/sshotf1b.wav weapons/cclose.wav weapons/cin.wav weapons/cout.wav weapons/copen.wav",
HC_NUM}
,
{
Expand All @@ -1453,7 +1453,7 @@ world_model_flags int copied to 'ent->s.effects' (see s.effects fo
IT_WEAPON,
NULL,
0,
"weapons/ssgbolt.wav weapons/ssgfire.wav weapons/ssgin.wav misc/lensflik.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav",
"weapons/ssgbolt.wav weapons/ssgfire.wav weapons/ssgfire1.wav weapons/ssgfire2.wav weapons/ssgin.wav misc/lensflik.wav weapons/hyprbl1a.wav weapons/hyprbf1a.wav",
SNIPER_NUM}
,
{
Expand Down
59 changes: 41 additions & 18 deletions source/p_weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2124,12 +2124,14 @@ void PlayWeaponSound(edict_t* ent)
case MZ_BLASTER:
#if USE_AQTION
if (cl_actionsounds->value) {
if (cl_mk23_sound->integer == 1)
if (cl_mk23_sound->value == 1)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mk23fire1.wav"), 1, ATTN_LOUD, 0);
else if (cl_mk23_sound->integer == 2)
else if (cl_mk23_sound->value == 2)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mk23fire2.wav"), 1, ATTN_LOUD, 0);
else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mk23fire.wav"), 1, ATTN_LOUD, 0);
} else {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mk23fire.wav"), 1, ATTN_LOUD, 0);
}
#else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mk23fire.wav"), 1, ATTN_LOUD, 0);
Expand All @@ -2139,12 +2141,14 @@ void PlayWeaponSound(edict_t* ent)
case MZ_MACHINEGUN:
#if USE_AQTION
if (cl_actionsounds->value) {
if (cl_mp5_sound->integer == 1)
if (cl_mp5_sound->value == 1)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mp5fire1.wav"), 1, ATTN_LOUD, 0);
else if (cl_mp5_sound->integer == 2)
else if (cl_mp5_sound->value == 2)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mp5fire2.wav"), 1, ATTN_LOUD, 0);
else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mp5fire.wav"), 1, ATTN_LOUD, 0);
} else {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mp5fire.wav"), 1, ATTN_LOUD, 0);
}
#else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/mp5fire.wav"), 1, ATTN_LOUD, 0);
Expand All @@ -2154,12 +2158,14 @@ void PlayWeaponSound(edict_t* ent)
case MZ_ROCKET:
#if USE_AQTION
if (cl_actionsounds->value) {
if (cl_m4_sound->integer == 1)
if (cl_m4_sound->value == 1)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/m4a1fire1.wav"), 1, ATTN_LOUD, 0);
else if (cl_m4_sound->integer == 2)
else if (cl_m4_sound->value == 2)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/m4a1fire2.wav"), 1, ATTN_LOUD, 0);
else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/m4a1fire.wav"), 1, ATTN_LOUD, 0);
} else {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/m4a1fire.wav"), 1, ATTN_LOUD, 0);
}
#else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/m4a1fire.wav"), 1, ATTN_LOUD, 0);
Expand All @@ -2169,12 +2175,14 @@ void PlayWeaponSound(edict_t* ent)
case MZ_SHOTGUN:
#if USE_AQTION
if (cl_actionsounds->value) {
if (cl_m3_sound->integer == 1)
if (cl_m3_sound->value == 1)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/shotgf1b1.wav"), 1, ATTN_LOUD, 0);
else if (cl_m3_sound->integer == 2)
else if (cl_m3_sound->value == 2)
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/shotgf1b2.wav"), 1, ATTN_LOUD, 0);
else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/shotgf1b.wav"), 1, ATTN_LOUD, 0);
} else {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/shotgf1b.wav"), 1, ATTN_LOUD, 0);
}
#else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/shotgf1b.wav"), 1, ATTN_LOUD, 0);
Expand All @@ -2184,19 +2192,27 @@ void PlayWeaponSound(edict_t* ent)
case MZ_SSHOTGUN:
#if USE_AQTION
if (cl_actionsounds->value) {
if (cl_m3_sound->integer == 1)
if (cl_hc_sound->value == 1) {
// Both barrels: sound on both WEAPON and ITEM to produce a louder boom.
if (!ent->client->pers.hc_mode)
if (!ent->client->pers.hc_mode) {
gi.sound(ent, CHAN_ITEM, gi.soundindex("weapons/cannon_fire1.wav"), 1, ATTN_NORM, 0);
}
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/cannon_fire1.wav"), 1, ATTN_LOUD, 0);
else if (cl_m3_sound->integer == 2)
if (!ent->client->pers.hc_mode)
} else if (cl_hc_sound->value == 2) {
if (!ent->client->pers.hc_mode) {
gi.sound(ent, CHAN_ITEM, gi.soundindex("weapons/cannon_fire2.wav"), 1, ATTN_NORM, 0);
}
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/cannon_fire2.wav"), 1, ATTN_LOUD, 0);
else
if (!ent->client->pers.hc_mode)
} else {
if (!ent->client->pers.hc_mode) {
gi.sound(ent, CHAN_ITEM, gi.soundindex("weapons/cannon_fire.wav"), 1, ATTN_NORM, 0);
}
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/cannon_fire.wav"), 1, ATTN_LOUD, 0);
}
} else {
if (!ent->client->pers.hc_mode)
gi.sound(ent, CHAN_ITEM, gi.soundindex("weapons/cannon_fire.wav"), 1, ATTN_NORM, 0);
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/cannon_fire.wav"), 1, ATTN_LOUD, 0);
}
#else
if (!ent->client->pers.hc_mode)
Expand All @@ -2208,12 +2224,19 @@ void PlayWeaponSound(edict_t* ent)
case MZ_HYPERBLASTER:
#if USE_AQTION
if (cl_actionsounds->value) {
if (cl_ssg_sound->integer == 1)
if (cl_ssg_sound->value == 1) {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/ssgfire1.wav"), 1, ATTN_LOUD, 0);
else if (cl_ssg_sound->integer == 2)
gi.dprintf("Firing sound ssgfire1.wav\n");
} else if (cl_ssg_sound->value == 2) {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/ssgfire2.wav"), 1, ATTN_LOUD, 0);
else
gi.dprintf("Firing sound ssgfire2.wav\n");
} else {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/ssgfire.wav"), 1, ATTN_LOUD, 0);
gi.dprintf("Firing sound ssgfire.wav\n");
}
} else {
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/ssgfire.wav"), 1, ATTN_LOUD, 0);
gi.dprintf("Firing sound ssgfire (else)\n");
}
#else
gi.sound(ent, CHAN_WEAPON, gi.soundindex("weapons/ssgfire.wav"), 1, ATTN_LOUD, 0);
Expand Down Expand Up @@ -2299,7 +2322,7 @@ void Pistol_Fire(edict_t* ent)

// gi.cprintf(ent, PRINT_HIGH, "Spread is %d\n", spread);

if ((ent->client->mk23_rds == 1))
if (ent->client->mk23_rds == 1)
{
//Hard coded for reload only.
ent->client->ps.gunframe = 62;
Expand Down

0 comments on commit f496600

Please sign in to comment.