Prev: 45809 Up: Map Next: 46106
45963: Display and process input for character selection menu (current room's characters only)
Used by the routines at 41924, 42257, 42638, 43043, 43636 and 44933.
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
45963 PUSH HL Store HL (pointer to text to append to menu's title string)
45964 PUSH BC Store BC
45965 PUSH IX Store IX
45967 PUSH DE Store DE (command summary text pointer)
45968 CALL 47938 Play short downward scale sound
45971 POP DE Restore DE (command summary text pointer)
45972 CALL 63388 Print text at command summary text pointer (e.g. "COMMAND ") in command summary window
45975 LD A,(23702) Load A with Magic Knight's current room...
45978 CALL 46408 ...and create list of characters in this room at 23422, loading A with number of characters
45981 JR NZ,46011 If there are characters in this room then skip ahead to 46011
45983 LD HL,51381 Point HL at "THERE IS NOBODY IN THIS ROOM" text
45986 LD DE,49140 Adjust height of window 13 to accommodate text...
45989 CALL 45617 ...
45992 PUSH HL Store HL (pointer to start of text to print)
45993 LD A,13 Draw window 13...
45995 CALL 47193 ...
45998 POP HL Restore HL (pointer to start of text to print)
45999 CALL 46902 Print text at HL
46002 CALL 64230 Wait for interrupt then display "PRESS FIRE TO CONTINUE" window and wait for fire to be pressed
46005 POP IX Restore IX
46007 POP BC Restore BC
46008 POP HL Restore HL (pointer to text to append to menu's title string)
46009 XOR A Set A to zero and set zero flag
46010 RET Return
46011 ADD A,4 Add four to number of characters in current room (for menu size padding)...
46013 LD C,A ...and load value into C
46014 LD A,(49060) Load A with window's top y-coordinate
46017 ADD A,C Add 4 + number of characters...
46018 LD (49061),A ...and set window's bottom y-coordinate to this value
46021 POP IX Restore IX
46023 POP BC Restore BC
46024 LD A,3 Draw window 3 as a menu window...
46026 CALL 47185 ...
46029 LD HL,51367 Point HL at "WHO DO YOU WANT TO " text...
46032 CALL 46902 ...and print to screen
46035 POP HL Restore HL (pointer to text to append to menu's title string, as at beginning of this routine)
46036 CALL 46902 Append this text to menu's title
46039 LD IX,23422 Point IX at list of characters in room
46043 LD B,8 Load B with 8 (8 characters)
46045 PUSH BC Store BC (B = remaining characters to process)
46046 LD A,(IX+0) Load A with index of current character in list...
46049 CP 255 ...and if this is 255 (end marker)...
46051 JP Z,46095 ...then skip ahead to 46095
46054 LD HL,50753 Point HL at text printing instructions to move cursor to start of next character row within window, then right by two characters
46057 PUSH IX Store IX (current position in list of characters in room)
46059 CALL 46902 Print text at HL to screen (i.e. move cursor)
46062 POP IX Restore IX (current position in list of characters in room)
46064 LD A,(IX+0) Load A with index of current character in list...
46067 LD (41937),A Set this character as the Current Character
46070 LD HL,45800 Point HL at instruction to print full name of Current Character
46073 PUSH IX Store IX (current position in list of characters in room)
46075 CALL 46902 Print text to screen
46078 POP IX Restore IX (current position in list of characters in room)
46080 INC IX Advance IX to next character in list
46082 POP BC Restore BC (B = remaining characters to process)
46083 DJNZ 46045 Decrease B and loop back to 46045
46085 CALL 47502 Process keyboard / joystick input on a menu and load A with selected item index
46088 CALL 45781 Update Current Character based upon selection made in menu
46091 LD A,1 Load A with 1
46093 OR A Reset zero flag
46094 RET Return
46095 POP BC Restore BC (B = remaining characters to process)
46096 CALL 47502 Process keyboard / joystick input on a menu and load A with selected item index
46099 CALL 45781 Update Current Character based upon selection made in menu
46102 LD A,1 Load A with 1
46104 OR A Reset zero flag
46105 RET Return
Prev: 45809 Up: Map Next: 46106