X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=fbgfx;a=blobdiff_plain;f=src%2Ftunnel.c;fp=src%2Ftunnel.c;h=a348431ab3c0d6d3e9550257dac91c7ab3f04269;hp=0000000000000000000000000000000000000000;hb=4b522caf5387f8075b7bbb2a2b0475c012157456;hpb=7e9af893a6d14c0136a89648a2fdebab614a662f diff --git a/src/tunnel.c b/src/tunnel.c new file mode 100644 index 0000000..a348431 --- /dev/null +++ b/src/tunnel.c @@ -0,0 +1,68 @@ +#include +#include +#include +#include +#include "tunnel.h" + +static int xsz, ysz; +static unsigned int *tunnel_map; + + +int init_tunnel(int x, int y) +{ + int i, j; + unsigned int *tmap; + + xsz = x; + ysz = y; + + printf("precalculating tunnel map...\n"); + + if(!(tunnel_map = malloc(xsz * ysz * sizeof *tunnel_map))) { + fprintf(stderr, "failed to allocate tunnel map\n"); + return -1; + } + tmap = tunnel_map; + + for(i=0; i> 16) & 0xffff; + unsigned int ty = *tmap & 0xffff; + ++tmap; + + r = tx >> 8; + g = ty >> 8; + + *pixels++ = ((((r >> 3) & 0x1f) << 11) | + (((g >> 2) & 0x3f) << 5));/* | + ((b >> 3) & 0x1f));*/ + } + } +}