- 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. 
- Added a missing NULL pointer check to S_Start.


SVN r884 (trunk)
This commit is contained in:
Christoph Oelckers 2008-04-05 16:45:39 +00:00
parent fd21005391
commit eff5a4dad9
5 changed files with 51 additions and 10 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -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:

View file

@ -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;

View file

@ -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