Optimized minimap

This commit is contained in:
neauoire 2022-09-10 17:36:53 -07:00
parent 7dcb59d93e
commit 39a717262f
1 changed files with 35 additions and 1 deletions

View File

@ -144,6 +144,40 @@ JMP2r
;draw-map JSR2 ;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 JMP2r
@cast ( -- range tile color ) @cast ( -- range tile color )
@ -163,7 +197,7 @@ JMP2r
JMP2r JMP2r
@raycast ( range* -- x* y* ) @raycast ( angle* range* -- x* y* )
STH2 STH2
#10 SFT2 ;sin60 ADD2 LDA2 #10 SFT2 ;sin60 ADD2 LDA2