Faster raycast-pos

This commit is contained in:
neauoire 2022-09-11 09:49:06 -07:00
parent 0fe97c02e4
commit ea67f4a700
1 changed files with 8 additions and 12 deletions

View File

@ -166,18 +166,15 @@ JMP2r
;player-icn .Screen/addr DEO2 ;player-icn .Screen/addr DEO2
#05 .Screen/sprite DEO #05 .Screen/sprite DEO
.player/x LDZ2 .player/x LDZ2 .player/y LDZ2
.player/y LDZ2
.player/r LDZ2 ;ray-pos JSR2 .player/r LDZ2 ;ray-pos JSR2
#01 ;draw-line JSR2 #01 ;draw-line JSR2
.player/x LDZ2 .player/x LDZ2 .player/y LDZ2
.player/y LDZ2
.player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray-pos JSR2 .player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray-pos JSR2
#02 ;draw-line JSR2 #02 ;draw-line JSR2
.player/x LDZ2 .player/x LDZ2 .player/y LDZ2
.player/y LDZ2
.player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray-pos JSR2 .player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray-pos JSR2
#02 ;draw-line JSR2 #02 ;draw-line JSR2
@ -189,14 +186,13 @@ JMP2r
#ff01 #ff01
&r &r
#00 OVR [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 #00 OVR [ LIT2 &angle $2 ] SWP2 ;raycast JSR2
OVR2 OVR2 ;get-tile JSR2 DUP2 ,&y STR2
DUP #00 EQU ,&continue JCN OVR2 ,&x STR2
POP ROT2 POP2 JMP2r ;get-tile JSR2 ,&end JCN
&continue
POP POP2 POP2
INC GTHk ,&r JCN INC GTHk ,&r JCN
&end
POP2 POP2
#0000 #0000 ( res ) [ LIT2 &x $2 ] [ LIT2 &y $2 ]
JMP2r JMP2r