Allow customization of pause screen.

This commit is contained in:
Marisa Kirisame 2021-10-16 10:29:45 +02:00 committed by Christoph Oelckers
parent d5ad8b28ec
commit 95b8629fe0
2 changed files with 26 additions and 11 deletions

View file

@ -1026,18 +1026,31 @@ void D_Display ()
// draw pause pic // draw pause pic
if ((paused || pauseext) && menuactive == MENU_Off) if ((paused || pauseext) && menuactive == MENU_Off)
{ {
auto tex = TexMan.GetGameTextureByName(gameinfo.PauseSign, true); // [MK] optionally let the status bar handle this
double x = (SCREENWIDTH - tex->GetDisplayWidth() * CleanXfac)/2 + bool skip = false;
tex->GetDisplayLeftOffset() * CleanXfac; IFVIRTUALPTR(StatusBar, DBaseStatusBar, DrawPaused)
DrawTexture(twod, tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
if (paused && multiplayer)
{ {
FFont *font = generic_ui? NewSmallFont : SmallFont; VMValue params[] { (DObject*)StatusBar, paused-1 };
FString pstring = GStrings("TXT_BY"); int rv;
pstring.Substitute("%s", players[paused - 1].userinfo.GetName()); VMReturn ret(&rv);
DrawText(twod, font, CR_RED, VMCall(func, params, countof(params), &ret, 1);
(twod->GetWidth() - font->StringWidth(pstring)*CleanXfac) / 2, skip = !!rv;
(tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE); }
if ( !skip )
{
auto tex = TexMan.GetGameTextureByName(gameinfo.PauseSign, true);
double x = (SCREENWIDTH - tex->GetDisplayWidth() * CleanXfac)/2 +
tex->GetDisplayLeftOffset() * CleanXfac;
DrawTexture(twod, tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
if (paused && multiplayer)
{
FFont *font = generic_ui? NewSmallFont : SmallFont;
FString pstring = GStrings("TXT_BY");
pstring.Substitute("%s", players[paused - 1].userinfo.GetName());
DrawText(twod, font, CR_RED,
(twod->GetWidth() - font->StringWidth(pstring)*CleanXfac) / 2,
(tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
}
} }
} }

View file

@ -235,6 +235,8 @@ class BaseStatusBar : StatusBarCore native
virtual bool ProcessMidPrint(Font fnt, String msg, bool bold) { return false; } virtual bool ProcessMidPrint(Font fnt, String msg, bool bold) { return false; }
// [MK] let the HUD handle drawing the chat prompt // [MK] let the HUD handle drawing the chat prompt
virtual bool DrawChat(String txt) { return false; } virtual bool DrawChat(String txt) { return false; }
// [MK] let the HUD handle drawing the pause graphics
virtual bool DrawPaused(int player) { return false; }
native TextureID GetMugshot(int accuracy, int stateflags=MugShot.STANDARD, String default_face = "STF"); native TextureID GetMugshot(int accuracy, int stateflags=MugShot.STANDARD, String default_face = "STF");
native int GetTopOfStatusBar(); native int GetTopOfStatusBar();