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

This commit is contained in:
Rachael Alexanderson 2019-03-18 04:05:19 -04:00
commit dd4ef010ab
107 changed files with 1346 additions and 698 deletions

View file

@ -46,6 +46,7 @@
#include "vm.h" #include "vm.h"
#include "i_time.h" #include "i_time.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "v_text.h"
const char *KeyNames[NUM_KEYS] = const char *KeyNames[NUM_KEYS] =
{ {
@ -297,7 +298,7 @@ void C_NameKeys (char *str, int first, int second)
c++; c++;
strcpy (str, KeyName (first)); strcpy (str, KeyName (first));
if (second) if (second)
strcat (str, " or "); strcat (str, TEXTCOLOR_BLACK ", " TEXTCOLOR_NORMAL);
} }
if (second) if (second)

View file

@ -1243,10 +1243,12 @@ CCMD(secret)
FString levelname; FString levelname;
level_info_t *info = FindLevelInfo(mapname); level_info_t *info = FindLevelInfo(mapname);
const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()]; const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()];
levelname.Format("%s - %s\n", mapname, ln); levelname.Format("%s - %s", mapname, ln);
size_t llen = levelname.Len() - 1; Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars());
size_t llen = levelname.Len();
levelname = "";
for(size_t ii=0; ii<llen; ii++) levelname += '-'; for(size_t ii=0; ii<llen; ii++) levelname += '-';
Printf(TEXTCOLOR_YELLOW"%s\n", levelname.GetChars()); Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars());
foundsome = true; foundsome = true;
} }
} }

View file

@ -131,8 +131,6 @@ static GameAtExit *ExitCmdList;
EXTERN_CVAR (Bool, show_messages) EXTERN_CVAR (Bool, show_messages)
static bool ConsoleDrawing;
// Buffer for AddToConsole() // Buffer for AddToConsole()
static char *work = NULL; static char *work = NULL;
static int worklen = 0; static int worklen = 0;
@ -586,49 +584,6 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE)
setmsgcolor (PRINTLEVELS+1, self); setmsgcolor (PRINTLEVELS+1, self);
} }
struct TextQueue
{
TextQueue (bool notify, int printlevel, const char *text)
: Next(NULL), bNotify(notify), PrintLevel(printlevel), Text(text)
{
}
TextQueue *Next;
bool bNotify;
int PrintLevel;
FString Text;
};
TextQueue *EnqueuedText, **EnqueuedTextTail = &EnqueuedText;
void EnqueueConsoleText (bool notify, int printlevel, const char *text)
{
TextQueue *queued = new TextQueue (notify, printlevel, text);
*EnqueuedTextTail = queued;
EnqueuedTextTail = &queued->Next;
}
void DequeueConsoleText ()
{
TextQueue *queued = EnqueuedText;
while (queued != NULL)
{
TextQueue *next = queued->Next;
if (queued->bNotify)
{
NotifyStrings.AddString(queued->PrintLevel, queued->Text);
}
else
{
AddToConsole (queued->PrintLevel, queued->Text);
}
delete queued;
queued = next;
}
EnqueuedText = NULL;
EnqueuedTextTail = &EnqueuedText;
}
EColorRange C_GetDefaultFontColor() EColorRange C_GetDefaultFontColor()
{ {
// Ideally this should analyze the SmallFont and pick a matching color. // Ideally this should analyze the SmallFont and pick a matching color.
@ -827,15 +782,9 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
con_notifylines == 0) con_notifylines == 0)
return; return;
if (ConsoleDrawing)
{
EnqueueConsoleText (true, printlevel, source);
return;
}
width = DisplayWidth / active_con_scaletext(con_consolefont); width = DisplayWidth / active_con_scaletext(con_consolefont);
FFont *font = *con_consolefont ? NewConsoleFont : SmallFont; FFont *font = *con_consolefont ? NewSmallFont : SmallFont;
if (AddType == APPENDLINE && Text.Size() > 0 && Text[Text.Size() - 1].PrintLevel == printlevel) if (AddType == APPENDLINE && Text.Size() > 0 && Text[Text.Size() - 1].PrintLevel == printlevel)
{ {
@ -888,11 +837,51 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
void AddToConsole (int printlevel, const char *text) void AddToConsole (int printlevel, const char *text)
{ {
conbuffer->AddText(printlevel, MakeUTF8(text), Logfile); conbuffer->AddText(printlevel, MakeUTF8(text));
} }
int PrintString (int printlevel, const char *outline) //==========================================================================
//
//
//
//==========================================================================
void WriteLineToLog(FILE *LogFile, const char *outline)
{ {
// Strip out any color escape sequences before writing to the log file
TArray<char> copy(strlen(outline) + 1);
const char * srcp = outline;
char * dstp = copy.Data();
while (*srcp != 0)
{
if (*srcp != TEXTCOLOR_ESCAPE)
{
*dstp++ = *srcp++;
}
else if (srcp[1] == '[')
{
srcp += 2;
while (*srcp != ']' && *srcp != 0) srcp++;
if (*srcp == ']') srcp++;
}
else
{
if (srcp[1] != 0) srcp += 2;
else break;
}
}
*dstp = 0;
fputs(copy.Data(), LogFile);
fflush(LogFile);
}
int PrintString (int iprintlevel, const char *outline)
{
int printlevel = iprintlevel & PRINT_TYPES;
if (printlevel < msglevel || *outline == '\0') if (printlevel < msglevel || *outline == '\0')
{ {
return 0; return 0;
@ -907,16 +896,15 @@ int PrintString (int printlevel, const char *outline)
{ {
I_PrintStr(outline); I_PrintStr(outline);
conbuffer->AddText(printlevel, outline, Logfile); conbuffer->AddText(printlevel, outline);
if (vidactive && screen && SmallFont) if (vidactive && screen && SmallFont && !(iprintlevel & PRINT_NONOTIFY))
{ {
NotifyStrings.AddString(printlevel, outline); NotifyStrings.AddString(printlevel, outline);
} }
} }
else if (Logfile != nullptr) if (Logfile != nullptr && !(iprintlevel & PRINT_NOLOG))
{ {
fputs(outline, Logfile); WriteLineToLog(Logfile, outline);
fflush(Logfile);
} }
return count; return count;
} }
@ -1079,7 +1067,7 @@ void FNotifyBuffer::Draw()
line = Top; line = Top;
canskip = true; canskip = true;
FFont *font = *con_consolefont ? NewConsoleFont : SmallFont; FFont *font = *con_consolefont ? NewSmallFont : SmallFont;
lineadv = font->GetHeight (); lineadv = font->GetHeight ();
for (unsigned i = 0; i < Text.Size(); ++ i) for (unsigned i = 0; i < Text.Size(); ++ i)
@ -1220,8 +1208,6 @@ void C_DrawConsole ()
int bottomline = ConBottom / textScale - CurrentConsoleFont->GetHeight()*2 - 4; int bottomline = ConBottom / textScale - CurrentConsoleFont->GetHeight()*2 - 4;
ConsoleDrawing = true;
for(FBrokenLines *p = printline; p >= blines && lines > 0; p--, lines--) for(FBrokenLines *p = printline; p >= blines && lines > 0; p--, lines--)
{ {
if (textScale == 1) if (textScale == 1)
@ -1237,8 +1223,6 @@ void C_DrawConsole ()
} }
} }
ConsoleDrawing = false;
if (ConBottom >= 20) if (ConBottom >= 20)
{ {
if (gamestate != GS_STARTUP) if (gamestate != GS_STARTUP)
@ -1758,33 +1742,25 @@ CCMD (echo)
/* Printing in the middle of the screen */ /* Printing in the middle of the screen */
CVAR (Float, con_midtime, 3.f, CVAR_ARCHIVE) CVAR(Float, con_midtime, 3.f, CVAR_ARCHIVE)
static const char bar1[] = TEXTCOLOR_RED "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" const char *console_bar = "----------------------------------------";
"\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_TAN "\n";
static const char bar2[] = 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_GREEN "\n";
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; return;
if (msg != NULL) if (msg != nullptr)
{ {
AddToConsole (-1, bar1); auto color = (EColorRange)PrintColors[bold? PRINTLEVELS+1 : PRINTLEVELS];
AddToConsole (-1, msg); Printf(PRINT_NONOTIFY, TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", color, console_bar, msg, console_bar);
AddToConsole (-1, bar3);
auto color = (EColorRange)PrintColors[PRINTLEVELS];
bool altscale = false; bool altscale = false;
if (font == nullptr) if (font == nullptr)
{ {
altscale = con_midconsolefont; altscale = con_midconsolefont;
font = altscale ? NewConsoleFont : SmallFont; font = altscale ? NewSmallFont : SmallFont;
if (altscale && color == CR_UNTRANSLATED) color = C_GetDefaultFontColor(); if (altscale && color == CR_UNTRANSLATED) color = C_GetDefaultFontColor();
} }
@ -1797,32 +1773,6 @@ void C_MidPrint (FFont *font, const char *msg)
} }
} }
void C_MidPrintBold (FFont *font, const char *msg)
{
if (msg)
{
AddToConsole (-1, bar2);
AddToConsole (-1, msg);
AddToConsole (-1, bar3);
auto color = (EColorRange)PrintColors[PRINTLEVELS+1];
bool altscale = false;
if (font == nullptr)
{
altscale = con_midconsolefont;
font = altscale ? NewConsoleFont : 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'));
}
else
{
StatusBar->DetachMessage (MAKE_ID('C','N','T','R'));
}
}
DEFINE_ACTION_FUNCTION(_Console, MidPrint) DEFINE_ACTION_FUNCTION(_Console, MidPrint)
{ {
PARAM_PROLOGUE; PARAM_PROLOGUE;
@ -1831,8 +1781,7 @@ DEFINE_ACTION_FUNCTION(_Console, MidPrint)
PARAM_BOOL(bold); PARAM_BOOL(bold);
const char *txt = text[0] == '$'? GStrings(&text[1]) : text.GetChars(); const char *txt = text[0] == '$'? GStrings(&text[1]) : text.GetChars();
if (!bold) C_MidPrint(fnt, txt); C_MidPrint(fnt, txt, bold);
else C_MidPrintBold(fnt, txt);
return 0; return 0;
} }

View file

@ -78,8 +78,7 @@ void C_AdjustBottom (void);
void C_FlushDisplay (void); void C_FlushDisplay (void);
class FFont; class FFont;
void C_MidPrint (FFont *font, const char *message); void C_MidPrint (FFont *font, const char *message, bool bold = false);
void C_MidPrintBold (FFont *font, const char *message);
bool C_Responder (event_t *ev); bool C_Responder (event_t *ev);
@ -87,4 +86,6 @@ void C_AddTabCommand (const char *name);
void C_RemoveTabCommand (const char *name); void C_RemoveTabCommand (const char *name);
void C_ClearTabCommands(); // Removes all tab commands void C_ClearTabCommands(); // Removes all tab commands
extern const char *console_bar;
#endif #endif

View file

@ -55,33 +55,6 @@ FConsoleBuffer::FConsoleBuffer()
mBrokenStart.Push(0); mBrokenStart.Push(0);
} }
//==========================================================================
//
//
//
//==========================================================================
FConsoleBuffer::~FConsoleBuffer()
{
FreeBrokenText();
}
//==========================================================================
//
//
//
//==========================================================================
void FConsoleBuffer::FreeBrokenText(unsigned start, unsigned end)
{
if (end > m_BrokenConsoleText.Size()) end = m_BrokenConsoleText.Size();
for (unsigned i = start; i < end; i++)
{
m_BrokenConsoleText[i].Clear();
m_BrokenConsoleText[i].ShrinkToFit();
}
}
//========================================================================== //==========================================================================
// //
// Adds a new line of text to the console // Adds a new line of text to the console
@ -95,7 +68,7 @@ void FConsoleBuffer::FreeBrokenText(unsigned start, unsigned end)
// //
//========================================================================== //==========================================================================
void FConsoleBuffer::AddText(int printlevel, const char *text, FILE *logfile) void FConsoleBuffer::AddText(int printlevel, const char *text)
{ {
FString build = TEXTCOLOR_TAN; FString build = TEXTCOLOR_TAN;
@ -135,117 +108,9 @@ void FConsoleBuffer::AddText(int printlevel, const char *text, FILE *logfile)
mAddType = APPENDLINE; mAddType = APPENDLINE;
} }
// don't bother about linefeeds etc. inside the text, we'll let the formatter sort this out later. // don't bother with linefeeds etc. inside the text, we'll let the formatter sort this out later.
build.AppendCStrPart(text, textsize); build.AppendCStrPart(text, textsize);
mConsoleText.Push(build); mConsoleText.Push(build);
if (logfile != NULL) WriteLineToLog(logfile, text);
}
//==========================================================================
//
//
//
//==========================================================================
void FConsoleBuffer::WriteLineToLog(FILE *LogFile, const char *outline)
{
// Strip out any color escape sequences before writing to the log file
TArray<char> copy(strlen(outline)+1);
const char * srcp = outline;
char * dstp = copy.Data();
while (*srcp != 0)
{
if (*srcp != TEXTCOLOR_ESCAPE)
{
switch (*srcp)
{
case '\35':
*dstp++ = '<';
break;
case '\36':
*dstp++ = '-';
break;
case '\37':
*dstp++ = '>';
break;
default:
*dstp++=*srcp;
break;
}
srcp++;
}
else if (srcp[1] == '[')
{
srcp+=2;
while (*srcp != ']' && *srcp != 0) srcp++;
if (*srcp == ']') srcp++;
}
else
{
if (srcp[1]!=0) srcp+=2;
else break;
}
}
*dstp=0;
fputs (copy.Data(), LogFile);
fflush (LogFile);
}
//==========================================================================
//
//
//
//==========================================================================
void FConsoleBuffer::WriteContentToLog(FILE *LogFile)
{
if (LogFile != NULL)
{
for (unsigned i = 0; i < mConsoleText.Size(); i++)
{
WriteLineToLog(LogFile, mConsoleText[i]);
}
}
}
//==========================================================================
//
// ensures that the following text is not appended to the current line.
//
//==========================================================================
void FConsoleBuffer::Linefeed(FILE *Logfile)
{
if (mAddType != NEWLINE && Logfile != NULL) fputc('\n', Logfile);
mAddType = NEWLINE;
}
//==========================================================================
//
//
//
//==========================================================================
static const char bar1[] = TEXTCOLOR_RED "\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_TAN "\n";
static const char bar2[] = TEXTCOLOR_RED "\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_GREEN "\n";
static const char bar3[] = TEXTCOLOR_RED "\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 FConsoleBuffer::AddMidText(const char *string, bool bold, FILE *Logfile)
{
Linefeed(Logfile);
AddText (-1, bold? bar2 : bar1, Logfile);
AddText (-1, string, Logfile);
Linefeed(Logfile);
AddText(-1, bar3, Logfile);
} }
//========================================================================== //==========================================================================
@ -258,7 +123,6 @@ void FConsoleBuffer::FormatText(FFont *formatfont, int displaywidth)
{ {
if (formatfont != mLastFont || displaywidth != mLastDisplayWidth || mBufferWasCleared) if (formatfont != mLastFont || displaywidth != mLastDisplayWidth || mBufferWasCleared)
{ {
FreeBrokenText();
m_BrokenConsoleText.Clear(); m_BrokenConsoleText.Clear();
mBrokenStart.Clear(); mBrokenStart.Clear();
mBrokenStart.Push(0); mBrokenStart.Push(0);

View file

@ -61,19 +61,12 @@ class FConsoleBuffer
int mLastDisplayWidth; int mLastDisplayWidth;
bool mLastLineNeedsUpdate; bool mLastLineNeedsUpdate;
void WriteLineToLog(FILE *LogFile, const char *outline);
void FreeBrokenText(unsigned int start = 0, unsigned int end = INT_MAX);
void Linefeed(FILE *Logfile);
public: public:
FConsoleBuffer(); FConsoleBuffer();
~FConsoleBuffer(); void AddText(int printlevel, const char *string);
void AddText(int printlevel, const char *string, FILE *logfile = NULL);
void AddMidText(const char *string, bool bold, FILE *logfile);
void FormatText(FFont *formatfont, int displaywidth); void FormatText(FFont *formatfont, int displaywidth);
void ResizeBuffer(unsigned newsize); void ResizeBuffer(unsigned newsize);
void WriteContentToLog(FILE *logfile);
void Clear() void Clear()
{ {
mBufferWasCleared = true; mBufferWasCleared = true;

View file

@ -1292,6 +1292,7 @@ void D_DoAdvanceDemo (void)
} }
else else
{ {
singledemo = false;
G_DeferedPlayDemo (demoname); G_DeferedPlayDemo (demoname);
demosequence = 2; demosequence = 2;
break; break;

View file

@ -250,8 +250,8 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
} }
int GetGender() const int GetGender() const
{ {
auto cvar = static_cast<FIntCVar *>(*CheckKey(NAME_Gender)); auto cvar = CheckKey(NAME_Gender);
return cvar? *cvar : 0; return cvar ? *static_cast<FIntCVar *>(*cvar) : 0;
} }
bool GetNoAutostartMap() const bool GetNoAutostartMap() const
{ {

View file

@ -89,7 +89,10 @@ enum
PRINT_CHAT, // chat messages PRINT_CHAT, // chat messages
PRINT_TEAMCHAT, // chat messages from a teammate PRINT_TEAMCHAT, // chat messages from a teammate
PRINT_LOG, // only to logfile PRINT_LOG, // only to logfile
PRINT_BOLD = 200 // What Printf_Bold used PRINT_BOLD = 200, // What Printf_Bold used
PRINT_TYPES = 1023, // Bitmask.
PRINT_NONOTIFY = 1024, // Flag - do not add to notify buffer
PRINT_NOLOG = 2048, // Flag - do not print to log file
}; };
enum enum

View file

@ -573,7 +573,7 @@ void FParser::SF_Include(void)
void FParser::SF_Input(void) void FParser::SF_Input(void)
{ {
Printf(PRINT_BOLD,"input() function not available in doom\n"); Printf(PRINT_BOLD,"input() function not available in Doom\n");
} }
//========================================================================== //==========================================================================

View file

@ -51,6 +51,9 @@ CVAR(Int, developer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
// [RH] Feature control cvars // [RH] Feature control cvars
CVAR(Bool, var_friction, true, CVAR_SERVERINFO); CVAR(Bool, var_friction, true, CVAR_SERVERINFO);
// Option Search
CVAR(Bool, os_isanyof, true, CVAR_ARCHIVE);
@ -131,7 +134,6 @@ CUSTOM_CVAR(Float, teamdamage, 0.f, CVAR_SERVERINFO | CVAR_NOINITCALL)
CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
{ {
SetLanguageIDs();
GStrings.UpdateLanguage(); GStrings.UpdateLanguage();
for (auto Level : AllLevels()) for (auto Level : AllLevels())
{ {
@ -139,4 +141,3 @@ CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOB
if (Level->info != nullptr) Level->LevelName = Level->info->LookupLevelName(); if (Level->info != nullptr) Level->LevelName = Level->info->LookupLevelName();
} }
} }

View file

@ -2727,7 +2727,7 @@ void G_DoPlayDemo (void)
} }
demo_p = demobuffer; demo_p = demobuffer;
Printf ("Playing demo %s\n", defdemoname.GetChars()); if (singledemo) Printf ("Playing demo %s\n", defdemoname.GetChars());
C_BackupCVars (); // [RH] Save cvars that might be affected by demo C_BackupCVars (); // [RH] Save cvars that might be affected by demo
@ -2744,7 +2744,7 @@ void G_DoPlayDemo (void)
} }
else else
{ {
Printf (PRINT_BOLD, "%s", eek); //Printf (PRINT_BOLD, "%s", eek);
gameaction = ga_nothing; gameaction = ga_nothing;
} }
} }

