disabled dep-files when building on dos, because it goes into an infinite loop
[dosdemo] / src / tunnel.c
index 4fbc16b..9071b74 100644 (file)
@@ -1,10 +1,12 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <math.h>
 #include <assert.h>
 #include "imago2.h"
 #include "demo.h"
 #include "screen.h"
+#include "gfxutil.h"
 
 #ifndef M_PI
 #define M_PI   3.1415926535
@@ -26,8 +28,6 @@ static void draw_tunnel_range(unsigned short *pixels, int xoffs, int yoffs, int
 static int count_bits(unsigned int x);
 static int count_zeros(unsigned int x);
 
-static unsigned int *gen_test_image(int *wptr, int *hptr);
-
 static struct screen scr = {
        "tunnel",
        init,
@@ -183,11 +183,13 @@ static void draw(void)
                int starty = i * num_lines;
                int resty = starty + draw_lines;
                int rest_lines = num_lines - draw_lines;
-               draw_tunnel_range((unsigned short*)fb_pixels, xoffs, yoffs, starty, draw_lines, time_msec);
+               draw_tunnel_range(fb_pixels, xoffs, yoffs, starty, draw_lines, time_msec);
                if(rest_lines) {
-                       memset((unsigned short*)fb_pixels + resty * fb_width, 0, rest_lines * fb_width * 2);
+                       memset(fb_pixels + resty * fb_width, 0, rest_lines * fb_width * 2);
                }
        }
+
+       swap_buffers(0);
 }
 
 static void tunnel_color(int *rp, int *gp, int *bp, long toffs, unsigned int tpacked, int fog)
@@ -212,18 +214,13 @@ static void tunnel_color(int *rp, int *gp, int *bp, long toffs, unsigned int tpa
        *bp = (b * fog) >> 8;
 }
 
-#define PACK_RGB16(r, g, b) \
-       (((((r) >> 3) & 0x1f) << 11) | ((((g) >> 2) & 0x3f) << 5) | (((b) >> 3) & 0x1f))
-#define PACK_RGB32(r, g, b) \
-       ((((r) & 0xff) << 16) | (((g) & 0xff) << 8) | ((b) & 0xff))
-
 static void draw_tunnel_range(unsigned short *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;
+       long toffs = tm / 8;
        unsigned int *pixels = (unsigned int*)pix + starty * (fb_width >> 1);
 
        for(i=0; i<num_lines; i++) {
@@ -263,6 +260,7 @@ static int count_zeros(unsigned int x)
        return num;
 }
 
+/*
 static unsigned int *gen_test_image(int *wptr, int *hptr)
 {
        int i, j;
@@ -286,3 +284,4 @@ static unsigned int *gen_test_image(int *wptr, int *hptr)
        *hptr = ysz;
        return pixels;
 }
+*/