Raycast returns pos

This commit is contained in:
neauoire 2022-09-11 09:36:22 -07:00
parent 5bfd6b3e72
commit 37656fa799
1 changed files with 7 additions and 13 deletions

View File

@ -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