View file

@ -1062,12 +1062,8 @@ void FLevelLocals::DoLoadLevel(const FString &nextmapname, int position, bool au
if (isPrimaryLevel()) if (isPrimaryLevel())
{ {
FString mapname = nextmapname; FString mapname = nextmapname;
mapname.ToLower(); mapname.ToUpper();
Printf( Printf("\n%s\n\n" TEXTCOLOR_BOLD "%s - %s\n\n", console_bar, mapname.GetChars(), LevelName.GetChars());
"\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\n\n"
TEXTCOLOR_BOLD "%s - %s\n\n",
mapname.GetChars(), LevelName.GetChars());
} }
// Set the sky map. // Set the sky map.

View file

@ -55,6 +55,7 @@
CVAR(Int,hud_althudscale, 0, CVAR_ARCHIVE) // Scale the hud to 640x400? 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_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! // These are intentionally not the same as in the automap!
CVAR (Bool, hud_showsecrets, true,CVAR_ARCHIVE); // Show secrets on HUD CVAR (Bool, hud_showsecrets, true,CVAR_ARCHIVE); // Show secrets on HUD
CVAR (Bool, hud_showmonsters, true,CVAR_ARCHIVE); // Show monster stats on HUD CVAR (Bool, hud_showmonsters, true,CVAR_ARCHIVE); // Show monster stats on HUD

View file

@ -42,6 +42,51 @@
#include "fontinternals.h" #include "fontinternals.h"
struct HexDataSource
{
int FirstChar = INT_MAX, LastChar = INT_MIN;
TArray<uint8_t> glyphdata;
unsigned glyphmap[65536] = {};
//==========================================================================
//
// parse a HEX font
//
//==========================================================================
void ParseDefinition(int lumpnum)
{
FScanner sc;
sc.OpenLumpNum(lumpnum);
sc.SetCMode(true);
glyphdata.Push(0); // ensure that index 0 can be used as 'not present'.
while (sc.GetString())
{
int codepoint = (int)strtoull(sc.String, nullptr, 16);
sc.MustGetStringName(":");
sc.MustGetString();
if (codepoint >= 0 && codepoint < 65536 && !sc.Compare("00000000000000000000000000000000")) // don't set up empty glyphs.
{
unsigned size = (unsigned)strlen(sc.String);
unsigned offset = glyphdata.Reserve(size / 2 + 1);
glyphmap[codepoint] = offset;
glyphdata[offset++] = size / 2;
for (unsigned i = 0; i < size; i += 2)
{
char hex[] = { sc.String[i], sc.String[i + 1], 0 };
glyphdata[offset++] = (uint8_t)strtoull(hex, nullptr, 16);
}
if (codepoint < FirstChar) FirstChar = codepoint;
if (codepoint > LastChar) LastChar = codepoint;
}
}
}
};
static HexDataSource hexdata;
// This is a font character that reads RLE compressed data. // This is a font character that reads RLE compressed data.
class FHexFontChar : public FImageSource class FHexFontChar : public FImageSource
{ {
@ -113,51 +158,78 @@ TArray<uint8_t> FHexFontChar::CreatePalettedPixels(int)
return Pixels; return Pixels;
} }
class FHexFontChar2 : public FHexFontChar
{
public:
FHexFontChar2(uint8_t *sourcedata, int swidth, int width, int height);
TArray<uint8_t> CreatePalettedPixels(int conversion) override;
};
//==========================================================================
//
// FHexFontChar :: FHexFontChar
//
// Used by HEX fonts.
//
//==========================================================================
FHexFontChar2::FHexFontChar2(uint8_t *sourcedata, int swidth, int width, int height)
: FHexFontChar(sourcedata, swidth, width, height)
{
}
//==========================================================================
//
// FHexFontChar :: Get8BitPixels
//
// The render style has no relevance here.
//
//==========================================================================
TArray<uint8_t> FHexFontChar2::CreatePalettedPixels(int)
{
int destSize = Width * Height;
TArray<uint8_t> Pixels(destSize, true);
uint8_t *dest_p = Pixels.Data();
auto drawLayer = [&](int ix, int iy, int color)
{
const uint8_t *src_p = SourceData;
for (int y = 0; y < Height-2; y++)
{
for (int x = 0; x < SourceWidth; x++)
{
int byte = *src_p++;
uint8_t *pixelstart = dest_p + (ix + 8 * x) * Height + (iy+y);
for (int bit = 0; bit < 8; bit++)
{
if (byte & (128 >> bit))
{
pixelstart[bit*Height] = color;
}
}
}
}
};
memset(dest_p, 0, destSize);
const int darkcolor = 3;
const int brightcolor = 14;
for (int xx=0;xx<3;xx++) for (int yy=0;yy<3;yy++) if (xx !=1 || yy != 1)
drawLayer(xx, yy, darkcolor);
drawLayer(1, 1, brightcolor);
return Pixels;
}
class FHexFont : public FFont class FHexFont : public FFont
{ {
TArray<uint8_t> glyphdata;
unsigned glyphmap[65536] = {};
public: public:
//==========================================================================
//
// parse a HEX font
//
//==========================================================================
void ParseDefinition(int lumpnum)
{
FScanner sc;
FirstChar = INT_MAX;
LastChar = INT_MIN;
sc.OpenLumpNum(lumpnum);
sc.SetCMode(true);
glyphdata.Push(0); // ensure that index 0 can be used as 'not present'.
while (sc.GetString())
{
int codepoint = (int)strtoull(sc.String, nullptr, 16);
sc.MustGetStringName(":");
sc.MustGetString();
if (codepoint >= 0 && codepoint < 65536 && !sc.Compare("00000000000000000000000000000000")) // don't set up empty glyphs.
{
unsigned size = (unsigned)strlen(sc.String);
unsigned offset = glyphdata.Reserve(size/2 + 1);
glyphmap[codepoint] = offset;
glyphdata[offset++] = size / 2;
for(unsigned i = 0; i < size; i+=2)
{
char hex[] = { sc.String[i], sc.String[i+1], 0 };
glyphdata[offset++] = (uint8_t)strtoull(hex, nullptr, 16);
}
if (codepoint < FirstChar) FirstChar = codepoint;
if (codepoint > LastChar) LastChar = codepoint;
}
}
}
//========================================================================== //==========================================================================
// //
// FHexFont :: FHexFont // FHexFont :: FHexFont
@ -173,7 +245,8 @@ public:
FontName = fontname; FontName = fontname;
ParseDefinition(lump); FirstChar = hexdata.FirstChar;
LastChar = hexdata.LastChar;
Next = FirstFont; Next = FirstFont;
FirstFont = this; FirstFont = this;
@ -208,11 +281,11 @@ public:
Chars.Resize(LastChar - FirstChar + 1); Chars.Resize(LastChar - FirstChar + 1);
for (int i = FirstChar; i <= LastChar; i++) for (int i = FirstChar; i <= LastChar; i++)
{ {
if (glyphmap[i] > 0) if (hexdata.glyphmap[i] > 0)
{ {
auto offset = glyphmap[i]; auto offset = hexdata.glyphmap[i];
int size = glyphdata[offset] / 16; int size = hexdata.glyphdata[offset] / 16;
Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar (&glyphdata[offset+1], size, size * 9, 16)); Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar (&hexdata.glyphdata[offset+1], size, size * 9, 16));
Chars[i - FirstChar].TranslatedPic->SetUseType(ETextureType::FontChar); Chars[i - FirstChar].TranslatedPic->SetUseType(ETextureType::FontChar);
Chars[i - FirstChar].XMove = size * spacing; Chars[i - FirstChar].XMove = size * spacing;
TexMan.AddTexture(Chars[i - FirstChar].TranslatedPic); TexMan.AddTexture(Chars[i - FirstChar].TranslatedPic);
@ -226,6 +299,79 @@ public:
}; };
class FHexFont2 : public FFont
{
public:
//==========================================================================
//
// FHexFont :: FHexFont
//
// Loads a HEX font
//
//==========================================================================
FHexFont2(const char *fontname, int lump)
: FFont(lump)
{
assert(lump >= 0);
FontName = fontname;
FirstChar = hexdata.FirstChar;
LastChar = hexdata.LastChar;
Next = FirstFont;
FirstFont = this;
FontHeight = 18;
SpaceWidth = 10;
GlobalKerning = -1;
translateUntranslated = true;
LoadTranslations();
}
//==========================================================================
//
// FHexFont :: LoadTranslations
//
//==========================================================================
void LoadTranslations()
{
const int spacing = 9;
double luminosity[256];
memset(PatchRemap, 0, 256);
for (int i = 0; i < 18; i++)
{
// Create a gradient similar to the old console font.
PatchRemap[i] = i;
luminosity[i] = i / 17.;
}
ActiveColors = 18;
Chars.Resize(LastChar - FirstChar + 1);
for (int i = FirstChar; i <= LastChar; i++)
{
if (hexdata.glyphmap[i] > 0)
{
auto offset = hexdata.glyphmap[i];
int size = hexdata.glyphdata[offset] / 16;
Chars[i - FirstChar].TranslatedPic = new FImageTexture(new FHexFontChar2(&hexdata.glyphdata[offset + 1], size, 2 + size * 8, 18));
Chars[i - FirstChar].TranslatedPic->SetUseType(ETextureType::FontChar);
Chars[i - FirstChar].XMove = size * spacing;
TexMan.AddTexture(Chars[i - FirstChar].TranslatedPic);
}
else Chars[i - FirstChar].XMove = spacing;
}
BuildTranslations(luminosity, nullptr, &TranslationParms[0][0], ActiveColors, nullptr);
}
};
//========================================================================== //==========================================================================
// //
// //
@ -234,5 +380,18 @@ public:
FFont *CreateHexLumpFont (const char *fontname, int lump) FFont *CreateHexLumpFont (const char *fontname, int lump)
{ {
if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
return new FHexFont(fontname, lump); return new FHexFont(fontname, lump);
} }
//==========================================================================
//
//
//
//==========================================================================
FFont *CreateHexLumpFont2(const char *fontname, int lump)
{
if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
return new FHexFont2(fontname, lump);
}

View file

@ -1449,10 +1449,12 @@ void V_InitFonts()
V_InitCustomFonts(); V_InitCustomFonts();
FFont *CreateHexLumpFont(const char *fontname, int lump); FFont *CreateHexLumpFont(const char *fontname, int lump);
FFont *CreateHexLumpFont2(const char *fontname, int lump);
auto lump = Wads.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements. auto lump = Wads.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
if (lump == -1) I_FatalError("newconsolefont.hex not found"); // This font is needed - do not start up without it. if (lump == -1) I_FatalError("newconsolefont.hex not found"); // This font is needed - do not start up without it.
NewConsoleFont = CreateHexLumpFont("NewConsoleFont", lump); NewConsoleFont = CreateHexLumpFont("NewConsoleFont", lump);
NewSmallFont = CreateHexLumpFont2("NewSmallFont", lump);
CurrentConsoleFont = NewConsoleFont; CurrentConsoleFont = NewConsoleFont;
// load the heads-up font // load the heads-up font
@ -1540,6 +1542,6 @@ void V_ClearFonts()
delete FFont::FirstFont; delete FFont::FirstFont;
} }
FFont::FirstFont = nullptr; FFont::FirstFont = nullptr;
CurrentConsoleFont = NewConsoleFont = SmallFont = SmallFont2 = BigFont = ConFont = IntermissionFont = nullptr; CurrentConsoleFont = NewSmallFont = NewConsoleFont = SmallFont = SmallFont2 = BigFont = ConFont = IntermissionFont = nullptr;
} }

View file

@ -164,7 +164,7 @@ protected:
}; };
extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *CurrentConsoleFont; extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont;
void V_InitFonts(); void V_InitFonts();
void V_ClearFonts(); void V_ClearFonts();

View file

