From c191d95110f49299d9cfcfd550531a2004941c6f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 13 Mar 2010 08:28:13 +0000 Subject: [PATCH] - Fixed: Hexen's fighter's skull has a different animation than Heretic's so it needs to be a separate class. - Added an option to parse lumps named ZMAPINFO in place of MAPINFO. Any MAPINFO lumps in files containing a ZMAPINFO lump will be completely ignored. This is to allow ZDoom specific definitions which are incompatible with other engines capable of reading MAPINFO. Any ZMAPINFO lump must be in the new MAPINFO format. SVN r2208 (trunk) --- src/g_level.h | 4 +- src/g_mapinfo.cpp | 17 ++++++++- src/w_wad.cpp | 40 ++++++++++++++++++++ src/w_wad.h | 1 + wadsrc/static/actors/hexen/fighterplayer.txt | 27 ++++++++++++- 5 files changed, 84 insertions(+), 5 deletions(-) diff --git a/src/g_level.h b/src/g_level.h index 7ea2e3147..0e17b02b1 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -68,9 +68,9 @@ struct FMapInfoParser int format_type; bool HexenHack; - FMapInfoParser() + FMapInfoParser(int format = FMT_Unknown) { - format_type = FMT_Unknown; + format_type = format; HexenHack = false; } diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index f9fe5e829..09e8eb96a 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1929,10 +1929,23 @@ void G_ParseMapInfo (const char *basemapinfo) parse.ParseMapInfo(Wads.GetNumForFullName(basemapinfo), gamedefaults, defaultinfo); } + static const char *mapinfonames[] = { "MAPINFO", "ZMAPINFO", NULL }; + int nindex; + // Parse any extra MAPINFOs. - while ((lump = Wads.FindLump ("MAPINFO", &lastlump)) != -1) + while ((lump = Wads.FindLumpMulti (mapinfonames, &lastlump, false, &nindex)) != -1) { - FMapInfoParser parse; + if (nindex == 0) + { + // If this lump is named MAPINFO we need to check if the same WAD contains a ZMAPINFO lump. + // If that exists we need to skip this one. + + int wad = Wads.GetLumpFile(lump); + int altlump = Wads.CheckNumForName("ZMAPINFO", ns_global, wad, true); + + if (altlump >= 0) continue; + } + FMapInfoParser parse(nindex == 1? FMapInfoParser::FMT_New : FMapInfoParser::FMT_Unknown); level_info_t defaultinfo; parse.ParseMapInfo(lump, gamedefaults, defaultinfo); } diff --git a/src/w_wad.cpp b/src/w_wad.cpp index bb8deb384..68a8d4c3e 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -848,6 +848,46 @@ int FWadCollection::FindLump (const char *name, int *lastlump, bool anyns) return -1; } +//========================================================================== +// +// W_FindLumpMulti +// +// Find a named lump. Specifically allows duplicates for merging of e.g. +// SNDINFO lumps. Returns everything having one of the passed names. +// +//========================================================================== + +int FWadCollection::FindLumpMulti (const char **names, int *lastlump, bool anyns, int *nameindex) +{ + LumpRecord *lump_p; + + assert(lastlump != NULL && *lastlump >= 0); + lump_p = &LumpInfo[*lastlump]; + while (lump_p < &LumpInfo[NumLumps]) + { + FResourceLump *lump = lump_p->lump; + + if (anyns || lump->Namespace == ns_global) + { + + for(const char **name = names; *name != NULL; name++) + { + if (!strnicmp(*name, lump->Name, 8)) + { + int lump = int(lump_p - &LumpInfo[0]); + *lastlump = lump + 1; + if (nameindex != NULL) *nameindex = int(name - names); + return lump; + } + } + } + lump_p++; + } + + *lastlump = NumLumps; + return -1; +} + //========================================================================== // // W_CheckLumpName diff --git a/src/w_wad.h b/src/w_wad.h index 2edd71587..19129476f 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -182,6 +182,7 @@ public: FileReader * GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD int FindLump (const char *name, int *lastlump, bool anyns=false); // [RH] Find lumps with duplication + int FindLumpMulti (const char **names, int *lastlump, bool anyns = false, int *nameindex = NULL); // same with multiple possible names bool CheckLumpName (int lump, const char *name); // [RH] True if lump's name == name static DWORD LumpNameHash (const char *name); // [RH] Create hash key from an 8-char name diff --git a/wadsrc/static/actors/hexen/fighterplayer.txt b/wadsrc/static/actors/hexen/fighterplayer.txt index 277a2986b..2253ba5b6 100644 --- a/wadsrc/static/actors/hexen/fighterplayer.txt +++ b/wadsrc/static/actors/hexen/fighterplayer.txt @@ -64,7 +64,7 @@ ACTOR FighterPlayer : PlayerPawn Stop XDeath: PLAY O 5 A_PlayerScream - PLAY P 5 A_SkullPop + PLAY P 5 A_SkullPop("BloodyFighterSkull") PLAY R 5 A_NoBlocking PLAY STUV 5 PLAY W -1 @@ -99,3 +99,28 @@ ACTOR FighterPlayer : PlayerPawn } } +// The fighter's bloody skull -------------------------------------------------------------- + +Actor BloodyFighterSkull : PlayerChunk +{ + Game Hexen + Radius 4 + Height 4 + +NOBLOCKMAP + +DROPOFF + +LOWGRAVITY + +CANNOTPUSH + +SKYEXPLODE + +NOBLOCKMONST + +NOSKIN + States + { + Spawn: + BSKL A 0 + BSKL ABCDFGH 5 A_CheckFloor("Hit") + Goto Spawn+1 + Hit: + BSKL I 16 A_CheckPlayerDone + Wait + } +}