Prev: 40357 Up: Map Next: 40437
40406: Room-specific routine: Move Magic Knight down a room if appropriate
Move Magic Knight "down" a room if he is at 128 < x < 153 and y = 152.
Used by the routines at 40190 and 40546.
40406 LD A,(24841) If Magic Knight's current y-coordinate (pixels) is not 152...
40409 CP 152 ...i.e. he is not at floor-level...
40411 RET NZ ...then return
40412 LD A,(24840) If Magic Knight's current x-coordinate (pixels) is 153 or greater...
40415 CP 153 ...
40417 RET NC ...then return
40418 CP 128 If Magic Knight's current x-coordinate (pixels) is less than 128...
40420 RET C ...then return
40421 LD A,48 Set Magic Knight's current y-coordinate (pixels) to 48...
40423 LD (24841),A ...
40426 LD A,(23702) Load A with index of Magic Knight's current room...
40429 SUB 7 ...minus 7
40431 LD (23702),A Set this as Magic Knight's current room (see trivia)
40434 JP 38841 Move Magic Knight into room A, draw room, objects and characters and initialise room-specific data
Prev: 40357 Up: Map Next: 40437