- Added compat_badangles to simulate Doom's incorrect sine table: Player

spawning and teleporting will be offset by one fineangle so they cannot
  face directly in one of the cardinal directions.



SVN r3308 (trunk)
This commit is contained in:
Randy Heit 2011-11-01 02:58:52 +00:00
parent c23b918596
commit e121bd7d92
10 changed files with 149 additions and 90 deletions

View file

@ -59,7 +59,14 @@ struct FCompatOption
{
const char *Name;
int CompatFlags;
int BCompatFlags;
int WhichSlot;
};
enum
{
SLOT_COMPAT,
SLOT_COMPAT2,
SLOT_BCOMPAT
};
enum
@ -86,41 +93,43 @@ TMap<FMD5Holder, FCompatValues, FMD5HashTraits> BCompatMap;
static FCompatOption Options[] =
{
{ "setslopeoverflow", 0, BCOMPATF_SETSLOPEOVERFLOW },
{ "resetplayerspeed", 0, BCOMPATF_RESETPLAYERSPEED },
{ "vileghosts", 0, BCOMPATF_VILEGHOSTS },
{ "ignoreteleporttags", 0, BCOMPATF_BADTELEPORTERS },
{ "setslopeoverflow", BCOMPATF_SETSLOPEOVERFLOW, SLOT_BCOMPAT },
{ "resetplayerspeed", BCOMPATF_RESETPLAYERSPEED, SLOT_BCOMPAT },
{ "vileghosts", BCOMPATF_VILEGHOSTS, SLOT_BCOMPAT },
{ "ignoreteleporttags", BCOMPATF_BADTELEPORTERS, SLOT_BCOMPAT },
// 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 },
{ "wallrun", COMPATF_WALLRUN, 0 }, // [GZ] Added for CC MAP29
{ "anybossdeath", COMPATF_ANYBOSSDEATH, 0}, // [GZ] Added for UAC_DEAD
{ "mushroom", COMPATF_MUSHROOM, 0},
{ "mbfmonstermove", COMPATF_MBFMONSTERMOVE, 0 },
{ "corpsegibs", COMPATF_CORPSEGIBS, 0 },
{ "noblockfriends", COMPATF_NOBLOCKFRIENDS, 0 },
{ "spritesort", COMPATF_SPRITESORT, 0 },
{ "hitscan", COMPATF_HITSCAN, 0 },
{ "lightlevel", COMPATF_LIGHT, 0 },
{ "polyobj", COMPATF_POLYOBJ, 0 },
{ "maskedmidtex", COMPATF_MASKEDMIDTEX, 0 },
{ "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 },
{ NULL, 0, 0 }
};
@ -189,15 +198,13 @@ void ParseCompatibility()
md5array.Push(md5);
sc.MustGetString();
} while (!sc.Compare("{"));
flags.CompatFlags = 0;
flags.BCompatFlags = 0;
memset(flags.CompatFlags, 0, sizeof(flags.CompatFlags));
flags.ExtCommandIndex = ~0u;
while (sc.GetString())
{
if ((i = sc.MatchString(&Options[0].Name, sizeof(*Options))) >= 0)
{
flags.CompatFlags |= Options[i].CompatFlags;
flags.BCompatFlags |= Options[i].BCompatFlags;
flags.CompatFlags[Options[i].WhichSlot] |= Options[i].CompatFlags;
}
else if (sc.Compare("clearlineflags"))
{
@ -226,7 +233,7 @@ void ParseCompatibility()
sc.MustGetString();
CompatParams.Push(P_FindLineSpecial(sc.String, NULL, NULL));
for(int i=0;i<5;i++)
for (int i = 0; i < 5; i++)
{
sc.MustGetNumber();
CompatParams.Push(sc.Number);
@ -269,18 +276,21 @@ void CheckCompatibility(MapData *map)
{
ii_compatflags = COMPATF_SHORTTEX|COMPATF_LIGHT;
if (gameinfo.flags & GI_COMPATSTAIRS) ii_compatflags |= COMPATF_STAIRINDEX;
ii_compatflags2 = 0;
ib_compatflags = 0;
ii_compatparams = -1;
}
else if (Wads.GetLumpFile(map->lumpnum) == 1 && (gameinfo.flags & GI_COMPATPOLY1) && Wads.CheckLumpName(map->lumpnum, "MAP36"))
{
ii_compatflags = COMPATF_POLYOBJ;
ii_compatflags2 = 0;
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;
ii_compatflags2 = 0;
ib_compatflags = 0;
ii_compatparams = -1;
}
@ -297,25 +307,35 @@ void CheckCompatibility(MapData *map)
{
Printf("%02X", md5.Bytes[j]);
}
if (flags != NULL) Printf(", cflags = %08x, bflags = %08x\n", flags->CompatFlags, flags->BCompatFlags);
else Printf("\n");
if (flags != NULL)
{
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)
{
ii_compatflags = flags->CompatFlags;
ib_compatflags = flags->BCompatFlags;
ii_compatflags = flags->CompatFlags[SLOT_COMPAT];
ii_compatflags2 = flags->CompatFlags[SLOT_COMPAT2];
ib_compatflags = flags->CompatFlags[SLOT_BCOMPAT];
ii_compatparams = flags->ExtCommandIndex;
}
else
{
ii_compatflags = 0;
ii_compatflags2 = 0;
ib_compatflags = 0;
ii_compatparams = -1;
}
}
// Reset i_compatflags
compatflags.Callback();
compatflags2.Callback();
}
//==========================================================================
@ -416,5 +436,5 @@ CCMD (mapchecksum)
CCMD (hiddencompatflags)
{
Printf("%08x %08x\n", ii_compatflags, ib_compatflags);
Printf("%08x %08x %08x\n", ii_compatflags, ii_compatflags2, ib_compatflags);
}

View file

@ -14,8 +14,7 @@ union FMD5Holder
struct FCompatValues
{
int CompatFlags;
int BCompatFlags;
int CompatFlags[3];
unsigned int ExtCommandIndex;
};

View file

@ -515,8 +515,8 @@ CVAR (Flag, sv_nocountendmonst, dmflags2, DF2_NOCOUNTENDMONST);
//
//==========================================================================
int i_compatflags; // internal compatflags composed from the compatflags CVAR and MAPINFO settings
int ii_compatflags, ib_compatflags;
int i_compatflags, i_compatflags2; // internal compatflags composed from the compatflags CVAR and MAPINFO settings
int ii_compatflags, ii_compatflags2, ib_compatflags;
EXTERN_CVAR(Int, compatmode)
@ -526,19 +526,30 @@ static int GetCompatibility(int mask)
else return (mask & ~level.info->compatmask) | (level.info->compatflags & level.info->compatmask);
}
static int GetCompatibility2(int mask)
{
return (level.info == NULL) ? mask
: (mask & ~level.info->compatmask2) | (level.info->compatflags2 & level.info->compatmask2);
}
CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
{
int old = i_compatflags;
i_compatflags = GetCompatibility(self) | ii_compatflags;
if ((old ^i_compatflags) & COMPATF_POLYOBJ)
if ((old ^ i_compatflags) & COMPATF_POLYOBJ)
{
FPolyObj::ClearAllSubsectorLinks();
}
}
CUSTOM_CVAR (Int, compatflags2, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
{
i_compatflags2 = GetCompatibility2(self) | ii_compatflags2;
}
CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
{
int v;
int v, w = 0;
switch (self)
{
@ -558,6 +569,7 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_NO_PASSMOBJ|COMPATF_LIMITPAIN|
COMPATF_DEHHEALTH|COMPATF_INVISIBILITY|COMPATF_CROSSDROPOFF|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|
COMPATF_WALLRUN|COMPATF_NOTOSSDROPS|COMPATF_LIGHT|COMPATF_MASKEDMIDTEX;
w = COMPATF2_BADANGLES;
break;
case 3: // Boom compat mode
@ -580,40 +592,42 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
}
compatflags = v;
compatflags2 = w;
}
CVAR (Flag, compat_shortTex, compatflags, COMPATF_SHORTTEX);
CVAR (Flag, compat_stairs, compatflags, COMPATF_STAIRINDEX);
CVAR (Flag, compat_limitpain, compatflags, COMPATF_LIMITPAIN);
CVAR (Flag, compat_silentpickup,compatflags, COMPATF_SILENTPICKUP);
CVAR (Flag, compat_nopassover, compatflags, COMPATF_NO_PASSMOBJ);
CVAR (Flag, compat_soundslots, compatflags, COMPATF_MAGICSILENCE);
CVAR (Flag, compat_wallrun, compatflags, COMPATF_WALLRUN);
CVAR (Flag, compat_notossdrops, compatflags, COMPATF_NOTOSSDROPS);
CVAR (Flag, compat_useblocking, compatflags, COMPATF_USEBLOCKING);
CVAR (Flag, compat_nodoorlight, compatflags, COMPATF_NODOORLIGHT);
CVAR (Flag, compat_ravenscroll, compatflags, COMPATF_RAVENSCROLL);
CVAR (Flag, compat_soundtarget, compatflags, COMPATF_SOUNDTARGET);
CVAR (Flag, compat_dehhealth, compatflags, COMPATF_DEHHEALTH);
CVAR (Flag, compat_trace, compatflags, COMPATF_TRACE);
CVAR (Flag, compat_dropoff, compatflags, COMPATF_DROPOFF);
CVAR (Flag, compat_boomscroll, compatflags, COMPATF_BOOMSCROLL);
CVAR (Flag, compat_invisibility,compatflags, COMPATF_INVISIBILITY);
CVAR (Flag, compat_silentinstantfloors,compatflags, COMPATF_SILENT_INSTANT_FLOORS);
CVAR (Flag, compat_sectorsounds,compatflags, COMPATF_SECTORSOUNDS);
CVAR (Flag, compat_missileclip, compatflags, COMPATF_MISSILECLIP);
CVAR (Flag, compat_crossdropoff,compatflags, COMPATF_CROSSDROPOFF);
CVAR (Flag, compat_anybossdeath,compatflags, COMPATF_ANYBOSSDEATH);
CVAR (Flag, compat_minotaur, compatflags, COMPATF_MINOTAUR);
CVAR (Flag, compat_mushroom, compatflags, COMPATF_MUSHROOM);
CVAR (Flag, compat_mbfmonstermove,compatflags, COMPATF_MBFMONSTERMOVE);
CVAR (Flag, compat_corpsegibs, compatflags, COMPATF_CORPSEGIBS);
CVAR (Flag, compat_noblockfriends,compatflags,COMPATF_NOBLOCKFRIENDS);
CVAR (Flag, compat_spritesort, compatflags,COMPATF_SPRITESORT);
CVAR (Flag, compat_hitscan, compatflags,COMPATF_HITSCAN);
CVAR (Flag, compat_light, compatflags,COMPATF_LIGHT);
CVAR (Flag, compat_polyobj, compatflags,COMPATF_POLYOBJ);
CVAR (Flag, compat_maskedmidtex,compatflags,COMPATF_MASKEDMIDTEX);
CVAR (Flag, compat_shortTex, compatflags, COMPATF_SHORTTEX);
CVAR (Flag, compat_stairs, compatflags, COMPATF_STAIRINDEX);
CVAR (Flag, compat_limitpain, compatflags, COMPATF_LIMITPAIN);
CVAR (Flag, compat_silentpickup, compatflags, COMPATF_SILENTPICKUP);
CVAR (Flag, compat_nopassover, compatflags, COMPATF_NO_PASSMOBJ);
CVAR (Flag, compat_soundslots, compatflags, COMPATF_MAGICSILENCE);
CVAR (Flag, compat_wallrun, compatflags, COMPATF_WALLRUN);
CVAR (Flag, compat_notossdrops, compatflags, COMPATF_NOTOSSDROPS);
CVAR (Flag, compat_useblocking, compatflags, COMPATF_USEBLOCKING);
CVAR (Flag, compat_nodoorlight, compatflags, COMPATF_NODOORLIGHT);
CVAR (Flag, compat_ravenscroll, compatflags, COMPATF_RAVENSCROLL);
CVAR (Flag, compat_soundtarget, compatflags, COMPATF_SOUNDTARGET);
CVAR (Flag, compat_dehhealth, compatflags, COMPATF_DEHHEALTH);
CVAR (Flag, compat_trace, compatflags, COMPATF_TRACE);
CVAR (Flag, compat_dropoff, compatflags, COMPATF_DROPOFF);
CVAR (Flag, compat_boomscroll, compatflags, COMPATF_BOOMSCROLL);
CVAR (Flag, compat_invisibility, compatflags, COMPATF_INVISIBILITY);
CVAR (Flag, compat_silentinstantfloors, compatflags, COMPATF_SILENT_INSTANT_FLOORS);
CVAR (Flag, compat_sectorsounds, compatflags, COMPATF_SECTORSOUNDS);
CVAR (Flag, compat_missileclip, compatflags, COMPATF_MISSILECLIP);
CVAR (Flag, compat_crossdropoff, compatflags, COMPATF_CROSSDROPOFF);
CVAR (Flag, compat_anybossdeath, compatflags, COMPATF_ANYBOSSDEATH);
CVAR (Flag, compat_minotaur, compatflags, COMPATF_MINOTAUR);
CVAR (Flag, compat_mushroom, compatflags, COMPATF_MUSHROOM);
CVAR (Flag, compat_mbfmonstermove, compatflags, COMPATF_MBFMONSTERMOVE);
CVAR (Flag, compat_corpsegibs, compatflags, COMPATF_CORPSEGIBS);
CVAR (Flag, compat_noblockfriends, compatflags, COMPATF_NOBLOCKFRIENDS);
CVAR (Flag, compat_spritesort, compatflags, COMPATF_SPRITESORT);
CVAR (Flag, compat_hitscan, compatflags, COMPATF_HITSCAN);
CVAR (Flag, compat_light, compatflags, COMPATF_LIGHT);
CVAR (Flag, compat_polyobj, compatflags, COMPATF_POLYOBJ);
CVAR (Flag, compat_maskedmidtex, compatflags, COMPATF_MASKEDMIDTEX);
CVAR (Flag, compat_badangles, compatflags2, COMPATF2_BADANGLES);
//==========================================================================
//

View file

@ -334,6 +334,8 @@ enum
COMPATF_LIGHT = 1 << 29, // Find neighboring light level like Doom
COMPATF_POLYOBJ = 1 << 30, // Draw polyobjects the old fashioned way
COMPATF_MASKEDMIDTEX = 1 << 31, // Ignore compositing when drawing masked midtextures
COMPATF2_BADANGLES = 1 << 0, // It is impossible to face directly NSEW.
};
// Emulate old bugs for select maps. These are not exposed by a cvar

