Prev: 40527 Up: Map Next: 40598
40546: Room-specific routine: Move Magic Knight up or down a room if appropriate and boost jumps if wearing Power Boots
The call at 40546 will move Magic Knight "down" a room if he is at 128 < x < 153 and y = 152.
The remainder of this routine will move Magic Knight "up" a room if he is at x > 203 and y < 62. Magic Knight's jumps are also boosted here if he is wearing the Power Boots.
Used by the routine at 40190.
40546 CALL 40406 Move Magic Knight down a room if appropriate
This entry point is used by the routine at 40190.
This entry point serves as the room-specific routine for moving Magic Knight up a room if appropriate, and boosting jumps if wearing Power Boots.
40549 LD A,(24841) If Magic Knight's current y-coordinate (pixels) is 152...
40552 CP 152 ...
40554 RET Z ...then return
40555 LD A,(24840) If Magic Knight's current x-coordinate (pixels) is less than 204...
40558 CP 204 ...
40560 RET C ...then return
40561 LD A,11 If Magic Knight is not wearing the Power Boots (11)...
40563 CALL 45505 ...
40566 RET NZ ...then return
40567 LD A,(24841) If Magic Knight's current y-coordinate (pixels) is less than 62...
40570 CP 62 ...
40572 JR C,40582 ...then skip ahead to 40582
40574 LD A,252 Set Magic Knight's y-velocity to -4...
40576 LD (24845),A ...
40579 JP 61816 Set redraw-Magic-Knight-on-next-interrupt flag, wait for interrupt and return
40582 LD A,136 Set Magic Knight's current y-coordinate (pixels) to 136...
40584 LD (24841),A ...
40587 LD A,(23702) Load A with index of Magic Knight's current room...
40590 ADD A,7 ...plus 7
40592 LD (23702),A Set this as Magic Knight's current room (see trivia)
40595 JP 38841 Move Magic Knight into room A, draw room, objects and characters and initialise room-specific data
Prev: 40527 Up: Map Next: 40598