- allow the language table to supersede the title patches, if appropriate

For the Doom IWADs the provided font looks almost identical to the characters used on the title patches. So, for any level name that got replaced in some language, it will now check if the retrieved name comes from the default table, and if not, ignore the title patch and print the name with the specified font.

This also required removing the 'en' label from the default table,  because with this present, the text would always be picked from 'en' instead of 'default'. Since 'en' and 'default' had the same contents, in any English locale the 'default' table was never hit, so this won't make any difference for the texts being chosen.

Last but not least, wminfo has been made a local variable in G_DoCompleted. There were two places where this was accessed from outside the summary screen or its setup code, and both were incorrect.

# Conflicts:
#	src/g_hub.cpp
#	src/g_level.cpp
#	src/gamedata/g_mapinfo.h
#	src/gi.h
#	src/p_setup.cpp
#	src/stringtable.cpp
#	src/stringtable.h
#	wadsrc/static/zscript/ui/statscreen/statscreen.zs
#	wadsrc_extra/static/iwadinfo.txt

# Conflicts:
#	src/gi.h
#	wadsrc_extra/static/iwadinfo.txt
This commit is contained in:
Christoph Oelckers 2019-02-15 00:29:24 +01:00 committed by drfrag
parent 2172b1bd63
commit 2b51e8d5dd
17 changed files with 71 additions and 31 deletions

View file

@ -166,6 +166,13 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize,
sc.MustGetString();
iwad->BkColor = V_GetColor(NULL, sc);
}
else if (sc.Compare("IgnoreTitlePatches"))
{
sc.MustGetStringName("=");
sc.MustGetNumber();
if (sc.Number) iwad->flags |= GI_IGNORETITLEPATCHES;
else iwad->flags &= ~GI_IGNORETITLEPATCHES;
}
else if (sc.Compare("Load"))
{
sc.MustGetStringName("=");

View file

@ -198,9 +198,7 @@ uint8_t* zdembodyend; // end of ZDEM BODY chunk
bool singledemo; // quit after playing a demo from cmdline
bool precache = true; // if true, load all graphics at start
wbstartstruct_t wminfo; // parms for world map / intermission
short consistancy[MAXPLAYERS][BACKUPTICS];

View file

@ -132,12 +132,13 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
{
if (cluster->flags & CLUSTER_LOOKUPNAME)
{
level.LevelName = GStrings(cluster->ClusterName);
wbs->thisname = GStrings(cluster->ClusterName);
}
else
{
level.LevelName = cluster->ClusterName;
wbs->thisname = cluster->ClusterName;
}
wbs->LName0.SetInvalid(); // The level's own name was just invalidated, and so was its name patch.
}
}
}

View file

