diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b4bb035af..025365822 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -465,7 +465,6 @@ if(${SRB2_CONFIG_HWRENDER}) ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c - ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c @@ -483,7 +482,6 @@ if(${SRB2_CONFIG_HWRENDER}) ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h - ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h ${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h diff --git a/src/Makefile b/src/Makefile index 98351a8a2..9951ca91d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -280,7 +280,7 @@ ifdef NOHW OPTS+=-DNOHW else OPTS+=-DHWRENDER - OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \ + OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \ $(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \ $(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o endif diff --git a/src/d_main.c b/src/d_main.c index ff05e1a64..685a3f2c9 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -624,8 +624,7 @@ static int menuInputDelayTimer = 0; void D_SRB2Loop(void) { - tic_t entertic = 0, oldentertics = 0, realtics = 0; - double rendertimeout = INFTICS; + tic_t entertic = 0, oldentertics = 0, realtics = 0, rendertimeout = INFTICS; double deltatics = 0.0; double deltasecs = 0.0; @@ -727,7 +726,7 @@ void D_SRB2Loop(void) if (lastdraw || singletics || gametic > rendergametic) { rendergametic = gametic; - rendertimeout = entertic + TICRATE/17.5; + rendertimeout = entertic + TICRATE/17; doDisplay = true; } diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c deleted file mode 100644 index 079349c37..000000000 --- a/src/hardware/hw_light.c +++ /dev/null @@ -1,27 +0,0 @@ -// SONIC ROBO BLAST 2 -//----------------------------------------------------------------------------- -// Copyright (C) 1993-1996 by id Software, Inc. -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2019 by Sonic Team Junior. -// -// This program is free software distributed under the -// terms of the GNU General Public License, version 2. -// See the 'LICENSE' file for more details. -//----------------------------------------------------------------------------- -/// \file - -#include "../doomdef.h" - -#ifdef HWRENDER -#include "hw_light.h" -#include "hw_drv.h" -#include "../i_video.h" -#include "../z_zone.h" -#include "../m_random.h" -#include "../m_bbox.h" -#include "../w_wad.h" -#include "../r_state.h" -#include "../r_main.h" -#include "../p_local.h" - -#endif // HWRENDER diff --git a/src/hardware/hw_light.h b/src/hardware/hw_light.h deleted file mode 100644 index fbc1d1f26..000000000 --- a/src/hardware/hw_light.h +++ /dev/null @@ -1,20 +0,0 @@ -// SONIC ROBO BLAST 2 -//----------------------------------------------------------------------------- -// Copyright (C) 1993-1996 by id Software, Inc. -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2019 by Sonic Team Junior. -// -// This program is free software distributed under the -// terms of the GNU General Public License, version 2. -// See the 'LICENSE' file for more details. -//----------------------------------------------------------------------------- -/// \file -/// \brief Dynamic lighting & coronas add on by Hurdler - -#ifndef _HW_LIGHTS_ -#define _HW_LIGHTS_ - -#include "hw_glob.h" -#include "hw_defs.h" - -#endif diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c4449f512..0b946ebeb 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -12,6 +12,7 @@ /// \brief hardware renderer, using the standard HardWareRender driver DLL for SRB2 #include +#include // qsort #include "../doomstat.h" @@ -24,7 +25,6 @@ #include "hw_batching.h" #include "hw_md2.h" #include "hw_clip.h" -#include "hw_light.h" #include "../i_video.h" // for rendermode == render_glide #include "../v_video.h" @@ -48,8 +48,6 @@ #include "../m_argv.h" // parm functions for msaa #include "../p_slopes.h" -#include // qsort - #define ABS(x) ((x) < 0 ? -(x) : (x)) #define SOFTLIGHT(llevel) HWR_ShouldUsePaletteRendering() ? ((llevel) >> LIGHTSEGSHIFT) << LIGHTSEGSHIFT : (llevel) @@ -5748,6 +5746,17 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) void HWR_LoadLevel(void) { + // Lactozilla (December 8, 2019) + // Level setup used to free EVERY mipmap from memory. + // Even mipmaps that aren't related to level textures. + // Presumably, the hardware render code used to store textures as level data. + // Meaning, they had memory allocated and marked with the PU_LEVEL tag. + // Level textures are only reloaded after R_LoadTextures, which is + // when the texture list is loaded. + + // Sal: Unfortunately, NOT freeing them causes the dreaded Color Bug. + HWR_FreeMipmapCache(); + HWR_CreatePlanePolygons((INT32)numnodes - 1); if (HWR_ShouldUsePaletteRendering()) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 0b43095da..c71f47185 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -26,7 +26,6 @@ #ifdef HWRENDER #include "hw_drv.h" -#include "hw_light.h" #include "hw_md2.h" #include "../d_main.h" #include "../r_bsp.h" diff --git a/src/p_setup.c b/src/p_setup.c index a78c1b318..5b1ef515e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -77,7 +77,6 @@ #endif #ifdef HWRENDER #include "hardware/hw_main.h" -#include "hardware/hw_light.h" #endif #include "p_slopes.h" @@ -2784,12 +2783,6 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate) // Clear pointers that would be left dangling by the purge R_FlushTranslationColormapCache(); -#ifdef HWRENDER - // Free GPU textures before freeing patches. - if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED)) - HWR_FreeMipmapCache(); -#endif - Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1); #if defined (WALLSPLATS) || defined (FLOORSPLATS) diff --git a/src/p_user.c b/src/p_user.c index bacdb920d..1219414df 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -55,7 +55,6 @@ #endif #ifdef HWRENDER -#include "hardware/hw_light.h" #include "hardware/hw_main.h" #endif