X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Ftunnel.c;h=9071b74ea4a1cba12010c6bcd4c86c88bfff6da3;hp=ee6758e083e45ebb63dec771881306774e6395d5;hb=3398fc6c4188104048f99b650a6cb90beda9b6ed;hpb=2c2834ca26bf4d2b9f6a588c9aa53a8b36510bd6 diff --git a/src/tunnel.c b/src/tunnel.c index ee6758e..9071b74 100644 --- a/src/tunnel.c +++ b/src/tunnel.c @@ -1,10 +1,12 @@ #include #include +#include #include #include -/*#include */ +#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, @@ -102,16 +102,16 @@ static int init(void) } } - /*if(!(tex_pixels = img_load_pixels(TEX_FNAME, &tex_xsz, &tex_ysz, IMG_FMT_RGBA32))) { + if(!(tex_pixels = img_load_pixels(TEX_FNAME, &tex_xsz, &tex_ysz, IMG_FMT_RGBA32))) { fprintf(stderr, "failed to load image " TEX_FNAME "\n"); return -1; } if((count_bits(tex_xsz) | count_bits(tex_ysz)) != 1) { fprintf(stderr, "non-pow2 image (%dx%d)\n", tex_xsz, tex_ysz); return -1; - }*/ + } - tex_pixels = gen_test_image(&tex_xsz, &tex_ysz); + /*tex_pixels = gen_test_image(&tex_xsz, &tex_ysz);*/ n = count_zeros(tex_xsz); for(i=0; i> 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