From 771500d9f85ae3e3ac858568cef02753a4b9d6e1 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Fri, 22 Dec 2023 10:21:55 +0100 Subject: [PATCH] Incorrect surf_styles param size for LightPlane. Most callee's already used MAXCPULIGHTMAPS as size, which the function expects. --- engine/client/render.h | 2 +- engine/gl/gl_heightmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/client/render.h b/engine/client/render.h index 0ad014001..56b053eed 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -582,7 +582,7 @@ void Mod_SubmodelLoaded(struct model_s *mod, int state); #ifdef RUNTIMELIGHTING struct relight_ctx_s; struct llightinfo_s; -void LightPlane (struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[4], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale); //special version that doesn't know what a face is or anything. +void LightPlane (struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[MAXCPULIGHTMAPS], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale); //special version that doesn't know what a face is or anything. struct relight_ctx_s *LightStartup(struct relight_ctx_s *ctx, struct model_s *model, qboolean shadows, qboolean skiplit); void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles); void LightShutdown(struct relight_ctx_s *ctx); diff --git a/engine/gl/gl_heightmap.c b/engine/gl/gl_heightmap.c index a8a41c270..f8d694f31 100644 --- a/engine/gl/gl_heightmap.c +++ b/engine/gl/gl_heightmap.c @@ -5738,7 +5738,7 @@ void Terr_Brush_Draw(heightmap_t *hm, batch_t **batches, entity_t *e) { if (br->faces[j].relight && dorelight) { - lightstyleindex_t styles[4] = {0,INVALID_LIGHTSTYLE,INVALID_LIGHTSTYLE,INVALID_LIGHTSTYLE}; + lightstyleindex_t styles[max(2,MAXCPULIGHTMAPS)] = {0,INVALID_LIGHTSTYLE}; int texsize[2] = {br->faces[j].lmextents[0]-1, br->faces[j].lmextents[1]-1}; vec2_t exactmins, exactmaxs; int m, k;