Prev: 32027 Up: Map Next: 32194
32035: Process and execute command to locate a character
Used by the routines at 27176 and 31153.
32035 LD A,(65532) If locate-enabled flag is not set...
32038 BIT 1,A ...
32040 JP Z,27189 ...then jump into main game loop (process keyboard input and move Magic Knight, enter menus or execute other command)
32043 CALL 38075 Play upward scale sound
32046 CALL 37654 Display / update command summary window at bottom of screen
32049 LD DE,46807 Point DE at "LOCATE" text...
32052 CALL 38693 ...and print in command summary window at bottom of screen
32055 LD HL,44078 Point HL at "LOCATE ?" text
32058 PUSH HL Store HL
32059 CALL 35293 Display and handle full character selection menu
32062 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
32065 LD A,22 Draw window 22...
32067 CALL 36987 ...
32070 LD A,(23493) Load A with x-coordinate of left-hand edge of window...
32073 ADD A,2 ...add 2...
32075 LD C,A ...and load into C
32076 LD A,(23494) Load A with y-coordinate of top edge of window...
32079 ADD A,3 ...add 3...
32081 LD B,A ...and load into B
32082 LD A,71 Store 71 (white INK, black PAPER, BRIGHT) at 23695...
32084 LD (23695),A ...
32087 LD A,1 Draw "Locate a Character" compass...
32089 CALL 29960 ...
32092 LD HL,46810 Print "LOCATED [CHARACTER]" text...
32095 CALL 36725 ...
32098 CALL 34402 Point HL at current position data for Current Character
32101 LD DE,0 Set DE to zero so command summary window is not updated with additional text
32104 LD A,(HL) Load room of Current Character
32105 OR A If room is zero (i.e. character is in the lift)...
32106 JP Z,32183 ...then skip ahead to 32183
32109 DEC A Discard floor information and set A to represent room number 0-7 (starting at zero for room next to lift), i.e. room's x-coordinate and load into B
32110 AND 7
32112 LD B,A
32113 LD A,(65529) Load Magic Knight's current room into A
32116 DEC A Discard floor information and set A to represent room number 0-7 (starting at zero for room next to lift), i.e. room's x-coordinate
32117 AND 7
32119 CP B Compare character's room x-coordinate to Magic Knight's
32120 JR Z,32131 If character's room and Magic Knight's room are at the same x-coordinate, then skip ahead to 32131
32122 JP M,32129 If character's room is to the right of Magic Knight's, then skip ahead to 32129
Character's room is to the left of Magic Knight's
32125 LD E,254 Load E with 254 (-2)
32127 JR 32131 Skip ahead to 32131
32129 LD E,2 Load E with 2
32131 LD A,(HL) Load A with character's current room
32132 DEC A Decrease by one
32133 AND 248 Clear all but floor information (i.e. y-coordinate)
32135 LD B,A Load into B
32136 LD A,(65529) Load Magic Knight's current room into A
32139 DEC A Decrease by one
32140 AND 248 Clear all but floor information (i.e. y-coordinate)
32142 CP B Compare character's room y-coordinate to Magic Knight's
32143 JR Z,32154 If character's room and Magic Knight's room are at the same y-coordinate, then skip ahead to 32154
32145 JP M,32152 If character's room is below Magic Knight's, then skip ahead to 32152
Character's room is above Magic Knight's
32148 LD D,254 Load D with 254 (-2)
32150 JR 32154 Skip ahead to 32154
32152 LD D,2 Load D with 2
32154 LD A,(23494) Load A with y-coordinate of top edge of current window to draw (characters) (typically 1)
32157 ADD A,5 Add 5 to y-coordinate (now pointing at top row of middle "origin" square of "locate compass")
32159 ADD A,D Add D (which is either +/-2 to point to top half or bottom half of "locate compass")
32160 LD H,A Load this y-coordinate into H
32161 LD A,(23493) Load A with x-coordinate of left edge of current window (typically 1)
32164 ADD A,4 Add 4 to y-coordinate (now pointing at left column of middle "origin" square of "locate compass")
32166 ADD A,E Add E (which is either +/-2 to point to left half or right half of "locate compass")
32167 LD L,A Load x-coordinate into L
32168 LD (23462),HL Store HL at 23462
32171 CALL 38749 Display "PRESS SPACE OR FIRE TO CONTINUE" window and wait for space / fire
32174 LD HL,0 Set word at 23462 to zero...
32177 LD (23462),HL ...
32180 JP 30428 Reset Gimbal-white-out-safe flag, redraw current room and return to main game loop
32183 LD HL,46815 Print "IN THE LIFT" text...
32186 CALL 36725 ...
32189 LD HL,1539 Set H to 6 and L to 3 (as lift is always left of Magic Knight's current room when he's not in the lift!)
32192 JR 32168 Skip back to display the compass
Prev: 32027 Up: Map Next: 32194