@ -75,6 +75,9 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
bool lastWasSpace = false; bool lastWasSpace = false;
int kerning = font->GetDefaultKerning (); int kerning = font->GetDefaultKerning ();
// The real isspace is a bit too badly defined, so use our own one
auto myisspace = [](int ch) { return ch == '\t' || ch == '\r' || ch == '\n' || ch == ' '; };
w = 0; w = 0;
while ( (c = GetCharFromString(string)) ) while ( (c = GetCharFromString(string)) )
@ -104,7 +107,7 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
continue; continue;
} }
if (iswspace(c)) if (myisspace(c))
{ {
if (!lastWasSpace) if (!lastWasSpace)
{ {
@ -137,12 +140,12 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
start = space; start = space;
space = NULL; space = NULL;
while (*start && iswspace (*start) && *start != '\n') while (*start && myisspace (*start) && *start != '\n')
start++; start++;
if (*start == '\n') if (*start == '\n')
start++; start++;
else else
while (*start && iswspace (*start)) while (*start && myisspace (*start))
start++; start++;
string = start; string = start;
} }
@ -160,7 +163,7 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
while (s < string) while (s < string)
{ {
// If there is any non-white space in the remainder of the string, add it. // If there is any non-white space in the remainder of the string, add it.
if (!iswspace (*s++)) if (!myisspace (*s++))
{ {
auto i = Lines.Reserve(1); auto i = Lines.Reserve(1);
breakit (&Lines[i], font, start, string, linecolor); breakit (&Lines[i], font, start, string, linecolor);

View file

@ -44,6 +44,7 @@ struct FBrokenLines
}; };
#define TEXTCOLOR_ESCAPE '\034' #define TEXTCOLOR_ESCAPE '\034'
#define TEXTCOLOR_ESCAPESTR "\034"
#define TEXTCOLOR_BRICK "\034A" #define TEXTCOLOR_BRICK "\034A"
#define TEXTCOLOR_TAN "\034B" #define TEXTCOLOR_TAN "\034B"

View file

@ -397,6 +397,7 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_BOOL(dontcrunchcorpses, "dontcrunchcorpses") GAMEINFOKEY_BOOL(dontcrunchcorpses, "dontcrunchcorpses")
GAMEINFOKEY_BOOL(correctprintbold, "correctprintbold") GAMEINFOKEY_BOOL(correctprintbold, "correctprintbold")
GAMEINFOKEY_BOOL(forcetextinmenus, "forcetextinmenus") GAMEINFOKEY_BOOL(forcetextinmenus, "forcetextinmenus")
GAMEINFOKEY_BOOL(forcenogfxsubstitution, "forcenogfxsubstitution")
GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter")
GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast")
GAMEINFOKEY_COLOR(dimcolor, "dimcolor") GAMEINFOKEY_COLOR(dimcolor, "dimcolor")

View file

@ -121,6 +121,7 @@ struct gameinfo_t
bool dontcrunchcorpses; bool dontcrunchcorpses;
bool correctprintbold; bool correctprintbold;
bool forcetextinmenus; bool forcetextinmenus;
bool forcenogfxsubstitution;
TArray<FName> creditPages; TArray<FName> creditPages;
TArray<FName> finalePages; TArray<FName> finalePages;
TArray<FName> infoPages; TArray<FName> infoPages;

View file

@ -464,7 +464,7 @@ void STAT_ChangeLevel(const char *newl, FLevelLocals *Level)
section.ToUpper(); section.ToUpper();
const char *ep_name = StartEpisode->mEpisodeName; const char *ep_name = StartEpisode->mEpisodeName;
if (*ep_name == '$') ep_name = GStrings[ep_name+1]; if (*ep_name == '$') ep_name = GStrings(ep_name+1);
FStatistics *sl = GetStatisticsList(EpisodeStatistics, section, ep_name); FStatistics *sl = GetStatisticsList(EpisodeStatistics, section, ep_name);
int statvals[6] = {0,0,0,0,0,0}; int statvals[6] = {0,0,0,0,0,0};

View file

@ -45,6 +45,7 @@
#include "d_player.h" #include "d_player.h"
#include "xlsxread/xlsxio_read.h" #include "xlsxread/xlsxio_read.h"
EXTERN_CVAR(String, language)
//========================================================================== //==========================================================================
// //
@ -63,7 +64,6 @@ void FStringTable::LoadStrings ()
if (!LoadLanguageFromSpreadsheet(lump)) if (!LoadLanguageFromSpreadsheet(lump))
LoadLanguage (lump); LoadLanguage (lump);
} }
SetLanguageIDs();
UpdateLanguage(); UpdateLanguage();
allMacros.Clear(); allMacros.Clear();
} }
@ -150,13 +150,15 @@ bool FStringTable::readSheetIntoTable(xlsxioreader reader, const char *sheetname
int column = 0; int column = 0;
char *value; char *value;
table.Reserve(1); table.Reserve(1);
auto myisspace = [](int ch) { return ch == '\t' || ch == '\r' || ch == '\n' || ch == ' '; };
while ((value = xlsxioread_sheet_next_cell(sheet)) != nullptr) while ((value = xlsxioread_sheet_next_cell(sheet)) != nullptr)
{ {
auto vcopy = value; auto vcopy = value;
if (table.Size() <= (unsigned)row) table.Reserve(1); if (table.Size() <= (unsigned)row) table.Reserve(1);
while (*vcopy && iswspace((unsigned char)*vcopy)) vcopy++; // skip over leaading whitespace; while (*vcopy && myisspace((unsigned char)*vcopy)) vcopy++; // skip over leaading whitespace;
auto vend = vcopy + strlen(vcopy); auto vend = vcopy + strlen(vcopy);
while (vend > vcopy && iswspace((unsigned char)vend[-1])) *--vend = 0; // skip over trailing whitespace while (vend > vcopy && myisspace((unsigned char)vend[-1])) *--vend = 0; // skip over trailing whitespace
ProcessEscapes(vcopy); ProcessEscapes(vcopy);
table[row].Push(vcopy); table[row].Push(vcopy);
column++; column++;
@ -376,6 +378,12 @@ void FStringTable::InsertString(int langid, FName label, const FString &string)
void FStringTable::UpdateLanguage() void FStringTable::UpdateLanguage()
{ {
size_t langlen = strlen(language);
int LanguageID = (langlen < 2 || langlen > 3) ?
MAKE_ID('e', 'n', 'u', '\0') :
MAKE_ID(language[0], language[1], language[2], '\0');
currentLanguageSet.Clear(); currentLanguageSet.Clear();
auto checkone = [&](uint32_t lang_id) auto checkone = [&](uint32_t lang_id)
@ -387,11 +395,8 @@ void FStringTable::UpdateLanguage()
checkone(dehacked_table); checkone(dehacked_table);
checkone(global_table); checkone(global_table);
for (int i = 0; i < 4; ++i) checkone(LanguageID);
{ checkone(LanguageID & MAKE_ID(0xff, 0xff, 0, 0));
checkone(LanguageIDs[i]);
checkone(LanguageIDs[i] & MAKE_ID(0xff, 0xff, 0, 0));
}
checkone(default_table); checkone(default_table);
} }

View file

@ -403,9 +403,11 @@ FTexture *FTextureManager::FindTexture(const char *texname, ETextureType usetype
// 3: Only replace if the string is not the default and the graphic comes from the IWAD. Never replace a localized graphic. // 3: Only replace if the string is not the default and the graphic comes from the IWAD. Never replace a localized graphic.
// 4: Like 1, but lets localized graphics pass. // 4: Like 1, but lets localized graphics pass.
// //
// The default is 3, which only replaces known content with non-default texts.
//
//========================================================================== //==========================================================================
CUSTOM_CVAR(Int, cl_localizationmode,0, CVAR_ARCHIVE) CUSTOM_CVAR(Int, cl_gfxlocalization, 3, CVAR_ARCHIVE)
{ {
if (self < 0 || self > 4) self = 0; if (self < 0 || self > 4) self = 0;
} }
@ -421,8 +423,8 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut
if (!texnum.isValid()) return false; if (!texnum.isValid()) return false;
// First the unconditional settings, 0='never' and 1='always'. // First the unconditional settings, 0='never' and 1='always'.
if (cl_localizationmode == 1 || gameinfo.forcetextinmenus) return false; if (cl_gfxlocalization == 1 || gameinfo.forcetextinmenus) return false;
if (cl_localizationmode == 0) return true; if (cl_gfxlocalization == 0 || gameinfo.forcenogfxsubstitution) return true;
uint32_t langtable = 0; uint32_t langtable = 0;
if (*substitute == '$') substitute = GStrings.GetString(substitute+1, &langtable); if (*substitute == '$') substitute = GStrings.GetString(substitute+1, &langtable);
@ -433,11 +435,11 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut
if (localizedTex != texnum.GetIndex()) return true; // Do not substitute a localized variant of the graphics patch. if (localizedTex != texnum.GetIndex()) return true; // Do not substitute a localized variant of the graphics patch.
// For mode 4 we are done now. // For mode 4 we are done now.
if (cl_localizationmode == 4) return false; if (cl_gfxlocalization == 4) return false;
// Mode 2 and 3 must reject any text replacement from the default language tables. // Mode 2 and 3 must reject any text replacement from the default language tables.
if ((langtable & MAKE_ID(255,0,0,0)) == MAKE_ID('*', 0, 0, 0)) return true; // Do not substitute if the string comes from the default table. if ((langtable & MAKE_ID(255,0,0,0)) == MAKE_ID('*', 0, 0, 0)) return true; // Do not substitute if the string comes from the default table.
if (cl_localizationmode == 2) return false; if (cl_gfxlocalization == 2) return false;
// Mode 3 must also reject substitutions for non-IWAD content. // Mode 3 must also reject substitutions for non-IWAD content.
int file = Wads.GetLumpFile(Textures[texnum.GetIndex()].Texture->SourceLump); int file = Wads.GetLumpFile(Textures[texnum.GetIndex()].Texture->SourceLump);
@ -1300,17 +1302,20 @@ int FTextureManager::PalCheck(int tex)
// FTextureManager :: PalCheck // FTextureManager :: PalCheck
// //
//========================================================================== //==========================================================================
EXTERN_CVAR(String, language)
int FTextureManager::ResolveLocalizedTexture(int tex) int FTextureManager::ResolveLocalizedTexture(int tex)
{ {
for(int i = 0; i < 4; i++) size_t langlen = strlen(language);
{ int lang = (langlen < 2 || langlen > 3) ?
uint32_t lang = LanguageIDs[i]; MAKE_ID('e', 'n', 'u', '\0') :
uint64_t index = (uint64_t(lang) << 32) + tex; MAKE_ID(language[0], language[1], language[2], '\0');
if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex;
index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex; uint64_t index = (uint64_t(lang) << 32) + tex;
if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex;
} index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex;
if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex;
return tex; return tex;
} }

View file

@ -847,6 +847,7 @@ void DIntermissionController::OnDestroy ()
void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, uint8_t state) void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, uint8_t state)
{ {
ScaleOverrider s;
if (DIntermissionController::CurrentIntermission != NULL) if (DIntermissionController::CurrentIntermission != NULL)
{ {
DIntermissionController::CurrentIntermission->Destroy(); DIntermissionController::CurrentIntermission->Destroy();
@ -892,6 +893,7 @@ void F_StartIntermission(FName seq, uint8_t state)
bool F_Responder (event_t* ev) bool F_Responder (event_t* ev)
{ {
ScaleOverrider s;
if (DIntermissionController::CurrentIntermission != NULL) if (DIntermissionController::CurrentIntermission != NULL)
{ {
return DIntermissionController::CurrentIntermission->Responder(ev); return DIntermissionController::CurrentIntermission->Responder(ev);
@ -907,6 +909,7 @@ bool F_Responder (event_t* ev)
void F_Ticker () void F_Ticker ()
{ {
ScaleOverrider s;
if (DIntermissionController::CurrentIntermission != NULL) if (DIntermissionController::CurrentIntermission != NULL)
{ {
DIntermissionController::CurrentIntermission->Ticker(); DIntermissionController::CurrentIntermission->Ticker();
@ -921,6 +924,7 @@ void F_Ticker ()
void F_Drawer () void F_Drawer ()
{ {
ScaleOverrider s;
if (DIntermissionController::CurrentIntermission != NULL) if (DIntermissionController::CurrentIntermission != NULL)
{ {
DIntermissionController::CurrentIntermission->Drawer(); DIntermissionController::CurrentIntermission->Drawer();
@ -936,6 +940,7 @@ void F_Drawer ()
void F_EndFinale () void F_EndFinale ()
{ {
ScaleOverrider s;
if (DIntermissionController::CurrentIntermission != NULL) if (DIntermissionController::CurrentIntermission != NULL)
{ {
DIntermissionController::CurrentIntermission->Destroy(); DIntermissionController::CurrentIntermission->Destroy();
@ -951,6 +956,7 @@ void F_EndFinale ()
void F_AdvanceIntermission() void F_AdvanceIntermission()
{ {
ScaleOverrider s;
if (DIntermissionController::CurrentIntermission != NULL) if (DIntermissionController::CurrentIntermission != NULL)
{ {
DIntermissionController::CurrentIntermission->mAdvance = true; DIntermissionController::CurrentIntermission->mAdvance = true;

View file

@ -405,7 +405,7 @@ DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu)
// //
//============================================================================= //=============================================================================
EXTERN_CVAR(Int, cl_localizationmode) EXTERN_CVAR(Int, cl_gfxlocalization)
void M_SetMenu(FName menu, int param) void M_SetMenu(FName menu, int param)
@ -420,7 +420,7 @@ void M_SetMenu(FName menu, int param)
{ {
menu = NAME_MainmenuTextOnly; menu = NAME_MainmenuTextOnly;
} }
else else if (cl_gfxlocalization != 0 && !gameinfo.forcenogfxsubstitution)
{ {
// For these games we must check up-front if they get localized because in that case another template must be used. // For these games we must check up-front if they get localized because in that case another template must be used.
DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Mainmenu); DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Mainmenu);
@ -429,7 +429,7 @@ void M_SetMenu(FName menu, int param)
if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor))) if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
{ {
DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc); DListMenuDescriptor *ld = static_cast<DListMenuDescriptor*>(*desc);
if (ld->mFromEngine && cl_localizationmode != 0) if (ld->mFromEngine)
{ {
// This assumes that replacing one graphic will replace all of them. // This assumes that replacing one graphic will replace all of them.
// So this only checks the "New game" entry for localization capability. // So this only checks the "New game" entry for localization capability.

View file

@ -536,8 +536,6 @@
extern FILE *Logfile;
FRandom pr_acs ("ACS"); FRandom pr_acs ("ACS");
// I imagine this much stack space is probably overkill, but it could // I imagine this much stack space is probably overkill, but it could
@ -8614,10 +8612,7 @@ scriptwait:
if (pcd == PCD_ENDPRINTBOLD || screen == NULL || if (pcd == PCD_ENDPRINTBOLD || screen == NULL ||
screen->CheckLocalView()) screen->CheckLocalView())
{ {
if (pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (Level->flags2 & LEVEL2_HEXENHACK))) C_MidPrint (activefont, work, pcd == PCD_ENDPRINTBOLD && (gameinfo.correctprintbold || (Level->flags2 & LEVEL2_HEXENHACK)));
C_MidPrintBold(activefont, work);
else
C_MidPrint (activefont, work);
} }
STRINGBUILDER_FINISH(work); STRINGBUILDER_FINISH(work);
} }
@ -8720,17 +8715,8 @@ scriptwait:
(type & HUDMSG_LAYER_MASK) >> HUDMSG_LAYER_SHIFT); (type & HUDMSG_LAYER_MASK) >> HUDMSG_LAYER_SHIFT);
if (type & HUDMSG_LOG) if (type & HUDMSG_LOG)
{ {
static const char bar[] = TEXTCOLOR_ORANGE "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36" int consolecolor = color >= CR_BRICK && color <= CR_YELLOW ? color + 'A' : '-';
"\36\36\36\36\36\36\36\36\36\36\36\36\37" TEXTCOLOR_NORMAL "\n"; Printf(PRINT_NONOTIFY, "\n" TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", consolecolor, console_bar, work.GetChars(), console_bar);
char consolecolor[3];
consolecolor[0] = '\x1c';
consolecolor[1] = color >= CR_BRICK && color <= CR_YELLOW ? color + 'A' : '-';
consolecolor[2] = '\0';
AddToConsole (-1, bar);
AddToConsole (-1, consolecolor);
AddToConsole (-1, work);
AddToConsole (-1, bar);
} }
} }
} }

View file

@ -1341,7 +1341,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PrintBold)
con_midtime = float(time); con_midtime = float(time);
} }
FString formatted = strbin1(text); FString formatted = strbin1(text);
C_MidPrintBold(font, formatted.GetChars()); C_MidPrint(font, formatted.GetChars(), true);
con_midtime = saved; con_midtime = saved;
return 0; return 0;
} }

View file

@ -695,8 +695,7 @@ static void TerminalResponse (const char *str)
if (StatusBar != NULL) if (StatusBar != NULL)
{ {
AddToConsole(-1, str); Printf(PRINT_NONOTIFY, "%s\n", str);
AddToConsole(-1, "\n");
// The message is positioned a bit above the menu choices, because // The message is positioned a bit above the menu choices, because
// merchants can tell you something like this but continue to show // merchants can tell you something like this but continue to show
// their dialogue screen. I think most other conversations use this // their dialogue screen. I think most other conversations use this

View file

@ -98,7 +98,7 @@ CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO)
CVAR(Bool, cl_doautoaim, false, CVAR_ARCHIVE) CVAR(Bool, cl_doautoaim, false, CVAR_ARCHIVE)
static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 * posforwindowcheck = NULL); static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 * posforwindowcheck = NULL);
static void SpawnShootDecal(AActor *t1, const FTraceResults &trace); static void SpawnShootDecal(AActor *t1, AActor *defaults, const FTraceResults &trace);
static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff); static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff);
static FRandom pr_tracebleed("TraceBleed"); static FRandom pr_tracebleed("TraceBleed");
@ -4568,20 +4568,20 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
{ {
// [ZK] If puff has FORCEDECAL set, do not use the weapon's decal // [ZK] If puff has FORCEDECAL set, do not use the weapon's decal
if (puffDefaults->flags7 & MF7_FORCEDECAL && puff != NULL && puff->DecalGenerator) if (puffDefaults->flags7 & MF7_FORCEDECAL && puff != NULL && puff->DecalGenerator)
SpawnShootDecal(puff, trace); SpawnShootDecal(puff, puff, trace);
else else
SpawnShootDecal(t1, trace); SpawnShootDecal(t1, t1, trace);
} }
// Else, look if the bulletpuff has a decal defined. // Else, look if the bulletpuff has a decal defined.
else if (puff != NULL && puff->DecalGenerator) else if (puff != NULL && puff->DecalGenerator)
{ {
SpawnShootDecal(puff, trace); SpawnShootDecal(puff, puff, trace);
} }
else else
{ {
SpawnShootDecal(t1, trace); SpawnShootDecal(t1, t1, trace);
} }
} }
else if (puff != NULL && else if (puff != NULL &&
@ -5268,9 +5268,9 @@ void P_RailAttack(FRailParams *p)
puff->Destroy(); puff->Destroy();
} }
if (puffDefaults != nullptr && puffDefaults->flags7 & MF7_FORCEDECAL && puffDefaults->DecalGenerator) if (puffDefaults != nullptr && puffDefaults->flags7 & MF7_FORCEDECAL && puffDefaults->DecalGenerator)
SpawnShootDecal(puffDefaults, trace); SpawnShootDecal(source, puffDefaults, trace);
else else
SpawnShootDecal(source, trace); SpawnShootDecal(source, source, trace);
} }
if (trace.HitType == TRACE_HitFloor || trace.HitType == TRACE_HitCeiling) if (trace.HitType == TRACE_HitFloor || trace.HitType == TRACE_HitCeiling)
@ -6746,19 +6746,19 @@ bool P_ChangeSector(sector_t *sector, int crunch, double amt, int floorOrCeil, b
// //
//========================================================================== //==========================================================================
void SpawnShootDecal(AActor *t1, const FTraceResults &trace) void SpawnShootDecal(AActor *t1, AActor *defaults, const FTraceResults &trace)
{ {
FDecalBase *decalbase = NULL; FDecalBase *decalbase = nullptr;
if (t1->player != NULL && t1->player->ReadyWeapon != NULL) if (defaults->player != nullptr && defaults->player->ReadyWeapon != nullptr)
{ {
decalbase = t1->player->ReadyWeapon->DecalGenerator; decalbase = defaults->player->ReadyWeapon->DecalGenerator;
} }
else else
{ {
decalbase = t1->DecalGenerator; decalbase = defaults->DecalGenerator;
} }
if (decalbase != NULL) if (decalbase != nullptr)
{ {
DImpactDecal::StaticCreate(t1->Level, decalbase->GetDecal(), DImpactDecal::StaticCreate(t1->Level, decalbase->GetDecal(),
trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor); trace.HitPos, trace.Line->sidedef[trace.Side], trace.ffloor);

View file

@ -426,9 +426,7 @@ void player_t::SetLogText (const char *text)
if (mo && mo->CheckLocalView()) if (mo && mo->CheckLocalView())
{ {
// Print log text to console // Print log text to console
AddToConsole(-1, TEXTCOLOR_GOLD); Printf(PRINT_NONOTIFY, TEXTCOLOR_GOLD "%s\n", LogText[0] == '$' ? GStrings(text + 1) : text);
AddToConsole(-1, LogText[0] == '$'? GStrings(text+1) : text );
AddToConsole(-1, "\n");
} }
} }

View file

@ -68,21 +68,6 @@ ticcmd_t* I_BaseTiccmd()
//
// SetLanguageIDs
//
void SetLanguageIDs()
{
size_t langlen = strlen(language);
uint32_t lang = (langlen < 2 || langlen > 3)
? MAKE_ID('e', 'n', 'u', '\0')
: MAKE_ID(language[0], language[1], language[2], '\0');
LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang;
}
double PerfToSec, PerfToMillisec; double PerfToSec, PerfToMillisec;
static void CalculateCPUSpeed() static void CalculateCPUSpeed()

View file

@ -45,16 +45,6 @@ struct WadStuff;
#define SHARE_DIR "/usr/local/share/" #define SHARE_DIR "/usr/local/share/"
#endif #endif
// Index values into the LanguageIDs array
enum
{
LANGIDX_UserPreferred,
LANGIDX_UserDefault,
LANGIDX_SysPreferred,
LANGIDX_SysDefault
};
extern uint32_t LanguageIDs[4];
extern void SetLanguageIDs ();
// Called by DoomMain. // Called by DoomMain.
void I_Init (void); void I_Init (void);

View file

@ -149,11 +149,11 @@ void I_SetFPSLimit(int limit)
{ {
FPSLimitTimerEnabled = true; FPSLimitTimerEnabled = true;
if(timer_create(CLOCK_REALTIME, &FPSLimitEvent, &FPSLimitTimer) == -1) if(timer_create(CLOCK_REALTIME, &FPSLimitEvent, &FPSLimitTimer) == -1)
Printf(DMSG_WARNING, "Failed to create FPS limitter event\n"); Printf(DMSG_WARNING, "Failed to create FPS limiter event\n");
itimerspec period = { {0, 0}, {0, 0} }; itimerspec period = { {0, 0}, {0, 0} };
period.it_value.tv_nsec = period.it_interval.tv_nsec = 1000000000 / limit; period.it_value.tv_nsec = period.it_interval.tv_nsec = 1000000000 / limit;
if(timer_settime(FPSLimitTimer, 0, &period, NULL) == -1) if(timer_settime(FPSLimitTimer, 0, &period, NULL) == -1)
Printf(DMSG_WARNING, "Failed to set FPS limitter timer\n"); Printf(DMSG_WARNING, "Failed to set FPS limiter timer\n");
DPrintf(DMSG_NOTIFY, "FPS timer set to %u ms\n", (unsigned int) period.it_interval.tv_nsec / 1000000); DPrintf(DMSG_NOTIFY, "FPS timer set to %u ms\n", (unsigned int) period.it_interval.tv_nsec / 1000000);
} }
} }

View file

@ -92,20 +92,6 @@ void I_EndRead(void)
} }
//
// SetLanguageIDs
//
void SetLanguageIDs ()
{
size_t langlen = strlen(language);
uint32_t lang = (langlen < 2 || langlen > 3) ?
MAKE_ID('e','n','u','\0') :
MAKE_ID(language[0],language[1],language[2],'\0');
LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang;
}
// //
// I_Init // I_Init
// //

View file

@ -223,9 +223,9 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind
else else
{ {
viewwindow.WidescreenRatio = ActiveRatio(fullWidth, fullHeight); viewwindow.WidescreenRatio = ActiveRatio(fullWidth, fullHeight);
DrawFSHUD = (windowSize == 11);
} }
DrawFSHUD = (windowSize == 11);
// [RH] Sky height fix for screens not 200 (or 240) pixels tall // [RH] Sky height fix for screens not 200 (or 240) pixels tall
R_InitSkyMap (); R_InitSkyMap ();

View file

@ -59,6 +59,7 @@ public:
void BindBase() void BindBase()
{ {
mBuffer->BindBase(); mBuffer->BindBase();
mLastMappedIndex = UINT_MAX;
} }
}; };

View file

@ -183,21 +183,21 @@ void S_NoiseDebug (void)
int y, color; int y, color;
y = 32 * CleanYfac; y = 32 * CleanYfac;
screen->DrawText (SmallFont, CR_YELLOW, 0, y, "*** SOUND DEBUG INFO ***", TAG_DONE); screen->DrawText (NewConsoleFont, CR_YELLOW, 0, y, "*** SOUND DEBUG INFO ***", TAG_DONE);
y += 8; y += NewConsoleFont->GetHeight();
screen->DrawText (SmallFont, CR_GOLD, 0, y, "name", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 0, y, "name", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 70, y, "x", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 70, y, "x", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 120, y, "y", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 120, y, "y", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 170, y, "z", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 170, y, "z", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 220, y, "vol", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 220, y, "vol", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 260, y, "dist", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 260, y, "dist", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 300, y, "chan", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 300, y, "chan", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 340, y, "pri", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 340, y, "pri", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 380, y, "flags", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 380, y, "flags", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 460, y, "aud", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 460, y, "aud", TAG_DONE);
screen->DrawText (SmallFont, CR_GOLD, 520, y, "pos", TAG_DONE); screen->DrawText (NewConsoleFont, CR_GOLD, 520, y, "pos", TAG_DONE);
y += 8; y += NewConsoleFont->GetHeight();
if (Channels == NULL) if (Channels == NULL)
{ {
@ -220,52 +220,52 @@ void S_NoiseDebug (void)
// Name // Name
Wads.GetLumpName (temp, S_sfx[chan->SoundID].lumpnum); Wads.GetLumpName (temp, S_sfx[chan->SoundID].lumpnum);
temp[8] = 0; temp[8] = 0;
screen->DrawText (SmallFont, color, 0, y, temp, TAG_DONE); screen->DrawText (NewConsoleFont, color, 0, y, temp, TAG_DONE);
if (!(chan->ChanFlags & CHAN_IS3D)) if (!(chan->ChanFlags & CHAN_IS3D))
{ {
screen->DrawText(SmallFont, color, 70, y, "---", TAG_DONE); // X screen->DrawText(NewConsoleFont, color, 70, y, "---", TAG_DONE); // X
screen->DrawText(SmallFont, color, 120, y, "---", TAG_DONE); // Y screen->DrawText(NewConsoleFont, color, 120, y, "---", TAG_DONE); // Y
screen->DrawText(SmallFont, color, 170, y, "---", TAG_DONE); // Z screen->DrawText(NewConsoleFont, color, 170, y, "---", TAG_DONE); // Z
screen->DrawText(SmallFont, color, 260, y, "---", TAG_DONE); // Distance screen->DrawText(NewConsoleFont, color, 260, y, "---", TAG_DONE); // Distance
} }
else else
{ {
// X coordinate // X coordinate
mysnprintf(temp, countof(temp), "%.0f", origin.X); mysnprintf(temp, countof(temp), "%.0f", origin.X);
screen->DrawText(SmallFont, color, 70, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 70, y, temp, TAG_DONE);
// Y coordinate // Y coordinate
mysnprintf(temp, countof(temp), "%.0f", origin.Z); mysnprintf(temp, countof(temp), "%.0f", origin.Z);
screen->DrawText(SmallFont, color, 120, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 120, y, temp, TAG_DONE);
// Z coordinate // Z coordinate
mysnprintf(temp, countof(temp), "%.0f", origin.Y); mysnprintf(temp, countof(temp), "%.0f", origin.Y);
screen->DrawText(SmallFont, color, 170, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 170, y, temp, TAG_DONE);
// Distance // Distance
if (chan->DistanceScale > 0) if (chan->DistanceScale > 0)
{ {
mysnprintf(temp, countof(temp), "%.0f", (origin - listener).Length()); mysnprintf(temp, countof(temp), "%.0f", (origin - listener).Length());
screen->DrawText(SmallFont, color, 260, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 260, y, temp, TAG_DONE);
} }
else else
{ {
screen->DrawText(SmallFont, color, 260, y, "---", TAG_DONE); screen->DrawText(NewConsoleFont, color, 260, y, "---", TAG_DONE);
} }
} }
// Volume // Volume
mysnprintf(temp, countof(temp), "%.2g", chan->Volume); mysnprintf(temp, countof(temp), "%.2g", chan->Volume);
screen->DrawText(SmallFont, color, 220, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 220, y, temp, TAG_DONE);
// Channel // Channel
mysnprintf(temp, countof(temp), "%d", chan->EntChannel); mysnprintf(temp, countof(temp), "%d", chan->EntChannel);
screen->DrawText(SmallFont, color, 300, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 300, y, temp, TAG_DONE);
// Priority // Priority
mysnprintf(temp, countof(temp), "%d", chan->Priority); mysnprintf(temp, countof(temp), "%d", chan->Priority);
screen->DrawText(SmallFont, color, 340, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 340, y, temp, TAG_DONE);
// Flags // Flags
mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE%sV", mysnprintf(temp, countof(temp), "%s3%sZ%sU%sM%sN%sA%sL%sE%sV",
@ -278,18 +278,18 @@ void S_NoiseDebug (void)
(chan->ChanFlags & CHAN_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK, (chan->ChanFlags & CHAN_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK,
(chan->ChanFlags & CHAN_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK); (chan->ChanFlags & CHAN_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_BLACK);
screen->DrawText(SmallFont, color, 380, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 380, y, temp, TAG_DONE);
// Audibility // Audibility
mysnprintf(temp, countof(temp), "%.4f", GSnd->GetAudibility(chan)); mysnprintf(temp, countof(temp), "%.4f", GSnd->GetAudibility(chan));
screen->DrawText(SmallFont, color, 460, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 460, y, temp, TAG_DONE);
// Position // Position
mysnprintf(temp, countof(temp), "%u", GSnd->GetPosition(chan)); mysnprintf(temp, countof(temp), "%u", GSnd->GetPosition(chan));
screen->DrawText(SmallFont, color, 520, y, temp, TAG_DONE); screen->DrawText(NewConsoleFont, color, 520, y, temp, TAG_DONE);
y += 8; y += NewConsoleFont->GetHeight();
if (chan->PrevChan == &Channels) if (chan->PrevChan == &Channels)
{ {
break; break;

View file

@ -154,7 +154,7 @@ public:
int DisplayWidth, DisplayHeight; int DisplayWidth, DisplayHeight;
FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *CurrentConsoleFont; FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont;
uint32_t Col2RGB8[65][256]; uint32_t Col2RGB8[65][256];
uint32_t *Col2RGB8_LessPrecision[65]; uint32_t *Col2RGB8_LessPrecision[65];
@ -548,13 +548,10 @@ CCMD(clean)
void V_UpdateModeSize (int width, int height) void V_UpdateModeSize (int width, int height)
{ {
int cx1, cx2; // This calculates the menu scale.
V_CalcCleanFacs(320, 200, width, height, &CleanXfac, &CleanYfac, &cx1, &cx2); // The optimal scale will always be to fit a virtual 640 pixel wide display onto the screen.
// Exceptions are made for a few ranges where the available virtual width is > 480.
CleanWidth = width / CleanXfac;
CleanHeight = height / CleanYfac;
assert(CleanWidth >= 320 && CleanHeight >= 200);
int w = screen->GetWidth(); int w = screen->GetWidth();
int factor; int factor;
@ -563,7 +560,11 @@ void V_UpdateModeSize (int width, int height)
else if (w >= 1600 && w < 1920) factor = 3; else if (w >= 1600 && w < 1920) factor = 3;
else factor = w / 640; else factor = w / 640;
CleanXfac_1 = CleanYfac_1 = factor; CleanXfac = CleanYfac = factor;
CleanWidth = width / CleanXfac;
CleanHeight = height / CleanYfac;
CleanYfac_1 = CleanXfac_1 = MAX(1, int (CleanXfac * 0.7));
CleanWidth_1 = width / CleanXfac_1; CleanWidth_1 = width / CleanXfac_1;
CleanHeight_1 = height / CleanYfac_1; CleanHeight_1 = height / CleanYfac_1;
@ -590,52 +591,8 @@ void V_OutputResized (int width, int height)
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2) void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2)
{ {
float ratio; if (designheight < 240 && realheight >= 480) designheight = 240;
int cwidth; *cleanx = *cleany = std::min(realwidth / designwidth, realheight / designheight);
int cheight;
int cx1, cy1, cx2, cy2;
// For larger screems always use at least a 16:9 ratio for clean factor calculation, even if the actual ratio is narrower.
if (realwidth > 1280 && (double)realwidth / realheight < 16./9)
{
realheight = realwidth * 9 / 16;
}
ratio = ActiveRatio(realwidth, realheight);
if (AspectTallerThanWide(ratio))
{
cwidth = realwidth;
cheight = realheight * AspectMultiplier(ratio) / 48;
}
else
{
cwidth = realwidth * AspectMultiplier(ratio) / 48;
cheight = realheight;
}
// Use whichever pair of cwidth/cheight or width/height that produces less difference
// between CleanXfac and CleanYfac.
cx1 = MAX(cwidth / designwidth, 1);
cy1 = MAX(cheight / designheight, 1);
cx2 = MAX(realwidth / designwidth, 1);
cy2 = MAX(realheight / designheight, 1);
if (abs(cx1 - cy1) <= abs(cx2 - cy2) || MAX(cx1, cx2) >= 4)
{ // e.g. 640x360 looks better with this.
*cleanx = cx1;
*cleany = cy1;
}
else
{ // e.g. 720x480 looks better with this.
*cleanx = cx2;
*cleany = cy2;
}
if (*cleanx < *cleany)
*cleany = *cleanx;
else
*cleanx = *cleany;
if (_cx1 != NULL) *_cx1 = cx1;
if (_cx2 != NULL) *_cx2 = cx2;
} }
bool IVideo::SetResolution () bool IVideo::SetResolution ()
@ -960,6 +917,7 @@ DEFINE_GLOBAL(SmallFont2)
DEFINE_GLOBAL(BigFont) DEFINE_GLOBAL(BigFont)
DEFINE_GLOBAL(ConFont) DEFINE_GLOBAL(ConFont)
DEFINE_GLOBAL(NewConsoleFont) DEFINE_GLOBAL(NewConsoleFont)
DEFINE_GLOBAL(NewSmallFont)
DEFINE_GLOBAL(IntermissionFont) DEFINE_GLOBAL(IntermissionFont)
DEFINE_GLOBAL(CleanXfac) DEFINE_GLOBAL(CleanXfac)
DEFINE_GLOBAL(CleanYfac) DEFINE_GLOBAL(CleanYfac)

View file

@ -625,4 +625,35 @@ inline int active_con_scale()
} }
class ScaleOverrider
{
int savedxfac, savedyfac, savedwidth, savedheight;
public:
// This is to allow certain elements to use an optimal fullscreen scale which for the menu would be too large.
// The old code contained far too much mess to compensate for the menus which negatively affected everything else.
// However, for compatibility reasons the currently used variables cannot be changed so they have to be overridden temporarily.
// This class provides a safe interface for this because it ensures that the values get restored afterward.
// Currently, the intermission and the level summary screen use this.
ScaleOverrider()
{
savedxfac = CleanXfac;
savedyfac = CleanYfac;
savedwidth = CleanWidth;
savedheight = CleanHeight;
V_CalcCleanFacs(320, 200, screen->GetWidth(), screen->GetHeight(), &CleanXfac, &CleanYfac);
CleanWidth = screen->GetWidth() / CleanXfac;
CleanHeight = screen->GetHeight() / CleanYfac;
}
~ScaleOverrider()
{
CleanXfac = savedxfac;
CleanYfac = savedyfac;
CleanWidth = savedwidth;
CleanHeight = savedheight;
}
};
#endif // __V_VIDEO_H__ #endif // __V_VIDEO_H__

View file

@ -701,6 +701,7 @@ void WI_Ticker()
{ {
if (WI_Screen) if (WI_Screen)
{ {
ScaleOverrider s;
IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Ticker) IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Ticker)
{ {
VMValue self = WI_Screen; VMValue self = WI_Screen;
@ -720,6 +721,7 @@ void WI_Drawer()
{ {
if (WI_Screen) if (WI_Screen)
{ {
ScaleOverrider s;
IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Drawer) IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Drawer)
{ {
VMValue self = WI_Screen; VMValue self = WI_Screen;
@ -767,6 +769,7 @@ void WI_Start(wbstartstruct_t *wbstartstruct)
SN_StopAllSequences(Level); SN_StopAllSequences(Level);
} }
WI_Screen = cls->CreateNew(); WI_Screen = cls->CreateNew();
ScaleOverrider s;
IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Start) IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Start)
{ {
VMValue val[2] = { WI_Screen, wbstartstruct }; VMValue val[2] = { WI_Screen, wbstartstruct };

View file

@ -878,12 +878,7 @@ void DoMain (HINSTANCE hInstance)
} }
if (StdOut == NULL) if (StdOut == NULL)
{ {
// AttachConsole was introduced with Windows XP. (OTOH, since we if (AttachConsole(ATTACH_PARENT_PROCESS))
// have to share the console with the shell, I'm not sure if it's
// a good idea to actually attach to it.)
typedef BOOL (WINAPI *ac)(DWORD);
ac attach_console = kernel != NULL ? (ac)GetProcAddress(kernel, "AttachConsole") : NULL;
if (attach_console != NULL && attach_console(ATTACH_PARENT_PROCESS))
{ {
StdOut = GetStdHandle(STD_OUTPUT_HANDLE); StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD foo; WriteFile(StdOut, "\n", 1, &foo, NULL); DWORD foo; WriteFile(StdOut, "\n", 1, &foo, NULL);
@ -893,6 +888,29 @@ void DoMain (HINSTANCE hInstance)
{ {
StdOut = GetStdHandle(STD_OUTPUT_HANDLE); StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
} }
// These two functions do not exist in Windows XP.
BOOL (WINAPI* p_GetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
BOOL (WINAPI* p_SetCurrentConsoleFontEx)(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
p_SetCurrentConsoleFontEx = (decltype(p_SetCurrentConsoleFontEx))GetProcAddress(kernel, "SetCurrentConsoleFontEx");
p_GetCurrentConsoleFontEx = (decltype(p_GetCurrentConsoleFontEx))GetProcAddress(kernel, "GetCurrentConsoleFontEx");
if (p_SetCurrentConsoleFontEx && p_GetCurrentConsoleFontEx)
{
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof(cfi);
if (p_GetCurrentConsoleFontEx(StdOut, false, &cfi))
{
if (*cfi.FaceName == 0) // If the face name is empty, the default (useless) raster font is actoive.
{
//cfi.dwFontSize = { 8, 14 };
wcscpy(cfi.FaceName, L"Lucida Console");
cfi.FontFamily = FF_DONTCARE;
p_SetCurrentConsoleFontEx(StdOut, false, &cfi);
}
}
}
FancyStdOut = true; FancyStdOut = true;
} }
} }

View file

@ -273,65 +273,6 @@ void I_DetectOS(void)
info.dwBuildNumber, info.szCSDVersion); info.dwBuildNumber, info.szCSDVersion);
} }
//==========================================================================
//
// SubsetLanguageIDs
//
// Helper function for SetLanguageIDs.
//
//==========================================================================
static void SubsetLanguageIDs(LCID id, LCTYPE type, int idx)
{
char buf[8];
LCID langid;
char *idp;
if (!GetLocaleInfoA(id, type, buf, 8))
return;
langid = MAKELCID(strtoul(buf, NULL, 16), SORT_DEFAULT);
if (!GetLocaleInfoA(langid, LOCALE_SABBREVLANGNAME, buf, 8))
return;
idp = (char *)(&LanguageIDs[idx]);
memset (idp, 0, 4);
idp[0] = tolower(buf[0]);
idp[1] = tolower(buf[1]);
idp[2] = tolower(buf[2]);
idp[3] = 0;
}
//==========================================================================
//
// SetLanguageIDs
//
//==========================================================================
void SetLanguageIDs()
{
size_t langlen = strlen(language);
if (langlen < 2 || langlen > 3)
{
memset(LanguageIDs, 0, sizeof(LanguageIDs));
SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, 0);
SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 1);
SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, 2);
SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 3);
}
else
{
uint32_t lang = 0;
((uint8_t *)&lang)[0] = (language)[0];
((uint8_t *)&lang)[1] = (language)[1];
((uint8_t *)&lang)[2] = (language)[2];
LanguageIDs[0] = lang;
LanguageIDs[1] = lang;
LanguageIDs[2] = lang;
LanguageIDs[3] = lang;
}
}
//========================================================================== //==========================================================================
// //
// CalculateCPUSpeed // CalculateCPUSpeed

View file

@ -34,17 +34,6 @@
struct ticcmd_t; struct ticcmd_t;
struct WadStuff; struct WadStuff;
// Index values into the LanguageIDs array
enum
{
LANGIDX_UserPreferred,
LANGIDX_UserDefault,
LANGIDX_SysPreferred,
LANGIDX_SysDefault
};
extern uint32_t LanguageIDs[4];
extern void SetLanguageIDs ();
// [RH] Detects the OS the game is running under. // [RH] Detects the OS the game is running under.
void I_DetectOS (void); void I_DetectOS (void);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

View file

@ -75,9 +75,7 @@ MUSIC_READ_M = "read_m";
MUSIC_DM2TTL = "dm2ttl"; MUSIC_DM2TTL = "dm2ttl";
MUSIC_DM2INT = "dm2int"; MUSIC_DM2INT = "dm2int";
// MBF (BOOM?) narration backgrounds // MBF (BOOM?) narration backgrounds
bgflatE1 = "FLOOR4_8"; bgflatE1 = "FLOOR4_8";
bgflatE2 = "SFLR6_1"; bgflatE2 = "SFLR6_1";
bgflatE3 = "MFLR8_4"; bgflatE3 = "MFLR8_4";
@ -93,3 +91,237 @@ bgcastcall = "BOSSBACK";
TAG_QUEST4 = "quest4"; TAG_QUEST4 = "quest4";
TAG_QUEST5 = "quest5"; TAG_QUEST5 = "quest5";
TAG_QUEST6 = "quest4"; TAG_QUEST6 = "quest4";
// For printing a custom banner to the console. Must be overridden by mods.
STARTUP1 = "";
STARTUP2 = "";
STARTUP3 = "";
STARTUP4 = "";
STARTUP5 = "";
// Placeholder definitions for strings that are in the game content table where the labels are needed even when that file is not loaded.
// Level names
HUSTR_E1M1 = "";
HUSTR_E1M2 = "";
HUSTR_E1M3 = "";
HUSTR_E1M4 = "";
HUSTR_E1M5 = "";
HUSTR_E1M6 = "";
HUSTR_E1M7 = "";
HUSTR_E1M8 = "";
HUSTR_E1M9 = "";
HUSTR_E2M1 = "";
HUSTR_E2M2 = "";
HUSTR_E2M3 = "";
HUSTR_E2M4 = "";
HUSTR_E2M5 = "";
HUSTR_E2M6 = "";
HUSTR_E2M7 = "";
HUSTR_E2M8 = "";
HUSTR_E2M9 = "";
HUSTR_E3M1 = "";
HUSTR_E3M2 = "";
HUSTR_E3M3 = "";
HUSTR_E3M4 = "";
HUSTR_E3M5 = "";
HUSTR_E3M6 = "";
HUSTR_E3M7 = "";
HUSTR_E3M8 = "";
HUSTR_E3M9 = "";
HUSTR_E4M1 = "";
HUSTR_E4M2 = "";
HUSTR_E4M3 = "";
HUSTR_E4M4 = "";
HUSTR_E4M5 = "";
HUSTR_E4M6 = "";
HUSTR_E4M7 = "";
HUSTR_E4M8 = "";
HUSTR_E4M9 = "";
HHUSTR_E1M1 = "";
HHUSTR_E1M2 = "";
HHUSTR_E1M3 = "";
HHUSTR_E1M4 = "";
HHUSTR_E1M5 = "";
HHUSTR_E1M6 = "";
HHUSTR_E1M7 = "";
HHUSTR_E1M8 = "";
HHUSTR_E1M9 = "";
HHUSTR_E2M1 = "";
HHUSTR_E2M2 = "";
HHUSTR_E2M3 = "";
HHUSTR_E2M4 = "";
HHUSTR_E2M5 = "";
HHUSTR_E2M6 = "";
HHUSTR_E2M7 = "";
HHUSTR_E2M8 = "";
HHUSTR_E2M9 = "";
HHUSTR_E3M1 = "";
HHUSTR_E3M2 = "";
HHUSTR_E3M3 = "";
HHUSTR_E3M4 = "";
HHUSTR_E3M5 = "";
HHUSTR_E3M6 = "";
HHUSTR_E3M7 = "";
HHUSTR_E3M8 = "";
HHUSTR_E3M9 = "";
HHUSTR_E4M1 = "";
HHUSTR_E4M2 = "";
HHUSTR_E4M3 = "";
HHUSTR_E4M4 = "";
HHUSTR_E4M5 = "";
HHUSTR_E4M6 = "";
HHUSTR_E4M7 = "";
HHUSTR_E4M8 = "";
HHUSTR_E4M9 = "";
HHUSTR_E5M1 = "";
HHUSTR_E5M2 = "";
HHUSTR_E5M3 = "";
HHUSTR_E5M4 = "";
HHUSTR_E5M5 = "";
HHUSTR_E5M6 = "";
HHUSTR_E5M7 = "";
HHUSTR_E5M8 = "";
HHUSTR_E5M9 = "";
HUSTR_1 = "";
HUSTR_2 = "";
HUSTR_3 = "";
HUSTR_4 = "";
HUSTR_5 = "";
HUSTR_6 = "";
HUSTR_7 = "";
HUSTR_8 = "";
HUSTR_9 = "";
HUSTR_10 = "";
HUSTR_11 = "";
HUSTR_12 = "";
HUSTR_13 = "";
HUSTR_14 = "";
HUSTR_15 = "";
HUSTR_16 = "";
HUSTR_17 = "";
HUSTR_18 = "";
HUSTR_19 = "";
HUSTR_20 = "";
HUSTR_21 = "";
HUSTR_22 = "";
HUSTR_23 = "";
HUSTR_24 = "";
HUSTR_25 = "";
HUSTR_26 = "";
HUSTR_27 = "";
HUSTR_28 = "";
HUSTR_29 = "";
HUSTR_30 = "";
HUSTR_31 = "";
HUSTR_32 = "";
HUSTR_31B = "";
HUSTR_32B = "";
HUSTR_33 = "";
NHUSTR_1 = "";
NHUSTR_2 = "";
NHUSTR_3 = "";
NHUSTR_4 = "";
NHUSTR_5 = "";
NHUSTR_6 = "";
NHUSTR_7 = "";
NHUSTR_8 = "";
NHUSTR_9 = "";
PHUSTR_1 = "";
PHUSTR_2 = "";
PHUSTR_3 = "";
PHUSTR_4 = "";
PHUSTR_5 = "";
PHUSTR_6 = "";
PHUSTR_7 = "";
PHUSTR_8 = "";
PHUSTR_9 = "";
PHUSTR_10 = "";
PHUSTR_11 = "";
PHUSTR_12 = "";
PHUSTR_13 = "";
PHUSTR_14 = "";
PHUSTR_15 = "";
PHUSTR_16 = "";
PHUSTR_17 = "";
PHUSTR_18 = "";
PHUSTR_19 = "";
PHUSTR_20 = "";
PHUSTR_21 = "";
PHUSTR_22 = "";
PHUSTR_23 = "";
PHUSTR_24 = "";
PHUSTR_25 = "";
PHUSTR_26 = "";
PHUSTR_27 = "";
PHUSTR_28 = "";
PHUSTR_29 = "";
PHUSTR_30 = "";
PHUSTR_31 = "";
PHUSTR_32 = "";
THUSTR_1 = "";
THUSTR_2 = "";
THUSTR_3 = "";
THUSTR_4 = "";
THUSTR_5 = "";
THUSTR_6 = "";
THUSTR_7 = "";
THUSTR_8 = "";
THUSTR_9 = "";
THUSTR_10 = "";
THUSTR_11 = "";
THUSTR_12 = "";
THUSTR_13 = "";
THUSTR_14 = "";
THUSTR_15 = "";
THUSTR_16 = "";
THUSTR_17 = "";
THUSTR_18 = "";
THUSTR_19 = "";
THUSTR_20 = "";
THUSTR_21 = "";
THUSTR_22 = "";
THUSTR_23 = "";
THUSTR_24 = "";
THUSTR_25 = "";
THUSTR_26 = "";
THUSTR_27 = "";
THUSTR_28 = "";
THUSTR_29 = "";
THUSTR_30 = "";
THUSTR_31 = "";
THUSTR_32 = "";
E1TEXT = "";
E2TEXT = "";
E3TEXT = "";
E4TEXT = "";
C1TEXT = "";
C2TEXT = "";
C3TEXT = "";
C4TEXT = "";
C5TEXT = "";
C6TEXT = "";
P1TEXT = "";
P2TEXT = "";
P3TEXT = "";
P4TEXT = "";
P5TEXT = "";
P6TEXT = "";
T1TEXT = "";
T2TEXT = "";
T3TEXT = "";
T4TEXT = "";
T5TEXT = "";
T6TEXT = "";
NERVETEXT = "";
HE1TEXT = "";
HE2TEXT = "";
HE3TEXT = "";
HE4TEXT = "";
HE5TEXT = "";

View file

@ -189,7 +189,7 @@ clearepisodes
episode e1m1 episode e1m1
{ {
picname = "M_EPI1" picname = "M_EPI1"
name = "Chex Quest" name = "$TXT_CHEX_EP"
key = "k" key = "k"
} }

View file

@ -21,28 +21,28 @@ clearepisodes
episode e1m1 episode e1m1
{ {
picname = "M_EPI1" picname = "M_EPI1"
name = "Knee-Deep in the Dead" name = "$TXT_D1E1"
key = "k" key = "k"
} }
episode e2m1 episode e2m1
{ {
picname = "M_EPI2" picname = "M_EPI2"
name = "The Shores of Hell" name = "$TXT_D1E2"
key = "t" key = "t"
} }
episode e3m1 episode e3m1
{ {
picname = "M_EPI3" picname = "M_EPI3"
name = "Inferno" name = "$TXT_D1E3"
key = "i" key = "i"
} }
episode e4m1 episode e4m1
{ {
picname = "M_EPI4" picname = "M_EPI4"
name = "Thy Flesh Consumed" name = "$TXT_D1E4"
key = "t" key = "t"
optional optional
} }

View file

@ -4,13 +4,13 @@ include "mapinfo/doomcommon.txt"
clearepisodes clearepisodes
episode map01 episode map01
{ {
name = "Hell On Earth" name = "$TXT_D2E1"
key = "h" key = "h"
} }
episode level01 episode level01
{ {
name = "No Rest for the Living" name = "$TXT_D1E2"
key = "n" key = "n"
optional optional
} }

View file

@ -3,5 +3,6 @@ include "mapinfo/doom2.txt"
gameinfo gameinfo
{ {
cursorpic = "cursor" cursorpic = "cursor"
forcenogfxsubstitution = true
} }

View file

@ -4,5 +4,6 @@ gameinfo
{ {
cursorpic = "cursor" cursorpic = "cursor"
statusbarclass = "HarmonyStatusBar" statusbarclass = "HarmonyStatusBar"
forcenogfxsubstitution = true
} }

View file

@ -6,7 +6,7 @@ include "mapinfo/doomcommon.txt"
clearepisodes clearepisodes
episode map01 episode map01
{ {
name = "The Plutonia Experiment" name = "$TXT_PLUT_EP"
key = "t" key = "t"
} }

View file

@ -6,7 +6,7 @@ include "mapinfo/doomcommon.txt"
clearepisodes clearepisodes
episode map01 episode map01
{ {
name = "TNT: Evilution" name = "$TXT_TNT_EP"
key = "t" key = "t"
} }

View file

@ -4,5 +4,6 @@ gameinfo
{ {
swapmenu = true swapmenu = true
cursorpic = "cursor" cursorpic = "cursor"
forcenogfxsubstitution = true
} }

View file

@ -344,11 +344,13 @@ OptionValue AutoOffOn
OptionMenuSettings OptionMenuSettings
{ {
// These can be overridden if a different menu fonts requires it. // These can be overridden if a different menu fonts requires it.
Linespacing 8 Linespacing 17
/*
IfGame(Heretic, Hexen) IfGame(Heretic, Hexen)
{ {
Linespacing 9 Linespacing 9
} }
*/
} }
DefaultOptionMenu DefaultOptionMenu
@ -378,6 +380,8 @@ OptionMenu "OptionsMenu" protected
Submenu "$OPTMNU_DISPLAY", "VideoOptions" Submenu "$OPTMNU_DISPLAY", "VideoOptions"
Submenu "$OPTMNU_VIDEO", "VideoModeMenu" Submenu "$OPTMNU_VIDEO", "VideoModeMenu"
StaticText " " StaticText " "
Submenu "$OS_TITLE", "os_Menu"
StaticText " "
SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults" SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults"
SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved" SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved"
Command "$OPTMNU_CONSOLE", "menuconsole" Command "$OPTMNU_CONSOLE", "menuconsole"
@ -1216,30 +1220,43 @@ OptionString MapMarkFont
OptionMenu AutomapOptions protected OptionMenu AutomapOptions protected
{ {
Title "$AUTOMAPMNU_TITLE" Title "$AUTOMAPMNU_TITLE"
Option "$AUTOMAPMNU_COLORSET", "am_colorset", "MapColorTypes" Option "$AUTOMAPMNU_COLORSET", "am_colorset", "MapColorTypes"
Option "$AUTOMAPMNU_CUSTOMCOLORS", "am_customcolors", "YesNo" Option "$AUTOMAPMNU_CUSTOMCOLORS", "am_customcolors", "YesNo"
Submenu "$AUTOMAPMNU_SETCUSTOMCOLORS", "MapColorMenu" Submenu "$AUTOMAPMNU_SETCUSTOMCOLORS", "MapColorMenu"
StaticText ""
Submenu "$AUTOMAPMNU_CONTROLS", "MapControlsMenu" Submenu "$AUTOMAPMNU_CONTROLS", "MapControlsMenu"
StaticText " "
StaticText ""
Option "$AUTOMAPMNU_ROTATE", "am_rotate", "RotateTypes" Option "$AUTOMAPMNU_ROTATE", "am_rotate", "RotateTypes"
Option "$AUTOMAPMNU_OVERLAY", "am_overlay", "OverlayTypes" Option "$AUTOMAPMNU_OVERLAY", "am_overlay", "OverlayTypes"
Option "$AUTOMAPMNU_TEXTURED", "am_textured", "OnOff" Option "$AUTOMAPMNU_TEXTURED", "am_textured", "OnOff"
Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff"
Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff"
Slider "$AUTOMAPMNU_EMPTYSPACEMARGIN", "am_emptyspacemargin", 0, 90, 5, 0 StaticText ""
StaticText " "
Option "$AUTOMAPMNU_SHOWITEMS", "am_showitems", "OnOff" Option "$AUTOMAPMNU_SHOWITEMS", "am_showitems", "OnOff"
Option "$AUTOMAPMNU_SHOWMONSTERS", "am_showmonsters", "OnOff" Option "$AUTOMAPMNU_SHOWMONSTERS", "am_showmonsters", "OnOff"
Option "$AUTOMAPMNU_SHOWSECRETS", "am_showsecrets", "OnOff" Option "$AUTOMAPMNU_SHOWSECRETS", "am_showsecrets", "OnOff"
Option "$AUTOMAPMNU_SHOWTIME", "am_showtime", "OnOff" Option "$AUTOMAPMNU_SHOWTIME", "am_showtime", "OnOff"
Option "$AUTOMAPMNU_SHOWTOTALTIME", "am_showtotaltime", "OnOff" Option "$AUTOMAPMNU_SHOWTOTALTIME", "am_showtotaltime", "OnOff"
Option "$AUTOMAPMNU_MAPSECRETS", "am_map_secrets", "SecretTypes"
Option "$AUTOMAPMNU_SHOWMAPLABEL", "am_showmaplabel", "MaplabelTypes" Option "$AUTOMAPMNU_SHOWMAPLABEL", "am_showmaplabel", "MaplabelTypes"
Option "$AUTOMAPMNU_DRAWMAPBACK", "am_drawmapback", "MapBackTypes"
StaticText ""
Option "$AUTOMAPMNU_SHOWKEYS", "am_showkeys", "OnOff" Option "$AUTOMAPMNU_SHOWKEYS", "am_showkeys", "OnOff"
Option "$AUTOMAPMNU_SHOWKEYS_ALWAYS", "am_showkeys_always", "OnOff"
StaticText ""
Option "$AUTOMAPMNU_MAPSECRETS", "am_map_secrets", "SecretTypes"
Option "$AUTOMAPMNU_DRAWMAPBACK", "am_drawmapback", "MapBackTypes"
Option "$AUTOMAPMNU_SHOWTRIGGERLINES", "am_showtriggerlines", "MapTriggers" Option "$AUTOMAPMNU_SHOWTRIGGERLINES", "am_showtriggerlines", "MapTriggers"
Option "$AUTOMAPMNU_SHOWTHINGSPRITES", "am_showthingsprites", "STSTypes" Option "$AUTOMAPMNU_SHOWTHINGSPRITES", "am_showthingsprites", "STSTypes"
StaticText " "
StaticText ""
Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff"
Slider "$AUTOMAPMNU_EMPTYSPACEMARGIN", "am_emptyspacemargin", 0, 90, 5, 0
StaticText ""
Option "$AUTOMAPMNU_MARKFONT", "am_markfont", "MapMarkFont" Option "$AUTOMAPMNU_MARKFONT", "am_markfont", "MapMarkFont"
Option "$AUTOMAPMNU_MARKCOLOR", "am_markcolor", "TextColors" Option "$AUTOMAPMNU_MARKCOLOR", "am_markcolor", "TextColors"
} }
@ -1255,18 +1272,24 @@ OptionMenu MapControlsMenu protected
Title "$MAPCNTRLMNU_TITLE" Title "$MAPCNTRLMNU_TITLE"
ScrollTop 2 ScrollTop 2
StaticTextSwitchable "$CNTRLMNU_SWITCHTEXT1", "$CNTRLMNU_SWITCHTEXT2", "ControlMessage" StaticTextSwitchable "$CNTRLMNU_SWITCHTEXT1", "$CNTRLMNU_SWITCHTEXT2", "ControlMessage"
StaticText ""
StaticText "$MAPCNTRLMNU_CONTROLS", 1 StaticText ""
MapControl "$MAPCNTRLMNU_PANLEFT", "+am_panleft" MapControl "$MAPCNTRLMNU_PANLEFT", "+am_panleft"
MapControl "$MAPCNTRLMNU_PANRIGHT", "+am_panright" MapControl "$MAPCNTRLMNU_PANRIGHT", "+am_panright"
MapControl "$MAPCNTRLMNU_PANUP", "+am_panup" MapControl "$MAPCNTRLMNU_PANUP", "+am_panup"
MapControl "$MAPCNTRLMNU_PANDOWN", "+am_pandown" MapControl "$MAPCNTRLMNU_PANDOWN", "+am_pandown"
StaticText ""
MapControl "$MAPCNTRLMNU_ZOOMIN", "+am_zoomin" MapControl "$MAPCNTRLMNU_ZOOMIN", "+am_zoomin"
MapControl "$MAPCNTRLMNU_ZOOMOUT", "+am_zoomout" MapControl "$MAPCNTRLMNU_ZOOMOUT", "+am_zoomout"
StaticText ""
MapControl "$MAPCNTRLMNU_TOGGLEZOOM", "am_gobig" MapControl "$MAPCNTRLMNU_TOGGLEZOOM", "am_gobig"
MapControl "$MAPCNTRLMNU_TOGGLEFOLLOW", "am_togglefollow" MapControl "$MAPCNTRLMNU_TOGGLEFOLLOW", "am_togglefollow"
MapControl "$MAPCNTRLMNU_TOGGLEGRID", "am_togglegrid" MapControl "$MAPCNTRLMNU_TOGGLEGRID", "am_togglegrid"
MapControl "$MAPCNTRLMNU_TOGGLETEXTURE", "am_toggletexture" MapControl "$MAPCNTRLMNU_TOGGLETEXTURE", "am_toggletexture"
StaticText ""
MapControl "$MAPCNTRLMNU_SETMARK", "am_setmark" MapControl "$MAPCNTRLMNU_SETMARK", "am_setmark"
MapControl "$MAPCNTRLMNU_CLEARMARK", "am_clearmarks" MapControl "$MAPCNTRLMNU_CLEARMARK", "am_clearmarks"
} }
@ -1468,6 +1491,7 @@ OptionValue JumpCrouchFreeLook
OptionMenu GameplayOptions protected OptionMenu GameplayOptions protected
{ {
Position -35
Title "$GMPLYMNU_TITLE" Title "$GMPLYMNU_TITLE"
//Indent 222 //Indent 222
Submenu "$GMPLYMNU_DEATHMATCH", "DeathmatchOptions" Submenu "$GMPLYMNU_DEATHMATCH", "DeathmatchOptions"
@ -1510,6 +1534,7 @@ OptionMenu GameplayOptions protected
OptionMenu DeathmatchOptions protected OptionMenu DeathmatchOptions protected
{ {
Position -35
Title "$GMPLYMNU_DEATHMATCH" Title "$GMPLYMNU_DEATHMATCH"
Option "$GMPLYMNU_WEAPONSSTAY", "sv_weaponstay", "YesNo" Option "$GMPLYMNU_WEAPONSSTAY", "sv_weaponstay", "YesNo"
@ -1530,6 +1555,7 @@ OptionMenu DeathmatchOptions protected
OptionMenu CoopOptions protected OptionMenu CoopOptions protected
{ {
Position -35
Title "$GMPLYMNU_COOPERATIVE" Title "$GMPLYMNU_COOPERATIVE"
Option "$GMPLYMNU_MULTIPLAYERWEAPONS", "sv_noweaponspawn", "NoYes" Option "$GMPLYMNU_MULTIPLAYERWEAPONS", "sv_noweaponspawn", "NoYes"
@ -1564,6 +1590,7 @@ OptionValue CompatModes
OptionMenu "CompatibilityOptions" protected OptionMenu "CompatibilityOptions" protected
{ {
Position -35
Title "$CMPTMNU_TITLE" Title "$CMPTMNU_TITLE"
Option "$CMPTMNU_MODE", "compatmode", "CompatModes", "", 1 Option "$CMPTMNU_MODE", "compatmode", "CompatModes", "", 1
StaticText " " StaticText " "
@ -1578,6 +1605,7 @@ OptionMenu "CompatibilityOptions" protected
OptionMenu "CompatActorMenu" protected OptionMenu "CompatActorMenu" protected
{ {
Position -35
Title "$CMPTMNU_ACTORBEHAVIOR" Title "$CMPTMNU_ACTORBEHAVIOR"
Option "$CMPTMNU_CORPSEGIBS", "compat_CORPSEGIBS", "YesNo" Option "$CMPTMNU_CORPSEGIBS", "compat_CORPSEGIBS", "YesNo"
Option "$CMPTMNU_NOBLOCKFRIENDS", "compat_NOBLOCKFRIENDS", "YesNo" Option "$CMPTMNU_NOBLOCKFRIENDS", "compat_NOBLOCKFRIENDS", "YesNo"
@ -1593,6 +1621,7 @@ OptionMenu "CompatActorMenu" protected
OptionMenu "CompatDehackedMenu" protected OptionMenu "CompatDehackedMenu" protected
{ {
Position -35
Title "$CMPTMNU_DEHACKEDBEHAVIOR" Title "$CMPTMNU_DEHACKEDBEHAVIOR"
Option "$CMPTMNU_DEHHEALTH", "compat_DEHHEALTH", "YesNo" Option "$CMPTMNU_DEHHEALTH", "compat_DEHHEALTH", "YesNo"
Option "$CMPTMNU_MUSHROOM", "compat_MUSHROOM", "YesNo" Option "$CMPTMNU_MUSHROOM", "compat_MUSHROOM", "YesNo"
@ -1601,6 +1630,7 @@ OptionMenu "CompatDehackedMenu" protected
OptionMenu "CompatMapMenu" protected OptionMenu "CompatMapMenu" protected
{ {
Position -35
Title "$CMPTMNU_MAPACTIONBEHAVIOR" Title "$CMPTMNU_MAPACTIONBEHAVIOR"
Option "$CMPTMNU_USEBLOCKING", "compat_USEBLOCKING", "YesNo" Option "$CMPTMNU_USEBLOCKING", "compat_USEBLOCKING", "YesNo"
Option "$CMPTMNU_ANYBOSSDEATH", "compat_ANYBOSSDEATH", "YesNo" Option "$CMPTMNU_ANYBOSSDEATH", "compat_ANYBOSSDEATH", "YesNo"
@ -1619,6 +1649,7 @@ OptionMenu "CompatMapMenu" protected
OptionMenu "CompatPhysicsMenu" protected OptionMenu "CompatPhysicsMenu" protected
{ {
Position -35
Title "$CMPTMNU_PHYSICSBEHAVIOR" Title "$CMPTMNU_PHYSICSBEHAVIOR"
Option "$CMPTMNU_NOPASSOVER", "compat_nopassover", "YesNo" Option "$CMPTMNU_NOPASSOVER", "compat_nopassover", "YesNo"
Option "$CMPTMNU_BOOMSCROLL", "compat_BOOMSCROLL", "YesNo" Option "$CMPTMNU_BOOMSCROLL", "compat_BOOMSCROLL", "YesNo"
@ -1634,6 +1665,7 @@ OptionMenu "CompatPhysicsMenu" protected
OptionMenu "CompatRenderMenu" protected OptionMenu "CompatRenderMenu" protected
{ {
Position -35
Title "$CMPTMNU_RENDERINGBEHAVIOR" Title "$CMPTMNU_RENDERINGBEHAVIOR"
Option "$CMPTMNU_POLYOBJ", "compat_POLYOBJ", "YesNo" Option "$CMPTMNU_POLYOBJ", "compat_POLYOBJ", "YesNo"
Option "$CMPTMNU_MASKEDMIDTEX", "compat_MASKEDMIDTEX", "YesNo" Option "$CMPTMNU_MASKEDMIDTEX", "compat_MASKEDMIDTEX", "YesNo"
@ -1643,6 +1675,7 @@ OptionMenu "CompatRenderMenu" protected
OptionMenu "CompatSoundMenu" protected OptionMenu "CompatSoundMenu" protected
{ {
Position -35
Title "$CMPTMNU_SOUNDBEHAVIOR" Title "$CMPTMNU_SOUNDBEHAVIOR"
Option "$CMPTMNU_SOUNDSLOTS", "compat_soundslots", "YesNo" Option "$CMPTMNU_SOUNDSLOTS", "compat_soundslots", "YesNo"
Option "$CMPTMNU_SILENTPICKUP", "compat_SILENTPICKUP", "YesNo" Option "$CMPTMNU_SILENTPICKUP", "compat_SILENTPICKUP", "YesNo"
@ -2606,3 +2639,21 @@ OptionString "LanguageOptions"
"ptb", "Português do Brasil (PTB)" "ptb", "Português do Brasil (PTB)"
"rus", "Русский (RU)" "rus", "Русский (RU)"
} }
/*=======================================
*
* Option Search menu
*
*=======================================*/
OptionMenu "os_Menu"
{
Class "os_Menu"
Title "$OS_TITLE"
}
OptionValue "os_isanyof_values"
{
0, "$OS_ALL"
1, "$OS_ANY"
}

View file

@ -253,6 +253,11 @@ version "3.8"
#include "zscript/ui/menu/reverbedit.zs" #include "zscript/ui/menu/reverbedit.zs"
#include "zscript/ui/menu/textentermenu.zs" #include "zscript/ui/menu/textentermenu.zs"
#include "zscript/ui/menu/search/menu.zs"
#include "zscript/ui/menu/search/searchfield.zs"
#include "zscript/ui/menu/search/query.zs"
#include "zscript/ui/menu/search/anyoralloption.zs"
#include "zscript/ui/statscreen/statscreen.zs" #include "zscript/ui/statscreen/statscreen.zs"
#include "zscript/ui/statscreen/statscreen_coop.zs" #include "zscript/ui/statscreen/statscreen_coop.zs"
#include "zscript/ui/statscreen/statscreen_dm.zs" #include "zscript/ui/statscreen/statscreen_dm.zs"

View file

@ -23,6 +23,7 @@ struct _ native // These are the global variables, the struct is only here to av
native readonly Font bigfont; native readonly Font bigfont;
native readonly Font confont; native readonly Font confont;
native readonly Font NewConsoleFont; native readonly Font NewConsoleFont;
native readonly Font NewSmallFont;
native readonly Font intermissionfont; native readonly Font intermissionfont;
native readonly int CleanXFac; native readonly int CleanXFac;
native readonly int CleanYFac; native readonly int CleanYFac;

View file

@ -327,8 +327,7 @@ class ColorpickerMenu : OptionMenu
screen.Clear (x + 48*CleanXfac_1, y, x + 48*2*CleanXfac_1, y + 48*CleanYfac_1, newColor); screen.Clear (x + 48*CleanXfac_1, y, x + 48*2*CleanXfac_1, y + 48*CleanYfac_1, newColor);
y += 49*CleanYfac_1; y += 49*CleanYfac_1;
screen.DrawText (SmallFont, Font.CR_GRAY, x+(24-SmallFont.StringWidth("Old")/2)*CleanXfac_1, y, "Old", DTA_CleanNoMove_1, true); screen.DrawText (SmallFont, Font.CR_GRAY, x+(48-SmallFont.StringWidth("---->")/2)*CleanXfac_1, y, "---->", DTA_CleanNoMove_1, true);
screen.DrawText (SmallFont, Font.CR_WHITE, x+(48+24-SmallFont.StringWidth("New")/2)*CleanXfac_1, y, "New", DTA_CleanNoMove_1, true);
} }
override void OnDestroy() override void OnDestroy()

View file

@ -146,7 +146,6 @@ class LoadSaveMenu : ListMenu
commentRight = commentLeft + commentWidth; commentRight = commentLeft + commentWidth;
commentBottom = commentTop + commentHeight; commentBottom = commentTop + commentHeight;
commentRows = commentHeight / rowHeight; commentRows = commentHeight / rowHeight;
} }
@ -191,9 +190,9 @@ class LoadSaveMenu : ListMenu
if (manager.SavegameCount() > 0) if (manager.SavegameCount() > 0)
{ {
String text = (Selected == -1 || !manager.GetSavegame(Selected).bOldVersion)? Stringtable.Localize("$MNU_NOPICTURE") : Stringtable.Localize("$MNU_DIFFVERSION"); String text = (Selected == -1 || !manager.GetSavegame(Selected).bOldVersion)? Stringtable.Localize("$MNU_NOPICTURE") : Stringtable.Localize("$MNU_DIFFVERSION");
int textlen = SmallFont.StringWidth(text) * CleanXfac; int textlen = NewSmallFont.StringWidth(text) * CleanXfac;
screen.DrawText (SmallFont, Font.CR_GOLD, savepicLeft+(savepicWidth-textlen)/2, screen.DrawText (NewSmallFont, Font.CR_GOLD, savepicLeft+(savepicWidth-textlen)/2,
savepicTop+(savepicHeight-rowHeight)/2, text, DTA_CleanNoMove, true); savepicTop+(savepicHeight-rowHeight)/2, text, DTA_CleanNoMove, true);
} }
} }
@ -206,7 +205,7 @@ class LoadSaveMenu : ListMenu
for(int i = 0; i < numlinestoprint; i++) for(int i = 0; i < numlinestoprint; i++)
{ {
screen.DrawText(NewConsoleFont, Font.CR_ORANGE, commentLeft / FontScale, (commentTop + rowHeight * i) / FontScale, BrokenSaveComment.StringAt(i), screen.DrawText(NewConsoleFont, Font.CR_ORANGE, commentLeft / FontScale, (commentTop + rowHeight * i) / FontScale, BrokenSaveComment.StringAt(i),
DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true);
} }
@ -217,10 +216,10 @@ class LoadSaveMenu : ListMenu
if (manager.SavegameCount() == 0) if (manager.SavegameCount() == 0)
{ {
String text = Stringtable.Localize("$MNU_NOFILES"); String text = Stringtable.Localize("$MNU_NOFILES");
int textlen = SmallFont.StringWidth(text) * CleanXfac; int textlen = NewConsoleFont.StringWidth(text) * FontScale;
screen.DrawText (NewConsoleFont, Font.CR_GOLD, (listboxLeft+(listboxWidth-textlen)/2) / FontScale, (listboxTop+(listboxHeight-rowHeight)/2) / FontScale, text, screen.DrawText (NewConsoleFont, Font.CR_GOLD, (listboxLeft+(listboxWidth-textlen)/2) / FontScale, (listboxTop+(listboxHeight-rowHeight)/2) / FontScale, text,
DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true);
return; return;
} }
@ -255,7 +254,7 @@ class LoadSaveMenu : ListMenu
if (!mEntering) if (!mEntering)
{ {
screen.DrawText (NewConsoleFont, colr, (listboxLeft+1) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, node.SaveTitle, screen.DrawText (NewConsoleFont, colr, (listboxLeft+1) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, node.SaveTitle,
DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true);
} }
else else
{ {
@ -263,13 +262,13 @@ class LoadSaveMenu : ListMenu
int length = NewConsoleFont.StringWidth(s) * FontScale; int length = NewConsoleFont.StringWidth(s) * FontScale;
int displacement = min(0, listboxWidth - 2 - length); int displacement = min(0, listboxWidth - 2 - length);
screen.DrawText (NewConsoleFont, Font.CR_WHITE, (listboxLeft + 1 + displacement) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, s, screen.DrawText (NewConsoleFont, Font.CR_WHITE, (listboxLeft + 1 + displacement) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, s,
DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true);
} }
} }
else else
{ {
screen.DrawText (NewConsoleFont, colr, (listboxLeft+1) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, node.SaveTitle, screen.DrawText (NewConsoleFont, colr, (listboxLeft+1) / FontScale, (listboxTop+rowHeight*i + FontScale) / FontScale, node.SaveTitle,
DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale); DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true);
} }
screen.ClearClipRect(); screen.ClearClipRect();
j++; j++;
@ -475,6 +474,7 @@ class SaveMenu : LoadSaveMenu
manager.InsertNewSaveNode(); manager.InsertNewSaveNode();
TopItem = 0; TopItem = 0;
Selected = manager.ExtractSaveData (-1); Selected = manager.ExtractSaveData (-1);
UpdateSaveComment();
} }
//============================================================================= //=============================================================================
@ -614,7 +614,7 @@ class LoadMenu : LoadSaveMenu
Super.Init(parent, desc); Super.Init(parent, desc);
TopItem = 0; TopItem = 0;
Selected = manager.ExtractSaveData (-1); Selected = manager.ExtractSaveData (-1);
UpdateSaveComment();
} }
//============================================================================= //=============================================================================

View file

@ -285,8 +285,38 @@ class Menu : Object native ui version("2.4")
static void DrawConText (int color, int x, int y, String str) static void DrawConText (int color, int x, int y, String str)
{ {
screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac_1, DTA_CellY, 8 * CleanYfac_1); screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac);
} }
static int OptionColor(int color)
{
if (color != Font.CR_UNTRANSLATED) return color;
// This needs fixing for mods with custom fonts.
return gameinfo.gametype == GAME_Doom ? Font.CR_RED : gameinfo.gametype == GAME_Chex ? Font.CR_GREEN : gameinfo.gametype == GAME_Strife ? Font.CR_GOLD : Font.CR_GRAY;
}
static Font OptionFont()
{
return NewSmallFont;
}
static int OptionHeight()
{
return OptionFont().GetHeight();
}
static int OptionWidth(String s)
{
return OptionFont().StringWidth(s);
}
static void DrawOptionText(int x, int y, int color, String text, bool grayed = false)
{
String label = Stringtable.Localize(text);
int overlay = grayed? Color(96,48,0,0) : 0;
screen.DrawText (OptionFont(), OptionColor(color), x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
}
} }

View file

@ -451,7 +451,7 @@ class OptionMenu : Menu
} }
int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1; int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1;
int lastrow = screen.GetHeight() - SmallFont.GetHeight() * CleanYfac_1; int lastrow = screen.GetHeight() - OptionHeight() * CleanYfac_1;
int i; int i;
for (i = 0; i < mDesc.mItems.Size() && y <= lastrow; i++) for (i = 0; i < mDesc.mItems.Size() && y <= lastrow; i++)
@ -468,7 +468,7 @@ class OptionMenu : Menu
{ {
if (((MenuTime() % 8) < 6) || GetCurrentMenu() != self) if (((MenuTime() % 8) < 6) || GetCurrentMenu() != self)
{ {
DrawConText(OptionMenuSettings.mFontColorSelection, cur_indent + 3 * CleanXfac_1, y+fontheight-9*CleanYfac_1, "\xd"); DrawOptionText(cur_indent + 3 * CleanXfac_1, y, Font.CR_UNTRANSLATED, "◄");
} }
} }
y += fontheight; y += fontheight;
@ -480,11 +480,11 @@ class OptionMenu : Menu
if (CanScrollUp) if (CanScrollUp)
{ {
DrawConText(Font.CR_ORANGE, 3 * CleanXfac_1, ytop, "\x1a"); DrawOptionText(screen.GetWidth() - 11 * CleanXfac_1, ytop, Font.CR_UNTRANSLATED, "▲");
} }
if (CanScrollDown) if (CanScrollDown)
{ {
DrawConText(Font.CR_ORANGE, 3 * CleanXfac_1, y - 8*CleanYfac_1, "\x1b"); DrawOptionText(screen.GetWidth() - 11 * CleanXfac_1 , y - 8*CleanYfac_1, Font.CR_UNTRANSLATED, "▼");
} }
Super.Drawer(); Super.Drawer();
} }
@ -519,8 +519,8 @@ class GameplayMenu : OptionMenu
Super.Drawer(); Super.Drawer();
String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2); String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2);
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue,
(screen.GetWidth() - SmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 35 * CleanXfac_1, s,
DTA_CleanNoMove_1, true); DTA_CleanNoMove_1, true);
} }
} }
@ -532,8 +532,8 @@ class CompatibilityMenu : OptionMenu
Super.Drawer(); Super.Drawer();
String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2); String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2);
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue,
(screen.GetWidth() - SmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s, (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 35 * CleanXfac_1, s,
DTA_CleanNoMove_1, true); DTA_CleanNoMove_1, true);
} }
} }

