diff --git a/src/g_level.h b/src/g_level.h index 2df5af946..e7305e9da 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -362,7 +362,7 @@ struct level_info_t int outsidefogdensity; int skyfog; float pixelstretch; - + // Redirection: If any player is carrying the specified item, then // you go to the RedirectMap instead of this one. FName RedirectType; diff --git a/src/g_levellocals.h b/src/g_levellocals.h index b7f4f9aa3..505d797b6 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -67,6 +67,8 @@ struct FLevelLocals FString F1Pic; EMapType maptype; + uint64_t ShaderStartTime = 0; // tell the shader system when we started the level (forces a timer restart) + TArray vertexes; TArray sectors; TArray linebuffer; // contains the line lists for the sectors. diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index 609e80005..fe4af882f 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -37,6 +37,7 @@ #include "gl/renderer/gl_colormap.h" #include "gl/dynlights//gl_lightbuffer.h" #include "gl/renderer/gl_renderbuffers.h" +#include "g_levellocals.h" void gl_SetTextureMode(int type); @@ -121,7 +122,7 @@ bool FRenderState::ApplyShader() static uint64_t firstFrame = 0; // if firstFrame is not yet initialized, initialize it to current time // if we're going to overflow a float (after ~4.6 hours, or 24 bits), re-init to regain precision - if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1<<24)) + if ((firstFrame == 0) || (screen->FrameTime - firstFrame >= 1<<24) || level.ShaderStartTime > firstFrame) firstFrame = screen->FrameTime; static const float nulvec[] = { 0.f, 0.f, 0.f, 0.f }; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 02522d3df..336d4452e 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3627,6 +3627,8 @@ void P_SetupLevel (const char *lumpname, int position) bool buildmap; const int *oldvertextable = NULL; + level.ShaderStartTime = I_msTime(); // indicate to the shader system that the level just started + // This is motivated as follows: bool RequireGLNodes = Renderer->RequireGLNodes() || am_textured;