From d180e552342e0a83563000d1762c6b6e4c5c6e3b Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 1 May 2014 16:55:48 +0000 Subject: [PATCH] engine.c: instead of fogpal post-tweaks (last 2 commits), normalize by numshades-1. That is, for every for palette (now, even ones created by the user) the last shade is the (or rather, a color close to the) full fog color by construction. In loadpalette(), reject a PALETTE.DAT with only one shade level. git-svn-id: https://svn.eduke32.com/eduke32@4458 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 88fd0d0e4..1a2ccdd9a 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -8051,7 +8051,7 @@ static int32_t loadpalette(void) kread(fil,palette,768); kread(fil,&numshades,2); numshades = B_LITTLE16(numshades); - if (numshades <= 0) + if (numshades <= 1) return loadpalette_err("Invalid number of shades in \"palette.dat\"!"); alloc_palookup(0); @@ -8254,18 +8254,11 @@ int32_t loadlookups(int32_t fp, uint8_t **basepaltabptr) for (j=1; j<=255-3; j++) if (!palookup[j] && !palookup[j+1] && !palookup[j+2] && !palookup[j+3]) { - int32_t i, k; - makepalookup(j, NULL, 15, 15, 15, 1); makepalookup(j+1, NULL, 15, 0, 0, 1); makepalookup(j+2, NULL, 0, 15, 0, 1); makepalookup(j+3, NULL, 0, 0, 15, 1); - // Make last shade value always map to the same color index. - for (k=0; k<3; k++) - for (i=1; i<255; i++) - palookup[j+k][((numshades-1)<<8) + i] = palookup[j+k][((numshades-1)<<8)]; - firstfogpal = j; break; } @@ -14985,7 +14978,7 @@ void makepalookup(int32_t palnum, const char *remapbuf, int8_t r, int8_t g, int8 for (i=0; i