mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
- added a generic message display, using ZDoom's code.
This is mainly meant for Nam and WW2GI which have an ugly-as-hell font for these texts.
This commit is contained in:
parent
6d04f0f159
commit
3ea526055f
7 changed files with 17 additions and 22 deletions
|
@ -234,7 +234,7 @@ struct GameInterface
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
FString f;
|
FString f;
|
||||||
f.VFormat(fmt, ap);
|
f.VFormat(fmt, ap);
|
||||||
DoPrintMessage(prio, fmt);
|
DoPrintMessage(prio, f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
#include "v_font.h"
|
#include "v_font.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "inputstate.h"
|
#include "inputstate.h"
|
||||||
|
#include "i_time.h"
|
||||||
|
#include "gamecvars.h"
|
||||||
|
|
||||||
|
|
||||||
#define LEFTMARGIN 8
|
#define LEFTMARGIN 8
|
||||||
|
@ -123,15 +125,13 @@ static GameAtExit *ExitCmdList;
|
||||||
#define SCROLLDN 2
|
#define SCROLLDN 2
|
||||||
#define SCROLLNO 0
|
#define SCROLLNO 0
|
||||||
|
|
||||||
CVAR (Bool, show_messages, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
||||||
|
|
||||||
// Buffer for AddToConsole()
|
// Buffer for AddToConsole()
|
||||||
static char *work = NULL;
|
static char *work = NULL;
|
||||||
static int worklen = 0;
|
static int worklen = 0;
|
||||||
|
|
||||||
CVAR(Float, con_notifytime, 3.f, CVAR_ARCHIVE)
|
CVAR(Float, con_notifytime, 3.f, CVAR_ARCHIVE)
|
||||||
CVAR(Bool, con_centernotify, false, CVAR_ARCHIVE)
|
CVAR(Bool, con_centernotify, false, CVAR_ARCHIVE)
|
||||||
CUSTOM_CVAR(Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high resolutions?
|
CUSTOM_CVAR(Int, con_scaletext, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // Scale notify text at high resolutions?
|
||||||
{
|
{
|
||||||
if (self < 0) self = 0;
|
if (self < 0) self = 0;
|
||||||
}
|
}
|
||||||
|
@ -541,7 +541,7 @@ CUSTOM_CVAR(Int, con_notifylines, NUMNOTIFIES, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PrintColors[PRINTLEVELS+2] = { CR_RED, CR_GOLD, CR_GRAY, CR_GREEN, CR_GREEN, CR_GOLD };
|
int PrintColors[PRINTLEVELS+2] = { CR_RED, CR_GOLD, CR_YELLOW, CR_GREEN, CR_GREEN, CR_GOLD };
|
||||||
|
|
||||||
static void setmsgcolor (int index, int color);
|
static void setmsgcolor (int index, int color);
|
||||||
|
|
||||||
|
@ -775,7 +775,7 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
|
||||||
TArray<FBrokenLines> lines;
|
TArray<FBrokenLines> lines;
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if ((printlevel != 128 && !show_messages) ||
|
if (hud_messages != 2 ||
|
||||||
source.IsEmpty() ||
|
source.IsEmpty() ||
|
||||||
//gamestate == GS_FULLCONSOLE ||
|
//gamestate == GS_FULLCONSOLE ||
|
||||||
//gamestate == GS_DEMOSCREEN ||
|
//gamestate == GS_DEMOSCREEN ||
|
||||||
|
@ -901,7 +901,7 @@ int PrintString (int iprintlevel, const char *outline)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
conbuffer->AddText(printlevel, outline);
|
conbuffer->AddText(printlevel, outline);
|
||||||
if (vidactive && screen && (iprintlevel & PRINT_NOTIFY))
|
if (vidactive && (iprintlevel & PRINT_NOTIFY))
|
||||||
{
|
{
|
||||||
NotifyStrings.AddString(printlevel, outline);
|
NotifyStrings.AddString(printlevel, outline);
|
||||||
}
|
}
|
||||||
|
@ -1074,7 +1074,7 @@ void FNotifyBuffer::Tick()
|
||||||
if (Text[i].TimeOut != 0 && --Text[i].TimeOut <= 0)
|
if (Text[i].TimeOut != 0 && --Text[i].TimeOut <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i > 0)
|
if (i < Text.Size())
|
||||||
{
|
{
|
||||||
Text.Delete(0, i);
|
Text.Delete(0, i);
|
||||||
}
|
}
|
||||||
|
@ -1106,9 +1106,6 @@ void FNotifyBuffer::Draw()
|
||||||
j = notify.TimeOut;
|
j = notify.TimeOut;
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
if (!show_messages && notify.PrintLevel != 128)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
double alpha = (j < NOTIFYFADETIME) ? 1. * j / NOTIFYFADETIME : 1;
|
double alpha = (j < NOTIFYFADETIME) ? 1. * j / NOTIFYFADETIME : 1;
|
||||||
|
|
||||||
if (notify.PrintLevel >= PRINTLEVELS)
|
if (notify.PrintLevel >= PRINTLEVELS)
|
||||||
|
|
|
@ -257,7 +257,6 @@ CVARD(Bool, hud_showmapname, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disab
|
||||||
CVARD(Bool, hud_position, false, CVAR_ARCHIVE, "aligns the status bar to the bottom/top")
|
CVARD(Bool, hud_position, false, CVAR_ARCHIVE, "aligns the status bar to the bottom/top")
|
||||||
CVARD(Bool, hud_bgstretch, false, CVAR_ARCHIVE|CVAR_FRONTEND_DUKELIKE, "enable/disable background image stretching in wide resolutions")
|
CVARD(Bool, hud_bgstretch, false, CVAR_ARCHIVE|CVAR_FRONTEND_DUKELIKE, "enable/disable background image stretching in wide resolutions")
|
||||||
CVARD(Int, hud_messagetime, 120, CVAR_ARCHIVE|CVAR_FRONTEND_DUKELIKE, "length of time to display multiplayer chat messages")
|
CVARD(Int, hud_messagetime, 120, CVAR_ARCHIVE|CVAR_FRONTEND_DUKELIKE, "length of time to display multiplayer chat messages")
|
||||||
// Should be available to all games - the message handling should also be consolidated into a game independent feature.
|
|
||||||
CUSTOM_CVARD(Int, hud_messages, 1, CVAR_ARCHIVE, "enable/disable showing messages")
|
CUSTOM_CVARD(Int, hud_messages, 1, CVAR_ARCHIVE, "enable/disable showing messages")
|
||||||
{
|
{
|
||||||
if (self < 0 || self > 2) self = 1;
|
if (self < 0 || self > 2) self = 1;
|
||||||
|
@ -266,16 +265,15 @@ CUSTOM_CVARD(Int, hud_messages, 1, CVAR_ARCHIVE, "enable/disable showing message
|
||||||
|
|
||||||
CCMD (togglemessages)
|
CCMD (togglemessages)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (hud_messages)
|
if (hud_messages)
|
||||||
{
|
{
|
||||||
Printf (128, "%s\n", GStrings("MSGOFF"));
|
gi->PrintMessage(PRINT_MEDIUM, "%s\n", GStrings("MSGOFF"));
|
||||||
hud_messages = false;
|
hud_messages = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Printf (128, "%s\n", GStrings("MSGON"));
|
|
||||||
hud_messages = true;
|
hud_messages = true;
|
||||||
|
gi->PrintMessage(PRINT_MEDIUM, "%s\n", GStrings("MSGON"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1107,7 +1107,7 @@ void G_PrintGameQuotes(int32_t snum)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (text_quote.IsNotEmpty() && ps->ftq == -32878) height = gametext_(x, y, text_quote, textsh(k), pal, texto(k), texta(k), TEXT_XCENTER).y + (1 << 16);
|
if (text_quote.IsNotEmpty() && ps->ftq == -32768) height = gametext_(x, y, text_quote, textsh(k), pal, texto(k), texta(k), TEXT_XCENTER).y + (1 << 16);
|
||||||
else height = gametext_(x, y, quoteMgr.GetQuote(ps->ftq), textsh(k), pal, texto(k), texta(k), TEXT_XCENTER).y + (1<<16);
|
else height = gametext_(x, y, quoteMgr.GetQuote(ps->ftq), textsh(k), pal, texto(k), texta(k), TEXT_XCENTER).y + (1<<16);
|
||||||
}
|
}
|
||||||
while (0);
|
while (0);
|
||||||
|
@ -1154,7 +1154,7 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
|
||||||
{
|
{
|
||||||
auto qu = quoteMgr.GetQuote(q);
|
auto qu = quoteMgr.GetQuote(q);
|
||||||
if (p == g_player[screenpeek].ps && qu[0] != '\0')
|
if (p == g_player[screenpeek].ps && qu[0] != '\0')
|
||||||
Printf(PRINT_MEDIUM | PRINT_NOTIFY, cq ? OSDTEXT_DEFAULT "%s\n" : "%s\n", qu);
|
Printf((cq? PRINT_LOW : PRINT_MEDIUM) | PRINT_NOTIFY, "%s\n", qu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1153,7 +1153,7 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
|
||||||
{
|
{
|
||||||
auto qu = quoteMgr.GetQuote(q);
|
auto qu = quoteMgr.GetQuote(q);
|
||||||
if (p == g_player[screenpeek].ps && qu[0] != '\0')
|
if (p == g_player[screenpeek].ps && qu[0] != '\0')
|
||||||
Printf(PRINT_NOTIFY, cq ? OSDTEXT_DEFAULT "%s\n" : "%s\n", qu);
|
Printf((cq ? PRINT_LOW : PRINT_MEDIUM) | PRINT_NOTIFY, "%s\n", qu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,7 +1178,7 @@ void GameInterface::DoPrintMessage(int prio, const char* t)
|
||||||
if (p->ftq == QUOTE_RESERVED || p->ftq == QUOTE_RESERVED2) return;
|
if (p->ftq == QUOTE_RESERVED || p->ftq == QUOTE_RESERVED2) return;
|
||||||
|
|
||||||
if (p == g_player[screenpeek].ps)
|
if (p == g_player[screenpeek].ps)
|
||||||
Printf(PRINT_NOTIFY, cq ? OSDTEXT_DEFAULT "%s\n" : "%s\n", t);
|
Printf(prio|PRINT_NOTIFY, cq ? OSDTEXT_DEFAULT "%s\n" : "%s\n", t);
|
||||||
|
|
||||||
if (hud_messages == 1)
|
if (hud_messages == 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1352,8 +1352,8 @@ InitLevel(void)
|
||||||
|
|
||||||
if (ArgCheat)
|
if (ArgCheat)
|
||||||
{
|
{
|
||||||
SWBOOL bak = hud_messages;
|
int bak = hud_messages;
|
||||||
hud_messages = FALSE;
|
hud_messages = 0;
|
||||||
EveryCheatToggle(&Player[0],NULL);
|
EveryCheatToggle(&Player[0],NULL);
|
||||||
hud_messages = bak;
|
hud_messages = bak;
|
||||||
GodMode = TRUE;
|
GodMode = TRUE;
|
||||||
|
|
|
@ -447,7 +447,7 @@ void PutStringInfo(PLAYERp pp, const char *string)
|
||||||
if (!hud_messages)
|
if (!hud_messages)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Printf(PRINT_LOW|PRINT_NOTIFY, "%s", string); // Put it in the console too
|
Printf(PRINT_MEDIUM|PRINT_NOTIFY, "%s", string); // Put it in the console too
|
||||||
if (hud_messages == 1) PutStringInfoLine(pp, string);
|
if (hud_messages == 1) PutStringInfoLine(pp, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue