Merge branch 'master' into vulkan2

This commit is contained in:
Christoph Oelckers 2019-03-03 00:04:19 +01:00
commit 6ba8fee5c2
112 changed files with 301 additions and 99 deletions

View file

@ -2581,7 +2581,8 @@ void D_DoomMain (void)
}; };
for (p = 0; p < 5; ++p) for (p = 0; p < 5; ++p)
{ {
const char *str = GStrings[startupString[p]]; // At this point we cannot use the player's gender info yet so force 'male' here.
const char *str = GStrings.GetString(startupString[p], nullptr, 0);
if (str != NULL && str[0] != '\0') if (str != NULL && str[0] != '\0')
{ {
Printf("%s\n", str); Printf("%s\n", str);

View file

@ -278,7 +278,7 @@ void EventManager::WorldLoaded()
{ {
for (DStaticEventHandler* handler = FirstEventHandler; handler; handler = handler->next) for (DStaticEventHandler* handler = FirstEventHandler; handler; handler = handler->next)
{ {
if (savegamerestore) continue; // don't execute WorldLoaded for handlers loaded from the savegame. if (!handler->IsStatic() && savegamerestore) continue; // don't execute WorldLoaded for handlers loaded from the savegame.
handler->WorldLoaded(); handler->WorldLoaded();
} }
} }

View file

@ -94,6 +94,7 @@ CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE|CVAR_NOINITCALL)
if (thinker != NULL) if (thinker != NULL)
{ {
thinker->Destroy(); thinker->Destroy();
Level->ImpactDecalCount--;
} }
} }
} }

View file

@ -1530,7 +1530,7 @@ FLevelLocals::FLevelLocals() : Behaviors(this), tagManager(this)
{ {
Players[i] = &players[i]; Players[i] = &players[i];
} }
localEventManager = new EventManager; localEventManager = new EventManager(this);
} }
FLevelLocals::~FLevelLocals() FLevelLocals::~FLevelLocals()

View file

@ -539,7 +539,7 @@ void FDynamicLight::CollectWithinRadius(const DVector3 &opos, FSection *section,
bool hitonesidedback = false; bool hitonesidedback = false;
for (unsigned i = 0; i < collected_ss.Size(); i++) for (unsigned i = 0; i < collected_ss.Size(); i++)
{ {
auto &pos = collected_ss[i].pos; auto pos = collected_ss[i].pos;
section = collected_ss[i].sect; section = collected_ss[i].sect;
touching_sector = AddLightNode(&section->lighthead, section, this, touching_sector); touching_sector = AddLightNode(&section->lighthead, section, this, touching_sector);

View file

@ -2164,13 +2164,14 @@ static int PatchMusic (int dummy)
while ((result = GetLine()) == 1) while ((result = GetLine()) == 1)
{ {
const char *newname = skipwhite (Line2); FString newname = skipwhite (Line2);
FString keystring; FString keystring;
keystring << "MUSIC_" << Line1; keystring << "MUSIC_" << Line1;
DehStrings.Insert(keystring, newname); TableElement te = { newname, newname, newname, newname };
DPrintf (DMSG_SPAMMY, "Music %s set to:\n%s\n", keystring.GetChars(), newname); DehStrings.Insert(keystring, te);
DPrintf (DMSG_SPAMMY, "Music %s set to:\n%s\n", keystring.GetChars(), newname.GetChars());
} }
return result; return result;
@ -2283,7 +2284,9 @@ static int PatchText (int oldSize)
str = EnglishStrings.MatchString(oldStr); str = EnglishStrings.MatchString(oldStr);
if (str != NULL) if (str != NULL)
{ {
DehStrings.Insert(str, newStr); FString newname = newStr;
TableElement te = { 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 EnglishStrings.Remove(str); // remove entry so that it won't get found again by the next iteration or by another replacement later
good = true; good = true;
} }
@ -2337,7 +2340,8 @@ static int PatchStrings (int dummy)
// Account for a discrepancy between Boom's and ZDoom's name for the red skull key pickup message // Account for a discrepancy between Boom's and ZDoom's name for the red skull key pickup message
const char *ll = Line1; const char *ll = Line1;
if (!stricmp(ll, "GOTREDSKULL")) ll = "GOTREDSKUL"; if (!stricmp(ll, "GOTREDSKULL")) ll = "GOTREDSKUL";
DehStrings.Insert(ll, holdstring); TableElement te = { holdstring, holdstring, holdstring, holdstring };
DehStrings.Insert(ll, te);
DPrintf (DMSG_SPAMMY, "%s set to:\n%s\n", Line1, holdstring.GetChars()); DPrintf (DMSG_SPAMMY, "%s set to:\n%s\n", Line1, holdstring.GetChars());
} }

View file

@ -185,6 +185,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
if (FixedWidth > 0) if (FixedWidth > 0)
{ {
ReadSheetFont(folderdata, FixedWidth, FontHeight, Scale); ReadSheetFont(folderdata, FixedWidth, FontHeight, Scale);
Type = Folder;
} }
else else
{ {
@ -211,6 +212,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
} }
if (lump.isValid()) if (lump.isValid())
{ {
Type = Multilump;
if (position < minchar) minchar = position; if (position < minchar) minchar = position;
if (position > maxchar) maxchar = position; if (position > maxchar) maxchar = position;
charMap.Insert(position, TexMan.GetTexture(lump)); charMap.Insert(position, TexMan.GetTexture(lump));
@ -235,6 +237,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
auto tex = TexMan.GetTexture(lump); auto tex = TexMan.GetTexture(lump);
tex->SetScale(Scale); tex->SetScale(Scale);
charMap.Insert((int)position, tex); charMap.Insert((int)position, tex);
Type = Folder;
} }
} }
} }

View file

@ -131,6 +131,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A) if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A)
{ {
LoadBMF(lump, data); LoadBMF(lump, data);
Type = BMF;
} }
else if (data[0] != 'F' || data[1] != 'O' || data[2] != 'N' || else if (data[0] != 'F' || data[1] != 'O' || data[2] != 'N' ||
(data[3] != '1' && data[3] != '2')) (data[3] != '1' && data[3] != '2'))
@ -143,10 +144,12 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
{ {
case '1': case '1':
LoadFON1 (lump, data); LoadFON1 (lump, data);
Type = Fon1;
break; break;
case '2': case '2':
LoadFON2 (lump, data); LoadFON2 (lump, data);
Type = Fon2;
break; break;
} }
} }

View file

@ -859,6 +859,12 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
FFont *font = FFont::FindFont (name); FFont *font = FFont::FindFont (name);
if (font == nullptr) if (font == nullptr)
{ {
if (!stricmp(name, "BIGUPPER"))
{
font = FFont::FindFont("BIGFONT");
if (font) return font;
}
int lump = -1; int lump = -1;
int folderfile = -1; int folderfile = -1;
@ -1446,6 +1452,10 @@ void V_InitFonts()
SmallFont2 = new FFont("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1); SmallFont2 = new FFont("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
} }
} }
//This must be read before BigFont so that it can be properly substituted.
BigUpper = V_GetFont("BigUpper");
if (!(BigFont = V_GetFont("BigFont"))) if (!(BigFont = V_GetFont("BigFont")))
{ {
if (gameinfo.gametype & GAME_Raven) if (gameinfo.gametype & GAME_Raven)
@ -1453,7 +1463,15 @@ void V_InitFonts()
BigFont = new FFont("BigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1); BigFont = new FFont("BigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1);
} }
} }
if (!(BigUpper = V_GetFont("BigUpper")))
// let PWAD BIGFONTs override the stock BIGUPPER font. (This check needs to be made smarter.)
if (BigUpper && BigFont->Type != FFont::Folder && BigUpper->Type == FFont::Folder)
{
delete BigUpper;
BigUpper = BigFont;
}
if (BigUpper == nullptr)
{ {
BigUpper = BigFont; BigUpper = BigFont;
} }

View file

@ -81,6 +81,18 @@ extern int NumTextColors;
class FFont class FFont
{ {
public: public:
enum EFontType
{
Unknown,
Folder,
Multilump,
Fon1,
Fon2,
BMF,
Custom
};
FFont (const char *fontname, const char *nametemplate, const char *filetemplate, int first, int count, int base, int fdlump, int spacewidth=-1, bool notranslate = false); FFont (const char *fontname, const char *nametemplate, const char *filetemplate, int first, int count, int base, int fdlump, int spacewidth=-1, bool notranslate = false);
virtual ~FFont (); virtual ~FFont ();
@ -119,6 +131,7 @@ protected:
void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale); void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
EFontType Type = EFontType::Unknown;
int FirstChar, LastChar; int FirstChar, LastChar;
int SpaceWidth; int SpaceWidth;
int FontHeight; int FontHeight;
@ -147,6 +160,7 @@ protected:
friend struct FontsDeleter; friend struct FontsDeleter;
friend void V_ClearFonts(); friend void V_ClearFonts();
friend void V_InitFonts();
}; };

View file

