- tun = *tunptr++;
- angle = tun & 0xffff;
- depth = tun >> 16;
- tx = (angle >> 6) & 0x7f;
- ty = ((depth >> 7) - zoffs) & 0x7f;
- pp = tuncross_pixels[(ty << 7) + tx];
+ vblperf_end();
+ wait_vblank();
+ present(backbuf);
+ vblperf_begin();
+ }
+}
+
+#define TUN_U(x) ((x) & 0x3f)
+#define TUN_V(x) (((x) >> 6) & 0x3ff)
+
+__attribute__((noinline, target("arm"), section(".iwram")))
+static void draw_tunnel(void)
+{
+ int i, j, tx, ty, u, v, angle, depth, zoffs, uoffs, flip, tunturn;
+ static int tunsweep;
+ uint16_t pptop, ppbot;
+ uint16_t *top, *bot;
+ uint32_t tun, *tunptr;
+
+ //tunsweep = SIN(nframes) >> 4;
+
+ if((bnstate & BN_RT) && tunsweep > -31) tunsweep--;
+ if((bnstate & BN_LT) && tunsweep < 31) tunsweep++;
+
+ flip = tunsweep < 0;
+ tunturn = abs(tunsweep) & 0x1f;
+
+ zoffs = num_vbl;
+ uoffs = (flip ? -num_vbl : num_vbl) >> 1;