From d78e0f21a1d5a963a37719d0bb5799203e056d08 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 10 Sep 2022 17:23:43 -0700 Subject: [PATCH] Clamp rotation --- ray/src/ray.tal | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ray/src/ray.tal b/ray/src/ray.tal index 6c32822..80c5e9a 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -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 ]