diff --git a/ray/src/ray.tal b/ray/src/ray.tal index bee7d40..1c6aeb7 100644 --- a/ray/src/ray.tal +++ b/ray/src/ray.tal @@ -97,13 +97,14 @@ BRK JMP2r -@draw-col ( distance -- ) +@draw-col ( distance color -- ) + #04 SFT ,&color STR STH #8000 &l #00 OVR .Screen/y DEO2 - DUP STHkr ;get-color JSR2 .Screen/pixel DEO + DUP STHkr ;get-color JSR2 [ LIT &color $1 ] ADD .Screen/pixel DEO INC GTHk ,&l JCN POP2 POPr @@ -113,7 +114,6 @@ JMP2r @get-color ( y distance -- color ) OVR #40 GTH ,&bottom JCN - #01 SFT GTH INC JMP2r @@ -130,7 +130,7 @@ JMP2r .player/x LDZ2 .player/y LDZ2 - [ #00 ;cast JSR2 ] + [ #00 ;cast JSR2 ] POP STH2k ;raycast JSR2 OVR2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 OVR2 .player/y LDZ2 STH2kr #01 SFT2 SUB2 ADD2 @@ -141,17 +141,20 @@ JMP2r JMP2r -@cast ( -- range ) +@cast ( -- range tile ) #8001 &r #00 OVR STH2k ;raycast JSR2 SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 - ;get-tile JSR2 #00 NEQ ,&collide JCN + ;get-tile JSR2 + DUP #00 EQU ,&continue JCN + ROT POP JMP2r + &continue + POP INC GTHk ,&r JCN - &collide - NIP + NIP #00 JMP2r