diff --git a/gui/dads/dads.tal b/gui/dads/dads.tal index 7e03964..d74bb07 100644 --- a/gui/dads/dads.tal +++ b/gui/dads/dads.tal @@ -34,7 +34,7 @@ BRK @on-mouse ( -> ) - [ LIT2 00 -Mouse/state ] DEI NEQ #42 ADD ;cursor-icn update-cursor + [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn update-cursor .Mouse/state DEI ?&on-touch BRK @@ -43,7 +43,7 @@ BRK .Mouse/x DEI2 #0008 SUB2 NIP #18 DIV .Mouse/y DEI2 #0008 SUB2 NIP #18 DIV - move + try-move #00 .Mouse/state DEO BRK @@ -63,9 +63,7 @@ BRK JMP2r &found ( bounds* -- block* ) - NIP #00 SWP #0006 MUL2 ;game ADD2 - JMP2r @is-at ( block* x y -- f ) @@ -77,9 +75,31 @@ JMP2r JMP2r -@move ( x y -- ) +@try-move ( x y -- ) - pick phex #0a18 DEO + pick DUP2 #ffff EQU2 ?&blank + ( up ) + DUP2 INC2k INC2 LDA2 #0100 SUB2 can-move phex/b #2018 DEO + ( right ) + DUP2 INC2k INC2 LDA2 #0001 ADD2 can-move phex/b #2018 DEO + ( down ) + DUP2 INC2k INC2 LDA2 #0100 ADD2 can-move phex/b #2018 DEO + ( left ) + DUP2 INC2k INC2 LDA2 #0100 SUB2 can-move phex/b #2018 DEO + phex #0a18 DEO + +JMP2r +&blank ( block* -- ) + POP2 +JMP2r + +@is-free ( x y -- f ) + +JMP2r + +@can-move ( block* x y -- f ) + + POP2 POP2 #00 JMP2r