Client: Display icons on the HUD for the different artifacts you can carry

This commit is contained in:
Marco Cawthorne 2023-04-17 23:30:05 -07:00
parent 43fc2c69ee
commit 030b63bcac
Signed by: eukara
GPG key ID: CE2032F0A2882A22

View file

@ -70,6 +70,10 @@ float spr_flash2[4] = {
32 / 128 // size y 32 / 128 // size y
}; };
string g_hud_icninvin;
string g_hud_icninvis;
string g_hud_icnquad;
/* precaches */ /* precaches */
void void
HUD_Init(void) HUD_Init(void)
@ -101,6 +105,11 @@ HUD_Init(void)
g_hudsngammo = spriteframe("sprites/hudsngammo.spr", 0, 0.0f); g_hudsngammo = spriteframe("sprites/hudsngammo.spr", 0, 0.0f);
g_hudssgammo = spriteframe("sprites/hudssgammo.spr", 0, 0.0f); g_hudssgammo = spriteframe("sprites/hudssgammo.spr", 0, 0.0f);
g_hud_icninvin = spriteframe("sprites/icninvin.spr", 0, 0.0f);
g_hud_icninvis = spriteframe("sprites/icninvis.spr", 0, 0.0f);
g_hud_icnquad = spriteframe("sprites/icnquad.spr", 0, 0.0f);
HUD_AmmoNotify_Init(); HUD_AmmoNotify_Init();
HUD_DamageNotify_Init(); HUD_DamageNotify_Init();
HUD_ItemNotify_Init(); HUD_ItemNotify_Init();
@ -473,6 +482,66 @@ HUD_DrawQuakeCrosshair(void)
Font_DrawText(crossPos, quakeCross, FONT_20); Font_DrawText(crossPos, quakeCross, FONT_20);
} }
void
HUD_DrawPowerupIcons(void)
{
player pl = (player)pSeat->m_ePlayer;
vector pickupPos;
pickupPos = g_hudmins + [16, (g_hudres[1] / 2) - 32];
if (pl.g_items & ITEM_QUAD) {
drawsubpic(
pickupPos,
[32, 32],
g_hud_icnquad,
[0, 0],
[1.0, 1.0],
[1,1,1],
1.0f,
0
);
pickupPos[1] += 32;
}
if (pl.g_items & ITEM_INVIS) {
drawsubpic(
pickupPos,
[32, 32],
g_hud_icninvis,
[0, 0],
[1.0, 1.0],
[1,1,1],
1.0f,
0
);
pickupPos[1] += 32;
}
if (pl.g_items & ITEM_INVULN) {
drawsubpic(
pickupPos,
[32, 32],
g_hud_icninvin,
[0, 0],
[1.0, 1.0],
[1,1,1],
1.0f,
0
);
pickupPos[1] += 32;
}
if (pl.g_items & ITEM_ENVIROSUIT) {
drawsubpic(
pickupPos,
[32, 32],
g_hud_icninvis,
[0, 0],
[1.0, 1.0],
[0,1,0],
1.0f,
0
);
}
}
/* main entry */ /* main entry */
void void
HUD_Draw(void) HUD_Draw(void)
@ -499,6 +568,7 @@ HUD_Draw(void)
HUD_DrawArmor(); HUD_DrawArmor();
HUD_DrawFlashlight(); HUD_DrawFlashlight();
HUD_DrawNotify(); HUD_DrawNotify();
HUD_DrawPowerupIcons();
Damage_Draw(); Damage_Draw();
} }