Skip to content
Permalink
Browse files

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

  • Loading branch information...
madame-rachelle committed Apr 14, 2019
2 parents 3deda0e + ad23726 commit b8dfb3c136e694e0cbaba3f06e6a13879a2e859c
Showing with 398 additions and 191 deletions.
  1. +6 −21 src/c_console.cpp
  2. +1 −1 src/d_main.cpp
  3. +1 −1 src/doomstat.h
  4. +15 −0 src/g_cvars.cpp
  5. +1 −1 src/g_statusbar/hudmessages.cpp
  6. +6 −4 src/g_statusbar/sbar.h
  7. +17 −25 src/g_statusbar/shared_sbar.cpp
  8. +11 −4 src/gamedata/d_dehacked.cpp
  9. +46 −9 src/gamedata/stringtable.cpp
  10. +5 −3 src/gamedata/stringtable.h
  11. +1 −1 src/menu/loadsavemenu.cpp
  12. +11 −1 src/rendering/2d/v_draw.cpp
  13. +21 −1 src/rendering/2d/v_drawtext.cpp
  14. +93 −4 src/scripting/vmthunks.cpp
  15. +22 −13 src/utility/zstring.cpp
  16. +2 −1 src/utility/zstring.h
  17. +0 −1 src/v_video.cpp
  18. +12 −0 src/v_video.h
  19. +28 −27 wadsrc/static/language.csv
  20. +2 −2 wadsrc/static/zscript/actors/player/player.zs
  21. +13 −5 wadsrc/static/zscript/base.zs
  22. +8 −0 wadsrc/static/zscript/constants.zs
  23. +5 −4 wadsrc/static/zscript/ui/menu/listmenuitems.zs
  24. +2 −2 wadsrc/static/zscript/ui/menu/messagebox.zs
  25. +2 −2 wadsrc/static/zscript/ui/menu/textentermenu.zs
  26. +1 −1 wadsrc/static/zscript/ui/statscreen/statscreen.zs
  27. +4 −16 wadsrc/static/zscript/ui/statusbar/alt_hud.zs
  28. +2 −2 wadsrc/static/zscript/ui/statusbar/doom_sbar.zs
  29. +3 −3 wadsrc/static/zscript/ui/statusbar/heretic_sbar.zs
  30. +3 −3 wadsrc/static/zscript/ui/statusbar/hexen_sbar.zs
  31. +1 −1 wadsrc/static/zscript/ui/statusbar/statusbar.zs
  32. +5 −5 wadsrc/static/zscript/ui/statusbar/strife_sbar.zs
  33. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/003A.lmp
  34. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00A1.lmp
  35. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00BF.lmp
  36. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C0.lmp
  37. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C1.lmp
  38. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C2.lmp
  39. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C3.lmp
  40. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C4.lmp
  41. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C5.lmp
  42. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C6.lmp
  43. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C7.lmp
  44. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C8.lmp
  45. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00C9.lmp
  46. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00CA.lmp
  47. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00CB.lmp
  48. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00CC.lmp
  49. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00CD.lmp
  50. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00CE.lmp
  51. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00CF.lmp
  52. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00D1.lmp
  53. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00D2.lmp
  54. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00D3.lmp
  55. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00D4.lmp
  56. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00D5.lmp
  57. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00D6.lmp
  58. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00D9.lmp
  59. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00DA.lmp
  60. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00DB.lmp
  61. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/00DC.lmp
  62. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/0152.lmp
  63. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/016E.lmp
  64. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/0178.lmp
  65. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/0401.lmp
  66. BIN wadsrc_extra/static/filter/game-chex/fonts/bigfont/1E9E.lmp
  67. BIN wadsrc_extra/static/filter/game-chex/fonts/defsmallfont/00D2.lmp
  68. BIN wadsrc_extra/static/filter/game-doom/fonts/bigfont/00A1.lmp
  69. BIN wadsrc_extra/static/filter/game-doom/fonts/bigfont/00BF.lmp
  70. BIN wadsrc_extra/static/filter/game-doom/fonts/bigupper/00A1.lmp
  71. BIN wadsrc_extra/static/filter/game-doom/fonts/bigupper/00BF.lmp
  72. BIN wadsrc_extra/static/filter/game-doom/fonts/defsmallfont/00D2.lmp
  73. +48 −27 wadsrc_extra/static/language.csv
@@ -79,21 +79,6 @@ CUSTOM_CVAR(Int, con_buffersize, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
if (self >= 0 && self < 128) self = 128;
}

bool generic_hud, generic_ui;

EXTERN_CVAR(Bool, ui_generic)

CUSTOM_CVAR(Bool, hud_generic, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // All HUD elements only use generic assets
{
generic_hud = self || ui_generic;
}

CUSTOM_CVAR(Bool, ui_generic, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // The entire UI uses generic assets (this excludes the primary menus)
{
generic_ui = self;
generic_hud = self || hud_generic;
}

FConsoleBuffer *conbuffer;

static void C_TabComplete (bool goForward);
@@ -599,13 +584,13 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE)
EColorRange C_GetDefaultFontColor()
{
// Ideally this should analyze the SmallFont and pick a matching color.
if (!generic_hud) return CR_UNTRANSLATED;
if (!generic_ui) return CR_UNTRANSLATED;
return gameinfo.gametype == GAME_Doom ? CR_RED : gameinfo.gametype == GAME_Chex ? CR_GREEN : gameinfo.gametype == GAME_Strife ? CR_GOLD : CR_GRAY;
}

FFont * C_GetDefaultHUDFont()
{
return generic_hud? NewSmallFont : SmallFont;
return generic_ui? NewSmallFont : SmallFont;
}

void C_InitConback()
@@ -800,9 +785,9 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
con_notifylines == 0)
return;

width = DisplayWidth / active_con_scaletext(generic_hud);
width = DisplayWidth / active_con_scaletext(generic_ui);

FFont *font = hud_generic ? NewSmallFont : SmallFont;
FFont *font = generic_ui ? NewSmallFont : SmallFont;
if (font == nullptr) return; // Without an initialized font we cannot handle the message (this is for those which come here before the font system is ready.)

if (AddType == APPENDLINE && Text.Size() > 0 && Text[Text.Size() - 1].PrintLevel == printlevel)
@@ -1086,7 +1071,7 @@ void FNotifyBuffer::Draw()
line = Top;
canskip = true;

FFont *font = hud_generic ? NewSmallFont : SmallFont;
FFont *font = generic_ui ? NewSmallFont : SmallFont;
lineadv = font->GetHeight ();

for (unsigned i = 0; i < Text.Size(); ++ i)
@@ -1109,7 +1094,7 @@ void FNotifyBuffer::Draw()
else
color = PrintColors[notify.PrintLevel];

int scale = active_con_scaletext(generic_hud);
int scale = active_con_scaletext(generic_ui);
if (!center)
screen->DrawText (font, color, 0, line, notify.Text,
DTA_VirtualWidth, screen->GetWidth() / scale,
@@ -858,7 +858,7 @@ void D_Display ()
screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
if (paused && multiplayer)
{
FFont *font = generic_hud? NewSmallFont : SmallFont;
FFont *font = generic_ui? NewSmallFont : SmallFont;
pstring << ' ' << players[paused - 1].userinfo.GetName();
screen->DrawText(font, CR_RED,
(screen->GetWidth() - font->StringWidth(pstring)*CleanXfac) / 2,
@@ -254,6 +254,6 @@ EXTERN_CVAR (Int, compatflags2);
extern FString LumpFilterIWAD;

// These control whether certain items use generic text output instead of game-specific one.
extern bool generic_hud, generic_ui;
extern bool generic_ui;

#endif
@@ -132,6 +132,20 @@ CUSTOM_CVAR(Float, teamdamage, 0.f, CVAR_SERVERINFO | CVAR_NOINITCALL)
}
}

bool generic_ui;

void UpdateGenericUI(bool cvar)
{
auto switchstr = GStrings["USE_GENERIC_FONT"];
generic_ui = (cvar || (switchstr && strtoll(switchstr, nullptr, 0)));
}

CUSTOM_CVAR(Bool, ui_generic, false, 0) // This is for allowing to test the generic font system with all languages
{
UpdateGenericUI(self);
}


CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
{
GStrings.UpdateLanguage();
@@ -140,4 +154,5 @@ CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOB
// does this even make sense on secondary levels...?
if (Level->info != nullptr) Level->LevelName = Level->info->LookupLevelName();
}
UpdateGenericUI(ui_generic);
}
@@ -197,7 +197,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
Top = y;
HoldTics = (int)(holdTime * TICRATE);
Tics = -1; // -1 to compensate for one additional Tick the message will receive.
Font = font? font : generic_hud? NewSmallFont : SmallFont;
Font = font? font : generic_ui? NewSmallFont : SmallFont;
TextColor = textColor;
State = 0;
SourceText = copystring (text);
@@ -52,6 +52,8 @@ enum EHudState
HUD_AltHud // Used for passing through popups to the alt hud
};

