mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Color swizzle & software lighting fix
This commit is contained in:
parent
d80342e0a8
commit
d1a8c1b277
2 changed files with 38 additions and 18 deletions
|
@ -193,20 +193,30 @@ R_BuildLightMap (void)
|
|||
if (surf->dlightframe == r_framecount)
|
||||
R_AddDynamicLights ();
|
||||
|
||||
// // LordHavoc: changed to positive (not inverse) lighting
|
||||
// for (i = 0; i < size; i++) {
|
||||
// t = bound(256, blocklights[i] >> (8 - VID_CBITS),
|
||||
// 256 * (VID_GRADES - 1));
|
||||
// blocklights[i] = t;
|
||||
// }
|
||||
// bound, invert, and shift
|
||||
for (i = 0; i < size; i++) {
|
||||
t = (255 * 256 - blocklights[i]) >> (8 - VID_CBITS);
|
||||
/*
|
||||
* JohnnyonFlame:
|
||||
* 32 and 16bpp modes uses the positive lighting, unlike 8bpp
|
||||
*/
|
||||
switch (sw32_r_pixbytes) {
|
||||
case 1:
|
||||
// bound, invert, and shift
|
||||
for (i = 0; i < size; i++) {
|
||||
t = (255 * 256 - blocklights[i]) >> (8 - VID_CBITS);
|
||||
|
||||
if (t < (1 << 6))
|
||||
t = (1 << 6);
|
||||
if (t < (1 << 6))
|
||||
t = (1 << 6);
|
||||
|
||||
blocklights[i] = t;
|
||||
blocklights[i] = t;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// LordHavoc: changed to positive (not inverse) lighting
|
||||
for (i = 0; i < size; i++) {
|
||||
t = bound(256, blocklights[i] >> (8 - VID_CBITS),
|
||||
256 * (VID_GRADES - 1));
|
||||
blocklights[i] = t;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,31 +55,41 @@ VID_MakeColormap32 (void *outcolormap, byte *pal)
|
|||
int c, l;
|
||||
byte *out;
|
||||
out = (byte *)&d_8to24table;
|
||||
|
||||
/*
|
||||
* Generates colors not affected by lighting, such as
|
||||
* HUD pieces and general sprites (such as explosions)
|
||||
*/
|
||||
for (c = 0; c < 256; c++) {
|
||||
*out++ = pal[c*3+0];
|
||||
*out++ = pal[c*3+1];
|
||||
*out++ = pal[c*3+2];
|
||||
*out++ = pal[c*3+1];
|
||||
*out++ = pal[c*3+0];
|
||||
*out++ = 255;
|
||||
}
|
||||
d_8to24table[255] = 0; // 255 is transparent
|
||||
out = (byte *) outcolormap;
|
||||
|
||||
/*
|
||||
* Generates colors affected by lighting, such as the
|
||||
* world and other models that give it life, like foes and pickups.
|
||||
*/
|
||||
for (l = 0;l < VID_GRADES;l++)
|
||||
{
|
||||
for (c = 0;c < vid.fullbright;c++)
|
||||
{
|
||||
out[(l*256+c)*4+0] = bound(0, (pal[c*3+0] * l) >> (VID_CBITS - 1),
|
||||
out[(l*256+c)*4+0] = bound(0, (pal[c*3+2] * l) >> (VID_CBITS - 1),
|
||||
255);
|
||||
out[(l*256+c)*4+1] = bound(0, (pal[c*3+1] * l) >> (VID_CBITS - 1),
|
||||
255);
|
||||
out[(l*256+c)*4+2] = bound(0, (pal[c*3+2] * l) >> (VID_CBITS - 1),
|
||||
out[(l*256+c)*4+2] = bound(0, (pal[c*3+0] * l) >> (VID_CBITS - 1),
|
||||
255);
|
||||
out[(l*256+c)*4+3] = 255;
|
||||
}
|
||||
for (;c < 255;c++)
|
||||
{
|
||||
out[(l*256+c)*4+0] = pal[c*3+0];
|
||||
out[(l*256+c)*4+0] = pal[c*3+2];
|
||||
out[(l*256+c)*4+1] = pal[c*3+1];
|
||||
out[(l*256+c)*4+2] = pal[c*3+2];
|
||||
out[(l*256+c)*4+2] = pal[c*3+0];
|
||||
out[(l*256+c)*4+3] = 255;
|
||||
}
|
||||
out[(l*256+255)*4+0] = 0;
|
||||
|
|
Loading…
Reference in a new issue