Reflect orientation in viewport

This commit is contained in:
neauoire 2022-09-10 17:47:00 -07:00
parent 55ebe5d26d
commit a036e4a7fb
1 changed files with 14 additions and 14 deletions

View File

@ -67,11 +67,11 @@ BRK
;update JSR2 ;update JSR2
&no-r &no-r
DUP #01 NEQ ,&no-a JCN DUP #01 NEQ ,&no-a JCN
.player/r LDZ2k #0008 SUB2 #03ff AND2 ROT STZ2 .player/r LDZ2k #0004 SUB2 #03ff AND2 ROT STZ2
;update JSR2 ;update JSR2
&no-a &no-a
DUP #02 NEQ ,&no-b JCN DUP #02 NEQ ,&no-b JCN
.player/r LDZ2k #0008 ADD2 #03ff AND2 ROT STZ2 .player/r LDZ2k #0004 ADD2 #03ff AND2 ROT STZ2
;update JSR2 ;update JSR2
&no-b &no-b
POP POP
@ -104,11 +104,10 @@ JMP2r
.player/a LDZ2 .player/a LDZ2
#00 .Screen/auto DEO #00 .Screen/auto DEO
#0100 #0000 #0080 #0000
&h &h
DUP2 #0090 ADD2 .Screen/x DEO2 DUP2 #10 SFT2 #0090 ADD2 .Screen/x DEO2
DUP2 .player/r LDZ2 ADD2 #0400 DIV2k MUL2 SUB2 .player/a STZ2 DUP2 .player/r LDZ2 ADD2 #03ff AND2 ;ray-tile JSR2 ;draw-col JSR2
( get distance ) ;cast JSR2 ;draw-col JSR2
INC2 GTH2k ,&h JCN INC2 GTH2k ,&h JCN
POP2 POP2 POP2 POP2
.player/a STZ2 .player/a STZ2
@ -170,22 +169,22 @@ JMP2r
.player/x LDZ2 .player/x LDZ2
.player/y LDZ2 .player/y LDZ2
.player/r LDZ2 ;ray JSR2 .player/r LDZ2 ;ray-pos JSR2
#01 ;draw-line JSR2 #01 ;draw-line JSR2
.player/x LDZ2 .player/x LDZ2
.player/y LDZ2 .player/y LDZ2
.player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray JSR2 .player/r LDZ2 #0040 SUB2 #03ff AND2 ;ray-pos JSR2
#02 ;draw-line JSR2 #02 ;draw-line JSR2
.player/x LDZ2 .player/x LDZ2
.player/y LDZ2 .player/y LDZ2
.player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray JSR2 .player/r LDZ2 #0040 ADD2 #03ff AND2 ;ray-pos JSR2
#02 ;draw-line JSR2 #02 ;draw-line JSR2
JMP2r JMP2r
@ray ( angle* -- x* y* ) @ray-pos ( angle* -- x* y* )
,&angle STR2 ,&angle STR2
#ff01 #ff01
@ -204,11 +203,12 @@ JMP2r
JMP2r JMP2r
@cast ( -- range tile color ) @ray-tile ( angle* -- distance color )
#8001 ,&angle STR2
#ff01
&r &r
#00 OVR STH2k .player/a LDZ2 SWP2 ;raycast JSR2 #00 OVR STH2k [ LIT2 &angle $2 ] SWP2 ;raycast JSR2
SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2
SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2
;get-tile JSR2 ;get-tile JSR2
@ -217,7 +217,7 @@ JMP2r
&continue &continue
POP POP
INC GTHk ,&r JCN INC GTHk ,&r JCN
NIP #00 NIP
JMP2r JMP2r