Prev: F4FF Up: Map Next: F54F
F503: Room logic : The Super Market
F503 LD A,$FF Turn off the second platform, active when the trolley is moving. (AF7C)
F505 LD ($AF80),A
F508 LD A,$0C Is flag 0C (trolley oiled) set?
F50A CALL $EC1D
F50D JR Z,$F543 Jump forward if it isn't.
F50F LD A,$06 Touching a moving object drops endurance by 6.
F511 LD ($F26E),A
If the trolley is oiled, it needs moving.
F514 LD IX,$F4FF Point IX at the movement table.
F518 LD BC,$F2F7 Point DE at the bounds table.
F51B CALL $EF35 Update moving objects.
F51E LD A,$36 Set the ID to the trolley graphic. (8A38)
F520 CALL $A8A0 Draw the graphic.
F523 CALL $E329 Check for collision detection.
See if we have jumped onto the trolley.
F526 LD A,(IY+$0A) Get the Y co-ordinate?
F529 CP $88 Is it 88 ie: jumped to the height of the trolley?
F52B RET NZ Return if it hasn't.
The Y co-ordinate is correct, check the X co-ordinate.
F52C LD A,(IY+$05) Get the current X co-ordinate.
F52F SUB (IX-$04) Is it close enough to the X co-ordinate of the trolley?
F532 SUB $04
F534 CP $F8
F536 RET C Return if it isn't.
The character has landed on top of a moving trolley. Switch on a byte in the platform table (AF7C) that will treat this as a temporary platform and allow them to jump higher.
F537 LD A,(IX-$04) Set the X co-ordinate to match that of the trolley.
F53A LD (IY+$05),A
F53D LD A,$A8 Set the top of the trolley as an active platform.
F53F LD ($AF80),A
F542 RET Return.
The trolley's not oiled, so just draw it.
F543 LD HL,$A8F0 Set the position.
F546 LD ($A838),HL
F549 LD A,$36 Set the ID to the trolley graphic.
F54B CALL $A8A0 Draw it and return.
F54E RET
Prev: F4FF Up: Map Next: F54F