- 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)
This commit is contained in:
Christoph Oelckers 2010-02-13 08:56:08 +00:00
parent 784aef8928
commit 6ec30761c6
6 changed files with 40 additions and 5 deletions

View file

@ -37,6 +37,7 @@
#include "actor.h" #include "actor.h"
#include "templates.h" #include "templates.h"
#include "autosegs.h" #include "autosegs.h"
#include "v_text.h"
TArray<PClass *> PClass::m_RuntimeActors; TArray<PClass *> PClass::m_RuntimeActors;
TArray<PClass *> PClass::m_Types; TArray<PClass *> PClass::m_Types;
@ -185,7 +186,7 @@ void PClass::InsertIntoHash ()
else if (lexx == 0) else if (lexx == 0)
{ // This type has already been inserted { // This type has already been inserted
// ... but there is no need whatsoever to make it a fatal error! // ... 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; break;
} }
else else

View file

@ -39,6 +39,7 @@
#include "m_fixed.h" #include "m_fixed.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "d_net.h" #include "d_net.h"
#include "v_text.h"
#include "gi.h" #include "gi.h"
@ -142,15 +143,26 @@ void FActorInfo::StaticSetActorNums ()
void FActorInfo::RegisterIDs () void FActorInfo::RegisterIDs ()
{ {
const PClass *cls = PClass::FindClass(Class->TypeName);
bool set = false;
if (GameFilter == GAME_Any || (GameFilter & gameinfo.gametype)) if (GameFilter == GAME_Any || (GameFilter & gameinfo.gametype))
{ {
if (SpawnID != 0) 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) 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 // Fill out the list for Chex Quest with Doom's actors
@ -158,6 +170,10 @@ void FActorInfo::RegisterIDs ()
(GameFilter & GAME_Doom)) (GameFilter & GAME_Doom))
{ {
DoomEdMap.AddType (DoomEdNum, Class, true); 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());
}
} }
} }

View file

@ -663,7 +663,9 @@ manual_stair:
if ( (ok = (tsec != NULL)) ) 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 // if sector's floor already moving, look for another
//jff 2/26/98 special lockout condition for retriggering //jff 2/26/98 special lockout condition for retriggering
@ -673,6 +675,9 @@ manual_stair:
sec = tsec; sec = tsec;
continue; continue;
} }
if (!(i_compatflags & COMPATF_STAIRINDEX)) height += stairstep;
} }
newsecnum = (int)(tsec - sectors); newsecnum = (int)(tsec - sectors);
} }

View file

@ -2829,9 +2829,11 @@ void AActor::Tick ()
AActor *onmo; AActor *onmo;
int i; int i;
assert (state != NULL); //assert (state != NULL);
if (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(); Destroy();
return; return;
} }

View file

@ -1072,6 +1072,12 @@ static FActorInfo *ParseActorHeader(FScanner &sc, Baggage *bag)
// Get actor name // Get actor name
sc.MustGetString (); sc.MustGetString ();
replaceName = sc.String; 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 // Now, after the actor names have been parsed, it is time to switch to C-mode

View file

@ -24,6 +24,11 @@ A80E7EE40E0D0C76A6FBD242BE29FE27 // map15
resetplayerspeed resetplayerspeed
} }
6DA6FCBA8089161BDEC6A1D3F6C8D60F // Eternal Doom MAP25
{
stairs
}
10E1E2B36302D31AC4AE68C84B5DC457 // Eternal Doom MAP28 10E1E2B36302D31AC4AE68C84B5DC457 // Eternal Doom MAP28
{ {
// What's really sad is that I got a separate bug report for this map // What's really sad is that I got a separate bug report for this map