From b81e9109291d13323e6cfaacaf45ebd2924b77f1 Mon Sep 17 00:00:00 2001 From: Jaime Moreira Date: Wed, 24 Apr 2024 19:43:24 -0400 Subject: [PATCH] GL1 multitexture, refactored memory allocation It was missing error checking and cleanup at shutdown. Also, reset state when needed. Fixes "death by laser" in boss1 map. --- src/client/refresh/gl1/gl1_lightmap.c | 61 ++++++++++++++++++--------- src/client/refresh/gl1/gl1_main.c | 5 +++ 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/client/refresh/gl1/gl1_lightmap.c b/src/client/refresh/gl1/gl1_lightmap.c index 6ff92ff5..2ee2dedc 100644 --- a/src/client/refresh/gl1/gl1_lightmap.c +++ b/src/client/refresh/gl1/gl1_lightmap.c @@ -31,13 +31,48 @@ extern gllightmapstate_t gl_lms; void R_SetCacheState(msurface_t *surf); void R_BuildLightMap(msurface_t *surf, byte *dest, int stride); +void +LM_FreeLightmapBuffers(void) +{ + for (int i=0; iorigin, shadelight); } + R_EnableMultitexture(false); glPushMatrix(); R_RotateForEntity(currententity); @@ -1654,6 +1657,7 @@ RI_Shutdown(void) ri.Cmd_RemoveCommand("imagelist"); ri.Cmd_RemoveCommand("gl_strings"); + LM_FreeLightmapBuffers(); Mod_FreeAll(); R_ShutdownImages(); @@ -1909,6 +1913,7 @@ R_DrawBeam(entity_t *e) VectorAdd(start_points[i], direction, end_points[i]); } + R_EnableMultitexture(false); glDisable(GL_TEXTURE_2D); glEnable(GL_BLEND); glDepthMask(GL_FALSE);