mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
- Added a compatibility lump because I think it's a shame that Void doesn't
work properly on new ZDooms after all the collaboration I had with Cyb on that map. (Works with other maps, too.) SVN r1402 (trunk)
This commit is contained in:
parent
84c5c7d38e
commit
4e509728a0
16 changed files with 1129 additions and 380 deletions
|
@ -1,3 +1,8 @@
|
|||
February 4, 2009
|
||||
- Added a compatibility lump because I think it's a shame that Void doesn't
|
||||
work properly on new ZDooms after all the collaboration I had with Cyb on
|
||||
that map. (Works with other maps, too.)
|
||||
|
||||
February 5, 2009 (Changes by Graf Zahl)
|
||||
- Made improvements so that the FOptionalMapinfoData class is easier to use.
|
||||
|
||||
|
|
246
src/compatibility.cpp
Normal file
246
src/compatibility.cpp
Normal file
|
@ -0,0 +1,246 @@
|
|||
/*
|
||||
** 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"
|
||||
#include "doomstat.h"
|
||||
#include "c_dispatch.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
struct FCompatOption
|
||||
{
|
||||
const char *Name;
|
||||
int CompatFlags;
|
||||
int BCompatFlags;
|
||||
};
|
||||
|
||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||
|
||||
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
||||
|
||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||
|
||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
TMap<FMD5Holder, FCompatValues, FMD5HashTraits> BCompatMap;
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static FCompatOption Options[] =
|
||||
{
|
||||
{ "setslopeoverflow", 0, BCOMPATF_SETSLOPEOVERFLOW },
|
||||
{ "resetplayerspeed", 0, BCOMPATF_RESETPLAYERSPEED },
|
||||
|
||||
// list copied from g_mapinfo.cpp
|
||||
{ "shorttex", COMPATF_SHORTTEX, 0 },
|
||||
{ "stairs", COMPATF_STAIRINDEX, 0 },
|
||||
{ "limitpain", COMPATF_LIMITPAIN, 0 },
|
||||
{ "nopassover", COMPATF_NO_PASSMOBJ, 0 },
|
||||
{ "notossdrops", COMPATF_NOTOSSDROPS, 0 },
|
||||
{ "useblocking", COMPATF_USEBLOCKING, 0 },
|
||||
{ "nodoorlight", COMPATF_NODOORLIGHT, 0 },
|
||||
{ "ravenscroll", COMPATF_RAVENSCROLL, 0 },
|
||||
{ "soundtarget", COMPATF_SOUNDTARGET, 0 },
|
||||
{ "dehhealth", COMPATF_DEHHEALTH, 0 },
|
||||
{ "trace", COMPATF_TRACE, 0 },
|
||||
{ "dropoff", COMPATF_DROPOFF, 0 },
|
||||
{ "boomscroll", COMPATF_BOOMSCROLL, 0 },
|
||||
{ "invisibility", COMPATF_INVISIBILITY, 0 },
|
||||
{ "silentinstantfloors", COMPATF_SILENT_INSTANT_FLOORS, 0 },
|
||||
{ "sectorsounds", COMPATF_SECTORSOUNDS, 0 },
|
||||
{ "missileclip", COMPATF_MISSILECLIP, 0 },
|
||||
{ "crossdropoff", COMPATF_CROSSDROPOFF, 0 },
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ParseCompatibility
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void ParseCompatibility()
|
||||
{
|
||||
TArray<FMD5Holder> md5array;
|
||||
FMD5Holder md5;
|
||||
FCompatValues flags;
|
||||
int i, x;
|
||||
unsigned int j;
|
||||
|
||||
// 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
|
||||
{
|
||||
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("{"));
|
||||
flags.CompatFlags = 0;
|
||||
flags.BCompatFlags = 0;
|
||||
while (sc.MustGetString(), (i = sc.MatchString(&Options[0].Name, sizeof(*Options))) >= 0)
|
||||
{
|
||||
flags.CompatFlags |= Options[i].CompatFlags;
|
||||
flags.BCompatFlags |= Options[i].BCompatFlags;
|
||||
}
|
||||
sc.UnGet();
|
||||
sc.MustGetStringName("}");
|
||||
for (j = 0; j < md5array.Size(); ++j)
|
||||
{
|
||||
BCompatMap[md5array[j]] = flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CheckCompatibility
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void CheckCompatibility(MapData *map)
|
||||
{
|
||||
FMD5Holder md5;
|
||||
FCompatValues *flags;
|
||||
|
||||
map->GetChecksum(md5.Bytes);
|
||||
flags = BCompatMap.CheckKey(md5);
|
||||
if (flags != NULL)
|
||||
{
|
||||
ii_compatflags = flags->CompatFlags;
|
||||
ib_compatflags = flags->BCompatFlags;
|
||||
}
|
||||
else
|
||||
{
|
||||
ii_compatflags = 0;
|
||||
ib_compatflags = 0;
|
||||
}
|
||||
// Reset i_compatflags
|
||||
compatflags = compatflags;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CCMD mapchecksum
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
CCMD (mapchecksum)
|
||||
{
|
||||
MapData *map;
|
||||
BYTE cksum[16];
|
||||
|
||||
if (argv.argc() < 2)
|
||||
{
|
||||
Printf("Usage: mapchecksum <map> ...\n");
|
||||
}
|
||||
for (unsigned int i = 1; i < argv.argc(); ++i)
|
||||
{
|
||||
map = P_OpenMapData(argv[i]);
|
||||
if (map == NULL)
|
||||
{
|
||||
Printf("Cannot load %s as a map\n", argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
map->GetChecksum(cksum);
|
||||
delete map;
|
||||
for (int j = 0; j < sizeof(cksum); ++j)
|
||||
{
|
||||
Printf("%02X", cksum[j]);
|
||||
}
|
||||
Printf(" // %s\n", argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CCMD hiddencompatflags
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
CCMD (hiddencompatflags)
|
||||
{
|
||||
Printf("%08x %08x\n", ii_compatflags, ib_compatflags);
|
||||
}
|
40
src/compatibility.h
Normal file
40
src/compatibility.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
#ifndef COMPATIBILITY_H
|
||||
#define COMPATIBILITY_H
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "tarray.h"
|
||||
#include "p_setup.h"
|
||||
|
||||
union FMD5Holder
|
||||
{
|
||||
BYTE Bytes[16];
|
||||
DWORD DWords[4];
|
||||
};
|
||||
|
||||
struct FCompatValues
|
||||
{
|
||||
int CompatFlags;
|
||||
int BCompatFlags;
|
||||
};
|
||||
|
||||
struct FMD5HashTraits
|
||||
{
|
||||
hash_t Hash(const FMD5Holder key)
|
||||
{
|
||||
return *(hash_t *)key.Bytes;
|
||||
}
|
||||
int Compare(const FMD5Holder left, const FMD5Holder right)
|
||||
{
|
||||
return left.DWords[0] != right.DWords[0] ||
|
||||
left.DWords[1] != right.DWords[1] ||
|
||||
left.DWords[2] != right.DWords[2] ||
|
||||
left.DWords[3] != right.DWords[3];
|
||||
}
|
||||
};
|
||||
|
||||
extern TMap<FMD5Holder, FCompatValues, FMD5HashTraits> BCompatMap;
|
||||
|
||||
void ParseCompatibility();
|
||||
void CheckCompatibility(MapData *map);
|
||||
|
||||
#endif
|
|
@ -100,6 +100,7 @@
|
|||
#include "d_netinf.h"
|
||||
#include "v_palette.h"
|
||||
#include "m_cheat.h"
|
||||
#include "compatibility.h"
|
||||
|
||||
EXTERN_CVAR(Bool, hud_althud)
|
||||
void DrawHUD();
|
||||
|
@ -509,6 +510,7 @@ CVAR (Flag, sv_noautoaim, dmflags2, DF2_NOAUTOAIM);
|
|||
//==========================================================================
|
||||
|
||||
int i_compatflags; // internal compatflags composed from the compatflags CVAR and MAPINFO settings
|
||||
int ii_compatflags, ib_compatflags;
|
||||
|
||||
EXTERN_CVAR(Int, compatmode)
|
||||
|
||||
|
@ -520,7 +522,7 @@ static int GetCompatibility(int mask)
|
|||
|
||||
CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
||||
{
|
||||
i_compatflags = GetCompatibility(self);
|
||||
i_compatflags = GetCompatibility(self) | ii_compatflags;
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_SERVERINFO|CVAR_NOINITCALL)
|
||||
|
@ -2366,6 +2368,8 @@ void D_DoomMain (void)
|
|||
Printf ("ST_Init: Init startup screen.\n");
|
||||
StartScreen = FStartupScreen::CreateInstance (R_GuesstimateNumTextures() + 5);
|
||||
|
||||
ParseCompatibility();
|
||||
|
||||
Printf ("P_Init: Checking cmd-line parameters...\n");
|
||||
flags = dmflags;
|
||||
if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS;
|
||||
|
|
|
@ -282,6 +282,14 @@ enum
|
|||
COMPATF_CROSSDROPOFF = 1 << 20, // monsters can't be pushed over dropoffs
|
||||
};
|
||||
|
||||
// Emulate old bugs for select maps. These are not exposed by a cvar
|
||||
// or mapinfo because we do not want new maps to use these bugs.
|
||||
enum
|
||||
{
|
||||
BCOMPATF_SETSLOPEOVERFLOW = 1 << 0, // SetSlope things can overflow
|
||||
BCOMPATF_RESETPLAYERSPEED = 1 << 1, // Set player speed to 1.0 when changing maps
|
||||
};
|
||||
|
||||
// phares 3/20/98:
|
||||
//
|
||||
// Player friction is variable, based on controlling
|
||||
|
|
|
@ -249,6 +249,6 @@ EXTERN_CVAR (Int, dmflags);
|
|||
EXTERN_CVAR (Int, dmflags2); // [BC]
|
||||
|
||||
EXTERN_CVAR (Int, compatflags);
|
||||
extern int i_compatflags;
|
||||
extern int i_compatflags, ii_compatflags, ib_compatflags;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1185,6 +1185,10 @@ void G_FinishTravel ()
|
|||
inv->LinkToWorld ();
|
||||
inv->Travelled ();
|
||||
}
|
||||
if (ib_compatflags & BCOMPATF_RESETPLAYERSPEED)
|
||||
{
|
||||
pawn->Speed = pawn->GetDefault()->Speed;
|
||||
}
|
||||
if (level.FromSnapshot)
|
||||
{
|
||||
FBehavior::StaticStartTypedScripts (SCRIPT_Return, pawn, true);
|
||||
|
|
294
src/md5.cpp
Normal file
294
src/md5.cpp
Normal file
|
@ -0,0 +1,294 @@
|
|||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
#include <string.h> /* for memcpy() */
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "md5.h"
|
||||
#include "templates.h"
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
void byteSwap(DWORD *buf, unsigned words)
|
||||
{
|
||||
BYTE *p = (BYTE *)buf;
|
||||
|
||||
do {
|
||||
*buf++ = (DWORD)((unsigned)p[3] << 8 | p[2]) << 16 |
|
||||
((unsigned)p[1] << 8 | p[0]);
|
||||
p += 4;
|
||||
} while (--words);
|
||||
}
|
||||
#else
|
||||
#define byteSwap(buf,words)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void MD5Context::Init()
|
||||
{
|
||||
buf[0] = 0x67452301;
|
||||
buf[1] = 0xefcdab89;
|
||||
buf[2] = 0x98badcfe;
|
||||
buf[3] = 0x10325476;
|
||||
|
||||
bytes[0] = 0;
|
||||
bytes[1] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Context::Update(const BYTE *buf, unsigned len)
|
||||
{
|
||||
DWORD t;
|
||||
|
||||
/* Update byte count */
|
||||
|
||||
t = bytes[0];
|
||||
if ((bytes[0] = t + len) < t)
|
||||
bytes[1]++; /* Carry from low to high */
|
||||
|
||||
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
|
||||
if (t > len) {
|
||||
memcpy((BYTE *)in + 64 - t, buf, len);
|
||||
return;
|
||||
}
|
||||
/* First chunk is an odd size */
|
||||
if (t < 64)
|
||||
{
|
||||
memcpy((BYTE *)in + 64 - t, buf, t);
|
||||
byteSwap(in, 16);
|
||||
MD5Transform(this->buf, in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
|
||||
/* Process data in 64-byte chunks */
|
||||
while (len >= 64)
|
||||
{
|
||||
memcpy(in, buf, 64);
|
||||
byteSwap(in, 16);
|
||||
MD5Transform(this->buf, in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
memcpy(in, buf, len);
|
||||
}
|
||||
|
||||
void MD5Context::Update(FileReader *file, unsigned len)
|
||||
{
|
||||
BYTE readbuf[8192];
|
||||
long t;
|
||||
|
||||
while (len != 0)
|
||||
{
|
||||
t = MIN(len, sizeof(readbuf));
|
||||
len -= t;
|
||||
t = file->Read(readbuf, t);
|
||||
Update(readbuf, t);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void MD5Context::Final(BYTE digest[16])
|
||||
{
|
||||
int count = bytes[0] & 0x3f; /* Number of bytes in ctx->in */
|
||||
BYTE *p = (BYTE *)in + count;
|
||||
|
||||
/* Set the first char of padding to 0x80. There is always room. */
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 56 bytes (-8..55) */
|
||||
count = 56 - 1 - count;
|
||||
|
||||
if (count < 0) /* Padding forces an extra block */
|
||||
{
|
||||
memset(p, 0, count + 8);
|
||||
byteSwap(in, 16);
|
||||
MD5Transform(buf, in);
|
||||
p = (BYTE *)in;
|
||||
count = 56;
|
||||
}
|
||||
memset(p, 0, count);
|
||||
byteSwap(in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
in[14] = bytes[0] << 3;
|
||||
in[15] = (bytes[1] << 3) | (bytes[0] >> 29);
|
||||
MD5Transform(buf, in);
|
||||
|
||||
byteSwap(buf, 4);
|
||||
memcpy(digest, buf, 16);
|
||||
memset(this, 0, sizeof(*this)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
#ifndef ASM_MD5
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f,w,x,y,z,in,s) \
|
||||
(w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void
|
||||
MD5Transform(DWORD buf[4], const DWORD in[16])
|
||||
{
|
||||
register DWORD a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#include "c_dispatch.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CCMD md5sum
|
||||
//
|
||||
// Like the command-line tool, because I wanted to make sure I had it right.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
CCMD (md5sum)
|
||||
{
|
||||
if (argv.argc() < 2)
|
||||
{
|
||||
Printf("Usage: md5sum <file> ...\n");
|
||||
}
|
||||
for (int i = 1; i < argv.argc(); ++i)
|
||||
{
|
||||
FILE *file = fopen(argv[i], "rb");
|
||||
if (file == NULL)
|
||||
{
|
||||
Printf("%s: %s\n", argv[i], strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
MD5Context md5;
|
||||
BYTE readbuf[8192];
|
||||
size_t len;
|
||||
|
||||
while ((len = fread(readbuf, 1, sizeof(readbuf), file)) > 0)
|
||||
{
|
||||
md5.Update(readbuf, (unsigned int)len);
|
||||
}
|
||||
md5.Final(readbuf);
|
||||
for(int j = 0; j < 16; ++j)
|
||||
{
|
||||
Printf("%02x", readbuf[j]);
|
||||
}
|
||||
Printf(" *%s\n", argv[i]);
|
||||
fclose (file);
|
||||
}
|
||||
}
|
||||
}
|
41
src/md5.h
Normal file
41
src/md5.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* This is the header file for the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
#include "files.h"
|
||||
|
||||
struct MD5Context
|
||||
{
|
||||
MD5Context() { Init(); }
|
||||
|
||||
void Init();
|
||||
void Update(const BYTE *buf, unsigned len);
|
||||
void Update(FileReader *file, unsigned len);
|
||||
void Final(BYTE digest[16]);
|
||||
|
||||
private:
|
||||
DWORD buf[4];
|
||||
DWORD bytes[2];
|
||||
DWORD in[16];
|
||||
|
||||
};
|
||||
|
||||
void MD5Transform(DWORD buf[4], DWORD const in[16]);
|
||||
|
||||
#endif /* !MD5_H */
|
|
@ -3762,7 +3762,6 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer)
|
|||
if (sectors[i].SoundTarget == oldactor) sectors[i].SoundTarget = NULL;
|
||||
}
|
||||
|
||||
|
||||
DObject::StaticPointerSubstitution (oldactor, p->mo);
|
||||
// PointerSubstitution() will also affect the bodyque, so undo that now.
|
||||
for (int ii=0; ii < BODYQUESIZE; ++ii)
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
#include "r_sky.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_level.h"
|
||||
#include "md5.h"
|
||||
#include "compatibility.h"
|
||||
|
||||
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt);
|
||||
void P_SetSlopes ();
|
||||
|
@ -510,6 +512,51 @@ bool P_CheckMapData(const char *mapname)
|
|||
return true;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// MapData :: GetChecksum
|
||||
//
|
||||
// Hashes a map based on its header, THINGS, LINEDEFS, SIDEDEFS, SECTORS,
|
||||
// and BEHAVIOR lumps. Node-builder generated lumps are not included.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void MapData::GetChecksum(BYTE cksum[16])
|
||||
{
|
||||
MD5Context md5;
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
if (isText)
|
||||
{
|
||||
file->Seek(MapLumps[ML_TEXTMAP].FilePos, SEEK_SET);
|
||||
md5.Update(file, MapLumps[ML_TEXTMAP].Size);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MapLumps[ML_LABEL].Size != 0)
|
||||
{
|
||||
file->Seek(MapLumps[ML_LABEL].FilePos, SEEK_SET);
|
||||
md5.Update(file, MapLumps[ML_LABEL].Size);
|
||||
}
|
||||
file->Seek(MapLumps[ML_THINGS].FilePos, SEEK_SET);
|
||||
md5.Update(file, MapLumps[ML_THINGS].Size);
|
||||
file->Seek(MapLumps[ML_LINEDEFS].FilePos, SEEK_SET);
|
||||
md5.Update(file, MapLumps[ML_LINEDEFS].Size);
|
||||
file->Seek(MapLumps[ML_SIDEDEFS].FilePos, SEEK_SET);
|
||||
md5.Update(file, MapLumps[ML_SIDEDEFS].Size);
|
||||
file->Seek(MapLumps[ML_SECTORS].FilePos, SEEK_SET);
|
||||
md5.Update(file, MapLumps[ML_SECTORS].Size);
|
||||
}
|
||||
if (HasBehavior)
|
||||
{
|
||||
file->Seek(MapLumps[ML_BEHAVIOR].FilePos, SEEK_SET);
|
||||
md5.Update(file, MapLumps[ML_BEHAVIOR].Size);
|
||||
}
|
||||
}
|
||||
md5.Final(cksum);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// [RH] Figure out blends for deep water sectors
|
||||
|
@ -3301,6 +3348,9 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
{
|
||||
// note: most of this ordering is important
|
||||
ForceNodeBuild = gennodes;
|
||||
|
||||
CheckCompatibility(map);
|
||||
|
||||
// [RH] Load in the BEHAVIOR lump
|
||||
FBehavior::StaticUnloadModules ();
|
||||
if (map->HasBehavior)
|
||||
|
|
|
@ -80,6 +80,8 @@ struct MapData
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GetChecksum(BYTE cksum[16]);
|
||||
};
|
||||
|
||||
MapData * P_OpenMapData(const char * mapname);
|
||||
|
|
|
@ -178,8 +178,16 @@ void P_SetSlope (secplane_t *plane, bool setCeil, int xyangi, int zangi,
|
|||
|
||||
FVector3 norm;
|
||||
|
||||
norm[0] = float(finecosine[zang]) * float(finecosine[xyang]);
|
||||
norm[1] = float(finecosine[zang]) * float(finesine[xyang]);
|
||||
if (ib_compatflags & BCOMPATF_SETSLOPEOVERFLOW)
|
||||
{
|
||||
norm[0] = float(finecosine[zang] * finecosine[xyang]);
|
||||
norm[1] = float(finecosine[zang] * finesine[xyang]);
|
||||
}
|
||||
else
|
||||
{
|
||||
norm[0] = float(finecosine[zang]) * float(finecosine[xyang]);
|
||||
norm[1] = float(finecosine[zang]) * float(finesine[xyang]);
|
||||
}
|
||||
norm[2] = float(finesine[zang]) * 65536.f;
|
||||
norm.MakeUnit();
|
||||
plane->a = (int)(norm[0] * 65536.f);
|
||||
|
|
|
@ -398,7 +398,7 @@ template<class KT> struct THashTraits
|
|||
|
||||
template<class VT> struct TValueTraits
|
||||
{
|
||||
// Initializes a value for TMap. If a regular consructor isn't
|
||||
// Initializes a value for TMap. If a regular constructor isn't
|
||||
// good enough, you can override it.
|
||||
void Init(VT &value)
|
||||
{
|
||||
|
|
32
wadsrc/static/compatibility.txt
Normal file
32
wadsrc/static/compatibility.txt
Normal file
|
@ -0,0 +1,32 @@
|
|||
6DC9F6CCEAE7A91AEC48EBE506F22BC4 // void.wad MAP01
|
||||
{
|
||||
setslopeoverflow
|
||||
}
|
||||
|
||||
B2D8DA03489D1C67F60DC87FBC4EA338 // map01 - Massmouth 2
|
||||
801304DA3784308D333951B5E0CF8E9E // map02
|
||||
6EA4D5CAEA16857B2A882467E1633BC2 // map03
|
||||
A4E01929938958BB9DA9EF3066802184 // map04
|
||||
54F4B897BAA50F070CECA25555031C15 // map05
|
||||
BB93EA15CA068FBC7E0381E4E959207C // map06
|
||||
960397183E44D26212E8876681D2801D // map07
|
||||
E4D05765BDB5BF9D22F0548E2807BAE9 // map08
|
||||
696203E7A2C8A14C00F8824F74BD3D53 // map09
|
||||
EEFB83ABB26A473382FAA063CF120501 // map10
|
||||
FD031167E57BD1EEB65279F5895300F2 // map11
|
||||
9C69328D5B82392DEA1C0552CF283F38 // map12
|
||||
16569BB1F80D52304319DDD0C2DE4B5A // map13
|
||||
1760E2F04B4E2C5CDD235855FCAB8327 // map14
|
||||
A80E7EE40E0D0C76A6FBD242BE29FE27 // map15
|
||||
2F1F8E27FBB5EF21AFBE1F3B13C03037 // map16
|
||||
1CE294781A2455DE72C197E0B3DF6212 // map31
|
||||
{
|
||||
resetplayerspeed
|
||||
}
|
||||
|
||||
10E1E2B36302D31AC4AE68C84B5DC457 // Eternal Doom MAP28
|
||||
{
|
||||
// What's really sad is that I got a separate bug report for this map
|
||||
// years ago, but nobody made mention of this problem back then.
|
||||
trace
|
||||
}
|
764
zdoom.vcproj
764
zdoom.vcproj
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue