diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 82d26d7ab7..cceb7c20e1 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1715,7 +1715,7 @@ static void SetPointer(FState *state, PFunction *sym, int frame = 0) { if (sym == NULL) { - state->SetAction(NULL); + state->ClearAction(); return; } else diff --git a/src/info.cpp b/src/info.cpp index 3a800e2cf5..d827cd7a0a 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -61,6 +61,11 @@ FRandom FState::pr_statetics("StateTics"); cycle_t ActionCycles; +void FState::SetAction(const char *name) +{ + ActionFunc = FindGlobalActionFunction(name)->Variants[0].Implementation; +} + bool FState::CallAction(AActor *self, AActor *stateowner) { if (ActionFunc != NULL) diff --git a/src/info.h b/src/info.h index 460adb0fba..5d9d36879c 100644 --- a/src/info.h +++ b/src/info.h @@ -126,6 +126,8 @@ struct FState Frame = frame - 'A'; } void SetAction(VMFunction *func) { ActionFunc = func; } + void ClearAction() { ActionFunc = NULL; } + void SetAction(const char *name); bool CallAction(AActor *self, AActor *stateowner); static PClassActor *StaticFindStateOwner (const FState *state); static PClassActor *StaticFindStateOwner (const FState *state, PClassActor *info); diff --git a/src/thingdef/olddecorations.cpp b/src/thingdef/olddecorations.cpp index fa543e372a..b04c589eeb 100644 --- a/src/thingdef/olddecorations.cpp +++ b/src/thingdef/olddecorations.cpp @@ -234,24 +234,24 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def) { if (extra.bExplosive) { - type->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_Explode")->Variants[0].Implementation); + type->OwnedStates[extra.DeathStart].SetAction("A_Explode"); } } else { // The first frame plays the death sound and // the second frame makes it nonsolid. - type->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_Scream")->Variants[0].Implementation); + type->OwnedStates[extra.DeathStart].SetAction("A_Scream"); if (extra.bSolidOnDeath) { } else if (extra.DeathStart + 1 < extra.DeathEnd) { - type->OwnedStates[extra.DeathStart+1].SetAction(FindGlobalActionFunction("A_NoBlocking")->Variants[0].Implementation); + type->OwnedStates[extra.DeathStart+1].SetAction("A_NoBlocking"); } else { - type->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_ScreamAndUnblock")->Variants[0].Implementation); + type->OwnedStates[extra.DeathStart].SetAction("A_ScreamAndUnblock"); } if (extra.DeathHeight == 0) @@ -283,17 +283,17 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def) // The first frame plays the burn sound and // the second frame makes it nonsolid. - type->OwnedStates[extra.FireDeathStart].SetAction(FindGlobalActionFunction("A_ActiveSound")->Variants[0].Implementation); + type->OwnedStates[extra.FireDeathStart].SetAction("A_ActiveSound"); if (extra.bSolidOnBurn) { } else if (extra.FireDeathStart + 1 < extra.FireDeathEnd) { - type->OwnedStates[extra.FireDeathStart+1].SetAction(FindGlobalActionFunction("A_NoBlocking")->Variants[0].Implementation); + type->OwnedStates[extra.FireDeathStart+1].SetAction("A_NoBlocking"); } else { - type->OwnedStates[extra.FireDeathStart].SetAction(FindGlobalActionFunction("A_ActiveAndUnblock")->Variants[0].Implementation); + type->OwnedStates[extra.FireDeathStart].SetAction("A_ActiveAndUnblock"); } if (extra.BurnHeight == 0) extra.BurnHeight = ((AActor*)(type->Defaults))->height; @@ -314,14 +314,14 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def) type->OwnedStates[i].Tics = 5; type->OwnedStates[i].TicRange = 0; type->OwnedStates[i].Misc1 = 0; - type->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeath")->Variants[0].Implementation); + type->OwnedStates[i].SetAction("A_FreezeDeath"); i = type->NumOwnedStates - 1; type->OwnedStates[i].NextState = &type->OwnedStates[i]; type->OwnedStates[i].Tics = 1; type->OwnedStates[i].TicRange = 0; type->OwnedStates[i].Misc1 = 0; - type->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeathChunks")->Variants[0].Implementation); + type->OwnedStates[i].SetAction("A_FreezeDeathChunks"); bag.statedef.SetStateLabel("Ice", &type->OwnedStates[extra.IceDeathStart]); } else if (extra.bGenericIceDeath)