2009-02-05 02:55:28 +00:00
|
|
|
/*
|
|
|
|
** compatibility.cpp
|
|
|
|
** Handles compatibility flags for maps that are unlikely to be updated.
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
** Copyright 2009 Randy Heit
|
|
|
|
** 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.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
** This file is for maps that have been rendered broken by bug fixes or other
|
|
|
|
** changes that seemed minor at the time, and it is unlikely that the maps
|
|
|
|
** will be changed. If you are making a map and you know it needs a
|
|
|
|
** compatibility option to play properly, you are advised to specify so with
|
|
|
|
** a MAPINFO.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// HEADER FILES ------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "compatibility.h"
|
|
|
|
#include "sc_man.h"
|
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "doomdef.h"
|
2010-04-11 11:18:33 +00:00
|
|
|
#include "doomdata.h"
|
2009-02-05 02:55:28 +00:00
|
|
|
#include "doomstat.h"
|
|
|
|
#include "c_dispatch.h"
|
2009-02-06 00:16:57 +00:00
|
|
|
#include "gi.h"
|
|
|
|
#include "g_level.h"
|
2010-04-11 11:18:33 +00:00
|
|
|
#include "p_lnspec.h"
|
|
|
|
#include "r_state.h"
|
2012-10-22 01:28:11 +00:00
|
|
|
#include "w_wad.h"
|
2009-02-05 02:55:28 +00:00
|
|
|
|
|
|
|
// MACROS ------------------------------------------------------------------
|
|
|
|
|
|
|
|
// TYPES -------------------------------------------------------------------
|
|
|
|
|
|
|
|
struct FCompatOption
|
|
|
|
{
|
|
|
|
const char *Name;
|
2013-01-21 22:30:30 +00:00
|
|
|
DWORD CompatFlags;
|
2011-11-01 02:58:52 +00:00
|
|
|
int WhichSlot;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SLOT_COMPAT,
|
|
|
|
SLOT_COMPAT2,
|
|
|
|
SLOT_BCOMPAT
|
2009-02-05 02:55:28 +00:00
|
|
|
};
|
|
|
|
|
2010-04-11 11:18:33 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CP_END,
|
|
|
|
CP_CLEARFLAGS,
|
|
|
|
CP_SETFLAGS,
|
2012-03-15 20:33:33 +00:00
|
|
|
CP_SETSPECIAL,
|
2012-03-15 23:41:44 +00:00
|
|
|
CP_CLEARSPECIAL,
|
2013-01-23 04:48:33 +00:00
|
|
|
CP_SETACTIVATION,
|
|
|
|
CP_SECTORFLOOROFFSET,
|
|
|
|
CP_SETWALLYSCALE,
|
2013-06-25 21:36:24 +00:00
|
|
|
CP_SETTHINGZ,
|
2014-09-08 20:54:56 +00:00
|
|
|
CP_SETTAG,
|
2010-04-11 11:18:33 +00:00
|
|
|
};
|
|
|
|
|
2009-02-05 02:55:28 +00:00
|
|
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
|
|
|
|
|
|
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
|
|
|
|
|
|
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
|
|
|
|
|
|
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
2013-06-25 22:50:50 +00:00
|
|
|
extern TArray<FMapThing> MapThingsConverted;
|
2009-02-05 02:55:28 +00:00
|
|
|
|
|
|
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
|
|
|
|
|
|
|
TMap<FMD5Holder, FCompatValues, FMD5HashTraits> BCompatMap;
|
|
|
|
|
|
|
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
|
|
|
|
|
|
|
static FCompatOption Options[] =
|
|
|
|
{
|
2011-11-01 02:58:52 +00:00
|
|
|
{ "setslopeoverflow", BCOMPATF_SETSLOPEOVERFLOW, SLOT_BCOMPAT },
|
|
|
|
{ "resetplayerspeed", BCOMPATF_RESETPLAYERSPEED, SLOT_BCOMPAT },
|
|
|
|
{ "vileghosts", BCOMPATF_VILEGHOSTS, SLOT_BCOMPAT },
|
|
|
|
{ "ignoreteleporttags", BCOMPATF_BADTELEPORTERS, SLOT_BCOMPAT },
|
2013-02-07 21:32:06 +00:00
|
|
|
{ "rebuildnodes", BCOMPATF_REBUILDNODES, SLOT_BCOMPAT },
|
2013-07-02 19:15:08 +00:00
|
|
|
{ "linkfrozenprops", BCOMPATF_LINKFROZENPROPS, SLOT_BCOMPAT },
|
2014-02-24 23:43:28 +00:00
|
|
|
{ "disablepushwindowcheck", BCOMPATF_NOWINDOWCHECK, SLOT_BCOMPAT },
|
2009-02-05 02:55:28 +00:00
|
|
|
|
|
|
|
// list copied from g_mapinfo.cpp
|
2011-11-01 02:58:52 +00:00
|
|
|
{ "shorttex", COMPATF_SHORTTEX, SLOT_COMPAT },
|
|
|
|
{ "stairs", COMPATF_STAIRINDEX, SLOT_COMPAT },
|
|
|
|
{ "limitpain", COMPATF_LIMITPAIN, SLOT_COMPAT },
|
|
|
|
{ "nopassover", COMPATF_NO_PASSMOBJ, SLOT_COMPAT },
|
|
|
|
{ "notossdrops", COMPATF_NOTOSSDROPS, SLOT_COMPAT },
|
|
|
|
{ "useblocking", COMPATF_USEBLOCKING, SLOT_COMPAT },
|
|
|
|
{ "nodoorlight", COMPATF_NODOORLIGHT, SLOT_COMPAT },
|
|
|
|
{ "ravenscroll", COMPATF_RAVENSCROLL, SLOT_COMPAT },
|
|
|
|
{ "soundtarget", COMPATF_SOUNDTARGET, SLOT_COMPAT },
|
|
|
|
{ "dehhealth", COMPATF_DEHHEALTH, SLOT_COMPAT },
|
|
|
|
{ "trace", COMPATF_TRACE, SLOT_COMPAT },
|
|
|
|
{ "dropoff", COMPATF_DROPOFF, SLOT_COMPAT },
|
|
|
|
{ "boomscroll", COMPATF_BOOMSCROLL, SLOT_COMPAT },
|
|
|
|
{ "invisibility", COMPATF_INVISIBILITY, SLOT_COMPAT },
|
|
|
|
{ "silentinstantfloors", COMPATF_SILENT_INSTANT_FLOORS, SLOT_COMPAT },
|
|
|
|
{ "sectorsounds", COMPATF_SECTORSOUNDS, SLOT_COMPAT },
|
|
|
|
{ "missileclip", COMPATF_MISSILECLIP, SLOT_COMPAT },
|
|
|
|
{ "crossdropoff", COMPATF_CROSSDROPOFF, SLOT_COMPAT },
|
|
|
|
{ "wallrun", COMPATF_WALLRUN, SLOT_COMPAT }, // [GZ] Added for CC MAP29
|
|
|
|
{ "anybossdeath", COMPATF_ANYBOSSDEATH, SLOT_COMPAT },// [GZ] Added for UAC_DEAD
|
|
|
|
{ "mushroom", COMPATF_MUSHROOM, SLOT_COMPAT },
|
|
|
|
{ "mbfmonstermove", COMPATF_MBFMONSTERMOVE, SLOT_COMPAT },
|
|
|
|
{ "corpsegibs", COMPATF_CORPSEGIBS, SLOT_COMPAT },
|
|
|
|
{ "noblockfriends", COMPATF_NOBLOCKFRIENDS, SLOT_COMPAT },
|
|
|
|
{ "spritesort", COMPATF_SPRITESORT, SLOT_COMPAT },
|
|
|
|
{ "hitscan", COMPATF_HITSCAN, SLOT_COMPAT },
|
|
|
|
{ "lightlevel", COMPATF_LIGHT, SLOT_COMPAT },
|
|
|
|
{ "polyobj", COMPATF_POLYOBJ, SLOT_COMPAT },
|
|
|
|
{ "maskedmidtex", COMPATF_MASKEDMIDTEX, SLOT_COMPAT },
|
|
|
|
{ "badangles", COMPATF2_BADANGLES, SLOT_COMPAT2 },
|
2012-05-05 22:53:16 +00:00
|
|
|
{ "floormove", COMPATF2_FLOORMOVE, SLOT_COMPAT2 },
|
2014-10-25 10:12:06 +00:00
|
|
|
{ "soundcutoff", COMPATF2_SOUNDCUTOFF, SLOT_COMPAT2 },
|
2011-11-01 02:58:52 +00:00
|
|
|
|
2009-02-05 02:55:28 +00:00
|
|
|
{ NULL, 0, 0 }
|
|
|
|
};
|
|
|
|
|
2013-01-23 04:48:33 +00:00
|
|
|
static const char *const LineSides[] =
|
|
|
|
{
|
|
|
|
"Front", "Back", NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const WallTiers[] =
|
|
|
|
{
|
|
|
|
"Top", "Mid", "Bot", NULL
|
|
|
|
};
|
|
|
|
|
2010-04-11 11:18:33 +00:00
|
|
|
static TArray<int> CompatParams;
|
|
|
|
static int ii_compatparams;
|
|
|
|
|
2009-02-05 02:55:28 +00:00
|
|
|
// CODE --------------------------------------------------------------------
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ParseCompatibility
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void ParseCompatibility()
|
|
|
|
{
|
|
|
|
TArray<FMD5Holder> md5array;
|
|
|
|
FMD5Holder md5;
|
|
|
|
FCompatValues flags;
|
|
|
|
int i, x;
|
|
|
|
unsigned int j;
|
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
BCompatMap.Clear();
|
|
|
|
CompatParams.Clear();
|
|
|
|
|
2009-02-05 02:55:28 +00:00
|
|
|
// The contents of this file are not cumulative, as it should not
|
|
|
|
// be present in user-distributed maps.
|
|
|
|
FScanner sc(Wads.GetNumForFullName("compatibility.txt"));
|
|
|
|
|
|
|
|
while (sc.GetString()) // Get MD5 signature
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (strlen(sc.String) != 32)
|
|
|
|
{
|
|
|
|
sc.ScriptError("MD5 signature must be exactly 32 characters long");
|
|
|
|
}
|
|
|
|
for (i = 0; i < 32; ++i)
|
|
|
|
{
|
|
|
|
if (sc.String[i] >= '0' && sc.String[i] <= '9')
|
|
|
|
{
|
|
|
|
x = sc.String[i] - '0';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.String[i] |= 'a' ^ 'A';
|
|
|
|
if (sc.String[i] >= 'a' && sc.String[i] <= 'f')
|
|
|
|
{
|
|
|
|
x = sc.String[i] - 'a' + 10;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-03-10 23:07:37 +00:00
|
|
|
x = 0;
|
2009-02-05 02:55:28 +00:00
|
|
|
sc.ScriptError("MD5 signature must be a hexadecimal value");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!(i & 1))
|
|
|
|
{
|
|
|
|
md5.Bytes[i / 2] = x << 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
md5.Bytes[i / 2] |= x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
md5array.Push(md5);
|
|
|
|
sc.MustGetString();
|
|
|
|
} while (!sc.Compare("{"));
|
2011-11-01 02:58:52 +00:00
|
|
|
memset(flags.CompatFlags, 0, sizeof(flags.CompatFlags));
|
2010-08-11 03:56:31 +00:00
|
|
|
flags.ExtCommandIndex = ~0u;
|
2010-04-11 11:18:33 +00:00
|
|
|
while (sc.GetString())
|
2009-02-05 02:55:28 +00:00
|
|
|
{
|
2010-04-11 11:18:33 +00:00
|
|
|
if ((i = sc.MatchString(&Options[0].Name, sizeof(*Options))) >= 0)
|
|
|
|
{
|
2011-11-01 02:58:52 +00:00
|
|
|
flags.CompatFlags[Options[i].WhichSlot] |= Options[i].CompatFlags;
|
2010-04-11 11:18:33 +00:00
|
|
|
}
|
|
|
|
else if (sc.Compare("clearlineflags"))
|
|
|
|
{
|
2010-08-11 03:56:31 +00:00
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
2010-04-11 11:18:33 +00:00
|
|
|
CompatParams.Push(CP_CLEARFLAGS);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("setlineflags"))
|
|
|
|
{
|
2010-08-11 03:56:31 +00:00
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
2010-04-11 11:18:33 +00:00
|
|
|
CompatParams.Push(CP_SETFLAGS);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
}
|
|
|
|
else if (sc.Compare("setlinespecial"))
|
|
|
|
{
|
2010-08-11 03:56:31 +00:00
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
2010-04-11 11:18:33 +00:00
|
|
|
CompatParams.Push(CP_SETSPECIAL);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
|
|
|
|
sc.MustGetString();
|
|
|
|
CompatParams.Push(P_FindLineSpecial(sc.String, NULL, NULL));
|
2011-11-01 02:58:52 +00:00
|
|
|
for (int i = 0; i < 5; i++)
|
2010-04-11 11:18:33 +00:00
|
|
|
{
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
}
|
|
|
|
}
|
2012-03-15 23:41:44 +00:00
|
|
|
else if (sc.Compare("clearlinespecial"))
|
|
|
|
{
|
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
|
|
|
CompatParams.Push(CP_CLEARSPECIAL);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
}
|
2012-03-15 20:33:33 +00:00
|
|
|
else if (sc.Compare("setactivation"))
|
|
|
|
{
|
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
|
|
|
CompatParams.Push(CP_SETACTIVATION);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
}
|
2013-01-23 04:48:33 +00:00
|
|
|
else if (sc.Compare("sectorflooroffset"))
|
|
|
|
{
|
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
|
|
|
CompatParams.Push(CP_SECTORFLOOROFFSET);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
sc.MustGetFloat();
|
|
|
|
CompatParams.Push(FLOAT2FIXED(sc.Float));
|
|
|
|
}
|
|
|
|
else if (sc.Compare("setwallyscale"))
|
|
|
|
{
|
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
|
|
|
CompatParams.Push(CP_SETWALLYSCALE);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
sc.MustGetString();
|
|
|
|
CompatParams.Push(sc.MustMatchString(LineSides));
|
|
|
|
sc.MustGetString();
|
|
|
|
CompatParams.Push(sc.MustMatchString(WallTiers));
|
|
|
|
sc.MustGetFloat();
|
|
|
|
CompatParams.Push(FLOAT2FIXED(sc.Float));
|
|
|
|
}
|
2013-06-25 21:36:24 +00:00
|
|
|
else if (sc.Compare("setthingz"))
|
|
|
|
{
|
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
|
|
|
CompatParams.Push(CP_SETTHINGZ);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
sc.MustGetFloat();
|
|
|
|
CompatParams.Push(FLOAT2FIXED(sc.Float));
|
|
|
|
}
|
2014-09-08 20:54:56 +00:00
|
|
|
else if (sc.Compare("setsectortag"))
|
|
|
|
{
|
|
|
|
if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size();
|
|
|
|
CompatParams.Push(CP_SETTAG);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
sc.MustGetNumber();
|
|
|
|
CompatParams.Push(sc.Number);
|
|
|
|
}
|
2010-04-11 11:18:33 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.UnGet();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-08-11 03:56:31 +00:00
|
|
|
if (flags.ExtCommandIndex != ~0u)
|
2010-04-11 11:18:33 +00:00
|
|
|
{
|
|
|
|
CompatParams.Push(CP_END);
|
2009-02-05 02:55:28 +00:00
|
|
|
}
|
|
|
|
sc.MustGetStringName("}");
|
|
|
|
for (j = 0; j < md5array.Size(); ++j)
|
|
|
|
{
|
|
|
|
BCompatMap[md5array[j]] = flags;
|
|
|
|
}
|
2009-02-06 00:16:57 +00:00
|
|
|
md5array.Clear();
|
2009-02-05 02:55:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CheckCompatibility
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void CheckCompatibility(MapData *map)
|
|
|
|
{
|
|
|
|
FMD5Holder md5;
|
|
|
|
FCompatValues *flags;
|
2012-03-15 23:41:44 +00:00
|
|
|
bool onlyparams = true;
|
2009-02-05 02:55:28 +00:00
|
|
|
|
2010-05-29 07:07:39 +00:00
|
|
|
// When playing Doom IWAD levels force COMPAT_SHORTTEX and COMPATF_LIGHT.
|
|
|
|
// I'm not sure if the IWAD maps actually need COMPATF_LIGHT but it certainly does not hurt.
|
|
|
|
// TNT's MAP31 also needs COMPATF_STAIRINDEX but that only gets activated for TNT.WAD.
|
2011-01-29 11:09:38 +00:00
|
|
|
if (Wads.GetLumpFile(map->lumpnum) == 1 && (gameinfo.flags & GI_COMPATSHORTTEX) && level.maptype == MAPTYPE_DOOM)
|
2009-02-05 02:55:28 +00:00
|
|
|
{
|
2010-05-29 07:07:39 +00:00
|
|
|
ii_compatflags = COMPATF_SHORTTEX|COMPATF_LIGHT;
|
2010-05-12 09:44:44 +00:00
|
|
|
if (gameinfo.flags & GI_COMPATSTAIRS) ii_compatflags |= COMPATF_STAIRINDEX;
|
2011-11-01 02:58:52 +00:00
|
|
|
ii_compatflags2 = 0;
|
2009-02-06 00:16:57 +00:00
|
|
|
ib_compatflags = 0;
|
2010-04-11 11:18:33 +00:00
|
|
|
ii_compatparams = -1;
|
2009-02-05 02:55:28 +00:00
|
|
|
}
|
2010-08-15 10:02:10 +00:00
|
|
|
else if (Wads.GetLumpFile(map->lumpnum) == 1 && (gameinfo.flags & GI_COMPATPOLY1) && Wads.CheckLumpName(map->lumpnum, "MAP36"))
|
|
|
|
{
|
|
|
|
ii_compatflags = COMPATF_POLYOBJ;
|
2011-11-01 02:58:52 +00:00
|
|
|
ii_compatflags2 = 0;
|
2010-08-15 10:02:10 +00:00
|
|
|
ib_compatflags = 0;
|
|
|
|
ii_compatparams = -1;
|
|
|
|
}
|
|
|
|
else if (Wads.GetLumpFile(map->lumpnum) == 2 && (gameinfo.flags & GI_COMPATPOLY2) && Wads.CheckLumpName(map->lumpnum, "MAP47"))
|
|
|
|
{
|
|
|
|
ii_compatflags = COMPATF_POLYOBJ;
|
2011-11-01 02:58:52 +00:00
|
|
|
ii_compatflags2 = 0;
|
2010-08-15 10:02:10 +00:00
|
|
|
ib_compatflags = 0;
|
|
|
|
ii_compatparams = -1;
|
|
|
|
}
|
2009-02-05 02:55:28 +00:00
|
|
|
else
|
|
|
|
{
|
2012-03-15 23:41:44 +00:00
|
|
|
onlyparams = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
map->GetChecksum(md5.Bytes);
|
2009-02-06 00:16:57 +00:00
|
|
|
|
2012-03-15 23:41:44 +00:00
|
|
|
flags = BCompatMap.CheckKey(md5);
|
2009-02-06 00:16:57 +00:00
|
|
|
|
2012-03-15 23:41:44 +00:00
|
|
|
if (developer)
|
|
|
|
{
|
|
|
|
Printf("MD5 = ");
|
|
|
|
for (size_t j = 0; j < sizeof(md5.Bytes); ++j)
|
2009-02-06 00:16:57 +00:00
|
|
|
{
|
2012-03-15 23:41:44 +00:00
|
|
|
Printf("%02X", md5.Bytes[j]);
|
2009-02-06 00:16:57 +00:00
|
|
|
}
|
|
|
|
if (flags != NULL)
|
2012-03-15 23:41:44 +00:00
|
|
|
{
|
|
|
|
Printf(", cflags = %08x, cflags2 = %08x, bflags = %08x\n",
|
|
|
|
flags->CompatFlags[SLOT_COMPAT], flags->CompatFlags[SLOT_COMPAT2], flags->CompatFlags[SLOT_BCOMPAT]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags != NULL)
|
|
|
|
{
|
|
|
|
if (!onlyparams)
|
2009-02-06 00:16:57 +00:00
|
|
|
{
|
2011-11-01 02:58:52 +00:00
|
|
|
ii_compatflags = flags->CompatFlags[SLOT_COMPAT];
|
|
|
|
ii_compatflags2 = flags->CompatFlags[SLOT_COMPAT2];
|
|
|
|
ib_compatflags = flags->CompatFlags[SLOT_BCOMPAT];
|
2009-02-06 00:16:57 +00:00
|
|
|
}
|
2012-03-15 23:41:44 +00:00
|
|
|
ii_compatparams = flags->ExtCommandIndex;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!onlyparams)
|
2009-02-06 00:16:57 +00:00
|
|
|
{
|
|
|
|
ii_compatflags = 0;
|
2011-11-01 02:58:52 +00:00
|
|
|
ii_compatflags2 = 0;
|
2009-02-06 00:16:57 +00:00
|
|
|
ib_compatflags = 0;
|
|
|
|
}
|
2012-03-15 23:41:44 +00:00
|
|
|
ii_compatparams = -1;
|
2009-02-05 02:55:28 +00:00
|
|
|
}
|
|
|
|
// Reset i_compatflags
|
2009-02-06 00:16:57 +00:00
|
|
|
compatflags.Callback();
|
2011-11-01 02:58:52 +00:00
|
|
|
compatflags2.Callback();
|
2009-02-05 02:55:28 +00:00
|
|
|
}
|
|
|
|
|
2010-04-11 11:18:33 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// SetCompatibilityParams
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void SetCompatibilityParams()
|
|
|
|
{
|
|
|
|
if (ii_compatparams != -1)
|
|
|
|
{
|
|
|
|
unsigned i = ii_compatparams;
|
|
|
|
|
|
|
|
while (CompatParams[i] != CP_END && i < CompatParams.Size())
|
|
|
|
{
|
|
|
|
switch (CompatParams[i])
|
|
|
|
{
|
|
|
|
case CP_CLEARFLAGS:
|
|
|
|
{
|
|
|
|
if (CompatParams[i+1] < numlines)
|
|
|
|
{
|
|
|
|
line_t *line = &lines[CompatParams[i+1]];
|
|
|
|
line->flags &= ~CompatParams[i+2];
|
|
|
|
}
|
|
|
|
i+=3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CP_SETFLAGS:
|
|
|
|
{
|
|
|
|
if (CompatParams[i+1] < numlines)
|
|
|
|
{
|
|
|
|
line_t *line = &lines[CompatParams[i+1]];
|
|
|
|
line->flags |= CompatParams[i+2];
|
|
|
|
}
|
|
|
|
i+=3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CP_SETSPECIAL:
|
|
|
|
{
|
|
|
|
if (CompatParams[i+1] < numlines)
|
|
|
|
{
|
|
|
|
line_t *line = &lines[CompatParams[i+1]];
|
|
|
|
line->special = CompatParams[i+2];
|
|
|
|
for(int ii=0;ii<5;ii++)
|
|
|
|
{
|
|
|
|
line->args[ii] = CompatParams[i+ii+3];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i+=8;
|
|
|
|
break;
|
|
|
|
}
|
2012-03-15 23:41:44 +00:00
|
|
|
case CP_CLEARSPECIAL:
|
|
|
|
{
|
|
|
|
if (CompatParams[i+1] < numlines)
|
|
|
|
{
|
|
|
|
line_t *line = &lines[CompatParams[i+1]];
|
|
|
|
line->special = 0;
|
|
|
|
memset(line->args, 0, sizeof(line->args));
|
|
|
|
}
|
|
|
|
i += 2;
|
|
|
|
break;
|
|
|
|
}
|
2012-03-15 20:33:33 +00:00
|
|
|
case CP_SETACTIVATION:
|
|
|
|
{
|
|
|
|
if (CompatParams[i+1] < numlines)
|
|
|
|
{
|
|
|
|
line_t *line = &lines[CompatParams[i+1]];
|
|
|
|
line->activation = CompatParams[i+2];
|
|
|
|
}
|
|
|
|
i += 3;
|
|
|
|
break;
|
|
|
|
}
|
2013-01-23 04:48:33 +00:00
|
|
|
case CP_SECTORFLOOROFFSET:
|
|
|
|
{
|
|
|
|
if (CompatParams[i+1] < numsectors)
|
|
|
|
{
|
|
|
|
sector_t *sec = §ors[CompatParams[i+1]];
|
|
|
|
sec->floorplane.ChangeHeight(CompatParams[i+2]);
|
|
|
|
sec->ChangePlaneTexZ(sector_t::floor, CompatParams[i+2]);
|
|
|
|
}
|
|
|
|
i += 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CP_SETWALLYSCALE:
|
|
|
|
{
|
|
|
|
if (CompatParams[i+1] < numlines)
|
|
|
|
{
|
|
|
|
side_t *side = lines[CompatParams[i+1]].sidedef[CompatParams[i+2]];
|
|
|
|
if (side != NULL)
|
|
|
|
{
|
|
|
|
side->SetTextureYScale(CompatParams[i+3], CompatParams[i+4]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i += 5;
|
|
|
|
break;
|
|
|
|
}
|
2013-06-25 21:36:24 +00:00
|
|
|
case CP_SETTHINGZ:
|
|
|
|
{
|
|
|
|
// When this is called, the things haven't been spawned yet so we can alter the position inside the MapThings array.
|
2013-06-25 22:50:50 +00:00
|
|
|
if ((unsigned)CompatParams[i+1] < MapThingsConverted.Size())
|
2013-06-25 21:36:24 +00:00
|
|
|
{
|
|
|
|
MapThingsConverted[CompatParams[i+1]].z = CompatParams[i+2];
|
|
|
|
}
|
|
|
|
i += 3;
|
|
|
|
break;
|
|
|
|
}
|
2014-09-08 20:54:56 +00:00
|
|
|
case CP_SETTAG:
|
|
|
|
{
|
|
|
|
if ((unsigned)CompatParams[i + 1] < (unsigned)numsectors)
|
|
|
|
{
|
|
|
|
sectors[CompatParams[i + 1]].tag = CompatParams[i + 2];
|
|
|
|
}
|
2014-09-08 21:25:27 +00:00
|
|
|
i += 3;
|
2014-09-08 20:54:56 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-04-11 11:18:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-05 02:55:28 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD mapchecksum
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (mapchecksum)
|
|
|
|
{
|
|
|
|
MapData *map;
|
|
|
|
BYTE cksum[16];
|
|
|
|
|
|
|
|
if (argv.argc() < 2)
|
|
|
|
{
|
|
|
|
Printf("Usage: mapchecksum <map> ...\n");
|
|
|
|
}
|
2009-02-05 04:18:08 +00:00
|
|
|
for (int i = 1; i < argv.argc(); ++i)
|
2009-02-05 02:55:28 +00:00
|
|
|
{
|
2013-08-31 03:38:57 +00:00
|
|
|
map = P_OpenMapData(argv[i], true);
|
2009-02-05 02:55:28 +00:00
|
|
|
if (map == NULL)
|
|
|
|
{
|
|
|
|
Printf("Cannot load %s as a map\n", argv[i]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
map->GetChecksum(cksum);
|
|
|
|
delete map;
|
2009-02-05 04:18:08 +00:00
|
|
|
for (size_t j = 0; j < sizeof(cksum); ++j)
|
2009-02-05 02:55:28 +00:00
|
|
|
{
|
|
|
|
Printf("%02X", cksum[j]);
|
|
|
|
}
|
|
|
|
Printf(" // %s\n", argv[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CCMD hiddencompatflags
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (hiddencompatflags)
|
|
|
|
{
|
2011-11-01 02:58:52 +00:00
|
|
|
Printf("%08x %08x %08x\n", ii_compatflags, ii_compatflags2, ib_compatflags);
|
2009-02-05 02:55:28 +00:00
|
|
|
}
|