mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
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
This commit is contained in:
parent
c697835073
commit
d180e55234
1 changed files with 2 additions and 9 deletions
|
@ -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<numshades; i++)
|
||||
{
|
||||
int32_t palscale = divscale16(i,numshades);
|
||||
int32_t palscale = divscale16(i,numshades-1);
|
||||
|
||||
for (j=0; j<256; j++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue