From ac4450885f493292fa5322ad3734f0bebf9551ef Mon Sep 17 00:00:00 2001 From: neauoire Date: Sun, 11 Sep 2022 10:31:59 -0700 Subject: [PATCH] Upscaled world --- ray/src/ray.tal | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/ray/src/ray.tal b/ray/src/ray.tal index 5098e21..5547a4e 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -36,8 +36,8 @@ ;on-mouse .Mouse/vector DEO2 ;on-button .Controller/vector DEO2 - #0060 .player/x STZ2 - #0070 .player/y STZ2 + #0060 #10 SFT2 .player/x STZ2 + #0070 #10 SFT2 .player/y STZ2 ;update JSR2 @@ -50,7 +50,7 @@ BRK .Controller/button DEI DUP #10 NEQ ,&no-u JCN - .player/r LDZ2 #0002 ;raycast JSR2 + .player/r LDZ2 #0004 ;raycast JSR2 .player/y STZ2 .player/x STZ2 ;update JSR2 @@ -117,7 +117,7 @@ JMP2r @draw-col ( distance* color -- ) #04 SFT ,&color STR - ( TODO ) NIP + #01 SFT2 NIP STH #8000 &l @@ -163,29 +163,35 @@ JMP2r ( draw player ) - .player/x LDZ2 #0003 SUB2 .Screen/x DEO2 - .player/y LDZ2 #0003 SUB2 .Screen/y DEO2 + .player/x LDZ2 #01 SFT2 #0003 SUB2 .Screen/x DEO2 + .player/y LDZ2 #01 SFT2 #0003 SUB2 .Screen/y DEO2 ;player-icn .Screen/addr DEO2 #05 .Screen/sprite DEO - .player/x LDZ2 .player/y LDZ2 - .player/r LDZ2 ;ray-pos JSR2 + .player/x LDZ2 .player/y LDZ2 ;to-scale JSR2 + .player/r LDZ2 ;ray-pos JSR2 ;to-scale JSR2 #01 ;draw-line JSR2 - .player/x LDZ2 .player/y LDZ2 - .player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray-pos JSR2 + .player/x LDZ2 .player/y LDZ2 ;to-scale JSR2 + .player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray-pos JSR2 ;to-scale JSR2 #02 ;draw-line JSR2 - .player/x LDZ2 .player/y LDZ2 - .player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray-pos JSR2 + .player/x LDZ2 .player/y LDZ2 ;to-scale JSR2 + .player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray-pos JSR2 ;to-scale JSR2 #02 ;draw-line JSR2 JMP2r +@to-scale ( x* y* -- x* y* ) + + SWP2 #01 SFT2 SWP2 #01 SFT2 + +JMP2r + @ray-pos ( angle* -- x* y* ) ,&angle STR2 - #0100 #0001 + #0200 #0001 &r DUP2 [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 DUP2 ,&y STR2 @@ -201,7 +207,7 @@ JMP2r @ray-tile ( angle* -- distance* color ) ,&angle STR2 - #0100 #0001 + #0200 #0001 &r DUP2 ,&distance STR2 DUP2 [ LIT2 &angle $2 ] SWP2 ;raycast JSR2 @@ -228,6 +234,7 @@ JMP2r @get-tile ( x* y* -- tile ) + ;to-scale JSR2 #43 SFT2 SWP2 #03 SFT2 ADD2 #0003 MUL2 ;nametable ADD2 LDA2 NIP