- fixed: Dehacked replaced pickups multiple times for changing its states.

- fixed: Dehacked must copy AInventory's state to any item it hacks to be a 
  pickup.
- fixed a few more DECORATE bugs.


SVN r1166 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-13 09:11:19 +00:00
parent 3cb073a3a0
commit 4fd717046e
8 changed files with 48 additions and 10 deletions

View file

@ -1,3 +1,9 @@
August 12, 2008 (Changes by Graf Zahl)
- fixed: Dehacked replaced pickups multiple times for changing its states.
- fixed: Dehacked must copy AInventory's state to any item it hacks to be a
pickup.
- fixed a few more DECORATE bugs.
August 12, 2008 (Changes by Graf Zahl)
- Fixed: The chat sound for Strife was misnamed in the gameinfo structure.
- fixed a few DECORATE bugs.

View file

@ -346,6 +346,15 @@ static bool ReadChars (char **stuff, int size);
static char *igets (void);
static int GetLine (void);
static void PushTouchedActor(PClass *cls)
{
for(unsigned i = 0; i < TouchedActors.Size(); i++)
{
if (TouchedActors[i] == cls) return;
}
TouchedActors.Push(cls);
}
inline const char *GetName (int name)
{
return NameBase + NameOffs[name];
@ -438,7 +447,8 @@ static FState *FindState (int statenum)
{
if (StateMap[i].OwnerIsPickup)
{
TouchedActors.Push (const_cast<PClass *>(StateMap[i].Owner));
PushTouchedActor(const_cast<PClass *>(StateMap[i].Owner));
}
return StateMap[i].State + statenum - stateacc;
}
@ -1026,7 +1036,7 @@ static int PatchThing (int thingy)
if (info->flags & MF_SPECIAL)
{
TouchedActors.Push (const_cast<PClass *>(type));
PushTouchedActor(const_cast<PClass *>(type));
}
// Make MF3_ISMONSTER match MF_COUNTKILL
@ -2577,6 +2587,11 @@ void FinishDehPatch ()
// Make a copy the state labels
MakeStateDefines(type->ActorInfo->StateList);
if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory)))
{
// If this is a hacked non-inventory item we must also copy AInventory's special states
AddStateDefines(RUNTIME_CLASS(AInventory)->ActorInfo->StateList);
}
InstallStates(subclass->ActorInfo, defaults2);
// Use the DECORATE replacement feature to redirect all spawns
@ -2584,7 +2599,7 @@ void FinishDehPatch ()
type->ActorInfo->Replacement = subclass->ActorInfo;
subclass->ActorInfo->Replacee = type->ActorInfo;
DPrintf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());
Printf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());
}
// Now that all Dehacked patches have been processed, it's okay to free StateMap.

View file

@ -837,6 +837,8 @@ void AInventory::Hide ()
}
}
assert(HideDoomishState != NULL || HideSpecialState != NULL);
if (HideSpecialState != NULL)
{
SetState (HideSpecialState);
@ -848,11 +850,6 @@ void AInventory::Hide ()
SetState (HideDoomishState);
tics = 1050;
}
else
{
GoAwayAndDie();
return;
}
if (RespawnTics != 0)
{
tics = RespawnTics;

View file

@ -99,6 +99,7 @@ void AddState (const char * statename, FState * state);
FState * FindState(AActor * actor, const PClass * type, const char * name);
void InstallStates(FActorInfo *info, AActor *defaults);
void MakeStateDefines(const FStateLabels *list);
void AddStateDefines(const FStateLabels *list);
FState *P_GetState(AActor *self, FState *CallingState, int offset);
int FinishStates (FScanner &sc, FActorInfo *actor, AActor *defaults, Baggage &bag);
int ParseStates(FScanner &sc, FActorInfo *actor, AActor *defaults, Baggage &bag);

View file

@ -369,6 +369,24 @@ void MakeStateDefines(const FStateLabels *list)
MakeStateList(list, StateLabels);
}
void AddStateDefines(const FStateLabels *list)
{
if (list != NULL) for(int i=0;i<list->NumLabels;i++)
{
if (list->Labels[i].Children == NULL)
{
if (!FindStateLabelInList(StateLabels, list->Labels[i].Label, false))
{
FStateDefine def;
def.Label = list->Labels[i].Label;
def.State = list->Labels[i].State;
StateLabels.Push(def);
}
}
}
}
//==========================================================================
//
// PrepareStateParameters

View file

@ -191,6 +191,7 @@ ACTOR BloodPool 111
ACTOR ZCorpseLynchedNoHeart 109 native
{
Game Hexen
Radius 10
Height 100
+SOLID +SPAWNCEILING +NOGRAVITY

View file

@ -37,7 +37,7 @@ ACTOR Inventory native
action native A_ClearReFire();
action native A_CheckReload();
action native A_GunFlash();
action native A_Saw(sound fullsound = "misc/sawfull", sound hitsound = "misc/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff");
action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff");
action native A_CheckForReload(int counter, state label);
action native A_ResetReloadCounter();
action native A_RestoreSpecialPosition();

View file

@ -467,7 +467,7 @@ ACTOR SStalagmiteSmall 163
States
{
Spawn:
STLG E -1
STLG F -1
Stop
}
}