@ -89,6 +89,7 @@
#include "dobjgc.h"
#include "i_music.h"
#include "a_dynlight.h"
#include "stringtable.h"
#include "gi.h"
@ -765,12 +766,16 @@ void G_DoCompleted (void)
if (automapactive)
AM_Stop ();
wbstartstruct_t wminfo; // parms for world map / intermission
uint32_t langtable[2] = {};
wminfo.finished_ep = level.cluster - 1;
wminfo.LName0 = TexMan.CheckForTexture(level.info->PName, ETextureType::MiscPatch);
wminfo.thisname = info->LookupLevelName(&langtable[0]); // re-get the name so we have more info about its origin.
wminfo.current = level.MapName;
if (deathmatch &&
(dmflags & DF_SAME_LEVEL) &&
(*dmflags & DF_SAME_LEVEL) &&
!(level.flags & LEVEL_CHANGEMAPCHEAT))
{
wminfo.next = level.MapName;
@ -781,13 +786,37 @@ void G_DoCompleted (void)
level_info_t *nextinfo = FindLevelInfo (nextlevel, false);
if (nextinfo == NULL || strncmp (nextlevel, "enDSeQ", 6) == 0)
{
wminfo.next = nextlevel;
wminfo.next = "";
wminfo.LName1.SetInvalid();
wminfo.nextname = "";
}
else
{
wminfo.next = nextinfo->MapName;
wminfo.LName1 = TexMan.CheckForTexture(nextinfo->PName, ETextureType::MiscPatch);
wminfo.nextname = info->LookupLevelName(&langtable[1]);
}
}
// Ignore the (C)WILVxx lumps from the original Doom IWADs so that the name can be localized properly, if the retrieved text does not come from the default table.
// This is only active for those IWADS where the style of these graphics matches the provided BIGFONT for the respective game.
if (gameinfo.flags & GI_IGNORETITLEPATCHES)
{
FTextureID *texids[] = { &wminfo.LName0, &wminfo.LName1 };
for (int i = 0; i < 2; i++)
{
if (texids[i]->isValid() && langtable[i] != FStringTable::default_table)
{
FTexture *tex = TexMan.GetTexture(*texids[i]);
if (tex != nullptr)
{
int filenum = Wads.GetLumpFile(tex->GetSourceLump());
if (filenum >= 0 && filenum <= Wads.GetIwadNum())
{
texids[i]->SetInvalid();
}
}
}
}
}
@ -1257,7 +1286,7 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, WorldDone)
void G_DoWorldDone (void)
{
gamestate = GS_LEVEL;
if (wminfo.next[0] == 0)
if (nextlevel.IsEmpty())
{
// Don't crash if no next map is given. Just repeat the current one.
Printf ("No next map specified.\n");

View file

@ -406,7 +406,7 @@ struct level_info_t
}
void Reset();
bool isValid();
FString LookupLevelName ();
FString LookupLevelName (uint32_t *langtable = nullptr);
void ClearDefered()
{
deferred.Clear();

View file

@ -294,14 +294,14 @@ void level_info_t::Reset()
//
//==========================================================================
FString level_info_t::LookupLevelName()
FString level_info_t::LookupLevelName(uint32_t *langtable)
{
// All IWAD names that may be substituted by a graphics patch are declared as language strings.
if (langtable) *langtable = 0;
if (flags & LEVEL_LOOKUPLEVELNAME)
{
const char *thename;
const char *lookedup;
lookedup = GStrings[LevelName];
const char *lookedup = GStrings.GetString(LevelName, langtable);
if (lookedup == NULL)
{
thename = LevelName;

View file

@ -49,6 +49,7 @@ enum
GI_COMPATPOLY1 = 0x00000040, // Hexen's MAP36 needs old polyobject drawing
GI_COMPATPOLY2 = 0x00000080, // so does HEXDD's MAP47
GI_NOTEXTCOLOR = 0x00000100, // Chex Quest 3 would have everything green
GI_IGNORETITLEPATCHES = 0x00000200, // Ignore the map name graphics when not runnning in English language
};
#include "gametype.h"

View file

@ -3144,8 +3144,7 @@ void P_FreeLevelData ()
P_ClearPortals();
tagManager.Clear();
level.total_monsters = level.total_items = level.total_secrets =
level.killed_monsters = level.found_items = level.found_secrets =
wminfo.maxfrags = 0;
level.killed_monsters = level.found_items = level.found_secrets = 0;
if (level.sectors.Size() > 0)
{
@ -3235,7 +3234,6 @@ void P_SetupLevel(const char *lumpname, int position, bool newGame)
}
level.maptype = MAPTYPE_UNKNOWN;
wminfo.partime = 180;
if (!savegamerestore)
{

View file

@ -330,7 +330,7 @@ static FxExpression *StringConstToChar(FxExpression *basex)
int chr = str.GetNextCharacter(position);
// Only succeed if the full string is consumed, i.e. it contains only one code point.
if (position == str.Len())
if (position == (int)str.Len())
{
return new FxConstant(chr, basex->ScriptPosition);
}

View file

@ -75,7 +75,7 @@ public:
allStrings.Insert(dehacked_table, map);
UpdateLanguage();
}
const char *GetLanguageString(const char *name, uint32_t langtable) const;
const char *GetString(const char *name, uint32_t *langtable) const;
const char *operator() (const char *name) const; // Never returns NULL

View file

@ -766,13 +766,7 @@ void WI_Start(wbstartstruct_t *wbstartstruct)
I_FatalError("Cannot create status screen");
}
}
// Set up some global stuff that is always needed.
auto info = FindLevelInfo(wbstartstruct->next, false);
if (info == nullptr)
{
wbstartstruct->next = "";
}
else wbstartstruct->nextname = info->LookupLevelName();
V_SetBlend(0, 0, 0, 0);
S_StopAllChannels();
SN_StopAllSequences();
@ -866,6 +860,7 @@ DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, next_ep);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, current);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, next);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, nextname);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, thisname);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName0);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName1);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxkills);

View file

@ -30,6 +30,7 @@
#include "doomdef.h"
class FTexture;
struct FLevelLocals;
//
// INTERMISSION
@ -54,6 +55,7 @@ struct wbstartstruct_t
FString current; // [RH] Name of map just finished
FString next; // next level, [RH] actual map name
FString nextname; // printable name for next level.
FString thisname; // printable name for next level.
FTextureID LName0;
FTextureID LName1;
@ -78,8 +80,6 @@ struct wbstartstruct_t
// Intermission stats.
// Parameters for world map / intermission.
extern wbstartstruct_t wminfo;
// Called by main loop, animate the intermission.
void WI_Ticker ();

View file

@ -1,6 +1,6 @@
/* U.S. English. (Sorry, it's not English English.) */
[en default]
[default]
SECRETMESSAGE = "A secret is revealed!";

View file

@ -743,8 +743,7 @@ class StatusScreen abstract play version("2.5")
Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch); // "sucks"
Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch); // "par"
// Use the local level structure which can be overridden by hubs
lnametexts[0] = level.LevelName;
lnametexts[0] = wbstartstruct.thisname;
lnametexts[1] = wbstartstruct.nextname;
bg = InterBackground.Create(wbs);

View file

@ -23,6 +23,7 @@ struct WBStartStruct native version("2.4")
native String current; // [RH] Name of map just finished
native String next; // next level, [RH] actual map name
native String nextname; // next level, printable name
native String thisname; // this level, printable name
native TextureID LName0;
native TextureID LName1;

View file

@ -318,6 +318,7 @@ IWad
"DPHOOF","BFGGA0","HEADA1","CYBRA1","SPIDA1D1", "E4M2",
"DMENUPIC", "M_ACPT", "M_CAN", "M_EXITO", "M_CHG"
BannerColors = "54 54 54", "a8 a8 a8"
IgnoreTitlePatches = 1
}
IWad
@ -330,6 +331,7 @@ IWad
Compatibility = "Shorttex"
MustContain = "SMOOSHED", "ANIMDEFS", "LANGUAGE", "MAPINFO", "ENDOOM", "M_DOOM", "TITLEPIC", "TEXTURES"
BannerColors = "a8 00 00", "a8 a8 a8"
IgnoreTitlePatches = 1
}
IWad
@ -345,6 +347,7 @@ IWad
"E3M1","E3M2","E3M3","E3M4","E3M5","E3M6","E3M7","E3M8","E3M9",
"DPHOOF","BFGGA0","HEADA1","CYBRA1","SPIDA1D1", "E4M2"
BannerColors = "54 54 54", "a8 a8 a8"
IgnoreTitlePatches = 1
}
IWad
@ -360,6 +363,7 @@ IWad
"E3M1","E3M2","E3M3","E3M4","E3M5","E3M6","E3M7","E3M8","E3M9",
"DPHOOF","BFGGA0","HEADA1","CYBRA1","SPIDA1D1"
BannerColors = "54 54 54", "a8 a8 a8"
IgnoreTitlePatches = 1
}
IWad
@ -371,6 +375,7 @@ IWad
Compatibility = "Shareware", "Shorttex"
MustContain = "E1M1"
BannerColors = "54 54 54", "a8 a8 a8"
IgnoreTitlePatches = 1
}
IWad
@ -384,6 +389,7 @@ IWad
Compatibility = "Shorttex", "Stairs"
MustContain = "MAP01", "REDTNT2"
BannerColors = "a8 00 00", "a8 a8 a8"
IgnoreTitlePatches = 1
}
IWad
@ -397,6 +403,7 @@ IWad
Compatibility = "Shorttex"
MustContain = "MAP01", "CAMO1"
BannerColors = "a8 00 00", "a8 a8 a8"
IgnoreTitlePatches = 1
}
IWad
@ -412,6 +419,7 @@ IWad
IWADName = "sigil.wad"
Mapinfo = "mapinfo/ultdoom.txt"
Compatibility = "Shorttex"
IgnoreTitlePatches = 1
}
IWad
@ -426,6 +434,7 @@ IWad
MustContain = "MAP01", "DMENUPIC", "M_ACPT", "M_CAN", "M_EXITO", "M_CHG"
BannerColors = "a8 00 00", "a8 a8 a8"
Load = "nerve.wad"
IgnoreTitlePatches = 1
}
IWad
@ -439,6 +448,7 @@ IWad
Compatibility = "Shorttex"
MustContain = "MAP01", "MAP30"
BannerColors = "a8 00 00", "a8 a8 a8"
IgnoreTitlePatches = 1
}
// NRFTL must be last to be checked because MAP01 is its only requirement
@ -454,6 +464,7 @@ IWad
IWADName = "nerve.wad"
Mapinfo = "mapinfo/doom2.txt"
Compatibility = "Shorttex"
IgnoreTitlePatches = 1
}

View file

@ -1,4 +1,4 @@
[en default]
[default]
// Strings from Hexen's IWAD scripts. Technically they are not needed here for English, they are mainly meant to be documentation for translating.