View file

@ -240,6 +240,7 @@ EXTERN_CVAR (Int, dmflags);
EXTERN_CVAR (Int, dmflags2); // [BC]
EXTERN_CVAR (Int, compatflags);
extern int i_compatflags, ii_compatflags, ib_compatflags;
EXTERN_CVAR (Int, compatflags2);
extern int i_compatflags, i_compatflags2, ii_compatflags, ii_compatflags2, ib_compatflags;
#endif

View file

@ -664,6 +664,7 @@ void G_DoCompleted (void)
}
else
{
level_info_t *nextinfo = FindLevelInfo (nextlevel);
wminfo.next = nextinfo->mapname;
wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->pname, FTexture::TEX_MiscPatch)];
@ -1253,6 +1254,7 @@ void G_InitLevelLocals ()
level.skypic2[8] = 0;
compatflags.Callback();
compatflags2.Callback();
NormalLight.ChangeFade (level.fadeto);

View file

@ -299,8 +299,8 @@ struct level_info_t
float aircontrol;
int WarpTrans;
int airsupply;
DWORD compatflags;
DWORD compatmask;
DWORD compatflags, compatflags2;
DWORD compatmask, compatmask2;
FString Translator; // for converting Doom-format linedef and sector types.
int DefaultEnvironment; // Default sound environment for the map.
FName Intermission;
@ -561,6 +561,7 @@ struct FSkillInfo
bool FastMonsters;
bool DisableCheats;
bool AutoUseHealth;
bool EasyBossBrain;
int RespawnCounter;
int RespawnLimit;

