From 6ec30761c6c62ca830cac2d1ed787d8eb5361fcd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 13 Feb 2010 08:56:08 +0000 Subject: [PATCH] - Added Boom's stairbuilding fix when one step couldn't be built due to an active thinker in the sector. This is compatibility optioned with COMPAT_STAIRINDEX. Also added a compatibility setting for Eternal Doom MAP25 which relies on Doom's original broken behavior. - added a few sanity checks for duplicate actor names in DECORATE. ZDoom will now print more warnings and all crash cases should be properly handled but since this is still an error this will not work properly in all circumstances. For example, if you have a duplicate name all classes that inherit from the original definition will not survive a savegame if they reference a state belonging to that class at the point of saving. - Print 'tried to register class more than once' in red to highlight it. - fixed: actors may not replace themselves. SVN r2158 (trunk) --- src/dobjtype.cpp | 3 ++- src/info.cpp | 20 ++++++++++++++++++-- src/p_floor.cpp | 7 ++++++- src/p_mobj.cpp | 4 +++- src/thingdef/thingdef_parse.cpp | 6 ++++++ wadsrc/static/compatibility.txt | 5 +++++ 6 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 2243023d0c..63d4a8423c 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -37,6 +37,7 @@ #include "actor.h" #include "templates.h" #include "autosegs.h" +#include "v_text.h" TArray PClass::m_RuntimeActors; TArray PClass::m_Types; @@ -185,7 +186,7 @@ void PClass::InsertIntoHash () else if (lexx == 0) { // This type has already been inserted // ... but there is no need whatsoever to make it a fatal error! - Printf ("Tried to register class '%s' more than once.\n", TypeName.GetChars()); + Printf (TEXTCOLOR_RED"Tried to register class '%s' more than once.\n", TypeName.GetChars()); break; } else diff --git a/src/info.cpp b/src/info.cpp index 88a0ff7d2f..89628e5b7d 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -39,6 +39,7 @@ #include "m_fixed.h" #include "c_dispatch.h" #include "d_net.h" +#include "v_text.h" #include "gi.h" @@ -142,15 +143,26 @@ void FActorInfo::StaticSetActorNums () void FActorInfo::RegisterIDs () { + const PClass *cls = PClass::FindClass(Class->TypeName); + bool set = false; + if (GameFilter == GAME_Any || (GameFilter & gameinfo.gametype)) { if (SpawnID != 0) { - SpawnableThings[SpawnID] = Class; + SpawnableThings[SpawnID] = cls; + if (cls != Class) + { + Printf(TEXTCOLOR_RED"Spawn ID %d refers to hidden class type '%s'\n", SpawnID, cls->TypeName.GetChars()); + } } if (DoomEdNum != -1) { - DoomEdMap.AddType (DoomEdNum, Class); + DoomEdMap.AddType (DoomEdNum, cls); + if (cls != Class) + { + Printf(TEXTCOLOR_RED"Editor number %d refers to hidden class type '%s'\n", DoomEdNum, cls->TypeName.GetChars()); + } } } // Fill out the list for Chex Quest with Doom's actors @@ -158,6 +170,10 @@ void FActorInfo::RegisterIDs () (GameFilter & GAME_Doom)) { DoomEdMap.AddType (DoomEdNum, Class, true); + if (cls != Class) + { + Printf(TEXTCOLOR_RED"Editor number %d refers to hidden class type '%s'\n", DoomEdNum, cls->TypeName.GetChars()); + } } } diff --git a/src/p_floor.cpp b/src/p_floor.cpp index fd06ff0c1a..a03b505831 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -663,7 +663,9 @@ manual_stair: if ( (ok = (tsec != NULL)) ) { - height += stairstep; + // Doom bug: Height was changed before discarding the sector as part of the stairs. + // Needs to be compatibility optioned because some maps (Eternall MAP25) depend on it. + if (i_compatflags & COMPATF_STAIRINDEX) height += stairstep; // if sector's floor already moving, look for another //jff 2/26/98 special lockout condition for retriggering @@ -673,6 +675,9 @@ manual_stair: sec = tsec; continue; } + + if (!(i_compatflags & COMPATF_STAIRINDEX)) height += stairstep; + } newsecnum = (int)(tsec - sectors); } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b589e061ee..13c75eb991 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2829,9 +2829,11 @@ void AActor::Tick () AActor *onmo; int i; - assert (state != NULL); + //assert (state != NULL); if (state == NULL) { + Printf("Actor of type %s at (%f,%f) left without a state\n", GetClass()->TypeName.GetChars(), + x/65536., y/65536.); Destroy(); return; } diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index 85930b09ce..7712fe43b0 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -1072,6 +1072,12 @@ static FActorInfo *ParseActorHeader(FScanner &sc, Baggage *bag) // Get actor name sc.MustGetString (); replaceName = sc.String; + + if (replaceName == typeName) + { + sc.ScriptMessage ("Cannot replace class %s with itself", typeName.GetChars()); + FScriptPosition::ErrorCounter++; + } } // Now, after the actor names have been parsed, it is time to switch to C-mode diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index a4fd90659f..685fda086a 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -24,6 +24,11 @@ A80E7EE40E0D0C76A6FBD242BE29FE27 // map15 resetplayerspeed } +6DA6FCBA8089161BDEC6A1D3F6C8D60F // Eternal Doom MAP25 +{ + stairs +} + 10E1E2B36302D31AC4AE68C84B5DC457 // Eternal Doom MAP28 { // What's really sad is that I got a separate bug report for this map