From fb6e4becaadea0a6d64d711c6757e471ad22d62c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 4 Nov 2023 12:35:58 +0100 Subject: [PATCH] added rudimentary support for DSDA's COMPLVL lumo. 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. --- src/d_main.cpp | 2 +- src/doomdef.h | 2 +- src/gamedata/g_mapinfo.cpp | 56 +++++++++++++++++++++++++++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 78421e707f..64d29bb550 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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 & pwads) diff --git a/src/doomdef.h b/src/doomdef.h index 5d70ecd206..111bf7ad2c 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -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 diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index a525e80d94..1fec3346bc 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -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()) { @@ -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;