Merge remote-tracking branch 'origin/master' into vulkan2

This commit is contained in:
Rachael Alexanderson 2019-04-11 17:45:35 -04:00
commit 3deda0efd2
47 changed files with 5687 additions and 4376 deletions

View File

@ -394,8 +394,8 @@ bool FCajunMaster::DoAddBot (FLevelLocals *Level, uint8_t *info, botskill_t skil
else
Printf ("%s joined the game\n", players[bnum].userinfo.GetName());
Level->localEventManager->PlayerEntered(bnum, false);
Level->DoReborn (bnum, true);
Level->localEventManager->PlayerEntered(bnum, false);
return true;
}

View File

@ -79,8 +79,20 @@ CUSTOM_CVAR(Int, con_buffersize, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
if (self >= 0 && self < 128) self = 128;
}
CVAR(Bool, con_consolefont, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, con_midconsolefont, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
bool generic_hud, generic_ui;
EXTERN_CVAR(Bool, ui_generic)
CUSTOM_CVAR(Bool, hud_generic, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // All HUD elements only use generic assets
{
generic_hud = self || ui_generic;
}
CUSTOM_CVAR(Bool, ui_generic, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // The entire UI uses generic assets (this excludes the primary menus)
{
generic_ui = self;
generic_hud = self || hud_generic;
}
FConsoleBuffer *conbuffer;
@ -587,9 +599,15 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE)
EColorRange C_GetDefaultFontColor()
{
// Ideally this should analyze the SmallFont and pick a matching color.
if (!generic_hud) return CR_UNTRANSLATED;
return gameinfo.gametype == GAME_Doom ? CR_RED : gameinfo.gametype == GAME_Chex ? CR_GREEN : gameinfo.gametype == GAME_Strife ? CR_GOLD : CR_GRAY;
}
FFont * C_GetDefaultHUDFont()
{
return generic_hud? NewSmallFont : SmallFont;
}
void C_InitConback()
{
conback = TexMan.CheckForTexture ("CONBACK", ETextureType::MiscPatch);
@ -782,9 +800,10 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
con_notifylines == 0)
return;
width = DisplayWidth / active_con_scaletext(con_consolefont);
width = DisplayWidth / active_con_scaletext(generic_hud);
FFont *font = *con_consolefont ? NewSmallFont : SmallFont;
FFont *font = hud_generic ? NewSmallFont : SmallFont;
if (font == nullptr) return; // Without an initialized font we cannot handle the message (this is for those which come here before the font system is ready.)
if (AddType == APPENDLINE && Text.Size() > 0 && Text[Text.Size() - 1].PrintLevel == printlevel)
{
@ -897,7 +916,7 @@ int PrintString (int iprintlevel, const char *outline)
I_PrintStr(outline);
conbuffer->AddText(printlevel, outline);
if (vidactive && screen && SmallFont && !(iprintlevel & PRINT_NONOTIFY))
if (vidactive && screen && !(iprintlevel & PRINT_NONOTIFY))
{
NotifyStrings.AddString(printlevel, outline);
}
@ -1067,7 +1086,7 @@ void FNotifyBuffer::Draw()
line = Top;
canskip = true;
FFont *font = *con_consolefont ? NewSmallFont : SmallFont;
FFont *font = hud_generic ? NewSmallFont : SmallFont;
lineadv = font->GetHeight ();
for (unsigned i = 0; i < Text.Size(); ++ i)
@ -1090,11 +1109,7 @@ void FNotifyBuffer::Draw()
else
color = PrintColors[notify.PrintLevel];
if (color == CR_UNTRANSLATED && *con_consolefont)
{
color = C_GetDefaultFontColor();
}
int scale = active_con_scaletext(con_consolefont);
int scale = active_con_scaletext(generic_hud);
if (!center)
screen->DrawText (font, color, 0, line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale,
@ -1103,7 +1118,7 @@ void FNotifyBuffer::Draw()
DTA_Alpha, alpha, TAG_DONE);
else
screen->DrawText (font, color, (screen->GetWidth() -
SmallFont->StringWidth (notify.Text) * scale) / 2 / scale,
font->StringWidth (notify.Text) * scale) / 2 / scale,
line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
@ -1756,16 +1771,7 @@ void C_MidPrint (FFont *font, const char *msg, bool bold)
auto color = (EColorRange)PrintColors[bold? PRINTLEVELS+1 : PRINTLEVELS];
Printf(PRINT_HIGH|PRINT_NONOTIFY, TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", color, console_bar, msg, console_bar);
bool altscale = false;
if (font == nullptr)
{
altscale = con_midconsolefont;
font = altscale ? NewSmallFont : SmallFont;
if (altscale && color == CR_UNTRANSLATED) color = C_GetDefaultFontColor();
}
StatusBar->AttachMessage (Create<DHUDMessage>(font, msg, 1.5f, 0.375f, 0, 0,
color, con_midtime, altscale), MAKE_ID('C','N','T','R'));
StatusBar->AttachMessage (Create<DHUDMessage>(font, msg, 1.5f, 0.375f, 0, 0, color, con_midtime), MAKE_ID('C','N','T','R'));
}
else
{

View File

@ -155,6 +155,16 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize,
}
while (sc.CheckString(","));
}
else if (sc.Compare("DeleteLumps"))
{
sc.MustGetStringName("=");
do
{
sc.MustGetString();
iwad->DeleteLumps.Push(FString(sc.String));
}
while (sc.CheckString(","));
}
else if (sc.Compare("BannerColors"))
{
sc.MustGetStringName("=");

View File

@ -858,9 +858,10 @@ void D_Display ()
screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
if (paused && multiplayer)
{
FFont *font = generic_hud? NewSmallFont : SmallFont;
pstring << ' ' << players[paused - 1].userinfo.GetName();
screen->DrawText(SmallFont, CR_RED,
(screen->GetWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2,
screen->DrawText(font, CR_RED,
(screen->GetWidth() - font->StringWidth(pstring)*CleanXfac) / 2,
(tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
}
}
@ -1075,13 +1076,6 @@ void D_PageDrawer (void)
DTA_BilinearFilter, true,
TAG_DONE);
}
else
{
if (!PageBlank)
{
screen->DrawText (SmallFont, CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE);
}
}
if (Advisory != NULL)
{
screen->DrawTexture (Advisory, 4, 160, DTA_320x200, true, TAG_DONE);

View File

@ -109,6 +109,7 @@ struct FIWADInfo
FString MapInfo; // Base mapinfo to load
TArray<FString> Load; // Wads to be loaded with this one.
TArray<FString> Lumps; // Lump names for identification
TArray<FString> DeleteLumps; // Lumps which must be deleted from the directory.
int flags = 0;
};

View File

@ -253,4 +253,7 @@ EXTERN_CVAR (Int, compatflags2);
// Filters from AddAutoloadFiles(). Used to filter files from archives.
extern FString LumpFilterIWAD;
// These control whether certain items use generic text output instead of game-specific one.
extern bool generic_hud, generic_ui;
#endif

View File

@ -350,7 +350,7 @@ CCMD (weapnext)
// [BC] Option to display the name of the weapon being cycled to.
if ((displaynametags & 2) && StatusBar && SmallFont && SendItemUse)
{
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(SmallFont, SendItemUse->GetTag(),
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(nullptr, SendItemUse->GetTag(),
1.5f, 0.90f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID( 'W', 'E', 'P', 'N' ));
}
if (SendItemUse != players[consoleplayer].ReadyWeapon)
@ -376,7 +376,7 @@ CCMD (weapprev)
// [BC] Option to display the name of the weapon being cycled to.
if ((displaynametags & 2) && StatusBar && SmallFont && SendItemUse)
{
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(SmallFont, SendItemUse->GetTag(),
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(nullptr, SendItemUse->GetTag(),
1.5f, 0.90f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID( 'W', 'E', 'P', 'N' ));
}
if (SendItemUse != players[consoleplayer].ReadyWeapon)
@ -389,7 +389,7 @@ static void DisplayNameTag(AActor *actor)
{
auto tag = actor->GetTag();
if ((displaynametags & 1) && StatusBar && SmallFont)
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(SmallFont, tag,
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(nullptr, tag,
1.5f, 0.80f, 0, 0, (EColorRange)*nametagcolor, 2.f, 0.35f), MAKE_ID('S', 'I', 'N', 'V'));
}

View File

@ -39,6 +39,7 @@
#include "v_video.h"
#include "cmdlib.h"
#include "serializer.h"
#include "doomstat.h"
#include "vm.h"
EXTERN_CVAR(Int, con_scaletext)
@ -128,7 +129,7 @@ void DHUDMessageBase::CallDraw(int bottom, int visibility)
//============================================================================
DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight,
EColorRange textColor, float holdTime, bool altscale)
EColorRange textColor, float holdTime)
{
if (hudwidth == 0 || hudheight == 0)
{
@ -139,7 +140,6 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
// for x range [0.0, 1.0]: Positions center of box
// for x range [1.0, 2.0]: Positions center of box, and centers text inside it
HUDWidth = HUDHeight = 0;
AltScale = altscale;
if (fabs (x) > 2.f)
{
CenterX = true;
@ -197,10 +197,10 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
Top = y;
HoldTics = (int)(holdTime * TICRATE);
Tics = -1; // -1 to compensate for one additional Tick the message will receive.
Font = font? font : generic_hud? NewSmallFont : SmallFont;
TextColor = textColor;
State = 0;
SourceText = copystring (text);
Font = font;
VisibilityFlags = 0;
Style = STYLE_Translucent;
Alpha = 1.;
@ -320,7 +320,7 @@ void DHUDMessage::ResetText (const char *text)
}
else
{
width = SCREENWIDTH / active_con_scaletext(AltScale);
width = SCREENWIDTH / active_con_scaletext();
}
Lines = V_BreakLines (Font, NoWrap ? INT_MAX : width, (uint8_t *)text);
@ -380,7 +380,7 @@ void DHUDMessage::Draw (int bottom, int visibility)
xscale = yscale = 1;
if (HUDWidth == 0)
{
int scale = active_con_scaletext(AltScale);
int scale = active_con_scaletext();
screen_width /= scale;
screen_height /= scale;
bottom /= scale;
@ -484,7 +484,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
{
if (hudheight == 0)
{
int scale = active_con_scaletext(AltScale);
int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,
@ -577,7 +577,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics);
if (hudheight == 0)
{
int scale = active_con_scaletext(AltScale);
int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,
@ -666,7 +666,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
float trans = float(Alpha * Tics / FadeInTics);
if (hudheight == 0)
{
int scale = active_con_scaletext(AltScale);
int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,
@ -837,7 +837,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
{
if (hudheight == 0)
{
int scale = active_con_scaletext(AltScale);
int scale = active_con_scaletext();
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,

View File

@ -84,7 +84,7 @@ class DHUDMessage : public DHUDMessageBase
DECLARE_CLASS (DHUDMessage, DHUDMessageBase)
public:
DHUDMessage (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight,
EColorRange textColor, float holdTime, bool altscale = false);
EColorRange textColor, float holdTime);
virtual void OnDestroy () override;
virtual void Serialize(FSerializer &arc);
@ -140,7 +140,6 @@ protected:
int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords
int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords
bool HandleAspect;
bool AltScale;
EColorRange TextColor;
FFont *Font;
FRenderStyle Style;
@ -207,7 +206,7 @@ class DHUDMessageTypeOnFadeOut : public DHUDMessageFadeOut
DECLARE_CLASS (DHUDMessageTypeOnFadeOut, DHUDMessageFadeOut)
public:
DHUDMessageTypeOnFadeOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight,
EColorRange textColor, float typeTime, float holdTime, float fadeOutTime);
EColorRange textColor, float typeTime, float holdTime, float fadeOutTimee);
virtual void Serialize(FSerializer &arc);
virtual void DoDraw (int linenum, int x, int y, bool clean, int hudheight);
@ -448,6 +447,7 @@ public:
{
return SBarTop;
}
void DoDrawAutomapHUD(int crdefault, int highlight);
//protected:
void DrawPowerups ();

View File

@ -55,7 +55,6 @@
CVAR(Int,hud_althudscale, 0, CVAR_ARCHIVE) // Scale the hud to 640x400?
CVAR(Bool,hud_althud, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD
CVAR(Bool, hud_althudfont, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD
// These are intentionally not the same as in the automap!
CVAR (Bool, hud_showsecrets, true,CVAR_ARCHIVE); // Show secrets on HUD
CVAR (Bool, hud_showmonsters, true,CVAR_ARCHIVE); // Show monster stats on HUD

View File

@ -541,6 +541,131 @@ void DBaseStatusBar::BeginHUD(int resW, int resH, double Alpha, bool forcescaled
fullscreenOffsets = true;
}
//============================================================================
//
// automap HUD common drawer
// This is not called directly to give a status bar the opportunity to
// change the text colors. If you want to do something different,
// override DrawAutomap directly.
//
//============================================================================
void FormatMapName(FLevelLocals *self, int cr, FString *result);
static void DrawAMText(FFont *fnt, int color, const char *text, int vwidth, int vheight, int x, int y)
{
int zerowidth = fnt->GetCharWidth('0');
x += zerowidth / 2;
for (int i = 0; text[i]; i++)
{
int c = text[i];
int width = fnt->GetCharWidth(c);
screen->DrawChar(fnt, color, x, y, c, DTA_KeepRatio, true,
DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, DTA_LeftOffset, width / 2, TAG_DONE);
x += zerowidth;
}
}
void DBaseStatusBar::DoDrawAutomapHUD(int crdefault, int highlight)
{
auto scale = GetUIScale(hud_scale);
auto font = generic_hud ? NewSmallFont : SmallFont;
auto vwidth = screen->GetWidth() / scale;
auto vheight = screen->GetHeight() / scale;
auto fheight = font->GetHeight();
FString textbuffer;
int sec;
int y = 0;
int textdist = 4;
if (am_showtime)
{
sec = Tics2Seconds(primaryLevel->time);
textbuffer.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
DrawAMText(font, crdefault, textbuffer, vwidth, vheight, vwidth - font->GetCharWidth('0') * 8 - textdist, y);
y += fheight;
}
if (am_showtotaltime)
{
sec = Tics2Seconds(primaryLevel->totaltime);
textbuffer.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
DrawAMText(font, crdefault, textbuffer, vwidth, vheight, vwidth - font->GetCharWidth('0') * 8 - textdist, y);
}
if (!deathmatch)
{
y = 0;
if (am_showmonsters)
{
textbuffer.Format("%s\34%c %d/%d", GStrings("AM_MONSTERS"), crdefault + 65, primaryLevel->killed_monsters, primaryLevel->total_monsters);
screen->DrawText(font, highlight, textdist, y, textbuffer, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE);
y += fheight;
}
if (am_showsecrets)
{
textbuffer.Format("%s\34%c %d/%d", GStrings("AM_SECRETS"), crdefault + 65, primaryLevel->found_secrets, primaryLevel->total_secrets);
screen->DrawText(font, highlight, textdist, y, textbuffer, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE);
y += fheight;
}
// Draw item count
if (am_showitems)
{
textbuffer.Format("%s\34%c %d/%d", GStrings("AM_ITEMS"), crdefault + 65, primaryLevel->found_items, primaryLevel->total_items);
screen->DrawText(font, highlight, textdist, y, textbuffer, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE);
y += fheight;
}
}
FormatMapName(primaryLevel, crdefault, &textbuffer);
auto lines = V_BreakLines(font, vwidth - 32, textbuffer, true);
auto numlines = lines.Size();
auto finalwidth = lines.Last().Width;
// calculate the top of the statusbar including any protrusion and transform it from status bar to screen space.
double x = 0, yy = 0, w = HorizontalResolution, h = 0;
StatusbarToRealCoords(x, yy, w, h);
IFVIRTUAL(DBaseStatusBar, GetProtrusion)
{
int prot = 0;
VMValue params[] = { this, double(finalwidth * scale / w) };
VMReturn ret(&prot);
VMCall(func, params, 2, &ret, 1);
h = prot;
}
StatusbarToRealCoords(x, yy, w, h);
// Get the y coordinate for the first line of the map name text.
y = Scale(GetTopOfStatusbar() - int(h), vheight, screen->GetHeight()) - fheight * numlines;
// Draw the texts centered above the status bar.
for (unsigned i = 0; i < numlines; i++)
{
int x = (vwidth - font->StringWidth(lines[i].Text)) / 2;
screen->DrawText(font, highlight, x, y, lines[i].Text, DTA_KeepRatio, true, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE);
y += fheight;
}
}
DEFINE_ACTION_FUNCTION(DBaseStatusBar, DoDrawAutomapHUD)
{
PARAM_SELF_PROLOGUE(DBaseStatusBar);
PARAM_INT(crdefault);
PARAM_INT(highlight);
self->DoDrawAutomapHUD(crdefault, highlight);
return 0;
}
//---------------------------------------------------------------------------
//
// PROC AttachToPlayer
@ -754,7 +879,7 @@ void DBaseStatusBar::ShowPlayerName ()
EColorRange color;
color = (CPlayer == &players[consoleplayer]) ? CR_GOLD : CR_GREEN;
AttachMessage (Create<DHUDMessageFadeOut> (SmallFont, CPlayer->userinfo.GetName(),
AttachMessage (Create<DHUDMessageFadeOut> (nullptr, CPlayer->userinfo.GetName(),
1.5f, 0.92f, 0, 0, color, 2.f, 0.35f), MAKE_ID('P','N','A','M'));
}
@ -1043,15 +1168,16 @@ void DBaseStatusBar::DrawLog ()
if (CPlayer->LogText.IsNotEmpty())
{
// This uses the same scaling as regular HUD messages
auto scale = active_con_scaletext();
auto scale = active_con_scaletext(generic_hud);
hudwidth = SCREENWIDTH / scale;
hudheight = SCREENHEIGHT / scale;
FFont *font = C_GetDefaultHUDFont();
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;
auto lines = V_BreakLines (SmallFont, linelen, GStrings(CPlayer->LogText));
auto lines = V_BreakLines (font, linelen, CPlayer->LogText[0] == '$'? GStrings(CPlayer->LogText.GetChars()+1) : CPlayer->LogText.GetChars());
int height = 20;
for (unsigned i = 0; i < lines.Size(); i++) height += SmallFont->GetHeight () + 1;
for (unsigned i = 0; i < lines.Size(); i++) height += font->GetHeight ();
int x,y,w;
@ -1074,10 +1200,10 @@ void DBaseStatusBar::DrawLog ()
y+=10;
for (const FBrokenLines &line : lines)
{
screen->DrawText (SmallFont, CR_UNTRANSLATED, x, y, line.Text,
screen->DrawText (font, CR_UNTRANSLATED, x, y, line.Text,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
y += SmallFont->GetHeight ()+1;
y += font->GetHeight ();
}
}
}

View File

@ -708,6 +708,15 @@ int FFont::GetCharCode(int code, bool needpic) const
{
return code;
}
// Special handling for the ß which may only exist as lowercase, so for this we need an additional upper -> lower check for all fonts aside from the generic substitution logic.
if (code == 0x1e9e)
{
if (LastChar <= 0xdf && (!needpic || Chars[0xdf - FirstChar].TranslatedPic != nullptr))
{
return 0xdf;
}
}
// Use different substitution logic based on the fonts content:
// In a font which has both upper and lower case, prefer unaccented small characters over capital ones.
@ -780,23 +789,15 @@ int FFont::GetCharCode(int code, bool needpic) const
FTexture *FFont::GetChar (int code, int translation, int *const width, bool *redirected) const
{
code = GetCharCode(code, false);
code = GetCharCode(code, true);
int xmove = SpaceWidth;
if (code >= 0)
{
code -= FirstChar;
xmove = Chars[code].XMove;
if (Chars[code].TranslatedPic == nullptr)
{
code = GetCharCode(code + FirstChar, true);
if (code >= 0)
{
code -= FirstChar;
xmove = Chars[code].XMove;
}
}
}
if (width != nullptr)
{
*width = xmove;
@ -827,8 +828,9 @@ FTexture *FFont::GetChar (int code, int translation, int *const width, bool *red
int FFont::GetCharWidth (int code) const
{
code = GetCharCode(code, false);
return (code < 0) ? SpaceWidth : Chars[code - FirstChar].XMove;
code = GetCharCode(code, true);
if (code >= 0) return Chars[code - FirstChar].XMove;
return SpaceWidth;
}
//==========================================================================

View File

@ -808,6 +808,7 @@ int stripaccent(int code)
return 'z';
if (code == 0x9f) // Latin capital letter Y with diaeresis
return 'Y';
if (code == 0xab || code == 0xbb) return '"'; // typographic quotation marks.
if (code == 0xff) // Latin small letter Y with diaeresis
return 'y';
// Every other accented character has the high two bits set.
@ -857,10 +858,53 @@ int stripaccent(int code)
static const uint16_t u200map[] = {0xc4, 0xe4, 0xc2, 0xe2, 0xcb, 0xeb, 0xca, 0xea, 0xcf, 0xef, 0xce, 0xee, 0xd6, 0xf6, 0xd4, 0xe4, 'R', 'r', 'R', 'r', 0xdc, 0xfc, 0xdb, 0xfb, 0x15e, 0x15f, 0x162, 0x163};
return u200map[code - 0x200];
}
else if (code == 0x201d)
else switch (code)
{
// Map the typographic upper quotation mark to the generic form
code = '"';
case 0x2014:
return '-'; // long hyphen
case 0x201c:
case 0x201d:
case 0x201e:
return '"'; // typographic quotation marks
// Cyrillic characters with equivalents in the Latin alphabet.
case 0x400:
return 0xc8;
case 0x401:
return 0xcb;
case 0x405:
return 'S';
case 0x406:
return 'I';
case 0x407:
return 0xcf;
case 0x408:
return 'J';
case 0x450:
return 0xe8;
case 0x451:
return 0xeb;
case 0x455:
return 's';
case 0x456:
return 'i';
case 0x457:
return 0xef;
case 0x458:
return 'j';
}
// skip the rest of Latin characters because none of them are relevant for modern languages.

View File

@ -176,4 +176,8 @@ EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int
FFont *V_GetFont(const char *fontname, const char *fontlumpname = nullptr);
void V_InitFontColors();
EColorRange C_GetDefaultFontColor();
FFont * C_GetDefaultHUDFont();
#endif //__V_FONT_H__

View File

@ -905,7 +905,6 @@ void FWadCollection::RenameSprites ()
LumpInfo[i].lump->Name[0] = 0;
}
}
}
}
}

View File

@ -253,17 +253,34 @@ void DIntermissionScreenText::Init(FIntermissionAction *desc, bool first)
if (mText[0] == '$') mText = GStrings(&mText[1]);
mTextSpeed = static_cast<FIntermissionActionTextscreen*>(desc)->mTextSpeed;
mTextX = static_cast<FIntermissionActionTextscreen*>(desc)->mTextX;
bool usesDefault = mTextX < 0;
usesDefault = mTextX < 0;
if (mTextX < 0) mTextX =gameinfo.TextScreenX;
mTextY = static_cast<FIntermissionActionTextscreen*>(desc)->mTextY;
if (mTextY < 0) mTextY =gameinfo.TextScreenY;
// If the text is too wide, center it so that it works better on widescreen displays.
// On 4:3 it'd still be cut off, though.
int width = SmallFont->StringWidth(mText);
if (usesDefault && mTextX + width > 320 - mTextX)
if (!generic_ui)
{
mTextX = (320 - width) / 2;
// Todo: Split too long texts
// If the text is too wide, center it so that it works better on widescreen displays.
// On 4:3 it'd still be cut off, though.
int width = SmallFont->StringWidth(mText);
if (usesDefault && mTextX + width > 320 - mTextX)
{
mTextX = (320 - width) / 2;
}
}
else
{
// Todo: Split too long texts
mTextX *= 2;
mTextY *= 2;
int width = NewSmallFont->StringWidth(mText);
if (usesDefault && mTextX + width > 640 - mTextX)
{
mTextX = (640 - width) / 2;
}
}
@ -298,45 +315,59 @@ void DIntermissionScreenText::Drawer ()
int c;
const FRemapTable *range;
const uint8_t *ch = (const uint8_t*)mText.GetChars();
const int kerning = SmallFont->GetDefaultKerning();
// Count number of rows in this text. Since it does not word-wrap, we just count
// line feed characters.
int numrows;
auto font = generic_ui ? NewSmallFont : SmallFont;
auto fontscale = generic_ui ? MIN(screen->GetWidth()/640, screen->GetHeight()/400) : MIN(screen->GetWidth()/400, screen->GetHeight() / 250);
int cleanwidth = screen->GetWidth() / fontscale;
int cleanheight = screen->GetHeight() / fontscale;
int refwidth = generic_ui ? 640 : 320;
int refheight = generic_ui ? 400 : 200;
const int kerning = font->GetDefaultKerning();
for (numrows = 1, c = 0; ch[c] != '\0'; ++c)
{
numrows += (ch[c] == '\n');
}
int rowheight = SmallFont->GetHeight() * CleanYfac;
int rowpadding = (gameinfo.gametype & (GAME_DoomStrifeChex) ? 3 : -1) * CleanYfac;
int rowheight = font->GetHeight() * fontscale;
int rowpadding = (generic_ui? 2 : ((gameinfo.gametype & (GAME_DoomStrifeChex) ? 3 : -1))) * fontscale;
int cx = (mTextX - 160)*CleanXfac + screen->GetWidth() / 2;
int cy = (mTextY - 100)*CleanYfac + screen->GetHeight() / 2;
int cx = (mTextX - refwidth/2) * fontscale + screen->GetWidth() / 2;
int cy = (mTextY - refheight/2) * fontscale + screen->GetHeight() / 2;
cx = MAX<int>(0, cx);
int startx = cx;
// Does this text fall off the end of the screen? If so, try to eliminate some margins first.
while (rowpadding > 0 && cy + numrows * (rowheight + rowpadding) - rowpadding > screen->GetHeight())
if (usesDefault)
{
rowpadding--;
}
// If it's still off the bottom, try to center it vertically.
if (cy + numrows * (rowheight + rowpadding) - rowpadding > screen->GetHeight())
{
cy = (screen->GetHeight() - (numrows * (rowheight + rowpadding) - rowpadding)) / 2;
// If it's off the top now, you're screwed. It's too tall to fit.
if (cy < 0)
int allheight;
while ((allheight = numrows * (rowheight + rowpadding)), allheight > screen->GetHeight() && rowpadding > 0)
{
cy = 0;
rowpadding--;
}
allheight = numrows * (rowheight + rowpadding);
if (screen->GetHeight() - cy - allheight < cy)
{
cy = (screen->GetHeight() - allheight) / 2;
if (cy < 0) cy = 0;
}
}
else
{
// Does this text fall off the end of the screen? If so, try to eliminate some margins first.
while (rowpadding > 0 && cy + numrows * (rowheight + rowpadding) - rowpadding > screen->GetHeight())
{
rowpadding--;
}
// If it's still off the bottom, you are screwed if the origin is fixed.
}
rowheight += rowpadding;
// draw some of the text onto the screen
count = (mTicker - mTextDelay) / mTextSpeed;
range = SmallFont->GetColorTranslation (mTextColor);
range = font->GetColorTranslation (mTextColor);
for ( ; count > 0 ; count-- )
{
@ -350,13 +381,13 @@ void DIntermissionScreenText::Drawer ()
continue;
}
pic = SmallFont->GetChar (c, mTextColor, &w);
pic = font->GetChar (c, mTextColor, &w);
w += kerning;
w *= CleanXfac;
w *= fontscale;
if (cx + w > SCREENWIDTH)
continue;
screen->DrawChar(SmallFont, mTextColor, cx, cy, c, DTA_CleanNoMove, true, TAG_DONE);
screen->DrawChar(font, mTextColor, cx/fontscale, cy/fontscale, c, DTA_KeepRatio, true, DTA_VirtualWidth, cleanwidth, DTA_VirtualHeight, cleanheight, TAG_DONE);
cx += w;
}
}
@ -542,9 +573,10 @@ void DIntermissionScreenCast::Drawer ()
const char *name = mName;
if (name != NULL)
{
auto font = generic_ui ? NewSmallFont : SmallFont;
if (*name == '$') name = GStrings(name+1);
screen->DrawText (SmallFont, CR_UNTRANSLATED,
(SCREENWIDTH - SmallFont->StringWidth (name) * CleanXfac)/2,
screen->DrawText (font, CR_UNTRANSLATED,
(SCREENWIDTH - font->StringWidth (name) * CleanXfac)/2,
(SCREENHEIGHT * 180) / 200,
name,
DTA_CleanNoMove, true, TAG_DONE);
@ -963,3 +995,41 @@ void F_AdvanceIntermission()
}
}
#include "c_dispatch.h"
CCMD(measureintermissions)
{
static const char *intermissions[] = {
"E1TEXT", "E2TEXT", "E3TEXT", "E4TEXT",
"C1TEXT", "C2TEXT", "C3TEXT", "C4TEXT", "C5TEXT",
"P1TEXT", "P2TEXT", "P3TEXT", "P4TEXT", "P5TEXT",
"T1TEXT", "T2TEXT", "T3TEXT", "T4TEXT", "T5TEXT", "NERVETEXT",
"HE1TEXT", "HE2TEXT", "HE3TEXT", "HE4TEXT", "HE5TEXT",
"TXT_HEXEN_CLUS1MSG", "TXT_HEXEN_CLUS2MSG","TXT_HEXEN_CLUS3MSG","TXT_HEXEN_CLUS4MSG",
"TXT_HEXEN_WIN1MSG", "TXT_HEXEN_WIN2MSG","TXT_HEXEN_WIN3MSG",
"TXT_HEXDD_CLUS1MSG", "TXT_HEXDD_CLUS2MSG",
"TXT_HEXDD_WIN1MSG", "TXT_HEXDD_WIN2MSG","TXT_HEXDD_WIN3MSG" };
static const char *languages[] = { "", "cz", "de", "eng", "es", "esm", "fr", "hu", "it", "pl", "pt", "ro", "ru", "sr" };
for (auto l : languages)
{
int langid = *l ? MAKE_ID(l[0], l[1], l[2], 0) : FStringTable::default_table;
for (auto t : intermissions)
{
auto text = GStrings.GetLanguageString(t, langid);
if (text)
{
auto ch = text;
int numrows, c;
for (numrows = 1, c = 0; ch[c] != '\0'; ++c)
{
numrows += (ch[c] == '\n');
}
int width = SmallFont->StringWidth(text);
if (width > 360 || numrows > 20)
Printf("%s, %s: %d x %d\n", t, l, width, numrows);
}
}
}
}

View File

@ -8,6 +8,7 @@
#include "s_sound.h"
#include "v_font.h"
#include "g_game.h"
#include "v_text.h"
struct event_t;
@ -214,6 +215,10 @@ class DIntermissionScreenText : public DIntermissionScreen
int mTextDelay;
int mTextLen;
EColorRange mTextColor;
bool usesDefault;
void MeasureText(bool posisfixed);
FString RemoveLineFeeds(const char *text);
public:

View File

@ -8662,18 +8662,17 @@ scriptwait:
color = CLAMPCOLOR(Stack[optstart-4]);
}
FFont *font = activefont ? activefont : SmallFont;
switch (type & 0xFF)
{
default: // normal
alpha = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 1.f;
msg = Create<DHUDMessage> (font, work, x, y, hudwidth, hudheight, color, holdTime);
msg = Create<DHUDMessage> (activefont, work, x, y, hudwidth, hudheight, color, holdTime);
break;
case 1: // fade out
{
float fadeTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
alpha = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 1.f;
msg = Create<DHUDMessageFadeOut> (font, work, x, y, hudwidth, hudheight, color, holdTime, fadeTime);
msg = Create<DHUDMessageFadeOut> (activefont, work, x, y, hudwidth, hudheight, color, holdTime, fadeTime);
}
break;
case 2: // type on, then fade out
@ -8681,7 +8680,7 @@ scriptwait:
float typeTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.05f;
float fadeTime = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 0.5f;
alpha = (optstart < sp-2) ? ACSToFloat(Stack[optstart+2]) : 1.f;
msg = Create<DHUDMessageTypeOnFadeOut> (font, work, x, y, hudwidth, hudheight, color, typeTime, holdTime, fadeTime);
msg = Create<DHUDMessageTypeOnFadeOut> (activefont, work, x, y, hudwidth, hudheight, color, typeTime, holdTime, fadeTime);
}
break;
case 3: // fade in, then fade out
@ -8689,7 +8688,7 @@ scriptwait:
float inTime = (optstart < sp) ? ACSToFloat(Stack[optstart]) : 0.5f;
float outTime = (optstart < sp-1) ? ACSToFloat(Stack[optstart+1]) : 0.5f;
alpha = (optstart < sp-2) ? ACSToFloat(Stack[optstart + 2]) : 1.f;
msg = Create<DHUDMessageFadeInOut> (font, work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime);
msg = Create<DHUDMessageFadeInOut> (activefont, work, x, y, hudwidth, hudheight, color, holdTime, inTime, outTime);
}
break;
}

View File

@ -700,7 +700,7 @@ static void TerminalResponse (const char *str)
// merchants can tell you something like this but continue to show
// their dialogue screen. I think most other conversations use this
// only as a response for terminating the dialogue.
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(SmallFont, str,
StatusBar->AttachMessage(Create<DHUDMessageFadeOut>(nullptr, str,
float(CleanWidth/2) + 0.4f, float(ConversationMenuY - 110 + CleanHeight/2), CleanWidth, -CleanHeight,
CR_UNTRANSLATED, 3.f, 1.f), MAKE_ID('T','A','L','K'));
}

View File

@ -412,7 +412,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
PronounMessage (GStrings("SPREEKILLSELF"), buff,
player->userinfo.GetGender(), player->userinfo.GetName(),
player->userinfo.GetName());
StatusBar->AttachMessage (Create<DHUDMessageFadeOut>(SmallFont, buff,
StatusBar->AttachMessage (Create<DHUDMessageFadeOut>(nullptr, buff,
1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R'));
}
}
@ -469,7 +469,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
{
PronounMessage (GStrings("SPREEOVER"), buff, player->userinfo.GetGender(),
player->userinfo.GetName(), source->player->userinfo.GetName());
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (SmallFont, buff,
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (nullptr, buff,
1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R'));
}
}
@ -479,7 +479,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
{
PronounMessage (spreemsg, buff, player->userinfo.GetGender(),
player->userinfo.GetName(), source->player->userinfo.GetName());
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (SmallFont, buff,
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (nullptr, buff,
1.5f, 0.2f, 0, 0, CR_WHITE, 3.f, 0.5f), MAKE_ID('K','S','P','R'));
}
}
@ -529,7 +529,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
{
PronounMessage (multimsg, buff, player->userinfo.GetGender(),
player->userinfo.GetName(), source->player->userinfo.GetName());
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (SmallFont, buff,
StatusBar->AttachMessage (Create<DHUDMessageFadeOut> (nullptr, buff,
1.5f, 0.8f, 0, 0, CR_RED, 3.f, 0.5f), MAKE_ID('M','K','I','L'));
}
}

View File

@ -1210,6 +1210,11 @@ class GLDefsParser
FTextureID no = TexMan.CheckForTexture(sc.String, type, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_Overridable);
FTexture *tex = TexMan.GetTexture(no);
if (tex == nullptr)
{
sc.ScriptMessage("Material definition refers nonexistent texture '%s'\n", sc.String);
}
sc.MustGetToken('{');
while (!sc.CheckToken('}'))
{
@ -1266,26 +1271,29 @@ class GLDefsParser
}
}
sc.MustGetString();
bool okay = false;
for (int i = 0; i < MAX_CUSTOM_HW_SHADER_TEXTURES; i++)
if (tex)
{
if (!tex->CustomShaderTextures[i])
bool okay = false;
for (int i = 0; i < MAX_CUSTOM_HW_SHADER_TEXTURES; i++)
{
tex->CustomShaderTextures[i] = TexMan.FindTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (!tex->CustomShaderTextures[i])
{
sc.ScriptError("Custom hardware shader texture '%s' not found in texture '%s'\n", sc.String, tex ? tex->Name.GetChars() : "(null)");
}
tex->CustomShaderTextures[i] = TexMan.FindTexture(sc.String, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (!tex->CustomShaderTextures[i])
{
sc.ScriptError("Custom hardware shader texture '%s' not found in texture '%s'\n", sc.String, tex->Name.GetChars());
}
texNameList.Push(textureName);
texNameIndex.Push(i);
okay = true;
break;
texNameList.Push(textureName);
texNameIndex.Push(i);
okay = true;
break;
}
}
if (!okay)
{
sc.ScriptError("Error: out of texture units in texture '%s'", tex->Name.GetChars());
}
}
if (!okay)
{
sc.ScriptError("Error: out of texture units in texture '%s'", tex ? tex->Name.GetChars() : "(null)");
}
}
else if (sc.Compare("define"))

View File

@ -91,7 +91,7 @@ int GetUIScale(int altval)
int GetConScale(int altval)
{
int scaleval;
if (altval > 0) scaleval = altval;
if (altval > 0) scaleval = (altval+1) / 2;
else if (uiscale == 0)
{
// Default should try to scale to 640x400
@ -99,7 +99,7 @@ int GetConScale(int altval)
int hscale = screen->GetWidth() / 1280;
scaleval = clamp(vscale, 1, hscale);
}
else scaleval = uiscale / 2;
else scaleval = (uiscale+1) / 2;
// block scales that result in something larger than the current screen.
int vmax = screen->GetHeight() / 400;

View File

@ -181,6 +181,10 @@ void DFrameBuffer::DrawChar (FFont *font, int normalcolor, double x, double y, i
int dummy;
bool redirected;
// Workaround until this can be automated.
if (font == NewSmallFont && normalcolor == CR_UNTRANSLATED)
normalcolor = C_GetDefaultFontColor();
if (NULL != (pic = font->GetChar (character, normalcolor, &dummy, &redirected)))
{
DrawParms parms;
@ -211,6 +215,11 @@ void DFrameBuffer::DrawChar(FFont *font, int normalcolor, double x, double y, in
int dummy;
bool redirected;
// Workaround until this can be automated.
if (font == NewSmallFont && normalcolor == CR_UNTRANSLATED)
normalcolor = C_GetDefaultFontColor();
if (NULL != (pic = font->GetChar(character, normalcolor, &dummy, &redirected)))
{
DrawParms parms;
@ -265,6 +274,10 @@ void DFrameBuffer::DrawTextCommon(FFont *font, int normalcolor, double x, double
int kerning;
FTexture *pic;
// Workaround until this can be automated.
if (font == NewSmallFont && normalcolor == CR_UNTRANSLATED)
normalcolor = C_GetDefaultFontColor();
if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
parms.celly *= parms.scaley;

View File

@ -2589,7 +2589,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetSpotState, GetSpotState)
EXTERN_CVAR(Int, am_showmaplabel)
static void FormatMapName(FLevelLocals *self, int cr, FString *result)
void FormatMapName(FLevelLocals *self, int cr, FString *result)
{
char mapnamecolor[3] = { '\34', char(cr + 'A'), 0 };

View File

@ -926,3 +926,5 @@ DEFINE_GLOBAL(CleanXfac_1)
DEFINE_GLOBAL(CleanYfac_1)
DEFINE_GLOBAL(CleanWidth_1)
DEFINE_GLOBAL(CleanHeight_1)
DEFINE_GLOBAL(generic_hud)
DEFINE_GLOBAL(generic_ui)

View File

@ -82,6 +82,7 @@ IWad
Mapinfo = "mapinfo/hacx.txt"
MustContain = "MAP01", "HACX-R"
BannerColors = "00 00 a8", "a8 a8 a8"
Load = "hacx_gzdoom_stuff.pk3"
}
IWad
@ -183,6 +184,7 @@ IWad
Compatibility = "Poly1"
MustContain = "TITLE", "MAP01", "MAP40", "WINNOWR"
BannerColors = "f0 f0 f0", "6b 3c 18"
DeleteLumps = "FONTB01", "FONTB02", "FONTB03", "FONTB04", "FONTB06", "FONTB08", "FONTB09", "FONTB10", "FONTB11", "FONTB27", "FONTB28", "FONTB29", "FONTB30"
}
IWad
@ -207,6 +209,7 @@ IWad
Compatibility = "Shareware"
MustContain = "TITLE", "MAP01", "WINNOWR"
BannerColors = "f0 f0 f0", "6b 3c 18"
DeleteLumps = "FONTB01", "FONTB02", "FONTB03", "FONTB04", "FONTB06", "FONTB08", "FONTB09", "FONTB10", "FONTB11", "FONTB27", "FONTB28", "FONTB29", "FONTB30"
}
IWad
@ -232,6 +235,7 @@ IWad
Compatibility = "Extended"
MustContain = "E1M1", "E2M1", "TITLE", "MUS_E1M1", "EXTENDED"
BannerColors = "fc fc 00", "a8 00 00"
DeleteLumps = "FONTB01", "FONTB02", "FONTB03", "FONTB04", "FONTB06", "FONTB08", "FONTB09", "FONTB10", "FONTB11", "FONTB27", "FONTB28", "FONTB29", "FONTB30"
}
IWad
@ -244,6 +248,7 @@ IWad
Mapinfo = "mapinfo/heretic.txt"
MustContain = "E1M1", "E2M1", "TITLE", "MUS_E1M1"
BannerColors = "fc fc 00", "a8 00 00"
DeleteLumps = "FONTB01", "FONTB02", "FONTB03", "FONTB04", "FONTB06", "FONTB08", "FONTB09", "FONTB10", "FONTB11", "FONTB27", "FONTB28", "FONTB29", "FONTB30"
}
IWad
@ -255,6 +260,7 @@ IWad
Compatibility = "Shareware"
MustContain = "E1M1", "TITLE", "MUS_E1M1"
BannerColors = "fc fc 00", "a8 00 00"
DeleteLumps = "FONTB01", "FONTB02", "FONTB03", "FONTB04", "FONTB06", "FONTB08", "FONTB09", "FONTB10", "FONTB11", "FONTB27", "FONTB28", "FONTB29", "FONTB30"
}
IWad

File diff suppressed because it is too large Load Diff

View File

@ -64,9 +64,9 @@ gameinfo
textscreeny = 10
defaultendsequence = "Inter_Pic1"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "BigFont", "green"
statscreen_enteringfont = "BigFont", "green"
statscreen_mapnamefont = "*BigFont"
statscreen_finishedfont = "*BigFont", "green"
statscreen_enteringfont = "*BigFont", "green"
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"

View File

@ -64,9 +64,9 @@ gameinfo
textscreeny = 10
defaultendsequence = "Inter_Cast"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "BigFont", "red"
statscreen_enteringfont = "BigFont", "red"
statscreen_mapnamefont = "*BigFont"
statscreen_finishedfont = "*BigFont", "red"
statscreen_enteringfont = "*BigFont", "red"
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"

View File

@ -63,9 +63,9 @@ gameinfo
textscreeny = 5
defaultendsequence = "Inter_Pic1"
maparrow = "maparrows/dagger.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "SmallFont"
statscreen_enteringfont = "SmallFont"
statscreen_mapnamefont = "*BigFont"
statscreen_finishedfont = "*SmallFont"
statscreen_enteringfont = "*SmallFont"
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"

View File

@ -61,9 +61,9 @@ gameinfo
textscreeny = 5
defaultendsequence = "Inter_Chess"
maparrow = "maparrows/dagger.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "SmallFont"
statscreen_enteringfont = "SmallFont"
statscreen_mapnamefont = "*BigFont"
statscreen_finishedfont = "*SmallFont"
statscreen_enteringfont = "*SmallFont"
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"

View File

@ -54,9 +54,9 @@ gameinfo
textscreeny = 10
defaultendsequence = "Inter_Cast"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "BigFont"
statscreen_enteringfont = "BigFont"
statscreen_mapnamefont = "*BigFont"
statscreen_finishedfont = "*BigFont"
statscreen_enteringfont = "*BigFont"
messageboxclass = "MessageBoxMenu"
}

View File

@ -62,9 +62,9 @@ gameinfo
textscreeny = 10
defaultendsequence = "Inter_Strife"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont"
statscreen_finishedfont = "BigFont", "white"
statscreen_enteringfont = "BigFont", "white"
statscreen_mapnamefont = "*BigFont"
statscreen_finishedfont = "*BigFont", "white"
statscreen_enteringfont = "*BigFont", "white"
statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"

View File

@ -45,6 +45,8 @@ struct _ native // These are the global variables, the struct is only here to av
deprecated("3.8") native readonly bool globalfreeze;
native int LocalViewPitch;
native readonly @MusPlayingInfo musplaying;
native readonly bool generic_hud;
native readonly bool generic_ui;
// sandbox state in multi-level setups:

View File

@ -83,6 +83,13 @@ class ConversationMenu : Menu
int mSelection;
int ConversationPauseTic;
int LineHeight;
int ReplyLineHeight;
Font displayFont;
int displayWidth;
int displayHeight;
int fontScale;
int refwidth;
int refheight;
int SpeechWidth;
int ReplyWidth;
@ -105,10 +112,32 @@ class ConversationMenu : Menu
mShowGold = false;
ConversationPauseTic = gametic + 20;
DontDim = true;
if (!generic_ui)
{
displayFont = SmallFont;
displayWidth = CleanWidth;
displayHeight = CleanHeight;
fontScale = CleanXfac;
refwidth = 320;
refheight = 200;
ReplyWidth = 320-50-10;
SpeechWidth = screen.GetWidth()/CleanXfac - 24*2;
ReplyLineHeight = LineHeight = displayFont.GetHeight();
}
else
{
displayFont = NewSmallFont;
fontScale = (CleanXfac+1) / 2;
displayWidth = screen.GetWidth() / fontScale;
displayHeight = screen.GetHeight() / fontScale;
refwidth = 640;
refheight = 400;
ReplyWidth = 640-100-20;
SpeechWidth = screen.GetWidth()/fontScale - (24*2 * CleanXfac / fontScale);
LineHeight = displayFont.GetHeight() + 2;
ReplyLineHeight = LineHeight * fontScale / CleanYfac;
}
ReplyWidth = 320-50-10;
SpeechWidth = screen.GetWidth()/CleanXfac - 24*2;
LineHeight = SmallFont.GetHeight();
FormatSpeakerMessage();
return FormatReplies(activereply);
@ -145,7 +174,7 @@ class ConversationMenu : Menu
let amount = String.Format("%u", reply.PrintAmount);
ReplyText.Replace("%u", amount);
}
let ReplyLines = SmallFont.BreakLines (ReplyText, ReplyWidth);
let ReplyLines = displayFont.BreakLines (ReplyText, ReplyWidth);
mResponses.Push(mResponseLines.Size());
for (j = 0; j < ReplyLines.Count(); ++j)
@ -175,8 +204,8 @@ class ConversationMenu : Menu
mResponseLines.Push(goodbyestr);
// Determine where the top of the reply list should be positioned.
mYpos = MIN (140, 192 - mResponseLines.Size() * LineHeight);
i = 44 + mResponseLines.Size() * LineHeight;
mYpos = MIN (140, 192 - mResponseLines.Size() * ReplyLineHeight);
i = 44 + mResponseLines.Size() * ReplyLineHeight;
if (mYpos - 100 < i - screen.GetHeight() / CleanYfac / 2)
{
mYpos = i - screen.GetHeight() / CleanYfac / 2 + 100;
@ -214,7 +243,7 @@ class ConversationMenu : Menu
{
toSay = ".";
}
mDialogueLines = SmallFont.BreakLines(toSay, SpeechWidth);
mDialogueLines = displayFont.BreakLines(toSay, SpeechWidth);
}
//=============================================================================
@ -309,10 +338,10 @@ class ConversationMenu : Menu
int fh = LineHeight;
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160;
y = ((y - (screen.GetHeight() / 2)) / CleanYfac) + 100;
x = ((x - (screen.GetWidth() / 2)) / fontScale) + refWidth/2;
y = ((y - (screen.GetHeight() / 2)) / fontScale) + refHeight/2;
if (x >= 24 && x <= 320-24 && y >= mYpos && y < mYpos + fh * mResponseLines.Size())
if (x >= 24 && x <= refWidth-24 && y >= mYpos && y < mYpos + fh * mResponseLines.Size())
{
sel = (y - mYpos) / fh;
for(int i = 0; i < mResponses.Size(); i++)
@ -383,7 +412,7 @@ class ConversationMenu : Menu
virtual void DrawSpeakerText(bool dimbg)
{
String speakerName;
int linesize = LineHeight * CleanYfac;
int linesize = LineHeight * fontScale;
int cnt = mDialogueLines.Count();
// Who is talking to you?
@ -413,13 +442,13 @@ class ConversationMenu : Menu
if (speakerName.Length() > 0)
{
screen.DrawText(SmallFont, Font.CR_WHITE, x, y, speakerName, DTA_CleanNoMove, true);
screen.DrawText(displayFont, Font.CR_WHITE, x / fontScale, y / fontScale, speakerName, DTA_KeepRatio, true, DTA_VirtualWidth, displayWidth, DTA_VirtualHeight, displayHeight);
y += linesize * 3 / 2;
}
x = 24 * screen.GetWidth() / 320;
for (int i = 0; i < cnt; ++i)
{
screen.DrawText(SmallFont, Font.CR_UNTRANSLATED, x, y, mDialogueLines.StringAt(i), DTA_CleanNoMove, true);
screen.DrawText(displayFont, Font.CR_UNTRANSLATED, x / fontScale, y / fontScale, mDialogueLines.StringAt(i), DTA_KeepRatio, true, DTA_VirtualWidth, displayWidth, DTA_VirtualHeight, displayHeight);
y += linesize;
}
}
@ -435,18 +464,22 @@ class ConversationMenu : Menu
{
// Dim the screen behind the PC's choices.
screen.Dim(0, 0.45, (24 - 160) * CleanXfac + screen.GetWidth() / 2, (mYpos - 2 - 100) * CleanYfac + screen.GetHeight() / 2,
272 * CleanXfac, MIN(mResponseLines.Size() * LineHeight + 4, 200 - mYpos) * CleanYfac);
272 * CleanXfac, MIN(mResponseLines.Size() * ReplyLineHeight + 4, 200 - mYpos) * CleanYfac);
int y = mYpos;
int fontheight = LineHeight;
int response = 0;
for (int i = 0; i < mResponseLines.Size(); i++)
{
int width = SmallFont.StringWidth(mResponseLines[i]);
int width = displayFont.StringWidth(mResponseLines[i]);
int x = 64;
screen.DrawText(SmallFont, Font.CR_GREEN, x, y, mResponseLines[i], DTA_Clean, true);
double sx = (x - 160.0) * CleanXfac + (screen.GetWidth() * 0.5);
double sy = (y - 100.0) * CleanYfac + (screen.GetHeight() * 0.5);
screen.DrawText(displayFont, Font.CR_GREEN, sx / fontScale, sy / fontScale, mResponseLines[i], DTA_KeepRatio, true, DTA_VirtualWidth, displayWidth, DTA_VirtualHeight, displayHeight);
if (i == mResponses[response])
{
@ -454,19 +487,20 @@ class ConversationMenu : Menu
response++;
tbuf = String.Format("%d.", response);
x = 50 - SmallFont.StringWidth(tbuf);
screen.DrawText(SmallFont, Font.CR_GREY, x, y, tbuf, DTA_Clean, true);
x = 50 - displayFont.StringWidth(tbuf);
sx = (x - 160.0) * CleanXfac + (screen.GetWidth() * 0.5);
screen.DrawText(displayFont, Font.CR_GREY, sx / fontScale, sy / fontScale, tbuf, DTA_KeepRatio, true, DTA_VirtualWidth, displayWidth, DTA_VirtualHeight, displayHeight);
if (response == mSelection + 1)
{
int colr = ((MenuTime() % 8) < 4) || GetCurrentMenu() != self ? Font.CR_RED : Font.CR_GREY;
x = (50 + 3 - 160) * CleanXfac + screen.GetWidth() / 2;
int yy = (y + fontheight / 2 - 5 - 100) * CleanYfac + screen.GetHeight() / 2;
int yy = (y + ReplyLineHeight / 2 - 5 - 100) * CleanYfac + screen.GetHeight() / 2;
screen.DrawText(ConFont, colr, x, yy, "\xd", DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac);
}
}
y += fontheight;
y += ReplyLineHeight;
}
}

View File

@ -89,6 +89,8 @@ class ListMenuItemStaticPatch : ListMenuItem
return;
}
let font = generic_ui? NewSmallFont : mFont;
double x = mXpos;
Vector2 vec = TexMan.GetScaledSize(mTexture);
if (mYpos >= 0)
@ -100,8 +102,8 @@ class ListMenuItemStaticPatch : ListMenuItem
}
else
{
if (mCentered) x -= mFont.StringWidth(mSubstitute)/2;
screen.DrawText(mFont, mColor, x, mYpos, mSubstitute, DTA_Clean, true);
if (mCentered) x -= font.StringWidth(mSubstitute)/2;
screen.DrawText(font, mColor, x, mYpos, mSubstitute, DTA_Clean, true);
}
}
else
@ -114,8 +116,8 @@ class ListMenuItemStaticPatch : ListMenuItem
}
else
{
if (mCentered) x -= (mFont.StringWidth(mSubstitute) * CleanXfac)/2;
screen.DrawText(mFont, mColor, x, mYpos, mSubstitute, DTA_CleanNoMove, true);
if (mCentered) x -= (font.StringWidth(mSubstitute) * CleanXfac)/2;
screen.DrawText(font, mColor, x, mYpos, mSubstitute, DTA_CleanNoMove, true);
}
}
}
@ -164,18 +166,20 @@ class ListMenuItemStaticText : ListMenuItem
{
if (mText.Length() != 0)
{
let font = generic_ui? NewSmallFont : mFont;
String text = Stringtable.Localize(mText);
if (mYpos >= 0)
{
double x = mXpos;
if (mCentered) x -= mFont.StringWidth(text)/2;
screen.DrawText(mFont, mColor, x, mYpos, text, DTA_Clean, true);
if (mCentered) x -= font.StringWidth(text)/2;
screen.DrawText(font, mColor, x, mYpos, text, DTA_Clean, true);
}
else
{
double x = (mXpos - 160) * CleanXfac + (Screen.GetWidth() >> 1);
if (mCentered) x -= (mFont.StringWidth(text) * CleanXfac)/2;
screen.DrawText (mFont, mColor, x, -mYpos*CleanYfac, text, DTA_CleanNoMove, true);
if (mCentered) x -= (font.StringWidth(text) * CleanXfac)/2;
screen.DrawText (font, mColor, x, -mYpos*CleanYfac, text, DTA_CleanNoMove, true);
}
}
}
@ -285,12 +289,14 @@ class ListMenuItemTextItem : ListMenuItemSelectable
override void Drawer(bool selected)
{
screen.DrawText(mFont, selected ? mColorSelected : mColor, mXpos, mYpos, mText, DTA_Clean, true);
let font = generic_ui? NewSmallFont : mFont;
screen.DrawText(font, selected ? mColorSelected : mColor, mXpos, mYpos, mText, DTA_Clean, true);
}
override int GetWidth()
{
return max(1, mFont.StringWidth(StringTable.Localize(mText)));
let font = generic_ui? NewSmallFont : mFont;
return max(1, font.StringWidth(StringTable.Localize(mText)));
}
}

View File

@ -41,6 +41,10 @@ class MessageBoxMenu : Menu
int mMouseLeft, mMouseRight, mMouseY;
Name mAction;
Font textFont, arrowFont;
int destWidth, destHeight;
String selector;
native static void CallHandler(voidptr hnd);
@ -57,11 +61,29 @@ class MessageBoxMenu : Menu
messageSelection = 0;
mMouseLeft = 140;
mMouseY = 0x80000000;
int mr1 = 170 + SmallFont.StringWidth(Stringtable.Localize("$TXT_YES"));
int mr2 = 170 + SmallFont.StringWidth(Stringtable.Localize("$TXT_NO"));
if (generic_hud)
{
arrowFont = textFont = NewSmallFont;
int factor = (CleanXfac+1) / 2;
destWidth = screen.GetWidth() / factor;
destHeight = screen.GetHeight() / factor;
selector = "▶";
}
else
{
textFont = SmallFont;
arrowFont = ConFont;
destWidth = CleanWidth;
destHeight = CleanHeight;
selector = "\xd";
}
int mr1 = destWidth/2 + 10 + textFont.StringWidth(Stringtable.Localize("$TXT_YES"));
int mr2 = destWidth/2 + 10 + textFont.StringWidth(Stringtable.Localize("$TXT_NO"));
mMouseRight = MAX(mr1, mr2);
mParentMenu = parent;
mMessage = SmallFont.BreakLines(Stringtable.Localize(message), 300);
mMessage = textFont.BreakLines(Stringtable.Localize(message), generic_hud? 600 : 300);
mMessageMode = messagemode;
if (playsound)
{
@ -79,18 +101,16 @@ class MessageBoxMenu : Menu
override void Drawer ()
{
int i, y;
int fontheight = textFont.GetHeight();
int fontheight = SmallFont.GetHeight();
y = 100;
y = destHeight / 2;
int c = mMessage.Count();
for (i = 0; i < c; i++)
y -= SmallFont.GetHeight () / 2;
y -= c * fontHeight / 2;
for (i = 0; i < c; i++)
{
screen.DrawText (SmallFont, Font.CR_UNTRANSLATED, 160 - mMessage.StringWidth(i)/2, y, mMessage.StringAt(i), DTA_Clean, true);
screen.DrawText (textFont, Font.CR_UNTRANSLATED, destWidth/2 - mMessage.StringWidth(i)/2, y, mMessage.StringAt(i), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true);
y += fontheight;
}
@ -98,17 +118,15 @@ class MessageBoxMenu : Menu
{
y += fontheight;
mMouseY = y;
screen.DrawText(SmallFont, messageSelection == 0? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, 160, y, Stringtable.Localize("$TXT_YES"), DTA_Clean, true);
screen.DrawText(SmallFont, messageSelection == 1? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, 160, y + fontheight + 1, Stringtable.Localize("$TXT_NO"), DTA_Clean, true);
screen.DrawText(textFont, messageSelection == 0? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y, Stringtable.Localize("$TXT_YES"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true);
screen.DrawText(textFont, messageSelection == 1? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y + fontheight, Stringtable.Localize("$TXT_NO"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true);
if (messageSelection >= 0)
{
if ((MenuTime() % 8) < 6)
{
screen.DrawText(ConFont, OptionMenuSettings.mFontColorSelection,
(150 - 160) * CleanXfac + screen.GetWidth() / 2,
(y + (fontheight + 1) * messageSelection - 100 + fontheight/2 - 5) * CleanYfac + screen.GetHeight() / 2,
"\xd", DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac);
screen.DrawText(arrowFont, OptionMenuSettings.mFontColorSelection,
destWidth/2 - 11, y + fontheight * messageSelection, selector, DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true);
}
}
}
@ -268,11 +286,11 @@ class MessageBoxMenu : Menu
else
{
int sel = -1;
int fh = SmallFont.GetHeight() + 1;
int fh = textFont.GetHeight() + 1;
// convert x/y from screen to virtual coordinates, according to CleanX/Yfac use in DrawTexture
x = ((x - (screen.GetWidth() / 2)) / CleanXfac) + 160;
y = ((y - (screen.GetHeight() / 2)) / CleanYfac) + 100;
x = x * destWidth / screen.GetWidth();
y = y * destHeight / screen.GetHeight();
if (x >= mMouseLeft && x <= mMouseRight && y >= mMouseY && y < mMouseY + 2 * fh)
{

View File

@ -17,7 +17,19 @@ struct PatchInfo play version("2.5")
void Init(GIFont gifont)
{
mFont = Font.GetFont(gifont.fontname);
// Replace with the VGA-Unicode font if needed.
// The default settings for this are marked with a *.
// If some mod changes this it is assumed that it doesn't provide any localization for the map name in a language not supported by the font.
String s = gifont.fontname;
if (s.CharAt(0) != "*")
mFont = Font.GetFont(gifont.fontname);
else if (generic_ui)
mFont = NewSmallFont;
else
{
s = s.Mid(1);
mFont = Font.GetFont(s);
}
mColor = Font.FindFontColor(gifont.color);
if (mFont == NULL)
{

View File

@ -150,7 +150,7 @@ class DoomStatusScreen : StatusScreen
let tcolor = useGfx? Font.CR_UNTRANSLATED : Font.CR_RED;
Font printFont;
Font textFont = generic_ui? NewSmallFont : BigFont;
if (useGfx)
{
printFont = IntermissionFont;
@ -162,12 +162,12 @@ class DoomStatusScreen : StatusScreen
}
else
{
printFont = BigFont;
screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY, "$TXT_IMKILLS", DTA_Clean, true);
screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY+lh, "$TXT_IMITEMS", DTA_Clean, true);
screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY+2*lh, "$TXT_IMSECRETS", DTA_Clean, true);
screen.DrawText (BigFont, tcolor, SP_TIMEX, SP_TIMEY, "$TXT_IMTIME", DTA_Clean, true);
if (wbs.partime) screen.DrawText (BigFont, tcolor, 160 + SP_TIMEX, SP_TIMEY, "$TXT_IMPAR", DTA_Clean, true);
printFont = generic_ui? IntermissionFont : BigFont;
screen.DrawText (textFont, tcolor, SP_STATSX, SP_STATSY, "$TXT_IMKILLS", DTA_Clean, true);
screen.DrawText (textFont, tcolor, SP_STATSX, SP_STATSY+lh, "$TXT_IMITEMS", DTA_Clean, true);
screen.DrawText (textFont, tcolor, SP_STATSX, SP_STATSY+2*lh, "$TXT_IMSECRETS", DTA_Clean, true);
screen.DrawText (textFont, tcolor, SP_TIMEX, SP_TIMEY, "$TXT_IMTIME", DTA_Clean, true);
if (wbs.partime) screen.DrawText (textFont, tcolor, 160 + SP_TIMEX, SP_TIMEY, "$TXT_IMPAR", DTA_Clean, true);
}
drawPercent (printFont, 320 - SP_STATSX, SP_STATSY, cnt_kills[0], wbs.maxkills, true, tcolor);
@ -189,7 +189,7 @@ class DoomStatusScreen : StatusScreen
}
else
{
screen.DrawText (printFont, Font.CR_UNTRANSLATED, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true);
screen.DrawText (textFont, Font.CR_UNTRANSLATED, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true);
}
}
@ -209,10 +209,12 @@ class RavenStatusScreen : DoomStatusScreen
int lh = IntermissionFont.GetHeight() * 3 / 2;
drawLF();
screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 65, "$TXT_IMKILLS", DTA_Clean, true, DTA_Shadow, true);
screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 90, "$TXT_IMITEMS", DTA_Clean, true, DTA_Shadow, true);
screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 115, "$TXT_IMSECRETS", DTA_Clean, true, DTA_Shadow, true);
Font textFont = generic_ui? NewSmallFont : BigFont;
screen.DrawText (textFont, Font.CR_UNTRANSLATED, 50, 65, "$TXT_IMKILLS", DTA_Clean, true, DTA_Shadow, true);
screen.DrawText (textFont, Font.CR_UNTRANSLATED, 50, 90, "$TXT_IMITEMS", DTA_Clean, true, DTA_Shadow, true);
screen.DrawText (textFont, Font.CR_UNTRANSLATED, 50, 115, "$TXT_IMSECRETS", DTA_Clean, true, DTA_Shadow, true);
int countpos = gameinfo.gametype==GAME_Strife? 285:270;
if (sp_state >= 2)
@ -229,7 +231,7 @@ class RavenStatusScreen : DoomStatusScreen
}
if (sp_state >= 8)
{
screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 85, 160, "$TXT_IMTIME", DTA_Clean, true, DTA_Shadow, true);
screen.DrawText (textFont, Font.CR_UNTRANSLATED, 85, 160, "$TXT_IMTIME", DTA_Clean, true, DTA_Shadow, true);
drawTime (249, 160, cnt_time);
if (wi_showtotaltime)
{

View File

@ -159,7 +159,7 @@ class AltHud ui
let seconds = Thinker.Tics2Seconds(timer);
String s = String.Format("%02i:%02i:%02i", seconds / 3600, (seconds % 3600) / 60, seconds % 60);
int length = 8 * fnt.GetCharWidth("0");
DrawHudText(SmallFont, color, s, x-length, y, trans);
DrawHudText(fnt, color, s, x-length, y, trans);
}
//===========================================================================
@ -170,30 +170,14 @@ class AltHud ui
void DrawStatLine(int x, in out int y, String prefix, String text)
{
if (!hud_althudfont)
{
y -= SmallFont.GetHeight()-1;
screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75);
y -= SmallFont.GetHeight()-1;
screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75);
screen.DrawText(SmallFont, hudcolor_stats, x+statspace, y, text,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75);
}
else
{
double horzscale = 1.5;
int downscale = 2;
y -= NewSmallFont.GetHeight() / downscale;
screen.DrawText(NewSmallFont, hudcolor_statnames, x * horzscale, y * downscale, prefix,
DTA_KeepRatio, true,
DTA_VirtualWidthF, hudwidth * horzscale, DTA_VirtualHeight, hudheight * downscale, DTA_Alpha, 0.75);
screen.DrawText(NewSmallFont, hudcolor_stats, (x+statspace) * horzscale, y * downscale, text,
DTA_KeepRatio, true,
DTA_VirtualWidthF, hudwidth * horzscale, DTA_VirtualHeight, hudheight * downscale, DTA_Alpha, 0.75);
}
screen.DrawText(SmallFont, hudcolor_stats, x+statspace, y, text,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75);
}
void DrawStatus(PlayerInfo CPlayer, int x, int y)
@ -737,11 +721,11 @@ class AltHud ui
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
}
void DrawCoordinates(PlayerInfo CPlayer)
void DrawCoordinates(PlayerInfo CPlayer, bool withmapname)
{
Vector3 pos;
String coordstr;
int h = SmallFont.GetHeight() + 1;
int h = SmallFont.GetHeight();
let mo = CPlayer.mo;
if (!map_point_coordinates || !automapactive)
@ -757,16 +741,22 @@ class AltHud ui
int xpos = hudwidth - SmallFont.StringWidth("X: -00000")-6;
int ypos = 18;
screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(Level.MapName), ypos, Level.MapName,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
if (withmapname)
{
let font = generic_hud? NewSmallFont : SmallFont;
int hh = font.GetHeight();
screen.DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont.StringWidth(Level.LevelName), ypos + h, Level.LevelName,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
screen.DrawText(font, hudcolor_titl, hudwidth - 6 - font.StringWidth(Level.MapName), ypos, Level.MapName,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
screen.DrawText(font, hudcolor_titl, hudwidth - 6 - font.StringWidth(Level.LevelName), ypos + hh, Level.LevelName,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
ypos += 2 * hh + h;
}
ypos += 3 * h;
DrawCoordinateEntry(xpos, ypos, String.Format("X: %.0f", pos.X));
ypos += h;
DrawCoordinateEntry(xpos, ypos, String.Format("Y: %.0f", pos.Y));
@ -935,7 +925,7 @@ class AltHud ui
y = DrawAmmo(CPlayer, hudwidth-5, y);
if (hud_showweapons) DrawWeapons(CPlayer, hudwidth - 5, y);
DrawInventory(CPlayer, 144, hudheight - 28);
if (idmypos) DrawCoordinates(CPlayer);
if (idmypos) DrawCoordinates(CPlayer, true);
int h = SmallFont.GetHeight();
y = h;
@ -952,12 +942,14 @@ class AltHud ui
virtual void DrawAutomap(PlayerInfo CPlayer)
{
int fonth=SmallFont.GetHeight() + 1;
let font = generic_hud? NewSmallFont : SmallFont;
int fonth = font.GetHeight() + 1;
int bottom = hudheight - 1;
if (am_showtotaltime)
{
DrawTimeString(SmallFont, hudcolor_ttim, Level.totaltime, hudwidth-2, bottom, 1);
DrawTimeString(font, hudcolor_ttim, Level.totaltime, hudwidth-2, bottom, 1);
bottom -= fonth;
}
@ -965,19 +957,19 @@ class AltHud ui
{
if (Level.clusterflags & Level.CLUSTER_HUB)
{
DrawTimeString(SmallFont, hudcolor_time, Level.time, hudwidth-2, bottom, 1);
DrawTimeString(font, hudcolor_time, Level.time, hudwidth-2, bottom, 1);
bottom -= fonth;
}
// Single level time for hubs
DrawTimeString(SmallFont, hudcolor_ltim, Level.maptime, hudwidth-2, bottom, 1);
DrawTimeString(font, hudcolor_ltim, Level.maptime, hudwidth-2, bottom, 1);
}
screen.DrawText(SmallFont, 0, 1, hudheight - fonth - 1, Level.FormatMapName(hudcolor_titl),
screen.DrawText(font, Font.CR_BRICK, 2, hudheight - fonth - 1, Level.FormatMapName(hudcolor_titl),
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight);
DrawCoordinates(CPlayer);
DrawCoordinates(CPlayer, false);
}
//---------------------------------------------------------------------------

View File

@ -306,8 +306,6 @@ class BaseStatusBar native ui
native double drawClip[4]; // defines a clipping rectangle (not used yet)
native bool fullscreenOffsets; // current screen is displayed with fullscreen behavior.
private HUDFont mSmallFont;
native void AttachMessage(HUDMessageBase msg, uint msgid = 0, int layer = HUDMSGLayer_Default);
native HUDMessageBase DetachMessage(HUDMessageBase msg);
native HUDMessageBase DetachMessageID(uint msgid);
@ -322,7 +320,6 @@ class BaseStatusBar native ui
virtual void Init()
{
mSmallFont = HUDFont.Create("SmallFont");
}
native virtual void Tick ();
@ -835,77 +832,7 @@ class BaseStatusBar native ui
//
//============================================================================
protected void DoDrawAutomapHUD(int crdefault, int highlight)
{
let scale = GetHUDScale();
double textdist = 8. / scale.Y;
int height = SmallFont.GetHeight();
String printtext;
int SCREENWIDTH = screen.GetWidth();
BeginHUD();
// Draw timer
let y = textdist;
let width = SmallFont.StringWidth("00:00:00");
if (am_showtime)
{
printtext = Level.TimeFormatted();
DrawString(mSmallFont, Level.TimeFormatted(), (-textdist-width, y), 0, crdefault);
y += height;
}
if (am_showtotaltime)
{
DrawString(mSmallFont, Level.TimeFormatted(true), (-textdist-width, y), 0, crdefault);
}
if (!deathmatch)
{
y = textdist;
// Draw monster count
if (am_showmonsters)
{
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_MONSTERS"), crdefault+65, Level.killed_monsters, Level.total_monsters), (textdist, y), 0, highlight);
y += height;
}
// Draw secret count
if (am_showsecrets)
{
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_SECRETS"), crdefault+65, Level.found_secrets, Level.total_secrets), (textdist, y), 0, highlight);
y += height;
}
// Draw item count
if (am_showitems)
{
DrawString(mSmallFont, String.Format("%s\34%c %d/%d", Stringtable.Localize("$AM_ITEMS"), crdefault+65, Level.found_items, Level.total_items), (textdist, y), 0, highlight);
}
}
String mapname = Level.FormatMapName(crdefault);
BrokenLines lines = SmallFont.BreakLines(mapname, int(SCREENWIDTH / scale.X));
int numlines = lines.Count();
int finalwidth = int(SmallFont.StringWidth(lines.StringAt(numlines-1)) * scale.X);
// calculate the top of the statusbar including any protrusion and transform it from status bar to screen space.
double tmp, hres;
[tmp, tmp, hres] = StatusbarToRealCoords(0, 0, HorizontalResolution);
int protrusion = GetProtrusion(finalwidth / hres);
[tmp, tmp, tmp, hres] = StatusbarToRealCoords(0, 0, 0, protrusion);
// transform the top of the status bar position from screen to HUD space (a direct transformation from status bar to HUD space does not exist.)
y = (GetTopOfStatusBar() - hres) / scale.Y - height * numlines;
// Draw the texts centered above the status bar.
for(int i = 0; i < numlines; i++)
{
DrawString(mSmallFont, lines.StringAt(i), (0, y), DI_TEXT_ALIGN_CENTER|DI_SCREEN_HCENTER|DI_SCREEN_TOP, highlight);
y += height;
}
}
protected native void DoDrawAutomapHUD(int crdefault, int highlight);
virtual void DrawAutomapHUD(double ticFrac)
{

View File

@ -109,7 +109,7 @@ class StrifeStatusBar : BaseStatusBar
override void ShowPop (int popnum)
{
Super.ShowPop(popnum);
if (popnum == CurrentPop)
if (popnum == CurrentPop || (popnum == POP_LOG && generic_hud))
{
if (popnum == POP_Keys)
{
@ -146,7 +146,7 @@ class StrifeStatusBar : BaseStatusBar
override bool MustDrawLog(int state)
{
// Tell the base class to draw the log if the pop screen won't be displayed.
return false;
return !generic_hud;
}
void Reset ()

File diff suppressed because it is too large Load Diff