Basic detection routine
This commit is contained in:
parent
dcd92a5dfb
commit
f01eee7482
|
@ -78,15 +78,16 @@ JMP2r
|
|||
@try-move ( x y -- )
|
||||
|
||||
pick DUP2 #ffff EQU2 ?&blank
|
||||
OVR2 phex #0a18 DEO
|
||||
( up )
|
||||
DUP2 INC2k INC2 LDA2 #0100 SUB2 can-move phex/b #2018 DEO
|
||||
DUP2 #00ff can-move phex/b #0a18 DEO
|
||||
( right )
|
||||
DUP2 INC2k INC2 LDA2 #0001 ADD2 can-move phex/b #2018 DEO
|
||||
DUP2 #0001 can-move phex/b #0a18 DEO
|
||||
( down )
|
||||
DUP2 INC2k INC2 LDA2 #0100 ADD2 can-move phex/b #2018 DEO
|
||||
DUP2 #0100 can-move phex/b #0a18 DEO
|
||||
( left )
|
||||
DUP2 INC2k INC2 LDA2 #0100 SUB2 can-move phex/b #2018 DEO
|
||||
phex #0a18 DEO
|
||||
DUP2 #ff00 can-move phex/b #0a18 DEO
|
||||
POP2
|
||||
|
||||
JMP2r
|
||||
&blank ( block* -- )
|
||||
|
@ -95,11 +96,38 @@ JMP2r
|
|||
|
||||
@is-free ( x y -- f )
|
||||
|
||||
POP2 #00
|
||||
|
||||
JMP2r
|
||||
|
||||
@can-move ( block* x y -- f )
|
||||
|
||||
POP2 POP2 #00
|
||||
OVR2 ,&self STR2
|
||||
OVR2 STH2 INC2r INC2r LDA2r
|
||||
STHr ADD ,&offy STR
|
||||
STHr ADD ,&offx STR
|
||||
LDA2
|
||||
,&height STR
|
||||
,&width STR
|
||||
|
||||
[ LIT2 &height $1 00 ]
|
||||
&v
|
||||
STHk
|
||||
[ LIT2 &width $1 00 ]
|
||||
&h
|
||||
DUP [ LIT &offx $1 ] ADD
|
||||
STHkr [ LIT &offy $1 ] ADD
|
||||
pick
|
||||
DUP2 #ffff EQU2 ?&blank
|
||||
DUP2 [ LIT2 &self $2 ] EQU2 ?&blank
|
||||
POP2 POP2 POP2 POPr #00 JMP2r
|
||||
&blank
|
||||
POP2
|
||||
INC GTHk ?&h
|
||||
POP2 POPr
|
||||
INC GTHk ?&v
|
||||
POP2
|
||||
#01
|
||||
|
||||
JMP2r
|
||||
|
||||
|
|
Loading…
Reference in New Issue