From 264ab6b076cc24ee616a8a50e20e9115e4a1ffd1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 26 Jan 2011 10:28:09 +0000 Subject: [PATCH] - replace LEVEL_HEXENFORMAT with a maptype variable so that more precise checks for the map format can be done. SVN r3122 (3dfloors2) --- src/compatibility.cpp | 2 +- src/fragglescript/t_load.cpp | 6 +++--- src/g_level.h | 12 +++++++++++- src/p_3dfloors.cpp | 20 +++++++++++++------- src/p_setup.cpp | 11 +++++++++-- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 718bfecee8..d9dfd083d1 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -264,7 +264,7 @@ void CheckCompatibility(MapData *map) // 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. - if (Wads.GetLumpFile(map->lumpnum) == 1 && (gameinfo.flags & GI_COMPATSHORTTEX) && !(level.flags & LEVEL_HEXENFORMAT)) + if (Wads.GetLumpFile(map->lumpnum) == 1 && (gameinfo.flags & GI_COMPATSHORTTEX) && level.maptype == MAPTYPE_DOOM) { ii_compatflags = COMPATF_SHORTTEX|COMPATF_LIGHT; if (gameinfo.flags & GI_COMPATSTAIRS) ii_compatflags |= COMPATF_STAIRINDEX; diff --git a/src/fragglescript/t_load.cpp b/src/fragglescript/t_load.cpp index 3e49cf5983..c374de7106 100644 --- a/src/fragglescript/t_load.cpp +++ b/src/fragglescript/t_load.cpp @@ -306,8 +306,8 @@ bool FScriptLoader::ParseInfo(MapData * map) new DFraggleThinker; DFraggleThinker::ActiveThinker->LevelScript->data = copystring(scriptsrc.GetChars()); - if (drownflag==-1) drownflag = ((level.flags&LEVEL_HEXENFORMAT) || fsglobal); - if (!drownflag) level.airsupply=0; // Legacy doesn't to water damage. + if (drownflag==-1) drownflag = (level.maptype != MAPTYPE_DOOM || fsglobal); + if (!drownflag) level.airsupply=0; // Legacy doesn't to water damage so we need to check if it has to be disabled here. FFsOptions *opt = level.info->GetOptData("fragglescript", false); if (opt != NULL) @@ -343,7 +343,7 @@ void T_LoadScripts(MapData *map) // the default translator is being used. // Custom translators will not be patched. if ((gameinfo.gametype == GAME_Doom || gameinfo.gametype == GAME_Heretic) && level.info->Translator.IsEmpty() && - !((level.flags&LEVEL_HEXENFORMAT)) && SimpleLineTranslations[272 - 2*HasScripts].special == FS_Execute) + level.maptype == MAPTYPE_DOOM && SimpleLineTranslations[272 - 2*HasScripts].special == FS_Execute) { FLineTrans t = SimpleLineTranslations[270]; SimpleLineTranslations[270] = SimpleLineTranslations[272]; diff --git a/src/g_level.h b/src/g_level.h index 34c2bf5f8d..8e0477f413 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -162,7 +162,7 @@ enum ELevelFlags LEVEL_STARTLIGHTNING = 0x01000000, // Automatically start lightning LEVEL_FILTERSTARTS = 0x02000000, // Apply mapthing filtering to player starts LEVEL_LOOKUPLEVELNAME = 0x04000000, // Level name is the name of a language string - LEVEL_HEXENFORMAT = 0x08000000, // Level uses the Hexen map format + //LEVEL_HEXENFORMAT = 0x08000000, // Level uses the Hexen map format LEVEL_SWAPSKIES = 0x10000000, // Used by lightning LEVEL_NOALLIES = 0x20000000, // i.e. Inside Strife's front base @@ -253,6 +253,15 @@ struct FOptionalMapinfoDataPtr typedef TMap FOptData; typedef TMap FMusicMap; +enum EMapType +{ + MAPTYPE_UNKNOWN = 0, + MAPTYPE_DOOM, + MAPTYPE_HEXEN, + MAPTYPE_BUILD, + MAPTYPE_UDMF // This does not distinguish between namespaces. +}; + struct level_info_t { int levelnum; @@ -380,6 +389,7 @@ struct FLevelLocals char mapname[256]; // the lump name (E1M1, MAP01, etc) char nextmap[11]; // go here when using the regular exit char secretmap[11]; // map to go to when used secret exit + EMapType maptype; DWORD flags; DWORD flags2; diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index daa0c8a638..558fb874c2 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -784,14 +784,20 @@ void P_Spawn3DFloors (void) break; case Sector_Set3DFloor: - if (line->args[1]&8) + // The flag high-byte/line id is only needed in Hexen format. + // UDMF can set both of these parameters without any restriction of the usable values. + // In Doom format the translators can take full integers for the tag and the line ID always is the same as the tag. + if (level.maptype == MAPTYPE_HEXEN) { - line->id = line->args[4]; - } - else - { - line->args[0]+=256*line->args[4]; - line->args[4]=0; + if (line->args[1]&8) + { + line->id = line->args[4]; + } + else + { + line->args[0]+=256*line->args[4]; + line->args[4]=0; + } } P_Set3DFloor(line, line->args[1]&~8, line->args[2], line->args[3]); break; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 43f9704519..1d20a6f7a0 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1803,7 +1803,7 @@ void P_SetLineID (line_t *ld) // [RH] Set line id (as appropriate) here // for Doom format maps this must be done in P_TranslateLineDef because // the tag doesn't always go into the first arg. - if (level.flags & LEVEL_HEXENFORMAT) + if (level.maptype == MAPTYPE_HEXEN) { switch (ld->special) { @@ -3411,6 +3411,7 @@ void P_SetupLevel (char *lumpname, int position) times[i].Reset(); } + level.maptype = MAPTYPE_UNKNOWN; wminfo.partime = 180; MapThingsConverted.Clear(); @@ -3491,7 +3492,7 @@ void P_SetupLevel (char *lumpname, int position) if (map->HasBehavior) { P_LoadBehavior (map); - level.flags |= LEVEL_HEXENFORMAT; + level.maptype = MAPTYPE_HEXEN; } else { @@ -3514,6 +3515,11 @@ void P_SetupLevel (char *lumpname, int position) } } P_LoadTranslator(translator); + level.maptype = MAPTYPE_DOOM; + } + if (map->isText) + { + level.maptype = MAPTYPE_UDMF; } CheckCompatibility(map); T_LoadScripts(map); @@ -3594,6 +3600,7 @@ void P_SetupLevel (char *lumpname, int position) else { ForceNodeBuild = true; + level.maptype = MAPTYPE_BUILD; } bool reloop = false;