- unsigned int tx = (((*tmap >> 16) & 0xffff) << tex_xshift) >> 16;
- unsigned int ty = ((*tmap & 0xffff) << tex_yshift) >> 16;
- ++tmap;
-
- tx += toffs;
- ty += toffs << 1;
-
- tx &= tex_xmask;
- ty &= tex_ymask;
-
- col = tex_pixels[(ty << tex_xshift) + tx];
- r = col & 0xff;
- g = (col >> 8) & 0xff;
- b = (col >> 16) & 0xff;
-
- r = (r * *fog) >> 8;
- g = (g * *fog) >> 8;
- b = (b * *fog) >> 8;
- ++fog;
-
- col = ((((r >> 3) & 0x1f) << 11) | (((g >> 2) & 0x3f) << 5) | ((b >> 3) & 0x1f));
-
- ptr = pixels;
- for(k=0; k<VSCALE; k++) {
- switch(USCALE) {
- case 4:
- ptr[3] = col;
- case 3:
- ptr[2] = col;
- case 2:
- ptr[1] = col;
- case 1:
- *ptr = col;
- }
- ptr += xsz;
- }
- pixels += USCALE;
+ int r, g, b;
+
+ tunnel_color(&r, &g, &b, toffs, tmap[j], fog[j]);
+ col = PACK_RGB16(r, g, b);
+ *pixels++ = (col << 16) | col;
+ }
+ tmap += vxsz;
+ fog += vxsz;
+ }
+}
+
+static void draw_tunnel_range32(void *pix, int xoffs, int yoffs, int starty, int num_lines, long tm)
+{
+ int i, j;
+ unsigned int *tmap = tunnel_map + (starty + yoffs) * vxsz + xoffs;
+ unsigned char *fog = tunnel_fog + (starty + yoffs) * vxsz + xoffs;
+
+ long toffs = tm / 4;
+ unsigned int *pixels = (unsigned int*)pix + starty * fb_width;
+
+ for(i=0; i<num_lines; i++) {
+ for(j=0; j<xsz; j++) {
+ unsigned int col;
+ int r, g, b;
+
+ tunnel_color(&r, &g, &b, toffs, tmap[j], fog[j]);
+ col = PACK_RGB32(r, g, b);
+
+ *pixels++ = col;
+ *pixels++ = col;