Prev: 41255 Up: Map Next: 41284
41261: Try Move
Moves an entity in the direction that it is heading, using MoveEntity, and then tests whether it has been blocked. An entity that is blocked by a cell of type 15 is allowed to carry on.
Input
B Number of steps that can still be taken
DE X position
HL Y position
Output
A The type of the cell that is blocking the entity
F The zero flag is set if the entity can carry on
TryMove 41261 CALL MoveEntity Move using MoveEntity, and return if the entity can carry on.
41264 RET Z
41265 PUSH HL Save the Y position.
41266 LD HL,(38446) Fetch the address of the cell that blocked the entity...
41269 LD A,(HL) ...and fetch its type.
41270 AND 15 Keep the current type of the cell.
41272 POP HL Restore the Y position.
41273 CP 15 Return if the cell is not type 15.
41275 RET NZ
41276 LD HL,(38485) Otherwise restore the Y position that the entity had before the move...
41279 LD DE,(38483) ...and the X position.
41283 RET Return with the zero flag set.
Prev: 41255 Up: Map Next: 41284