mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- some refactoring of olddecorations.cpp to move some repeated code into a subfunction.
This commit is contained in:
parent
b5029e0976
commit
d1b2ef5368
4 changed files with 17 additions and 10 deletions
|
@ -1715,7 +1715,7 @@ static void SetPointer(FState *state, PFunction *sym, int frame = 0)
|
|||
{
|
||||
if (sym == NULL)
|
||||
{
|
||||
state->SetAction(NULL);
|
||||
state->ClearAction();
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue