mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- added a native style display mode to the notification message display.
Fixes #9
This commit is contained in:
parent
4469cf7edb
commit
41a1120033
4 changed files with 130 additions and 27 deletions
|
@ -468,7 +468,7 @@ void viewSetSystemMessage(const char* pMessage, ...) {
|
|||
|
||||
void viewSetMessage(const char *pMessage, const int pal, const MESSAGE_PRIORITY priority)
|
||||
{
|
||||
int printlevel = priority < 0 ? PRINT_LOW : priority < MESSAGE_PRIORITY_SYSTEM ? PRINT_MEDIUM : PRINT_HIGH;
|
||||
int printlevel = priority <= MESSAGE_PRIORITY_NORMAL ? PRINT_LOW : priority < MESSAGE_PRIORITY_SYSTEM ? PRINT_MEDIUM : PRINT_HIGH;
|
||||
Printf(printlevel|PRINT_NOTIFY, "%s\n", pMessage);
|
||||
}
|
||||
|
||||
|
|
|
@ -139,11 +139,12 @@ static int worklen = 0;
|
|||
|
||||
CVAR(Float, con_notifytime, 3.f, CVAR_ARCHIVE)
|
||||
CVAR(Bool, con_centernotify, false, CVAR_ARCHIVE)
|
||||
CVAR(Bool, con_notify_advanced, false, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR(Int, con_scaletext, 2, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // Scale notify text at high resolutions?
|
||||
{
|
||||
if (self < 0) self = 0;
|
||||
}
|
||||
CVAR(Bool, con_pulseText, true, CVAR_ARCHIVE)
|
||||
CVAR(Bool, con_pulsetext, false, CVAR_ARCHIVE)
|
||||
|
||||
CUSTOM_CVAR(Int, con_scale, 0, CVAR_ARCHIVE)
|
||||
{
|
||||
|
@ -536,6 +537,7 @@ public:
|
|||
void Clear() { Text.Clear(); }
|
||||
void Tick();
|
||||
void Draw();
|
||||
void DrawNative();
|
||||
|
||||
private:
|
||||
TArray<FNotifyText> Text;
|
||||
|
@ -551,7 +553,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_UNTRANSLATED, CR_GOLD, CR_GRAY, CR_GREEN, CR_GREEN, CR_UNTRANSLATED };
|
||||
|
||||
static void setmsgcolor (int index, int color);
|
||||
|
||||
|
@ -560,37 +562,37 @@ FILE *Logfile = NULL;
|
|||
|
||||
FIntCVar msglevel ("msg", 0, CVAR_ARCHIVE);
|
||||
|
||||
CUSTOM_CVAR (Int, msg0color, 6, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, msg0color, CR_UNTRANSLATED, CVAR_ARCHIVE)
|
||||
{
|
||||
setmsgcolor (0, self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, msg1color, 5, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, msg1color, CR_GOLD, CVAR_ARCHIVE)
|
||||
{
|
||||
setmsgcolor (1, self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, msg2color, 2, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, msg2color, CR_GRAY, CVAR_ARCHIVE)
|
||||
{
|
||||
setmsgcolor (2, self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, msg3color, 3, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, msg3color, CR_GREEN, CVAR_ARCHIVE)
|
||||
{
|
||||
setmsgcolor (3, self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, msg4color, 3, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, msg4color, CR_GREEN, CVAR_ARCHIVE)
|
||||
{
|
||||
setmsgcolor (4, self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, msgmidcolor, 5, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, msgmidcolor, CR_UNTRANSLATED, CVAR_ARCHIVE)
|
||||
{
|
||||
setmsgcolor (PRINTLEVELS, self);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE)
|
||||
CUSTOM_CVAR (Int, msgmidcolor2, CR_BROWN, CVAR_ARCHIVE)
|
||||
{
|
||||
setmsgcolor (PRINTLEVELS+1, self);
|
||||
}
|
||||
|
@ -915,9 +917,12 @@ int PrintString (int iprintlevel, const char *outline)
|
|||
I_PrintStr(outline);
|
||||
|
||||
conbuffer->AddText(printlevel, outline);
|
||||
if (vidactive && (iprintlevel & PRINT_NOTIFY)) // The logic here is inverse to ZDoom because most texts getting here should not be on screem.
|
||||
if (!(iprintlevel & PRINT_NONOTIFY))
|
||||
{
|
||||
NotifyStrings.AddString(printlevel, outline);
|
||||
if (vidactive && ((iprintlevel & PRINT_NOTIFY) || con_notify_advanced))
|
||||
{
|
||||
NotifyStrings.AddString(printlevel, outline);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Logfile != nullptr && !(iprintlevel & PRINT_NOLOG))
|
||||
|
@ -1074,21 +1079,90 @@ void FNotifyBuffer::Tick()
|
|||
}
|
||||
}
|
||||
|
||||
void FNotifyBuffer::DrawNative()
|
||||
{
|
||||
// Native display is:
|
||||
// * centered at the top and pulsing for Duke
|
||||
// * centered shifted down and not pulsing for Shadow Warrior
|
||||
// * top left for Exhumed
|
||||
// * 4 lines with the tiny font for Blood. (same mechanic as the regular one, just a different font and scale.)
|
||||
|
||||
bool center = g_gameType & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_WW2GI | GAMEFLAG_RR | GAMEFLAG_SW);
|
||||
bool pulse = g_gameType & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_WW2GI | GAMEFLAG_RR);
|
||||
unsigned topline = g_gameType & GAMEFLAG_BLOOD ? 0 : Text.Size() - 1;
|
||||
|
||||
FFont* font = g_gameType & GAMEFLAG_BLOOD ? SmallFont2 : SmallFont;
|
||||
|
||||
int line = (g_gameType & GAMEFLAG_BLOOD)? Top : (g_gameType & GAMEFLAG_SW) ? 40 : font->GetDisplacement();
|
||||
bool canskip = (g_gameType & GAMEFLAG_BLOOD);
|
||||
int lineadv = font->GetHeight();
|
||||
|
||||
for (unsigned i = topline; i < Text.Size(); ++i)
|
||||
{
|
||||
FNotifyText& notify = Text[i];
|
||||
|
||||
if (notify.TimeOut == 0)
|
||||
continue;
|
||||
|
||||
int j = notify.TimeOut - notify.Ticker;
|
||||
if (j > 0)
|
||||
{
|
||||
double alpha = g_gameType & GAMEFLAG_BLOOD? ((j < NOTIFYFADETIME) ? 1. * j / NOTIFYFADETIME : 1) : 1;
|
||||
if (pulse)
|
||||
{
|
||||
alpha *= 0.7 + 0.3 * sin(I_msTime() / 100.);
|
||||
}
|
||||
|
||||
if (!center)
|
||||
{
|
||||
DrawText(twod, font, CR_UNTRANSLATED, 0, line, notify.Text,
|
||||
DTA_FullscreenScale, FSMode_ScaleToHeight,
|
||||
DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_KeepRatio, true,
|
||||
DTA_Alpha, alpha, TAG_DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
int fac = isRR() ? 2 : 1;
|
||||
|
||||
DrawText(twod, font, CR_UNTRANSLATED, 160 * fac - font->StringWidth(notify.Text) / 2, line, notify.Text,
|
||||
DTA_FullscreenScale, FSMode_ScaleToHeight,
|
||||
DTA_VirtualWidth, 320 * fac, DTA_VirtualHeight, 200 * fac,
|
||||
DTA_Alpha, alpha, TAG_DONE);
|
||||
}
|
||||
line += lineadv;
|
||||
canskip = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
notify.TimeOut = 0;
|
||||
}
|
||||
}
|
||||
if (canskip)
|
||||
{
|
||||
Top = TopGoal;
|
||||
}
|
||||
}
|
||||
|
||||
void FNotifyBuffer::Draw()
|
||||
{
|
||||
bool center = (con_centernotify != 0.f);
|
||||
int line, lineadv, color, j;
|
||||
bool canskip;
|
||||
|
||||
if (gamestate == GS_FULLCONSOLE || gamestate == GS_MENUSCREEN)
|
||||
return;
|
||||
|
||||
if (!con_notify_advanced)
|
||||
{
|
||||
DrawNative();
|
||||
return;
|
||||
}
|
||||
|
||||
bool center = (con_centernotify != 0.f);
|
||||
int color;
|
||||
|
||||
FFont* font = generic_ui ? NewSmallFont : SmallFont? SmallFont : AlternativeSmallFont;
|
||||
|
||||
line = Top + font->GetDisplacement() / NotifyFontScale;
|
||||
canskip = true;
|
||||
int line = Top + font->GetDisplacement() / NotifyFontScale;
|
||||
bool canskip = true;
|
||||
|
||||
lineadv = font->GetHeight () / NotifyFontScale;
|
||||
int lineadv = font->GetHeight () / NotifyFontScale;
|
||||
|
||||
for (unsigned i = 0; i < Text.Size(); ++ i)
|
||||
{
|
||||
|
@ -1097,11 +1171,11 @@ void FNotifyBuffer::Draw()
|
|||
if (notify.TimeOut == 0)
|
||||
continue;
|
||||
|
||||
j = notify.TimeOut - notify.Ticker;
|
||||
int j = notify.TimeOut - notify.Ticker;
|
||||
if (j > 0)
|
||||
{
|
||||
double alpha = (j < NOTIFYFADETIME) ? 1. * j / NOTIFYFADETIME : 1;
|
||||
if (con_pulseText)
|
||||
if (con_pulsetext)
|
||||
{
|
||||
alpha *= 0.7 + 0.3 * sin(I_msTime() / 100.);
|
||||
}
|
||||
|
|
|
@ -1009,7 +1009,12 @@ OptionValue "HUDMessages"
|
|||
{
|
||||
0, "$OPTVAL_OFF"
|
||||
1, "$OPTVAL_ON"
|
||||
2, "$DSPLYMNU_GENERIC"
|
||||
}
|
||||
|
||||
OptionValue "HUDMessageStyle"
|
||||
{
|
||||
0, "$OPTVAL_CLASSIC"
|
||||
1, "$OPTVAL_ADVANCED"
|
||||
}
|
||||
|
||||
OptionMenu "HUDOptions" //protected
|
||||
|
@ -1026,12 +1031,14 @@ OptionMenu "HUDOptions" //protected
|
|||
|
||||
StaticText ""
|
||||
Option "$DSPLYMNU_MESSAGES", "hud_messages", "HudMessages"
|
||||
Option "$DSPLYMNU_MESSAGEDISP", "con_notify_advanced", "HudMessageStyle"
|
||||
Option "$MSGMNU_CENTERMESSAGES", "con_centernotify", "OnOff", "con_notify_advanced"
|
||||
Option "$MSGMNU_PULSEMESSAGES", "con_pulsetext", "OnOff", "con_notify_advanced"
|
||||
Slider "$MSGMNU_MESSAGESCALE", "con_scaletext", 0.0, 8.0, 1.0, -1
|
||||
|
||||
StaticText ""
|
||||
Option "$DSPLYMNU_CROSSHAIR", "cl_crosshair", OnOff
|
||||
ifgame(duke, nam, ww2gi, redneck, redneckrides, fury, deer)
|
||||
{
|
||||
Slider "$DSPLYMNU_CROSSHAIRSCALE", "cl_crosshairscale", 50, 100, 10, 1
|
||||
}
|
||||
Slider "$DSPLYMNU_CROSSHAIRSCALE", "cl_crosshairscale", 50, 100, 10, 1
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -507,6 +507,12 @@ None (linear mipmap),OPTVAL_NONELINEARMIPMAP,,,,Žádné (lineární mipmapa),Au
|
|||
None (trilinear),OPTVAL_NONETRILINEAR,,,,Žádné (trilineární),Aus (trilinear),,Nenio (trilinia),Ninguno (trilineal),,Ei mitään (trilineaarinen),Aucun (mipmap trilinéaire),,Nessuno (mipmap trilineare),なし(トライリニア),없음 (삼선형),Geen (trilineair),Brak (trzyliniowe),Nenhum (trilinear),,,Нет (трилинейная),Ништа (трилинеарно)
|
||||
Bilinear,OPTVAL_BILINEAR,,,,Bilineární,,,Dulinia,Bilineal,,Bilineaarinen,Bilinéaire,,Bilineare,バイリニア,쌍선형,Bilineair,Dwuliniowe,,,,Билинейная,Билинеарно
|
||||
Trilinear,OPTVAL_TRILINEAR,,,,Trilineární,,,Trilinia,Trilineal,,Trilineaarinen,Trilinéaire,,Trilineare,トライリニア,삼선형,Trilineair,Trzyliniowe,,,,Трилинейная,Трилинеарно
|
||||
Message Display Style,DSPLYMNU_MESSAGEDISP,,,,,Nachrichtenstil,,,,,,,,,,,,,,,,,
|
||||
Classic,OPTVAL_CLASSIC,,,,,Klassisch,,,,,,,,,,,,,,,,,
|
||||
Advanced,OPTVAL_ADVANCED,,,,,Erweitert,,,,,,,,,,,,,,,,,
|
||||
Center messages,MSGMNU_CENTERMESSAGES,,,Centre messages,Vycentrovat zprávy,Nachrichten zentrieren,,Centrigi mesaĝoj,Centrar mensajes,,Keskitä viestit,Messages centrés,,Messaggi centrati,メッセージを中央に,메시지 중간에 위치,Berichten centreren,Wyśrodkuj wiadomości,Centralizar mensagens,Centrar mensagens,Mesaje centrate,Центрирование сообщений,Централне поруке
|
||||
Pulsating message Display,MSGMNU_PULSEMESSAGES,,,,,Pulsierende Nachrichtenanzeige,,,,,,,,,,,,,,,,,
|
||||
Message Scale,MSGMNU_MESSAGESCALE,,,,,Nachrichtengröße,,,,,,,,,,,,,,,,,
|
||||
2x,OPTVAL_2X,,,,,,,2-oble,,,,,,,,,,,,,,,
|
||||
4x,OPTVAL_4X,,,,,,,4-oble,,,,,,,,,,,,,,,
|
||||
8x,OPTVAL_8X,,,,,,,8-oble,,,,,,,,,,,,,,,
|
||||
|
@ -2317,4 +2323,20 @@ Time Key,TXT_EX_PICKUP25,,,,,,,,,,,,,,,,,,,,,,
|
|||
War Key,TXT_EX_PICKUP26,,,,,,,,,,,,,,,,,,,,,,
|
||||
Earth Key,TXT_EX_PICKUP27,,,,,,,,,,,,,,,,,,,,,,
|
||||
Magic,TXT_EX_PICKUP28,,,,,,,,,,,,,,,,,,,,,,
|
||||
Location Preserved,TXT_EX_PICKUP29,,,,,,,,,,,,,,,,,,,,,,
|
||||
Location Preserved,TXT_EX_PICKUP29,,,,,,,,,,,,,,,,,,,,,,
|
||||
"Pick up a copy of Exhumed
|
||||
today to continue the adventure!
|
||||
More levels, nastier creatures
|
||||
and the evil doings of the
|
||||
Kilmaat await you in the full
|
||||
version of the game.
|
||||
Twenty levels, plus 12 network
|
||||
play levels can be yours!
|
||||
",TXT_EX_SHAREWARE,,,,,,,,,,,,,,,,,,,,,,
|
||||
"Hi Sweetie, I love you",TXT_EX_SWEETIE,,,,,,,,,,,,,,,,,,,,,,
|
||||
Flashes toggled,TXT_EX_FLASHES,,,,,,,,,,,,,,,,,,,,,,
|
||||
Full Map,TXT_EX_FULLMAP,,,,,,,,,,,,,,,,,,,,,,
|
||||
Slip mode ON,TXT_EX_SLIPON,,,,,,,,,,,,,,,,,,,,,,
|
||||
Slip mode OFF,TXT_EX_SLIPOFF,,,,,,,,,,,,,,,,,,,,,,
|
||||
Snake Cam Enabled,TXT_EX_SNAKEON,,,,,,,,,,,,,,,,,,,,,,
|
||||
Snake Cam Disabled,TXT_EX_SNAKEOFF,,,,,,,,,,,,,,,,,,,,,,
|
|
Loading…
Reference in a new issue