Skip to content

Commit

Permalink
added rudimentary support for DSDA's COMPLVL lumo.
Browse files Browse the repository at this point in the history
This cannot of course set real complevels, so what it does is set all appropriate compatibility flags from the respective preset.
It does leave out a few flags that are preferably left to the user, like infinitely tall actors or wall running.
  • Loading branch information
coelckers committed Nov 4, 2023
1 parent 06af5f2 commit fb6e4be
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/d_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ void GetReserved(LumpFilterInfo& lfi)
{
lfi.reservedFolders = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/",
"materials/", "models/", "fonts/", "brightmaps/" };
lfi.requiredPrefixes = { "mapinfo", "zmapinfo", "umapinfo", "gameinfo", "sndinfo", "sndseq", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo", "maps/" };
lfi.requiredPrefixes = { "mapinfo", "zmapinfo", "umapinfo", "gameinfo", "sndinfo", "sndseq", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo", "complvl", "terrain", "maps/" };
}

static FString CheckGameInfo(std::vector<std::string> & pwads)
Expand Down
2 changes: 1 addition & 1 deletion src/doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ enum : unsigned int
COMPATF_VILEGHOSTS = 1 << 25, // Crushed monsters are resurrected as ghosts.
COMPATF_NOBLOCKFRIENDS = 1 << 26, // Friendly monsters aren't blocked by monster-blocking lines.
COMPATF_SPRITESORT = 1 << 27, // Invert sprite sorting order for sprites of equal distance
COMPATF_HITSCAN = 1 << 28, // Hitscans use original blockmap anf hit check code.
COMPATF_HITSCAN = 1 << 28, // Hitscans use original blockmap and hit check code.
COMPATF_LIGHT = 1 << 29, // Find neighboring light level like Doom
COMPATF_POLYOBJ = 1 << 30, // Draw polyobjects the old fashioned way
COMPATF_MASKEDMIDTEX = 1u << 31, // Ignore compositing when drawing masked midtextures
Expand Down
56 changes: 55 additions & 1 deletion src/gamedata/g_mapinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2587,6 +2587,56 @@ void G_ParseMapInfo (FString basemapinfo)
int lump, lastlump = 0;
level_info_t gamedefaults;

int flags1 = 0, flags2 = 0;
if (gameinfo.gametype == GAME_Doom)
{
int comp = fileSystem.CheckNumForName("COMPLVL");
if (comp >= 0)
{
auto complvl = fileSystem.ReadFile(comp);
auto data = complvl.GetString();
int length = fileSystem.FileLength(comp);
if (length == 7 && !strnicmp("vanilla", data, 7))
{
flags1 =
COMPATF_SHORTTEX | COMPATF_STAIRINDEX | COMPATF_USEBLOCKING | COMPATF_NODOORLIGHT | COMPATF_SPRITESORT |
COMPATF_TRACE | COMPATF_MISSILECLIP | COMPATF_SOUNDTARGET | COMPATF_DEHHEALTH | COMPATF_CROSSDROPOFF |
COMPATF_LIGHT | COMPATF_MASKEDMIDTEX |
COMPATF_LIMITPAIN | COMPATF_INVISIBILITY | COMPATF_VILEGHOSTS;

flags2 =
COMPATF2_FLOORMOVE | COMPATF2_EXPLODE1 | COMPATF2_NOMBF21 | COMPATF2_POINTONLINE;
}
else if (length == 4 && !strnicmp("boom", data, 4))
{
flags1 =
COMPATF_TRACE | COMPATF_SOUNDTARGET | COMPATF_BOOMSCROLL | COMPATF_MISSILECLIP | COMPATF_MASKEDMIDTEX |
COMPATF_INVISIBILITY;

flags2 =
COMPATF2_EXPLODE1 | COMPATF2_NOMBF21 | COMPATF2_POINTONLINE;
}
else if (length == 3 && !strnicmp("mbf", data, 3))
{
flags1 =
COMPATF_TRACE | COMPATF_SOUNDTARGET | COMPATF_BOOMSCROLL | COMPATF_MISSILECLIP | COMPATF_MUSHROOM |
COMPATF_MBFMONSTERMOVE | COMPATF_NOBLOCKFRIENDS | COMPATF_MASKEDMIDTEX | COMPATF_INVISIBILITY;

flags2 =
COMPATF2_EXPLODE1 | COMPATF2_AVOID_HAZARDS | COMPATF2_STAYONLIFT | COMPATF2_NOMBF21 | COMPATF2_POINTONLINE;
}
else if (length == 5 && !strnicmp("mbf21", data, 5))
{
flags1 =
COMPATF_TRACE | COMPATF_SOUNDTARGET | COMPATF_BOOMSCROLL | COMPATF_MISSILECLIP | COMPATF_MUSHROOM |
COMPATF_MASKEDMIDTEX | COMPATF_INVISIBILITY;

flags2 =
COMPATF2_EXPLODE1 | COMPATF2_AVOID_HAZARDS | COMPATF2_STAYONLIFT | COMPATF2_POINTONLINE;
}
}
}

// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.
if (basemapinfo.IsNotEmpty())
{
Expand All @@ -2600,7 +2650,11 @@ void G_ParseMapInfo (FString basemapinfo)
}
parse.ParseMapInfo(baselump, gamedefaults, defaultinfo);
}

gamedefaults.compatflags |= flags1;
gamedefaults.compatmask |= flags1;
gamedefaults.compatflags2 |= flags2;
gamedefaults.compatmask2 |= flags2;

static const char *mapinfonames[] = { "MAPINFO", "ZMAPINFO", "UMAPINFO", NULL };
int nindex;

Expand Down

0 comments on commit fb6e4be

Please sign in to comment.