diff --git a/docs/rh-log.txt b/docs/rh-log.txt index d78d0ad0a8..91cf8d9516 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ April 5, 2008 (Changes by Graf Zahl) +- Added the option to use $ as a prefix to a string table name everywhere in + MAPINFO where 'lookup' could be specified so that there is one consistent + way to do it. - Externalized all default episode definitions. Added an 'optional' keyword to handle M4 and 5 in Doom and Heretic. - Added P_CheckMapData function and replaced all calls to P_OpenMapData that diff --git a/src/g_hub.cpp b/src/g_hub.cpp index 65551fdc3f..983fa177e6 100644 --- a/src/g_hub.cpp +++ b/src/g_hub.cpp @@ -41,6 +41,7 @@ #include "gi.h" #include "files.h" #include "m_png.h" +#include "gstrings.h" //========================================================================== @@ -102,7 +103,14 @@ void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs) } if (cluster->clustername) { - strncpy(level.level_name, cluster->clustername, 64); + if (cluster->flags & CLUSTER_LOOKUPNAME) + { + strncpy(level.level_name, GStrings(cluster->clustername), 64); + } + else + { + strncpy(level.level_name, cluster->clustername, 64); + } level.level_name[63]=0; } } diff --git a/src/g_level.cpp b/src/g_level.cpp index 20814db73f..25c6e26c3a 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -493,7 +493,7 @@ MapInfoHandler ClusterHandlers[] = { MITYPE_HEX, cioffset(cdid), 0 }, { MITYPE_SETFLAG, CLUSTER_ENTERTEXTINLUMP, 0 }, { MITYPE_SETFLAG, CLUSTER_EXITTEXTINLUMP, 0 }, - { MITYPE_STRING, cioffset(clustername), 0 }, + { MITYPE_STRING, cioffset(clustername), CLUSTER_LOOKUPNAME }, }; static void ParseMapInfoLower (FScanner &sc, @@ -736,12 +736,21 @@ static void G_DoParseMapInfo (int lump) } uppercopy (levelinfo->mapname, sc.String); sc.MustGetString (); - if (sc.Compare ("lookup")) + if (sc.String[0] == '$') { - sc.MustGetString (); + // For consistency with other definitions allow $Stringtablename here, too. levelflags |= LEVEL_LOOKUPLEVELNAME; + ReplaceString (&levelinfo->level_name, sc.String+1); + } + else + { + if (sc.Compare ("lookup")) + { + sc.MustGetString (); + levelflags |= LEVEL_LOOKUPLEVELNAME; + } + ReplaceString (&levelinfo->level_name, sc.String); } - ReplaceString (&levelinfo->level_name, sc.String); // Set up levelnum now so that you can use Teleport_NewMap specials // to teleport to maps with standard names without needing a levelnum. if (!strnicmp (levelinfo->mapname, "MAP", 3) && levelinfo->mapname[5] == 0) @@ -1025,12 +1034,21 @@ static void ParseMapInfoLower (FScanner &sc, case MITYPE_STRING: sc.MustGetString (); - if (sc.Compare ("lookup")) + if (sc.String[0] == '$') { + // For consistency with other definitions allow $Stringtablename here, too. flags |= handler->data2; - sc.MustGetString (); + ReplaceString ((char **)(info + handler->data1), sc.String+1); + } + else + { + if (sc.Compare ("lookup")) + { + flags |= handler->data2; + sc.MustGetString (); + } + ReplaceString ((char **)(info + handler->data1), sc.String); } - ReplaceString ((char **)(info + handler->data1), sc.String); break; case MITYPE_MUSIC: diff --git a/src/g_level.h b/src/g_level.h index efd1b8a721..3340659aa8 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -306,6 +306,7 @@ typedef struct cluster_info_s cluster_info_t; #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 extern FLevelLocals level; diff --git a/src/s_sound.cpp b/src/s_sound.cpp index f6fa0beee1..055f23716c 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -358,10 +358,21 @@ void S_Start () // Check for local sound definitions. Only reload if they differ // from the previous ones. + char *LocalSndInfo; + char *LocalSndSeq; // To be certain better check whether level is valid! - char *LocalSndInfo = level.info ? level.info->soundinfo : (char*)""; - char *LocalSndSeq = level.info ? level.info->sndseq : (char*)""; + if (level.info && level.info->soundinfo) + { + LocalSndInfo = level.info->soundinfo; + LocalSndSeq = level.info->sndseq; + } + else + { + LocalSndInfo = ""; + LocalSndSeq = ""; + } + bool parse_ss = false; // This level uses a different local SNDINFO