Prev: 6C95 Up: Map Next: 6CFA
6CC2: Check the tiles next to Horace or a guard
Used by the routines at 624F, 6337 and 63DA.
Input
A Sprite animation frame
HL Sprite location
Output
A 1 (tunnel entrance), 2 (maze exit/entrance), 3 (wall), or 0 (none of these)
6CC2 PUSH BC Save BC.
6CC3 PUSH DE Save DE.
6CC4 PUSH HL Save the sprite location.
6CC5 LD BC,$4000 Convert the sprite location into a display file address.
6CC8 ADD HL,BC
6CC9 CALL $6D17 Set HL to the display file address of the tile in front of the sprite.
6CCC CALL $6C0F Set HL' to the corresponding attribute file address.
6CCF EXX Exchange registers.
6CD0 LD E,$00 E' will hold the indicator of any interesting tiles at this location; initialise it now.
6CD2 CALL $6CFA Check the top-left tile.
6CD5 INC HL Point HL' at the top-right tile.
6CD6 CALL $6CFA Check the top-right tile.
6CD9 LD BC,$001F Point HL' at the bottom-left tile.
6CDC ADD HL,BC
6CDD CALL $6CFA Check the bottom-left tile.
6CE0 INC HL Point HL' at the bottom-right tile.
6CE1 CALL $6CFA Check the bottom-right tile.
6CE4 LD A,E Copy the tile indicator to A.
6CE5 EXX Exchange registers.
6CE6 POP HL Restore the sprite location to HL.
6CE7 POP DE Restore DE.
6CE8 POP BC Restore BC.
6CE9 CP $FF Is the sprite facing a wall tile?
6CEB JR NZ,$6CF0 Jump if not.
6CED LD A,$03 Signal: sprite is facing a wall tile.
6CEF RET
6CF0 AND $0A Return with A=1 if the sprite is facing a tunnel entrance.
6CF2 RRC A
6CF4 CP $01
6CF6 RET Z
6CF7 RRC A Now A=2 if the sprite is facing the maze exit/entrance, or 0 otherwise.
6CF9 RET
Prev: 6C95 Up: Map Next: 6CFA