From 08a6112a344ccf8633d90f83792bd7c878e7d631 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 10 Sep 2022 13:38:54 -0700 Subject: [PATCH] Basic rangefinding --- .gitignore | 9 +++++++++ ray/bin/ray.rom | Bin 1645 -> 0 bytes ray/src/ray.tal | 40 ++++++++++++++++++++++++++++------------ 3 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 .gitignore delete mode 100644 ray/bin/ray.rom diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cab9744 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.DS* +*jpg +*png +*bmp +/bin +*snarf +*theme +*nametable +*rom diff --git a/ray/bin/ray.rom b/ray/bin/ray.rom deleted file mode 100644 index 0720557067f44cb1d9f41d95f3f3995d611c03b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1645 zcmbtSOK2KV6upkd8b47X;7|e?t(^p0%=iJvv|tDX3NE{`ltL+WXGjpb>*Ba607x)Sy{1JZ6 zw-GD|*A}#bpr@dWphGB}v+!hu>oiRu1BxL?I}xr|=?yL~;3^eOxJ$ylmlm2D(^>F4 z=~rV(Tbbncf!w1A-8jR}x+=)MEj;^XTe!cOxLb(FSFsgyy~gKIVi&3Rf_&yuf$I;U1WzT% zQ)Gkbtr)SXd!Khjg}vmAUGcr$pEh1Vzw_pLPi{HBD5S@tG^Kdf5yuYD{ut*QLny*KOnrK^u$ zg}XfV+u&|ZN4VtU`!bg-)&%IpOdgmi8{MgSKr3E&)_FmA&5LC}Hg2jgRH(7qF{k)3 zzVjnd#C&N+_~vv(O{L{+2RhNNdam_S{rq5OSRPfz)k%GV$ zok4rp8a2m9+^kQk>B@zxE>yx^7T|{xPJpQ>-be)5Qik^ z9GvAG{vW;EJD0EUXXRX1o8Db!*>cXasQ)8llQytVk&N>c#)~prZ(K5=Etmt>)h`~+ l^Kh^&w>V@evt+pC45@K4S7WEAG?dwx{w ) + ;draw-map JSR2 + + .Mouse/x DEI2 #003c DIV2k MUL2 SUB2 .player/a STZ2 + .player/x LDZ2 .player/y LDZ2 - [ LIT2 &range 0020 ] STH2k ;raycast JSR2 + #0060 + STH2k ;raycast JSR2 - OVR2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 - #03 SFT2 ;print JSR2 #2018 DEO - DUP2 .player/y LDZ2 STH2kr #01 SFT2 SUB2 ADD2 - #03 SFT2 ;print JSR2 #0a18 DEO + OVR2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 + OVR2 .player/y LDZ2 STH2kr #01 SFT2 SUB2 ADD2 + ;get-tile JSR2 #00 NEQ ,&color STR SWP2 .player/x LDZ2 STH2kr #01 SFT2 SUB2 ADD2 SWP2 .player/y LDZ2 STH2r #01 SFT2 SUB2 ADD2 - #02 ;draw-line JSR2 - - ,&range LDR2 INC2 ,&range STR2 + #02 [ LIT &color $1 ] ADD ;draw-line JSR2 BRK +@cast ( -- range ) + + #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 + INC GTHk ,&r JCN + &collide + NIP + +JMP2r + @raycast ( range* -- x* y* ) STH2 @@ -98,8 +114,8 @@ JMP2r ( draw player ) - .player/x LDZ2 #0004 SUB2 .Screen/x DEO2 - .player/y LDZ2 #0004 SUB2 .Screen/y DEO2 + .player/x LDZ2 #0003 SUB2 .Screen/x DEO2 + .player/y LDZ2 #0003 SUB2 .Screen/y DEO2 ;player-icn .Screen/addr DEO2 #05 .Screen/sprite DEO @@ -120,8 +136,8 @@ JMP2r @get-tile ( x* y* -- tile ) - #03 SFT2 #0010 SFT2 - #03 SFT2 ADD2 #0003 MUL2 ;nametable ADD2 LDZ + #43 SFT2 SWP2 #03 SFT2 ADD2 #0003 MUL2 + ;nametable ADD2 LDA2 NIP JMP2r