From 55bb4afac8e1bce0838784e3375f373f5d1c8c57 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 7 Jul 2011 21:43:49 +0000 Subject: [PATCH] - backported GZDoom extensions to renderer interface. SVN r3266 (trunk) --- src/fragglescript/t_cmd.cpp | 8 ++------ src/p_setup.cpp | 10 ++++++++-- src/r_renderer.h | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/fragglescript/t_cmd.cpp b/src/fragglescript/t_cmd.cpp index 0bf88ea344..190c6b984d 100644 --- a/src/fragglescript/t_cmd.cpp +++ b/src/fragglescript/t_cmd.cpp @@ -46,9 +46,7 @@ #include "c_dispatch.h" #include "sc_man.h" #include "g_level.h" -#ifdef GLSUPPORT -#include "gl/gl_functions.h" -#endif +#include "r_renderer.h" //========================================================================== // @@ -186,9 +184,7 @@ void FS_EmulateCmd(char * string) { sc.MustGetNumber(); // Using this disables most MAPINFO fog options! -#ifdef GLSUPPORT - gl_SetFogParams(sc.Number*70/400, 0xff000000, 0, 0); -#endif + Renderer->SetFogParams(sc.Number*70/400, 0xff000000, 0, 0); } else if (sc.Compare("gr_fogcolor")) { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 0eac87b155..4a4f664741 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -66,6 +66,7 @@ #include "md5.h" #include "compatibility.h" #include "po_man.h" +#include "r_renderer.h" #include "r_data/colormaps.h" #include "fragglescript/t_fs.h" @@ -3273,6 +3274,7 @@ extern polyblock_t **PolyBlockMap; void P_FreeLevelData () { + Renderer->CleanLevelData(); FPolyObj::ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process. SN_StopAllSequences (); DThinker::DestroyAllThinkers (); @@ -3445,7 +3447,8 @@ void P_SetupLevel (char *lumpname, int position) bool buildmap; // This is motivated as follows: - bool RequireGLNodes = am_textured; + + bool RequireGLNodes = Renderer->RequireGLNodes() || am_textured; for (i = 0; i < (int)countof(times); ++i) { @@ -3756,7 +3759,7 @@ void P_SetupLevel (char *lumpname, int position) bool BuildGLNodes; if (ForceNodeBuild) { - BuildGLNodes = am_textured || multiplayer || demoplayback || demorecording || genglnodes; + BuildGLNodes = Renderer->RequireGLNodes() || am_textured || multiplayer || demoplayback || demorecording || genglnodes; startTime = I_FPSTime (); TArray polyspots, anchors; @@ -3900,6 +3903,9 @@ void P_SetupLevel (char *lumpname, int position) // set up world state P_SpawnSpecials (); + // This must be done BEFORE the PolyObj Spawn!!! + Renderer->PreprocessLevel(); + times[16].Clock(); if (reloop) P_LoopSidedefs (false); PO_Init (); // Initialize the polyobjs diff --git a/src/r_renderer.h b/src/r_renderer.h index e815abf12f..c9de1278ac 100644 --- a/src/r_renderer.h +++ b/src/r_renderer.h @@ -60,6 +60,10 @@ struct FRenderer virtual void CopyStackedViewParameters() {} virtual void RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov) = 0; virtual sector_t *FakeFlat(sector_t *sec, sector_t *tempsec, int *floorlightlevel, int *ceilinglightlevel, bool back) = 0; + virtual void SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog) {} + virtual void PreprocessLevel() {} + virtual void CleanLevelData() {} + virtual bool RequireGLNodes() { return false; } };