View file

@ -44,19 +44,28 @@ class OptionMenuItem : MenuItemBase
mCentered = center; mCentered = center;
} }
protected void drawText(int x, int y, int color, String text, bool grayed = false)
{
Menu.DrawOptionText(x, y, color, text, grayed);
}
protected int drawLabel(int indent, int y, int color, bool grayed = false) protected int drawLabel(int indent, int y, int color, bool grayed = false)
{ {
String label = Stringtable.Localize(mLabel); String label = Stringtable.Localize(mLabel);
int overlay = grayed? Color(96,48,0,0) : 0;
int x; int x;
int w = SmallFont.StringWidth(label) * CleanXfac_1; int w = Menu.OptionWidth(label) * CleanXfac_1;
if (!mCentered) x = indent - w; if (!mCentered) x = indent - w;
else x = (screen.GetWidth() - w) / 2; else x = (screen.GetWidth() - w) / 2;
screen.DrawText (SmallFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); Menu.DrawOptionText(x, y, color, label, grayed);
return x; return x;
} }
protected void drawValue(int indent, int y, int color, String text, bool grayed = false)
{
Menu.DrawOptionText(indent + CursorSpace(), y, color, text, grayed);
}
int CursorSpace() int CursorSpace()
{ {
@ -71,11 +80,11 @@ class OptionMenuItem : MenuItemBase
override int GetIndent() override int GetIndent()
{ {
if (mCentered) return 0; if (mCentered) return 0;
return SmallFont.StringWidth(Stringtable.Localize(mLabel)); return Menu.OptionWidth(Stringtable.Localize(mLabel));
} }
override bool MouseEvent(int type, int x, int y) override bool MouseEvent(int type, int x, int y)
{ {
if (Selectable() && type == Menu.MOUSE_Release) if (Selectable() && type == Menu.MOUSE_Release)
{ {
return Menu.GetCurrentMenu().MenuEvent(Menu.MKEY_Enter, true); return Menu.GetCurrentMenu().MenuEvent(Menu.MKEY_Enter, true);
@ -140,8 +149,7 @@ class OptionMenuItemLabeledSubmenu : OptionMenuItemSubmenu
String text = mLabelCVar.GetString(); String text = mLabelCVar.GetString();
if (text.Length() == 0) text = Stringtable.Localize("$notset"); if (text.Length() == 0) text = Stringtable.Localize("$notset");
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); drawValue(indent, y, OptionMenuSettings.mFontColorValue, text);
return indent; return indent;
} }
} }
@ -286,19 +294,16 @@ class OptionMenuItemOptionBase : OptionMenuItem
//============================================================================= //=============================================================================
override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected)
{ {
bool grayed = isGrayed();
if (mCenter) if (mCenter)
{ {
indent = (screen.GetWidth() / 2); indent = (screen.GetWidth() / 2);
} }
drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed); drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, isGrayed());
int overlay = grayed? Color(96,48,0,0) : 0;
int Selection = GetSelection(); int Selection = GetSelection();
String text = StringTable.Localize(OptionValues.GetText(mValues, Selection)); String text = StringTable.Localize(OptionValues.GetText(mValues, Selection));
if (text.Length() == 0) text = "Unknown"; if (text.Length() == 0) text = "Unknown";
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); drawValue(indent, y, OptionMenuSettings.mFontColorValue, text, isGrayed());
return indent; return indent;
} }
@ -502,11 +507,11 @@ class OptionMenuItemControlBase : OptionMenuItem
description = KeyBindings.NameKeys (Key1, Key2); description = KeyBindings.NameKeys (Key1, Key2);
if (description.Length() > 0) if (description.Length() > 0)
{ {
Menu.DrawConText(Font.CR_WHITE, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, description); drawValue(indent, y, Font.CR_WHITE, description);
} }
else else
{ {
screen.DrawText(SmallFont, Font.CR_BLACK, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, "---", DTA_CleanNoMove_1, true); drawValue(indent, y, Font.CR_BLACK, "---");
} }
return indent; return indent;
} }
@ -644,9 +649,9 @@ class OptionMenuItemStaticTextSwitchable : OptionMenuItem
override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected)
{ {
String txt = StringTable.Localize(mCurrent? mAltText : mLabel); String txt = StringTable.Localize(mCurrent? mAltText : mLabel);
int w = SmallFont.StringWidth(txt) * CleanXfac_1; int w = Menu.OptionWidth(txt) * CleanXfac_1;
int x = (screen.GetWidth() - w) / 2; int x = (screen.GetWidth() - w) / 2;
screen.DrawText (SmallFont, mColor, x, y, txt, DTA_CleanNoMove_1, true); drawText(x, y, mColor, txt);
return -1; return -1;
} }
@ -722,8 +727,8 @@ class OptionMenuSliderBase : OptionMenuItem
String textbuf; String textbuf;
double range; double range;
int maxlen = 0; int maxlen = 0;
int right = x + (12*8 + 4) * CleanXfac_1; int right = x + (12*8 + 4) * CleanXfac; // length of slider. This uses the old ConFont and
int cy = y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1; int cy = y + CleanYFac;
range = max - min; range = max - min;
double ccur = clamp(cur, min, max) - min; double ccur = clamp(cur, min, max) - min;
@ -731,7 +736,7 @@ class OptionMenuSliderBase : OptionMenuItem
if (fracdigits >= 0) if (fracdigits >= 0)
{ {
textbuf = String.format(formater, max); textbuf = String.format(formater, max);
maxlen = SmallFont.StringWidth(textbuf) * CleanXfac_1; maxlen = Menu.OptionWidth(textbuf) * CleanXfac_1;
} }
mSliderShort = right + maxlen > screen.GetWidth(); mSliderShort = right + maxlen > screen.GetWidth();
@ -746,13 +751,13 @@ class OptionMenuSliderBase : OptionMenuItem
// On 320x200 we need a shorter slider // On 320x200 we need a shorter slider
Menu.DrawConText(Font.CR_WHITE, x, cy, "\x10\x11\x11\x11\x11\x11\x12"); Menu.DrawConText(Font.CR_WHITE, x, cy, "\x10\x11\x11\x11\x11\x11\x12");
Menu.DrawConText(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 38) / range)) * CleanXfac_1), cy, "\x13"); Menu.DrawConText(Font.FindFontColor(gameinfo.mSliderColor), x + int((5 + ((ccur * 38) / range)) * CleanXfac_1), cy, "\x13");
right -= 5*8*CleanXfac_1; right -= 5*8*CleanXfac;
} }
if (fracdigits >= 0 && right + maxlen <= screen.GetWidth()) if (fracdigits >= 0 && right + maxlen <= screen.GetWidth())
{ {
textbuf = String.format(formater, cur); textbuf = String.format(formater, cur);
screen.DrawText(SmallFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true); drawText(right, y, Font.CR_DARKGRAY, textbuf);
} }
} }
@ -971,9 +976,7 @@ class OptionMenuFieldBase : OptionMenuItem
{ {
bool grayed = mGrayCheck != null && !mGrayCheck.GetInt(); bool grayed = mGrayCheck != null && !mGrayCheck.GetInt();
drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed); drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed);
int overlay = grayed? Color(96, 48, 0, 0) : 0; drawValue(indent, y, OptionMenuSettings.mFontColorValue, Represent(), grayed);
screen.DrawText(SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
return indent; return indent;
} }
@ -1022,7 +1025,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase
override String Represent() override String Represent()
{ {
if (mEnter) return mEnter.GetText() .. SmallFont.GetCursor(); if (mEnter) return mEnter.GetText() .. Menu.OptionFont().GetCursor();
else return GetCVarString(); else return GetCVarString();
} }
@ -1032,7 +1035,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase
{ {
// reposition the text so that the cursor is visible when in entering mode. // reposition the text so that the cursor is visible when in entering mode.
String text = Represent(); String text = Represent();
int tlen = SmallFont.StringWidth(text) * CleanXfac_1; int tlen = Menu.OptionWidth(text) * CleanXfac_1;
int newindent = screen.GetWidth() - tlen - CursorSpace(); int newindent = screen.GetWidth() - tlen - CursorSpace();
if (newindent < indent) indent = newindent; if (newindent < indent) indent = newindent;
} }
@ -1044,7 +1047,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase
if (mkey == Menu.MKEY_Enter) if (mkey == Menu.MKEY_Enter)
{ {
Menu.MenuSound("menu/choose"); Menu.MenuSound("menu/choose");
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, GetCVarString(), -1, fromcontroller); mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), Menu.OptionFont(), GetCVarString(), -1, fromcontroller);
mEnter.ActivateMenu(); mEnter.ActivateMenu();
return true; return true;
} }
@ -1156,7 +1159,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
if ((Selection == 0 || Selection == -1) && mClickVal <= 0) if ((Selection == 0 || Selection == -1) && mClickVal <= 0)
{ {
String text = Selection == 0? TextZero : Selection == -1? TextNegOne : ""; String text = Selection == 0? TextZero : Selection == -1? TextNegOne : "";
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); drawValue(indent, y, OptionMenuSettings.mFontColorValue, text);
} }
else else
{ {

View file

@ -132,8 +132,7 @@ class OptionMenuItemReverbSelect : OptionMenuItemSubMenu
int x = drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor); int x = drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor);
String text = ReverbEdit.GetSelectedEnvironment(); String text = ReverbEdit.GetSelectedEnvironment();
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true); drawValue(indent, y, OptionMenuSettings.mFontColorValue, text);
return indent; return indent;
} }
} }
@ -210,7 +209,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase
virtual String Represent() virtual String Represent()
{ {
return mEnter.GetText() .. SmallFont.GetCursor(); return mEnter.GetText() .. Menu.OptionFont().GetCursor();
} }
//============================================================================= //=============================================================================
@ -221,7 +220,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase
mDrawX = indent + CursorSpace(); mDrawX = indent + CursorSpace();
if (mEnter) if (mEnter)
{ {
screen.DrawText(SmallFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true); drawText(mDrawX, y, OptionMenuSettings.mFontColorValue, Represent());
} }
else else
{ {
@ -235,7 +234,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase
if (mkey == Menu.MKEY_Enter) if (mkey == Menu.MKEY_Enter)
{ {
Menu.MenuSound("menu/choose"); Menu.MenuSound("menu/choose");
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller); mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), Menu.OptionFont(), String.Format("%.3f", GetSliderValue()), -1, fromcontroller);
mEnter.ActivateMenu(); mEnter.ActivateMenu();
return true; return true;
} }

