Prev: 27797 Up: Map Next: 27898
27842: Check the tiles next to Horace or a guard
Used by the routines at 25167, 25399 and 25562.
Input
A Sprite animation frame
HL Sprite location
Output
A 1 (tunnel entrance), 2 (maze exit/entrance), 3 (wall), or 0 (none of these)
27842 PUSH BC Save BC.
27843 PUSH DE Save DE.
27844 PUSH HL Save the sprite location.
27845 LD BC,16384 Convert the sprite location into a display file address.
27848 ADD HL,BC
27849 CALL 27927 Set HL to the display file address of the tile in front of the sprite.
27852 CALL 27663 Set HL' to the corresponding attribute file address.
27855 EXX Exchange registers.
27856 LD E,0 E' will hold the indicator of any interesting tiles at this location; initialise it now.
27858 CALL 27898 Check the top-left tile.
27861 INC HL Point HL' at the top-right tile.
27862 CALL 27898 Check the top-right tile.
27865 LD BC,31 Point HL' at the bottom-left tile.
27868 ADD HL,BC
27869 CALL 27898 Check the bottom-left tile.
27872 INC HL Point HL' at the bottom-right tile.
27873 CALL 27898 Check the bottom-right tile.
27876 LD A,E Copy the tile indicator to A.
27877 EXX Exchange registers.
27878 POP HL Restore the sprite location to HL.
27879 POP DE Restore DE.
27880 POP BC Restore BC.
27881 CP 255 Is the sprite facing a wall tile?
27883 JR NZ,27888 Jump if not.
27885 LD A,3 Signal: sprite is facing a wall tile.
27887 RET
27888 AND 10 Return with A=1 if the sprite is facing a tunnel entrance.
27890 RRC A
27892 CP 1
27894 RET Z
27895 RRC A Now A=2 if the sprite is facing the maze exit/entrance, or 0 otherwise.
27897 RET
Prev: 27797 Up: Map Next: 27898