Client: support game title fade-in

This commit is contained in:
Marco Cawthorne 2023-09-27 14:07:45 -07:00
parent 9ab028abd7
commit b1365cce22
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
4 changed files with 42 additions and 1 deletions

View File

@ -58,6 +58,7 @@ struct
int m_iItemsOld;
float m_flDamageIndicator;
float m_flTitleAlpha;
} g_seatslocal[4], *pSeatLocal;
void HUD_DrawAmmo1(void);

View File

@ -23,5 +23,39 @@ ClientGame_PreDraw(void)
void
ClientGame_PostDraw(void)
{
if (pSeatLocal->m_flTitleAlpha > 0.0) {
vector title1Pos = g_hudmins + (g_hudres / 2) + [-238,-15];
vector title2Pos = g_hudmins + (g_hudres / 2) + [18,-15];
float titleAlpha = pSeatLocal->m_flTitleAlpha;
if (titleAlpha > 3.0)
titleAlpha = 4.0 - titleAlpha;
if (titleAlpha > 1.0)
titleAlpha = 1.0f;
drawsubpic(
title1Pos,
[256, 30],
g_hud4_spr,
[0, 226/256],
[1, 30/256],
[1,1,1] * titleAlpha,
1.0,
DRAWFLAG_ADDITIVE
);
drawsubpic(
title2Pos,
[220, 30],
g_hud5_spr,
[0, 226/256],
[220/256, 30/256],
[1,1,1] * titleAlpha,
1.0f,
DRAWFLAG_ADDITIVE
);
pSeatLocal->m_flTitleAlpha -= frametime;
}
}

View File

@ -34,6 +34,12 @@ void
ClientGame_InitDone(void)
{
VGUI_ShowMOTD();
bool gameTitle = serverkeyfloat("gametitle");
if (gameTitle == true) {
pSeatLocal->m_flTitleAlpha = 4.0f;
}
}
void

View File

@ -23,7 +23,7 @@ draw.qc
damage.qc
init.qc
flashlight.qc
../../../valve/src/client/flashlight.qc
entities.qc
cmds.qc
game_event.qc