mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-04-22 23:50:58 +00:00
- Consolidated C_MidPrint and C_MidPrintBold.
This commit is contained in:
parent
488627d3b2
commit
f63f833ed1
4 changed files with 10 additions and 30 deletions
|
@ -1852,36 +1852,21 @@ static const char bar2[] = TEXTCOLOR_RED "\n\35\36\36\36\36\36\36\36\36\36\36\36
|
|||
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\36\36\36\36\36\36\36\36\37" TEXTCOLOR_NORMAL "\n";
|
||||
|
||||
void C_MidPrint (FFont *font, const char *msg)
|
||||
void C_MidPrint (FFont *font, const char *msg, bool bold)
|
||||
{
|
||||
if (StatusBar == NULL || screen == NULL)
|
||||
if (StatusBar == nullptr || screen == nullptr)
|
||||
return;
|
||||
|
||||
if (msg != NULL)
|
||||
if (msg != nullptr)
|
||||
{
|
||||
AddToConsole (-1, bar1);
|
||||
AddToConsole (-1, msg);
|
||||
AddToConsole (-1, bar3);
|
||||
|
||||
auto color = (EColorRange)PrintColors[bold? PRINTLEVELS+1 : PRINTLEVELS];
|
||||
|
||||
StatusBar->AttachMessage (Create<DHUDMessage>(font, msg, 1.5f, 0.375f, 0, 0,
|
||||
(EColorRange)PrintColors[PRINTLEVELS], con_midtime), MAKE_ID('C','N','T','R'));
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusBar->DetachMessage (MAKE_ID('C','N','T','R'));
|
||||
}
|
||||
}
|
||||
|
||||
void C_MidPrintBold (FFont *font, const char *msg)
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
AddToConsole (-1, bar2);
|
||||
AddToConsole (-1, msg);
|
||||
AddToConsole (-1, bar3);
|
||||
|
||||
StatusBar->AttachMessage (Create<DHUDMessage> (font, msg, 1.5f, 0.375f, 0, 0,
|
||||
(EColorRange)PrintColors[PRINTLEVELS+1], con_midtime), MAKE_ID('C','N','T','R'));
|
||||
color, con_midtime), MAKE_ID('C','N','T','R'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1897,8 +1882,7 @@ DEFINE_ACTION_FUNCTION(_Console, MidPrint)
|
|||
PARAM_BOOL(bold);
|
||||
|
||||
const char *txt = text[0] == '$'? GStrings(&text[1]) : text.GetChars();
|
||||
if (!bold) C_MidPrint(fnt, txt);
|
||||
else C_MidPrintBold(fnt, txt);
|
||||
C_MidPrint(fnt, txt, bold);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,8 +78,7 @@ void C_InitTicker (const char *label, unsigned int max, bool showpercent=true);
|
|||
void C_SetTicker (unsigned int at, bool forceUpdate=false);
|
||||
|
||||
class FFont;
|
||||
void C_MidPrint (FFont *font, const char *message);
|
||||
void C_MidPrintBold (FFont *font, const char *message);
|
||||
void C_MidPrint (FFont *font, const char *message, bool bold = false);
|
||||
|
||||
bool C_Responder (event_t *ev);
|
||||
|
||||
|
|
|
@ -8733,10 +8733,7 @@ scriptwait:
|
|||
if (pcd == PCD_ENDPRINTBOLD || screen == NULL ||
|
||||
screen->CheckLocalView (consoleplayer))
|
||||
{
|
||||
if (pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (level.flags2 & LEVEL2_HEXENHACK)))
|
||||
C_MidPrintBold(activefont, work);
|
||||
else
|
||||
C_MidPrint (activefont, work);
|
||||
C_MidPrint(activefont, work, pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (level.flags2 & LEVEL2_HEXENHACK)));
|
||||
}
|
||||
STRINGBUILDER_FINISH(work);
|
||||
}
|
||||
|
|
|
@ -1359,7 +1359,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PrintBold)
|
|||
con_midtime = float(time);
|
||||
}
|
||||
FString formatted = strbin1(text);
|
||||
C_MidPrintBold(font != NULL ? font : SmallFont, formatted.GetChars());
|
||||
C_MidPrint(font != NULL ? font : SmallFont, formatted.GetChars(), true);
|
||||
con_midtime = saved;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue