- fixed: having a state immediately followed label with a goto immediately following that label did not link the state to its proper next state.

SVN r3661 (trunk)
This commit is contained in:
Christoph Oelckers 2012-05-17 11:16:20 +00:00
parent 0cc6822a11
commit 7356350d5c
2 changed files with 19 additions and 0 deletions

View File

@ -523,6 +523,7 @@ void FStateDefinitions::MakeStateDefines(const PClass *cls)
{ {
StateArray.Clear(); StateArray.Clear();
laststate = NULL; laststate = NULL;
laststatebeforelabel = NULL;
lastlabel = -1; lastlabel = -1;
if (cls != NULL && cls->ActorInfo != NULL && cls->ActorInfo->StateList != NULL) if (cls != NULL && cls->ActorInfo != NULL && cls->ActorInfo->StateList != NULL)
@ -744,11 +745,18 @@ bool FStateDefinitions::SetGotoLabel(const char *string)
{ // Following a state definition: Modify it. { // Following a state definition: Modify it.
laststate->NextState = (FState*)copystring(string); laststate->NextState = (FState*)copystring(string);
laststate->DefineFlags = SDF_LABEL; laststate->DefineFlags = SDF_LABEL;
laststatebeforelabel = NULL;
return true; return true;
} }
else if (lastlabel >= 0) else if (lastlabel >= 0)
{ // Following a label: Retarget it. { // Following a label: Retarget it.
RetargetStates (lastlabel+1, string); RetargetStates (lastlabel+1, string);
if (laststatebeforelabel != NULL)
{
laststatebeforelabel->NextState = (FState*)copystring(string);
laststatebeforelabel->DefineFlags = SDF_LABEL;
laststatebeforelabel = NULL;
}
return true; return true;
} }
return false; return false;
@ -767,11 +775,17 @@ bool FStateDefinitions::SetStop()
if (laststate != NULL) if (laststate != NULL)
{ {
laststate->DefineFlags = SDF_STOP; laststate->DefineFlags = SDF_STOP;
laststatebeforelabel = NULL;
return true; return true;
} }
else if (lastlabel >=0) else if (lastlabel >=0)
{ {
RetargetStates (lastlabel+1, NULL); RetargetStates (lastlabel+1, NULL);
if (laststatebeforelabel != NULL)
{
laststatebeforelabel->DefineFlags = SDF_STOP;
laststatebeforelabel = NULL;
}
return true; return true;
} }
return false; return false;
@ -790,6 +804,7 @@ bool FStateDefinitions::SetWait()
if (laststate != NULL) if (laststate != NULL)
{ {
laststate->DefineFlags = SDF_WAIT; laststate->DefineFlags = SDF_WAIT;
laststatebeforelabel = NULL;
return true; return true;
} }
return false; return false;
@ -809,6 +824,7 @@ bool FStateDefinitions::SetLoop()
{ {
laststate->DefineFlags = SDF_INDEX; laststate->DefineFlags = SDF_INDEX;
laststate->NextState = (FState*)(lastlabel+1); laststate->NextState = (FState*)(lastlabel+1);
laststatebeforelabel = NULL;
return true; return true;
} }
return false; return false;
@ -849,6 +865,7 @@ bool FStateDefinitions::AddStates(FState *state, const char *framechars)
StateArray.Push(*state); StateArray.Push(*state);
} }
laststate = &StateArray[StateArray.Size() - 1]; laststate = &StateArray[StateArray.Size() - 1];
laststatebeforelabel = laststate;
return !error; return !error;
} }

View File

@ -65,6 +65,7 @@ class FStateDefinitions
{ {
TArray<FStateDefine> StateLabels; TArray<FStateDefine> StateLabels;
FState *laststate; FState *laststate;
FState *laststatebeforelabel;
intptr_t lastlabel; intptr_t lastlabel;
TArray<FState> StateArray; TArray<FState> StateArray;
@ -84,6 +85,7 @@ public:
FStateDefinitions() FStateDefinitions()
{ {
laststate = NULL; laststate = NULL;
laststatebeforelabel = NULL;
lastlabel = -1; lastlabel = -1;
} }