From 37656fa79918f34902e26b4c23b9199663965e5a Mon Sep 17 00:00:00 2001 From: neauoire Date: Sun, 11 Sep 2022 09:36:22 -0700 Subject: [PATCH] Raycast returns pos --- ray/src/ray.tal | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/ray/src/ray.tal b/ray/src/ray.tal index c3ad405..7fe78f0 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -18,7 +18,7 @@ |0000 @player - &x $2 &y $2 &a $2 &r $2 + &x $2 &y $2 &r $2 @line &x $2 &y $2 &dx $2 &dy $2 &e1 $2 @@ -50,9 +50,7 @@ BRK .Controller/button DEI DUP #10 NEQ ,&no-u JCN - .player/r LDZ2 #0002 STH2k ;raycast JSR2 - SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 - SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 + .player/r LDZ2 #0002 ;raycast JSR2 .player/y STZ2 .player/x STZ2 ;update JSR2 &no-u @@ -189,9 +187,7 @@ JMP2r ,&angle STR2 #ff01 &r - #00 OVR STH2k [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 - SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 - SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 + #00 OVR [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 OVR2 OVR2 ;get-tile JSR2 DUP #00 EQU ,&continue JCN POP ROT2 POP2 JMP2r @@ -208,9 +204,7 @@ JMP2r ,&angle STR2 #ff01 &r - #00 OVR STH2k [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 - SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 - SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 + #00 OVR [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 ;get-tile JSR2 DUP #00 EQU ,&continue JCN ROT POP JMP2r @@ -226,9 +220,9 @@ JMP2r STH2 #10 SFT2 ;sin60 ADD2 LDA2 #00 SWP STH2kr MUL2 #08 SFT2 ,&y STR2 - #00 SWP STH2r MUL2 #08 SFT2 ,&x STR2 - [ LIT2 &x $2 ] - [ LIT2 &y $2 ] + #00 SWP STH2kr MUL2 #08 SFT2 ,&x STR2 + [ LIT2 &x $2 ] .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 + [ LIT2 &y $2 ] .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 JMP2r