From ea67f4a700490f72bf5758312ec6a5a196552c46 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sun, 11 Sep 2022 09:49:06 -0700 Subject: [PATCH] Faster raycast-pos --- ray/src/ray.tal | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ray/src/ray.tal b/ray/src/ray.tal index f56a539..5a7f969 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -166,18 +166,15 @@ JMP2r ;player-icn .Screen/addr DEO2 #05 .Screen/sprite DEO - .player/x LDZ2 - .player/y LDZ2 + .player/x LDZ2 .player/y LDZ2 .player/r LDZ2 ;ray-pos JSR2 #01 ;draw-line JSR2 - .player/x LDZ2 - .player/y LDZ2 + .player/x LDZ2 .player/y LDZ2 .player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray-pos JSR2 #02 ;draw-line JSR2 - .player/x LDZ2 - .player/y LDZ2 + .player/x LDZ2 .player/y LDZ2 .player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray-pos JSR2 #02 ;draw-line JSR2 @@ -189,14 +186,13 @@ JMP2r #ff01 &r #00 OVR [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 - OVR2 OVR2 ;get-tile JSR2 - DUP #00 EQU ,&continue JCN - POP ROT2 POP2 JMP2r - &continue - POP POP2 POP2 + DUP2 ,&y STR2 + OVR2 ,&x STR2 + ;get-tile JSR2 ,&end JCN INC GTHk ,&r JCN + &end POP2 - #0000 #0000 + ( res ) [ LIT2 &x $2 ] [ LIT2 &y $2 ] JMP2r