From 6e83d231fe612d76149c5a0f05ef77b4b698b458 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 27 Nov 2008 17:43:36 +0000 Subject: [PATCH] - The co-op summary screen now has a totals row at the bottom (if it fits). - Changed WI_drawPercent() when wi_percents is false so that the total display is optional, and it formats it like Heretic's intermission, with a slash and a fixed-width right column. - Font is no longer a property of the screen object. Pass the font to DrawText and DrawChar directly instead. - Doom's intermission characters are now collected together as a font so they can be colorized. SVN r1294 (trunk) --- docs/rh-log.txt | 14 +- src/c_console.cpp | 49 +++-- src/c_console.h | 5 +- src/ct_chat.cpp | 12 +- src/d_main.cpp | 2 +- src/d_net.cpp | 2 +- src/f_finale.cpp | 8 +- src/g_shared/a_keys.cpp | 6 +- src/g_shared/a_puzzleitems.cpp | 3 +- src/g_shared/a_secrettrigger.cpp | 3 +- src/g_shared/hudmessages.cpp | 45 ++--- src/g_shared/sbar.h | 8 +- src/g_shared/shared_hud.cpp | 83 ++++---- src/g_shared/shared_sbar.cpp | 27 ++- src/g_strife/a_alienspectres.cpp | 8 +- src/g_strife/a_strifeitems.cpp | 2 +- src/g_strife/a_strifestuff.cpp | 1 + src/g_strife/a_thingstoblowup.cpp | 2 +- src/g_strife/strife_sbar.cpp | 11 +- src/hu_scores.cpp | 19 +- src/m_menu.cpp | 113 +++++------ src/m_options.cpp | 40 ++-- src/p_acs.cpp | 23 +-- src/p_conversation.cpp | 12 +- src/p_interaction.cpp | 8 +- src/p_setup.cpp | 2 +- src/p_spec.cpp | 3 +- src/r_polymost.cpp | 2 +- src/s_sound.cpp | 58 +++--- src/stats.cpp | 6 +- src/thingdef/thingdef_codeptr.cpp | 9 +- src/v_font.cpp | 43 ++-- src/v_font.h | 3 +- src/v_text.cpp | 33 ++-- src/v_video.cpp | 10 +- src/v_video.h | 8 +- src/wi_stuff.cpp | 312 ++++++++++++------------------ wadsrc/static/fontdefs.txt | 20 ++ wadsrc/static/textcolors.txt | 10 + 39 files changed, 470 insertions(+), 555 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c703d3df26..53487f2a58 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,5 +1,17 @@ +November 27, 2008 +- The co-op summary screen now has a totals row at the bottom (if it fits). +- Changed WI_drawPercent() when wi_percents is false so that the total + display is optional, and it formats it like Heretic's intermission, with + a slash and a fixed-width right column. + +November 21, 2008 +- Font is no longer a property of the screen object. Pass the font to + DrawText and DrawChar directly instead. +- Doom's intermission characters are now collected together as a font + so they can be colorized. + November 15, 2008 (Changes by Graf Zahl) -- moved common code of Raven's fast projectiles into a base class +- Moved common code of Raven's fast projectiles into a base class called FastProjectile. This base class doesn't have any effects attached so that it can be used for user defined fast projectiles. diff --git a/src/c_console.cpp b/src/c_console.cpp index 2cd6eadd75..d66c403d13 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -560,11 +560,11 @@ void C_AddNotifyString (int printlevel, const char *source) if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel) { FString str = NotifyStrings[NUMNOTIFIES-1].Text + source; - lines = V_BreakLines (screen->Font, width, str); + lines = V_BreakLines (SmallFont, width, str); } else { - lines = V_BreakLines (screen->Font, width, source); + lines = V_BreakLines (SmallFont, width, source); addtype = (addtype == APPENDLINE) ? NEWLINE : addtype; } @@ -852,7 +852,7 @@ int PrintString (int printlevel, const char *outline) I_PrintStr (outline); AddToConsole (printlevel, outline); - if (vidactive && screen && screen->Font) + if (vidactive && screen && SmallFont) { C_AddNotifyString (printlevel, outline); maybedrawnow (false, false); @@ -1036,10 +1036,10 @@ static void C_DrawNotifyText () if (con_scaletext == 1) { if (!center) - screen->DrawText (color, 0, line, NotifyStrings[i].Text, + screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text, DTA_CleanNoMove, true, DTA_Alpha, alpha, TAG_DONE); else - screen->DrawText (color, (SCREENWIDTH - + screen->DrawText (SmallFont, color, (SCREENWIDTH - SmallFont->StringWidth (NotifyStrings[i].Text)*CleanXfac)/2, line, NotifyStrings[i].Text, DTA_CleanNoMove, true, DTA_Alpha, alpha, TAG_DONE); @@ -1047,10 +1047,10 @@ static void C_DrawNotifyText () else if (con_scaletext == 0) { if (!center) - screen->DrawText (color, 0, line, NotifyStrings[i].Text, + screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text, DTA_Alpha, alpha, TAG_DONE); else - screen->DrawText (color, (SCREENWIDTH - + screen->DrawText (SmallFont, color, (SCREENWIDTH - SmallFont->StringWidth (NotifyStrings[i].Text))/2, line, NotifyStrings[i].Text, DTA_Alpha, alpha, TAG_DONE); @@ -1058,13 +1058,13 @@ static void C_DrawNotifyText () else { if (!center) - screen->DrawText (color, 0, line, NotifyStrings[i].Text, + screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text, DTA_VirtualWidth, screen->GetWidth() / 2, DTA_VirtualHeight, screen->GetHeight() / 2, DTA_KeepRatio, true, DTA_Alpha, alpha, TAG_DONE); else - screen->DrawText (color, (screen->GetWidth() / 2 - + screen->DrawText (SmallFont, color, (screen->GetWidth() / 2 - SmallFont->StringWidth (NotifyStrings[i].Text))/2, line, NotifyStrings[i].Text, DTA_VirtualWidth, screen->GetWidth() / 2, @@ -1161,8 +1161,7 @@ void C_DrawConsole (bool hw2d) if (ConBottom >= 12) { - screen->SetFont (ConFont); - screen->DrawText (CR_ORANGE, SCREENWIDTH - 8 - + screen->DrawText (ConFont, CR_ORANGE, SCREENWIDTH - 8 - ConFont->StringWidth ("v" DOTVERSIONSTR), ConBottom - ConFont->GetHeight() - 4, "v" DOTVERSIONSTR, TAG_DONE); @@ -1194,11 +1193,11 @@ void C_DrawConsole (bool hw2d) { tickstr[tickend+3] = 0; } - screen->DrawText (CR_BROWN, LEFTMARGIN, tickerY, tickstr, TAG_DONE); + screen->DrawText (ConFont, CR_BROWN, LEFTMARGIN, tickerY, tickstr, TAG_DONE); // Draw the marker i = LEFTMARGIN+5+tickbegin*8 + Scale (TickerAt, (SDWORD)(tickend - tickbegin)*8, TickerMax); - screen->DrawChar (CR_ORANGE, (int)i, tickerY, 0x13, TAG_DONE); + screen->DrawChar (ConFont, CR_ORANGE, (int)i, tickerY, 0x13, TAG_DONE); TickerVisible = true; } @@ -1228,7 +1227,6 @@ void C_DrawConsole (bool hw2d) if (menuactive != MENU_Off) { - screen->SetFont (SmallFont); return; } @@ -1238,8 +1236,6 @@ void C_DrawConsole (bool hw2d) int pos = (InsertLine - 1) & LINEMASK; int i; - screen->SetFont (ConFont); - ConsoleDrawing = true; for (i = RowAdjust; i; i--) @@ -1260,7 +1256,7 @@ void C_DrawConsole (bool hw2d) pos = (pos - 1) & LINEMASK; if (Lines[pos] != NULL) { - screen->DrawText (CR_TAN, LEFTMARGIN, offset + lines * ConFont->GetHeight(), + screen->DrawText (ConFont, CR_TAN, LEFTMARGIN, offset + lines * ConFont->GetHeight(), Lines[pos], TAG_DONE); } lines--; @@ -1279,13 +1275,13 @@ void C_DrawConsole (bool hw2d) FString command((char *)&CmdLine[2+CmdLine[259]]); int cursorpos = CmdLine[1] - CmdLine[259]; - screen->DrawChar (CR_ORANGE, left, bottomline, '\x1c', TAG_DONE); - screen->DrawText (CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline, + screen->DrawChar (ConFont, CR_ORANGE, left, bottomline, '\x1c', TAG_DONE); + screen->DrawText (ConFont, CR_ORANGE, left + ConFont->GetCharWidth(0x1c), bottomline, command, TAG_DONE); if (cursoron) { - screen->DrawChar (CR_YELLOW, left + ConFont->GetCharWidth(0x1c) + cursorpos * ConFont->GetCharWidth(0xb), + screen->DrawChar (ConFont, CR_YELLOW, left + ConFont->GetCharWidth(0x1c) + cursorpos * ConFont->GetCharWidth(0xb), bottomline, '\xb', TAG_DONE); } } @@ -1293,11 +1289,10 @@ void C_DrawConsole (bool hw2d) { // Indicate that the view has been scrolled up (10) // and if we can scroll no further (12) - screen->DrawChar (CR_GREEN, 0, bottomline, pos == TopLine ? 12 : 10, TAG_DONE); + screen->DrawChar (ConFont, CR_GREEN, 0, bottomline, pos == TopLine ? 12 : 10, TAG_DONE); } } } - screen->SetFont (SmallFont); } void C_FullConsole () @@ -1826,12 +1821,12 @@ static const char bar3[] = TEXTCOLOR_RED "\n\35\36\36\36\36\36\36\36\36\36\36\36 "\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_NORMAL "\n"; static const char logbar[] = "\n<------------------------------->\n"; -void C_MidPrint (const char *msg) +void C_MidPrint (FFont *font, const char *msg) { if (StatusBar == NULL) return; - if (msg) + if (msg != NULL) { AddToConsole (-1, bar1); AddToConsole (-1, msg); @@ -1844,7 +1839,7 @@ void C_MidPrint (const char *msg) fflush (Logfile); } - StatusBar->AttachMessage (new DHUDMessage (msg, 1.5f, 0.375f, 0, 0, + StatusBar->AttachMessage (new DHUDMessage (font, msg, 1.5f, 0.375f, 0, 0, (EColorRange)PrintColors[PRINTLEVELS], con_midtime), MAKE_ID('C','N','T','R')); } else @@ -1853,7 +1848,7 @@ void C_MidPrint (const char *msg) } } -void C_MidPrintBold (const char *msg) +void C_MidPrintBold (FFont *font, const char *msg) { if (msg) { @@ -1868,7 +1863,7 @@ void C_MidPrintBold (const char *msg) fflush (Logfile); } - StatusBar->AttachMessage (new DHUDMessage (msg, 1.5f, 0.375f, 0, 0, + StatusBar->AttachMessage (new DHUDMessage (font, msg, 1.5f, 0.375f, 0, 0, (EColorRange)PrintColors[PRINTLEVELS+1], con_midtime), MAKE_ID('C','N','T','R')); } else diff --git a/src/c_console.h b/src/c_console.h index 49eafb030e..e1434c0516 100644 --- a/src/c_console.h +++ b/src/c_console.h @@ -73,8 +73,9 @@ void C_FlushDisplay (void); void C_InitTicker (const char *label, unsigned int max, bool showpercent=true); void C_SetTicker (unsigned int at, bool forceUpdate=false); -void C_MidPrint (const char *message); -void C_MidPrintBold (const char *message); +class FFont; +void C_MidPrint (FFont *font, const char *message); +void C_MidPrintBold (FFont *font, const char *message); bool C_Responder (event_t *ev); diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index f527ac1b33..f2cb1706d3 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -213,13 +213,13 @@ void CT_Drawer (void) y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y; promptwidth = SmallFont->StringWidth (prompt) * scalex; - x = screen->Font->GetCharWidth ('_') * scalex * 2 + promptwidth; + x = SmallFont->GetCharWidth ('_') * scalex * 2 + promptwidth; // figure out if the text is wider than the screen-> // if so, only draw the right-most portion of it. for (i = len - 1; i >= 0 && x < screen_width; i--) { - x += screen->Font->GetCharWidth (ChatQueue[i] & 0x7f) * scalex; + x += SmallFont->GetCharWidth (ChatQueue[i] & 0x7f) * scalex; } if (i >= 0) @@ -236,14 +236,14 @@ void CT_Drawer (void) ChatQueue[len+1] = '\0'; if (con_scaletext < 2) { - screen->DrawText (CR_GREEN, 0, y, prompt, DTA_CleanNoMove, *con_scaletext, TAG_DONE); - screen->DrawText (CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_CleanNoMove, *con_scaletext, TAG_DONE); + screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, DTA_CleanNoMove, *con_scaletext, TAG_DONE); + screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_CleanNoMove, *con_scaletext, TAG_DONE); } else { - screen->DrawText (CR_GREEN, 0, y, prompt, + screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); - screen->DrawText (CR_GREY, promptwidth, y, (char *)(ChatQueue + i), + screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); } ChatQueue[len] = '\0'; diff --git a/src/d_main.cpp b/src/d_main.cpp index a2d1a97aec..b73f161ad6 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -897,7 +897,7 @@ void D_PageDrawer (void) screen->Clear (0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0); if (!PageBlank) { - screen->DrawText (CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE); + screen->DrawText (SmallFont, CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE); } } if (Advisory != NULL) diff --git a/src/d_net.cpp b/src/d_net.cpp index 9dac2ff376..d7ad9e623c 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1993,7 +1993,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) case DEM_CENTERPRINT: s = ReadString (stream); - C_MidPrint (s); + C_MidPrint (SmallFont, s); break; case DEM_UINFCHANGED: diff --git a/src/f_finale.cpp b/src/f_finale.cpp index 6037af5036..bbdd7d4352 100644 --- a/src/f_finale.cpp +++ b/src/f_finale.cpp @@ -397,7 +397,7 @@ void F_TextWrite (void) // draw some of the text onto the screen leftmargin = (gameinfo.gametype & (GAME_DoomStrifeChex|GAME_Hexen) ? 10 : 20) - 160; - rowheight = screen->Font->GetHeight () + + rowheight = SmallFont->GetHeight () + (gameinfo.gametype & (GAME_DoomStrifeChex) ? 3 : -1); scale = (CleanXfac != 1 || CleanYfac != 1); @@ -413,7 +413,7 @@ void F_TextWrite (void) ch = FinaleText.GetChars(); count = (FinaleCount - 10)/TEXTSPEED; - range = screen->Font->GetColorTranslation (CR_UNTRANSLATED); + range = SmallFont->GetColorTranslation (CR_UNTRANSLATED); for ( ; count ; count-- ) { @@ -427,7 +427,7 @@ void F_TextWrite (void) continue; } - pic = screen->Font->GetChar (c, &w); + pic = SmallFont->GetChar (c, &w); if (cx+w > SCREENWIDTH) continue; if (pic != NULL) @@ -761,7 +761,7 @@ void F_CastDrawer (void) DTA_DestHeight, screen->GetHeight(), TAG_DONE); - screen->DrawText (CR_RED, + screen->DrawText (SmallFont, CR_UNTRANSLATED, (SCREENWIDTH - SmallFont->StringWidth (GStrings(castorder[castnum].name)) * CleanXfac)/2, (SCREENHEIGHT * 180) / 200, GStrings(castorder[castnum].name), diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp index e9298e8fa0..b328d8ae74 100644 --- a/src/g_shared/a_keys.cpp +++ b/src/g_shared/a_keys.cpp @@ -9,7 +9,7 @@ #include "v_palette.h" #include "w_wad.h" #include "doomstat.h" - +#include "v_font.h" struct OneKey @@ -169,9 +169,9 @@ static void PrintMessage (const char *str) { if (str[0]=='$') { - str=GStrings(str+1); + str = GStrings(str+1); } - C_MidPrint (str); + C_MidPrint (SmallFont, str); } } diff --git a/src/g_shared/a_puzzleitems.cpp b/src/g_shared/a_puzzleitems.cpp index 68bca31fbb..0cbc7cc337 100644 --- a/src/g_shared/a_puzzleitems.cpp +++ b/src/g_shared/a_puzzleitems.cpp @@ -6,6 +6,7 @@ #include "s_sound.h" #include "c_console.h" #include "doomstat.h" +#include "v_font.h" IMPLEMENT_CLASS (APuzzleItem) @@ -38,7 +39,7 @@ bool APuzzleItem::Use (bool pickup) const char *message = GetClass()->Meta.GetMetaString (AIMETA_PuzzFailMessage); if (message != NULL && *message=='$') message = GStrings[message + 1]; if (message == NULL) message = GStrings("TXT_USEPUZZLEFAILED"); - C_MidPrintBold (message); + C_MidPrintBold (SmallFont, message); } return false; } diff --git a/src/g_shared/a_secrettrigger.cpp b/src/g_shared/a_secrettrigger.cpp index 353ae87397..d0996aab8f 100644 --- a/src/g_shared/a_secrettrigger.cpp +++ b/src/g_shared/a_secrettrigger.cpp @@ -39,6 +39,7 @@ #include "s_sound.h" #include "d_player.h" #include "doomstat.h" +#include "v_font.h" EXTERN_CVAR(String, secretmessage) @@ -66,7 +67,7 @@ void ASecretTrigger::Activate (AActor *activator) { if (args[0] <= 1) { - C_MidPrint (secretmessage); + C_MidPrint (SmallFont, secretmessage); } if (args[0] == 0 || args[0] == 2) { diff --git a/src/g_shared/hudmessages.cpp b/src/g_shared/hudmessages.cpp index 933b60bf39..a27b4191f8 100644 --- a/src/g_shared/hudmessages.cpp +++ b/src/g_shared/hudmessages.cpp @@ -68,7 +68,7 @@ inline FArchive &operator<< (FArchive &arc, EColorRange &i) // //============================================================================ -DHUDMessage::DHUDMessage (const char *text, float x, float y, int hudwidth, int hudheight, +DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float holdTime) { if (hudwidth == 0 || hudheight == 0) @@ -138,7 +138,7 @@ DHUDMessage::DHUDMessage (const char *text, float x, float y, int hudwidth, int TextColor = textColor; State = 0; SourceText = copystring (text); - Font = screen->Font; + Font = font; ResetText (SourceText); } @@ -268,11 +268,8 @@ void DHUDMessage::Draw (int bottom) int ystep; int i; bool clean = false; - FFont *oldfont = screen->Font; int hudheight; - screen->SetFont (Font); - DrawSetup (); int screen_width = SCREENWIDTH; @@ -371,8 +368,6 @@ void DHUDMessage::Draw (int bottom) DoDraw (i, drawx, y, clean, hudheight); y += ystep; } - - screen->SetFont (oldfont); } //============================================================================ @@ -397,13 +392,13 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) { if (con_scaletext <= 1) { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, TAG_DONE); } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualHeight, SCREENHEIGHT/2, DTA_KeepRatio, true, @@ -412,7 +407,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, HUDWidth, DTA_VirtualHeight, hudheight, TAG_DONE); @@ -429,10 +424,10 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) // //============================================================================ -DHUDMessageFadeOut::DHUDMessageFadeOut (const char *text, float x, float y, +DHUDMessageFadeOut::DHUDMessageFadeOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float holdTime, float fadeOutTime) - : DHUDMessage (text, x, y, hudwidth, hudheight, textColor, holdTime) + : DHUDMessage (font, text, x, y, hudwidth, hudheight, textColor, holdTime) { FadeOutTics = (int)(fadeOutTime * TICRATE); State = 1; @@ -490,14 +485,14 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh { if (con_scaletext <= 1) { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, DTA_Alpha, trans, TAG_DONE); } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualHeight, SCREENHEIGHT/2, DTA_Alpha, trans, @@ -507,7 +502,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, HUDWidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, @@ -527,10 +522,10 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh // //============================================================================ -DHUDMessageFadeInOut::DHUDMessageFadeInOut (const char *text, float x, float y, +DHUDMessageFadeInOut::DHUDMessageFadeInOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float holdTime, float fadeInTime, float fadeOutTime) - : DHUDMessageFadeOut (text, x, y, hudwidth, hudheight, textColor, holdTime, fadeOutTime) + : DHUDMessageFadeOut (font, text, x, y, hudwidth, hudheight, textColor, holdTime, fadeOutTime) { FadeInTics = (int)(fadeInTime * TICRATE); State = FadeInTics == 0; @@ -583,14 +578,14 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu { if (con_scaletext <= 1) { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, DTA_Alpha, trans, TAG_DONE); } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualHeight, SCREENHEIGHT/2, DTA_Alpha, trans, @@ -600,7 +595,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, HUDWidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, @@ -624,10 +619,10 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu // //============================================================================ -DHUDMessageTypeOnFadeOut::DHUDMessageTypeOnFadeOut (const char *text, float x, float y, +DHUDMessageTypeOnFadeOut::DHUDMessageTypeOnFadeOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float typeTime, float holdTime, float fadeOutTime) - : DHUDMessageFadeOut (text, x, y, hudwidth, hudheight, textColor, holdTime, fadeOutTime) + : DHUDMessageFadeOut (font, text, x, y, hudwidth, hudheight, textColor, holdTime, fadeOutTime) { TypeOnTime = typeTime * TICRATE; if (TypeOnTime == 0.f) @@ -729,14 +724,14 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in { if (con_scaletext <= 1) { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_CleanNoMove, clean, DTA_TextLen, LineVisible, TAG_DONE); } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualHeight, SCREENHEIGHT/2, DTA_KeepRatio, true, @@ -746,7 +741,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in } else { - screen->DrawText (TextColor, x, y, Lines[linenum].Text, + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, DTA_VirtualWidth, HUDWidth, DTA_VirtualHeight, hudheight, DTA_TextLen, LineVisible, diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 00f471c1e8..c174d9f11a 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -57,7 +57,7 @@ class DHUDMessage : public DObject DECLARE_CLASS (DHUDMessage, DObject) HAS_OBJECT_POINTERS public: - DHUDMessage (const char *text, float x, float y, int hudwidth, int hudheight, + DHUDMessage (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float holdTime); virtual ~DHUDMessage (); @@ -98,7 +98,7 @@ class DHUDMessageFadeOut : public DHUDMessage { DECLARE_CLASS (DHUDMessageFadeOut, DHUDMessage) public: - DHUDMessageFadeOut (const char *text, float x, float y, int hudwidth, int hudheight, + DHUDMessageFadeOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float holdTime, float fadeOutTime); virtual void Serialize (FArchive &arc); @@ -117,7 +117,7 @@ class DHUDMessageFadeInOut : public DHUDMessageFadeOut { DECLARE_CLASS (DHUDMessageFadeInOut, DHUDMessageFadeOut) public: - DHUDMessageFadeInOut (const char *text, float x, float y, int hudwidth, int hudheight, + DHUDMessageFadeInOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float holdTime, float fadeInTime, float fadeOutTime); virtual void Serialize (FArchive &arc); @@ -136,7 +136,7 @@ class DHUDMessageTypeOnFadeOut : public DHUDMessageFadeOut { DECLARE_CLASS (DHUDMessageTypeOnFadeOut, DHUDMessageFadeOut) public: - DHUDMessageTypeOnFadeOut (const char *text, float x, float y, int hudwidth, int hudheight, + DHUDMessageTypeOnFadeOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float typeTime, float holdTime, float fadeOutTime); virtual void Serialize (FArchive &arc); diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index 5e217ad2e7..cb77e40d19 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -156,14 +156,14 @@ static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, int trans // //--------------------------------------------------------------------------- -static void DrawHudText(int color, char * text, int x, int y, int trans=0xc000) +static void DrawHudText(FFont *font, int color, char * text, int x, int y, int trans=0xc000) { - int zerowidth = screen->Font->GetCharWidth('0'); + int zerowidth = font->GetCharWidth('0'); x+=zerowidth/2; for(int i=0;text[i];i++) { - screen->DrawChar(color, x, y, text[i], + screen->DrawChar(font, color, x, y, text[i], DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, DTA_CenterBottomOffset, 1, TAG_DONE); @@ -178,12 +178,12 @@ static void DrawHudText(int color, char * text, int x, int y, int trans=0xc000) // //--------------------------------------------------------------------------- -static void DrawHudNumber(int color, int num, int x, int y, int trans=0xc000) +static void DrawHudNumber(FFont *font, int color, int num, int x, int y, int trans=0xc000) { char text[15]; mysnprintf(text, countof(text), "%d", num); - DrawHudText(color, text, x, y, trans); + DrawHudText(font, color, text, x, y, trans); } @@ -198,29 +198,27 @@ static void DrawStatus(player_t * CPlayer, int x, int y) char tempstr[50]; int space; - screen->SetFont(SmallFont); - if (hud_showstats) { - space=SmallFont->StringWidth("Ac: "); + space = SmallFont->StringWidth("Ac: "); - y-=SmallFont->GetHeight()-1; - screen->DrawText(hudcolor_statnames, x, y, "Ac:", + y -= SmallFont->GetHeight()-1; + screen->DrawText(SmallFont, hudcolor_statnames, x, y, "Ac:", DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->accuracy); - screen->DrawText(hudcolor_stats, x+space, y, tempstr, + screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); y-=SmallFont->GetHeight()-1; - screen->DrawText(hudcolor_statnames, x, y, "St:", + screen->DrawText(SmallFont, hudcolor_statnames, x, y, "St:", DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); mysnprintf(tempstr, countof(tempstr), "%i ", CPlayer->stamina); - screen->DrawText(hudcolor_stats, x+space, y, tempstr, + screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); } @@ -233,39 +231,39 @@ static void DrawStatus(player_t * CPlayer, int x, int y) // work in cooperative hub games if (hud_showsecrets) { - y-=SmallFont->GetHeight()-1; - screen->DrawText(hudcolor_statnames, x, y, "S:", + y -= SmallFont->GetHeight()-1; + screen->DrawText(SmallFont, hudcolor_statnames, x, y, "S:", DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); mysnprintf(tempstr, countof(tempstr), "%i/%i ", multiplayer? CPlayer->secretcount : level.found_secrets, level.total_secrets); - screen->DrawText(hudcolor_stats, x+space, y, tempstr, + screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); } if (hud_showitems) { - y-=SmallFont->GetHeight()-1; - screen->DrawText(hudcolor_statnames, x, y, "I:", + y -= SmallFont->GetHeight()-1; + screen->DrawText(SmallFont, hudcolor_statnames, x, y, "I:", DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); mysnprintf(tempstr, countof(tempstr), "%i/%i ", multiplayer? CPlayer->itemcount : level.found_items, level.total_items); - screen->DrawText(hudcolor_stats, x+space, y, tempstr, + screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); } if (hud_showmonsters) { - y-=SmallFont->GetHeight()-1; - screen->DrawText(hudcolor_statnames, x, y, "K:", + y -= SmallFont->GetHeight()-1; + screen->DrawText(SmallFont, hudcolor_statnames, x, y, "K:", DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); mysnprintf(tempstr, countof(tempstr), "%i/%i ", multiplayer? CPlayer->killcount : level.killed_monsters, level.total_monsters); - screen->DrawText(hudcolor_stats, x+space, y, tempstr, + screen->DrawText(SmallFont, hudcolor_stats, x+space, y, tempstr, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE); } @@ -289,9 +287,7 @@ static void DrawHealth(int health, int x, int y) CR_BLUE; DrawImageToBox(healthpic, x, y, 31, 17); - - screen->SetFont(HudFont); - DrawHudNumber(fontcolor, health, x + 33, y + 17); + DrawHudNumber(HudFont, fontcolor, health, x + 33, y + 17); } //=========================================================================== @@ -318,9 +314,7 @@ static void DrawArmor(AInventory * armor, int x, int y) if (ap) { DrawImageToBox(TexMan[armor->Icon], x, y, 31, 17); - - screen->SetFont(HudFont); - DrawHudNumber(fontcolor, ap, x + 33, y + 17); + DrawHudNumber(HudFont, fontcolor, ap, x + 33, y + 17); } } } @@ -530,10 +524,9 @@ static int DrawAmmo(player_t * CPlayer, int x, int y) // ok, we got all ammo types. Now draw the list back to front (bottom to top) - int def_width=ConFont->StringWidth("000/000"); + int def_width = ConFont->StringWidth("000/000"); x-=def_width; - screen->SetFont(ConFont); - int yadd=ConFont->GetHeight(); + int yadd = ConFont->GetHeight(); for(i=orderedammos.Size()-1;i>=0;i--) { @@ -559,7 +552,7 @@ static int DrawAmmo(player_t * CPlayer, int x, int y) ammo < ( (maxammo * hud_ammo_red) / 100) ? CR_RED : ammo < ( (maxammo * hud_ammo_yellow) / 100) ? CR_GOLD : CR_GREEN ); - DrawHudText(fontcolor, buf, x-tex_width, y+yadd, trans); + DrawHudText(ConFont, fontcolor, buf, x-tex_width, y+yadd, trans); DrawImageToBox(TexMan[icon], x-20, y, 16, 8, trans); y-=10; } @@ -699,8 +692,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y) if (rover->Amount>=1000) xx = 32 - IndexFont->StringWidth(buffer); else xx = 22; - screen->SetFont(IndexFont); - screen->DrawText(CR_GOLD, x+xx, y+20, buffer, + screen->DrawText(IndexFont, CR_GOLD, x+xx, y+20, buffer, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, trans, TAG_DONE); } @@ -728,9 +720,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y) static void DrawFrags(player_t * CPlayer, int x, int y) { DrawImageToBox(fragpic, x, y, 31, 17); - - screen->SetFont(HudFont); - DrawHudNumber(CR_GRAY, CPlayer->fragcount, x + 33, y + 17); + DrawHudNumber(HudFont, CR_GRAY, CPlayer->fragcount, x + 33, y + 17); } @@ -747,7 +737,7 @@ static void DrawCoordinates(player_t * CPlayer) fixed_t y; fixed_t z; char coordstr[18]; - int h=SmallFont->GetHeight()+1; + int h = SmallFont->GetHeight()+1; if (!map_point_coordinates || !automapactive) @@ -768,17 +758,17 @@ static void DrawCoordinates(player_t * CPlayer) int ypos = 18; mysnprintf(coordstr, countof(coordstr), "X: %d", x>>FRACBITS); - screen->DrawText(hudcolor_xyco, xpos, ypos, coordstr, + screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos, coordstr, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); mysnprintf(coordstr, countof(coordstr), "Y: %d", y>>FRACBITS); - screen->DrawText(hudcolor_xyco, xpos, ypos+h, coordstr, + screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+h, coordstr, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); mysnprintf(coordstr, countof(coordstr), "Z: %d", z>>FRACBITS); - screen->DrawText(hudcolor_xyco, xpos, ypos+2*h, coordstr, + screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+2*h, coordstr, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); } @@ -845,7 +835,6 @@ void DrawHUD() i=DrawAmmo(CPlayer, hudwidth-5, i); DrawWeapons(CPlayer, hudwidth-5, i); DrawInventory(CPlayer, 144, hudheight-28); - screen->SetFont(SmallFont); if (CPlayer->camera && CPlayer->camera->player) { StatusBar->DrawCrosshair(); @@ -862,13 +851,11 @@ void DrawHUD() int fonth=SmallFont->GetHeight()+1; int bottom=hudheight-1; - screen->SetFont(SmallFont); - if (am_showtotaltime) { seconds = level.totaltime / TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); - DrawHudText(hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); + DrawHudText(SmallFont, hudcolor_ttim, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; } @@ -876,7 +863,7 @@ void DrawHUD() { seconds = level.time /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); - DrawHudText(hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); + DrawHudText(SmallFont, hudcolor_time, printstr, hudwidth-length, bottom, FRACUNIT); bottom -= fonth; // Single level time for hubs @@ -884,12 +871,12 @@ void DrawHUD() { seconds= level.maptime /TICRATE; mysnprintf(printstr, countof(printstr), "%02i:%02i:%02i", seconds/3600, (seconds%3600)/60, seconds%60); - DrawHudText(hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); + DrawHudText(SmallFont, hudcolor_ltim, printstr, hudwidth-length, bottom, FRACUNIT); } } mysnprintf(printstr, countof(printstr), "%s: %s", level.mapname, level.level_name); - screen->DrawText(hudcolor_titl, 1, hudheight-fonth-1, printstr, + screen->DrawText(SmallFont, hudcolor_titl, 1, hudheight-fonth-1, printstr, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 133dd01122..cc25a3b185 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -430,7 +430,7 @@ void DBaseStatusBar::ShowPlayerName () EColorRange color; color = (CPlayer == &players[consoleplayer]) ? CR_GOLD : CR_GREEN; - AttachMessage (new DHUDMessageFadeOut (CPlayer->userinfo.netname, + AttachMessage (new DHUDMessageFadeOut (SmallFont, CPlayer->userinfo.netname, 1.5f, 0.92f, 0, 0, color, 2.f, 0.35f), MAKE_ID('P','N','A','M')); } @@ -1126,7 +1126,7 @@ void DBaseStatusBar::Draw (EHudState state) if (idmypos) { // Draw current coordinates - int height = screen->Font->GetHeight(); + int height = SmallFont->GetHeight(); char labels[3] = { 'X', 'Y', 'Z' }; fixed_t *value; int i; @@ -1163,7 +1163,7 @@ void DBaseStatusBar::Draw (EHudState state) for (i = 2, value = &CPlayer->mo->z; i >= 0; y -= height, --value, --i) { mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS); - screen->DrawText (CR_GREEN, xpos, y, line, + screen->DrawText (SmallFont, CR_GREEN, xpos, y, line, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); @@ -1185,20 +1185,20 @@ void DBaseStatusBar::Draw (EHudState state) EColorRange highlight = (gameinfo.gametype & GAME_DoomChex) ? CR_UNTRANSLATED : CR_YELLOW; - height = screen->Font->GetHeight () * CleanYfac; + height = SmallFont->GetHeight () * CleanYfac; // Draw timer y = 8; if (am_showtime) { mysnprintf (line, countof(line), "%02d:%02d:%02d", time/3600, (time%3600)/60, time%60); // Time - screen->DrawText (CR_GREY, SCREENWIDTH - 80*CleanXfac, y, line, DTA_CleanNoMove, true, TAG_DONE); + screen->DrawText (SmallFont, CR_GREY, SCREENWIDTH - 80*CleanXfac, y, line, DTA_CleanNoMove, true, TAG_DONE); y+=8*CleanYfac; } if (am_showtotaltime) { mysnprintf (line, countof(line), "%02d:%02d:%02d", totaltime/3600, (totaltime%3600)/60, totaltime%60); // Total time - screen->DrawText (CR_GREY, SCREENWIDTH - 80*CleanXfac, y, line, DTA_CleanNoMove, true, TAG_DONE); + screen->DrawText (SmallFont, CR_GREY, SCREENWIDTH - 80*CleanXfac, y, line, DTA_CleanNoMove, true, TAG_DONE); } // Draw map name @@ -1245,7 +1245,7 @@ void DBaseStatusBar::Draw (EHudState state) line[i] = TEXTCOLOR_ESCAPE; line[i+1] = CR_GREY + 'A'; strcpy (&line[i+2], level.level_name); - screen->DrawText (highlight, + screen->DrawText (SmallFont, highlight, (SCREENWIDTH - SmallFont->StringWidth (line)*CleanXfac)/2, y, line, DTA_CleanNoMove, true, TAG_DONE); @@ -1258,7 +1258,7 @@ void DBaseStatusBar::Draw (EHudState state) { mysnprintf (line, countof(line), "MONSTERS:" TEXTCOLOR_GREY " %d/%d", level.killed_monsters, level.total_monsters); - screen->DrawText (highlight, 8, y, line, + screen->DrawText (SmallFont, highlight, 8, y, line, DTA_CleanNoMove, true, TAG_DONE); y += height; } @@ -1268,7 +1268,7 @@ void DBaseStatusBar::Draw (EHudState state) { mysnprintf (line, countof(line), "SECRETS:" TEXTCOLOR_GREY " %d/%d", level.found_secrets, level.total_secrets); - screen->DrawText (highlight, 8, y, line, + screen->DrawText (SmallFont, highlight, 8, y, line, DTA_CleanNoMove, true, TAG_DONE); y += height; } @@ -1278,7 +1278,7 @@ void DBaseStatusBar::Draw (EHudState state) { mysnprintf (line, countof(line), "ITEMS:" TEXTCOLOR_GREY " %d/%d", level.found_items, level.total_items); - screen->DrawText (highlight, 8, y, line, + screen->DrawText (SmallFont, highlight, 8, y, line, DTA_CleanNoMove, true, TAG_DONE); } } @@ -1341,11 +1341,10 @@ void DBaseStatusBar::DrawLog () Scale(w, SCREENWIDTH, hudwidth), Scale(height, SCREENHEIGHT, hudheight)); x+=20; y+=10; - screen->SetFont(SmallFont); for (int i = 0; lines[i].Width != -1; i++) { - screen->DrawText (CR_UNTRANSLATED, x, y, lines[i].Text, + screen->DrawText (SmallFont, CR_UNTRANSLATED, x, y, lines[i].Text, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); y += SmallFont->GetHeight ()+1; @@ -1374,7 +1373,7 @@ void DBaseStatusBar::DrawTopStuff (EHudState state) { if (demoplayback && demover != DEMOGAMEVERSION) { - screen->DrawText (CR_TAN, 0, ST_Y - 40 * CleanYfac, + screen->DrawText (SmallFont, CR_TAN, 0, ST_Y - 40 * CleanYfac, "Demo was recorded with a different version\n" "of ZDoom. Expect it to go out of sync.", DTA_CleanNoMove, true, TAG_DONE); @@ -1548,7 +1547,7 @@ void DBaseStatusBar::DrawConsistancy () const players[1-consoleplayer].inconsistant/ticdup); } } - screen->DrawText (CR_GREEN, + screen->DrawText (SmallFont, CR_GREEN, (screen->GetWidth() - SmallFont->StringWidth (conbuff)*CleanXfac) / 2, 0, conbuff, DTA_CleanNoMove, true, TAG_DONE); BorderTopRefresh = screen->GetPageCount (); diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 085113f9fc..bd2c0d72f9 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -111,14 +111,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) break; case NAME_AlienSpectre2: - C_MidPrint(GStrings("TXT_KILLED_BISHOP")); + C_MidPrint(SmallFont, GStrings("TXT_KILLED_BISHOP")); log = 74; player->GiveInventoryType (QuestItemClasses[20]); break; case NAME_AlienSpectre3: { - C_MidPrint(GStrings("TXT_KILLED_ORACLE")); + C_MidPrint(SmallFont, GStrings("TXT_KILLED_ORACLE")); // If there are any Oracles still alive, kill them. TThinkerIterator it(NAME_Oracle); AActor *oracle; @@ -149,7 +149,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) } case NAME_AlienSpectre4: - C_MidPrint(GStrings("TXT_KILLED_MACIL")); + C_MidPrint(SmallFont, GStrings("TXT_KILLED_MACIL")); player->GiveInventoryType (QuestItemClasses[23]); if (player->FindInventory (QuestItemClasses[24]) == NULL) { // Richter has taken over. Macil is a snake. @@ -162,7 +162,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) break; case NAME_AlienSpectre5: - C_MidPrint(GStrings("TXT_KILLED_LOREMASTER")); + C_MidPrint(SmallFont, GStrings("TXT_KILLED_LOREMASTER")); ASigil *sigil; player->GiveInventoryType (QuestItemClasses[25]); diff --git a/src/g_strife/a_strifeitems.cpp b/src/g_strife/a_strifeitems.cpp index b8f28d8ae7..c1028ccfab 100644 --- a/src/g_strife/a_strifeitems.cpp +++ b/src/g_strife/a_strifeitems.cpp @@ -110,7 +110,7 @@ bool AScanner::Use (bool pickup) { if (Owner->CheckLocalView (consoleplayer)) { - C_MidPrint(GStrings("TXT_NEEDMAP")); + C_MidPrint(SmallFont, GStrings("TXT_NEEDMAP")); } return false; } diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index a65cc91b46..abd2cb2a85 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -17,6 +17,7 @@ #include "a_sharedglobal.h" #include "templates.h" #include "d_event.h" +#include "v_font.h" // Include all the other Strife stuff here to reduce compile time #include "a_acolyte.cpp" diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index 8c68f26002..d0271e3e64 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -53,7 +53,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem) if (name != NULL) { - C_MidPrint (name); + C_MidPrint (SmallFont, name); } } diff --git a/src/g_strife/strife_sbar.cpp b/src/g_strife/strife_sbar.cpp index 782eec96da..7066282eb1 100644 --- a/src/g_strife/strife_sbar.cpp +++ b/src/g_strife/strife_sbar.cpp @@ -581,7 +581,6 @@ private: screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_Alpha, FRACUNIT*3/4, TAG_DONE); screen->DrawTexture (Images[bars], left, top, DTA_CleanNoMove, true, TAG_DONE); - screen->SetFont (SmallFont2); switch (CurrentPop) { @@ -592,7 +591,7 @@ private: ((level.time/TICRATE)%3600)/60, (level.time/TICRATE)%60); - screen->DrawText (CR_UNTRANSLATED, left+210*xscale, top+8*yscale, buff, + screen->DrawText (SmallFont2, CR_UNTRANSLATED, left+210*xscale, top+8*yscale, buff, DTA_CleanNoMove, true, TAG_DONE); if (CPlayer->LogText != NULL) @@ -600,7 +599,7 @@ private: FBrokenLines *lines = V_BreakLines (SmallFont2, 272, CPlayer->LogText); for (i = 0; lines[i].Width >= 0; ++i) { - screen->DrawText (CR_UNTRANSLATED, left+24*xscale, top+(18+i*12)*yscale, + screen->DrawText (SmallFont2, CR_UNTRANSLATED, left+24*xscale, top+(18+i*12)*yscale, lines[i].Text, DTA_CleanNoMove, true, TAG_DONE); } V_FreeBrokenLines (lines); @@ -653,7 +652,7 @@ private: DTA_ClipLeft, clipleft, DTA_ClipRight, clipright, TAG_DONE); - screen->DrawText (CR_UNTRANSLATED, + screen->DrawText (SmallFont2, CR_UNTRANSLATED, left + (colnum * 140 + leftcol + 17)*xscale, top + (11 + rownum)*yscale, label, @@ -711,7 +710,7 @@ private: }; for (i = 0; i < 7; ++i) { - const PClass * ammotype = PClass::FindClass(AmmoList[i].AmmoType); + const PClass *ammotype = PClass::FindClass(AmmoList[i].AmmoType); item = CPlayer->mo->FindInventory (ammotype); if (item == NULL) @@ -758,8 +757,6 @@ private: } break; } - - screen->SetFont (SmallFont); } void DrINumber (signed int val, int x, int y, int imgBase) const diff --git a/src/hu_scores.cpp b/src/hu_scores.cpp index 2366c924f3..4235c1247f 100644 --- a/src/hu_scores.cpp +++ b/src/hu_scores.cpp @@ -157,7 +157,7 @@ void HU_DrawScores (player_t *player) static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYERS]) { int color; - int height = screen->Font->GetHeight() * CleanYfac; + int height = SmallFont->GetHeight() * CleanYfac; unsigned int i; int maxwidth = 0; int numTeams = 0; @@ -221,8 +221,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER char score[80]; mysnprintf (score, countof(score), "%d", teams[i].score); - screen->SetFont (BigFont); - screen->DrawText (teams[i].GetTextColor (), scorexwidth, gamestate == GS_INTERMISSION ? y * 4 / 5 : y / 2, score, + screen->DrawText (BigFont, teams[i].GetTextColor(), scorexwidth, gamestate == GS_INTERMISSION ? y * 4 / 5 : y / 2, score, DTA_CleanNoMove, true, TAG_DONE); scorexwidth += SCREENWIDTH / 8; @@ -232,15 +231,13 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER gamestate == GS_INTERMISSION ? y += 0 : y += SCREENWIDTH / 32; } - screen->SetFont (SmallFont); - - screen->DrawText (color, SCREENWIDTH / 32, y, "Color", + screen->DrawText (SmallFont, color, SCREENWIDTH / 32, y, "Color", DTA_CleanNoMove, true, TAG_DONE); - screen->DrawText (color, SCREENWIDTH / 4, y, deathmatch ? "Frags" : "Kills", + screen->DrawText (SmallFont, color, SCREENWIDTH / 4, y, deathmatch ? "Frags" : "Kills", DTA_CleanNoMove, true, TAG_DONE); - screen->DrawText (color, SCREENWIDTH / 2, y, "Name", + screen->DrawText (SmallFont, color, SCREENWIDTH / 2, y, "Name", DTA_CleanNoMove, true, TAG_DONE); x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1); @@ -287,7 +284,7 @@ static void HU_DrawTimeRemaining (int y) else mysnprintf (str, countof(str), "Level ends in %02d:%02d", minutes, seconds); - screen->DrawText (CR_GREY, SCREENWIDTH/2 - SmallFont->StringWidth (str)/2*CleanXfac, + screen->DrawText (SmallFont, CR_GREY, SCREENWIDTH/2 - SmallFont->StringWidth (str)/2*CleanXfac, y, str, DTA_CleanNoMove, true, TAG_DONE); } } @@ -329,10 +326,10 @@ static void HU_DrawPlayer (player_t *player, bool highlight, int x, int y, int h mysnprintf (str, countof(str), "%d", deathmatch ? player->fragcount : player->killcount); - screen->DrawText (color, SCREENWIDTH / 4, y, player->playerstate == PST_DEAD && !deathmatch ? "DEAD" : str, + screen->DrawText (SmallFont, color, SCREENWIDTH / 4, y, player->playerstate == PST_DEAD && !deathmatch ? "DEAD" : str, DTA_CleanNoMove, true, TAG_DONE); - screen->DrawText (color, SCREENWIDTH / 2, y, player->userinfo.netname, + screen->DrawText (SmallFont, color, SCREENWIDTH / 2, y, player->userinfo.netname, DTA_CleanNoMove, true, TAG_DONE); if (teamplay && teams[player->userinfo.team].logo.GetChars ()) diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 1da41e4d8b..09ad5db556 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -941,11 +941,10 @@ void M_DrawLoad (void) else { const char *loadgame = GStrings("MNU_LOADGAME"); - screen->DrawText (CR_UNTRANSLATED, + screen->DrawText (BigFont, CR_UNTRANSLATED, (SCREENWIDTH - BigFont->StringWidth (loadgame)*CleanXfac)/2, 10*CleanYfac, loadgame, DTA_CleanNoMove, true, TAG_DONE); } - screen->SetFont (SmallFont); M_DrawSaveLoadCommon (); } @@ -984,10 +983,6 @@ static void M_ExtractSaveData (const FSaveGameNode *node) M_UnloadSaveData (); - // When breaking comment strings below, be sure to get the spacing from - // the small font instead of some other font. - screen->SetFont (SmallFont); - if (node != NULL && node->Succ != NULL && !node->Filename.IsEmpty() && @@ -1036,7 +1031,7 @@ static void M_ExtractSaveData (const FSaveGameNode *node) memcpy (comment + timelen, pcomment, commentlen); } comment[timelen+commentlen] = 0; - SaveComment = V_BreakLines (screen->Font, 216*screen->GetWidth()/640/CleanXfac, comment); + SaveComment = V_BreakLines (SmallFont, 216*screen->GetWidth()/640/CleanXfac, comment); delete[] comment; delete[] time; delete[] pcomment; @@ -1121,7 +1116,7 @@ static void M_DrawSaveLoadCommon () ? GStrings("MNU_NOPICTURE") : GStrings("MNU_DIFFVERSION"); const int textlen = SmallFont->StringWidth (text)*CleanXfac; - screen->DrawText (CR_GOLD, savepicLeft+(savepicWidth-textlen)/2, + screen->DrawText (SmallFont, CR_GOLD, savepicLeft+(savepicWidth-textlen)/2, savepicTop+(savepicHeight-rowHeight)/2, text, DTA_CleanNoMove, true, TAG_DONE); } @@ -1137,7 +1132,7 @@ static void M_DrawSaveLoadCommon () // for that. for (i = 0; SaveComment != NULL && SaveComment[i].Width >= 0 && i < 6; ++i) { - screen->DrawText (CR_GOLD, commentLeft, commentTop + screen->DrawText (SmallFont, CR_GOLD, commentLeft, commentTop + SmallFont->GetHeight()*i*CleanYfac, SaveComment[i].Text, DTA_CleanNoMove, true, TAG_DONE); } @@ -1154,7 +1149,7 @@ static void M_DrawSaveLoadCommon () const char * text = GStrings("MNU_NOFILES"); const int textlen = SmallFont->StringWidth (text)*CleanXfac; - screen->DrawText (CR_GOLD, listboxLeft+(listboxWidth-textlen)/2, + screen->DrawText (SmallFont, CR_GOLD, listboxLeft+(listboxWidth-textlen)/2, listboxTop+(listboxHeight-rowHeight)/2, text, DTA_CleanNoMove, true, TAG_DONE); return; @@ -1189,17 +1184,16 @@ static void M_DrawSaveLoadCommon () didSeeSelected = true; if (!genStringEnter) { - screen->DrawText ( - color, listboxLeft+1, - listboxTop+rowHeight*i+CleanYfac, node->Title, + screen->DrawText (SmallFont, color, + listboxLeft+1, listboxTop+rowHeight*i+CleanYfac, node->Title, DTA_CleanNoMove, true, TAG_DONE); } else { - screen->DrawText (CR_WHITE, listboxLeft+1, - listboxTop+rowHeight*i+CleanYfac, savegamestring, + screen->DrawText (SmallFont, CR_WHITE, + listboxLeft+1, listboxTop+rowHeight*i+CleanYfac, savegamestring, DTA_CleanNoMove, true, TAG_DONE); - screen->DrawText (CR_WHITE, + screen->DrawText (SmallFont, CR_WHITE, listboxLeft+1+SmallFont->StringWidth (savegamestring)*CleanXfac, listboxTop+rowHeight*i+CleanYfac, underscore, DTA_CleanNoMove, true, TAG_DONE); @@ -1207,9 +1201,8 @@ static void M_DrawSaveLoadCommon () } else { - screen->DrawText ( - color, listboxLeft+1, - listboxTop+rowHeight*i+CleanYfac, node->Title, + screen->DrawText (SmallFont, color, + listboxLeft+1, listboxTop+rowHeight*i+CleanYfac, node->Title, DTA_CleanNoMove, true, TAG_DONE); } } @@ -1306,12 +1299,11 @@ void M_DrawSave() } else { - const char * text = GStrings("MNU_SAVEGAME"); - screen->DrawText (CR_UNTRANSLATED, + const char *text = GStrings("MNU_SAVEGAME"); + screen->DrawText (BigFont, CR_UNTRANSLATED, (SCREENWIDTH - BigFont->StringWidth (text)*CleanXfac)/2, 10*CleanYfac, text, DTA_CleanNoMove, true, TAG_DONE); } - screen->SetFont (SmallFont); M_DrawSaveLoadCommon (); } @@ -1681,8 +1673,8 @@ static void DrawClassMenu(void) "M_MWALK%d" }; - const char * text = GStrings("MNU_CHOOSECLASS"); - screen->DrawText (CR_UNTRANSLATED, 34, 24, text, DTA_Clean, true, TAG_DONE); + const char *text = GStrings("MNU_CHOOSECLASS"); + screen->DrawText (BigFont, CR_UNTRANSLATED, 34, 24, text, DTA_Clean, true, TAG_DONE); classnum = itemOn; if (classnum > 2) { @@ -1703,7 +1695,7 @@ static void M_DrawClassMenu () if (ClassMenuDef.numitems > 4 && gameinfo.gametype & GAME_Raven) tit_y = 2; - screen->DrawText (gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, + screen->DrawText (BigFont, gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, 160 - BigFont->StringWidth (text)/2, tit_y, text, DTA_Clean, true, TAG_DONE); @@ -1753,7 +1745,7 @@ static void M_DrawClassMenu () static void DrawHexenSkillMenu() { - screen->DrawText (CR_UNTRANSLATED, 74, 16, GStrings("MNU_CHOOSESKILL"), DTA_Clean, true, TAG_DONE); + screen->DrawText (BigFont, CR_UNTRANSLATED, 74, 16, GStrings("MNU_CHOOSESKILL"), DTA_Clean, true, TAG_DONE); } @@ -2141,31 +2133,30 @@ static void M_PlayerSetupDrawer () } // Draw title - const char * text = GStrings("MNU_PLAYERSETUP"); - screen->DrawText (gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, + const char *text = GStrings("MNU_PLAYERSETUP"); + screen->DrawText (BigFont, gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, 160 - BigFont->StringWidth (text)/2, 15, text, DTA_Clean, true, TAG_DONE); - screen->SetFont (SmallFont); // Draw player name box - screen->DrawText (label, PSetupDef.x, PSetupDef.y+yo, "Name", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y+yo, "Name", DTA_Clean, true, TAG_DONE); M_DrawSaveLoadBorder (PSetupDef.x + 56, PSetupDef.y, MAXPLAYERNAME+1); - screen->DrawText (CR_UNTRANSLATED, PSetupDef.x + 56 + xo, PSetupDef.y+yo, savegamestring, + screen->DrawText (SmallFont, CR_UNTRANSLATED, PSetupDef.x + 56 + xo, PSetupDef.y+yo, savegamestring, DTA_Clean, true, TAG_DONE); // Draw cursor for player name box if (genStringEnter) - screen->DrawText (CR_UNTRANSLATED, + screen->DrawText (SmallFont, CR_UNTRANSLATED, PSetupDef.x + SmallFont->StringWidth(savegamestring) + 56+xo, PSetupDef.y + yo, underscore, DTA_Clean, true, TAG_DONE); // Draw player team setting x = SmallFont->StringWidth ("Team") + 8 + PSetupDef.x; - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT+yo, "Team", + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT+yo, "Team", DTA_Clean, true, TAG_DONE); - screen->DrawText (value, x, PSetupDef.y + LINEHEIGHT+yo, + screen->DrawText (SmallFont, value, x, PSetupDef.y + LINEHEIGHT+yo, !TEAMINFO_IsValidTeam (players[consoleplayer].userinfo.team) ? "None" : teams[players[consoleplayer].userinfo.team].name, DTA_Clean, true, TAG_DONE); @@ -2231,12 +2222,12 @@ static void M_PlayerSetupDrawer () } const char *str = "PRESS " TEXTCOLOR_WHITE "SPACE"; - screen->DrawText (CR_GOLD, 320 - 52 - 32 - + screen->DrawText (SmallFont, CR_GOLD, 320 - 52 - 32 - SmallFont->StringWidth (str)/2, PSetupDef.y + LINEHEIGHT*3 + 76, str, DTA_Clean, true, TAG_DONE); str = PlayerRotation ? "TO SEE FRONT" : "TO SEE BACK"; - screen->DrawText (CR_GOLD, 320 - 52 - 32 - + screen->DrawText (SmallFont, CR_GOLD, 320 - 52 - 32 - SmallFont->StringWidth (str)/2, PSetupDef.y + LINEHEIGHT*3 + 76 + SmallFont->GetHeight (), str, DTA_Clean, true, TAG_DONE); @@ -2245,9 +2236,9 @@ static void M_PlayerSetupDrawer () // Draw player color sliders //V_DrawTextCleanMove (CR_GREY, PSetupDef.x, PSetupDef.y + LINEHEIGHT, "Color"); - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*2+yo, "Red", DTA_Clean, true, TAG_DONE); - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*3+yo, "Green", DTA_Clean, true, TAG_DONE); - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*4+yo, "Blue", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*2+yo, "Red", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*3+yo, "Green", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*4+yo, "Blue", DTA_Clean, true, TAG_DONE); x = SmallFont->StringWidth ("Green") + 8 + PSetupDef.x; color = players[consoleplayer].userinfo.color; @@ -2259,35 +2250,35 @@ static void M_PlayerSetupDrawer () // [GRB] Draw class setting int pclass = players[consoleplayer].userinfo.PlayerClass; x = SmallFont->StringWidth ("Class") + 8 + PSetupDef.x; - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*5+yo, "Class", DTA_Clean, true, TAG_DONE); - screen->DrawText (value, x, PSetupDef.y + LINEHEIGHT*5+yo, + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*5+yo, "Class", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, value, x, PSetupDef.y + LINEHEIGHT*5+yo, pclass == -1 ? "Random" : PlayerClasses[pclass].Type->Meta.GetMetaString (APMETA_DisplayName), DTA_Clean, true, TAG_DONE); // Draw skin setting x = SmallFont->StringWidth ("Skin") + 8 + PSetupDef.x; - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*6+yo, "Skin", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*6+yo, "Skin", DTA_Clean, true, TAG_DONE); if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN || players[consoleplayer].userinfo.PlayerClass == -1) { - screen->DrawText (value, x, PSetupDef.y + LINEHEIGHT*6+yo, "Base", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, value, x, PSetupDef.y + LINEHEIGHT*6+yo, "Base", DTA_Clean, true, TAG_DONE); } else { - screen->DrawText (value, x, PSetupDef.y + LINEHEIGHT*6+yo, + screen->DrawText (SmallFont, value, x, PSetupDef.y + LINEHEIGHT*6+yo, skins[PlayerSkin].name, DTA_Clean, true, TAG_DONE); } // Draw gender setting x = SmallFont->StringWidth ("Gender") + 8 + PSetupDef.x; - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*7+yo, "Gender", DTA_Clean, true, TAG_DONE); - screen->DrawText (value, x, PSetupDef.y + LINEHEIGHT*7+yo, + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*7+yo, "Gender", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, value, x, PSetupDef.y + LINEHEIGHT*7+yo, genders[players[consoleplayer].userinfo.gender], DTA_Clean, true, TAG_DONE); // Draw autoaim setting x = SmallFont->StringWidth ("Autoaim") + 8 + PSetupDef.x; - screen->DrawText (label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*8+yo, "Autoaim", DTA_Clean, true, TAG_DONE); - screen->DrawText (value, x, PSetupDef.y + LINEHEIGHT*8+yo, + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*8+yo, "Autoaim", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, value, x, PSetupDef.y + LINEHEIGHT*8+yo, autoaim == 0 ? "Never" : autoaim <= 0.25 ? "Very Low" : autoaim <= 0.5 ? "Low" : @@ -2762,10 +2753,10 @@ void M_StartMessage (const char *string, void (*routine)(int), bool input) // // Find string height from hu_font chars // -int M_StringHeight (const char *string) +int M_StringHeight (FFont *font, const char *string) { int h; - int height = screen->Font->GetHeight (); + int height = font->GetHeight (); h = height; while (*string) @@ -3036,7 +3027,7 @@ bool M_SaveLoadResponder (event_t *ev) { V_FreeBrokenLines (SaveComment); } - SaveComment = V_BreakLines (screen->Font, 216*screen->GetWidth()/640/CleanXfac, workbuf); + SaveComment = V_BreakLines (SmallFont, 216*screen->GetWidth()/640/CleanXfac, workbuf); } break; @@ -3218,17 +3209,17 @@ void M_Drawer () BorderNeedRefresh = screen->GetPageCount (); SB_state = screen->GetPageCount (); - FBrokenLines *lines = V_BreakLines (screen->Font, 320, messageString); + FBrokenLines *lines = V_BreakLines (SmallFont, 320, messageString); y = 100; for (i = 0; lines[i].Width >= 0; i++) - y -= screen->Font->GetHeight () / 2; + y -= SmallFont->GetHeight () / 2; for (i = 0; lines[i].Width >= 0; i++) { - screen->DrawText (CR_UNTRANSLATED, 160 - lines[i].Width/2, y, lines[i].Text, + screen->DrawText (SmallFont, CR_UNTRANSLATED, 160 - lines[i].Width/2, y, lines[i].Text, DTA_Clean, true, TAG_DONE); - y += screen->Font->GetHeight (); + y += SmallFont->GetHeight (); } V_FreeBrokenLines (lines); @@ -3242,8 +3233,8 @@ void M_Drawer () // For Heretic shareware message: if (showSharewareMessage) { - const char * text = GStrings("MNU_ONLYREGISTERED"); - screen->DrawText (CR_WHITE, 160 - SmallFont->StringWidth(text)/2, + const char *text = GStrings("MNU_ONLYREGISTERED"); + screen->DrawText (SmallFont, CR_WHITE, 160 - SmallFont->StringWidth(text)/2, 8, text, DTA_Clean, true, TAG_DONE); } @@ -3256,7 +3247,6 @@ void M_Drawer () } else { - screen->SetFont (BigFont); if (currentMenu->routine) currentMenu->routine(); // call Draw routine @@ -3282,7 +3272,7 @@ void M_Drawer () } const char *text = currentMenu->menuitems[i].name; if (*text == '$') text = GStrings(text+1); - screen->DrawText (color, x, y, text, + screen->DrawText (BigFont, color, x, y, text, DTA_Clean, true, TAG_DONE); } else @@ -3293,7 +3283,6 @@ void M_Drawer () } y += LINEHEIGHT; } - screen->SetFont (SmallFont); // DRAW CURSOR if (drawSkull) @@ -3303,12 +3292,10 @@ void M_Drawer () // [RH] Use options menu cursor for the player setup menu. if (skullAnimCounter < 6) { - screen->SetFont (ConFont); - screen->DrawText (CR_RED, x - 16, + screen->DrawText (ConFont, CR_RED, x - 16, currentMenu->y + itemOn*LINEHEIGHT + (!(gameinfo.gametype & (GAME_DoomStrifeChex)) ? 6 : -1), "\xd", DTA_Clean, true, TAG_DONE); - screen->SetFont (SmallFont); } } else if (gameinfo.gametype & GAME_DoomChex) diff --git a/src/m_options.cpp b/src/m_options.cpp index e7bb69b4b4..404dc9543b 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1482,14 +1482,12 @@ static void M_DrawConText (int color, int x, int y, const char *str) { int len = (int)strlen(str); - screen->SetFont (ConFont); x = (x - 160) * CleanXfac + screen->GetWidth() / 2; y = (y - 100) * CleanYfac + screen->GetHeight() / 2; - screen->DrawText (color, x, y, str, + screen->DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac, TAG_DONE); - screen->SetFont (SmallFont); } void M_BuildKeyList (menuitem_t *item, int numitems) @@ -1660,11 +1658,9 @@ void M_OptDrawer () { if (BigFont && CurrentMenu->texttitle) { - screen->SetFont (BigFont); - screen->DrawText (gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, + screen->DrawText (BigFont, gameinfo.gametype & GAME_DoomChex ? CR_RED : CR_UNTRANSLATED, 160-BigFont->StringWidth (CurrentMenu->texttitle)/2, 10, CurrentMenu->texttitle, DTA_Clean, true, TAG_DONE); - screen->SetFont (SmallFont); y = 15 + BigFont->GetHeight (); } else @@ -1746,7 +1742,7 @@ void M_OptDrawer () ? CR_YELLOW : LabelColor; break; } - screen->DrawText (color, x, y, item->label, DTA_Clean, true, DTA_ColorOverlay, overlay, TAG_DONE); + screen->DrawText (SmallFont, color, x, y, item->label, DTA_Clean, true, DTA_ColorOverlay, overlay, TAG_DONE); switch (item->type) { @@ -1757,7 +1753,7 @@ void M_OptDrawer () mysnprintf (tbuf, countof(tbuf), "%d.", item->b.position); x = CurrentMenu->indent - SmallFont->StringWidth (tbuf); - screen->DrawText (CR_GREY, x, y, tbuf, DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, CR_GREY, x, y, tbuf, DTA_Clean, true, TAG_DONE); } break; @@ -1773,12 +1769,12 @@ void M_OptDrawer () if (v == vals) { - screen->DrawText (ValueColor, CurrentMenu->indent + 14, y, "Unknown", + screen->DrawText (SmallFont, ValueColor, CurrentMenu->indent + 14, y, "Unknown", DTA_Clean, true, TAG_DONE); } else { - screen->DrawText (item->type == cdiscrete ? v : ValueColor, + screen->DrawText (SmallFont, item->type == cdiscrete ? v : ValueColor, CurrentMenu->indent + 14, y, item->e.values[v].name, DTA_Clean, true, TAG_DONE); } @@ -1822,12 +1818,12 @@ void M_OptDrawer () if (v == vals) { - screen->DrawText (ValueColor, CurrentMenu->indent + 14, y, "Unknown", + screen->DrawText (SmallFont, ValueColor, CurrentMenu->indent + 14, y, "Unknown", DTA_Clean, true, DTA_ColorOverlay, overlay, TAG_DONE); } else { - screen->DrawText (item->type == cdiscrete ? v : ValueColor, + screen->DrawText (SmallFont, item->type == cdiscrete ? v : ValueColor, CurrentMenu->indent + 14, y, item->type != discretes ? item->e.values[v].name : item->e.valuestrings[v].name.GetChars(), DTA_Clean, true, DTA_ColorOverlay, overlay, TAG_DONE); @@ -1842,7 +1838,7 @@ void M_OptDrawer () value = item->a.cvar->GetGenericRep (CVAR_String); v = M_FindCurVal(value.String, item->e.enumvalues, (int)item->b.numvalues); - screen->DrawText(ValueColor, CurrentMenu->indent + 14, y, v, DTA_Clean, true, TAG_DONE); + screen->DrawText(SmallFont, ValueColor, CurrentMenu->indent + 14, y, v, DTA_Clean, true, TAG_DONE); } break; @@ -1856,11 +1852,11 @@ void M_OptDrawer () if (v == vals) { UCVarValue val = item->a.guidcvar->GetGenericRep (CVAR_String); - screen->DrawText (ValueColor, CurrentMenu->indent + 14, y, val.String, DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, ValueColor, CurrentMenu->indent + 14, y, val.String, DTA_Clean, true, TAG_DONE); } else { - screen->DrawText (ValueColor, CurrentMenu->indent + 14, y, item->e.guidvalues[v].Name, + screen->DrawText (SmallFont, ValueColor, CurrentMenu->indent + 14, y, item->e.guidvalues[v].Name, DTA_Clean, true, TAG_DONE); } @@ -1868,7 +1864,7 @@ void M_OptDrawer () break; case nochoice: - screen->DrawText (CR_GOLD, CurrentMenu->indent + 14, y, + screen->DrawText (SmallFont, CR_GOLD, CurrentMenu->indent + 14, y, (item->e.values[(int)item->b.min]).name, DTA_Clean, true, TAG_DONE); break; @@ -1897,7 +1893,7 @@ void M_OptDrawer () } else { - screen->DrawText(CR_BLACK, CurrentMenu->indent + 14, y + labelofs, "---", + screen->DrawText(SmallFont, CR_BLACK, CurrentMenu->indent + 14, y + labelofs, "---", DTA_Clean, true, TAG_DONE); } } @@ -1976,7 +1972,7 @@ void M_OptDrawer () str = "???"; } - screen->DrawText (ValueColor, + screen->DrawText (SmallFont, ValueColor, CurrentMenu->indent + 14, y, str, DTA_Clean, true, TAG_DONE); } break; @@ -2011,7 +2007,7 @@ void M_OptDrawer () else color = CR_BRICK; //LabelColor; - screen->DrawText (color, 104 * x + 20, y, str, DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, color, 104 * x + 20, y, str, DTA_Clean, true, TAG_DONE); } } @@ -2054,7 +2050,7 @@ void M_OptDrawer () fillptr += mysnprintf (fillptr, countof(flagsblah) - (fillptr - flagsblah), "%s = %d", vars[i]->GetName (), **vars[i]); } } - screen->DrawText (ValueColor, + screen->DrawText (SmallFont, ValueColor, 160 - (SmallFont->StringWidth (flagsblah) >> 1), 0, flagsblah, DTA_Clean, true, TAG_DONE); } @@ -2831,9 +2827,9 @@ static void ColorPickerDrawer () screen->Clear (x + 48*CleanXfac, y, x + 48*2*CleanXfac, y + 48*CleanYfac, -1, newColor); y += 49*CleanYfac; - screen->DrawText (CR_GRAY, x+(24-SmallFont->StringWidth("Old")/2)*CleanXfac, y, + screen->DrawText (SmallFont, CR_GRAY, x+(24-SmallFont->StringWidth("Old")/2)*CleanXfac, y, "Old", DTA_CleanNoMove, true, TAG_DONE); - screen->DrawText (CR_WHITE, x+(48+24-SmallFont->StringWidth("New")/2)*CleanXfac, y, + screen->DrawText (SmallFont, CR_WHITE, x+(48+24-SmallFont->StringWidth("New")/2)*CleanXfac, y, "New", DTA_CleanNoMove, true, TAG_DONE); } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index c5854282b0..385f174a30 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -2154,10 +2154,6 @@ void DLevelScript::DoSetFont (int fontnum) { activefont = SmallFont; } - if (screen != NULL) - { - screen->SetFont (activefont); - } } #define APROP_Health 0 @@ -2536,11 +2532,6 @@ int DLevelScript::RunScript () int optstart = -1; int temp; - if (screen != NULL) - { - screen->SetFont (activefont); - } - while (state == SCRIPT_Running) { if (++runaway > 500000) @@ -4009,7 +4000,7 @@ int DLevelScript::RunScript () if (pcd == PCD_ENDPRINTBOLD || screen == NULL || screen->CheckLocalView (consoleplayer)) { - C_MidPrint (work); + C_MidPrint (activefont, work); } } else @@ -4060,26 +4051,26 @@ int DLevelScript::RunScript () switch (type & 0xFFFF) { default: // normal - msg = new DHUDMessage (work, x, y, hudwidth, hudheight, color, holdTime); + msg = new DHUDMessage (activefont, work, x, y, hudwidth, hudheight, color, holdTime); break; case 1: // fade out { float fadeTime = (optstart < sp) ? FIXED2FLOAT(Stack[optstart]) : 0.5f; - msg = new DHUDMessageFadeOut (work, x, y, hudwidth, hudheight, color, holdTime, fadeTime); + msg = new DHUDMessageFadeOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, fadeTime); } break; case 2: // type on, then fade out { float typeTime = (optstart < sp) ? FIXED2FLOAT(Stack[optstart]) : 0.05f; float fadeTime = (optstart < sp-1) ? FIXED2FLOAT(Stack[optstart+1]) : 0.5f; - msg = new DHUDMessageTypeOnFadeOut (work, x, y, hudwidth, hudheight, color, typeTime, holdTime, fadeTime); + msg = new DHUDMessageTypeOnFadeOut (activefont, work, x, y, hudwidth, hudheight, color, typeTime, holdTime, fadeTime); } break; case 3: // fade in, then fade out { float inTime = (optstart < sp) ? FIXED2FLOAT(Stack[optstart]) : 0.5f; float outTime = (optstart < sp-1) ? FIXED2FLOAT(Stack[optstart+1]) : 0.5f; - msg = new DHUDMessageFadeInOut (work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime); + msg = new DHUDMessageFadeInOut (activefont, work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime); } break; } @@ -5582,10 +5573,6 @@ int DLevelScript::RunScript () this->pc = pc; assert (sp == 0); } - if (screen != NULL) - { - screen->SetFont (SmallFont); - } return resultValue; } diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 444601a2a7..bcbb0b4214 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -740,7 +740,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang toSay = GStrings[dlgtext.GetChars()]; if (toSay==NULL) toSay = "Go away!"; // Ok, it's lame - but it doesn't look like an error to the player. ;) } - DialogueLines = V_BreakLines (screen->Font, screen->GetWidth()/CleanXfac-24*2, toSay); + DialogueLines = V_BreakLines (SmallFont, screen->GetWidth()/CleanXfac-24*2, toSay); // Fill out the possible choices ShowGold = false; @@ -753,7 +753,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang continue; } ShowGold |= reply->NeedsGold; - reply->ReplyLines = V_BreakLines (screen->Font, 320-50-10, reply->Reply); + reply->ReplyLines = V_BreakLines (SmallFont, 320-50-10, reply->Reply); for (j = 0; reply->ReplyLines[j].Width >= 0; ++j) { item.label = reply->ReplyLines[j].Text.LockBuffer(); @@ -895,14 +895,14 @@ static void DrawConversationMenu () if (speakerName != NULL) { - screen->DrawText (CR_WHITE, x, y, speakerName, + screen->DrawText (SmallFont, CR_WHITE, x, y, speakerName, DTA_CleanNoMove, true, TAG_DONE); y += linesize * 3 / 2; } x = 24 * screen->GetWidth() / 320; for (i = 0; DialogueLines[i].Width >= 0; ++i) { - screen->DrawText (CR_UNTRANSLATED, x, y, DialogueLines[i].Text, + screen->DrawText (SmallFont, CR_UNTRANSLATED, x, y, DialogueLines[i].Text, DTA_CleanNoMove, true, TAG_DONE); y += linesize; } @@ -913,12 +913,12 @@ static void DrawConversationMenu () char goldstr[32]; mysnprintf (goldstr, countof(goldstr), "%d", coin != NULL ? coin->Amount : 0); - screen->DrawText (CR_GRAY, 21, 191, goldstr, DTA_320x200, true, + screen->DrawText (SmallFont, CR_GRAY, 21, 191, goldstr, DTA_320x200, true, DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE); screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon), 3, 190, DTA_320x200, true, DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE); - screen->DrawText (CR_GRAY, 20, 190, goldstr, DTA_320x200, true, TAG_DONE); + screen->DrawText (SmallFont, CR_GRAY, 20, 190, goldstr, DTA_320x200, true, TAG_DONE); screen->DrawTexture (TexMan(((AInventory *)GetDefaultByType (RUNTIME_CLASS(ACoin)))->Icon), 2, 189, DTA_320x200, true, TAG_DONE); } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index e8420b2c2e..6d3767ce3e 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -452,7 +452,7 @@ void AActor::Die (AActor *source, AActor *inflictor) SexMessage (GStrings("SPREEKILLSELF"), buff, player->userinfo.gender, player->userinfo.netname, player->userinfo.netname); - StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, + StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } @@ -500,7 +500,7 @@ void AActor::Die (AActor *source, AActor *inflictor) { SexMessage (GStrings("SPREEOVER"), buff, player->userinfo.gender, player->userinfo.netname, source->player->userinfo.netname); - StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, + StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } @@ -510,7 +510,7 @@ void AActor::Die (AActor *source, AActor *inflictor) { SexMessage (spreemsg, buff, player->userinfo.gender, player->userinfo.netname, source->player->userinfo.netname); - StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, + StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R')); } } @@ -558,7 +558,7 @@ void AActor::Die (AActor *source, AActor *inflictor) { SexMessage (multimsg, buff, player->userinfo.gender, player->userinfo.netname, source->player->userinfo.netname); - StatusBar->AttachMessage (new DHUDMessageFadeOut (buff, + StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, buff, 1.5f, 0.8f, 0, 0, CR_RED, 3.f, 0.5f), MAKE_ID('M','K','I','L')); } } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index bf3cdd14da..f7bd83635f 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3244,7 +3244,7 @@ void P_SetupLevel (char *lumpname, int position) AActor::ClearTIDHashes (); // [RH] clear out the mid-screen message - C_MidPrint (NULL); + C_MidPrint (NULL, NULL); // Free all level data from the previous map P_FreeLevelData (); diff --git a/src/p_spec.cpp b/src/p_spec.cpp index e6b73f6690..252d4aae25 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -58,6 +58,7 @@ #include "gi.h" #include "statnums.h" #include "g_level.h" +#include "v_font.h" // State. #include "r_state.h" @@ -544,7 +545,7 @@ void P_PlayerInSpecialSector (player_t *player) sector->special &= ~SECRET_MASK; if (player->mo->CheckLocalView (consoleplayer)) { - C_MidPrint (secretmessage); + C_MidPrint (SmallFont, secretmessage); S_Sound (CHAN_AUTO, "misc/secret", 1, ATTN_NORM); } } diff --git a/src/r_polymost.cpp b/src/r_polymost.cpp index e143b98bd0..57a315391b 100644 --- a/src/r_polymost.cpp +++ b/src/r_polymost.cpp @@ -670,7 +670,7 @@ void drawquad(float x0, float y0, float x1, float y1, float x2, float y2, float void printnum(int x, int y, int num) { char foo[16]; mysnprintf (foo, countof(foo), "%d", num); - RenderTarget->DrawText (CR_WHITE, x, y, foo); + RenderTarget->DrawText (SmallFont, CR_WHITE, x, y, foo); } void drawpolymosttest() diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 8147d3d3f2..c85ba0ff8f 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -151,17 +151,17 @@ void S_NoiseDebug (void) int y, color; y = 32 * CleanYfac; - screen->DrawText (CR_YELLOW, 0, y, "*** SOUND DEBUG INFO ***", TAG_DONE); + screen->DrawText (SmallFont, CR_YELLOW, 0, y, "*** SOUND DEBUG INFO ***", TAG_DONE); y += 8; - screen->DrawText (CR_GOLD, 0, y, "name", TAG_DONE); - screen->DrawText (CR_GOLD, 70, y, "x", TAG_DONE); - screen->DrawText (CR_GOLD, 120, y, "y", TAG_DONE); - screen->DrawText (CR_GOLD, 170, y, "z", TAG_DONE); - screen->DrawText (CR_GOLD, 220, y, "vol", TAG_DONE); - screen->DrawText (CR_GOLD, 260, y, "dist", TAG_DONE); - screen->DrawText (CR_GOLD, 300, y, "chan", TAG_DONE); - screen->DrawText (CR_GOLD, 340, y, "flags", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 0, y, "name", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 70, y, "x", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 120, y, "y", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 170, y, "z", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 220, y, "vol", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 260, y, "dist", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 300, y, "chan", TAG_DONE); + screen->DrawText (SmallFont, CR_GOLD, 340, y, "flags", TAG_DONE); y += 8; if (Channels == NULL) @@ -186,51 +186,51 @@ void S_NoiseDebug (void) // Name Wads.GetLumpName (temp, chan->SfxInfo->lumpnum); temp[8] = 0; - screen->DrawText (color, 0, y, temp, TAG_DONE); + screen->DrawText (SmallFont, color, 0, y, temp, TAG_DONE); if (!(chan->ChanFlags & CHAN_IS3D)) { - screen->DrawText(color, 70, y, "---", TAG_DONE); // X - screen->DrawText(color, 120, y, "---", TAG_DONE); // Y - screen->DrawText(color, 170, y, "---", TAG_DONE); // Z - screen->DrawText(color, 260, y, "---", TAG_DONE); // Distance + screen->DrawText(SmallFont, color, 70, y, "---", TAG_DONE); // X + screen->DrawText(SmallFont, color, 120, y, "---", TAG_DONE); // Y + screen->DrawText(SmallFont, color, 170, y, "---", TAG_DONE); // Z + screen->DrawText(SmallFont, color, 260, y, "---", TAG_DONE); // Distance } else { // X coordinate - mysnprintf (temp, countof(temp), "%.0f", origin.X); - screen->DrawText (color, 70, y, temp, TAG_DONE); + mysnprintf(temp, countof(temp), "%.0f", origin.X); + screen->DrawText(SmallFont, color, 70, y, temp, TAG_DONE); // Y coordinate - mysnprintf (temp, countof(temp), "%.0f", origin.Z); - screen->DrawText (color, 120, y, temp, TAG_DONE); + mysnprintf(temp, countof(temp), "%.0f", origin.Z); + screen->DrawText(SmallFont, color, 120, y, temp, TAG_DONE); // Z coordinate - mysnprintf (temp, countof(temp), "%.0f", origin.Y); - screen->DrawText (color, 170, y, temp, TAG_DONE); + mysnprintf(temp, countof(temp), "%.0f", origin.Y); + screen->DrawText(SmallFont, color, 170, y, temp, TAG_DONE); // Distance if (chan->DistanceScale > 0) { - mysnprintf (temp, countof(temp), "%.0f", (origin - listener).Length()); - screen->DrawText (color, 260, y, temp, TAG_DONE); + mysnprintf(temp, countof(temp), "%.0f", (origin - listener).Length()); + screen->DrawText(SmallFont, color, 260, y, temp, TAG_DONE); } else { - screen->DrawText (color, 260, y, "---", TAG_DONE); + screen->DrawText(SmallFont, color, 260, y, "---", TAG_DONE); } } // Volume - mysnprintf (temp, countof(temp), "%.2g", chan->Volume); - screen->DrawText (color, 220, y, temp, TAG_DONE); + mysnprintf(temp, countof(temp), "%.2g", chan->Volume); + screen->DrawText(SmallFont, color, 220, y, temp, TAG_DONE); // Channel - mysnprintf (temp, countof(temp), "%d", chan->EntChannel); - screen->DrawText (color, 300, y, temp, TAG_DONE); + mysnprintf(temp, countof(temp), "%d", chan->EntChannel); + screen->DrawText(SmallFont, color, 300, y, temp, TAG_DONE); // Flags - mysnprintf (temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE", + mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE", (chan->ChanFlags & CHAN_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_UI) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, @@ -239,7 +239,7 @@ void S_NoiseDebug (void) (chan->ChanFlags & CHAN_AREA) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK); - screen->DrawText (color, 340, y, temp, TAG_DONE); + screen->DrawText(SmallFont, color, 340, y, temp, TAG_DONE); y += 8; if (chan->PrevChan == &Channels) diff --git a/src/stats.cpp b/src/stats.cpp index 3698295949..dba058caa6 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -94,7 +94,6 @@ void FStat::PrintStat () int y = SCREENHEIGHT; int count = 0; - screen->SetFont (ConFont); for (FStat *stat = FirstStat; stat != NULL; stat = stat->m_Next) { if (stat->m_Active) @@ -104,17 +103,16 @@ void FStat::PrintStat () if (stattext.Len() > 0) { y -= fontheight; // there's at least one line of text - for(unsigned i = 0; i < stattext.Len()-1; i++) + for (unsigned i = 0; i < stattext.Len()-1; i++) { // Count number of linefeeds but ignore terminating ones. if (stattext[i] == '\n') y -= fontheight; } - screen->DrawText (CR_GREEN, 5, y, stattext, TAG_DONE); + screen->DrawText(ConFont, CR_GREEN, 5, y, stattext, TAG_DONE); count++; } } } - screen->SetFont (SmallFont); if (count) { SB_state = screen->GetPageCount (); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 1f3151e082..82b9e8c8ec 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1556,22 +1556,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) if (self->CheckLocalView (consoleplayer) || (self->target!=NULL && self->target->CheckLocalView (consoleplayer))) { - FFont * oldfont = screen->Font; float saved = con_midtime; - + FFont *font = NULL; if (fontname != NAME_None) { - FFont * font = V_GetFont(fontname); - if (font != NULL) screen->SetFont(font); + font = V_GetFont(fontname); } if (time > 0) { con_midtime = time; } - C_MidPrint(text); - screen->SetFont(oldfont); + C_MidPrint(font != NULL ? font : SmallFont, text); con_midtime = saved; } } diff --git a/src/v_font.cpp b/src/v_font.cpp index 2388e025d6..308c0eddbe 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -62,7 +62,7 @@ The FON2 header is followed by variable length data: ubyte Palette[PaletteSize+1][3]; -- The last entry is the delimiter color. The delimiter is not used - -- by the font but is used my imagetool when converting the font + -- by the font but is used by imagetool when converting the font -- back to an image. Color 0 is the transparent color and is also -- used only for converting the font back to an image. The other -- entries are all presorted in increasing order of brightness. @@ -146,6 +146,13 @@ protected: FTextureID PicNum; }; +// Essentially a normal multilump font but with an explicit list of character patches +class FSpecialFont : public FFont +{ +public: + FSpecialFont (const char *name, int first, int count, int *lumplist, const bool *notranslate); +}; + // This is a font character that loads a texture and recolors it. class FFontChar1 : public FTexture { @@ -1503,18 +1510,6 @@ void FFontChar2::MakeTexture () } } -//=========================================================================== -// -// Essentially a normal multilump font but -// with an explicit list of character patches -// -//=========================================================================== -class FSpecialFont : public FFont -{ -public: - FSpecialFont (const char *name, int first, int count, int *lumplist, const bool *notranslate); -}; - //========================================================================== // // FSpecialFont :: FSpecialFont @@ -1723,7 +1718,7 @@ void V_InitCustomFonts() if (sc.Number >= 0 && sc.Number < 256) notranslate[sc.Number] = true; } - format=2; + format = 2; } else { @@ -1756,7 +1751,7 @@ void V_InitCustomFonts() break; } } - if (count>0) + if (count > 0) { new FSpecialFont (namebuffer, first, count, &lumplist[first], notranslate); } @@ -2116,7 +2111,7 @@ void V_InitFonts() SmallFont = new FFont ("SmallFont", "STCFN%.3d", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART); } } - if (!(SmallFont2=FFont::FindFont("SmallFont2"))) + if (!(SmallFont2 = FFont::FindFont("SmallFont2"))) { if (Wads.CheckNumForName ("STBFN033", ns_graphics) >= 0) { @@ -2127,7 +2122,7 @@ void V_InitFonts() SmallFont2 = SmallFont; } } - if (!(BigFont=FFont::FindFont("BigFont"))) + if (!(BigFont = FFont::FindFont("BigFont"))) { if (gameinfo.gametype & GAME_DoomChex) { @@ -2142,9 +2137,19 @@ void V_InitFonts() BigFont = new FFont ("BigFont", "FONTB%02u", HU_FONTSTART, HU_FONTSIZE, 1); } } - if (!(ConFont=FFont::FindFont("ConsoleFont"))) + if (!(ConFont = FFont::FindFont("ConsoleFont"))) { ConFont = new FSingleLumpFont ("ConsoleFont", Wads.GetNumForName ("CONFONT")); } + if (!(IntermissionFont = FFont::FindFont("IntermissionFont"))) + { + if (gameinfo.gametype & GAME_DoomChex) + { + IntermissionFont = FFont::FindFont("IntermissionFont_Doom"); + } + if (IntermissionFont == NULL) + { + IntermissionFont = BigFont; + } + } } - diff --git a/src/v_font.h b/src/v_font.h index 14cf1391ef..e4b917f97f 100644 --- a/src/v_font.h +++ b/src/v_font.h @@ -66,6 +66,7 @@ enum EColorRange CR_DARKBROWN, CR_PURPLE, CR_DARKGRAY, + CR_CYAN, NUM_TEXT_COLORS }; @@ -126,7 +127,7 @@ protected: }; -extern FFont *SmallFont, *SmallFont2, *BigFont, *ConFont; +extern FFont *SmallFont, *SmallFont2, *BigFont, *ConFont, *IntermissionFont; void V_InitFonts(); EColorRange V_FindFontColor (FName name); diff --git a/src/v_text.cpp b/src/v_text.cpp index 5d24b9b422..7813494f50 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -48,18 +48,13 @@ #include "templates.h" // -// SetFont +// DrawChar // -// Set the canvas's font +// Write a single character using the given font // -void DCanvas::SetFont (FFont *font) +void STACK_ARGS DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...) { - Font = font; -} - -void STACK_ARGS DCanvas::DrawChar (int normalcolor, int x, int y, BYTE character, ...) -{ - if (Font == NULL) + if (font == NULL) return; if (normalcolor >= NumTextColors) @@ -68,9 +63,9 @@ void STACK_ARGS DCanvas::DrawChar (int normalcolor, int x, int y, BYTE character FTexture *pic; int dummy; - if (NULL != (pic = Font->GetChar (character, &dummy))) + if (NULL != (pic = font->GetChar (character, &dummy))) { - const FRemapTable *range = Font->GetColorTranslation ((EColorRange)normalcolor); + const FRemapTable *range = font->GetColorTranslation ((EColorRange)normalcolor); va_list taglist; va_start (taglist, character); DrawTexture (pic, x, y, DTA_Translation, range, TAG_MORE, &taglist); @@ -81,9 +76,9 @@ void STACK_ARGS DCanvas::DrawChar (int normalcolor, int x, int y, BYTE character // // DrawText // -// Write a string using the current font +// Write a string using the given font // -void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *string, ...) +void STACK_ARGS DCanvas::DrawText (FFont *font, int normalcolor, int x, int y, const char *string, ...) { va_list tags; DWORD tag; @@ -103,16 +98,16 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st int kerning; FTexture *pic; - if (Font == NULL || string == NULL) + if (font == NULL || string == NULL) return; if (normalcolor >= NumTextColors) normalcolor = CR_UNTRANSLATED; boldcolor = normalcolor ? normalcolor - 1 : NumTextColors - 1; - range = Font->GetColorTranslation ((EColorRange)normalcolor); - height = Font->GetHeight () + 1; - kerning = Font->GetDefaultKerning (); + range = font->GetColorTranslation ((EColorRange)normalcolor); + height = font->GetHeight () + 1; + kerning = font->GetDefaultKerning (); ch = (const BYTE *)string; cx = x; @@ -214,7 +209,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st EColorRange newcolor = V_ParseFontColor (ch, normalcolor, boldcolor); if (newcolor != CR_UNDEFINED) { - range = Font->GetColorTranslation (newcolor); + range = font->GetColorTranslation (newcolor); } continue; } @@ -226,7 +221,7 @@ void STACK_ARGS DCanvas::DrawText (int normalcolor, int x, int y, const char *st continue; } - if (NULL != (pic = Font->GetChar (c, &w))) + if (NULL != (pic = font->GetChar (c, &w))) { va_list taglist; va_start (taglist, string); diff --git a/src/v_video.cpp b/src/v_video.cpp index 839381b421..60c65f9ab2 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -130,7 +130,7 @@ const FTexture::Span FPaletteTester::DummySpan[2] = { { 0, 16 }, { 0, 0 } }; int DisplayWidth, DisplayHeight, DisplayBits; -FFont *SmallFont, *SmallFont2, *BigFont, *ConFont; +FFont *SmallFont, *SmallFont2, *BigFont, *ConFont, *IntermissionFont; extern "C" { DWORD Col2RGB8[65][256]; @@ -206,7 +206,6 @@ DCanvas::DCanvas (int _width, int _height) { // Init member vars Buffer = NULL; - Font = NULL; LockCount = 0; Width = _width; Height = _height; @@ -823,9 +822,7 @@ void DFrameBuffer::DrawRateStuff () chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2u ms (%3u fps)", howlong, LastCount); rate_x = Width - chars * 8; Clear (rate_x, 0, Width, 8, 0, 0); - SetFont (ConFont); - DrawText (CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], TAG_DONE); - SetFont (SmallFont); + DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], TAG_DONE); DWORD thisSec = ms/1000; if (LastSec < thisSec) @@ -1254,7 +1251,6 @@ bool V_DoModeSetup (int width, int height, int bits) screen = buff; GC::WriteBarrier(screen); - screen->SetFont (SmallFont); screen->SetGamma (Gamma); // Load fonts now so they can be packed into textures straight away, @@ -1464,7 +1460,6 @@ void V_Init2() int width = screen->GetWidth(); int height = screen->GetHeight(); float gamma = static_cast(screen)->Gamma; - FFont *font = screen->Font; { DFrameBuffer *s = screen; @@ -1482,7 +1477,6 @@ void V_Init2() Printf ("Resolution: %d x %d\n", SCREENWIDTH, SCREENHEIGHT); screen->SetGamma (gamma); - if (font != NULL) screen->SetFont (font); FBaseCVar::ResetColors (); C_NewModeAdjust(); M_InitVideoModesMenu(); diff --git a/src/v_video.h b/src/v_video.h index 788b319020..2402ed7faf 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -128,8 +128,6 @@ class DCanvas : public DObject { DECLARE_ABSTRACT_CLASS (DCanvas, DObject) public: - FFont *Font; - DCanvas (int width, int height); virtual ~DCanvas (); @@ -187,8 +185,6 @@ public: // Text drawing functions ----------------------------------------------- - virtual void SetFont (FFont *font); - // 2D Texture drawing void STACK_ARGS DrawTexture (FTexture *img, int x, int y, int tags, ...); void FillBorder (FTexture *img); // Fills the border around a 4:3 part of the screen on non-4:3 displays @@ -196,8 +192,8 @@ public: void VirtualToRealCoordsInt(int &x, int &y, int &w, int &h, int vwidth, int vheight, bool vbottom=false, bool handleaspect=true) const; // 2D Text drawing - void STACK_ARGS DrawText (int normalcolor, int x, int y, const char *string, ...); - void STACK_ARGS DrawChar (int normalcolor, int x, int y, BYTE character, ...); + void STACK_ARGS DrawText (FFont *font, int normalcolor, int x, int y, const char *string, ...); + void STACK_ARGS DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, ...); protected: BYTE *Buffer; diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index cf49c684f1..91849fc1a2 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -46,6 +46,7 @@ #include "v_text.h" #include "gi.h" #include "r_translate.h" +#include "templates.h" // States for the intermission typedef enum @@ -210,11 +211,6 @@ static bool noautostartmap; static TArray yah; // You Are Here graphic static FTexture* splat; // splat -static FTexture* percent; // %, : graphics -static FTexture* colon; -static FTexture* slash; -static FTexture* num[10]; // 0-9 graphic -static FTexture* wiminus; // minus sign static FTexture* finished; // "Finished!" graphics static FTexture* entering; // "Entering" graphic static FTexture* sp_secret; // "secret" @@ -409,12 +405,12 @@ void WI_LoadBackground(bool isenterpic) { case 0: // Background sc.MustGetString(); - texture=TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch,FTextureManager::TEXMAN_TryAny); + texture = TexMan.CheckForTexture(sc.String, FTexture::TEX_MiscPatch, FTextureManager::TEXMAN_TryAny); break; case 1: // Splat sc.MustGetString(); - splat=TexMan[sc.String]; + splat = TexMan[sc.String]; break; case 2: // Pointers @@ -422,7 +418,8 @@ void WI_LoadBackground(bool isenterpic) { yah.Push(TexMan[sc.String]); } - if (sc.Crossed) sc.UnGet(); + if (sc.Crossed) + sc.UnGet(); break; case 3: // Spots @@ -683,23 +680,15 @@ void WI_drawBackground() // //==================================================================== -static void WI_DrawCharPatch (FTexture *patch, int x, int y) +static int WI_DrawCharPatch (int charcode, int x, int y, EColorRange translation=CR_UNTRANSLATED) { - if (patch->UseType != FTexture::TEX_FontChar) - { - screen->DrawTexture (patch, x, y, - DTA_Clean, true, - DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : FRACUNIT/2, - TAG_DONE); - } - else - { - screen->DrawTexture (patch, x, y, - DTA_Clean, true, - DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : FRACUNIT/2, - DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED), // otherwise it doesn't look good in Strife! - TAG_DONE); - } + int width; + screen->DrawTexture(IntermissionFont->GetChar(charcode, &width), x, y, + DTA_Clean, true, + DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : FRACUNIT/2, + DTA_Translation, IntermissionFont->GetColorTranslation(translation), + TAG_DONE); + return x - width; } @@ -712,21 +701,20 @@ static void WI_DrawCharPatch (FTexture *patch, int x, int y) // //==================================================================== -int WI_DrawName(int y,const char * levelname, bool nomove=false) +int WI_DrawName(int y, const char *levelname, bool nomove=false) { int i; size_t l; - const char * p; - int h=0; + const char *p; + int h = 0; int lumph; - lumph=BigFont->GetHeight(); + lumph = BigFont->GetHeight(); - p=levelname; - l=strlen(p); + p = levelname; + l = strlen(p); if (!l) return 0; - screen->SetFont(BigFont); FBrokenLines *lines = V_BreakLines(BigFont, 320, p); if (lines) @@ -735,19 +723,18 @@ int WI_DrawName(int y,const char * levelname, bool nomove=false) { if (!nomove) { - screen->DrawText(CR_UNTRANSLATED, 160 - lines[i].Width/2, y+h, lines[i].Text, DTA_Clean, true, TAG_DONE); + screen->DrawText(BigFont, CR_UNTRANSLATED, 160 - lines[i].Width/2, y+h, lines[i].Text, DTA_Clean, true, TAG_DONE); } else { - screen->DrawText(CR_UNTRANSLATED, (SCREENWIDTH - lines[i].Width * CleanXfac) / 2, (y+h) * CleanYfac, + screen->DrawText(BigFont, CR_UNTRANSLATED, (SCREENWIDTH - lines[i].Width * CleanXfac) / 2, (y+h) * CleanYfac, lines[i].Text, DTA_CleanNoMove, true, TAG_DONE); } h+=lumph; } V_FreeBrokenLines(lines); } - screen->SetFont(SmallFont); - return h+lumph/4; + return h + lumph/4; } @@ -763,7 +750,7 @@ void WI_drawLF () { int y = WI_TITLEY; - FTexture * tex = wbs->LName0; + FTexture *tex = wbs->LName0; // draw if (tex) @@ -773,11 +760,12 @@ void WI_drawLF () } else { - y+=WI_DrawName(y, lnametexts[0]); + y += WI_DrawName(y, lnametexts[0]); } // draw "Finished!" - if (y < NG_STATSY - screen->Font->GetHeight()*3/4) + FFont *font = gameinfo.gametype & GAME_Raven ? SmallFont : BigFont; + if (y < NG_STATSY - font->GetHeight()*3/4) { // don't draw 'finished' if the level name is too high! if (gameinfo.gametype & GAME_DoomChex) @@ -786,10 +774,9 @@ void WI_drawLF () } else { - screen->SetFont(gameinfo.gametype&GAME_Raven? SmallFont : BigFont); - screen->DrawText(CR_WHITE, 160 - screen->Font->StringWidth("finished")/2, y-4, "finished", + screen->DrawText(font, CR_WHITE, + 160 - font->StringWidth("finished")/2, y-4, "finished", DTA_Clean, true, TAG_DONE); - screen->SetFont(SmallFont); } } } @@ -806,22 +793,21 @@ void WI_drawLF () void WI_drawEL () { int y = WI_TITLEY; - + FFont *font = gameinfo.gametype & GAME_Raven ? SmallFont : BigFont; // draw "entering" // be careful with the added height so that it works for oversized 'entering' patches! if (gameinfo.gametype & GAME_DoomChex) { screen->DrawTexture(entering, (SCREENWIDTH - entering->GetWidth() * CleanXfac) / 2, y * CleanYfac, DTA_CleanNoMove, true, TAG_DONE); - y += entering->GetHeight() + screen->Font->GetHeight()/4; + y += entering->GetHeight() + font->GetHeight()/4; } else { - screen->SetFont(gameinfo.gametype&GAME_Raven? SmallFont : BigFont); - screen->DrawText(CR_WHITE, (SCREENWIDTH - screen->Font->StringWidth("now entering:") * CleanXfac) / 2, y * CleanYfac, + screen->DrawText(font, CR_WHITE, + (SCREENWIDTH - font->StringWidth("now entering:") * CleanXfac) / 2, y * CleanYfac, "now entering:", DTA_CleanNoMove, true, TAG_DONE); - y += screen->Font->GetHeight()*5/4; - screen->SetFont(SmallFont); + y += font->GetHeight()*5/4; } // draw @@ -888,92 +874,81 @@ void WI_drawOnLnode( int n, FTexture * c[] ,int numc) } } -// ==================================================================== +//==================================================================== // // Draws a number. // If digits > 0, then use that many digits minimum, // otherwise only use as many as necessary. -// Returns new x position. +// x is the right edge of the number. +// Returns new x position, that is, the left edge of the number. // -// ==================================================================== -int WI_drawNum (int x, int y, int n, int digits, bool leadingzeros = true) +//==================================================================== +int WI_drawNum (int x, int y, int n, int digits, bool leadingzeros=true, EColorRange translation=CR_UNTRANSLATED) { - int fontwidth = num[3]->GetWidth(); - int xofs; + int fontwidth = IntermissionFont->GetCharWidth('3'); char text[8]; + int len; char *text_p; if (leadingzeros) { - mysnprintf (text, countof(text), "%07d", n); + len = mysnprintf (text, countof(text), "%0*d", digits, n); } else { - mysnprintf (text, countof(text), "%7d", n); - if (digits < 0) - { - text_p = strrchr (text, ' '); - digits = (text_p == NULL) ? 7 : 6 - (int)(text_p - text); - x -= digits * fontwidth; - } + len = mysnprintf (text, countof(text), "%d", n); } + text_p = text + MIN(len, countof(text)-1); - text_p = strchr (text, '-'); - if (text_p == NULL || text_p - text > 7 - digits) - { - text_p = text + 7 - digits; - } - - xofs = x; - - if (*text_p == '-') - { - x -= fontwidth; - WI_DrawCharPatch (wiminus, x, y); - } - - // draw the new number - while (*text_p) + while (--text_p >= text) { + // Digits are centered in a box the width of the '3' character. + // Other characters (specifically, '-') are right-aligned in their cell. if (*text_p >= '0' && *text_p <= '9') { - FTexture *p = num[*text_p - '0']; - WI_DrawCharPatch (p, xofs + (fontwidth - p->GetWidth())/2, y); + x -= fontwidth; + WI_DrawCharPatch(*text_p, x + (fontwidth - IntermissionFont->GetCharWidth(*text_p)) / 2, y, translation); } - text_p++; - xofs += fontwidth; + else + { + WI_DrawCharPatch(*text_p, x - IntermissionFont->GetCharWidth(*text_p), y, translation); + x -= fontwidth; + } + } + if (len < digits) + { + x -= fontwidth * (digits - len); } return x; - } -// ==================================================================== +//==================================================================== // // // -// ==================================================================== +//==================================================================== -void WI_drawPercent (int x, int y, int p, int b) +void WI_drawPercent (int x, int y, int p, int b, bool show_total=true) { if (p < 0) return; if (wi_percents) { - WI_DrawCharPatch (percent, x, y); - - if (b == 0) - WI_drawNum (x, y, 100, -1, false); - else - WI_drawNum(x, y, p * 100 / b, -1, false); + WI_DrawCharPatch('%', x, y, CR_UNTRANSLATED); + WI_drawNum(x, y, b == 0 ? 100 : p * 100 / b, -1, false); } else { - int y2 = y + percent->GetHeight() - screen->Font->GetHeight (); - x = WI_drawNum (x, y, b, -1, false); - x -= SmallFont->StringWidth (" OF "); - screen->DrawText (CR_UNTRANSLATED, x, y2, " OF", - DTA_Clean, true, TAG_DONE); + x += IntermissionFont->GetCharWidth('%'); + if (show_total) + { + int y2 = y + IntermissionFont->GetHeight() - BigFont->GetHeight(); + x = WI_drawNum(x, y, b, 3, false); + x -= BigFont->GetCharWidth('/'); + screen->DrawText (BigFont, gameinfo.gametype & GAME_Doom ? CR_RED : CR_UNTRANSLATED, x, y2, "/", + DTA_Clean, true, TAG_DONE); + } WI_drawNum (x, y, p, -1, false); } } @@ -991,6 +966,21 @@ void WI_drawTime (int x, int y, int t, bool no_sucks=false) return; sucky = !no_sucks && t >= wbs->sucktime * 60 * 60 && wbs->sucktime > 0; + + if (sucky) + { // "sucks" + if (sucks != NULL) + { + screen->DrawTexture (sucks, x - sucks->GetWidth(), y - IntermissionFont->GetHeight() - 2, + DTA_Clean, true, TAG_DONE); + } + else + { + screen->DrawText (BigFont, CR_UNTRANSLATED, x - BigFont->StringWidth("SUCKS"), y - IntermissionFont->GetHeight() - 2, + "SUCKS", DTA_Clean, true, TAG_DONE); + } + } + int hours = t / 3600; t -= hours * 3600; int minutes = t / 60; @@ -999,38 +989,17 @@ void WI_drawTime (int x, int y, int t, bool no_sucks=false) // Why were these offsets hard coded? Half the WADs with custom patches // I tested screwed up miserably in this function! - int num_spacing = num[3]->GetWidth(); - int colon_spacing = colon->GetWidth(); + int num_spacing = IntermissionFont->GetCharWidth('3'); + int colon_spacing = IntermissionFont->GetCharWidth(':'); - x -= 2*num_spacing; - WI_drawNum (x, y, seconds, 2); - x -= colon_spacing; - WI_DrawCharPatch (colon, x , y); - x -= 2*num_spacing ; - WI_drawNum (x, y, minutes, 2, hours!=0); + x = WI_drawNum (x, y, seconds, 2) - 1; + WI_DrawCharPatch (':', x -= colon_spacing, y); + x = WI_drawNum (x, y, minutes, 2, hours!=0); if (hours) { - x -= colon_spacing; - WI_DrawCharPatch (colon, x , y); - x -= 2*num_spacing ; + WI_DrawCharPatch (':', x -= colon_spacing, y); WI_drawNum (x, y, hours, 2); } - - if (sucky) - { // "sucks" - if (sucks != NULL) - { - screen->DrawTexture (sucks, x - sucks->GetWidth(), y - num[0]->GetHeight() - 2, - DTA_Clean, true, TAG_DONE); - } - else - { - screen->SetFont (BigFont); - screen->DrawText (CR_UNTRANSLATED, x - BigFont->StringWidth("SUCKS"), y - BigFont->GetHeight() - 2, - "SUCKS", DTA_Clean, true, TAG_DONE); - screen->SetFont (SmallFont); - } - } } void WI_End () @@ -1547,7 +1516,7 @@ void WI_updateNetgameStats () void WI_drawNetgameStats () { int i, x, y; - int pwidth = percent->GetWidth(); + int pwidth = IntermissionFont->GetCharWidth('%'); // draw animated background WI_drawBackground(); @@ -1588,33 +1557,41 @@ void WI_drawNetgameStats () DTA_Clean, true, TAG_DONE); + screen->DrawText(SmallFont, CR_GRAY, x + 3, y + 2, players[i].userinfo.netname, DTA_Clean, true, TAG_DONE); x += NG_SPACINGX; - WI_drawPercent (x-pwidth, y+10, cnt_kills[i], wbs->maxkills); x += NG_SPACINGX; - WI_drawPercent (x-pwidth, y+10, cnt_items[i], wbs->maxitems); x += NG_SPACINGX; - WI_drawPercent (x-pwidth, y+10, cnt_secret[i], wbs->maxsecret); x += NG_SPACINGX; + WI_drawPercent (x-pwidth, y+10, cnt_kills[i], wbs->maxkills, false); x += NG_SPACINGX; + WI_drawPercent (x-pwidth, y+10, cnt_items[i], wbs->maxitems, false); x += NG_SPACINGX; + WI_drawPercent (x-pwidth, y+10, cnt_secret[i], wbs->maxsecret, false); x += NG_SPACINGX; if (dofrags) WI_drawNum(x, y+10, cnt_frags[i], -1, false); y += WI_SPACINGY; } + + // [RH] Draw totals + x = NG_STATSX; + y += 10; + screen->DrawText(BigFont, CR_CYAN, x - BigFont->StringWidth("TOTALS"), y, "TOTALS", DTA_Clean, true, TAG_DONE); + x += NG_SPACINGX - pwidth + IntermissionFont->GetCharWidth('%'); + WI_drawNum(x, y, wbs->maxkills, -1, false, CR_CYAN); x += NG_SPACINGX; + WI_drawNum(x, y, wbs->maxitems, -1, false, CR_CYAN); x += NG_SPACINGX; + WI_drawNum(x, y, wbs->maxsecret, -1, false, CR_CYAN); } else { if (gameinfo.gametype & GAME_Raven) { - screen->SetFont (BigFont); - screen->DrawText (CR_UNTRANSLATED, 95, 35, "KILLS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); - screen->DrawText (CR_UNTRANSLATED, 155, 35, "BONUS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); - screen->DrawText (CR_UNTRANSLATED, 232, 35, "SECRET", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (BigFont, CR_UNTRANSLATED, 95, 35, "KILLS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (BigFont, CR_UNTRANSLATED, 155, 35, "BONUS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (BigFont, CR_UNTRANSLATED, 232, 35, "SECRET", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); y = 50; } else { - screen->SetFont (SmallFont); - screen->DrawText (CR_UNTRANSLATED, 95, 50, "KILLS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); - screen->DrawText (CR_UNTRANSLATED, 155, 50, "BONUS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); - screen->DrawText (CR_UNTRANSLATED, 232, 50, "SECRET", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (SmallFont, CR_UNTRANSLATED, 95, 50, "KILLS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (SmallFont, CR_UNTRANSLATED, 155, 50, "BONUS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (SmallFont, CR_UNTRANSLATED, 232, 50, "SECRET", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); y = 62; } WI_drawLF (); @@ -1634,9 +1611,8 @@ void WI_drawNetgameStats () } else // Hexen and Strife don't have a face graphic for this. { - char pstr[3]={'P', '1'+i, 0}; - screen->SetFont (BigFont); - screen->DrawText(CR_UNTRANSLATED, 25, y+10, pstr, DTA_Clean, true, TAG_DONE); + char pstr[3] = {'P', '1'+i, 0}; + screen->DrawText(BigFont, CR_UNTRANSLATED, 25, y+10, pstr, DTA_Clean, true, TAG_DONE); } WI_drawPercent (127, y+10, cnt_kills[i], wbs->maxkills); @@ -1650,7 +1626,6 @@ void WI_drawNetgameStats () } y += 37; } - screen->SetFont (SmallFont); } } @@ -1790,7 +1765,7 @@ void WI_drawStats (void) // line height int lh; - lh = (3*num[0]->GetHeight())/2; + lh = IntermissionFont->GetHeight() * 3 / 2; // draw animated background WI_drawBackground(); @@ -1824,34 +1799,33 @@ void WI_drawStats (void) } else { - screen->SetFont (BigFont); - screen->DrawText (CR_UNTRANSLATED, 50, 65, "KILLS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); - screen->DrawText (CR_UNTRANSLATED, 50, 90, "ITEMS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); - screen->DrawText (CR_UNTRANSLATED, 50, 115, "SECRETS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (BigFont, CR_UNTRANSLATED, 50, 65, "KILLS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (BigFont, CR_UNTRANSLATED, 50, 90, "ITEMS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); + screen->DrawText (BigFont, CR_UNTRANSLATED, 50, 115, "SECRETS", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); int slashpos = gameinfo.gametype==GAME_Strife? 235:237; int countpos = gameinfo.gametype==GAME_Strife? 185:200; if (sp_state >= 2) { WI_drawNum (countpos, 65, cnt_kills[0], 3, false); - WI_DrawCharPatch (slash, slashpos, 65); + WI_DrawCharPatch ('/', slashpos, 65); WI_drawNum (248, 65, wbs->maxkills, 3, false); } if (sp_state >= 4) { WI_drawNum (countpos, 90, cnt_items[0], 3, false); - WI_DrawCharPatch (slash, slashpos, 90); + WI_DrawCharPatch ('/', slashpos, 90); WI_drawNum (248, 90, wbs->maxitems, 3, false); } if (sp_state >= 6) { WI_drawNum (countpos, 115, cnt_secret[0], 3, false); - WI_DrawCharPatch (slash, slashpos, 115); + WI_DrawCharPatch ('/', slashpos, 115); WI_drawNum (248, 115, wbs->maxsecret, 3, false); } if (sp_state >= 8) { - screen->DrawText (CR_UNTRANSLATED, 85, 160, "TIME", + screen->DrawText (BigFont, CR_UNTRANSLATED, 85, 160, "TIME", DTA_Clean, true, DTA_Shadow, true, TAG_DONE); WI_drawTime (249, 160, cnt_time); if (wi_showtotaltime) @@ -1859,7 +1833,6 @@ void WI_drawStats (void) WI_drawTime (249, 180, cnt_total_time); } } - screen->SetFont (SmallFont); } } @@ -1950,13 +1923,8 @@ void WI_Ticker(void) void WI_loadData(void) { - int i; - char name[9]; - if (gameinfo.gametype & GAME_DoomChex) { - wiminus = TexMan["WIMINUS"]; // minus sign - percent = TexMan["WIPCNT"]; // percent sign finished = TexMan["WIF"]; // "finished" entering = TexMan["WIENTER"]; // "entering" kills = TexMan["WIOSTK"]; // "kills" @@ -1964,30 +1932,19 @@ void WI_loadData(void) sp_secret = TexMan["WISCRT2"]; // "secret" items = TexMan["WIOSTI"]; // "items" frags = TexMan["WIFRGS"]; // "frgs" - colon = TexMan["WICOLON"]; // ":" timepic = TexMan["WITIME"]; // "time" sucks = TexMan["WISUCKS"]; // "sucks" par = TexMan["WIPAR"]; // "par" - killers = TexMan["WIKILRS"]; // "killers" (vertical] - victims = TexMan["WIVCTMS"]; // "victims" (horiz] + killers = TexMan["WIKILRS"]; // "killers" (vertical] + victims = TexMan["WIVCTMS"]; // "victims" (horiz] total = TexMan["WIMSTT"]; // "total" star = TexMan["STFST01"]; // your face bstar = TexMan["STFDEAD0"]; // dead face p = TexMan["STPBANY"]; - - for (i = 0; i < 10; i++) - { // numbers 0-9 - mysnprintf (name, countof(name), "WINUM%d", i); - num[i] = TexMan[name]; - } } else if (gameinfo.gametype & GAME_Raven) { - wiminus = TexMan["FONTB13"]; - percent = TexMan["FONTB05"]; - colon = TexMan["FONTB26"]; - slash = TexMan["FONTB15"]; - if (gameinfo.gametype==GAME_Heretic) + if (gameinfo.gametype == GAME_Heretic) { star = TexMan["FACEA0"]; bstar = TexMan["FACEB0"]; @@ -1998,34 +1955,19 @@ void WI_loadData(void) star = BigFont->GetChar('*', &dummywidth); // just a dummy to avoid an error if it is being used bstar = star; } - - for (i = 0; i < 10; i++) - { - mysnprintf (name, countof(name), "FONTB%d", 16 + i); - num[i] = TexMan[name]; - } } else // Strife needs some handling, too! { int dummywidth; - wiminus = BigFont->GetChar('-', &dummywidth); - percent = BigFont->GetChar('%', &dummywidth); - colon = BigFont->GetChar(':', &dummywidth); - slash = BigFont->GetChar('/', &dummywidth); star = BigFont->GetChar('*', &dummywidth); // just a dummy to avoid an error if it is being used bstar = star; - for (i = 0; i < 10; i++) - { - num[i] = BigFont->GetChar('0'+i, &dummywidth); - } } // Use the local level structure which can be overridden by hubs if they eventually get names! lnametexts[0] = level.level_name; - level_info_t * li = FindLevelInfo(wbs->next); - if (li) lnametexts[1] = G_MaybeLookupLevelName(li); - else lnametexts[1]=NULL; + level_info_t *li = FindLevelInfo(wbs->next); + lnametexts[1] = li ? G_MaybeLookupLevelName(li) : NULL; WI_LoadBackground(false); } diff --git a/wadsrc/static/fontdefs.txt b/wadsrc/static/fontdefs.txt index 7e3aae0684..86eb7c349d 100644 --- a/wadsrc/static/fontdefs.txt +++ b/wadsrc/static/fontdefs.txt @@ -45,3 +45,23 @@ INDEXFONT_RAVEN 8 SMALLIN8 9 SMALLIN9 } + +// Doom and Chex intermissions use special text glyphs. The Raven and Strife +// games just use the standard big font. + +IntermissionFont_Doom +{ + % WIPCNT + : WICOLON + 0 WINUM0 + 1 WINUM1 + 2 WINUM2 + 3 WINUM3 + 4 WINUM4 + 5 WINUM5 + 6 WINUM6 + 7 WINUM7 + 8 WINUM8 + 9 WINUM9 + - WIMINUS +} diff --git a/wadsrc/static/textcolors.txt b/wadsrc/static/textcolors.txt index fb5f18eb99..7b018525ee 100644 --- a/wadsrc/static/textcolors.txt +++ b/wadsrc/static/textcolors.txt @@ -207,3 +207,13 @@ Console: Flat: #808080 } + +Cyan +{ + #001F1F #00F0F0 +Console: + #000000 #007F7F 0 127 + #00FFFF #FEFFFF 128 256 +Flat: + #00DDDD +}