enum EMonospacing : int;

// HUD Message base object --------------------------------------------------

// This is a mo-op base class to allow derived ZScript message types that can be managed by the status bar.
@@ -332,12 +334,12 @@ class DHUDFont : public DObject
public:
FFont *mFont;
int mSpacing;
bool mMonospaced;
EMonospacing mMonospacing;
int mShadowX;
int mShadowY;

DHUDFont(FFont *f, int sp, bool ms, int sx, int sy)
: mFont(f), mSpacing(sp), mMonospaced(ms), mShadowX(sx), mShadowY(sy)
DHUDFont(FFont *f, int sp, EMonospacing ms, int sx, int sy)
: mFont(f), mSpacing(sp), mMonospacing(ms), mShadowX(sx), mShadowY(sy)
{}
};

@@ -434,7 +436,7 @@ class DBaseStatusBar : public DObject
void DrawAltHUD();

void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY);
void DrawString(FFont *font, const FString &cstring, double x, double y, int flags, double Alpha, int translation, int spacing, bool monospaced, int shadowX, int shadowY);
void DrawString(FFont *font, const FString &cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY);
void TransformRect(double &x, double &y, double &w, double &h, int flags = 0);
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
void SetClipRect(double x, double y, double w, double h, int flags = 0);
@@ -552,48 +552,34 @@ void DBaseStatusBar::BeginHUD(int resW, int resH, double Alpha, bool forcescaled

void FormatMapName(FLevelLocals *self, int cr, FString *result);

static void DrawAMText(FFont *fnt, int color, const char *text, int vwidth, int vheight, int x, int y)
{
int zerowidth = fnt->GetCharWidth('0');

x += zerowidth / 2;
for (int i = 0; text[i]; i++)
{
int c = text[i];
int width = fnt->GetCharWidth(c);

screen->DrawChar(fnt, color, x, y, c, DTA_KeepRatio, true,
DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, DTA_LeftOffset, width / 2, TAG_DONE);
x += zerowidth;
}
}


void DBaseStatusBar::DoDrawAutomapHUD(int crdefault, int highlight)
{
auto scale = GetUIScale(hud_scale);
auto font = generic_hud ? NewSmallFont : SmallFont;
auto font = generic_ui ? NewSmallFont : SmallFont;
auto vwidth = screen->GetWidth() / scale;
auto vheight = screen->GetHeight() / scale;
auto fheight = font->GetHeight();
FString textbuffer;
int sec;
int y = 0;
int textdist = 4;
int zerowidth = font->GetCharWidth('0');

if (am_showtime)
{
sec = Tics2Seconds(primaryLevel->time);
textbuffer.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
DrawAMText(font, crdefault, textbuffer, vwidth, vheight, vwidth - font->GetCharWidth('0') * 8 - textdist, y);
screen->DrawText(font, crdefault, vwidth - zerowidth * 8 - textdist, y, textbuffer, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight,
DTA_Monospace, EMonospacing::CellCenter, DTA_Spacing, zerowidth, DTA_KeepRatio, true, TAG_END);
y += fheight;
}

if (am_showtotaltime)
{
sec = Tics2Seconds(primaryLevel->totaltime);
textbuffer.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
DrawAMText(font, crdefault, textbuffer, vwidth, vheight, vwidth - font->GetCharWidth('0') * 8 - textdist, y);
screen->DrawText(font, crdefault, vwidth - zerowidth * 8 - textdist, y, textbuffer, DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight,
DTA_Monospace, EMonospacing::CellCenter, DTA_Spacing, zerowidth, DTA_KeepRatio, true, TAG_END);
}

if (!deathmatch)
@@ -1168,7 +1154,7 @@ void DBaseStatusBar::DrawLog ()
if (CPlayer->LogText.IsNotEmpty())
{
// This uses the same scaling as regular HUD messages
auto scale = active_con_scaletext(generic_hud);
auto scale = active_con_scaletext(generic_ui);
hudwidth = SCREENWIDTH / scale;
hudheight = SCREENHEIGHT / scale;
FFont *font = C_GetDefaultHUDFont();
@@ -1600,8 +1586,10 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
//
//============================================================================

void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, double y, int flags, double Alpha, int translation, int spacing, bool monospaced, int shadowX, int shadowY)
void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY)
{
bool monospaced = monospacing != EMonospacing::Off;

switch (flags & DI_TEXT_ALIGN)
{
default:
@@ -1685,6 +1673,11 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
rw = c->GetDisplayWidthDouble();
rh = c->GetDisplayHeightDouble();

if (monospacing == EMonospacing::CellCenter)
rx += (spacing - rw) / 2;
else if (monospacing == EMonospacing::CellRight)
rx += (spacing - rw);

if (!fullscreenOffsets)
{
StatusbarToRealCoords(rx, ry, rw, rh);
@@ -1721,7 +1714,6 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
else
x += spacing;
}

}

void SBar_DrawString(DBaseStatusBar *self, DHUDFont *font, const FString &string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing)
@@ -1743,13 +1735,13 @@ void SBar_DrawString(DBaseStatusBar *self, DHUDFont *font, const FString &string
auto brk = V_BreakLines(font->mFont, wrapwidth, string, true);
for (auto &line : brk)
{
self->DrawString(font->mFont, line.Text, x, y, flags, alpha, trans, font->mSpacing, font->mMonospaced, font->mShadowX, font->mShadowY);
self->DrawString(font->mFont, line.Text, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY);
y += font->mFont->GetHeight() + linespacing;
}
}
else
{
self->DrawString(font->mFont, string, x, y, flags, alpha, trans, font->mSpacing, font->mMonospaced, font->mShadowX, font->mShadowY);
self->DrawString(font->mFont, string, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY);
}
}

@@ -282,6 +282,7 @@ static int PatchSize;
static char *Line1, *Line2;
static int dversion, pversion;
static bool including, includenotext;
static int LumpFileNum;

static const char *unknown_str = "Unknown key %s encountered in %s %d.\n";

@@ -2169,7 +2170,7 @@ static int PatchMusic (int dummy)

keystring << "MUSIC_" << Line1;

TableElement te = { newname, newname, newname, newname };
TableElement te = { LumpFileNum, { newname, newname, newname, newname } };
DehStrings.Insert(keystring, te);
DPrintf (DMSG_SPAMMY, "Music %s set to:\n%s\n", keystring.GetChars(), newname.GetChars());
}
@@ -2285,7 +2286,7 @@ static int PatchText (int oldSize)
if (str != NULL)
{
FString newname = newStr;
TableElement te = { newname, newname, newname, newname };
TableElement te = { LumpFileNum, { newname, newname, newname, newname } };
DehStrings.Insert(str, te);
EnglishStrings.Remove(str); // remove entry so that it won't get found again by the next iteration or by another replacement later
good = true;
@@ -2340,7 +2341,7 @@ static int PatchStrings (int dummy)
// Account for a discrepancy between Boom's and ZDoom's name for the red skull key pickup message
const char *ll = Line1;
if (!stricmp(ll, "GOTREDSKULL")) ll = "GOTREDSKUL";
TableElement te = { holdstring, holdstring, holdstring, holdstring };
TableElement te = { LumpFileNum, { holdstring, holdstring, holdstring, holdstring } };
DehStrings.Insert(ll, te);
DPrintf (DMSG_SPAMMY, "%s set to:\n%s\n", Line1, holdstring.GetChars());
}
@@ -2496,13 +2497,19 @@ int D_LoadDehLumps(DehLumpSource source)

bool D_LoadDehLump(int lumpnum)
{
auto ls = LumpFileNum;
LumpFileNum = Wads.GetLumpFile(lumpnum);

PatchSize = Wads.LumpLength(lumpnum);

PatchName = copystring(Wads.GetLumpFullPath(lumpnum));
PatchFile = new char[PatchSize + 1];
Wads.ReadLump(lumpnum, PatchFile);
PatchFile[PatchSize] = '\0'; // terminate with a '\0' character
return DoDehPatch();
auto res = DoDehPatch();
LumpFileNum = ls;

return res;
}

bool D_LoadDehFile(const char *patchfile)
Oops, something went wrong.

0 comments on commit b8dfb3c

Please sign in to comment.
You can’t perform that action at this time.