VC review

- Continue showing up on main in-game pause menu
- Flip to top half of screen, to avoid conflict with Round Queue
- Show over most UI, including menu
This commit is contained in:
toaster 2023-08-25 21:41:15 +01:00
parent 2a68650477
commit 92bd71496e
3 changed files with 42 additions and 28 deletions

View file

@ -825,6 +825,13 @@ void M_Drawer(void)
}
}
if (netgame && Playing())
{
boolean mainpause_open = menuactive && currentMenu == &PAUSE_MainDef;
ST_DrawServerSplash(!mainpause_open);
}
// focus lost notification goes on top of everything, even the former everything
if (window_notinfocus && cv_showfocuslost.value)
{

View file

@ -1314,7 +1314,7 @@ static INT32 ST_ServerSplash_OpacityFlag(INT32 opacity)
return (NUMTRANSMAPS - opacity) << V_ALPHASHIFT;
}
static void ST_DrawServerSplash(void)
void ST_DrawServerSplash(boolean timelimited)
{
static const fixed_t SPLASH_LEN = (FRACUNIT * TICRATE) * 3;
static const fixed_t SPLASH_WAIT = (FRACUNIT * TICRATE) / 2;
@ -1335,7 +1335,8 @@ static void ST_DrawServerSplash(void)
return;
}
if (splashTime >= SPLASH_LEN)
if (timelimited
&& splashTime >= SPLASH_LEN)
{
// We finished drawing it
return;
@ -1354,29 +1355,35 @@ static void ST_DrawServerSplash(void)
{
opacity = splashTic;
}
else if (splashTic > (SPLASH_LEN >> FRACBITS) - NUMTRANSMAPS)
else if (timelimited
&& splashTic > (SPLASH_LEN >> FRACBITS) - NUMTRANSMAPS)
{
opacity = (SPLASH_LEN >> FRACBITS) - splashTic;
}
INT32 opacityFlag = ST_ServerSplash_OpacityFlag(opacity);
patch_t *gridPatch = W_CachePatchName("MOTDBG", PU_CACHE);
fixed_t gridX = -splashTime / 3;
fixed_t gridY = (BASEVIDHEIGHT - gridPatch->height) * FRACUNIT;
INT32 gridOpacity = ST_ServerSplash_OpacityFlag(opacity / 2);
fixed_t maxX = (vid.width * FRACUNIT) / vid.dupx;
while (gridX < maxX)
if (gridPatch && gridPatch->width)
{
V_DrawFixedPatch(
gridX, gridY,
FRACUNIT,
(V_SNAPTOLEFT|V_SNAPTOBOTTOM) | V_SUBTRACT | gridOpacity,
gridPatch,
NULL
);
fixed_t gridX = -(splashTime / 3) % (gridPatch->width * FRACUNIT);
fixed_t gridY = (gridPatch->height) * FRACUNIT;
INT32 gridOpacity = ST_ServerSplash_OpacityFlag(opacity / 2);
fixed_t maxX = (vid.width * FRACUNIT) / vid.dupx;
gridX += (gridPatch->width * FRACUNIT);
while (gridX < maxX)
{
V_DrawFixedPatch(
gridX, gridY,
FRACUNIT,
(V_SNAPTOLEFT|V_SNAPTOBOTTOM) | V_SUBTRACT | V_VFLIP | gridOpacity,
gridPatch,
NULL
);
gridX += (gridPatch->width * FRACUNIT);
}
}
// We're a bit crunched atm to do this but hopefully in the future
@ -1384,7 +1391,7 @@ static void ST_DrawServerSplash(void)
// sends on client join instead.
patch_t *iconPatch = W_CachePatchName("MOTDICON", PU_CACHE);
fixed_t iconX = (BASEVIDWIDTH - 16 - iconPatch->width) * FRACUNIT;
fixed_t iconY = (BASEVIDHEIGHT - 8 - iconPatch->height) * FRACUNIT;
fixed_t iconY = (8) * FRACUNIT;
V_DrawFixedPatch(
iconX, iconY,
FRACUNIT,
@ -1394,7 +1401,15 @@ static void ST_DrawServerSplash(void)
);
fixed_t textX = (BASEVIDWIDTH - 16 - 36) * FRACUNIT;
fixed_t textY = (BASEVIDHEIGHT - 24) * FRACUNIT;
fixed_t textY = (24 - 8) * FRACUNIT;
V_DrawRightAlignedStringAtFixed(
textX, textY,
(V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag,
connectedservername
);
textY += 10*FRACUNIT;
if (connectedservercontact[0] != 0)
{
@ -1403,14 +1418,7 @@ static void ST_DrawServerSplash(void)
(V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag,
va("Contact @ %c%s", '\x80' + cv_shoutcolor.value, connectedservercontact)
);
textY -= (10 * FRACUNIT);
}
V_DrawRightAlignedStringAtFixed(
textX, textY,
(V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag,
connectedservername
);
}
void ST_Drawer(void)
@ -1487,9 +1495,6 @@ void ST_Drawer(void)
if (stagetitle)
ST_drawTitleCard();
if (netgame)
ST_DrawServerSplash();
// Replay manual-save stuff
if (demo.recording && multiplayer && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime)
{

View file

@ -75,6 +75,8 @@ void ST_preLevelTitleCardDrawer(void);
extern tic_t lt_ticker, lt_lasttic;
extern tic_t lt_exitticker, lt_endtime;
void ST_DrawServerSplash(boolean timelimited);
// return if player a is in the same team as player b
boolean ST_SameTeam(player_t *a, player_t *b);