1
0
Fork 0
forked from fn/valve

Client: Handle ammo notifications for GEARBOX, ifdefd

This commit is contained in:
Marco Cawthorne 2021-12-16 17:19:31 -08:00
parent f1fdad0bb7
commit 2f8bdaa32b
Signed by: eukara
GPG key ID: C196CD8BA993248A
3 changed files with 32 additions and 5 deletions

View file

@ -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;

View file

@ -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
}

View file

@ -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);
}
/*