From 4bc60ec900454d9af511d975033034f1acf8c70f Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 28 Apr 2013 03:55:31 +0000 Subject: [PATCH] - Added Blzut3's noextratic fix. SVN r4231 (trunk) --- src/p_mobj.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 9895d7a56d..9b697863d4 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3498,22 +3498,29 @@ void AActor::Tick () // cycle through states, calling action functions at transitions if (tics != -1) { - tics--; - // you can cycle through multiple states in a tic - // [RH] Use <= 0 instead of == 0 so that spawnstates - // of 0 tics work as expected. - if (tics <= 0) + // [BL] If we reach here with a 0 duration state, we + // have created an extra tic, so account for it. + int newtics; + do { - assert (state != NULL); - if (state == NULL) + newtics = --tics; + + // [RH] Use tics <= 0 instead of == 0 so that spawnstates + // of 0 tics work as expected. + if (tics <= 0) { - Destroy(); - return; + assert (state != NULL); + if (state == NULL) + { + Destroy(); + return; + } + if (!SetState (state->GetNextState())) + return; // freed itself } - if (!SetState (state->GetNextState())) - return; // freed itself } + while (newtics < 0); } else {