Clamp rotation

This commit is contained in:
neauoire 2022-09-10 17:23:43 -07:00
parent 63c89f3ce4
commit d78e0f21a1
1 changed files with 4 additions and 14 deletions

View File

@ -97,6 +97,8 @@ BRK
@update ( -- )
.player/a LDZ2k #03ff AND2 ROT STZ2
.player/r LDZ2k #03ff AND2 ROT STZ2
;draw-viewport JSR2
;draw-minimap JSR2
@ -146,25 +148,13 @@ JMP2r
;draw-map JSR2
.player/x LDZ2
.player/y LDZ2
[ #00 ;cast JSR2 ] POP
STH2k ;raycast JSR2
OVR2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2
OVR2 .player/y LDZ2 STH2kr #01 SFT2 SUB2 ADD2
;get-tile JSR2 #00 NEQ ,&color STR
SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 SWP2
.player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2
#02 [ LIT &color $1 ] ADD ;draw-line JSR2
JMP2r
@cast ( -- range tile color )
#8001
&r
#00 OVR STH2k ;raycast JSR2
#00 OVR STH2k .player/a LDZ2 SWP2 ;raycast JSR2
SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2
SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2
;get-tile JSR2
@ -180,7 +170,7 @@ JMP2r
@raycast ( range* -- x* y* )
STH2
.player/a LDZ2 #10 SFT2 ;sin60 ADD2 LDA2
#10 SFT2 ;sin60 ADD2 LDA2
#00 SWP STH2kr MUL2 #08 SFT2 ,&y STR2
#00 SWP STH2r MUL2 #08 SFT2 ,&x STR2
[ LIT2 &x $2 ]