From 2f8bdaa32bc0bae6774717eeea89320abe5f2574 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 16 Dec 2021 17:19:31 -0800 Subject: [PATCH] Client: Handle ammo notifications for GEARBOX, ifdefd --- src/client/hud.qc | 5 +++++ src/client/hud_ammonotify.qc | 27 ++++++++++++++++++++++++--- src/shared/player.qc | 5 +++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/client/hud.qc b/src/client/hud.qc index 3e5c429..008b0c0 100644 --- a/src/client/hud.qc +++ b/src/client/hud.qc @@ -410,14 +410,19 @@ HUD_DrawNotify(void) void HUD_WeaponPickupNotify(int w) { +#if defined (VALVE) || defined (GEARBOX) switch (w) { case WEAPON_SNARK: case WEAPON_SATCHEL: case WEAPON_HANDGRENADE: case WEAPON_TRIPMINE: +#if defined(GEARBOX) + case WEAPON_PENGUIN: +#endif return; default: } +#endif pSeatLocal->m_iPickupWeapon = w; pSeatLocal->m_flPickupAlpha = 2.5f; diff --git a/src/client/hud_ammonotify.qc b/src/client/hud_ammonotify.qc index 0c93832..9ccc592 100644 --- a/src/client/hud_ammonotify.qc +++ b/src/client/hud_ammonotify.qc @@ -1,4 +1,10 @@ +#ifndef GEARBOX +#define AMMO_COUNT 12 +#else +#define AMMO_COUNT 17 +#endif + string g_ammo_spr; typedef struct @@ -6,9 +12,9 @@ typedef struct float alpha; int count; } ammonote_t; -ammonote_t g_ammonotify[12]; +ammonote_t g_ammonotify[AMMO_COUNT]; -vector g_ammotype[12] = { +vector g_ammotype[AMMO_COUNT] = { [0/256, 72/128], // pistol [24/256, 72/128], // revolver [48/256, 72/128], // grenade @@ -21,6 +27,13 @@ vector g_ammotype[12] = { [72/256, 96/128], // satchel [96/256, 96/128], // snark [120/256, 96/128], // tripmine +#ifdef GEARBOX + [24/256, 72/128], // 556 (same as 357) + [24/256, 72/128], // 762 (same as 357) + [200/256, 48/128], // spore + [224/256, 48/128], // shock + [144/256, 72/128], // penguin +#endif }; void @@ -34,7 +47,7 @@ HUD_AmmoNotify_Draw(vector startpos) { vector pos = startpos; - for (int i = 0; i < 12; i++) { + for (int i = 0; i < AMMO_COUNT; i++) { vector srcpos; float a; @@ -95,4 +108,12 @@ HUD_AmmoNotify_Check(player pl) HUD_AmmoNotify_Insert(9, pl.ammo_satchel - pl.ammo_satchel_net); HUD_AmmoNotify_Insert(10, pl.ammo_snark - pl.ammo_snark_net); HUD_AmmoNotify_Insert(11, pl.ammo_tripmine - pl.ammo_tripmine_net); + +#ifdef GEARBOX + HUD_AmmoNotify_Insert(12, pl.ammo_556 - pl.ammo_556_net); + HUD_AmmoNotify_Insert(13, pl.ammo_762 - pl.ammo_762_net); + HUD_AmmoNotify_Insert(14, pl.ammo_spore - pl.ammo_spore_net); + HUD_AmmoNotify_Insert(15, pl.ammo_shock - pl.ammo_shock_net); + HUD_AmmoNotify_Insert(16, pl.ammo_penguin - pl.ammo_penguin_net); +#endif } \ No newline at end of file diff --git a/src/shared/player.qc b/src/shared/player.qc index 6e4de28..0219403 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -159,11 +159,12 @@ player::ReceiveEntity(float new, float fl) mode_tempstate = readbyte(); } - if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3) + if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3) { Weapons_AmmoUpdate(this); + HUD_AmmoNotify_Check(this); + } setorigin(this, origin); - HUD_AmmoNotify_Check(this); } /*