From 88b05fe2a10f20299a44ce7f23de7892489a552b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 17 Sep 2013 17:31:29 -0500 Subject: [PATCH 1/2] Fixed: SHGetKnownFolderPath needs to be declared as WINAPI. --- src/m_specialpaths.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_specialpaths.cpp b/src/m_specialpaths.cpp index cd116e538a..469f7587e5 100644 --- a/src/m_specialpaths.cpp +++ b/src/m_specialpaths.cpp @@ -15,7 +15,7 @@ #if defined(_WIN32) #include "version.h" // for GAMENAME -typedef HRESULT (*GKFP)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *); +typedef HRESULT (WINAPI *GKFP)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *); //=========================================================================== // From e021fba5e1813636245baad445d260240da73a63 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 17 Sep 2013 20:44:13 -0500 Subject: [PATCH 2/2] Improve NoDelay reliability. - Instead of tying NoDelay behavior to OF_JustSpawned, use a new actor flag, MF7_HANDLENODELAY. This only gets cleared once it has actually been checked by Tick(). This is necessary because freeze mode delays the initial run of Tick() past the initial spawn, so OF_JustSpawned will no longer be set when it does the initial tick. - Delay NoDelay processing if an actor is spawned dormant. Actors spawned dormant have Deactivate() called before they tick, so MF7_HANDLENODELAY will remain set as long as an actor is dormant. This allows the NoDelay handling to occur as expected once it is activated. --- src/actor.h | 3 ++- src/dobject.h | 2 +- src/dthinker.cpp | 2 +- src/p_mobj.cpp | 27 ++++++++++++++++----------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/actor.h b/src/actor.h index c60b6a516a..3a97ef49a2 100644 --- a/src/actor.h +++ b/src/actor.h @@ -334,11 +334,12 @@ enum MF6_NOTONAUTOMAP = 0x40000000, // will not be shown on automap with the 'scanner' powerup. MF6_RELATIVETOFLOOR = 0x80000000, // [RC] Make flying actors be affected by lifts. -// --- mobj.flags6 --- +// --- mobj.flags7 --- MF7_NEVERTARGET = 0x00000001, // can not be targetted at all, even if monster friendliness is considered. MF7_NOTELESTOMP = 0x00000002, // cannot telefrag under any circumstances (even when set by MAPINFO) MF7_ALWAYSTELEFRAG = 0x00000004, // will unconditionally be telefragged when in the way. Overrides all other settings. + MF7_HANDLENODELAY = 0x00000008, // respect NoDelay state flag // --- mobj.renderflags --- diff --git a/src/dobject.h b/src/dobject.h index 2ae5493c6d..40b47ee5c5 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -473,7 +473,7 @@ public: // use this method. virtual size_t PointerSubstitution (DObject *old, DObject *notOld); static size_t StaticPointerSubstitution (DObject *old, DObject *notOld); - + PClass *GetClass() const { if (Class == NULL) diff --git a/src/dthinker.cpp b/src/dthinker.cpp index 15206dabdd..327b297318 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -457,7 +457,7 @@ int DThinker::TickThinkers (FThinkerList *list, FThinkerList *dest) node->PostBeginPlay(); } else if (dest != NULL) - { // Move thinker from this list to the destination list + { I_Error("There is a thinker in the fresh list that has already ticked.\n"); } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 13f9de0af3..492dd33891 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3525,19 +3525,23 @@ void AActor::Tick () Destroy(); return; } - if (ObjectFlags & OF_JustSpawned && state->GetNoDelay()) + if ((flags7 & MF7_HANDLENODELAY) && !(flags2 & MF2_DORMANT)) { - // 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)) - 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. - if (starttics > 0 && tics >= 0) + flags7 &= ~MF7_HANDLENODELAY; + if (state->GetNoDelay()) { - tics++; + // 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)) + 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 @@ -4024,6 +4028,7 @@ void AActor::PostBeginPlay () Renderer->StateChanged(this); } PrevAngle = angle; + flags7 |= MF7_HANDLENODELAY; } void AActor::MarkPrecacheSounds() const