- more MAPINFO fixes:

* moved inlined parsing functions out of g_level.h into g_mapinfo.cpp.
  * made music parsing a subfunction because this code got repeated multiple times.
  * renamed some function
  * removed unused functions
  * fixed HexenHack handling. There was still a local variable involved that prevented access to the global one.
  * parsing of teaser keyword in episodes did not work.
  * fixed sky scroll speed values

The current code processes all old MAPINFOs I tested it with properly and did the same for
one I changed to the new format.


SVN r1389 (newmapinfo)
This commit is contained in:
Christoph Oelckers 2009-02-01 12:44:30 +00:00
parent 164901f8db
commit f0d89f71d0
4 changed files with 253 additions and 281 deletions

View file

@ -858,7 +858,7 @@ CCMD(nextmap)
if (next != NULL && strncmp(next, "enDSeQ", 6)) if (next != NULL && strncmp(next, "enDSeQ", 6))
{ {
G_InitNew(next, false); G_DeferedInitNew(next, false);
} }
else else
{ {
@ -879,7 +879,7 @@ CCMD(nextsecret)
if (next != NULL && strncmp(next, "enDSeQ", 6)) if (next != NULL && strncmp(next, "enDSeQ", 6))
{ {
G_InitNew(next, false); G_DeferedInitNew(next, false);
} }
else else
{ {

View file

@ -75,113 +75,26 @@ struct FMapInfoParser
} }
bool ParseLookupName(FString &dest); bool ParseLookupName(FString &dest);
void ParseMusic(FString &name, int &order);
void ParseLumpOrTextureName(char *name);
void ParseCluster(); void ParseCluster();
void ParseNextMap(char *mapname); void ParseNextMap(char *mapname);
void ParseLumpOrTextureName(char *name);
level_info_t *ParseMapHeader(level_info_t &defaultinfo); level_info_t *ParseMapHeader(level_info_t &defaultinfo);
void ParseMapDefinition(level_info_t &leveldef); void ParseMapDefinition(level_info_t &leveldef);
void ParseEpisodeInfo (); void ParseEpisodeInfo ();
void ParseSkill (); void ParseSkill ();
void ParseMapInfo (int lump, level_info_t &gamedefaults); void ParseMapInfo (int lump, level_info_t &gamedefaults);
void ParseOpenBrace() void ParseOpenBrace();
{ bool ParseCloseBrace();
switch(format_type) bool CheckAssign();
{ void ParseAssign();
default: void MustParseAssign();
format_type = sc.CheckString("{")? FMT_New : FMT_Old; void ParseComma();
if (format_type == FMT_New) sc.SetCMode(true); bool CheckNumber();
break; bool CheckFloat();
void SkipToNext();
case FMT_Old:
break;
case FMT_New:
sc.MustGetStringName("{");
sc.SetCMode(true);
break;
}
}
bool ParseCloseBrace()
{
if (format_type == FMT_New)
{
return sc.Compare("}");
}
else
{
// We have to assume that the next keyword
// starts a new top level block
sc.UnGet();
return true;
}
}
bool CheckOpenParen()
{
if (format_type == FMT_New) return sc.CheckString("=");
else return false; // force explicit handling
}
void ParseOpenParen()
{
if (format_type == FMT_New) sc.MustGetStringName("=");
}
void MustParseOpenParen()
{
if (format_type == FMT_New) sc.MustGetStringName("=");
else sc.ScriptError(NULL);
}
void ParseCloseParen()
{
//if (format_type == FMT_New) sc.MustGetStringName(")");
}
void ParseComma()
{
if (format_type == FMT_New) sc.MustGetStringName(",");
}
bool CheckNumber()
{
if (format_type == FMT_New)
{
if (sc.CheckString(","))
{
sc.MustGetNumber();
return true;
}
return false;
}
else return sc.CheckNumber();
}
bool CheckFloat()
{
if (format_type == FMT_New)
{
if (sc.CheckString(","))
{
sc.MustGetFloat();
return true;
}
return false;
}
else return sc.CheckFloat();
}
// skips an entire parameter list that's enclosed in parentheses.
void SkipToNext()
{
if (sc.CheckString("("))
{
while (!sc.CheckString(")"));
sc.MustGetStringName("(");
}
}
}; };
#define DEFINE_MAP_OPTION(name, old) \ #define DEFINE_MAP_OPTION(name, old) \

