From 39a717262f4d280b7671d34656597cebe07a082a Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 10 Sep 2022 17:36:53 -0700 Subject: [PATCH] Optimized minimap --- ray/src/ray.tal | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/ray/src/ray.tal b/ray/src/ray.tal index 331d54b..9eb689a 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -144,6 +144,40 @@ JMP2r ;draw-map JSR2 + .player/x LDZ2 + .player/y LDZ2 + .player/r LDZ2 ;ray JSR2 + #01 ;draw-line JSR2 + + .player/x LDZ2 + .player/y LDZ2 + .player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray JSR2 + #02 ;draw-line JSR2 + + .player/x LDZ2 + .player/y LDZ2 + .player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray JSR2 + #02 ;draw-line JSR2 + +JMP2r + +@ray ( angle* -- x* y* ) + + ,&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 + OVR2 OVR2 ;get-tile JSR2 + DUP #00 EQU ,&continue JCN + POP ROT2 POP2 JMP2r + &continue + POP POP2 POP2 + INC GTHk ,&r JCN + POP2 + #0000 #0000 + JMP2r @cast ( -- range tile color ) @@ -163,7 +197,7 @@ JMP2r JMP2r -@raycast ( range* -- x* y* ) +@raycast ( angle* range* -- x* y* ) STH2 #10 SFT2 ;sin60 ADD2 LDA2