SVN r146 (trunk)

This commit is contained in:
Christoph Oelckers 2006-05-26 08:19:39 +00:00
parent 90b5130db0
commit 5abd6b972c
2 changed files with 20 additions and 7 deletions

View file

@ -1,3 +1,8 @@
May 26, 2006 (Changes by Graf Zahl)
- Fixed: CallStateChain relied on CallingState being preserved across the
call of the state's action function. This is not the case when a missile
is being spawned and exploded right away.
May 25, 2006
- Fixed: The C code in AltSoundRenderer::CopyAndClip() did not shift the sample
data enough (2 bits instead of 8), so it was super loud and aliased.

View file

@ -107,13 +107,12 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState * State)
bool result = false;
int counter = 0;
StateCall.State = State;
while (StateCall.State != NULL)
while (State != NULL)
{
// Assume success. The code pointer will set this to false if necessary
StateCall.Result = true;
CallingState = StateCall.State;
StateCall.State->GetAction() (actor);
CallingState = StateCall.State = State;
State->GetAction() (actor);
// collect all the results. Even one successful call signifies overall success.
result |= StateCall.Result;
@ -122,16 +121,25 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState * State)
counter++;
if (counter >= 10000) break;
if (StateCall.State == CallingState)
if (StateCall.State == State)
{
// Abort immediately if the state jumps to itself!
if (StateCall.State == StateCall.State->GetNextState()) return false;
if (State == State->GetNextState())
{
StateCall.State = NULL;
return false;
}
// If both variables are still the same there was no jump
// so we must advance to the next state.
StateCall.State = StateCall.State->GetNextState();
State = State->GetNextState();
}
else
{
State = StateCall.State;
}
}
StateCall.State = NULL;
return result;
}