unknown changes
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Tue, 17 Jan 2017 23:15:28 +0000 (01:15 +0200)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Tue, 17 Jan 2017 23:15:28 +0000 (01:15 +0200)
src/main.c
src/tunnel.c

index f18563e..4d63726 100644 (file)
@@ -19,7 +19,7 @@ static int quit;
 
 int main(void)
 {
-       int i, trybpp[] = {32, 24, 16, 0};
+       int i, trybpp[] = {16, 32, 24, 16, 0};
 
        fbgfx_save_video_mode();
        fbgfx_get_video_mode(&fb_width, &fb_height, &fb_depth);
index c331f2d..221fadc 100644 (file)
 #define TEX_USCALE     4
 #define TEX_VSCALE     2
 
+#define NUM_WORK_ITEMS 8
+
+static struct work {
+       void *pixels;
+       int starty, num_lines;
+       long tm;
+       int xoffs, yoffs;
+} work[NUM_WORK_ITEMS];
+
 static int init(void);
 static void destroy(void);
 static void start(long trans_time);
@@ -140,6 +149,13 @@ static int init(void)
                return -1;
        }
 
+       /* initialize the constant part of all work items */
+       for(i=0; i<NUM_WORK_ITEMS; i++) {
+               int num_lines = ysz / NUM_WORK_ITEMS;
+               work[i].pixels = fb_pixels;
+               work[i].starty = i * num_lines;
+       }
+
        return 0;
 }
 
@@ -152,26 +168,22 @@ static void destroy(void)
 
 static void start(long trans_time)
 {
-       trans_start = time_msec;
-       trans_dur = trans_time;
-       trans_dir = 1;
+       if(trans_time) {
+               trans_start = time_msec;
+               trans_dur = trans_time;
+               trans_dir = 1;
+       }
 }
 
 static void stop(long trans_time)
 {
-       trans_start = time_msec;
-       trans_dur = trans_time;
-       trans_dir = -1;
+       if(trans_time) {
+               trans_start = time_msec;
+               trans_dur = trans_time;
+               trans_dir = -1;
+       }
 }
 
-#define NUM_WORK_ITEMS 32
-
-static struct work {
-       void *pixels;
-       int starty, num_lines;
-       long tm;
-       int xoffs, yoffs;
-} work[NUM_WORK_ITEMS];
 
 static void work_func(void *cls)
 {
@@ -204,8 +216,6 @@ static void draw(void)
        yoffs = (int)(sin(t * 4.0) * pan_height / 2) + pan_height / 2;
 
        for(i=0; i<NUM_WORK_ITEMS; i++) {
-               work[i].pixels = fb_pixels;
-               work[i].starty = i * num_lines;
                work[i].num_lines = draw_lines;
                work[i].tm = time_msec;
                work[i].xoffs = xoffs;
@@ -259,7 +269,7 @@ static void draw_tunnel_range16(void *pix, int xoffs, int yoffs, int starty, int
 
                        tunnel_color(&r, &g, &b, toffs, tmap[j], fog[j]);
                        col = PACK_RGB16(r, g, b);
-                       *pixels++ = col;
+                       *pixels++ = (col << 16) | col;
                }
                tmap += vxsz;
                fog += vxsz;