WEAPON_AUTORIFLE: Bringing some functions up to modern spec

This commit is contained in:
Xylemon 2023-01-18 14:03:53 -08:00
parent 8432bbfd0e
commit 2ecc2f77eb

View file

@ -92,9 +92,8 @@ w_autorifle_primary(player pl)
Weapons_ViewAnimation(pl, SNIPER_AUTOFIRE); Weapons_ViewAnimation(pl, SNIPER_AUTOFIRE);
#ifdef CLIENT #ifdef CLIENT
View_SetMuzzleflash(MUZZLE_WEIRD); View_SetMuzzleflash(MUZZLE_WEIRD);
#else
Sound_Play(pl, CHAN_WEAPON, "weapon_sniper.fire");
#endif #endif
Weapons_Sound(pl, CHAN_WEAPON, "weapon_sniper.fire");
pl.w_attack_next = 0.1f; pl.w_attack_next = 0.1f;
break; break;
case AUTO_EMPTY: case AUTO_EMPTY:
@ -106,38 +105,19 @@ w_autorifle_primary(player pl)
} }
void void
w_autorifle_hud(player pl) w_autorifle_postdraw(player pl)
{ {
#ifdef CLIENT #ifdef CLIENT
vector cross_pos; // crosshair
vector aicon_pos; if (pl.viewzoom == 1) {
Cross_DrawSub(g_cross_spr, [24,24], [72/128,0], [0.1875, 0.1875]);
/* crosshair/laser */ } else {
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12]; Cross_DrawSub(g_cross_spr, [104,16], [24/128,96/128], [104/128, 16/128]);
drawsubpic( }
cross_pos, // ammo counter
[24,24],
g_cross_spr,
[0.1875,0],
[0.1875, 0.1875],
[1,1,1],
1.0f,
DRAWFLAG_NORMAL
);
HUD_DrawAmmo2(); HUD_DrawAmmo2();
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42]; drawsubpic(aicon_pos, [24,24], "sprites/640hud7.spr_0.tga", [72/256,72/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
drawsubpic(
aicon_pos,
[24,24],
g_hud7_spr,
[0,72/128],
[24/256, 24/128],
g_hud_color,
pSeatLocal->m_flAmmo2Alpha,
DRAWFLAG_ADDITIVE
);
#endif #endif
} }
@ -183,7 +163,7 @@ weapon_t w_autorifle =
.secondary = __NULL__, .secondary = __NULL__,
.reload = __NULL__, .reload = __NULL__,
.release = w_autorifle_release, .release = w_autorifle_release,
.postdraw = w_autorifle_hud, .postdraw = w_autorifle_postdraw,
.precache = w_autorifle_precache, .precache = w_autorifle_precache,
.pickup = __NULL__, .pickup = __NULL__,
.updateammo = w_autorifle_updateammo, .updateammo = w_autorifle_updateammo,