- replace LEVEL_HEXENFORMAT with a maptype variable so that more precise checks for the map format can be done.

SVN r3122 (3dfloors2)
This commit is contained in:
Christoph Oelckers 2011-01-26 10:28:09 +00:00
parent 9ca4c49b84
commit 264ab6b076
5 changed files with 37 additions and 14 deletions

View file

@ -264,7 +264,7 @@ void CheckCompatibility(MapData *map)
// When playing Doom IWAD levels force COMPAT_SHORTTEX and COMPATF_LIGHT. // 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. // 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. // 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; ii_compatflags = COMPATF_SHORTTEX|COMPATF_LIGHT;
if (gameinfo.flags & GI_COMPATSTAIRS) ii_compatflags |= COMPATF_STAIRINDEX; if (gameinfo.flags & GI_COMPATSTAIRS) ii_compatflags |= COMPATF_STAIRINDEX;

View file

@ -306,8 +306,8 @@ bool FScriptLoader::ParseInfo(MapData * map)
new DFraggleThinker; new DFraggleThinker;
DFraggleThinker::ActiveThinker->LevelScript->data = copystring(scriptsrc.GetChars()); DFraggleThinker::ActiveThinker->LevelScript->data = copystring(scriptsrc.GetChars());
if (drownflag==-1) drownflag = ((level.flags&LEVEL_HEXENFORMAT) || fsglobal); if (drownflag==-1) drownflag = (level.maptype != MAPTYPE_DOOM || fsglobal);
if (!drownflag) level.airsupply=0; // Legacy doesn't to water damage. 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<FFsOptions>("fragglescript", false); FFsOptions *opt = level.info->GetOptData<FFsOptions>("fragglescript", false);
if (opt != NULL) if (opt != NULL)
@ -343,7 +343,7 @@ void T_LoadScripts(MapData *map)
// the default translator is being used. // the default translator is being used.
// Custom translators will not be patched. // Custom translators will not be patched.
if ((gameinfo.gametype == GAME_Doom || gameinfo.gametype == GAME_Heretic) && level.info->Translator.IsEmpty() && 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]; FLineTrans t = SimpleLineTranslations[270];
SimpleLineTranslations[270] = SimpleLineTranslations[272]; SimpleLineTranslations[270] = SimpleLineTranslations[272];

View file

@ -162,7 +162,7 @@ enum ELevelFlags
LEVEL_STARTLIGHTNING = 0x01000000, // Automatically start lightning LEVEL_STARTLIGHTNING = 0x01000000, // Automatically start lightning
LEVEL_FILTERSTARTS = 0x02000000, // Apply mapthing filtering to player starts LEVEL_FILTERSTARTS = 0x02000000, // Apply mapthing filtering to player starts
LEVEL_LOOKUPLEVELNAME = 0x04000000, // Level name is the name of a language string 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_SWAPSKIES = 0x10000000, // Used by lightning
LEVEL_NOALLIES = 0x20000000, // i.e. Inside Strife's front base LEVEL_NOALLIES = 0x20000000, // i.e. Inside Strife's front base
@ -253,6 +253,15 @@ struct FOptionalMapinfoDataPtr
typedef TMap<FName, FOptionalMapinfoDataPtr> FOptData; typedef TMap<FName, FOptionalMapinfoDataPtr> FOptData;
typedef TMap<int, FName> FMusicMap; typedef TMap<int, FName> FMusicMap;
enum EMapType
{
MAPTYPE_UNKNOWN = 0,
MAPTYPE_DOOM,
MAPTYPE_HEXEN,
MAPTYPE_BUILD,
MAPTYPE_UDMF // This does not distinguish between namespaces.
};
struct level_info_t struct level_info_t
{ {
int levelnum; int levelnum;
@ -380,6 +389,7 @@ struct FLevelLocals
char mapname[256]; // the lump name (E1M1, MAP01, etc) char mapname[256]; // the lump name (E1M1, MAP01, etc)
char nextmap[11]; // go here when using the regular exit char nextmap[11]; // go here when using the regular exit
char secretmap[11]; // map to go to when used secret exit char secretmap[11]; // map to go to when used secret exit
EMapType maptype;
DWORD flags; DWORD flags;
DWORD flags2; DWORD flags2;

View file

@ -784,14 +784,20 @@ void P_Spawn3DFloors (void)
break; break;
case Sector_Set3DFloor: 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]; if (line->args[1]&8)
} {
else line->id = line->args[4];
{ }
line->args[0]+=256*line->args[4]; else
line->args[4]=0; {
line->args[0]+=256*line->args[4];
line->args[4]=0;
}
} }
P_Set3DFloor(line, line->args[1]&~8, line->args[2], line->args[3]); P_Set3DFloor(line, line->args[1]&~8, line->args[2], line->args[3]);
break; break;

View file

@ -1803,7 +1803,7 @@ void P_SetLineID (line_t *ld)
// [RH] Set line id (as appropriate) here // [RH] Set line id (as appropriate) here
// for Doom format maps this must be done in P_TranslateLineDef because // for Doom format maps this must be done in P_TranslateLineDef because
// the tag doesn't always go into the first arg. // the tag doesn't always go into the first arg.
if (level.flags & LEVEL_HEXENFORMAT) if (level.maptype == MAPTYPE_HEXEN)
{ {
switch (ld->special) switch (ld->special)
{ {
@ -3411,6 +3411,7 @@ void P_SetupLevel (char *lumpname, int position)
times[i].Reset(); times[i].Reset();
} }
level.maptype = MAPTYPE_UNKNOWN;
wminfo.partime = 180; wminfo.partime = 180;
MapThingsConverted.Clear(); MapThingsConverted.Clear();
@ -3491,7 +3492,7 @@ void P_SetupLevel (char *lumpname, int position)
if (map->HasBehavior) if (map->HasBehavior)
{ {
P_LoadBehavior (map); P_LoadBehavior (map);
level.flags |= LEVEL_HEXENFORMAT; level.maptype = MAPTYPE_HEXEN;
} }
else else
{ {
@ -3514,6 +3515,11 @@ void P_SetupLevel (char *lumpname, int position)
} }
} }
P_LoadTranslator(translator); P_LoadTranslator(translator);
level.maptype = MAPTYPE_DOOM;
}
if (map->isText)
{
level.maptype = MAPTYPE_UDMF;
} }
CheckCompatibility(map); CheckCompatibility(map);
T_LoadScripts(map); T_LoadScripts(map);
@ -3594,6 +3600,7 @@ void P_SetupLevel (char *lumpname, int position)
else else
{ {
ForceNodeBuild = true; ForceNodeBuild = true;
level.maptype = MAPTYPE_BUILD;
} }
bool reloop = false; bool reloop = false;