Skip to content

Commit

Permalink
Allow customization of pause screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa Kirisame authored and coelckers committed Oct 16, 2021
1 parent d5ad8b2 commit 95b8629
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
35 changes: 24 additions & 11 deletions src/d_main.cpp
Expand Up @@ -1026,18 +1026,31 @@ void D_Display ()
// draw pause pic
if ((paused || pauseext) && menuactive == MENU_Off)
{
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)
// [MK] optionally let the status bar handle this
bool skip = false;
IFVIRTUALPTR(StatusBar, DBaseStatusBar, DrawPaused)
{
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);
VMValue params[] { (DObject*)StatusBar, paused-1 };
int rv;
VMReturn ret(&rv);
VMCall(func, params, countof(params), &ret, 1);
skip = !!rv;
}
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);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions wadsrc/static/zscript/ui/statusbar/statusbar.zs
Expand Up @@ -235,6 +235,8 @@ class BaseStatusBar : StatusBarCore native
virtual bool ProcessMidPrint(Font fnt, String msg, bool bold) { return false; }
// [MK] let the HUD handle drawing the chat prompt
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 int GetTopOfStatusBar();
Expand Down

0 comments on commit 95b8629

Please sign in to comment.