From 5aba252b873ae6885b2fc056c9ede5105213ef59 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 24 Feb 2015 20:37:58 -0600 Subject: [PATCH] Simplify NoDelay implementation - All NoDelay needs to do is call the current state's function. Calling SetState() is excessive. --- src/p_mobj.cpp | 12 ++---------- src/thingdef/thingdef_codeptr.cpp | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 2235c78200..1d933a22b1 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3673,17 +3673,9 @@ void AActor::Tick () if (state->GetNoDelay()) { // For immediately spawned objects with the NoDelay flag set for their - // Spawn state, explicitly set the current state so that it calls its - // action and chains 0-tic states. - int starttics = tics; - if (!SetState(state)) + // Spawn state, explicitly call the current state's function. + if (state->CallAction(this, this) && (ObjectFlags & OF_EuthanizeMe)) return; // freed itself - // If the initial state had a duration of 0 tics, let the next state run - // normally. Otherwise, increment tics by 1 so that we don't double up ticks. - else if (starttics > 0 && tics >= 0) - { - tics++; - } } } // cycle through states, calling action functions at transitions diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index c30d09c7a0..7dcab88160 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2375,7 +2375,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) if (text[0] == '$') text = GStrings(text+1); FString formatted = strbin1(text); - Printf("%s\n", formatted.GetChars()); + Printf("%4d: %s\n", gametic, formatted.GetChars()); ACTION_SET_RESULT(false); // Prints should never set the result for inventory state chains! }