From 10934f4d705b97cf90c1c7ad87fb1e790e28226e Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 29 Apr 2013 21:12:57 +0000 Subject: [PATCH] - Lets try fixing the extra tic issue by evaluating the zero delay states at PostBeginPlay. This requires delaying the state cycling until the next tick. SVN r4234 (trunk) --- src/p_mobj.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 70b1a7d13a..4a00a40b68 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3498,29 +3498,21 @@ void AActor::Tick () // cycle through states, calling action functions at transitions if (tics != -1) { - // you can cycle through multiple states in a tic - // [BL] If we reach here with a 0 duration state, we - // have created an extra tic, so account for it. - int newtics; - do + // [RH] Use tics <= 0 instead of == 0 so that spawnstates + // of 0 tics work as expected. + if (tics <= 0) { - newtics = --tics; - - // [RH] Use tics <= 0 instead of == 0 so that spawnstates - // of 0 tics work as expected. - if (tics <= 0) + assert (state != NULL); + if (state == NULL) { - assert (state != NULL); - if (state == NULL) - { - Destroy(); - return; - } - if (!SetState (state->GetNextState())) - return; // freed itself + Destroy(); + return; } + if (!SetState (state->GetNextState())) + return; // freed itself } - while (newtics < 0 && tics != -1); + + tics--; } else { @@ -3991,6 +3983,13 @@ void AActor::PostBeginPlay () Renderer->StateChanged(this); } PrevAngle = angle; + + // [BL] Run zero-delay spawn states now so that we don't create a tic later + if(tics == 0 && state) + { + if (!SetState (state->GetNextState())) + return; // freed itself + } } void AActor::MarkPrecacheSounds() const