diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0dc335988..030cba002 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,13 @@ April 2, 2008 +- Changed FScanner so that opening a lump gives the complete wad+lump name + rather than a generic one, so identifying errors among files that all have + the same lump name no longer involves any degree of guesswork in + determining exactly which file the error occurred in. +- Added a check to S_ParseSndSeq() for SNDSEQ lumps with unterminated final + sequences. +- Fixed: Parts of s_sndseq.cpp that scan the Sequences array need NULL + pointer checks, in case an improper sequence was encountered during + parsing but not early enough to avoid creating a slot for it in the array. - Added support for dumping from RAW/DRO/IMF files, so now anything that can be played as OPL can also be dumped. - Removed the opl_enable cvar, since OPL playback is now selectable as just diff --git a/src/decallib.cpp b/src/decallib.cpp index 1a0e193e7..d58eb794b 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -346,7 +346,7 @@ void FDecalLib::ReadAllDecals () while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1) { - FScanner sc(lump, "DECALDEF"); + FScanner sc(lump); ReadDecals (sc); } // Supporting code to allow specifying decals directly in the DECORATE lump diff --git a/src/g_level.cpp b/src/g_level.cpp index 1b7710af0..81e080aff 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -632,7 +632,7 @@ static void G_DoParseMapInfo (int lump) int clusterindex; QWORD levelflags; - FScanner sc(lump, Wads.GetLumpFullName(lump)); + FScanner sc(lump); SetLevelDefaults (&defaultinfo); HexenHack = false; diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp index 5b280db3c..37c9ee88d 100644 --- a/src/g_shared/a_keys.cpp +++ b/src/g_shared/a_keys.cpp @@ -344,7 +344,7 @@ void P_InitKeyMessages() ClearLocks(); while ((lump = Wads.FindLump ("LOCKDEFS", &lastlump)) != -1) { - FScanner sc(lump, "LOCKDEFS"); + FScanner sc(lump); while (sc.GetString ()) { if (sc.Compare("LOCK")) diff --git a/src/g_shared/sbarinfo_parser.cpp b/src/g_shared/sbarinfo_parser.cpp index 27cde16cb..08839b19c 100644 --- a/src/g_shared/sbarinfo_parser.cpp +++ b/src/g_shared/sbarinfo_parser.cpp @@ -130,7 +130,7 @@ void SBarInfo::ParseSBarInfo(int lump) { gameType = gameinfo.gametype; bool baseSet = false; - FScanner sc(lump, Wads.GetLumpFullName(lump)); + FScanner sc(lump); sc.SetCMode(true); while(sc.CheckToken(TK_Identifier) || sc.CheckToken(TK_Include)) { diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index aebe00100..323b3c0f4 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -928,7 +928,7 @@ void HUD_InitHud() while ((lump = Wads.FindLump ("ALTHUDCF", &lastlump)) != -1) { - FScanner sc(lump, "ALTHUDCF"); + FScanner sc(lump); while (sc.GetString()) { if (sc.Compare("Health")) diff --git a/src/m_options.cpp b/src/m_options.cpp index 270735060..f2a4b930a 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -3438,7 +3438,7 @@ void InitCrosshairsList() while ((lump = Wads.FindLump("XHAIRS", &lastlump)) != -1) { - FScanner sc(lump, "XHAIRS"); + FScanner sc(lump); while (sc.GetNumber()) { value.value = float(sc.Number); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index c7f99b136..825a2a6af 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -556,7 +556,7 @@ void FBehavior::StaticLoadDefaultModules () while ((lump = Wads.FindLump ("LOADACS", &lastlump)) != -1) { - FScanner sc(lump, "LOADACS"); + FScanner sc(lump); while (sc.GetString()) { int acslump = Wads.CheckNumForName (sc.String, ns_acslibrary); diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index c8ff8dacb..e8fff3be7 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -267,7 +267,7 @@ void P_InitTerrainTypes () lastlump = 0; while (-1 != (lump = Wads.FindLump ("TERRAIN", &lastlump)) ) { - FScanner sc(lump, "TERRAIN"); + FScanner sc(lump); ParseOuter (sc); } Splashes.ShrinkToFit (); diff --git a/src/r_anim.cpp b/src/r_anim.cpp index e2be495cb..14b701334 100644 --- a/src/r_anim.cpp +++ b/src/r_anim.cpp @@ -289,7 +289,7 @@ static void R_InitAnimDefs () while ((lump = Wads.FindLump ("ANIMDEFS", &lastlump)) != -1) { - FScanner sc(lump, "ANIMDEFS"); + FScanner sc(lump); while (sc.GetString ()) { diff --git a/src/r_things.cpp b/src/r_things.cpp index 0eb53ef9a..e4be056ce 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -453,7 +453,7 @@ void R_InitSkins (void) sndlumps[j] = -1; skins[i].namespc = Wads.GetLumpNamespace (base); - FScanner sc(base, "S_SKIN"); + FScanner sc(base); intname = 0; crouchname = 0; diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index c38744e9d..f0bda6aad 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -895,7 +895,7 @@ static void S_AddSNDINFO (int lump) bool skipToEndIf; TArray list; - FScanner sc(lump, "SNDINFO"); + FScanner sc(lump); skipToEndIf = false; while (sc.GetString ()) diff --git a/src/s_environment.cpp b/src/s_environment.cpp index ac48f414c..d6bf7d6a9 100644 --- a/src/s_environment.cpp +++ b/src/s_environment.cpp @@ -465,7 +465,7 @@ FArchive &operator<< (FArchive &arc, ReverbContainer *&env) return arc; } -static void ReadEAX (int lump, const char *lumpname) +static void ReadEAX (int lump) { FScanner sc; const ReverbContainer *def; @@ -476,7 +476,7 @@ static void ReadEAX (int lump, const char *lumpname) bool inited[NUM_EAX_FIELDS]; BYTE bools[32]; - sc.OpenLumpNum(lump, lumpname); + sc.OpenLumpNum(lump); while (sc.GetString ()) { name = copystring (sc.String); @@ -576,7 +576,7 @@ void S_ParseSndEax () while ((lump = Wads.FindLump ("SNDEAX", &lastlump)) != -1) { - ReadEAX (lump, "SNDEAX"); + ReadEAX (lump); } } diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index 2af2d4bb1..282e5961a 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -432,7 +432,7 @@ static void AssignHexenTranslations (void) { for (seq = 0; seq < Sequences.Size(); seq++) { - if (HexenSequences[i].Name == Sequences[seq]->SeqName) + if (Sequences[seq] != NULL && HexenSequences[i].Name == Sequences[seq]->SeqName) break; } if (seq == Sequences.Size()) @@ -499,7 +499,7 @@ void S_ParseSndSeq (int levellump) lump = levellump; levellump = -2; } - FScanner sc(lump, "SNDSEQ"); + FScanner sc(lump); while (sc.GetString ()) { bool bDoorSound = false; @@ -514,7 +514,7 @@ void S_ParseSndSeq (int levellump) seqtype = sc.String[0]; for (curseq = 0; curseq < (int)Sequences.Size(); curseq++) { - if (Sequences[curseq]->SeqName == seqname) + if (Sequences[curseq] != NULL && Sequences[curseq]->SeqName == seqname) { M_Free (Sequences[curseq]); Sequences[curseq] = NULL; @@ -684,6 +684,10 @@ void S_ParseSndSeq (int levellump) break; } } + if (curseq > 0) + { + sc.ScriptError("End of file encountered before the final sequence ended."); + } } if (gameinfo.gametype == GAME_Hexen) @@ -883,7 +887,7 @@ static int FindSequence (FName seqname) for (i = Sequences.Size(); i-- > 0; ) { - if (seqname == Sequences[i]->SeqName) + if (Sequences[i] != NULL && seqname == Sequences[i]->SeqName) { return i; } diff --git a/src/sc_man.cpp b/src/sc_man.cpp index 31d474587..7c590abc0 100644 --- a/src/sc_man.cpp +++ b/src/sc_man.cpp @@ -91,10 +91,10 @@ FScanner::FScanner(const FScanner &other) // //========================================================================== -FScanner::FScanner(int lumpnum, const char *name) +FScanner::FScanner(int lumpnum) { ScriptOpen = false; - OpenLumpNum(lumpnum, name); + OpenLumpNum(lumpnum); } //========================================================================== @@ -169,7 +169,7 @@ void FScanner::Open (const char *name) { I_Error("Could not find script lump '%s'\n", name); } - OpenLumpNum(lump, name); + OpenLumpNum(lump); } //========================================================================== @@ -219,14 +219,14 @@ void FScanner::OpenMem (const char *name, char *buffer, int size) // //========================================================================== -void FScanner :: OpenLumpNum (int lump, const char *name) +void FScanner :: OpenLumpNum (int lump) { Close (); { FMemLump mem = Wads.ReadLump(lump); ScriptBuffer = mem.GetString(); } - ScriptName = name; + ScriptName = Wads.GetLumpFullPath(lump); PrepareScript (); } diff --git a/src/sc_man.h b/src/sc_man.h index 245adbff1..cbfc00096 100644 --- a/src/sc_man.h +++ b/src/sc_man.h @@ -13,7 +13,7 @@ public: // Methods ------------------------------------------------------ FScanner(); FScanner(const FScanner &other); - FScanner(int lumpnum, const char *name); + FScanner(int lumpnum); ~FScanner(); FScanner &operator=(const FScanner &other); @@ -21,7 +21,7 @@ public: void Open(const char *lumpname); void OpenFile(const char *filename); void OpenMem(const char *name, char *buffer, int size); - void OpenLumpNum(int lump, const char *name); + void OpenLumpNum(int lump); void Close(); void SetCMode(bool cmode); diff --git a/src/stringtable.cpp b/src/stringtable.cpp index f4108a5bd..79b55da9f 100644 --- a/src/stringtable.cpp +++ b/src/stringtable.cpp @@ -149,7 +149,7 @@ void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int p code |= orMask; - FScanner sc(lumpnum, "LANGUAGE"); + FScanner sc(lumpnum); sc.SetCMode (true); while (sc.GetString ()) { diff --git a/src/teaminfo.cpp b/src/teaminfo.cpp index 04157eb2f..fa7316c0d 100644 --- a/src/teaminfo.cpp +++ b/src/teaminfo.cpp @@ -84,7 +84,7 @@ void TEAMINFO_Init () while ((lump = Wads.FindLump ("TEAMINFO", &lastlump)) != -1) { - FScanner sc(lump, "TEAMINFO"); + FScanner sc(lump); while (sc.GetString ()) { if (sc.Compare("CLEARTEAMS")) diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 114657eb3..fd428d1dd 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -508,7 +508,7 @@ void FTextureManager::LoadHiresTex(int wadnum) { if (Wads.GetLumpFile(remapLump) == wadnum) { - FScanner sc(remapLump, "HIRESTEX"); + FScanner sc(remapLump); while (sc.GetString()) { if (sc.Compare("remap")) // remap an existing texture diff --git a/src/thingdef/thingdef_main.cpp b/src/thingdef/thingdef_main.cpp index d19bd4c25..5339356a4 100644 --- a/src/thingdef/thingdef_main.cpp +++ b/src/thingdef/thingdef_main.cpp @@ -150,7 +150,7 @@ void LoadDecorations () lastlump = 0; while ((lump = Wads.FindLump ("DECORATE", &lastlump)) != -1) { - FScanner sc(lump, Wads.GetLumpFullName(lump)); + FScanner sc(lump); ParseDecorate (sc); } FinishThingdef(); diff --git a/src/v_font.cpp b/src/v_font.cpp index 4db45c3c1..3f83aadca 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -1631,7 +1631,7 @@ void V_InitCustomFonts() while ((llump = Wads.FindLump ("FONTDEFS", &lastlump)) != -1) { - sc.OpenLumpNum(llump, "FONTDEFS"); + sc.OpenLumpNum(llump); while (sc.GetString()) { memset (lumplist, -1, sizeof(lumplist)); @@ -1759,7 +1759,7 @@ void V_InitFontColors () while ((lump = Wads.FindLump ("TEXTCOLO", &lastlump)) != -1) { - FScanner sc(lump, "textcolors.txt"); + FScanner sc(lump); while (sc.GetString()) { names.Clear(); diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 544e5944d..8bd452e26 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -1617,6 +1617,25 @@ const char *FWadCollection::GetLumpFullName (int lump) const return LumpInfo[lump].name; } +//========================================================================== +// +// FWadCollection :: GetLumpFullPath +// +// Returns the name of the lump's wad prefixed to the lump's full name. +// +//========================================================================== + +FString FWadCollection::GetLumpFullPath(int lump) const +{ + FString foo; + + if ((size_t) lump < NumLumps) + { + foo << GetWadName(LumpInfo[lump].wadnum) << ':' << GetLumpFullName(lump); + } + return foo; +} + //========================================================================== // // GetLumpNamespace diff --git a/src/w_wad.h b/src/w_wad.h index e4f351128..7d84a4dda 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -206,6 +206,7 @@ public: int GetLumpFlags (int lump); // Return the flags for this lump void GetLumpName (char *to, int lump) const; // [RH] Copies the lump name to to using uppercopy const char *GetLumpFullName (int lump) const; // [RH] Returns the lump's full name + FString GetLumpFullPath (int lump) const; // [RH] Returns wad's name + lump's full name int GetLumpFile (int lump) const; // [RH] Returns wadnum for a specified lump int GetLumpNamespace (int lump) const; // [RH] Returns the namespace a lump belongs to bool CheckLumpName (int lump, const char *name) const; // [RH] Returns true if the names match diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index ae247ccb4..e6f2c783e 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -398,7 +398,7 @@ void WI_LoadBackground(bool isenterpic) int lumpnum=Wads.GetNumForName(lumpname+1); if (lumpnum>=0) { - FScanner sc(lumpnum,lumpname+1); + FScanner sc(lumpnum); while (sc.GetString()) { memset(&an,0,sizeof(an));