View file

@ -254,8 +254,8 @@ void level_info_t::Reset()
aircontrol = 0.f;
WarpTrans = 0;
airsupply = 20;
compatflags = 0;
compatmask = 0;
compatflags = compatflags2 = 0;
compatmask = compatmask2 = 0;
Translator = "";
RedirectType = 0;
RedirectMap[0] = 0;
@ -1272,6 +1272,7 @@ MapFlagHandlers[] =
{ "compat_light", MITYPE_COMPATFLAG, COMPATF_LIGHT, 0 },
{ "compat_polyobj", MITYPE_COMPATFLAG, COMPATF_POLYOBJ, 0 },
{ "compat_maskedmidtex", MITYPE_COMPATFLAG, COMPATF_MASKEDMIDTEX, 0 },
{ "compat_badangles", MITYPE_COMPATFLAG, 0, COMPATF2_BADANGLES },
{ "cd_start_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end1_track", MITYPE_EATNEXT, 0, 0 },
{ "cd_end2_track", MITYPE_EATNEXT, 0, 0 },
@ -1353,9 +1354,18 @@ void FMapInfoParser::ParseMapDefinition(level_info_t &info)
if (sc.CheckNumber()) set = sc.Number;
}
if (set) info.compatflags |= handler->data1;
else info.compatflags &= ~handler->data1;
if (set)
{
info.compatflags |= handler->data1;
info.compatflags2 |= handler->data2;
}
else
{
info.compatflags &= ~handler->data1;
info.compatflags2 &= ~handler->data2;
}
info.compatmask |= handler->data1;
info.compatmask2 |= handler->data2;
}
break;

