diff options
author | Andrey Nazarov <skuller@skuller.net> | 2007-08-14 20:18:08 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2007-08-14 20:18:08 +0000 |
commit | f294db4ccf45f6274e65260dd6f9a2c5faa94313 (patch) | |
tree | e8cf1ba2bfe9c8417eec17faf912442f52fc4ef2 /source/sw_block.h |
Initial import of the new Q2PRO tree.
Diffstat (limited to 'source/sw_block.h')
-rw-r--r-- | source/sw_block.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/source/sw_block.h b/source/sw_block.h new file mode 100644 index 0000000..98f5211 --- /dev/null +++ b/source/sw_block.h @@ -0,0 +1,48 @@ +#define BLOCK_SIZE ( 1 << BLOCK_SHIFT ) + +void BLOCK_FUNC( void ){ + int v, i, b, lightstep, lighttemp, light; + byte pix, *psource, *prowdest; + + psource = pbasesource; + prowdest = prowdestbase; + + for (v=0 ; v<r_numvblocks ; v++) + { + // FIXME: make these locals? + // FIXME: use delta rather than both right and left, like ASM? + lightleft = r_lightptr[0]; + lightright = r_lightptr[1]; + r_lightptr += r_lightwidth; + lightleftstep = (r_lightptr[0] - lightleft) >> BLOCK_SHIFT; + lightrightstep = (r_lightptr[1] - lightright) >> BLOCK_SHIFT; + + for (i=0 ; i<BLOCK_SIZE ; i++) + { + lighttemp = lightleft - lightright; + lightstep = lighttemp >> BLOCK_SHIFT; + + light = lightright; + + for (b=BLOCK_SIZE-1; b>=0; b--) + { + pix = psource[b]; + prowdest[b] = ((unsigned char *)vid.colormap) + [(light & 0xFF00) + pix]; + light += lightstep; + } + + psource += sourcetstep; + lightright += lightrightstep; + lightleft += lightleftstep; + prowdest += surfrowbytes; + } + + if (psource >= r_sourcemax) + psource -= r_stepback; + } +} + +#undef BLOCK_FUNC +#undef BLOCK_SIZE +#undef BLOCK_SHIFT |