View file

@ -0,0 +1,33 @@
//=============================================================================
//
// os_AnyOrAllOption class represents an Option Item for Option Search menu.
// Changing the value of this option causes the menu to refresh the search
// results.
//
//=============================================================================
class os_AnyOrAllOption : OptionMenuItemOption
{
os_AnyOrAllOption Init(os_Menu menu)
{
Super.Init("", "os_isanyof", "os_isanyof_values");
mMenu = menu;
return self;
}
override bool MenuEvent(int mkey, bool fromcontroller)
{
bool result = Super.MenuEvent(mkey, fromcontroller);
if (mKey == Menu.MKEY_Left || mKey == Menu.MKEY_Right)
{
mMenu.search();
}
return result;
}
private os_Menu mMenu;
}

View file

@ -0,0 +1,218 @@
//=============================================================================
//
// Option Search Menu class.
// This menu contains search field, and is dynamically filled with search
// results.
//
//=============================================================================
class os_Menu : OptionMenu
{
override void Init(Menu parent, OptionMenuDescriptor desc)
{
Super.Init(parent, desc);
mDesc.mItems.clear();
addSearchField();
mDesc.mScrollPos = 0;
mDesc.mSelectedItem = 0;
mDesc.CalcIndent();
}
void search()
{
string text = mSearchField.GetText();
let query = os_Query.fromString(text);
bool isAnyTermMatches = mIsAnyOfItem.mCVar.GetBool();
mDesc.mItems.clear();
addSearchField(text);
bool found = listOptions(mDesc, "MainMenu", query, "", isAnyTermMatches);
if (!found) { addNoResultsItem(mDesc); }
mDesc.CalcIndent();
}
private void addSearchField(string query = "")
{
string searchLabel = StringTable.Localize("$OS_LABEL");
mSearchField = new("os_SearchField").Init(searchLabel, self, query);
mIsAnyOfItem = new("os_AnyOrAllOption").Init(self);
mDesc.mItems.push(mSearchField);
mDesc.mItems.push(mIsAnyOfItem);
addEmptyLine(mDesc);
}
private static bool listOptions(OptionMenuDescriptor targetDesc,
string menuName,
os_Query query,
string path,
bool isAnyTermMatches)
{
let desc = MenuDescriptor.GetDescriptor(menuName);
let listMenuDesc = ListMenuDescriptor(desc);
if (listMenuDesc)
{
return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches);
}
let optionMenuDesc = OptionMenuDescriptor(desc);
if (optionMenuDesc)
{
return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches);
}
return false;
}
private static bool listOptionsListMenu(ListMenuDescriptor sourceDesc,
OptionMenuDescriptor targetDesc,
os_Query query,
string path,
bool isAnyTermMatches)
{
int nItems = sourceDesc.mItems.size();
bool found = false;
for (int i = 0; i < nItems; ++i)
{
let item = sourceDesc.mItems[i];
string actionN = item.GetAction();
let textItem = ListMenuItemTextItem(item);
string newPath = textItem
? makePath(path, textItem.mText)
: path;
found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches);
}
return found;
}
private static bool listOptionsOptionMenu(OptionMenuDescriptor sourceDesc,
OptionMenuDescriptor targetDesc,
os_Query query,
string path,
bool isAnyTermMatches)
{
if (sourceDesc == targetDesc) { return false; }
int nItems = sourceDesc.mItems.size();
bool first = true;
bool found = false;
for (int i = 0; i < nItems; ++i)
{
let item = sourceDesc.mItems[i];
if (item is "OptionMenuItemStaticText") { continue; }
string label = StringTable.Localize(item.mLabel);
if (!query.matches(label, isAnyTermMatches)) { continue; }
found = true;
if (first)
{
addEmptyLine(targetDesc);
addPathItem(targetDesc, path);
first = false;
}
let itemOptionBase = OptionMenuItemOptionBase(item);
if (itemOptionBase)
{
itemOptionBase.mCenter = false;
}
targetDesc.mItems.push(item);
}
for (int i = 0; i < nItems; ++i)
{
let item = sourceDesc.mItems[i];
string label = StringTable.Localize(item.mLabel);
string optionSearchTitle = StringTable.Localize("$OS_TITLE");
if (label == optionSearchTitle) { continue; }
if (item is "OptionMenuItemSubMenu")
{
string newPath = makePath(path, label);
found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches);
}
}
return found;
}
private static string makePath(string path, string label)
{
if (path.length() == 0) { return label; }
int pathWidth = SmallFont.StringWidth(path .. "/" .. label);
int screenWidth = Screen.GetWidth();
bool isTooWide = (pathWidth > screenWidth / 3);
string newPath = isTooWide
? path .. "/" .. "\n" .. label
: path .. "/" .. label;
return newPath;
}
private static void addPathItem(OptionMenuDescriptor desc, string path)
{
Array<String> lines;
path.split(lines, "\n");
int nLines = lines.size();
for (int i = 0; i < nLines; ++i)
{
OptionMenuItemStaticText text = new("OptionMenuItemStaticText").Init(lines[i], 1);
desc.mItems.push(text);
}
}
private static void addEmptyLine(OptionMenuDescriptor desc)
{
int nItems = desc.mItems.size();
if (nItems > 0)
{
let staticText = OptionMenuItemStaticText(desc.mItems[nItems - 1]);
if (staticText != null && staticText.mLabel == "") { return; }
}
let item = new("OptionMenuItemStaticText").Init("");
desc.mItems.push(item);
}
private static void addNoResultsItem(OptionMenuDescriptor desc)
{
string noResults = StringTable.Localize("$OS_NO_RESULTS");
let text = new("OptionMenuItemStaticText").Init(noResults, 0);
addEmptyLine(desc);
desc.mItems.push(text);
}
private os_AnyOrAllOption mIsAnyOfItem;
private os_SearchField mSearchField;
}