View file

@ -189,6 +189,150 @@ void cluster_info_t::Reset()
} }
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::ParseOpenBrace()
{
switch(format_type)
{
default:
format_type = sc.CheckString("{")? FMT_New : FMT_Old;
if (format_type == FMT_New)
sc.SetCMode(true);
break;
case FMT_Old:
break;
case FMT_New:
sc.MustGetStringName("{");
sc.SetCMode(true);
break;
}
}
//==========================================================================
//
//
//==========================================================================
bool FMapInfoParser::ParseCloseBrace()
{
if (format_type == FMT_New)
{
return sc.Compare("}");
}
else
{
// We have to assume that the next keyword
// starts a new top level block
sc.UnGet();
return true;
}
}
//==========================================================================
//
//
//==========================================================================
bool FMapInfoParser::CheckAssign()
{
if (format_type == FMT_New) return sc.CheckString("=");
else return false; // force explicit handling
}
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::ParseAssign()
{
if (format_type == FMT_New) sc.MustGetStringName("=");
}
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::MustParseAssign()
{
if (format_type == FMT_New) sc.MustGetStringName("=");
else sc.ScriptError(NULL);
}
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::ParseComma()
{
if (format_type == FMT_New) sc.MustGetStringName(",");
}
//==========================================================================
//
//
//==========================================================================
bool FMapInfoParser::CheckNumber()
{
if (format_type == FMT_New)
{
if (sc.CheckString(","))
{
sc.MustGetNumber();
return true;
}
return false;
}
else return sc.CheckNumber();
}
//==========================================================================
//
//
//==========================================================================
bool FMapInfoParser::CheckFloat()
{
if (format_type == FMT_New)
{
if (sc.CheckString(","))
{
sc.MustGetFloat();
return true;
}
return false;
}
else return sc.CheckFloat();
}
//==========================================================================
//
// skips an entire parameter list that's separated by commas
//
//==========================================================================
void FMapInfoParser::SkipToNext()
{
if (sc.CheckString("="))
{
do
{
sc.MustGetString();
}
while (sc.CheckString(","));
}
}
//========================================================================== //==========================================================================
// //
// ParseLookupnamr // ParseLookupnamr
@ -243,6 +387,29 @@ void FMapInfoParser::ParseLumpOrTextureName(char *name)
} }
//==========================================================================
//
//
//==========================================================================
void FMapInfoParser::ParseMusic(FString &name, int &order)
{
sc.MustGetString();
order = 0;
char *colon = strchr (sc.String, ':');
if (colon)
{
order = atoi(colon+1);
*colon = 0;
}
name = sc.String;
if (!colon && CheckNumber())
{
order = sc.Number;
}
}
//========================================================================== //==========================================================================
// //
// ParseCluster // ParseCluster
@ -269,58 +436,39 @@ void FMapInfoParser::ParseCluster()
{ {
if (sc.Compare("name")) if (sc.Compare("name"))
{ {
ParseOpenParen(); ParseAssign();
if (ParseLookupName(clusterinfo->ClusterName)) if (ParseLookupName(clusterinfo->ClusterName))
clusterinfo->flags |= CLUSTER_LOOKUPCLUSTERNAME; clusterinfo->flags |= CLUSTER_LOOKUPCLUSTERNAME;
ParseCloseParen();
} }
else if (sc.Compare("entertext")) else if (sc.Compare("entertext"))
{ {
ParseOpenParen(); ParseAssign();
if (ParseLookupName(clusterinfo->EnterText)) if (ParseLookupName(clusterinfo->EnterText))
clusterinfo->flags |= CLUSTER_LOOKUPENTERTEXT; clusterinfo->flags |= CLUSTER_LOOKUPENTERTEXT;
ParseCloseParen();
} }
else if (sc.Compare("exittext")) else if (sc.Compare("exittext"))
{ {
ParseOpenParen(); ParseAssign();
if (ParseLookupName(clusterinfo->ExitText)) if (ParseLookupName(clusterinfo->ExitText))
clusterinfo->flags |= CLUSTER_LOOKUPEXITTEXT; clusterinfo->flags |= CLUSTER_LOOKUPEXITTEXT;
ParseCloseParen();
} }
else if (sc.Compare("music")) else if (sc.Compare("music"))
{ {
int order = 0; int order = 0;
ParseOpenParen(); ParseAssign();
sc.MustGetString(); ParseMusic(clusterinfo->MessageMusic, clusterinfo->musicorder);
char *colon = strchr (sc.String, ':');
if (colon)
{
order = atoi(colon+1);
*colon = 0;
}
clusterinfo->MessageMusic = sc.String;
if (!colon && CheckNumber())
{
order = sc.Number;
}
clusterinfo->musicorder = order;
ParseCloseParen();
} }
else if (sc.Compare("flat")) else if (sc.Compare("flat"))
{ {
ParseOpenParen(); ParseAssign();
ParseLumpOrTextureName(clusterinfo->finaleflat); ParseLumpOrTextureName(clusterinfo->finaleflat);
ParseCloseParen();
} }
else if (sc.Compare("pic")) else if (sc.Compare("pic"))
{ {
ParseOpenParen(); ParseAssign();
ParseLumpOrTextureName(clusterinfo->finaleflat); ParseLumpOrTextureName(clusterinfo->finaleflat);
clusterinfo->flags |= CLUSTER_FINALEPIC; clusterinfo->flags |= CLUSTER_FINALEPIC;
ParseCloseParen();
} }
else if (sc.Compare("hub")) else if (sc.Compare("hub"))
{ {
@ -328,17 +476,15 @@ void FMapInfoParser::ParseCluster()
} }
else if (sc.Compare("cdtrack")) else if (sc.Compare("cdtrack"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetNumber(); sc.MustGetNumber();
clusterinfo->cdtrack = sc.Number; clusterinfo->cdtrack = sc.Number;
ParseCloseParen();
} }
else if (sc.Compare("cdid")) else if (sc.Compare("cdid"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
clusterinfo->cdid = strtoul (sc.String, NULL, 16); clusterinfo->cdid = strtoul (sc.String, NULL, 16);
ParseCloseParen();
} }
else if (sc.Compare("entertextislump")) else if (sc.Compare("entertextislump"))
{ {
@ -401,15 +547,14 @@ void FMapInfoParser::ParseNextMap(char *mapname)
sc.MustGetString(); sc.MustGetString();
if (sc.Compare("pic")) if (sc.Compare("pic"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
newSeq.EndType = END_Pic; newSeq.EndType = END_Pic;
newSeq.PicName = sc.String; newSeq.PicName = sc.String;
ParseCloseParen();
} }
else if (sc.Compare("hscroll")) else if (sc.Compare("hscroll"))
{ {
ParseOpenParen(); ParseAssign();
newSeq.EndType = END_Bunny; newSeq.EndType = END_Bunny;
sc.MustGetString(); sc.MustGetString();
newSeq.PicName = sc.String; newSeq.PicName = sc.String;
@ -418,18 +563,16 @@ void FMapInfoParser::ParseNextMap(char *mapname)
newSeq.PicName2 = sc.String; newSeq.PicName2 = sc.String;
if (CheckNumber()) if (CheckNumber())
newSeq.PlayTheEnd = !!sc.Number; newSeq.PlayTheEnd = !!sc.Number;
ParseCloseParen();
} }
else if (sc.Compare("vscroll")) else if (sc.Compare("vscroll"))
{ {
ParseOpenParen(); ParseAssign();
newSeq.EndType = END_Demon; newSeq.EndType = END_Demon;
sc.MustGetString(); sc.MustGetString();
newSeq.PicName = sc.String; newSeq.PicName = sc.String;
ParseComma(); ParseComma();
sc.MustGetString(); sc.MustGetString();
newSeq.PicName2 = sc.String; newSeq.PicName2 = sc.String;
ParseCloseParen();
} }
else if (sc.Compare("cast")) else if (sc.Compare("cast"))
{ {
@ -437,14 +580,13 @@ void FMapInfoParser::ParseNextMap(char *mapname)
} }
else if (sc.Compare("music")) else if (sc.Compare("music"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
newSeq.Music = sc.String; newSeq.Music = sc.String;
if (CheckNumber()) if (CheckNumber())
{ {
newSeq.MusicLooping = !!sc.Number; newSeq.MusicLooping = !!sc.Number;
} }
ParseCloseParen();
} }
else else
{ {
@ -548,29 +690,26 @@ void FMapInfoParser::ParseNextMap(char *mapname)
DEFINE_MAP_OPTION(levelnum, true) DEFINE_MAP_OPTION(levelnum, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->levelnum = parse.sc.Number; info->levelnum = parse.sc.Number;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(next, true) DEFINE_MAP_OPTION(next, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseNextMap(info->nextmap); parse.ParseNextMap(info->nextmap);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(secretnext, true) DEFINE_MAP_OPTION(secretnext, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseNextMap(info->secretmap); parse.ParseNextMap(info->secretmap);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(cluster, true) DEFINE_MAP_OPTION(cluster, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->cluster = parse.sc.Number; info->cluster = parse.sc.Number;
@ -588,13 +727,11 @@ DEFINE_MAP_OPTION(cluster, true)
clusterinfo->flags |= CLUSTER_HUB; clusterinfo->flags |= CLUSTER_HUB;
} }
} }
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(sky1, true) DEFINE_MAP_OPTION(sky1, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseLumpOrTextureName(info->skypic1); parse.ParseLumpOrTextureName(info->skypic1);
if (parse.CheckFloat()) if (parse.CheckFloat())
{ {
@ -602,14 +739,13 @@ DEFINE_MAP_OPTION(sky1, true)
{ {
parse.sc.Float /= 256; parse.sc.Float /= 256;
} }
info->skyspeed1 = parse.sc.Float; info->skyspeed1 = parse.sc.Float * (35.f / 1000.f);
} }
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(sky2, true) DEFINE_MAP_OPTION(sky2, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseLumpOrTextureName(info->skypic2); parse.ParseLumpOrTextureName(info->skypic2);
if (parse.CheckFloat()) if (parse.CheckFloat())
{ {
@ -617,105 +753,69 @@ DEFINE_MAP_OPTION(sky2, true)
{ {
parse.sc.Float /= 256; parse.sc.Float /= 256;
} }
info->skyspeed2 = parse.sc.Float; info->skyspeed2 = parse.sc.Float * (35.f / 1000.f);
} }
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(fade, true) DEFINE_MAP_OPTION(fade, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->fadeto = V_GetColor(NULL, parse.sc.String); info->fadeto = V_GetColor(NULL, parse.sc.String);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(outsidefog, true) DEFINE_MAP_OPTION(outsidefog, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->outsidefog = V_GetColor(NULL, parse.sc.String); info->outsidefog = V_GetColor(NULL, parse.sc.String);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(titlepatch, true) DEFINE_MAP_OPTION(titlepatch, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseLumpOrTextureName(info->pname); parse.ParseLumpOrTextureName(info->pname);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(partime, true) DEFINE_MAP_OPTION(partime, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->partime = parse.sc.Number; info->partime = parse.sc.Number;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(par, true) DEFINE_MAP_OPTION(par, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->partime = parse.sc.Number; info->partime = parse.sc.Number;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(sucktime, true) DEFINE_MAP_OPTION(sucktime, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->sucktime = parse.sc.Number; info->sucktime = parse.sc.Number;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(music, true) DEFINE_MAP_OPTION(music, true)
{ {
int order = 0; parse.ParseAssign();
parse.ParseOpenParen(); parse.ParseMusic(info->Music, info->musicorder);
parse.sc.MustGetString ();
char *colon = strchr (parse.sc.String, ':');
if (colon)
{
order = atoi(colon+1);
*colon = 0;
}
info->Music = parse.sc.String;
if (!colon && parse.CheckNumber())
{
order = parse.sc.Number;
}
info->musicorder = order;
// Flag the level so that the $MAP command doesn't override this. // Flag the level so that the $MAP command doesn't override this.
info->flags2 |= LEVEL2_MUSICDEFINED; info->flags2 |= LEVEL2_MUSICDEFINED;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(intermusic, true) DEFINE_MAP_OPTION(intermusic, true)
{ {
int order = 0; parse.ParseAssign();
parse.ParseOpenParen(); parse.ParseMusic(info->InterMusic, info->intermusicorder);
parse.sc.MustGetString ();
char *colon = strchr (parse.sc.String, ':');
if (colon)
{
order = atoi(colon+1);
*colon = 0;
}
info->InterMusic = parse.sc.String;
if (!colon && parse.CheckNumber())
{
order = parse.sc.Number;
}
info->intermusicorder = order;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(fadetable, true) DEFINE_MAP_OPTION(fadetable, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseLumpOrTextureName(info->fadetable); parse.ParseLumpOrTextureName(info->fadetable);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(evenlighting, true) DEFINE_MAP_OPTION(evenlighting, true)
@ -725,95 +825,84 @@ DEFINE_MAP_OPTION(evenlighting, true)
DEFINE_MAP_OPTION(cdtrack, true) DEFINE_MAP_OPTION(cdtrack, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->cdtrack = parse.sc.Number; info->cdtrack = parse.sc.Number;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(cdid, true) DEFINE_MAP_OPTION(cdid, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->cdid = strtoul (parse.sc.String, NULL, 16); info->cdid = strtoul (parse.sc.String, NULL, 16);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(warptrans, true) DEFINE_MAP_OPTION(warptrans, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->WarpTrans = parse.sc.Number; info->WarpTrans = parse.sc.Number;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(vertwallshade, true) DEFINE_MAP_OPTION(vertwallshade, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->WallVertLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127); info->WallVertLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(horizwallshade, true) DEFINE_MAP_OPTION(horizwallshade, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->WallHorizLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127); info->WallHorizLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(gravity, true) DEFINE_MAP_OPTION(gravity, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetFloat(); parse.sc.MustGetFloat();
info->gravity = parse.sc.Float; info->gravity = parse.sc.Float;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(aircontrol, true) DEFINE_MAP_OPTION(aircontrol, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetFloat(); parse.sc.MustGetFloat();
info->aircontrol = parse.sc.Float; info->aircontrol = parse.sc.Float;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(airsupply, true) DEFINE_MAP_OPTION(airsupply, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetNumber(); parse.sc.MustGetNumber();
info->airsupply = parse.sc.Number; info->airsupply = parse.sc.Number;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(interpic, true) DEFINE_MAP_OPTION(interpic, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->ExitPic = parse.sc.String; info->ExitPic = parse.sc.String;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(exitpic, true) DEFINE_MAP_OPTION(exitpic, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->ExitPic = parse.sc.String; info->ExitPic = parse.sc.String;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(enterpic, true) DEFINE_MAP_OPTION(enterpic, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->EnterPic = parse.sc.String; info->EnterPic = parse.sc.String;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(specialaction, true) DEFINE_MAP_OPTION(specialaction, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
FSpecialAction *sa = &info->specialactions[info->specialactions.Reserve(1)]; FSpecialAction *sa = &info->specialactions[info->specialactions.Reserve(1)];
int min_arg, max_arg; int min_arg, max_arg;
@ -834,71 +923,62 @@ DEFINE_MAP_OPTION(specialaction, true)
sa->Args[j++] = parse.sc.Number; sa->Args[j++] = parse.sc.Number;
} }
if (parse.format_type == parse.FMT_Old) parse.sc.SetCMode(false); if (parse.format_type == parse.FMT_Old) parse.sc.SetCMode(false);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(redirect, true) DEFINE_MAP_OPTION(redirect, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->RedirectType = parse.sc.String; info->RedirectType = parse.sc.String;
parse.ParseComma(); parse.ParseComma();
parse.ParseLumpOrTextureName(info->RedirectMap); parse.ParseLumpOrTextureName(info->RedirectMap);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(sndseq, true) DEFINE_MAP_OPTION(sndseq, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->SndSeq = parse.sc.String; info->SndSeq = parse.sc.String;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(sndinfo, true) DEFINE_MAP_OPTION(sndinfo, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->SoundInfo = parse.sc.String; info->SoundInfo = parse.sc.String;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(soundinfo, true) DEFINE_MAP_OPTION(soundinfo, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->SoundInfo = parse.sc.String; info->SoundInfo = parse.sc.String;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(translator, true) DEFINE_MAP_OPTION(translator, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetString(); parse.sc.MustGetString();
info->Translator = parse.sc.String; info->Translator = parse.sc.String;
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(bordertexture, true) DEFINE_MAP_OPTION(bordertexture, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseLumpOrTextureName(info->bordertexture); parse.ParseLumpOrTextureName(info->bordertexture);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(f1, true) DEFINE_MAP_OPTION(f1, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.ParseLumpOrTextureName(info->f1); parse.ParseLumpOrTextureName(info->f1);
parse.ParseCloseParen();
} }
DEFINE_MAP_OPTION(teamdamage, true) DEFINE_MAP_OPTION(teamdamage, true)
{ {
parse.ParseOpenParen(); parse.ParseAssign();
parse.sc.MustGetFloat(); parse.sc.MustGetFloat();
info->teamdamage = parse.sc.Float; info->teamdamage = parse.sc.Float;
parse.ParseCloseParen();
} }
//========================================================================== //==========================================================================
@ -1038,9 +1118,8 @@ void FMapInfoParser::ParseMapDefinition(level_info_t &info)
switch (handler->type) switch (handler->type)
{ {
case MITYPE_EATNEXT: case MITYPE_EATNEXT:
ParseOpenParen(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
ParseCloseParen();
break; break;
case MITYPE_IGNORE: case MITYPE_IGNORE:
@ -1079,7 +1158,7 @@ void FMapInfoParser::ParseMapDefinition(level_info_t &info)
int set = 1; int set = 1;
if (format_type == FMT_New) if (format_type == FMT_New)
{ {
if (CheckOpenParen()) if (CheckAssign())
{ {
sc.MustGetNumber(); sc.MustGetNumber();
set = sc.Number; set = sc.Number;
@ -1173,7 +1252,6 @@ static int GetDefaultLevelNum(const char *mapname)
level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo) level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
{ {
FName mapname; FName mapname;
bool HexenHack = false;
if (sc.CheckNumber()) if (sc.CheckNumber())
{ // MAPNAME is a number; assume a Hexen wad { // MAPNAME is a number; assume a Hexen wad
@ -1277,7 +1355,6 @@ void FMapInfoParser::ParseEpisodeInfo ()
{ {
uppercopy (map, sc.String); uppercopy (map, sc.String);
} }
sc.MustGetString ();
} }
ParseOpenBrace(); ParseOpenBrace();
@ -1296,19 +1373,17 @@ void FMapInfoParser::ParseEpisodeInfo ()
} }
else if (sc.Compare ("name")) else if (sc.Compare ("name"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
ReplaceString (&pic, sc.String); ReplaceString (&pic, sc.String);
picisgfx = false; picisgfx = false;
ParseCloseParen();
} }
else if (sc.Compare ("picname")) else if (sc.Compare ("picname"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
ReplaceString (&pic, sc.String); ReplaceString (&pic, sc.String);
picisgfx = true; picisgfx = true;
ParseCloseParen();
} }
else if (sc.Compare ("remove")) else if (sc.Compare ("remove"))
{ {
@ -1316,10 +1391,9 @@ void FMapInfoParser::ParseEpisodeInfo ()
} }
else if (sc.Compare ("key")) else if (sc.Compare ("key"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
key = sc.String[0]; key = sc.String[0];
ParseCloseParen();
} }
else if (sc.Compare("noskillmenu")) else if (sc.Compare("noskillmenu"))
{ {

View file

@ -80,31 +80,27 @@ void FMapInfoParser::ParseSkill ()
{ {
if (sc.Compare ("ammofactor")) if (sc.Compare ("ammofactor"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetFloat (); sc.MustGetFloat ();
skill.AmmoFactor = FLOAT2FIXED(sc.Float); skill.AmmoFactor = FLOAT2FIXED(sc.Float);
ParseCloseParen();
} }
else if (sc.Compare ("doubleammofactor")) else if (sc.Compare ("doubleammofactor"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetFloat (); sc.MustGetFloat ();
skill.DoubleAmmoFactor = FLOAT2FIXED(sc.Float); skill.DoubleAmmoFactor = FLOAT2FIXED(sc.Float);
ParseCloseParen();
} }
else if (sc.Compare ("dropammofactor")) else if (sc.Compare ("dropammofactor"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetFloat (); sc.MustGetFloat ();
skill.DropAmmoFactor = FLOAT2FIXED(sc.Float); skill.DropAmmoFactor = FLOAT2FIXED(sc.Float);
ParseCloseParen();
} }
else if (sc.Compare ("damagefactor")) else if (sc.Compare ("damagefactor"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetFloat (); sc.MustGetFloat ();
skill.DamageFactor = FLOAT2FIXED(sc.Float); skill.DamageFactor = FLOAT2FIXED(sc.Float);
ParseCloseParen();
} }
else if (sc.Compare ("fastmonsters")) else if (sc.Compare ("fastmonsters"))
{ {
@ -124,28 +120,25 @@ void FMapInfoParser::ParseSkill ()
} }
else if (sc.Compare("respawntime")) else if (sc.Compare("respawntime"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetFloat (); sc.MustGetFloat ();
skill.RespawnCounter = int(sc.Float*TICRATE); skill.RespawnCounter = int(sc.Float*TICRATE);
ParseCloseParen();
} }
else if (sc.Compare("respawnlimit")) else if (sc.Compare("respawnlimit"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetNumber (); sc.MustGetNumber ();
skill.RespawnLimit = sc.Number; skill.RespawnLimit = sc.Number;
ParseCloseParen();
} }
else if (sc.Compare("Aggressiveness")) else if (sc.Compare("Aggressiveness"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetFloat (); sc.MustGetFloat ();
skill.Aggressiveness = FRACUNIT - FLOAT2FIXED(clamp(sc.Float, 0.,1.)); skill.Aggressiveness = FRACUNIT - FLOAT2FIXED(clamp(sc.Float, 0.,1.));
ParseCloseParen();
} }
else if (sc.Compare("SpawnFilter")) else if (sc.Compare("SpawnFilter"))
{ {
ParseOpenParen(); ParseAssign();
if (sc.CheckNumber()) if (sc.CheckNumber())
{ {
if (sc.Number > 0) skill.SpawnFilter |= (1<<(sc.Number-1)); if (sc.Number > 0) skill.SpawnFilter |= (1<<(sc.Number-1));
@ -159,64 +152,56 @@ void FMapInfoParser::ParseSkill ()
else if (sc.Compare("hard")) skill.SpawnFilter |= 8; else if (sc.Compare("hard")) skill.SpawnFilter |= 8;
else if (sc.Compare("nightmare")) skill.SpawnFilter |= 16; else if (sc.Compare("nightmare")) skill.SpawnFilter |= 16;
} }
ParseCloseParen();
} }
else if (sc.Compare("ACSReturn")) else if (sc.Compare("ACSReturn"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetNumber (); sc.MustGetNumber ();
skill.ACSReturn = sc.Number; skill.ACSReturn = sc.Number;
ParseCloseParen();
} }
else if (sc.Compare("Name")) else if (sc.Compare("Name"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
skill.MenuName = sc.String; skill.MenuName = sc.String;
skill.MenuNameIsLump = false; skill.MenuNameIsLump = false;
ParseCloseParen();
} }
else if (sc.Compare("PlayerClassName")) else if (sc.Compare("PlayerClassName"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
FName pc = sc.String; FName pc = sc.String;
ParseComma(); ParseComma();
sc.MustGetString (); sc.MustGetString ();
skill.MenuNamesForPlayerClass[pc]=sc.String; skill.MenuNamesForPlayerClass[pc]=sc.String;
ParseCloseParen();
} }
else if (sc.Compare("PicName")) else if (sc.Compare("PicName"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString (); sc.MustGetString ();
skill.MenuName = sc.String; skill.MenuName = sc.String;
skill.MenuNameIsLump = true; skill.MenuNameIsLump = true;
ParseCloseParen();
} }
else if (sc.Compare("MustConfirm")) else if (sc.Compare("MustConfirm"))
{ {
ParseOpenParen(); ParseAssign();
skill.MustConfirm = true; skill.MustConfirm = true;
if (sc.CheckToken(TK_StringConst)) if (sc.CheckToken(TK_StringConst))
{ {
skill.MustConfirmText = sc.String; skill.MustConfirmText = sc.String;
} }
ParseCloseParen();
} }
else if (sc.Compare("Key")) else if (sc.Compare("Key"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
skill.Shortcut = tolower(sc.String[0]); skill.Shortcut = tolower(sc.String[0]);
ParseCloseParen();
} }
else if (sc.Compare("TextColor")) else if (sc.Compare("TextColor"))
{ {
ParseOpenParen(); ParseAssign();
sc.MustGetString(); sc.MustGetString();
skill.TextColor.Format("[%s]", sc.String); skill.TextColor.Format("[%s]", sc.String);
ParseCloseParen();
} }
else if (!ParseCloseBrace()) else if (!ParseCloseBrace())
{ {