Prev: 8B0C Up: Map Next: 8B90
8B1F: Update Monty and act on room flags
Used by the routine at 89D4.
Input
IX Pointer to room flags (8D52).
8B1F LD A,($5C7C) Take 2 off the current Y position.
8B22 SUB $02
8B24 LD ($5C7C),A
8B27 LD HL,$8D58 Increment the distance fallen (8D58).
8B2A INC (HL)
8B2B LD A,($5C7C) Put the old Y position in A.
8B2E ADD A,$02
8B30 INC (HL) Increment the distance fallen.
8B31 CALL $8452 Redraw Monty. Control continues to 8B34.
This entry point is used by the routines at 8A0A and 8A63.
8B34 CALL $8B90 Check Monty's current movement.
8B37 LD HL,$5C7C Get the current position in HL.
8B3A BIT 1,(IX+$00) Is Monty jumping?
8B3E JR NZ,$8B46 Move forward if so.
8B40 SET 0,(HL) Align Monty with a pixel boundary.
8B42 DEC HL
8B43 RES 0,(HL)
8B45 INC HL
Check that Monty can move in all directions, and block movement that is not possible.
8B46 LD A,($8D7E) Get the temporary Y co-ordinate.
8B49 BIT 7,(IX+$00) Can Monty move up?
8B4D JR Z,$8B55 Jump if so.
8B4F CP (HL) Is the current co-ordinate out of bounds?
8B50 JR NC,$8B55 Jump forward if not.
8B52 LD (HL),A Re-align Monty on the appropriate boundary and jump forward.
8B53 JR $8B5F
8B55 BIT 6,(IX+$00) Can Monty move down?
8B59 JR Z,$8B5F Jump if so.
8B5B CP (HL) Is the current co-ordinate out of bounds?
8B5C JR C,$8B5F Jump forward if not.
8B5E LD (HL),A Re-align Monty on the appropriate boundary.
8B5F LD HL,$5C7B Point HL at Monty's co-ordinates.
8B62 LD A,($8D7D) Get the temporary X co-ordinate.
8B65 BIT 5,(IX+$00) Can Monty move left?
8B69 JR Z,$8B71 Jump if so.
8B6B CP (HL) Is the current co-ordinate out of bounds?
8B6C JR C,$8B71 Jump forward if not.
8B6E LD (HL),A Re-align Monty on the appropriate boundary and jump forward.
8B6F JR $8B7B
8B71 BIT 4,(IX+$00) Can Monty move right?
8B75 JR Z,$8B7B Jump if so.
8B77 CP (HL) Is the current co-ordinate out of bounds?
8B78 JR NC,$8B7B Jump forward if not.
8B7A LD (HL),A Re-align Monty on the appropriate boundary.
Redraw Monty in the new screen position.
8B7B LD HL,($5C7B) Get the screen position.
8B7E LD ($ECDE),HL Set this for the graphic to print.
8B81 LD A,$04 Height is 4.
8B83 LD ($832E),A
8B86 LD HL,($848C) Get the pointer to the sprite data.
8B89 LD ($ECE0),HL Set this to draw.
8B8C CALL $EBE0 Draw the graphic and return.
8B8F RET
Prev: 8B0C Up: Map Next: 8B90