[qwaq] Copy only those bytes in the colormap tex

The fullbright count byte in a colormap is not in the generated colormap
texture data. Attempting to read it results in an angry valgrind.
This commit is contained in:
Bill Currie 2022-09-22 10:19:30 +09:00
parent 3147443617
commit a1813868fc

View file

@ -303,7 +303,10 @@ generate_colormap (void)
memcpy (colors[i][224], colors[31][224], 32 * 3); memcpy (colors[i][224], colors[31][224], 32 * 3);
} }
tex_t *cmap = ConvertImage (&tex, default_palette[0]); tex_t *cmap = ConvertImage (&tex, default_palette[0]);
memcpy (default_colormap, cmap->data, sizeof (default_colormap)); // the colormap has an extra byte indicating the number of fullbright
// entries, but that byte is not in the image, so don't try to copy it,
// thus the - 1
memcpy (default_colormap, cmap->data, sizeof (default_colormap) - 1);
free (cmap); free (cmap);
} }