Prev: 33952 Up: Map Next: 34265
34122: Display and process input for character selection menu (current room's characters only)
Used by the routines at 29619, 29756, 30145, 30686 and 31257.
Input
HL Pointer to text to append to menu's title string, after "WHO DO YOU WANT TO "
DE Command summary text pointer (second row of text in command summary window)
Output
A 1 if there is at least one character in the room, zero otherwise
F Reset if there is at least one character in the room, set otherwise
34122 PUSH HL Store HL (pointer to text to append to menu's title string)
34123 PUSH BC Store BC
34124 PUSH IX Store IX
34126 PUSH DE Store DE (command summary text pointer)
34127 CALL 35731 Play short downward scale sound
34130 POP DE Restore DE (command summary text pointer)
34131 CALL 54322 Print text at command summary text pointer (e.g. "COMMAND ") in command summary window
34134 LD A,(23701) Load A with Magic Knight's current room...
34137 CALL 34512 ...and create list of characters in this room at 23404, loading A with number of characters
34140 JR NZ,34170 If there are characters in this room then skip ahead to 34170
34142 LD HL,38628 Point HL at "THERE IS NOBODY IN THIS ROOM" text
34145 LD DE,37195 Adjust height of window 13 to accommodate text...
34148 CALL 33774 ...
34151 PUSH HL Store HL (pointer to start of text to print)
34152 LD A,13 Draw window 13...
34154 CALL 34990 ...
34157 POP HL Restore HL (pointer to start of text to print)
34158 CALL 34762 Print text at HL
34161 CALL 55138 Display "PRESS FIRE TO CONTINUE" window and wait for fire to be pressed
34164 POP IX Restore IX
34166 POP BC Restore BC
34167 POP HL Restore HL (pointer to text to append to menu's title string)
34168 XOR A Set A to zero and set zero flag
34169 RET Return
34170 ADD A,4 Add four to number of characters in current room (for menu size padding)...
34172 LD C,A ...and load value into C
34173 LD A,(37115) Load A with window's top y-coordinate
34176 ADD A,C Add 4 + number of characters...
34177 LD (37116),A ...and set window's bottom y-coordinate to this value
34180 POP IX Restore IX
34182 POP BC Restore BC
34183 LD A,3 Draw window 3 as a menu window...
34185 CALL 34982 ...
34188 LD HL,38610 Point HL at "WHO DO YOU WANT TO " text...
34191 CALL 34762 ...and print to screen
34194 POP HL Restore HL (pointer to text to append to menu's title string, as at beginning of this routine)
34195 CALL 34762 Append this text to menu's title
34198 LD IX,23404 Point IX at list of characters in room
34202 LD B,16 Load B with 16 (16 characters) (see trivia)
34204 PUSH BC Store BC (B = remaining characters to process)
34205 LD A,(IX+0) Load A with index of current character in list...
34208 CP 255 ...and if this is 255 (end marker)...
34210 JP Z,34254 ...then skip ahead to 34254
34213 LD HL,38351 Point HL at text printing instructions to move cursor to start of next character row within window, then right by two characters
34216 PUSH IX Store IX (current position in list of characters in room)
34218 CALL 34762 Print text at HL to screen (i.e. move cursor)
34221 POP IX Restore IX (current position in list of characters in room)
34223 LD A,(IX+0) Load A with index of current character in list...
34226 LD (29632),A Set this character as the Current Character
34229 LD HL,33943 Point HL at instruction to print name of Current Character
34232 PUSH IX Store IX (current position in list of characters in room)
34234 CALL 34762 Print text to screen
34237 POP IX Restore IX (current position in list of characters in room)
34239 INC IX Advance IX to next character in list
34241 POP BC Restore BC (B = remaining characters to process)
34242 DJNZ 34204 Decrease B and loop back to 34204
34244 CALL 35296 Process keyboard / joystick input on a menu and load A with selected item index
34247 CALL 33926 Update Current Character based upon selection made in menu
34250 LD A,1 Load A with 1
34252 OR A Reset zero flag
34253 RET Return
34254 POP BC Restore BC (B = remaining characters to process)
34255 CALL 35296 Process keyboard / joystick input on a menu and load A with selected item index
34258 CALL 33926 Update Current Character based upon selection made in menu
34261 LD A,1 Load A with 1
34263 OR A Reset zero flag
34264 RET Return
Prev: 33952 Up: Map Next: 34265