Prev: 40406 Up: Map Next: 40489
40437: Room-specific routine: Move Magic Knight between teleport rooms if appropriate
Used by the routine at 40190.
40437 XOR A Set BORDER to black and reset speaker state (see trivia)...
40438 OUT (254),A ...
40440 LD A,(23484) Load B with current password number...
40443 LD B,A ...
40444 LD A,(23402) If value encoded in main lever flags...
40447 CP B ...is not the same as current password number...
40448 RET NZ ...then return
40449 LD A,(24841) If Magic Knight's current y-coordinate (pixels) is not 144...
40452 CP 144 ...
40454 RET NZ ...then return
40455 LD A,(24840) If Magic Knight's current x-coordinate (pixels) is not 112...
40458 CP 112 ...
40460 RET NZ ...then return
40461 LD A,144 Set Magic Knight's current x-coordinate (pixels) to 144...
40463 LD (24840),A ...
40466 LD B,40 Load B with 40 (index of Castle Third Floor, 2, Teleport Room, 1)
40468 LD A,(23702) If Magic Knight's current room...
40471 CP 47 ...is 47 (Spaceship, 2, Teleport Room, 2)...
40473 JR Z,40477 ...then skip ahead to 40477
40475 LD B,47 Load B with 47 (index of Spaceship, 2, Teleport Room, 2)
40477 LD A,1 Set animate-puff-of-smoke flag...
40479 LD (23480),A ...
40482 LD A,B Load A with destination room index in B
40483 LD (23702),A Set this as Magic Knight's current room (see trivia)
40486 JP 38841 Move Magic Knight into room A, draw room, objects and characters and initialise room-specific data
Prev: 40406 Up: Map Next: 40489