mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-20 10:53:27 +00:00
Prompt HUD hiding implementation
This commit is contained in:
parent
54dc5d1892
commit
33a94ba2b8
3 changed files with 88 additions and 12 deletions
|
@ -2031,14 +2031,6 @@ boolean F_CutsceneResponder(event_t *event)
|
|||
// TEXT PROMPTS
|
||||
// ==================
|
||||
|
||||
INT32 F_GetPromptHideHud()
|
||||
{
|
||||
if (cutnum == INT32_MAX || scenenum == INT32_MAX || !textprompts[cutnum] || scenenum >= textprompts[cutnum]->numpages)
|
||||
return 0;
|
||||
else
|
||||
return textprompts[cutnum]->page[scenenum]->hidehud;
|
||||
}
|
||||
|
||||
static void F_GetPageTextGeometry(UINT8 *pagelines, boolean *rightside, INT32 *boxh, INT32 *texth, INT32 *texty, INT32 *namey, INT32 *chevrony, INT32 *textx, INT32 *textr)
|
||||
{
|
||||
// reuse:
|
||||
|
@ -2063,6 +2055,60 @@ static void F_GetPageTextGeometry(UINT8 *pagelines, boolean *rightside, INT32 *b
|
|||
*textr = *rightside ? BASEVIDWIDTH - (((*boxh * 4) + (*boxh/2)*4) + 4) : BASEVIDWIDTH-4;
|
||||
}
|
||||
|
||||
static fixed_t F_GetPromptHideHudBound(void)
|
||||
{
|
||||
UINT8 pagelines;
|
||||
boolean rightside;
|
||||
INT32 boxh, texth, texty, namey, chevrony;
|
||||
INT32 textx, textr;
|
||||
|
||||
if (cutnum == INT32_MAX || scenenum == INT32_MAX || !textprompts[cutnum] || scenenum >= textprompts[cutnum]->numpages ||
|
||||
!textprompts[cutnum]->page[scenenum].hidehud ||
|
||||
(splitscreen && textprompts[cutnum]->page[scenenum].hidehud != 2)) // don't hide on splitscreen, unless hide all is forced
|
||||
return 0;
|
||||
else if (textprompts[cutnum]->page[scenenum].hidehud == 2) // hide all
|
||||
return BASEVIDHEIGHT;
|
||||
|
||||
F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr);
|
||||
|
||||
// calc boxheight (see V_DrawPromptBack)
|
||||
boxh *= vid.dupy;
|
||||
boxh = (boxh * 4) + (boxh/2)*5; // 4 lines of space plus gaps between and some leeway
|
||||
|
||||
// return a coordinate to check
|
||||
// if negative: don't show hud elements below this coordinate (visually)
|
||||
// if positive: don't show hud elements above this coordinate (visually)
|
||||
return 0 - boxh; // \todo: if prompt at top of screen (someday), make this return positive
|
||||
}
|
||||
|
||||
boolean F_GetPromptHideHudAll(void)
|
||||
{
|
||||
if (cutnum == INT32_MAX || scenenum == INT32_MAX || !textprompts[cutnum] || scenenum >= textprompts[cutnum]->numpages ||
|
||||
!textprompts[cutnum]->page[scenenum].hidehud ||
|
||||
(splitscreen && textprompts[cutnum]->page[scenenum].hidehud != 2)) // don't hide on splitscreen, unless hide all is forced
|
||||
return false;
|
||||
else if (textprompts[cutnum]->page[scenenum].hidehud == 2) // hide all
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean F_GetPromptHideHud(fixed_t y)
|
||||
{
|
||||
INT32 ybound;
|
||||
boolean fromtop;
|
||||
fixed_t ytest;
|
||||
|
||||
if (!promptactive)
|
||||
return false;
|
||||
|
||||
ybound = F_GetPromptHideHudBound();
|
||||
fromtop = (ybound >= 0);
|
||||
ytest = (fromtop ? ybound : BASEVIDHEIGHT + ybound);
|
||||
|
||||
return (fromtop ? y < ytest : y >= ytest); // true means hide
|
||||
}
|
||||
|
||||
static void F_PreparePageText(char *pagetext)
|
||||
{
|
||||
UINT8 pagelines;
|
||||
|
|
|
@ -55,7 +55,8 @@ void F_EndCutScene(void);
|
|||
void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime);
|
||||
void F_TextPromptDrawer(void);
|
||||
void F_EndTextPrompt(boolean forceexec, boolean noexec);
|
||||
INT32 F_GetPromptHideHud(void);
|
||||
boolean F_GetPromptHideHudAll(void);
|
||||
boolean F_GetPromptHideHud(fixed_t y);
|
||||
|
||||
void F_StartGameEnd(void);
|
||||
void F_StartIntro(void);
|
||||
|
|
|
@ -603,6 +603,9 @@ static void ST_drawDebugInfo(void)
|
|||
|
||||
static void ST_drawScore(void)
|
||||
{
|
||||
if (F_GetPromptHideHud(hudinfo[HUD_SCORE].y))
|
||||
return;
|
||||
|
||||
// SCORE:
|
||||
ST_DrawPatchFromHud(HUD_SCORE, sboscore, V_HUDTRANS);
|
||||
if (objectplacing)
|
||||
|
@ -712,6 +715,9 @@ static void ST_drawTime(void)
|
|||
tictrn = G_TicsToCentiseconds(tics);
|
||||
}
|
||||
|
||||
if (F_GetPromptHideHud(hudinfo[HUD_TIME].y))
|
||||
return;
|
||||
|
||||
// TIME:
|
||||
ST_DrawPatchFromHud(HUD_TIME, ((downwards && (tics < 30*TICRATE) && (leveltime/5 & 1)) ? sboredtime : sbotime), V_HUDTRANS);
|
||||
|
||||
|
@ -738,6 +744,9 @@ static inline void ST_drawRings(void)
|
|||
{
|
||||
INT32 ringnum;
|
||||
|
||||
if (F_GetPromptHideHud(hudinfo[HUD_RINGS].y))
|
||||
return;
|
||||
|
||||
ST_DrawPatchFromHud(HUD_RINGS, ((!stplyr->spectator && stplyr->rings <= 0 && leveltime/5 & 1) ? sboredrings : sborings), ((stplyr->spectator) ? V_HUDTRANSHALF : V_HUDTRANS));
|
||||
|
||||
ringnum = ((objectplacing) ? op_currentdoomednum : max(stplyr->rings, 0));
|
||||
|
@ -756,6 +765,9 @@ static void ST_drawLivesArea(void)
|
|||
if (!stplyr->skincolor)
|
||||
return; // Just joined a server, skin isn't loaded yet!
|
||||
|
||||
if (F_GetPromptHideHud(hudinfo[HUD_LIVES].y))
|
||||
return;
|
||||
|
||||
// face background
|
||||
V_DrawSmallScaledPatch(hudinfo[HUD_LIVES].x, hudinfo[HUD_LIVES].y,
|
||||
hudinfo[HUD_LIVES].f|V_PERPLAYER|V_HUDTRANS, livesback);
|
||||
|
@ -927,6 +939,9 @@ static void ST_drawInput(void)
|
|||
if (stplyr->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
y -= 16;
|
||||
|
||||
if (F_GetPromptHideHud(y))
|
||||
return;
|
||||
|
||||
// O backing
|
||||
V_DrawFill(x, y-1, 16, 16, hudinfo[HUD_LIVES].f|20);
|
||||
V_DrawFill(x, y+15, 16, 1, hudinfo[HUD_LIVES].f|29);
|
||||
|
@ -1202,6 +1217,9 @@ static void ST_drawPowerupHUD(void)
|
|||
static INT32 flagoffs[2] = {0, 0}, shieldoffs[2] = {0, 0};
|
||||
#define ICONSEP (16+4) // matches weapon rings HUD
|
||||
|
||||
if (F_GetPromptHideHud(hudinfo[HUD_POWERUPS].y))
|
||||
return;
|
||||
|
||||
if (stplyr->spectator || stplyr->playerstate != PST_LIVE)
|
||||
return;
|
||||
|
||||
|
@ -1364,7 +1382,7 @@ static void ST_drawFirstPersonHUD(void)
|
|||
p = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE);
|
||||
|
||||
// Display the countdown drown numbers!
|
||||
if (p)
|
||||
if (p && !F_GetPromptHideHud(60 - SHORT(p->topoffset)))
|
||||
V_DrawScaledPatch((BASEVIDWIDTH/2) - (SHORT(p->width)/2) + SHORT(p->leftoffset), 60 - SHORT(p->topoffset),
|
||||
V_PERPLAYER|V_PERPLAYER|V_TRANSLUCENT, p);
|
||||
}
|
||||
|
@ -1908,6 +1926,9 @@ static void ST_drawMatchHUD(void)
|
|||
const INT32 y = 176; // HUD_LIVES
|
||||
INT32 offset = (BASEVIDWIDTH / 2) - (NUM_WEAPONS * 10) - 6;
|
||||
|
||||
if (F_GetPromptHideHud(y))
|
||||
return;
|
||||
|
||||
if (!G_RingSlingerGametype())
|
||||
return;
|
||||
|
||||
|
@ -1954,6 +1975,9 @@ static void ST_drawTextHUD(void)
|
|||
y -= 8;\
|
||||
}
|
||||
|
||||
if (F_GetPromptHideHud(y))
|
||||
return;
|
||||
|
||||
if ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && (!stplyr->spectator))
|
||||
{
|
||||
if (leveltime < hidetime * TICRATE)
|
||||
|
@ -2087,6 +2111,9 @@ static void ST_drawTeamHUD(void)
|
|||
patch_t *p;
|
||||
#define SEP 20
|
||||
|
||||
if (F_GetPromptHideHud(0)) // y base is 0
|
||||
return;
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
p = bflagico;
|
||||
else
|
||||
|
@ -2200,7 +2227,8 @@ static INT32 ST_drawEmeraldHuntIcon(mobj_t *hunt, patch_t **patches, INT32 offse
|
|||
interval = 0;
|
||||
}
|
||||
|
||||
V_DrawScaledPatch(hudinfo[HUD_HUNTPICS].x+offset, hudinfo[HUD_HUNTPICS].y, hudinfo[HUD_HUNTPICS].f|V_PERPLAYER|V_HUDTRANS, patches[i]);
|
||||
if (!F_GetPromptHideHud(hudinfo[HUD_HUNTPICS].y))
|
||||
V_DrawScaledPatch(hudinfo[HUD_HUNTPICS].x+offset, hudinfo[HUD_HUNTPICS].y, hudinfo[HUD_HUNTPICS].f|V_PERPLAYER|V_HUDTRANS, patches[i]);
|
||||
return interval;
|
||||
}
|
||||
|
||||
|
@ -2298,7 +2326,8 @@ static void ST_overlayDrawer(void)
|
|||
//hu_showscores = auto hide score/time/rings when tab rankings are shown
|
||||
if (!(hu_showscores && (netgame || multiplayer)))
|
||||
{
|
||||
if (maptol & TOL_NIGHTS || G_IsSpecialStage(gamemap))
|
||||
if ((maptol & TOL_NIGHTS || G_IsSpecialStage(gamemap)) &&
|
||||
!F_GetPromptHideHudAll())
|
||||
ST_drawNiGHTSHUD();
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue