From 4458fe897f6616abedb28443480269347d8a4dc8 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Sat, 24 Feb 2024 14:07:04 +0100 Subject: [PATCH] voxel: consider colormap changes when caching blood translation tables --- src/r_voxel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/r_voxel.c b/src/r_voxel.c index e1b00888..d967a8b9 100644 --- a/src/r_voxel.c +++ b/src/r_voxel.c @@ -1066,18 +1066,19 @@ void VX_DrawVoxel (vissprite_t * spr) if ((spr->mobjflags2 & MF2_COLOREDBLOOD) && (spr->colormap[0] != NULL)) { - static const byte * prev_trans = NULL; - const byte * trans = red2col[spr->color]; + static const byte * prev_trans = NULL, * prev_map = NULL; + const byte * trans = red2col[spr->color], * map = spr->colormap[0]; static byte new_colormap[256]; - if (prev_trans != trans) + if (prev_trans != trans || prev_map != map) { int i; for (i = 0 ; i < 256 ; i++) - new_colormap[i] = spr->colormap[0][trans[i]]; + new_colormap[i] = map[trans[i]]; prev_trans = trans; + prev_map = map; } spr->colormap[0] = new_colormap;