Routines
 Prev: 20956 Up: Map Next: 21237
21152: Display the cast of characters and change their names
Used by the routine at 21664. For each member of the cast: displays his name and title, walks him onto the screen, allows the user to change the name, and then walks him off the screen.
Input
Output
21152 LD A,21 Message 21: 'MR WACKER'
21154 PUSH AF Save the message number
21155 ADD A,80 A=101-111 (message number for the character's title)
21157 LD HL,16512 16512=display file address
21160 CALL 20668 Print the appropriate title (e.g. 'THE HEADMASTER')
21163 LD A,244 Message 244: '' (empty string)
21165 CALL 20665 Print this (thus removing 'Press 'C' to change name' from the screen)
21168 POP AF Restore the message number for the character's name to A
21169 PUSH AF Save it again
21170 LD HL,20544 20544=display file address
21173 CALL 20668 Print the character's name there
21176 POP AF Restore the message number for the character's name to A
21177 PUSH AF Save it again
21178 ADD A,224 Point HL at an entry in the table of animatory states at 21237
21180 LD L,A
21181 LD H,82
21183 LD A,(HL) A=animatory state of the character standing, facing right
21184 LD HL,53760 Point HL at byte 0 of ERIC's buffer
21187 LD (HL),A Fill in the animatory state
21188 INC L L=1
21189 LD (HL),124 Fill in the character's x-coordinate
21191 CALL 20956 Walk the character to the middle of the screen
21194 LD HL,23611 Reset bit 5 at 23611, ready for future keypresses
21197 RES 5,(HL)
21199 LD A,250 Message 250: 'Press 'C' to change name'
21201 CALL 20665 Print this message
21204 CALL 29154 Wait for a keypress
21207 JR Z,21204
21209 OR 32 Convert the keypress to lower case
21211 CP 99 Was 'c' pressed?
21213 JR NZ,21227 Jump if not
The user pressed 'c' to change the character's name.
21215 LD A,252 Message 252: 'Enter new name'
21217 CALL 20665 Print this message
21220 POP AF Restore the message number for the character's name to A
21221 PUSH AF Save it again
21222 CALL 20896 Change the character's name
21225 JR 21194
The user pressed some key other than 'c'.
21227 CALL 20956 Walk the character off screen
21230 POP AF Restore the message number for the character's name to A
21231 INC A Next character
21232 CP 32 Have we done all the main game characters yet?
21234 JR NZ,21154 Jump back if not
21236 RET
 Prev: 20956 Up: Map Next: 21237