diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/refresh/sw/block.h | 10 | ||||
-rw-r--r-- | src/refresh/sw/edge.c | 5 | ||||
-rw-r--r-- | src/refresh/sw/light.c | 4 | ||||
-rw-r--r-- | src/refresh/sw/scan.c | 13 |
4 files changed, 24 insertions, 8 deletions
diff --git a/src/refresh/sw/block.h b/src/refresh/sw/block.h index 85ae441..5a4a370 100644 --- a/src/refresh/sw/block.h +++ b/src/refresh/sw/block.h @@ -2,8 +2,8 @@ void BLOCK_FUNC(void) { - int v, i, b, lightstep, lighttemp, light; - byte pix, *psource, *prowdest; + int v, i, b, lightstep, lighttemp, light; + byte *psource, *prowdest; psource = pbasesource; prowdest = prowdestbase; @@ -24,9 +24,9 @@ void BLOCK_FUNC(void) light = lightright; for (b = BLOCK_SIZE - 1; b >= 0; b--) { - pix = psource[b]; - prowdest[b] = ((unsigned char *)vid.colormap) - [(light & 0xFF00) + pix]; + prowdest[b * TEX_BYTES + 0] = (psource[b * TEX_BYTES + 0] * light) >> 16; + prowdest[b * TEX_BYTES + 1] = (psource[b * TEX_BYTES + 1] * light) >> 16; + prowdest[b * TEX_BYTES + 2] = (psource[b * TEX_BYTES + 2] * light) >> 16; light += lightstep; } diff --git a/src/refresh/sw/edge.c b/src/refresh/sw/edge.c index 7a0a854..d7270d3 100644 --- a/src/refresh/sw/edge.c +++ b/src/refresh/sw/edge.c @@ -738,7 +738,10 @@ void D_FlatFillSurface(surf_t *surf, uint32_t color) pdest = (byte *)d_viewbuffer + d_scantable[span->v] + span->u * VID_BYTES; count = span->count; do { - *pdest++ = color & 0xff; + pdest[0] = color & 0xff; + pdest[1] = (color >> 8) & 0xff; + pdest[2] = (color >> 16) & 0xff; + pdest += VID_BYTES; } while (--count); } } diff --git a/src/refresh/sw/light.c b/src/refresh/sw/light.c index b256ab5..ec31e37 100644 --- a/src/refresh/sw/light.c +++ b/src/refresh/sw/light.c @@ -322,12 +322,16 @@ void R_BuildLightMap(void) // bound, invert, and shift for (i = 0; i < size; i++) { t = blocklights[i]; +#if 0 if (t < 0) t = 0; t = (255 * 256 - t) >> (8 - VID_CBITS); if (t < (1 << 6)) t = (1 << 6); +#else + clamp(t, 255, 65535); +#endif blocklights[i] = t; } diff --git a/src/refresh/sw/scan.c b/src/refresh/sw/scan.c index 2742404..7a00aea 100644 --- a/src/refresh/sw/scan.c +++ b/src/refresh/sw/scan.c @@ -94,11 +94,16 @@ D_DrawTurbulent8Span void D_DrawTurbulent8Span(void) { int sturb, tturb; + byte *ptex; do { sturb = ((r_turb_s + r_turb_turb[(r_turb_t >> 16) & (CYCLE - 1)]) >> 16) & 63; tturb = ((r_turb_t + r_turb_turb[(r_turb_s >> 16) & (CYCLE - 1)]) >> 16) & 63; - *r_turb_pdest++ = *(r_turb_pbase + (tturb << 6) + sturb); + ptex = r_turb_pbase + (tturb * 64 * TEX_BYTES) + sturb * TEX_BYTES; + r_turb_pdest[0] = ptex[2]; + r_turb_pdest[1] = ptex[1]; + r_turb_pdest[2] = ptex[0]; + r_turb_pdest += VID_BYTES; r_turb_s += r_turb_sstep; r_turb_t += r_turb_tstep; } while (--r_turb_spancount > 0); @@ -480,7 +485,11 @@ void D_DrawSpans16(espan_t *pspan) } do { - *pdest++ = *(pbase + (s >> 16) + (t >> 16) * cachewidth); + pbase = (byte *)cacheblock + (s >> 16) * TEX_BYTES + (t >> 16) * cachewidth; + pdest[0] = pbase[2]; + pdest[1] = pbase[1]; + pdest[2] = pbase[0]; + pdest += VID_BYTES; s += sstep; t += tstep; } while (--spancount > 0); |