Fix the black overbright dlights.

t was unsigned and underflowing. This fixes the problem but keeps the
bitshift unsigned clean.
This commit is contained in:
Bill Currie 2012-01-09 17:47:25 +09:00
parent 310ba49f17
commit 2b45cd693f

View file

@ -124,8 +124,8 @@ static void
R_BuildLightMap_1 (msurface_t *surf) R_BuildLightMap_1 (msurface_t *surf)
{ {
int smax, tmax, size; int smax, tmax, size;
unsigned scale, t; unsigned scale;
int i; int i, t;
byte *out; byte *out;
smax = (surf->extents[0] >> 4) + 1; smax = (surf->extents[0] >> 4) + 1;
@ -163,10 +163,10 @@ R_BuildLightMap_1 (msurface_t *surf)
// bound, invert, and shift // bound, invert, and shift
out = (byte *) blocklights; out = (byte *) blocklights;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
t = (255 * 256 - (int) blocklights[i]) >> (8 - VID_CBITS); t = (255 * 256 - (int) blocklights[i]);
t = max (t, 1 << (14 - VID_CBITS));
t = max (t, 1 << 6); t = ((unsigned) t) >> (16 - VID_CBITS);
*out++ = t >> 8; *out++ = t;
} }
GL_SubpicUpdate (surf->lightpic, (byte *) blocklights); GL_SubpicUpdate (surf->lightpic, (byte *) blocklights);