View file

@ -0,0 +1,73 @@
//=============================================================================
//
// Option Search Query class represents a search query.
// A search query consists constists of one or more terms (words).
//
// Query matching deponds on "os_is_any_of" variable.
// If this variable is "true", the text matches the query if any of the terms
// matches the query.
// If this variable is "false", the text matches the query only if all the
// terms match the query.
//
//=============================================================================
class os_Query
{
static os_Query fromString(string str)
{
let query = new("os_Query");
str.Split(query.mQueryParts, " ", TOK_SKIPEMPTY);
return query;
}
bool matches(string text, bool isSearchForAny)
{
return isSearchForAny
? matchesAny(text)
: matchesAll(text);
}
// private: //////////////////////////////////////////////////////////////////
private bool matchesAny(string text)
{
int nParts = mQueryParts.size();
for (int i = 0; i < nParts; ++i)
{
string queryPart = mQueryParts[i];
if (contains(text, queryPart)) { return true; }
}
return false;
}
private bool matchesAll(string text)
{
int nParts = mQueryParts.size();
for (int i = 0; i < nParts; ++i)
{
string queryPart = mQueryParts[i];
if (!contains(text, queryPart)) { return false; }
}
return true;
}
private static bool contains(string str, string substr)
{
str .toLower();
substr.toLower();
bool contains = (str.IndexOf(substr) != -1);
return contains;
}
private Array<String> mQueryParts;
}

View file

@ -0,0 +1,52 @@
//=============================================================================
//
// Option Search Field class.
//
// When the search query is entered, makes Search Menu perform a search.
//
//=============================================================================
class os_SearchField : OptionMenuItemTextField
{
os_SearchField Init(String label, os_Menu menu, string query)
{
Super.Init(label, "");
mMenu = menu;
mText = query;
return self;
}
override bool MenuEvent(int mkey, bool fromcontroller)
{
if (mkey == Menu.MKEY_Enter)
{
Menu.MenuSound("menu/choose");
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, mText, -1, fromcontroller);
mEnter.ActivateMenu();
return true;
}
if (mkey == Menu.MKEY_Input)
{
mtext = mEnter.GetText();
mMenu.search();
}
return Super.MenuEvent(mkey, fromcontroller);
}
override String Represent()
{
return mEnter
? mEnter.GetText() .. SmallFont.GetCursor()
: mText;
}
String GetText() { return mText; }
private os_Menu mMenu;
private string mText;
}

View file

@ -84,7 +84,7 @@ class TextEnterMenu : Menu
deprecated("3.8") static TextEnterMenu Open(Menu parent, String textbuffer, int maxlen, int sizemode, bool showgrid = false, bool allowcolors = false) deprecated("3.8") static TextEnterMenu Open(Menu parent, String textbuffer, int maxlen, int sizemode, bool showgrid = false, bool allowcolors = false)
{ {
let me = new("TextEnterMenu"); let me = new("TextEnterMenu");
me.Init(parent, SmallFont, textbuffer, maxlen*8, showgrid, allowcolors); me.Init(parent, Menu.OptionFont(), textbuffer, maxlen*8, showgrid, allowcolors);
return me; return me;
} }

View file

@ -353,6 +353,53 @@ class StatusScreen abstract play version("2.5")
} }
} }
//====================================================================
//
//
//====================================================================
void drawTextScaled (Font fnt, double x, double y, String text, double scale, int translation = Font.CR_UNTRANSLATED)
{
screen.DrawText(fnt, translation, x / scale, y / scale, text, DTA_VirtualWidthF, screen.GetWidth() / scale, DTA_VirtualHeightF, screen.GetHeight() / scale);
}
//====================================================================
//
//
//====================================================================
void drawNumScaled (Font fnt, int x, int y, double scale, int n, int digits, int translation = Font.CR_UNTRANSLATED)
{
String s = String.Format("%d", n);
drawTextScaled(fnt, x - fnt.StringWidth(s) * scale, y, s, scale, translation);
}
//====================================================================
//
//
//
//====================================================================
void drawPercentScaled (Font fnt, int x, int y, int p, int b, double scale, bool show_total = true, int color = Font.CR_UNTRANSLATED)
{
if (p < 0) return;
String s;
if (wi_percents)
{
s = String.Format("%d%%", b == 0 ? 100 : p * 100 / b);
}
else if (show_total)
{
s = String.Format("%d/%3d", p, b);
}
else
{
s = String.Format("%d", p);
}
drawTextScaled(fnt, x - fnt.StringWidth(s) * scale, y, s, scale, color);
}
//==================================================================== //====================================================================
// //
// Display level completion time and par, or "sucks" message if overflow. // Display level completion time and par, or "sucks" message if overflow.

View file

@ -2,6 +2,9 @@
class CoopStatusScreen : StatusScreen class CoopStatusScreen : StatusScreen
{ {
int textcolor; int textcolor;
double FontScale;
int RowHeight;
Font displayFont;
//==================================================================== //====================================================================
// //
@ -11,11 +14,14 @@ class CoopStatusScreen : StatusScreen
override void initStats () override void initStats ()
{ {
textcolor = (gameinfo.gametype & GAME_Raven) ? Font.CR_GREEN : Font.CR_UNTRANSLATED; textcolor = Font.CR_GRAY;
CurState = StatCount; CurState = StatCount;
acceleratestage = 0; acceleratestage = 0;
ng_state = 1; ng_state = 1;
displayFont = NewSmallFont;
FontScale = max(screen.GetHeight() / 480, 1);
RowHeight = max((displayFont.GetHeight() + 1) * FontScale, 1);
cnt_pause = Thinker.TICRATE; cnt_pause = Thinker.TICRATE;
@ -223,7 +229,7 @@ class CoopStatusScreen : StatusScreen
Vector2 readyoffset = TexMan.GetScaledOffset(readyico); Vector2 readyoffset = TexMan.GetScaledOffset(readyico);
height = int(readysize.Y - readyoffset.Y); height = int(readysize.Y - readyoffset.Y);
maxiconheight = MAX(height, maxiconheight); maxiconheight = MAX(height, maxiconheight);
height = SmallFont.GetHeight() * CleanYfac; height = displayFont.GetHeight() * FontScale;
lineheight = MAX(height, maxiconheight * CleanYfac); lineheight = MAX(height, maxiconheight * CleanYfac);
ypadding = (lineheight - height + 1) / 2; ypadding = (lineheight - height + 1) / 2;
y += CleanYfac; y += CleanYfac;
@ -232,11 +238,11 @@ class CoopStatusScreen : StatusScreen
text_secret = Stringtable.Localize("$SCORE_SECRET"); text_secret = Stringtable.Localize("$SCORE_SECRET");
text_kills = Stringtable.Localize("$SCORE_KILLS"); text_kills = Stringtable.Localize("$SCORE_KILLS");
icon_x = 8 * CleanXfac; icon_x = 8 * FontScale;
name_x = icon_x + maxscorewidth * CleanXfac; name_x = icon_x + maxscorewidth * FontScale;
kills_x = name_x + (maxnamewidth + MAX(SmallFont.StringWidth("XXXXX"), SmallFont.StringWidth(text_kills)) + 8) * CleanXfac; kills_x = name_x + (maxnamewidth + 1 + MAX(displayFont.StringWidth("XXXXXXXXXX"), displayFont.StringWidth(text_kills)) + 16) * FontScale;
bonus_x = kills_x + ((bonus_len = SmallFont.StringWidth(text_bonus)) + 8) * CleanXfac; bonus_x = kills_x + ((bonus_len = displayFont.StringWidth(text_bonus)) + 16) * FontScale;
secret_x = bonus_x + ((secret_len = SmallFont.StringWidth(text_secret)) + 8) * CleanXfac; secret_x = bonus_x + ((secret_len = displayFont.StringWidth(text_secret)) + 16) * FontScale;
x = (screen.GetWidth() - secret_x) >> 1; x = (screen.GetWidth() - secret_x) >> 1;
icon_x += x; icon_x += x;
@ -246,11 +252,11 @@ class CoopStatusScreen : StatusScreen
secret_x += x; secret_x += x;
screen.DrawText(SmallFont, textcolor, name_x, y, Stringtable.Localize("$SCORE_NAME"), DTA_CleanNoMove, true); drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_NAME"), FontScale, textcolor);
screen.DrawText(SmallFont, textcolor, kills_x - SmallFont.StringWidth(text_kills)*CleanXfac, y, text_kills, DTA_CleanNoMove, true); drawTextScaled(displayFont, kills_x - displayFont.StringWidth(text_kills) * FontScale, y, text_kills, FontScale, textcolor);
screen.DrawText(SmallFont, textcolor, bonus_x - bonus_len*CleanXfac, y, text_bonus, DTA_CleanNoMove, true); drawTextScaled(displayFont, bonus_x - bonus_len * FontScale, y, text_bonus, FontScale, textcolor);
screen.DrawText(SmallFont, textcolor, secret_x - secret_len*CleanXfac, y, text_secret, DTA_CleanNoMove, true); drawTextScaled(displayFont, secret_x - secret_len * FontScale, y, text_secret, FontScale, textcolor);
y += height + 6 * CleanYfac; y += height + 6 * FontScale;
missed_kills = wbs.maxkills; missed_kills = wbs.maxkills;
missed_items = wbs.maxitems; missed_items = wbs.maxitems;
@ -274,16 +280,16 @@ class CoopStatusScreen : StatusScreen
{ {
screen.DrawTexture(player.mo.ScoreIcon, true, icon_x, y, DTA_CleanNoMove, true); screen.DrawTexture(player.mo.ScoreIcon, true, icon_x, y, DTA_CleanNoMove, true);
} }
screen.DrawText(SmallFont, thiscolor, name_x, y + ypadding, player.GetUserName(), DTA_CleanNoMove, true); drawTextScaled(displayFont, name_x, y + ypadding, player.GetUserName(), FontScale, thiscolor);
drawPercent(SmallFont, kills_x, y + ypadding, cnt_kills[i], wbs.maxkills, false, thiscolor, true); drawPercentScaled(displayFont, kills_x, y + ypadding, cnt_kills[i], wbs.maxkills, FontScale, thiscolor);
missed_kills -= cnt_kills[i]; missed_kills -= cnt_kills[i];
if (ng_state >= 4) if (ng_state >= 4)
{ {
drawPercent(SmallFont, bonus_x, y + ypadding, cnt_items[i], wbs.maxitems, false, thiscolor, true); drawPercentScaled(displayFont, bonus_x, y + ypadding, cnt_items[i], wbs.maxitems, FontScale, thiscolor);
missed_items -= cnt_items[i]; missed_items -= cnt_items[i];
if (ng_state >= 6) if (ng_state >= 6)
{ {
drawPercent(SmallFont, secret_x, y + ypadding, cnt_secret[i], wbs.maxsecret, false, thiscolor, true); drawPercentScaled(displayFont, secret_x, y + ypadding, cnt_secret[i], wbs.maxsecret, FontScale, thiscolor);
missed_secrets -= cnt_secret[i]; missed_secrets -= cnt_secret[i];
} }
} }
@ -292,28 +298,28 @@ class CoopStatusScreen : StatusScreen
// Draw "MISSED" line // Draw "MISSED" line
y += 3 * CleanYfac; y += 3 * CleanYfac;
screen.DrawText(SmallFont, Font.CR_DARKGRAY, name_x, y, Stringtable.Localize("$SCORE_MISSED"), DTA_CleanNoMove, true); drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_MISSED"), FontScale, Font.CR_DARKGRAY);
drawPercent(SmallFont, kills_x, y, missed_kills, wbs.maxkills, false, Font.CR_DARKGRAY, true); drawPercentScaled(displayFont, kills_x, y, missed_kills, wbs.maxkills, FontScale, Font.CR_DARKGRAY);
if (ng_state >= 4) if (ng_state >= 4)
{ {
drawPercent(SmallFont, bonus_x, y, missed_items, wbs.maxitems, false, Font.CR_DARKGRAY, true); drawPercentScaled(displayFont, bonus_x, y, missed_items, wbs.maxitems, FontScale, Font.CR_DARKGRAY);
if (ng_state >= 6) if (ng_state >= 6)
{ {
drawPercent(SmallFont, secret_x, y, missed_secrets, wbs.maxsecret, false, Font.CR_DARKGRAY, true); drawPercentScaled(displayFont, secret_x, y, missed_secrets, wbs.maxsecret, FontScale, Font.CR_DARKGRAY);
} }
} }
// Draw "TOTAL" line // Draw "TOTAL" line
y += height + 3 * CleanYfac; y += height + 3 * CleanYfac;
screen.DrawText(SmallFont, textcolor, name_x, y, Stringtable.Localize("$SCORE_TOTAL"), DTA_CleanNoMove, true); drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$SCORE_TOTAL"), FontScale, textcolor);
drawNum(SmallFont, kills_x, y, wbs.maxkills, 0, false, textcolor, true); drawNumScaled(displayFont, kills_x, y, FontScale, wbs.maxkills, 0, textcolor);
if (ng_state >= 4) if (ng_state >= 4)
{ {
drawNum(SmallFont, bonus_x, y, wbs.maxitems, 0, false, textcolor, true); drawNumScaled(displayFont, bonus_x, y, FontScale, wbs.maxitems, 0, textcolor);
if (ng_state >= 6) if (ng_state >= 6)
{ {
drawNum(SmallFont, secret_x, y, wbs.maxsecret, 0, false, textcolor, true); drawNumScaled(displayFont, secret_x, y, FontScale, wbs.maxsecret, 0, textcolor);
} }
} }
} }
} }

View file

@ -170,14 +170,30 @@ class AltHud ui
void DrawStatLine(int x, in out int y, String prefix, String text) void DrawStatLine(int x, in out int y, String prefix, String text)
{ {
y -= SmallFont.GetHeight()-1; if (!hud_althudfont)
screen.DrawText(SmallFont, hudcolor_statnames, x, y, prefix, {
DTA_KeepRatio, true, y -= SmallFont.GetHeight()-1;
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75); 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, screen.DrawText(SmallFont, hudcolor_stats, x+statspace, y, text,
DTA_KeepRatio, true, DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75); 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);
}
} }
void DrawStatus(PlayerInfo CPlayer, int x, int y) void DrawStatus(PlayerInfo CPlayer, int x, int y)

Some files were not shown because too many files have changed in this diff Show more