@ -42,9 +42,16 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "v_text.h" #include "v_text.h"
#include "gi.h" #include "gi.h"
#include "d_player.h"
#include "xlsxread/xlsxio_read.h" #include "xlsxread/xlsxio_read.h"
//==========================================================================
//
//
//
//==========================================================================
void FStringTable::LoadStrings () void FStringTable::LoadStrings ()
{ {
int lastlump, lump; int lastlump, lump;
@ -58,8 +65,14 @@ void FStringTable::LoadStrings ()
} }
SetLanguageIDs(); SetLanguageIDs();
UpdateLanguage(); UpdateLanguage();
allMacros.Clear();
} }
//==========================================================================
//
//
//
//==========================================================================
bool FStringTable::LoadLanguageFromSpreadsheet(int lumpnum) bool FStringTable::LoadLanguageFromSpreadsheet(int lumpnum)
{ {
@ -69,14 +82,60 @@ bool FStringTable::LoadLanguageFromSpreadsheet(int lumpnum)
{ {
return false; return false;
} }
readMacros(xlsxio, "macros");
if (!readSheetIntoTable(xlsxio, "Sheet1")) return false; readSheetIntoTable(xlsxio, "strings");
// readMacros(xlsxio, "macros");
xlsxioread_close(xlsxio); xlsxioread_close(xlsxio);
return true; return true;
} }
//==========================================================================
//
//
//
//==========================================================================
bool FStringTable::readMacros(xlsxioreader reader, const char *sheetname)
{
xlsxioreadersheet sheet = xlsxioread_sheet_open(reader, sheetname, XLSXIOREAD_SKIP_NONE);
if (sheet == nullptr) return false;
while (xlsxioread_sheet_next_row(sheet))
{
auto macroname = xlsxioread_sheet_next_cell(sheet);
auto language = xlsxioread_sheet_next_cell(sheet);
if (!macroname || !language) continue;
FStringf combined_name("%s/%s", language, macroname);
free(language);
free(macroname);
FName name = combined_name;
StringMacro macro;
char *value;
for (int i = 0; i < 4; i++)
{
value = xlsxioread_sheet_next_cell(sheet);
macro.Replacements[i] = value;
free(value);
}
// This is needed because the reader code would choke on incompletely read rows.
while ((value = xlsxioread_sheet_next_cell(sheet)) != nullptr)
{
free(value);
}
allMacros.Insert(name, macro);
}
xlsxioread_sheet_close(sheet);
return true;
}
//==========================================================================
//
//
//
//==========================================================================
bool FStringTable::readSheetIntoTable(xlsxioreader reader, const char *sheetname) bool FStringTable::readSheetIntoTable(xlsxioreader reader, const char *sheetname)
{ {
@ -94,7 +153,7 @@ bool FStringTable::readSheetIntoTable(xlsxioreader reader, const char *sheetname
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() <= 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 && iswspace((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 && iswspace((unsigned char)vend[-1])) *--vend = 0; // skip over trailing whitespace
@ -105,12 +164,13 @@ bool FStringTable::readSheetIntoTable(xlsxioreader reader, const char *sheetname
} }
row++; row++;
} }
xlsxioread_sheet_close(sheet);
int labelcol = -1; int labelcol = -1;
int filtercol = -1; int filtercol = -1;
TArray<std::pair<int, unsigned>> langrows; TArray<std::pair<int, unsigned>> langrows;
if (table.Size() > 0)
{
for (unsigned column = 0; column < table[0].Size(); column++) for (unsigned column = 0; column < table[0].Size(); column++)
{ {
auto &entry = table[0][column]; auto &entry = table[0][column];
@ -157,15 +217,21 @@ bool FStringTable::readSheetIntoTable(xlsxioreader reader, const char *sheetname
auto str = row[langentry.first]; auto str = row[langentry.first];
if (str.Len() > 0) if (str.Len() > 0)
{ {
allStrings[langentry.second].Insert(strName, str); InsertString(langentry.second, strName, str);
str.Substitute("\n", "|");
Printf(PRINT_LOG, "Setting %s for %s to %.40s\n\n", strName.GetChars(), &langentry.second, str.GetChars());
} }
} }
} }
}
xlsxioread_sheet_close(sheet);
return true; return true;
} }
//==========================================================================
//
//
//
//==========================================================================
void FStringTable::LoadLanguage (int lumpnum) void FStringTable::LoadLanguage (int lumpnum)
{ {
bool errordone = false; bool errordone = false;
@ -262,13 +328,52 @@ void FStringTable::LoadLanguage (int lumpnum)
// Insert the string into all relevant tables. // Insert the string into all relevant tables.
for (auto map : activeMaps) for (auto map : activeMaps)
{ {
allStrings[map].Insert(strName, strText); InsertString(map, strName, strText);
} }
} }
} }
} }
} }
//==========================================================================
//
//
//
//==========================================================================
void FStringTable::InsertString(int langid, FName label, const FString &string)
{
const char *strlangid = (const char *)&langid;
TableElement te = { string, string, string, string };
long index;
while ((index = te.strings[0].IndexOf("@[")) >= 0)
{
auto endindex = te.strings[0].IndexOf(']', index);
if (endindex == -1)
{
Printf("Bad macro in %s : %s\n", strlangid, label.GetChars());
break;
}
FString macroname(string.GetChars() + index + 2, endindex - index - 2);
FStringf lookupstr("%s/%s", strlangid, macroname.GetChars());
FStringf replacee("@[%s]", macroname.GetChars());
FName lookupname(lookupstr, true);
auto replace = allMacros.CheckKey(lookupname);
for (int i = 0; i < 4; i++)
{
const char *replacement = replace && replace->Replacements[i] ? replace->Replacements[i] : "";
te.strings[i].Substitute(replacee, replacement);
}
}
allStrings[langid].Insert(label, te);
}
//==========================================================================
//
//
//
//==========================================================================
void FStringTable::UpdateLanguage() void FStringTable::UpdateLanguage()
{ {
currentLanguageSet.Clear(); currentLanguageSet.Clear();
@ -290,7 +395,12 @@ void FStringTable::UpdateLanguage()
checkone(default_table); checkone(default_table);
} }
//==========================================================================
//
// Replace \ escape sequences in a string with the escaped characters. // Replace \ escape sequences in a string with the escaped characters.
//
//==========================================================================
size_t FStringTable::ProcessEscapes (char *iptr) size_t FStringTable::ProcessEscapes (char *iptr)
{ {
char *sptr = iptr, *optr = iptr, c; char *sptr = iptr, *optr = iptr, c;
@ -317,10 +427,15 @@ size_t FStringTable::ProcessEscapes (char *iptr)
return optr - sptr; return optr - sptr;
} }
//==========================================================================
//
// Checks if the given key exists in any one of the default string tables that are valid for all languages.
// To replace IWAD content this condition must be true.
//
//==========================================================================
bool FStringTable::exists(const char *name) bool FStringTable::exists(const char *name)
{ {
// Checks if the given key exists in any one of the default string tables that are valid for all languages.
// To replace IWAD content this condition must be true.
if (name == nullptr || *name == 0) if (name == nullptr || *name == 0)
{ {
return false; return false;
@ -343,13 +458,20 @@ bool FStringTable::exists(const char *name)
return false; return false;
} }
//==========================================================================
//
// Finds a string by name and returns its value // Finds a string by name and returns its value
const char *FStringTable::GetString(const char *name, uint32_t *langtable) const //
//==========================================================================
const char *FStringTable::GetString(const char *name, uint32_t *langtable, int gender) const
{ {
if (name == nullptr || *name == 0) if (name == nullptr || *name == 0)
{ {
return nullptr; return nullptr;
} }
if (gender == -1) gender = players[consoleplayer].userinfo.GetGender();
if (gender < 0 || gender > 3) gender = 0;
FName nm(name, true); FName nm(name, true);
if (nm != NAME_None) if (nm != NAME_None)
{ {
@ -359,20 +481,27 @@ const char *FStringTable::GetString(const char *name, uint32_t *langtable) const
if (item) if (item)
{ {
if (langtable) *langtable = map.first; if (langtable) *langtable = map.first;
return item->GetChars(); return item->strings[gender].GetChars();
} }
} }
} }
return nullptr; return nullptr;
} }
//==========================================================================
//
// Finds a string by name in a given language // Finds a string by name in a given language
const char *FStringTable::GetLanguageString(const char *name, uint32_t langtable) const //
//==========================================================================
const char *FStringTable::GetLanguageString(const char *name, uint32_t langtable, int gender) const
{ {
if (name == nullptr || *name == 0) if (name == nullptr || *name == 0)
{ {
return nullptr; return nullptr;
} }
if (gender == -1) gender = players[consoleplayer].userinfo.GetGender();
if (gender < 0 || gender > 3) gender = 0;
FName nm(name, true); FName nm(name, true);
if (nm != NAME_None) if (nm != NAME_None)
{ {
@ -381,14 +510,19 @@ const char *FStringTable::GetLanguageString(const char *name, uint32_t langtable
auto item = map->CheckKey(nm); auto item = map->CheckKey(nm);
if (item) if (item)
{ {
return item->GetChars(); return item->strings[gender].GetChars();
} }
} }
return nullptr; return nullptr;
} }
//==========================================================================
//
// Finds a string by name and returns its value. If the string does // Finds a string by name and returns its value. If the string does
// not exist, returns the passed name instead. // not exist, returns the passed name instead.
//
//==========================================================================
const char *FStringTable::operator() (const char *name) const const char *FStringTable::operator() (const char *name) const
{ {
const char *str = operator[] (name); const char *str = operator[] (name);
@ -396,7 +530,14 @@ const char *FStringTable::operator() (const char *name) const
} }
//==========================================================================
//
// Find a string with the same exact text. Returns its name. // Find a string with the same exact text. Returns its name.
// This does not need to check genders, it is only used by
// Dehacked on the English table for finding stock strings.
//
//==========================================================================
const char *StringMap::MatchString (const char *string) const const char *StringMap::MatchString (const char *string) const
{ {
StringMap::ConstIterator it(*this); StringMap::ConstIterator it(*this);
@ -404,7 +545,7 @@ const char *StringMap::MatchString (const char *string) const
while (it.NextPair(pair)) while (it.NextPair(pair))
{ {
if (pair->Value.CompareNoCase(string) == 0) if (pair->Value.strings[0].CompareNoCase(string) == 0)
{ {
return pair->Key.GetChars(); return pair->Key.GetChars();
} }

View file

@ -47,14 +47,25 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomtype.h" #include "doomtype.h"
struct TableElement
{
FString strings[4];
};
// This public interface is for Dehacked // This public interface is for Dehacked
class StringMap : public TMap<FName, FString> class StringMap : public TMap<FName, TableElement>
{ {
public: public:
const char *MatchString(const char *string) const; const char *MatchString(const char *string) const;
}; };
struct StringMacro
{
FString Replacements[4];
};
class FStringTable class FStringTable
{ {
public: public:
@ -66,6 +77,7 @@ public:
}; };
using LangMap = TMap<uint32_t, StringMap>; using LangMap = TMap<uint32_t, StringMap>;
using StringMacroMap = TMap<FName, StringMacro>;
void LoadStrings (); void LoadStrings ();
void UpdateLanguage(); void UpdateLanguage();
@ -76,8 +88,8 @@ public:
UpdateLanguage(); UpdateLanguage();
} }
const char *GetLanguageString(const char *name, uint32_t langtable) const; const char *GetLanguageString(const char *name, uint32_t langtable, int gender = -1) const;
const char *GetString(const char *name, uint32_t *langtable) const; const char *GetString(const char *name, uint32_t *langtable, int gender = -1) const;
const char *operator() (const char *name) const; // Never returns NULL const char *operator() (const char *name) const; // Never returns NULL
const char *operator[] (const char *name) const const char *operator[] (const char *name) const
{ {
@ -87,12 +99,15 @@ public:
private: private:
StringMacroMap allMacros;
LangMap allStrings; LangMap allStrings;
TArray<std::pair<uint32_t, StringMap*>> currentLanguageSet; TArray<std::pair<uint32_t, StringMap*>> currentLanguageSet;
void LoadLanguage (int lumpnum); void LoadLanguage (int lumpnum);
bool LoadLanguageFromSpreadsheet(int lumpnum); bool LoadLanguageFromSpreadsheet(int lumpnum);
bool readMacros(struct xlsxio_read_struct *reader, const char *sheet);
bool readSheetIntoTable(struct xlsxio_read_struct *reader, const char *sheet); bool readSheetIntoTable(struct xlsxio_read_struct *reader, const char *sheet);
void InsertString(int langid, FName label, const FString &string);
static size_t ProcessEscapes (char *str); static size_t ProcessEscapes (char *str);
}; };

View file

@ -9,6 +9,7 @@
#include "r_data/r_translate.h" #include "r_data/r_translate.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "v_font.h" #include "v_font.h"
#include "gi.h"
#include "textures/textures.h" #include "textures/textures.h"
EXTERN_CVAR(Float, snd_menuvolume) EXTERN_CVAR(Float, snd_menuvolume)
@ -207,6 +208,8 @@ public:
mScrollTop = 0; mScrollTop = 0;
mIndent = 0; mIndent = 0;
mDontDim = 0; mDontDim = 0;
mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
} }
size_t PropagateMark() override; size_t PropagateMark() override;
~DOptionMenuDescriptor() ~DOptionMenuDescriptor()

View file

@ -948,6 +948,7 @@ static void ParseOptionMenu(FScanner &sc)
sc.MustGetString(); sc.MustGetString();
DOptionMenuDescriptor *desc = Create<DOptionMenuDescriptor>(); DOptionMenuDescriptor *desc = Create<DOptionMenuDescriptor>();
desc->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
desc->mMenuName = sc.String; desc->mMenuName = sc.String;
desc->mSelectedItem = -1; desc->mSelectedItem = -1;
desc->mScrollPos = 0; desc->mScrollPos = 0;
@ -1303,6 +1304,7 @@ static void BuildPlayerclassMenu()
DOptionMenuDescriptor *od = Create<DOptionMenuDescriptor>(); DOptionMenuDescriptor *od = Create<DOptionMenuDescriptor>();
MenuDescriptors[NAME_Playerclassmenu] = od; MenuDescriptors[NAME_Playerclassmenu] = od;
od->mMenuName = NAME_Playerclassmenu; od->mMenuName = NAME_Playerclassmenu;
od->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
od->mTitle = "$MNU_CHOOSECLASS"; od->mTitle = "$MNU_CHOOSECLASS";
od->mSelectedItem = 0; od->mSelectedItem = 0;
od->mScrollPos = 0; od->mScrollPos = 0;
@ -1683,6 +1685,7 @@ fail:
od = Create<DOptionMenuDescriptor>(); od = Create<DOptionMenuDescriptor>();
MenuDescriptors[NAME_Skillmenu] = od; MenuDescriptors[NAME_Skillmenu] = od;
od->mMenuName = NAME_Skillmenu; od->mMenuName = NAME_Skillmenu;
od->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
od->mTitle = "$MNU_CHOOSESKILL"; od->mTitle = "$MNU_CHOOSESKILL";
od->mSelectedItem = defindex; od->mSelectedItem = defindex;
od->mScrollPos = 0; od->mScrollPos = 0;

View file

@ -8869,7 +8869,7 @@ scriptwait:
case PCD_LOCALAMBIENTSOUND: case PCD_LOCALAMBIENTSOUND:
lookup = Level->Behaviors.LookupString (STACK(2)); lookup = Level->Behaviors.LookupString (STACK(2));
if (lookup != NULL && activator->CheckLocalView()) if (lookup != NULL && activator && activator->CheckLocalView())
{ {
S_Sound (CHAN_AUTO, S_Sound (CHAN_AUTO,
lookup, lookup,

View file

@ -261,12 +261,12 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf
if (message != NULL && message[0] == '$') if (message != NULL && message[0] == '$')
{ {
message = GStrings[message+1]; message = GStrings.GetString(message+1, nullptr, self->player->userinfo.GetGender());
} }
if (message == NULL) if (message == NULL)
{ {
message = GStrings("OB_DEFAULT"); message = GStrings.GetString("OB_DEFAULT", nullptr, self->player->userinfo.GetGender());
} }
// [CK] Don't display empty strings // [CK] Don't display empty strings

View file

@ -557,6 +557,9 @@ void P_PlayerStartStomp(AActor *actor, bool mononly)
if (th->player == NULL && !(th->flags3 & MF3_ISMONSTER)) if (th->player == NULL && !(th->flags3 & MF3_ISMONSTER))
continue; continue;
if ((th->flags6 & MF6_NOTELEFRAG) && !(th->flags7 & MF7_ALWAYSTELEFRAG))
continue;
if (th->player != NULL && mononly) if (th->player != NULL && mononly)
continue; continue;

View file

@ -7396,5 +7396,7 @@ void PrintMiscActorInfo(AActor *query)
Printf("FriendlySeeBlocks: %d\n", query->friendlyseeblocks); Printf("FriendlySeeBlocks: %d\n", query->friendlyseeblocks);
Printf("Target: %s\n", query->target ? query->target->GetClass()->TypeName.GetChars() : "-"); Printf("Target: %s\n", query->target ? query->target->GetClass()->TypeName.GetChars() : "-");
Printf("Last enemy: %s\n", query->lastenemy ? query->lastenemy->GetClass()->TypeName.GetChars() : "-"); Printf("Last enemy: %s\n", query->lastenemy ? query->lastenemy->GetClass()->TypeName.GetChars() : "-");
auto sn = FState::StaticGetStateName(query->state);
Printf("State:%s, Tics: %d", sn.GetChars(), query->tics);
} }
} }

View file

@ -1490,7 +1490,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
DPrintf(DMSG_NOTIFY, "Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]); DPrintf(DMSG_NOTIFY, "Loading sound \"%s\" (%td)\n", sfx->name.GetChars(), sfx - &S_sfx[0]);
int size = Wads.LumpLength(sfx->lumpnum); int size = Wads.LumpLength(sfx->lumpnum);
if (size > 0) if (size > 8)
{ {
auto wlump = Wads.OpenLumpReader(sfx->lumpnum); auto wlump = Wads.OpenLumpReader(sfx->lumpnum);
auto sfxdata = wlump.Read(size); auto sfxdata = wlump.Read(size);
@ -1556,7 +1556,7 @@ static void S_LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
else else
{ {
int size = Wads.LumpLength(sfx->lumpnum); int size = Wads.LumpLength(sfx->lumpnum);
if (size <= 0) return; if (size <= 8) return;
auto wlump = Wads.OpenLumpReader(sfx->lumpnum); auto wlump = Wads.OpenLumpReader(sfx->lumpnum);
auto sfxdata = wlump.Read(size); auto sfxdata = wlump.Read(size);

View file

@ -63,7 +63,7 @@ void zip_close(zip_t *zipfile)
zip_file_t *zip_fopen(zip_t *zipfile, const char *filename) zip_file_t *zip_fopen(zip_t *zipfile, const char *filename)
{ {
if (!zipfile) return NULL; if (!zipfile || !filename) return NULL;
auto lump = zipfile->FindLump(filename); auto lump = zipfile->FindLump(filename);
if (!lump) return NULL; if (!lump) return NULL;
return new FileReader(std::move(lump->NewReader())); return new FileReader(std::move(lump->NewReader()));

View file

@ -378,8 +378,6 @@ OptionMenu "OptionsMenu" protected
Submenu "$OPTMNU_DISPLAY", "VideoOptions" Submenu "$OPTMNU_DISPLAY", "VideoOptions"
Submenu "$OPTMNU_VIDEO", "VideoModeMenu" Submenu "$OPTMNU_VIDEO", "VideoModeMenu"
StaticText " " StaticText " "
Option "$OPTMNU_LANGUAGE", "language", "LanguageOptions"
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"
@ -419,12 +417,12 @@ ListMenu "PlayerMenu"
IfGame(Doom, Heretic, Strife, Chex) IfGame(Doom, Heretic, Strife, Chex)
{ {
MouseWindow 0, 220 MouseWindow 0, 220
PlayerDisplay 220, 80, "20 00 00", "80 00 40", 1, "PlayerDisplay" PlayerDisplay 220, 48, "20 00 00", "80 00 40", 1, "PlayerDisplay"
} }
IfGame(Hexen) IfGame(Hexen)
{ {
MouseWindow 0, 220 MouseWindow 0, 220
PlayerDisplay 220, 80, "00 07 00", "40 53 40", 1, "PlayerDisplay" PlayerDisplay 220, 48, "00 07 00", "40 53 40", 1, "PlayerDisplay"
} }
ValueText "$PLYRMNU_TEAM", "Team" ValueText "$PLYRMNU_TEAM", "Team"
@ -453,25 +451,12 @@ OptionMenu "CustomizeControls" protected
{ {
Title "$CNTRLMNU_TITLE" Title "$CNTRLMNU_TITLE"
StaticText ""
Submenu "$CNTRLMNU_ACTION" , "ActionControlsMenu" Submenu "$CNTRLMNU_ACTION" , "ActionControlsMenu"
StaticText ""
Submenu "$CNTRLMNU_CHAT" , "ChatControlsMenu" Submenu "$CNTRLMNU_CHAT" , "ChatControlsMenu"
StaticText ""
Submenu "$CNTRLMNU_WEAPONS" , "WeaponsControlMenu" Submenu "$CNTRLMNU_WEAPONS" , "WeaponsControlMenu"
StaticText ""
Submenu "$CNTRLMNU_INVENTORY" , "InventoryControlsMenu" Submenu "$CNTRLMNU_INVENTORY" , "InventoryControlsMenu"
StaticText ""
Submenu "$CNTRLMNU_OTHER" , "OtherControlsMenu" Submenu "$CNTRLMNU_OTHER" , "OtherControlsMenu"
StaticText ""
Submenu "$CNTRLMNU_POPUPS" , "StrifeControlsMenu" Submenu "$CNTRLMNU_POPUPS" , "StrifeControlsMenu"
StaticText ""
Submenu "$MAPCNTRLMNU_CONTROLS" , "MapControlsMenu" Submenu "$MAPCNTRLMNU_CONTROLS" , "MapControlsMenu"
} }
@ -912,9 +897,6 @@ OptionMenu "VideoOptions" protected
Option "$DSPLYMNU_NOMONSTERINTERPOLATION", "nomonsterinterpolation", "NoYes" Option "$DSPLYMNU_NOMONSTERINTERPOLATION", "nomonsterinterpolation", "NoYes"
Slider "$DSPLYMNU_MENUDIM", "dimamount", 0, 1.0, 0.05, 2 Slider "$DSPLYMNU_MENUDIM", "dimamount", 0, 1.0, 0.05, 2
ColorPicker "$DSPLYMNU_DIMCOLOR", "dimcolor" ColorPicker "$DSPLYMNU_DIMCOLOR", "dimcolor"
Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_STILLBOB", "stillbob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_BOBSPEED", "wbobspeed", 0, 2.0, 0.1
IfOption(Windows) IfOption(Windows)
{ {
StaticText " " StaticText " "
@ -1005,6 +987,11 @@ OptionMenu "HUDOptions" protected
Option "$HUDMNU_POISONFLASHES", "pf_poison", "ZDoomHexen" Option "$HUDMNU_POISONFLASHES", "pf_poison", "ZDoomHexen"
Option "$HUDMNU_ICEFLASHES", "pf_ice", "ZDoomHexen" Option "$HUDMNU_ICEFLASHES", "pf_ice", "ZDoomHexen"
Option "$HUDMNU_HAZARDFLASHES", "pf_hazard", "ZDoomStrife" Option "$HUDMNU_HAZARDFLASHES", "pf_hazard", "ZDoomStrife"
StaticText " "
Slider "$DSPLYMNU_MOVEBOB", "movebob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_STILLBOB", "stillbob", 0, 1.0, 0.05, 2
Slider "$DSPLYMNU_BOBSPEED", "wbobspeed", 0, 2.0, 0.1
} }
OptionMenu "ScalingOptions" protected OptionMenu "ScalingOptions" protected
@ -1149,6 +1136,8 @@ OptionMenu "MiscOptions" protected
Option "$MISCMNU_CACHENODES", "gl_cachenodes", "OnOff" Option "$MISCMNU_CACHENODES", "gl_cachenodes", "OnOff"
Slider "$MISCMNU_CACHETIME", "gl_cachetime", 0.0, 2.0, 0.1 Slider "$MISCMNU_CACHETIME", "gl_cachetime", 0.0, 2.0, 0.1
SafeCommand "$MISCMNU_CLEARNODECACHE", "clearnodecache" SafeCommand "$MISCMNU_CLEARNODECACHE", "clearnodecache"
StaticText " "
Option "$OPTMNU_LANGUAGE", "language", "LanguageOptions"
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------

View file

@ -562,6 +562,7 @@ class MorphedMonster : Actor
unmorphed.args[3] = args[3]; unmorphed.args[3] = args[3];
unmorphed.args[4] = args[4]; unmorphed.args[4] = args[4];
unmorphed.CopyFriendliness (self, true); unmorphed.CopyFriendliness (self, true);
unmorphed.bUnmorphed = false;
UnmorphedMe = NULL; UnmorphedMe = NULL;
Substitute(unmorphed); Substitute(unmorphed);
Destroy (); Destroy ();

View file

@ -228,6 +228,7 @@ class LoadSaveMenu : ListMenu
} }
screen.SetClipRect(listboxLeft, listboxTop+rowHeight*i, listboxRight, listboxTop+rowHeight*(i+1)); screen.SetClipRect(listboxLeft, listboxTop+rowHeight*i, listboxRight, listboxTop+rowHeight*(i+1));
int fontoffset = -CleanYFac;
if (j == Selected) if (j == Selected)
{ {
@ -235,19 +236,19 @@ class LoadSaveMenu : ListMenu
didSeeSelected = true; didSeeSelected = true;
if (!mEntering) if (!mEntering)
{ {
screen.DrawText (ConFont, colr, listboxLeft+1, listboxTop+rowHeight*i+CleanYfac, node.SaveTitle, DTA_CleanNoMove, true); screen.DrawText (ConFont, colr, listboxLeft+1, listboxTop+rowHeight*i+CleanYfac + fontoffset, node.SaveTitle, DTA_CleanNoMove, true);
} }
else else
{ {
String s = mInput.GetText() .. ConFont.GetCursor(); String s = mInput.GetText() .. ConFont.GetCursor();
int length = ConFont.StringWidth(s) * CleanXFac; int length = ConFont.StringWidth(s) * CleanXFac;
int displacement = min(0, listboxWidth - 2 - length); int displacement = min(0, listboxWidth - 2 - length);
screen.DrawText (ConFont, Font.CR_WHITE, listboxLeft + 1 + displacement, listboxTop+rowHeight*i+CleanYfac, s, DTA_CleanNoMove, true); screen.DrawText (ConFont, Font.CR_WHITE, listboxLeft + 1 + displacement, listboxTop+rowHeight*i+CleanYfac + fontoffset, s, DTA_CleanNoMove, true);
} }
} }
else else
{ {
screen.DrawText (ConFont, colr, listboxLeft+1, listboxTop+rowHeight*i+CleanYfac, node.SaveTitle, DTA_CleanNoMove, true); screen.DrawText (ConFont, colr, listboxLeft+1, listboxTop+rowHeight*i+CleanYfac + fontoffset, node.SaveTitle, DTA_CleanNoMove, true);
} }
screen.ClearClipRect(); screen.ClearClipRect();
j++; j++;

View file

@ -586,9 +586,9 @@ class PlayerMenu : ListMenu
{ {
Super.Drawer(); Super.Drawer();
String str = Stringtable.Localize("$PLYRMNU_PRESSSPACE"); String str = Stringtable.Localize("$PLYRMNU_PRESSSPACE");
screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70, str, DTA_Clean, true); screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 130, str, DTA_Clean, true);
str = Stringtable.Localize(mRotation ? "$PLYRMNU_SEEFRONT" : "$PLYRMNU_SEEBACK"); str = Stringtable.Localize(mRotation ? "$PLYRMNU_SEEFRONT" : "$PLYRMNU_SEEBACK");
screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 50 + 48 + 70 + SmallFont.GetHeight (), str, DTA_Clean, true); screen.DrawText (SmallFont, Font.CR_GOLD, 320 - 32 - 32 - SmallFont.StringWidth (str)/2, 130 + SmallFont.GetHeight (), str, DTA_Clean, true);
} }

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