View file

@ -1871,6 +1871,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
goto explode;
}
// Reflect the missile along angle
mo->angle = angle;
angle >>= ANGLETOFINESHIFT;
@ -3950,6 +3951,10 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer)
{
spawn_angle = ANG45 * (mthing->angle / 45);
}
if (i_compatflags2 & COMPATF2_BADANGLES)
{
spawn_angle += 1 << ANGLETOFINESHIFT;
}
}
mobj = static_cast<APlayerPawn *>

View file

@ -322,6 +322,7 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool
angle_t angle = 0;
fixed_t s = 0, c = 0;
fixed_t velx = 0, vely = 0;
angle_t badangle = 0;
if (thing == NULL)
{ // Teleport function called with an invalid actor
@ -367,7 +368,11 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, bool
{
z = ONFLOORZ;
}
if (P_Teleport (thing, searcher->x, searcher->y, z, searcher->angle, fog, sourceFog, keepOrientation, haltVelocity))
if ((i_compatflags2 & COMPATF2_BADANGLES) && (thing->player != NULL))
{
badangle = 1 << ANGLETOFINESHIFT;
}
if (P_Teleport (thing, searcher->x, searcher->y, z, searcher->angle + badangle, fog, sourceFog, keepOrientation, haltVelocity))
{
// [RH] Lee Killough's changes for silent teleporters from BOOM
if (!fog && line && keepOrientation)