- exported all Hexen map names and intermission texts to the language table.

As IWAD content this is in zd_extra.pk3.
This commit is contained in:
Christoph Oelckers 2019-02-11 01:33:09 +01:00
commit e4690b4cd8
4 changed files with 320 additions and 15 deletions

View file

@ -827,6 +827,28 @@ void FMapInfoParser::ParseCluster()
break;
}
}
// Remap Hexen's CLUS?MSG lumps to the string table, if applicable. The code here only checks what can actually be in an IWAD.
if (clusterinfo->flags & CLUSTER_EXITTEXTINLUMP)
{
int lump = Wads.CheckNumForFullName(clusterinfo->ExitText, false);
if (lump > 0)
{
// Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table.
int fileno = Wads.GetLumpFile(lump);
auto fn = Wads.GetWadName(fileno);
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
{
FStringf key("TXT_%.5s_%s", fn, sc.String);
if (GStrings.exists(key))
{
clusterinfo->ExitText = key;
clusterinfo->flags &= ~CLUSTER_EXITTEXTINLUMP;
clusterinfo->flags |= CLUSTER_LOOKUPEXITTEXT;
}
}
}
}
CheckEndOfFile("cluster");
}
@ -1900,8 +1922,25 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
{
sc.MustGetString ();
levelinfo->flags |= LEVEL_LOOKUPLEVELNAME;
levelinfo->LevelName = sc.String;
}
else if (HexenHack)
{
levelinfo->LevelName = sc.String;
// Try to localize Hexen's map names.
int fileno = Wads.GetLumpFile(sc.LumpNum);
auto fn = Wads.GetWadName(fileno);
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
{
FStringf key("TXT_%.5s_%s", fn, levelinfo->MapName.GetChars());
if (GStrings.exists(key))
{
levelinfo->flags |= LEVEL_LOOKUPLEVELNAME;
levelinfo->LevelName = key;
}
}
}
levelinfo->LevelName = sc.String;
}
// Set up levelnum now so that you can use Teleport_NewMap specials

View file

@ -427,15 +427,18 @@ struct cluster_info_t
};
// Cluster flags
#define CLUSTER_HUB 0x00000001 // Cluster uses hub behavior
#define CLUSTER_EXITTEXTINLUMP 0x00000002 // Exit text is the name of a lump
#define CLUSTER_ENTERTEXTINLUMP 0x00000004 // Enter text is the name of a lump
#define CLUSTER_FINALEPIC 0x00000008 // Finale "flat" is actually a full-sized image
#define CLUSTER_LOOKUPEXITTEXT 0x00000010 // Exit text is the name of a language string
#define CLUSTER_LOOKUPENTERTEXT 0x00000020 // Enter text is the name of a language string
#define CLUSTER_LOOKUPNAME 0x00000040 // Name is the name of a language string
#define CLUSTER_LOOKUPCLUSTERNAME 0x00000080 // Cluster name is the name of a language string
#define CLUSTER_ALLOWINTERMISSION 0x00000100 // Allow intermissions between levels in a hub.
enum
{
CLUSTER_HUB = 0x00000001, // Cluster uses hub behavior
CLUSTER_EXITTEXTINLUMP = 0x00000002, // Exit text is the name of a lump
CLUSTER_ENTERTEXTINLUMP = 0x00000004, // Enter text is the name of a lump
CLUSTER_FINALEPIC = 0x00000008, // Finale "flat" is actually a full-sized image
CLUSTER_LOOKUPEXITTEXT = 0x00000010, // Exit text is the name of a language string
CLUSTER_LOOKUPENTERTEXT = 0x00000020, // Enter text is the name of a language string
CLUSTER_LOOKUPNAME = 0x00000040, // Name is the name of a language string
CLUSTER_LOOKUPCLUSTERNAME = 0x00000080, // Cluster name is the name of a language string
CLUSTER_ALLOWINTERMISSION = 0x00000100 // Allow intermissions between levels in a hub.
};
extern TArray<level_info_t> wadlevelinfos;

View file

@ -37,6 +37,7 @@
#include "intermission/intermission.h"
#include "g_level.h"
#include "w_wad.h"
#include "gstrings.h"
static void ReplaceIntermission(FName intname,FIntermissionDescriptor *desc)
@ -291,9 +292,23 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc)
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
int lump = Wads.CheckNumForFullName(sc.String, true);
bool done = false;
if (lump > 0)
{
mText = Wads.ReadLump(lump).GetString();
// Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table.
int fileno = Wads.GetLumpFile(lump);
auto fn = Wads.GetWadName(fileno);
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
{
FStringf key("TXT_%.5s_%s", fn, sc.String);
if (GStrings.exists(key))
{
mText = "$" + key;
done = true;
}
}
if (!done)
mText = Wads.ReadLump(lump).GetString();
}
else
{