summaryrefslogtreecommitdiff
path: root/source/sw_block.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/sw_block.h')
-rw-r--r--source/sw_block.h48
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