diff --git a/ray/src/ray.tal b/ray/src/ray.tal index 96a0ef9..b066113 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -67,11 +67,11 @@ BRK ;update JSR2 &no-r 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 &no-a 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 &no-b POP @@ -104,11 +104,10 @@ JMP2r .player/a LDZ2 #00 .Screen/auto DEO - #0100 #0000 + #0080 #0000 &h - DUP2 #0090 ADD2 .Screen/x DEO2 - DUP2 .player/r LDZ2 ADD2 #0400 DIV2k MUL2 SUB2 .player/a STZ2 - ( get distance ) ;cast JSR2 ;draw-col JSR2 + DUP2 #10 SFT2 #0090 ADD2 .Screen/x DEO2 + DUP2 .player/r LDZ2 ADD2 #03ff AND2 ;ray-tile JSR2 ;draw-col JSR2 INC2 GTH2k ,&h JCN POP2 POP2 .player/a STZ2 @@ -170,22 +169,22 @@ JMP2r .player/x LDZ2 .player/y LDZ2 - .player/r LDZ2 ;ray JSR2 + .player/r LDZ2 ;ray-pos JSR2 #01 ;draw-line JSR2 .player/x 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 .player/x 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 JMP2r -@ray ( angle* -- x* y* ) +@ray-pos ( angle* -- x* y* ) ,&angle STR2 #ff01 @@ -204,11 +203,12 @@ JMP2r JMP2r -@cast ( -- range tile color ) +@ray-tile ( angle* -- distance color ) - #8001 + ,&angle STR2 + #ff01 &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/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 ;get-tile JSR2 @@ -217,7 +217,7 @@ JMP2r &continue POP INC GTHk ,&r JCN - NIP #00 + NIP JMP2r