From 11d447b3ef2de519e646802c0721e07cd5596133 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sun, 25 Apr 2021 17:22:29 +0300 Subject: [PATCH] fix --- src/gamescr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gamescr.c b/src/gamescr.c index 6eee713..23a8e21 100644 --- a/src/gamescr.c +++ b/src/gamescr.c @@ -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; -- 1.7.10.4