From f8481aae420d613bdbfea960ed23df9fe2b70d7e Mon Sep 17 00:00:00 2001 From: Samuel Walker Date: Sun, 1 Sep 2024 08:24:41 -0600 Subject: [PATCH] fixed issues (sorta) --- src/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.c b/src/main.c index 322f27a..6b5d201 100644 --- a/src/main.c +++ b/src/main.c @@ -154,6 +154,9 @@ void castRay(s16 angle, s16 column){ //Wall height calcs shortestDist = fix16Mul(dx, shortestDist); + if(shortestDist < 0){ + shortestDist = -shortestDist; + } fix16 wallHeightFix16 = fix16Div(FIX16(SCREEN_HEIGHT), (shortestDist + FIX16(1))); wallHeightFix16 = fix16Mul(wallHeightFix16, WALL_HEIGHT_SCALE); int wallHeight = fix16ToInt(wallHeightFix16);