0
0
Fork 0
mirror of https://github.com/ZDoom/gzdoom-gles.git synced 2025-02-27 13:41:06 +00:00

- Make the palette indexes used by FRemapTable subject to the global remap

table, just as the images they translate are.


SVN r2002 (trunk)
This commit is contained in:
Randy Heit 2009-11-26 03:16:54 +00:00
parent 5d7670acc4
commit 787f00abf9
2 changed files with 23 additions and 14 deletions

View file

@ -1,3 +1,7 @@
November 25, 2009
- Make the palette indexes used by FRemapTable subject to the global remap
table, just as the images they translate are.
November 24, 2009 (Changes by Graf Zahl) November 24, 2009 (Changes by Graf Zahl)
- Added MF4_ALLOWPARTICLES checks to blood spawning code. - Added MF4_ALLOWPARTICLES checks to blood spawning code.
- Fixed: EV_DoDonut, EV_DoElevator and EV_StartWaggle did not to any 0-tag - Fixed: EV_DoDonut, EV_DoElevator and EV_StartWaggle did not to any 0-tag

View file

@ -315,18 +315,21 @@ void FRemapTable::AddIndexRange(int start, int end, int pal1, int pal2)
} }
else if (start == end) else if (start == end)
{ {
start = GPalette.Remap[start];
pal1 = GPalette.Remap[pal1];
Remap[start] = pal1; Remap[start] = pal1;
Palette[start] = GPalette.BaseColors[pal1]; Palette[start] = GPalette.BaseColors[pal1];
Palette[start].a = start==0? 0:255; Palette[start].a = start == 0 ? 0 : 255;
return; return;
} }
palcol = pal1 << FRACBITS; palcol = pal1 << FRACBITS;
palstep = ((pal2 << FRACBITS) - palcol) / (end - start); palstep = ((pal2 << FRACBITS) - palcol) / (end - start);
for (int i = start; i <= end; palcol += palstep, ++i) for (int i = start; i <= end; palcol += palstep, ++i)
{ {
Remap[i] = palcol >> FRACBITS; int j = GPalette.Remap[i], k = GPalette.Remap[palcol >> FRACBITS];
Palette[i] = GPalette.BaseColors[palcol >> FRACBITS]; Remap[j] = k;
Palette[i].a = i==0? 0:255; Palette[j] = GPalette.BaseColors[k];
Palette[j].a = j == 0 ? 0 : 255;
} }
} }
@ -368,10 +371,10 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
} }
if (start == end) if (start == end)
{ {
Remap[start] = ColorMatcher.Pick start = GPalette.Remap[start];
(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS); Remap[start] = ColorMatcher.Pick(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
Palette[start] = PalEntry(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS); Palette[start] = PalEntry(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
Palette[start].a = start==0? 0:255; Palette[start].a = start == 0 ? 0 : 255;
} }
else else
{ {
@ -380,9 +383,9 @@ void FRemapTable::AddColorRange(int start, int end, int _r1,int _g1, int _b1, in
bs /= (end - start); bs /= (end - start);
for (int i = start; i <= end; ++i) for (int i = start; i <= end; ++i)
{ {
Remap[i] = ColorMatcher.Pick int j = GPalette.Remap[i];
(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS); Remap[j] = ColorMatcher.Pick(r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
Palette[i] = PalEntry(start==0? 0:255, r >> FRACBITS, g >> FRACBITS, b >> FRACBITS); Palette[j] = PalEntry(j == 0 ? 0 : 255, r >> FRACBITS, g >> FRACBITS, b >> FRACBITS);
r += rs; r += rs;
g += gs; g += gs;
b += bs; b += bs;
@ -412,7 +415,7 @@ void FRemapTable::AddDesaturation(int start, int end, float r1,float g1, float b
g1 *= 255; g1 *= 255;
b1 *= 255; b1 *= 255;
for(int c=start; c < end; c++) for(int c = start; c < end; c++)
{ {
double intensity = (GPalette.BaseColors[c].r * 77 + double intensity = (GPalette.BaseColors[c].r * 77 +
GPalette.BaseColors[c].g * 143 + GPalette.BaseColors[c].g * 143 +
@ -422,9 +425,11 @@ void FRemapTable::AddDesaturation(int start, int end, float r1,float g1, float b
MIN(255, int(g1 + intensity*g2)), MIN(255, int(g1 + intensity*g2)),
MIN(255, int(b1 + intensity*b2))); MIN(255, int(b1 + intensity*b2)));
Remap[c] = ColorMatcher.Pick(pe); int cc = GPalette.Remap[c];
Palette[c] = pe;
Palette[c].a = c==0? 0:255; Remap[cc] = ColorMatcher.Pick(pe);
Palette[cc] = pe;
Palette[cc].a = cc == 0 ? 0:255;
} }
} }