- Changed decorate replacement to be opt-in instead of opt-out. This allows for

greater flexibility in what can be replaced (replaced actors need not be ancestors
  of actors that replace them) at the expense of not having universal actor
  replacement. Instances where replacements work:
   - Line specials that spawn things (Thing_Spawn and related)
   - ACS spawning commands (SpawnSpot and the like)
   - Spawning mapthings at level load time in P_SpawnMapThing()
   - Spawning items off of dead dudes in P_DropItem()
   - The A_SpawnItem decorate function
   - The summon and summonfriend console commands
   - ThingCount will count both original actors and their replacements as the same
     things.
  TBD: Should the ACS inventory functions use replacements too, or not?


SVN r249 (trunk)
This commit is contained in:
Randy Heit 2006-07-13 03:34:50 +00:00
commit 38a073626f
8 changed files with 52 additions and 26 deletions

View file

@ -795,21 +795,6 @@ AInventory *AActor::FindInventory (const PClass *type) const
break;
}
}
if (item == NULL && type->ActorInfo->Replacement != NULL)
{ // Try again with a replacement type
PClass *newtype = type->ActorInfo->GetReplacement()->Class;
if (newtype != type)
{
for (item = Inventory; item != NULL; item = item->Inventory)
{
if (item->GetClass() == newtype)
{
break;
}
}
}
}
return item;
}
@ -3036,9 +3021,6 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
I_Error ("%s is not an actor\n", type->TypeName.GetChars());
}
// Handle decorate replacements.
type = type->ActorInfo->GetReplacement()->Class;
AActor *actor;
actor = static_cast<AActor *>(const_cast<PClass *>(type)->CreateNew ());
@ -3729,6 +3711,9 @@ void P_SpawnMapThing (mapthing2_t *mthing, int position)
// it to the unknown thing.
else
{
// Handle decorate replacements.
i = i->ActorInfo->GetReplacement()->Class;
const AActor *defaults = GetDefaultByType (i);
if (defaults->SpawnState == NULL ||
sprites[defaults->SpawnState->sprite.index].numframes == 0)