fix
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 25 Apr 2021 14:22:29 +0000 (17:22 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 25 Apr 2021 14:22:29 +0000 (17:22 +0300)
src/gamescr.c

index 6eee713..23a8e21 100644 (file)
@@ -91,7 +91,7 @@ void gamescr(void)
 }
 
 #define TUN_U(x)       ((x) & 0x3f)
-#define TUN_V(x)       (((x) >> 7) & 0x1ff)
+#define TUN_V(x)       (((x) >> 6) & 0x3ff)
 
 __attribute__((noinline, target("arm"), section(".iwram")))
 static void draw_tunnel(void)
@@ -111,7 +111,7 @@ static void draw_tunnel(void)
        tunturn = abs(tunsweep) & 0x1f;
 
        zoffs = num_vbl;
-       uoffs = 0;//(flip ? -num_vbl : num_vbl) >> 2;
+       uoffs = (flip ? -num_vbl : num_vbl) >> 1;
 
        top = vram[backbuf];
        bot = vram[backbuf] + 159 * 240 / 2;
@@ -126,7 +126,7 @@ static void draw_tunnel(void)
                                angle = TUN_U(tun >> 16);
                                depth = TUN_V(tun >> 16);
                                tx = ~(angle - uoffs) & 0x1f;
-                               ty = (depth + zoffs) & 0x1f;
+                               ty = ((depth >> 1) + zoffs) & 0x1f;
                                pptop = tex[(ty << 5) + tx];
                                tx = (angle + uoffs) & 0x1f;
                                ppbot = tex[(ty << 5) + tx];
@@ -134,7 +134,7 @@ static void draw_tunnel(void)
                                angle = TUN_U(tun);
                                depth = TUN_V(tun);
                                tx = ~(angle - uoffs) & 0x1f;
-                               ty = (depth + zoffs) & 0x1f;
+                               ty = ((depth >> 1) + zoffs) & 0x1f;
                                pptop |= (uint16_t)tex[(ty << 5) + tx] << 8;
                                tx = (angle + uoffs) & 0x1f;
                                ppbot |= (uint16_t)tex[(ty << 5) + tx] << 8;
@@ -153,7 +153,7 @@ static void draw_tunnel(void)
                                angle = TUN_U(tun);
                                depth = TUN_V(tun);
                                tx = (angle - uoffs) & 0x1f;
-                               ty = (depth + zoffs) & 0x1f;
+                               ty = ((depth >> 1) + zoffs) & 0x1f;
                                pptop = tex[(ty << 5) + tx];
                                tx = ~(angle + uoffs) & 0x1f;
                                ppbot = tex[(ty << 5) + tx];
@@ -161,7 +161,7 @@ static void draw_tunnel(void)
                                angle = TUN_U(tun >> 16);
                                depth = TUN_V(tun >> 16);
                                tx = (angle - uoffs) & 0x1f;
-                               ty = (depth + zoffs) & 0x1f;
+                               ty = ((depth >> 1) + zoffs) & 0x1f;
                                pptop |= (uint16_t)tex[(ty << 5) + tx] << 8;
                                tx = ~(angle + uoffs) & 0x1f;
                                ppbot |= (uint16_t)tex[(ty << 5) + tx] << 8;