2009-02-03 19:11:43 +00:00
|
|
|
/*
|
|
|
|
** g_level.cpp
|
|
|
|
** Parses MAPINFO
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
** Copyright 1998-2006 Randy Heit
|
|
|
|
** Copyright 2009 Christoph Oelckers
|
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include "templates.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "sc_man.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "p_lnspec.h"
|
|
|
|
#include "p_setup.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "farchive.h"
|
|
|
|
#include "p_acs.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "d_player.h"
|
2009-08-02 03:38:57 +00:00
|
|
|
#include "autosegs.h"
|
2010-07-01 09:35:39 +00:00
|
|
|
#include "version.h"
|
|
|
|
#include "v_text.h"
|
2009-02-03 19:11:43 +00:00
|
|
|
|
|
|
|
TArray<cluster_info_t> wadclusterinfos;
|
|
|
|
TArray<level_info_t> wadlevelinfos;
|
|
|
|
|
|
|
|
level_info_t TheDefaultLevelInfo;
|
|
|
|
static cluster_info_t TheDefaultClusterInfo;
|
|
|
|
|
2010-09-14 17:28:18 +00:00
|
|
|
TArray<FEpisode> AllEpisodes;
|
|
|
|
|
2012-08-28 03:21:13 +00:00
|
|
|
extern TMap<int, FString> HexenMusic;
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
static int FindWadLevelInfo (const char *name)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
2014-05-13 22:52:16 +00:00
|
|
|
{
|
|
|
|
if (!wadlevelinfos[i].MapName.CompareNoCase(name))
|
2009-02-03 19:11:43 +00:00
|
|
|
return i;
|
2014-05-13 22:52:16 +00:00
|
|
|
}
|
2009-02-03 19:11:43 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2013-02-12 23:55:28 +00:00
|
|
|
level_info_t *FindLevelInfo (const char *mapname, bool allowdefault)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ((i = FindWadLevelInfo (mapname)) > -1)
|
2010-01-08 03:40:10 +00:00
|
|
|
{
|
2009-02-03 19:11:43 +00:00
|
|
|
return &wadlevelinfos[i];
|
2010-01-08 03:40:10 +00:00
|
|
|
}
|
2013-02-12 23:55:28 +00:00
|
|
|
else if (allowdefault)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
if (TheDefaultLevelInfo.LevelName.IsEmpty())
|
|
|
|
{
|
2014-05-13 09:33:59 +00:00
|
|
|
TheDefaultLevelInfo.SkyPic2 = TheDefaultLevelInfo.SkyPic1 = "SKY1";
|
2009-02-03 19:11:43 +00:00
|
|
|
TheDefaultLevelInfo.LevelName = "Unnamed";
|
|
|
|
}
|
|
|
|
return &TheDefaultLevelInfo;
|
|
|
|
}
|
2013-02-12 23:55:28 +00:00
|
|
|
return NULL;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
level_info_t *FindLevelByNum (int num)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
|
|
|
if (wadlevelinfos[i].levelnum == num)
|
|
|
|
return &wadlevelinfos[i];
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
static level_info_t *FindLevelByWarpTrans (int num)
|
|
|
|
{
|
|
|
|
for (unsigned i = wadlevelinfos.Size(); i-- != 0; )
|
|
|
|
if (wadlevelinfos[i].WarpTrans == num)
|
|
|
|
return &wadlevelinfos[i];
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool CheckWarpTransMap (FString &mapname, bool substitute)
|
|
|
|
{
|
|
|
|
if (mapname[0] == '&' && (mapname[1] & 0xDF) == 'W' &&
|
|
|
|
(mapname[2] & 0xDF) == 'T' && mapname[3] == '@')
|
|
|
|
{
|
|
|
|
level_info_t *lev = FindLevelByWarpTrans (atoi (&mapname[4]));
|
|
|
|
if (lev != NULL)
|
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
mapname = lev->MapName;
|
2009-02-03 19:11:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (substitute)
|
|
|
|
{
|
|
|
|
char a = mapname[4], b = mapname[5];
|
|
|
|
mapname = "MAP";
|
|
|
|
mapname << a << b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
static int FindWadClusterInfo (int cluster)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < wadclusterinfos.Size(); i++)
|
|
|
|
if (wadclusterinfos[i].cluster == cluster)
|
|
|
|
return i;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
cluster_info_t *FindClusterInfo (int cluster)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ((i = FindWadClusterInfo (cluster)) > -1)
|
|
|
|
return &wadclusterinfos[i];
|
|
|
|
else
|
|
|
|
return &TheDefaultClusterInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void G_ClearSnapshots (void)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
|
|
|
{
|
|
|
|
wadlevelinfos[i].ClearSnapshot();
|
|
|
|
}
|
2013-05-30 02:22:47 +00:00
|
|
|
// Since strings are only locked when snapshotting a level, unlock them
|
|
|
|
// all now, since we got rid of all the snapshots that cared about them.
|
|
|
|
GlobalACSStrings.UnlockAll();
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Remove any existing defereds
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void P_RemoveDefereds (void)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
|
|
|
{
|
|
|
|
wadlevelinfos[i].ClearDefered();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void level_info_t::Reset()
|
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
MapName = "";
|
2014-05-13 09:33:59 +00:00
|
|
|
MapBackground = "";
|
2009-02-03 19:11:43 +00:00
|
|
|
levelnum = 0;
|
2014-05-13 13:32:54 +00:00
|
|
|
PName = "";
|
2014-05-13 22:52:16 +00:00
|
|
|
NextMap = "";
|
|
|
|
NextSecretMap = "";
|
2014-05-13 09:33:59 +00:00
|
|
|
SkyPic1 = SkyPic2 = "-NOFLAT-";
|
2009-02-03 19:11:43 +00:00
|
|
|
cluster = 0;
|
|
|
|
partime = 0;
|
|
|
|
sucktime = 0;
|
|
|
|
flags = 0;
|
2011-02-19 08:59:43 +00:00
|
|
|
if (gameinfo.gametype == GAME_Hexen)
|
|
|
|
flags2 = 0;
|
|
|
|
else
|
|
|
|
flags2 = LEVEL2_LAXMONSTERACTIVATION;
|
2009-02-03 19:11:43 +00:00
|
|
|
Music = "";
|
|
|
|
LevelName = "";
|
2014-05-13 09:33:59 +00:00
|
|
|
FadeTable = "COLORMAP";
|
2009-02-03 19:11:43 +00:00
|
|
|
WallHorizLight = -8;
|
|
|
|
WallVertLight = +8;
|
2014-05-13 09:33:59 +00:00
|
|
|
F1Pic = "";
|
2009-02-03 19:11:43 +00:00
|
|
|
musicorder = 0;
|
|
|
|
snapshot = NULL;
|
|
|
|
snapshotVer = 0;
|
|
|
|
defered = 0;
|
|
|
|
skyspeed1 = skyspeed2 = 0.f;
|
|
|
|
fadeto = 0;
|
|
|
|
outsidefog = 0xff000000;
|
|
|
|
cdtrack = 0;
|
|
|
|
cdid = 0;
|
|
|
|
gravity = 0.f;
|
|
|
|
aircontrol = 0.f;
|
|
|
|
WarpTrans = 0;
|
|
|
|
airsupply = 20;
|
2011-11-01 02:58:52 +00:00
|
|
|
compatflags = compatflags2 = 0;
|
|
|
|
compatmask = compatmask2 = 0;
|
2009-02-03 19:11:43 +00:00
|
|
|
Translator = "";
|
|
|
|
RedirectType = 0;
|
2014-05-13 22:52:16 +00:00
|
|
|
RedirectMapName = "";
|
2009-02-03 19:11:43 +00:00
|
|
|
EnterPic = "";
|
|
|
|
ExitPic = "";
|
|
|
|
InterMusic = "";
|
|
|
|
intermusicorder = 0;
|
|
|
|
SoundInfo = "";
|
|
|
|
SndSeq = "";
|
2014-05-13 09:33:59 +00:00
|
|
|
BorderTexture = "";
|
2009-02-03 19:11:43 +00:00
|
|
|
teamdamage = 0.f;
|
|
|
|
specialactions.Clear();
|
2010-03-31 03:48:16 +00:00
|
|
|
DefaultEnvironment = 0;
|
2012-08-22 22:36:06 +00:00
|
|
|
PrecacheSounds.Clear();
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
FString level_info_t::LookupLevelName()
|
|
|
|
{
|
|
|
|
if (flags & LEVEL_LOOKUPLEVELNAME)
|
|
|
|
{
|
|
|
|
const char *thename;
|
|
|
|
const char *lookedup;
|
|
|
|
|
|
|
|
lookedup = GStrings[LevelName];
|
|
|
|
if (lookedup == NULL)
|
|
|
|
{
|
|
|
|
thename = LevelName;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char checkstring[32];
|
|
|
|
|
|
|
|
// Strip out the header from the localized string
|
2014-05-13 22:52:16 +00:00
|
|
|
if (MapName.Len() > 3 && MapName[0] == 'E' && MapName[2] == 'M')
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2014-05-14 15:27:22 +00:00
|
|
|
mysnprintf (checkstring, countof(checkstring), "%s: ", MapName.GetChars());
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
2014-05-13 22:52:16 +00:00
|
|
|
else if (MapName.Len() > 3 && MapName[0] == 'M' && MapName[1] == 'A' && MapName[2] == 'P')
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[3]));
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
2014-05-13 22:52:16 +00:00
|
|
|
else if (MapName.Len() > 5 && MapName[0] == 'L' && MapName[1] == 'E' && MapName[2] == 'V' && MapName[3] == 'E' && MapName[4] == 'L')
|
2012-11-01 02:42:14 +00:00
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[5]));
|
2012-11-01 02:42:14 +00:00
|
|
|
}
|
2015-05-02 11:46:34 +00:00
|
|
|
else
|
|
|
|
{
|
2015-05-02 12:18:52 +00:00
|
|
|
// make sure nothing is stripped.
|
2015-05-02 11:46:34 +00:00
|
|
|
checkstring[0] = '\0';
|
|
|
|
}
|
2009-02-03 19:11:43 +00:00
|
|
|
thename = strstr (lookedup, checkstring);
|
2015-07-15 07:11:08 +00:00
|
|
|
if (thename == NULL)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
thename = lookedup;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
thename += strlen (checkstring);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return thename;
|
|
|
|
}
|
|
|
|
else return LevelName;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void level_info_t::ClearSnapshot()
|
|
|
|
{
|
|
|
|
if (snapshot != NULL) delete snapshot;
|
|
|
|
snapshot = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void level_info_t::ClearDefered()
|
|
|
|
{
|
|
|
|
acsdefered_t *def = defered;
|
|
|
|
while (def)
|
|
|
|
{
|
|
|
|
acsdefered_t *next = def->next;
|
|
|
|
delete def;
|
|
|
|
def = next;
|
|
|
|
}
|
|
|
|
defered = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
level_info_t *level_info_t::CheckLevelRedirect ()
|
|
|
|
{
|
|
|
|
if (RedirectType != NAME_None)
|
|
|
|
{
|
|
|
|
const PClass *type = PClass::FindClass(RedirectType);
|
|
|
|
if (type != NULL)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].mo->FindInventory (type))
|
|
|
|
{
|
|
|
|
// check for actual presence of the map.
|
2014-05-13 22:52:16 +00:00
|
|
|
if (P_CheckMapData(RedirectMapName))
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
return FindLevelInfo(RedirectMapName);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool level_info_t::isValid()
|
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
return MapName.Len() != 0 || this == &TheDefaultLevelInfo;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void cluster_info_t::Reset()
|
|
|
|
{
|
|
|
|
cluster = 0;
|
2010-03-06 03:28:22 +00:00
|
|
|
FinaleFlat = "";
|
2009-02-03 19:11:43 +00:00
|
|
|
ExitText = "";
|
|
|
|
EnterText = "";
|
|
|
|
MessageMusic = "";
|
|
|
|
musicorder = 0;
|
|
|
|
flags = 0;
|
|
|
|
cdtrack = 0;
|
|
|
|
ClusterName = "";
|
|
|
|
cdid = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FMapInfoParser::ParseOpenBrace()
|
|
|
|
{
|
|
|
|
switch(format_type)
|
|
|
|
{
|
|
|
|
default:
|
2009-02-11 00:16:05 +00:00
|
|
|
format_type = sc.CheckString("{") ? FMT_New : FMT_Old;
|
2009-02-03 19:11:43 +00:00
|
|
|
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(","));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-19 14:36:37 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// checks if the current block was properly terminated
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FMapInfoParser::CheckEndOfFile(const char *block)
|
|
|
|
{
|
|
|
|
if (format_type == FMT_New && !sc.Compare("}"))
|
|
|
|
{
|
|
|
|
sc.ScriptError("Unexpected end of file in %s definition", block);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ParseLookupname
|
|
|
|
// Parses a string that may reference the string table
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool FMapInfoParser::ParseLookupName(FString &dest)
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
if (sc.Compare("lookup"))
|
|
|
|
{
|
|
|
|
ParseComma();
|
|
|
|
sc.MustGetString();
|
|
|
|
dest = sc.String;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (sc.String[0] == '$')
|
|
|
|
{
|
|
|
|
dest = sc.String+1;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (format_type == FMT_Old)
|
|
|
|
{
|
|
|
|
dest = sc.String;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.UnGet();
|
|
|
|
dest = "";
|
|
|
|
do
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
dest << sc.String << '\n';
|
|
|
|
}
|
|
|
|
while (sc.CheckString(","));
|
|
|
|
// strip off the last newline
|
|
|
|
dest.Truncate(long(dest.Len()-1));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2014-05-15 18:29:36 +00:00
|
|
|
/*
|
2009-02-03 19:11:43 +00:00
|
|
|
void FMapInfoParser::ParseLumpOrTextureName(char *name)
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
uppercopy(name, sc.String);
|
|
|
|
name[8]=0;
|
|
|
|
}
|
2014-05-15 18:29:36 +00:00
|
|
|
*/
|
2009-02-03 19:11:43 +00:00
|
|
|
|
2010-03-06 03:28:22 +00:00
|
|
|
void FMapInfoParser::ParseLumpOrTextureName(FString &name)
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
name = sc.String;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
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
|
|
|
|
// Parses a cluster definition
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FMapInfoParser::ParseCluster()
|
|
|
|
{
|
|
|
|
sc.MustGetNumber ();
|
|
|
|
int clusterindex = FindWadClusterInfo (sc.Number);
|
|
|
|
if (clusterindex == -1)
|
|
|
|
{
|
|
|
|
clusterindex = wadclusterinfos.Reserve(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
cluster_info_t *clusterinfo = &wadclusterinfos[clusterindex];
|
|
|
|
clusterinfo->Reset();
|
|
|
|
clusterinfo->cluster = sc.Number;
|
|
|
|
|
|
|
|
ParseOpenBrace();
|
|
|
|
|
|
|
|
while (sc.GetString())
|
|
|
|
{
|
|
|
|
if (sc.Compare("name"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
if (ParseLookupName(clusterinfo->ClusterName))
|
|
|
|
clusterinfo->flags |= CLUSTER_LOOKUPCLUSTERNAME;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("entertext"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
if (ParseLookupName(clusterinfo->EnterText))
|
|
|
|
clusterinfo->flags |= CLUSTER_LOOKUPENTERTEXT;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("exittext"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
if (ParseLookupName(clusterinfo->ExitText))
|
|
|
|
clusterinfo->flags |= CLUSTER_LOOKUPEXITTEXT;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("music"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
ParseMusic(clusterinfo->MessageMusic, clusterinfo->musicorder);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("flat"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
2010-03-06 03:28:22 +00:00
|
|
|
ParseLumpOrTextureName(clusterinfo->FinaleFlat);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
else if (sc.Compare("pic"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
2010-03-06 03:28:22 +00:00
|
|
|
ParseLumpOrTextureName(clusterinfo->FinaleFlat);
|
2009-02-03 19:11:43 +00:00
|
|
|
clusterinfo->flags |= CLUSTER_FINALEPIC;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("hub"))
|
|
|
|
{
|
|
|
|
clusterinfo->flags |= CLUSTER_HUB;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("cdtrack"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
sc.MustGetNumber();
|
|
|
|
clusterinfo->cdtrack = sc.Number;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("cdid"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
sc.MustGetString();
|
|
|
|
clusterinfo->cdid = strtoul (sc.String, NULL, 16);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("entertextislump"))
|
|
|
|
{
|
|
|
|
clusterinfo->flags |= CLUSTER_ENTERTEXTINLUMP;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("exittextislump"))
|
|
|
|
{
|
|
|
|
clusterinfo->flags |= CLUSTER_EXITTEXTINLUMP;
|
|
|
|
}
|
|
|
|
else if (!ParseCloseBrace())
|
|
|
|
{
|
|
|
|
// Unknown
|
|
|
|
sc.ScriptMessage("Unknown property '%s' found in map definition\n", sc.String);
|
|
|
|
SkipToNext();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-02-19 14:36:37 +00:00
|
|
|
CheckEndOfFile("cluster");
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ParseNextMap
|
|
|
|
// Parses a next map field
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2014-05-13 22:52:16 +00:00
|
|
|
void FMapInfoParser::ParseNextMap(FString &mapname)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
if (sc.CheckNumber())
|
|
|
|
{
|
|
|
|
if (HexenHack)
|
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
mapname.Format("&wt@%02d", sc.Number);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
mapname.Format("MAP%02d", sc.Number);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-02 09:14:01 +00:00
|
|
|
sc.MustGetString();
|
2014-05-13 22:52:16 +00:00
|
|
|
mapname = sc.String;
|
2010-10-06 10:44:03 +00:00
|
|
|
FName seq = CheckEndSequence();
|
|
|
|
if (seq != NAME_None)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2014-05-13 22:52:16 +00:00
|
|
|
mapname.Format("enDSeQ%04x", int(seq));
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Map options
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(levelnum, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->levelnum = parse.sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(next, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 22:52:16 +00:00
|
|
|
parse.ParseNextMap(info->NextMap);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(secretnext, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 22:52:16 +00:00
|
|
|
parse.ParseNextMap(info->NextSecretMap);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
2009-09-14 09:41:09 +00:00
|
|
|
DEFINE_MAP_OPTION(secret, true) // Just an alias for secretnext, for Vavoom compatibility
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 22:52:16 +00:00
|
|
|
parse.ParseNextMap(info->NextSecretMap);
|
2009-09-14 09:41:09 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
DEFINE_MAP_OPTION(cluster, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->cluster = parse.sc.Number;
|
|
|
|
|
|
|
|
// If this cluster hasn't been defined yet, add it. This is especially needed
|
|
|
|
// for Hexen, because it doesn't have clusterdefs. If we don't do this, every
|
|
|
|
// level on Hexen will sometimes be considered as being on the same hub,
|
|
|
|
// depending on the check done.
|
|
|
|
if (FindWadClusterInfo (parse.sc.Number) == -1)
|
|
|
|
{
|
|
|
|
unsigned int clusterindex = wadclusterinfos.Reserve(1);
|
|
|
|
cluster_info_t *clusterinfo = &wadclusterinfos[clusterindex];
|
2009-03-25 22:02:15 +00:00
|
|
|
clusterinfo->Reset();
|
2009-02-03 19:11:43 +00:00
|
|
|
clusterinfo->cluster = parse.sc.Number;
|
|
|
|
if (parse.HexenHack)
|
|
|
|
{
|
|
|
|
clusterinfo->flags |= CLUSTER_HUB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(sky1, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 09:33:59 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->SkyPic1);
|
2009-02-03 19:11:43 +00:00
|
|
|
if (parse.CheckFloat())
|
|
|
|
{
|
|
|
|
if (parse.HexenHack)
|
|
|
|
{
|
|
|
|
parse.sc.Float /= 256;
|
|
|
|
}
|
2009-05-15 10:39:40 +00:00
|
|
|
info->skyspeed1 = float(parse.sc.Float * (35. / 1000.));
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(sky2, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 09:33:59 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->SkyPic2);
|
2009-02-03 19:11:43 +00:00
|
|
|
if (parse.CheckFloat())
|
|
|
|
{
|
|
|
|
if (parse.HexenHack)
|
|
|
|
{
|
|
|
|
parse.sc.Float /= 256;
|
|
|
|
}
|
2009-05-15 10:39:40 +00:00
|
|
|
info->skyspeed2 = float(parse.sc.Float * (35. / 1000.));
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-14 09:41:09 +00:00
|
|
|
// Vavoom compatibility
|
|
|
|
DEFINE_MAP_OPTION(skybox, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 09:33:59 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->SkyPic1);
|
2009-09-14 09:41:09 +00:00
|
|
|
info->skyspeed1 = 0;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
DEFINE_MAP_OPTION(fade, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->fadeto = V_GetColor(NULL, parse.sc.String);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(outsidefog, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->outsidefog = V_GetColor(NULL, parse.sc.String);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(titlepatch, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 13:32:54 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->PName);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(partime, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->partime = parse.sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(par, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->partime = parse.sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(sucktime, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->sucktime = parse.sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(music, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.ParseMusic(info->Music, info->musicorder);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(intermusic, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.ParseMusic(info->InterMusic, info->intermusicorder);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(fadetable, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 09:33:59 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->FadeTable);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(evenlighting, true)
|
|
|
|
{
|
|
|
|
info->WallVertLight = info->WallHorizLight = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(cdtrack, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->cdtrack = parse.sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(cdid, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->cdid = strtoul (parse.sc.String, NULL, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(warptrans, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->WarpTrans = parse.sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(vertwallshade, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->WallVertLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(horizwallshade, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->WallHorizLight = (SBYTE)clamp (parse.sc.Number / 2, -128, 127);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(gravity, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetFloat();
|
2009-05-15 10:39:40 +00:00
|
|
|
info->gravity = float(parse.sc.Float);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(aircontrol, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetFloat();
|
2009-05-15 10:39:40 +00:00
|
|
|
info->aircontrol = float(parse.sc.Float);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(airsupply, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
info->airsupply = parse.sc.Number;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(interpic, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->ExitPic = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(exitpic, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->ExitPic = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(enterpic, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->EnterPic = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(specialaction, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
|
|
|
|
FSpecialAction *sa = &info->specialactions[info->specialactions.Reserve(1)];
|
|
|
|
int min_arg, max_arg;
|
|
|
|
if (parse.format_type == parse.FMT_Old) parse.sc.SetCMode(true);
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
sa->Type = FName(parse.sc.String);
|
|
|
|
parse.sc.CheckString(",");
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
sa->Action = P_FindLineSpecial(parse.sc.String, &min_arg, &max_arg);
|
|
|
|
if (sa->Action == 0 || min_arg < 0)
|
|
|
|
{
|
2012-08-22 22:36:06 +00:00
|
|
|
parse.sc.ScriptError("Unknown specialaction '%s'", parse.sc.String);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
int j = 0;
|
|
|
|
while (j < 5 && parse.sc.CheckString(","))
|
|
|
|
{
|
|
|
|
parse.sc.MustGetNumber();
|
|
|
|
sa->Args[j++] = parse.sc.Number;
|
|
|
|
}
|
|
|
|
if (parse.format_type == parse.FMT_Old) parse.sc.SetCMode(false);
|
|
|
|
}
|
|
|
|
|
2012-08-22 22:36:06 +00:00
|
|
|
DEFINE_MAP_OPTION(PrecacheSounds, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
FSoundID snd = parse.sc.String;
|
|
|
|
if (snd == 0)
|
|
|
|
{
|
|
|
|
parse.sc.ScriptMessage("Unknown sound \"%s\"", parse.sc.String);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info->PrecacheSounds.Push(snd);
|
|
|
|
}
|
|
|
|
} while (parse.sc.CheckString(","));
|
|
|
|
}
|
|
|
|
|
2015-03-29 11:02:45 +00:00
|
|
|
DEFINE_MAP_OPTION(PrecacheTextures, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
FTextureID tex = TexMan.CheckForTexture(parse.sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_ReturnFirst);
|
|
|
|
if (!tex.isValid())
|
|
|
|
{
|
|
|
|
parse.sc.ScriptMessage("Unknown texture \"%s\"", parse.sc.String);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info->PrecacheTextures.Push(tex);
|
|
|
|
}
|
|
|
|
} while (parse.sc.CheckString(","));
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
DEFINE_MAP_OPTION(redirect, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->RedirectType = parse.sc.String;
|
|
|
|
parse.ParseComma();
|
2014-05-13 22:52:16 +00:00
|
|
|
parse.ParseNextMap(info->RedirectMapName);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(sndseq, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->SndSeq = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(sndinfo, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->SoundInfo = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(soundinfo, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->SoundInfo = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(translator, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->Translator = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
2010-10-06 10:44:03 +00:00
|
|
|
DEFINE_MAP_OPTION(deathsequence, false)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->deathsequence = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(slideshow, false)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
info->slideshow = parse.sc.String;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
DEFINE_MAP_OPTION(bordertexture, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 09:33:59 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->BorderTexture);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(f1, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 09:33:59 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->F1Pic);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_MAP_OPTION(teamdamage, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
|
|
|
parse.sc.MustGetFloat();
|
2009-05-15 10:39:40 +00:00
|
|
|
info->teamdamage = float(parse.sc.Float);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
2009-02-19 14:36:37 +00:00
|
|
|
DEFINE_MAP_OPTION(mapbackground, true)
|
|
|
|
{
|
|
|
|
parse.ParseAssign();
|
2014-05-13 09:33:59 +00:00
|
|
|
parse.ParseLumpOrTextureName(info->MapBackground);
|
2009-02-19 14:36:37 +00:00
|
|
|
}
|
|
|
|
|
2010-03-31 03:48:16 +00:00
|
|
|
DEFINE_MAP_OPTION(defaultenvironment, false)
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
|
|
|
|
parse.ParseAssign();
|
2010-03-31 23:33:18 +00:00
|
|
|
if (parse.sc.CheckNumber())
|
|
|
|
{ // Numeric ID XXX [, YYY]
|
|
|
|
id = parse.sc.Number << 8;
|
|
|
|
if (parse.CheckNumber())
|
|
|
|
{
|
|
|
|
id |= parse.sc.Number;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Named environment
|
|
|
|
parse.sc.MustGetString();
|
|
|
|
ReverbContainer *reverb = S_FindEnvironment(parse.sc.String);
|
|
|
|
if (reverb == NULL)
|
|
|
|
{
|
|
|
|
parse.sc.ScriptMessage("Unknown sound environment '%s'\n", parse.sc.String);
|
|
|
|
id = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
id = reverb->ID;
|
|
|
|
}
|
2010-03-31 03:48:16 +00:00
|
|
|
}
|
|
|
|
info->DefaultEnvironment = id;
|
|
|
|
}
|
|
|
|
|
2009-02-19 14:36:37 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// All flag based map options
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
enum EMIType
|
|
|
|
{
|
|
|
|
MITYPE_IGNORE,
|
|
|
|
MITYPE_EATNEXT,
|
|
|
|
MITYPE_SETFLAG,
|
|
|
|
MITYPE_CLRFLAG,
|
|
|
|
MITYPE_SCFLAGS,
|
|
|
|
MITYPE_SETFLAG2,
|
|
|
|
MITYPE_CLRFLAG2,
|
|
|
|
MITYPE_SCFLAGS2,
|
2014-12-26 12:43:49 +00:00
|
|
|
MITYPE_SETFLAG3,
|
|
|
|
MITYPE_CLRFLAG3,
|
|
|
|
MITYPE_SCFLAGS3,
|
2009-02-03 19:11:43 +00:00
|
|
|
MITYPE_COMPATFLAG,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MapInfoFlagHandler
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
EMIType type;
|
|
|
|
DWORD data1, data2;
|
|
|
|
}
|
|
|
|
MapFlagHandlers[] =
|
|
|
|
{
|
|
|
|
{ "nointermission", MITYPE_SETFLAG, LEVEL_NOINTERMISSION, 0 },
|
|
|
|
{ "intermission", MITYPE_CLRFLAG, LEVEL_NOINTERMISSION, 0 },
|
|
|
|
{ "doublesky", MITYPE_SETFLAG, LEVEL_DOUBLESKY, 0 },
|
|
|
|
{ "nosoundclipping", MITYPE_IGNORE, 0, 0 }, // was nosoundclipping
|
|
|
|
{ "allowmonstertelefrags", MITYPE_SETFLAG, LEVEL_MONSTERSTELEFRAG, 0 },
|
|
|
|
{ "map07special", MITYPE_SETFLAG, LEVEL_MAP07SPECIAL, 0 },
|
|
|
|
{ "baronspecial", MITYPE_SETFLAG, LEVEL_BRUISERSPECIAL, 0 },
|
|
|
|
{ "cyberdemonspecial", MITYPE_SETFLAG, LEVEL_CYBORGSPECIAL, 0 },
|
|
|
|
{ "spidermastermindspecial", MITYPE_SETFLAG, LEVEL_SPIDERSPECIAL, 0 },
|
|
|
|
{ "minotaurspecial", MITYPE_SETFLAG, LEVEL_MINOTAURSPECIAL, 0 },
|
|
|
|
{ "dsparilspecial", MITYPE_SETFLAG, LEVEL_SORCERER2SPECIAL, 0 },
|
|
|
|
{ "ironlichspecial", MITYPE_SETFLAG, LEVEL_HEADSPECIAL, 0 },
|
|
|
|
{ "specialaction_exitlevel", MITYPE_SCFLAGS, 0, ~LEVEL_SPECACTIONSMASK },
|
|
|
|
{ "specialaction_opendoor", MITYPE_SCFLAGS, LEVEL_SPECOPENDOOR, ~LEVEL_SPECACTIONSMASK },
|
|
|
|
{ "specialaction_lowerfloor", MITYPE_SCFLAGS, LEVEL_SPECLOWERFLOOR, ~LEVEL_SPECACTIONSMASK },
|
2010-05-28 21:29:28 +00:00
|
|
|
{ "specialaction_lowerfloortohighest",MITYPE_SCFLAGS,LEVEL_SPECLOWERFLOORTOHIGHEST, ~LEVEL_SPECACTIONSMASK },
|
2009-02-03 19:11:43 +00:00
|
|
|
{ "specialaction_killmonsters", MITYPE_SETFLAG, LEVEL_SPECKILLMONSTERS, 0 },
|
|
|
|
{ "lightning", MITYPE_SETFLAG, LEVEL_STARTLIGHTNING, 0 },
|
|
|
|
{ "smoothlighting", MITYPE_SETFLAG2, LEVEL2_SMOOTHLIGHTING, 0 },
|
|
|
|
{ "noautosequences", MITYPE_SETFLAG, LEVEL_SNDSEQTOTALCTRL, 0 },
|
|
|
|
{ "autosequences", MITYPE_CLRFLAG, LEVEL_SNDSEQTOTALCTRL, 0 },
|
|
|
|
{ "forcenoskystretch", MITYPE_SETFLAG, LEVEL_FORCENOSKYSTRETCH, 0 },
|
|
|
|
{ "skystretch", MITYPE_CLRFLAG, LEVEL_FORCENOSKYSTRETCH, 0 },
|
|
|
|
{ "allowfreelook", MITYPE_SCFLAGS, LEVEL_FREELOOK_YES, ~LEVEL_FREELOOK_NO },
|
|
|
|
{ "nofreelook", MITYPE_SCFLAGS, LEVEL_FREELOOK_NO, ~LEVEL_FREELOOK_YES },
|
|
|
|
{ "allowjump", MITYPE_CLRFLAG, LEVEL_JUMP_NO, 0 },
|
|
|
|
{ "nojump", MITYPE_SETFLAG, LEVEL_JUMP_NO, 0 },
|
|
|
|
{ "fallingdamage", MITYPE_SCFLAGS, LEVEL_FALLDMG_HX, ~LEVEL_FALLDMG_ZD },
|
|
|
|
{ "oldfallingdamage", MITYPE_SCFLAGS, LEVEL_FALLDMG_ZD, ~LEVEL_FALLDMG_HX },
|
|
|
|
{ "forcefallingdamage", MITYPE_SCFLAGS, LEVEL_FALLDMG_ZD, ~LEVEL_FALLDMG_HX },
|
|
|
|
{ "strifefallingdamage", MITYPE_SETFLAG, LEVEL_FALLDMG_ZD|LEVEL_FALLDMG_HX, 0 },
|
|
|
|
{ "nofallingdamage", MITYPE_SCFLAGS, 0, ~(LEVEL_FALLDMG_ZD|LEVEL_FALLDMG_HX) },
|
|
|
|
{ "noallies", MITYPE_SETFLAG, LEVEL_NOALLIES, 0 },
|
|
|
|
{ "filterstarts", MITYPE_SETFLAG, LEVEL_FILTERSTARTS, 0 },
|
2012-07-07 03:18:09 +00:00
|
|
|
{ "useplayerstartz", MITYPE_SETFLAG, LEVEL_USEPLAYERSTARTZ, 0 },
|
2012-07-08 01:43:47 +00:00
|
|
|
{ "randomplayerstarts", MITYPE_SETFLAG2, LEVEL2_RANDOMPLAYERSTARTS, 0 },
|
2009-02-03 19:11:43 +00:00
|
|
|
{ "activateowndeathspecials", MITYPE_SETFLAG, LEVEL_ACTOWNSPECIAL, 0 },
|
|
|
|
{ "killeractivatesdeathspecials", MITYPE_CLRFLAG, LEVEL_ACTOWNSPECIAL, 0 },
|
|
|
|
{ "missilesactivateimpactlines", MITYPE_SETFLAG2, LEVEL2_MISSILESACTIVATEIMPACT, 0 },
|
|
|
|
{ "missileshootersactivetimpactlines",MITYPE_CLRFLAG2, LEVEL2_MISSILESACTIVATEIMPACT, 0 },
|
|
|
|
{ "noinventorybar", MITYPE_SETFLAG, LEVEL_NOINVENTORYBAR, 0 },
|
2012-07-08 01:43:47 +00:00
|
|
|
{ "deathslideshow", MITYPE_IGNORE, 0, 0 },
|
2009-02-03 19:11:43 +00:00
|
|
|
{ "strictmonsteractivation", MITYPE_CLRFLAG2, LEVEL2_LAXMONSTERACTIVATION, LEVEL2_LAXACTIVATIONMAPINFO },
|
|
|
|
{ "laxmonsteractivation", MITYPE_SETFLAG2, LEVEL2_LAXMONSTERACTIVATION, LEVEL2_LAXACTIVATIONMAPINFO },
|
2011-02-19 08:59:43 +00:00
|
|
|
{ "additive_scrollers", MITYPE_COMPATFLAG, COMPATF_BOOMSCROLL, 0 },
|
2009-02-03 19:11:43 +00:00
|
|
|
{ "keepfullinventory", MITYPE_SETFLAG2, LEVEL2_KEEPFULLINVENTORY, 0 },
|
|
|
|
{ "monsterfallingdamage", MITYPE_SETFLAG2, LEVEL2_MONSTERFALLINGDAMAGE, 0 },
|
|
|
|
{ "nomonsterfallingdamage", MITYPE_CLRFLAG2, LEVEL2_MONSTERFALLINGDAMAGE, 0 },
|
|
|
|
{ "clipmidtextures", MITYPE_SETFLAG2, LEVEL2_CLIPMIDTEX, 0 },
|
|
|
|
{ "wrapmidtextures", MITYPE_SETFLAG2, LEVEL2_WRAPMIDTEX, 0 },
|
|
|
|
{ "allowcrouch", MITYPE_CLRFLAG, LEVEL_CROUCH_NO, 0 },
|
|
|
|
{ "nocrouch", MITYPE_SETFLAG, LEVEL_CROUCH_NO, 0 },
|
|
|
|
{ "pausemusicinmenus", MITYPE_SCFLAGS2, LEVEL2_PAUSE_MUSIC_IN_MENUS, 0 },
|
|
|
|
{ "noinfighting", MITYPE_SCFLAGS2, LEVEL2_NOINFIGHTING, ~LEVEL2_TOTALINFIGHTING },
|
|
|
|
{ "normalinfighting", MITYPE_SCFLAGS2, 0, ~(LEVEL2_NOINFIGHTING|LEVEL2_TOTALINFIGHTING)},
|
|
|
|
{ "totalinfighting", MITYPE_SCFLAGS2, LEVEL2_TOTALINFIGHTING, ~LEVEL2_NOINFIGHTING },
|
|
|
|
{ "infiniteflightpowerup", MITYPE_SETFLAG2, LEVEL2_INFINITE_FLIGHT, 0 },
|
|
|
|
{ "noinfiniteflightpowerup", MITYPE_CLRFLAG2, LEVEL2_INFINITE_FLIGHT, 0 },
|
|
|
|
{ "allowrespawn", MITYPE_SETFLAG2, LEVEL2_ALLOWRESPAWN, 0 },
|
|
|
|
{ "teamplayon", MITYPE_SCFLAGS2, LEVEL2_FORCETEAMPLAYON, ~LEVEL2_FORCETEAMPLAYOFF },
|
|
|
|
{ "teamplayoff", MITYPE_SCFLAGS2, LEVEL2_FORCETEAMPLAYOFF, ~LEVEL2_FORCETEAMPLAYON },
|
|
|
|
{ "checkswitchrange", MITYPE_SETFLAG2, LEVEL2_CHECKSWITCHRANGE, 0 },
|
|
|
|
{ "nocheckswitchrange", MITYPE_CLRFLAG2, LEVEL2_CHECKSWITCHRANGE, 0 },
|
2009-05-15 17:21:45 +00:00
|
|
|
{ "grinding_polyobj", MITYPE_SETFLAG2, LEVEL2_POLYGRIND, 0 },
|
|
|
|
{ "no_grinding_polyobj", MITYPE_CLRFLAG2, LEVEL2_POLYGRIND, 0 },
|
2009-06-06 12:46:35 +00:00
|
|
|
{ "resetinventory", MITYPE_SETFLAG2, LEVEL2_RESETINVENTORY, 0 },
|
2010-06-18 03:35:41 +00:00
|
|
|
{ "resethealth", MITYPE_SETFLAG2, LEVEL2_RESETHEALTH, 0 },
|
2010-09-18 16:08:10 +00:00
|
|
|
{ "endofgame", MITYPE_SETFLAG2, LEVEL2_ENDGAME, 0 },
|
|
|
|
{ "nostatistics", MITYPE_SETFLAG2, LEVEL2_NOSTATISTICS, 0 },
|
2010-12-16 09:13:06 +00:00
|
|
|
{ "noautosavehint", MITYPE_SETFLAG2, LEVEL2_NOAUTOSAVEHINT, 0 },
|
2012-08-23 00:31:29 +00:00
|
|
|
{ "forgetstate", MITYPE_SETFLAG2, LEVEL2_FORGETSTATE, 0 },
|
|
|
|
{ "rememberstate", MITYPE_CLRFLAG2, LEVEL2_FORGETSTATE, 0 },
|
2009-02-03 19:11:43 +00:00
|
|
|
{ "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 },
|
2013-01-03 02:08:08 +00:00
|
|
|
{ "spawnwithweaponraised", MITYPE_SETFLAG2, LEVEL2_PRERAISEWEAPON, 0 },
|
2014-12-26 12:43:49 +00:00
|
|
|
{ "forcefakecontrast", MITYPE_SETFLAG3, LEVEL3_FORCEFAKECONTRAST, 0 },
|
2009-02-03 19:11:43 +00:00
|
|
|
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
|
2011-02-19 08:59:43 +00:00
|
|
|
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 },
|
|
|
|
{ "compat_stairs", MITYPE_COMPATFLAG, COMPATF_STAIRINDEX, 0 },
|
|
|
|
{ "compat_limitpain", MITYPE_COMPATFLAG, COMPATF_LIMITPAIN, 0 },
|
|
|
|
{ "compat_nopassover", MITYPE_COMPATFLAG, COMPATF_NO_PASSMOBJ, 0 },
|
|
|
|
{ "compat_notossdrops", MITYPE_COMPATFLAG, COMPATF_NOTOSSDROPS, 0 },
|
|
|
|
{ "compat_useblocking", MITYPE_COMPATFLAG, COMPATF_USEBLOCKING, 0 },
|
|
|
|
{ "compat_nodoorlight", MITYPE_COMPATFLAG, COMPATF_NODOORLIGHT, 0 },
|
|
|
|
{ "compat_ravenscroll", MITYPE_COMPATFLAG, COMPATF_RAVENSCROLL, 0 },
|
|
|
|
{ "compat_soundtarget", MITYPE_COMPATFLAG, COMPATF_SOUNDTARGET, 0 },
|
|
|
|
{ "compat_dehhealth", MITYPE_COMPATFLAG, COMPATF_DEHHEALTH, 0 },
|
|
|
|
{ "compat_trace", MITYPE_COMPATFLAG, COMPATF_TRACE, 0 },
|
|
|
|
{ "compat_dropoff", MITYPE_COMPATFLAG, COMPATF_DROPOFF, 0 },
|
|
|
|
{ "compat_boomscroll", MITYPE_COMPATFLAG, COMPATF_BOOMSCROLL, 0 },
|
|
|
|
{ "compat_invisibility", MITYPE_COMPATFLAG, COMPATF_INVISIBILITY, 0 },
|
|
|
|
{ "compat_silent_instant_floors", MITYPE_COMPATFLAG, COMPATF_SILENT_INSTANT_FLOORS, 0 },
|
|
|
|
{ "compat_sectorsounds", MITYPE_COMPATFLAG, COMPATF_SECTORSOUNDS, 0 },
|
|
|
|
{ "compat_missileclip", MITYPE_COMPATFLAG, COMPATF_MISSILECLIP, 0 },
|
|
|
|
{ "compat_crossdropoff", MITYPE_COMPATFLAG, COMPATF_CROSSDROPOFF, 0 },
|
|
|
|
{ "compat_anybossdeath", MITYPE_COMPATFLAG, COMPATF_ANYBOSSDEATH, 0 },
|
|
|
|
{ "compat_minotaur", MITYPE_COMPATFLAG, COMPATF_MINOTAUR, 0 },
|
|
|
|
{ "compat_mushroom", MITYPE_COMPATFLAG, COMPATF_MUSHROOM, 0 },
|
|
|
|
{ "compat_mbfmonstermove", MITYPE_COMPATFLAG, COMPATF_MBFMONSTERMOVE, 0 },
|
|
|
|
{ "compat_corpsegibs", MITYPE_COMPATFLAG, COMPATF_CORPSEGIBS, 0 },
|
|
|
|
{ "compat_noblockfriends", MITYPE_COMPATFLAG, COMPATF_NOBLOCKFRIENDS, 0 },
|
|
|
|
{ "compat_spritesort", MITYPE_COMPATFLAG, COMPATF_SPRITESORT, 0 },
|
|
|
|
{ "compat_light", MITYPE_COMPATFLAG, COMPATF_LIGHT, 0 },
|
|
|
|
{ "compat_polyobj", MITYPE_COMPATFLAG, COMPATF_POLYOBJ, 0 },
|
2011-05-13 03:29:48 +00:00
|
|
|
{ "compat_maskedmidtex", MITYPE_COMPATFLAG, COMPATF_MASKEDMIDTEX, 0 },
|
2011-11-01 02:58:52 +00:00
|
|
|
{ "compat_badangles", MITYPE_COMPATFLAG, 0, COMPATF2_BADANGLES },
|
2012-05-05 22:53:16 +00:00
|
|
|
{ "compat_floormove", MITYPE_COMPATFLAG, 0, COMPATF2_FLOORMOVE },
|
2014-10-25 10:12:06 +00:00
|
|
|
{ "compat_soundcutoff", MITYPE_COMPATFLAG, 0, COMPATF2_SOUNDCUTOFF },
|
2009-02-03 19:11:43 +00:00
|
|
|
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
|
|
|
|
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
|
|
|
|
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },
|
|
|
|
{ "cd_end3_track", MITYPE_EATNEXT, 0, 0 },
|
|
|
|
{ "cd_intermission_track", MITYPE_EATNEXT, 0, 0 },
|
|
|
|
{ "cd_title_track", MITYPE_EATNEXT, 0, 0 },
|
2011-02-19 08:59:43 +00:00
|
|
|
{ NULL, MITYPE_IGNORE, 0, 0}
|
2009-02-03 19:11:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ParseMapDefinition
|
|
|
|
// Parses the body of a map definition, including defaultmap etc.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FMapInfoParser::ParseMapDefinition(level_info_t &info)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
|
|
|
|
ParseOpenBrace();
|
|
|
|
|
|
|
|
while (sc.GetString())
|
|
|
|
{
|
|
|
|
if ((index = sc.MatchString(&MapFlagHandlers->name, sizeof(*MapFlagHandlers))) >= 0)
|
|
|
|
{
|
|
|
|
MapInfoFlagHandler *handler = &MapFlagHandlers[index];
|
|
|
|
switch (handler->type)
|
|
|
|
{
|
|
|
|
case MITYPE_EATNEXT:
|
|
|
|
ParseAssign();
|
|
|
|
sc.MustGetString();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_IGNORE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_SETFLAG:
|
|
|
|
info.flags |= handler->data1;
|
|
|
|
info.flags |= handler->data2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_CLRFLAG:
|
|
|
|
info.flags &= ~handler->data1;
|
|
|
|
info.flags |= handler->data2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_SCFLAGS:
|
|
|
|
info.flags = (info.flags & handler->data2) | handler->data1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_SETFLAG2:
|
|
|
|
info.flags2 |= handler->data1;
|
|
|
|
info.flags2 |= handler->data2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_CLRFLAG2:
|
|
|
|
info.flags2 &= ~handler->data1;
|
|
|
|
info.flags2 |= handler->data2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_SCFLAGS2:
|
|
|
|
info.flags2 = (info.flags2 & handler->data2) | handler->data1;
|
|
|
|
break;
|
|
|
|
|
2014-12-26 12:43:49 +00:00
|
|
|
case MITYPE_SETFLAG3:
|
|
|
|
info.flags3 |= handler->data1;
|
|
|
|
info.flags3 |= handler->data2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_CLRFLAG3:
|
|
|
|
info.flags3 &= ~handler->data1;
|
|
|
|
info.flags3 |= handler->data2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MITYPE_SCFLAGS3:
|
|
|
|
info.flags3 = (info.flags3 & handler->data2) | handler->data1;
|
|
|
|
break;
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
case MITYPE_COMPATFLAG:
|
|
|
|
{
|
|
|
|
int set = 1;
|
|
|
|
if (format_type == FMT_New)
|
|
|
|
{
|
|
|
|
if (CheckAssign())
|
|
|
|
{
|
|
|
|
sc.MustGetNumber();
|
|
|
|
set = sc.Number;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sc.CheckNumber()) set = sc.Number;
|
|
|
|
}
|
|
|
|
|
2011-11-01 02:58:52 +00:00
|
|
|
if (set)
|
|
|
|
{
|
|
|
|
info.compatflags |= handler->data1;
|
|
|
|
info.compatflags2 |= handler->data2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
info.compatflags &= ~handler->data1;
|
|
|
|
info.compatflags2 &= ~handler->data2;
|
|
|
|
}
|
2009-02-03 19:11:43 +00:00
|
|
|
info.compatmask |= handler->data1;
|
2011-11-01 02:58:52 +00:00
|
|
|
info.compatmask2 |= handler->data2;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// should never happen
|
|
|
|
assert(false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-08-02 03:38:57 +00:00
|
|
|
FAutoSegIterator probe(YRegHead, YRegTail);
|
2009-02-03 19:11:43 +00:00
|
|
|
bool success = false;
|
|
|
|
|
2009-08-02 03:38:57 +00:00
|
|
|
while (*++probe != NULL)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2009-08-02 03:38:57 +00:00
|
|
|
if (sc.Compare(((FMapOptInfo *)(*probe))->name))
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2009-11-06 06:56:25 +00:00
|
|
|
if (!((FMapOptInfo *)(*probe))->old && format_type != FMT_New)
|
|
|
|
{
|
|
|
|
sc.ScriptError("MAPINFO option '%s' requires the new MAPINFO format", sc.String);
|
|
|
|
}
|
2009-08-02 03:38:57 +00:00
|
|
|
((FMapOptInfo *)(*probe))->handler(*this, &info);
|
2009-02-03 19:11:43 +00:00
|
|
|
success = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!success)
|
|
|
|
{
|
|
|
|
if (!ParseCloseBrace())
|
|
|
|
{
|
|
|
|
// Unknown
|
|
|
|
sc.ScriptMessage("Unknown property '%s' found in map definition\n", sc.String);
|
|
|
|
SkipToNext();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-19 14:36:37 +00:00
|
|
|
CheckEndOfFile("map");
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// GetDefaultLevelNum
|
|
|
|
// Gets a default level num from a map name.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
static int GetDefaultLevelNum(const char *mapname)
|
|
|
|
{
|
|
|
|
if (!strnicmp (mapname, "MAP", 3) && strlen(mapname) <= 5)
|
|
|
|
{
|
|
|
|
int mapnum = atoi (mapname + 3);
|
|
|
|
|
|
|
|
if (mapnum >= 1 && mapnum <= 99)
|
|
|
|
return mapnum;
|
|
|
|
}
|
|
|
|
else if (mapname[0] == 'E' &&
|
|
|
|
mapname[1] >= '0' && mapname[1] <= '9' &&
|
|
|
|
mapname[2] == 'M' &&
|
|
|
|
mapname[3] >= '0' && mapname[3] <= '9')
|
|
|
|
{
|
|
|
|
int epinum = mapname[1] - '1';
|
|
|
|
int mapnum = mapname[3] - '0';
|
|
|
|
return epinum*10 + mapnum;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ParseMapHeader
|
|
|
|
// Parses the header of a map definition ('map mapxx mapname')
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
|
|
|
|
{
|
|
|
|
FName mapname;
|
|
|
|
|
|
|
|
if (sc.CheckNumber())
|
|
|
|
{ // MAPNAME is a number; assume a Hexen wad
|
|
|
|
char maptemp[8];
|
|
|
|
mysnprintf (maptemp, countof(maptemp), "MAP%02d", sc.Number);
|
|
|
|
mapname = maptemp;
|
|
|
|
HexenHack = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
mapname = sc.String;
|
|
|
|
}
|
|
|
|
int levelindex = FindWadLevelInfo (mapname);
|
|
|
|
if (levelindex == -1)
|
|
|
|
{
|
|
|
|
levelindex = wadlevelinfos.Reserve(1);
|
|
|
|
}
|
|
|
|
level_info_t *levelinfo = &wadlevelinfos[levelindex];
|
|
|
|
*levelinfo = defaultinfo;
|
|
|
|
if (HexenHack)
|
|
|
|
{
|
|
|
|
levelinfo->WallHorizLight = levelinfo->WallVertLight = 0;
|
|
|
|
|
|
|
|
// Hexen levels are automatically nointermission,
|
|
|
|
// no auto sound sequences, falling damage,
|
|
|
|
// monsters activate their own specials, and missiles
|
|
|
|
// are always the activators of impact lines.
|
|
|
|
levelinfo->flags |= LEVEL_NOINTERMISSION
|
|
|
|
| LEVEL_SNDSEQTOTALCTRL
|
|
|
|
| LEVEL_FALLDMG_HX
|
|
|
|
| LEVEL_ACTOWNSPECIAL;
|
|
|
|
levelinfo->flags2|= LEVEL2_HEXENHACK
|
|
|
|
| LEVEL2_INFINITE_FLIGHT
|
|
|
|
| LEVEL2_MISSILESACTIVATEIMPACT
|
|
|
|
| LEVEL2_MONSTERFALLINGDAMAGE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-05-13 22:52:16 +00:00
|
|
|
levelinfo->MapName = mapname;
|
|
|
|
levelinfo->MapName.ToUpper();
|
2009-02-03 19:11:43 +00:00
|
|
|
sc.MustGetString ();
|
|
|
|
if (sc.String[0] == '$')
|
|
|
|
{
|
|
|
|
// For consistency with other definitions allow $Stringtablename here, too.
|
|
|
|
levelinfo->flags |= LEVEL_LOOKUPLEVELNAME;
|
|
|
|
levelinfo->LevelName = sc.String + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sc.Compare ("lookup"))
|
|
|
|
{
|
|
|
|
sc.MustGetString ();
|
|
|
|
levelinfo->flags |= LEVEL_LOOKUPLEVELNAME;
|
|
|
|
}
|
|
|
|
levelinfo->LevelName = 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.
|
2014-05-13 22:52:16 +00:00
|
|
|
levelinfo->levelnum = GetDefaultLevelNum(levelinfo->MapName);
|
2009-02-03 19:11:43 +00:00
|
|
|
|
2012-08-28 03:21:13 +00:00
|
|
|
// Does this map have a song defined via SNDINFO's $map command?
|
|
|
|
// Set that as this map's default music if it does.
|
|
|
|
FString *song;
|
|
|
|
if ((song = HexenMusic.CheckKey(levelinfo->levelnum)) != NULL)
|
|
|
|
{
|
|
|
|
levelinfo->Music = *song;
|
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
return levelinfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Episode definitions start with the header "episode <start-map>"
|
|
|
|
// and then can be followed by any of the following:
|
|
|
|
//
|
|
|
|
// name "Episode name as text"
|
|
|
|
// picname "Picture to display the episode name"
|
|
|
|
// key "Shortcut key for the menu"
|
|
|
|
// noskillmenu
|
|
|
|
// remove
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FMapInfoParser::ParseEpisodeInfo ()
|
|
|
|
{
|
2010-09-14 17:28:18 +00:00
|
|
|
unsigned int i;
|
2014-05-15 18:29:36 +00:00
|
|
|
FString map;
|
2010-09-14 17:28:18 +00:00
|
|
|
FString pic;
|
|
|
|
FString name;
|
2009-02-03 19:11:43 +00:00
|
|
|
bool remove = false;
|
|
|
|
char key = 0;
|
|
|
|
bool noskill = false;
|
|
|
|
bool optional = false;
|
|
|
|
bool extended = false;
|
|
|
|
|
|
|
|
// Get map name
|
|
|
|
sc.MustGetString ();
|
2014-05-15 18:29:36 +00:00
|
|
|
map = sc.String;
|
2009-02-03 19:11:43 +00:00
|
|
|
|
|
|
|
if (sc.CheckString ("teaser"))
|
|
|
|
{
|
|
|
|
sc.MustGetString ();
|
|
|
|
if (gameinfo.flags & GI_SHAREWARE)
|
|
|
|
{
|
2014-05-15 18:29:36 +00:00
|
|
|
map = sc.String;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ParseOpenBrace();
|
|
|
|
|
|
|
|
while (sc.GetString())
|
|
|
|
{
|
|
|
|
if (sc.Compare ("optional"))
|
|
|
|
{
|
|
|
|
// For M4 in Doom
|
|
|
|
optional = true;
|
|
|
|
}
|
|
|
|
else if (sc.Compare ("extended"))
|
|
|
|
{
|
|
|
|
// For M4 and M5 in Heretic
|
|
|
|
extended = true;
|
|
|
|
}
|
|
|
|
else if (sc.Compare ("name"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
sc.MustGetString ();
|
2010-09-14 17:28:18 +00:00
|
|
|
name = sc.String;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
else if (sc.Compare ("picname"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
sc.MustGetString ();
|
2010-09-14 17:28:18 +00:00
|
|
|
pic = sc.String;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
else if (sc.Compare ("remove"))
|
|
|
|
{
|
|
|
|
remove = true;
|
|
|
|
}
|
|
|
|
else if (sc.Compare ("key"))
|
|
|
|
{
|
|
|
|
ParseAssign();
|
|
|
|
sc.MustGetString ();
|
|
|
|
key = sc.String[0];
|
|
|
|
}
|
|
|
|
else if (sc.Compare("noskillmenu"))
|
|
|
|
{
|
|
|
|
noskill = true;
|
|
|
|
}
|
|
|
|
else if (!ParseCloseBrace())
|
|
|
|
{
|
|
|
|
// Unknown
|
|
|
|
sc.ScriptMessage("Unknown property '%s' found in episode definition\n", sc.String);
|
|
|
|
SkipToNext();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-02-19 14:36:37 +00:00
|
|
|
CheckEndOfFile("episode");
|
2009-02-03 19:11:43 +00:00
|
|
|
|
|
|
|
if (extended && !(gameinfo.flags & GI_MENUHACK_EXTENDED))
|
|
|
|
{ // If the episode is for the extended Heretic, but this is
|
|
|
|
// not the extended Heretic, ignore it.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (optional && !remove)
|
|
|
|
{
|
|
|
|
if (!P_CheckMapData(map))
|
|
|
|
{
|
|
|
|
// If the episode is optional and the map does not exist
|
|
|
|
// just ignore this episode definition.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-14 17:28:18 +00:00
|
|
|
for (i = 0; i < AllEpisodes.Size(); i++)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2010-09-14 17:28:18 +00:00
|
|
|
if (AllEpisodes[i].mEpisodeMap.CompareNoCase(map) == 0)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (remove)
|
|
|
|
{
|
|
|
|
// If the remove property is given for an episode, remove it.
|
2010-09-14 17:28:18 +00:00
|
|
|
AllEpisodes.Delete(i);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-12-02 13:57:05 +00:00
|
|
|
// Only allocate a new entry if this doesn't replace an existing episode.
|
|
|
|
if (i >= AllEpisodes.Size())
|
|
|
|
{
|
|
|
|
i = AllEpisodes.Reserve(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
FEpisode *epi = &AllEpisodes[i];
|
2009-02-03 19:11:43 +00:00
|
|
|
|
2010-09-14 17:28:18 +00:00
|
|
|
epi->mEpisodeMap = map;
|
|
|
|
epi->mEpisodeName = name;
|
|
|
|
epi->mPicName = pic;
|
|
|
|
epi->mShortcut = tolower(key);
|
|
|
|
epi->mNoSkill = noskill;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Clears episode definitions
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void ClearEpisodes()
|
|
|
|
{
|
2010-09-14 17:28:18 +00:00
|
|
|
AllEpisodes.Clear();
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// SetLevelNum
|
|
|
|
// Avoid duplicate levelnums. The level being set always has precedence.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
static void SetLevelNum (level_info_t *info, int num)
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); ++i)
|
|
|
|
{
|
|
|
|
if (wadlevelinfos[i].levelnum == num)
|
|
|
|
wadlevelinfos[i].levelnum = 0;
|
|
|
|
}
|
|
|
|
info->levelnum = num;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// G_DoParseMapInfo
|
|
|
|
// Parses a single MAPINFO lump
|
|
|
|
// data for wadlevelinfos and wadclusterinfos.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2009-03-22 11:37:56 +00:00
|
|
|
void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_info_t &defaultinfo)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
sc.OpenLumpNum(lump);
|
|
|
|
|
|
|
|
defaultinfo = gamedefaults;
|
|
|
|
HexenHack = false;
|
|
|
|
|
|
|
|
while (sc.GetString ())
|
|
|
|
{
|
2009-03-22 11:37:56 +00:00
|
|
|
if (sc.Compare("include"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
int inclump = Wads.CheckNumForFullName(sc.String, true);
|
|
|
|
if (inclump < 0)
|
|
|
|
{
|
|
|
|
sc.ScriptError("include file '%s' not found", sc.String);
|
|
|
|
}
|
2010-07-01 09:35:39 +00:00
|
|
|
if (Wads.GetLumpFile(sc.LumpNum) != Wads.GetLumpFile(inclump))
|
|
|
|
{
|
|
|
|
// Do not allow overriding includes from the default MAPINFO
|
|
|
|
if (Wads.GetLumpFile(sc.LumpNum) == 0)
|
|
|
|
{
|
|
|
|
I_FatalError("File %s is overriding core lump %s.",
|
|
|
|
Wads.GetWadFullName(Wads.GetLumpFile(inclump)), sc.String);
|
|
|
|
}
|
|
|
|
}
|
2009-03-22 11:37:56 +00:00
|
|
|
FScanner saved_sc = sc;
|
|
|
|
ParseMapInfo(inclump, gamedefaults, defaultinfo);
|
|
|
|
sc = saved_sc;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("gamedefaults"))
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
gamedefaults.Reset();
|
|
|
|
ParseMapDefinition(gamedefaults);
|
|
|
|
defaultinfo = gamedefaults;
|
|
|
|
}
|
|
|
|
else if (sc.Compare("defaultmap"))
|
|
|
|
{
|
|
|
|
defaultinfo = gamedefaults;
|
|
|
|
ParseMapDefinition(defaultinfo);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("adddefaultmap"))
|
|
|
|
{
|
|
|
|
// Same as above but adds to the existing definitions instead of replacing them completely
|
|
|
|
ParseMapDefinition(defaultinfo);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("map"))
|
|
|
|
{
|
|
|
|
level_info_t *levelinfo = ParseMapHeader(defaultinfo);
|
|
|
|
|
|
|
|
ParseMapDefinition(*levelinfo);
|
|
|
|
|
|
|
|
// When the second sky is -NOFLAT-, make it a copy of the first sky
|
2014-05-13 09:33:59 +00:00
|
|
|
if (!levelinfo->SkyPic2.CompareNoCase("-NOFLAT-"))
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2014-05-13 09:33:59 +00:00
|
|
|
levelinfo->SkyPic2 = levelinfo->SkyPic1;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
SetLevelNum (levelinfo, levelinfo->levelnum); // Wipe out matching levelnums from other maps.
|
|
|
|
}
|
2009-02-08 19:04:07 +00:00
|
|
|
// clusterdef is the old keyword but the new format has enough
|
|
|
|
// structuring that 'cluster' can be handled, too. The old format does not.
|
2009-02-09 00:11:07 +00:00
|
|
|
else if (sc.Compare("clusterdef") || (format_type != FMT_Old && sc.Compare("cluster")))
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
ParseCluster();
|
|
|
|
}
|
|
|
|
else if (sc.Compare("episode"))
|
|
|
|
{
|
|
|
|
ParseEpisodeInfo();
|
|
|
|
}
|
|
|
|
else if (sc.Compare("clearepisodes"))
|
|
|
|
{
|
|
|
|
ClearEpisodes();
|
|
|
|
}
|
|
|
|
else if (sc.Compare("skill"))
|
|
|
|
{
|
|
|
|
ParseSkill();
|
|
|
|
}
|
|
|
|
else if (sc.Compare("clearskills"))
|
|
|
|
{
|
|
|
|
AllSkills.Clear();
|
2009-07-23 04:33:07 +00:00
|
|
|
DefaultSkill = -1;
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
2009-03-22 11:37:56 +00:00
|
|
|
else if (sc.Compare("gameinfo"))
|
|
|
|
{
|
|
|
|
if (format_type != FMT_Old)
|
|
|
|
{
|
|
|
|
format_type = FMT_New;
|
|
|
|
ParseGameInfo();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("gameinfo definitions not supported with old MAPINFO syntax");
|
|
|
|
}
|
|
|
|
}
|
2010-10-06 10:44:03 +00:00
|
|
|
else if (sc.Compare("intermission"))
|
|
|
|
{
|
|
|
|
if (format_type != FMT_Old)
|
|
|
|
{
|
|
|
|
format_type = FMT_New;
|
|
|
|
ParseIntermission();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("intermission definitions not supported with old MAPINFO syntax");
|
|
|
|
}
|
|
|
|
}
|
2015-04-03 14:51:45 +00:00
|
|
|
else if (sc.Compare("doomednums"))
|
|
|
|
{
|
|
|
|
if (format_type != FMT_Old)
|
|
|
|
{
|
|
|
|
format_type = FMT_New;
|
|
|
|
ParseDoomEdNums();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("doomednums definitions not supported with old MAPINFO syntax");
|
|
|
|
}
|
|
|
|
}
|
2015-04-03 22:39:09 +00:00
|
|
|
else if (sc.Compare("spawnnums"))
|
|
|
|
{
|
|
|
|
if (format_type != FMT_Old)
|
|
|
|
{
|
|
|
|
format_type = FMT_New;
|
|
|
|
ParseSpawnNums();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("spawnnums definitions not supported with old MAPINFO syntax");
|
|
|
|
}
|
|
|
|
}
|
2015-04-04 22:31:15 +00:00
|
|
|
else if (sc.Compare("conversationids"))
|
|
|
|
{
|
|
|
|
if (format_type != FMT_Old)
|
|
|
|
{
|
|
|
|
format_type = FMT_New;
|
|
|
|
ParseConversationIDs();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("conversationids definitions not supported with old MAPINFO syntax");
|
|
|
|
}
|
|
|
|
}
|
2013-08-09 09:00:24 +00:00
|
|
|
else if (sc.Compare("automap") || sc.Compare("automap_overlay"))
|
2013-08-02 14:56:42 +00:00
|
|
|
{
|
|
|
|
if (format_type != FMT_Old)
|
|
|
|
{
|
|
|
|
format_type = FMT_New;
|
2013-08-09 09:00:24 +00:00
|
|
|
ParseAMColors(sc.Compare("automap_overlay"));
|
2013-08-02 14:56:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("automap colorset definitions not supported with old MAPINFO syntax");
|
|
|
|
}
|
|
|
|
}
|
2009-02-03 19:11:43 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("%s: Unknown top level keyword", sc.String);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-17 13:25:21 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void DeinitIntermissions();
|
|
|
|
|
|
|
|
static void ClearMapinfo()
|
|
|
|
{
|
2010-12-13 10:02:45 +00:00
|
|
|
wadclusterinfos.Clear();
|
|
|
|
wadlevelinfos.Clear();
|
2010-10-17 13:25:21 +00:00
|
|
|
ClearEpisodes();
|
2010-12-13 10:02:45 +00:00
|
|
|
AllSkills.Clear();
|
|
|
|
DefaultSkill = -1;
|
2010-10-17 13:25:21 +00:00
|
|
|
DeinitIntermissions();
|
2010-12-14 00:50:02 +00:00
|
|
|
level.info = NULL;
|
2010-10-17 13:25:21 +00:00
|
|
|
}
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// G_ParseMapInfo
|
|
|
|
// Parses the MAPINFO lumps of all loaded WADs and generates
|
|
|
|
// data for wadlevelinfos and wadclusterinfos.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2014-09-04 23:34:41 +00:00
|
|
|
void G_ParseMapInfo (FString basemapinfo)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
int lump, lastlump = 0;
|
|
|
|
level_info_t gamedefaults;
|
|
|
|
|
2010-12-13 10:02:45 +00:00
|
|
|
ClearMapinfo();
|
2010-10-17 13:25:21 +00:00
|
|
|
atterm(ClearMapinfo);
|
2009-02-03 19:11:43 +00:00
|
|
|
|
2010-07-01 09:35:39 +00:00
|
|
|
// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.
|
2014-09-04 23:34:41 +00:00
|
|
|
if (basemapinfo.IsNotEmpty())
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2009-03-22 11:37:56 +00:00
|
|
|
FMapInfoParser parse;
|
|
|
|
level_info_t defaultinfo;
|
2010-07-01 09:35:39 +00:00
|
|
|
int baselump = Wads.GetNumForFullName(basemapinfo);
|
|
|
|
if (Wads.GetLumpFile(baselump) > 0)
|
|
|
|
{
|
|
|
|
I_FatalError("File %s is overriding core lump %s.",
|
2014-09-04 23:34:41 +00:00
|
|
|
Wads.GetWadFullName(Wads.GetLumpFile(baselump)), basemapinfo.GetChars());
|
2010-07-01 09:35:39 +00:00
|
|
|
}
|
|
|
|
parse.ParseMapInfo(baselump, gamedefaults, defaultinfo);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
2010-03-13 08:28:13 +00:00
|
|
|
static const char *mapinfonames[] = { "MAPINFO", "ZMAPINFO", NULL };
|
|
|
|
int nindex;
|
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
// Parse any extra MAPINFOs.
|
2010-03-13 08:28:13 +00:00
|
|
|
while ((lump = Wads.FindLumpMulti (mapinfonames, &lastlump, false, &nindex)) != -1)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
2010-03-13 08:28:13 +00:00
|
|
|
if (nindex == 0)
|
|
|
|
{
|
|
|
|
// If this lump is named MAPINFO we need to check if the same WAD contains a ZMAPINFO lump.
|
|
|
|
// If that exists we need to skip this one.
|
|
|
|
|
|
|
|
int wad = Wads.GetLumpFile(lump);
|
|
|
|
int altlump = Wads.CheckNumForName("ZMAPINFO", ns_global, wad, true);
|
|
|
|
|
|
|
|
if (altlump >= 0) continue;
|
|
|
|
}
|
|
|
|
FMapInfoParser parse(nindex == 1? FMapInfoParser::FMT_New : FMapInfoParser::FMT_Unknown);
|
2009-03-22 11:37:56 +00:00
|
|
|
level_info_t defaultinfo;
|
|
|
|
parse.ParseMapInfo(lump, gamedefaults, defaultinfo);
|
2009-02-03 19:11:43 +00:00
|
|
|
}
|
|
|
|
|
2010-09-14 17:28:18 +00:00
|
|
|
if (AllEpisodes.Size() == 0)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
I_FatalError ("You cannot use clearepisodes in a MAPINFO if you do not define any new episodes after it.");
|
|
|
|
}
|
2009-07-23 04:33:07 +00:00
|
|
|
if (AllSkills.Size() == 0)
|
2009-02-03 19:11:43 +00:00
|
|
|
{
|
|
|
|
I_FatalError ("You cannot use clearskills in a MAPINFO if you do not define any new skills after it.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|