Prev: 31153 Up: Map Next: 31636
31370: Process command to examine an object, a character or Magic Knight
Used by the routines at 27176 and 31153.
31370 CALL 38075 Play upward scale sound
31373 LD A,(23377) Set Gimbal-white-out-safe flag...
31376 OR 1 ...
31378 LD (23377),A ...
31381 CALL 37654 Display / update command summary window at bottom of screen
31384 LD DE,45897 Point DE at "EXAMINE" text...
31387 CALL 38693 ...and print in command summary window at bottom of screen
31390 LD A,16 Display "EXAMINE WHAT?" menu window...
31392 CALL 36979 ...
31395 LD HL,45899 Print "EXAMINE WHAT? ... O OBJECT ... C CHARACTER ... S YOURSELF" text...
31398 CALL 36725 ...
31401 CALL 37333 Process input for menu, and load ASCII code of shortcut for selected (i.e. SPACE or fire pressed) item into A
31404 CP 79 If "O" pressed (i.e. EXAMINE OBJECT)...
31406 JP Z,31548 ...then skip ahead to 31548
31409 CP 67 If "C" pressed (i.e. EXAMINE CHARACTER)...
31411 JP Z,31452 ...then skip ahead to 31452
Examine yourself
31414 LD DE,46396 Point DE at "YOURSELF" text...
31417 CALL 38693 ...and print in command summary window at bottom of screen
31420 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
31423 LD A,18 Draw window 18...
31425 CALL 36987 ...
31428 LD A,14 Store 14 in current character memory slot...
31430 LD (30615),A ...as 14 is the position of "MAGIC KNIGHT" text relative to start of characters' short names in common words table
31433 LD HL,46126 Point HL at percentage completion text
31436 LD DE,46138 Point DE at time left text
31439 CALL 34268 Insert current time and score into "TIME LEFT" and "PERCENTAGE COMPLETION" texts
31442 LD HL,25315 Point HL at Magic Knight's current stats
31445 XOR A Load 0 (index of Magic Knight frame 1 [right] in graphics lookup data table at 42642) into instruction at 31537...
31446 LD (31538),A ...
31449 JP 31484 Skip ahead to 31484
Examine character
31452 LD HL,44065 Point HL at "EXAMINE ?" text
31455 LD DE,0 Set DE to zero so command summary window is not updated with additional text
31458 CALL 35141 Display and process input for character selection menu (current room's characters only), setting Current Character
31461 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
31464 LD A,18 Draw window 18...
31466 CALL 36987 ...
31469 LD A,(30615) Load A with index of Current (selected) Character
31472 ADD A,69 Add 69 to index of selected character (as 69 is index of first character in graphics lookup data table at 42642)...
31474 LD (31538),A ...and load into instruction at 31537
31477 SUB 69 Subtract 69 to revert to index of character
31479 LD E,0 Point HL at strength of the character...
31481 CALL 34174 ...
31484 CALL 35837 Insert numeric stats (at HL) of a character into "EXAMINE CHARACTER" window text
31487 PUSH HL Store HL (points to start of character's current stats)
31488 LD HL,45924 Print examine character window text (i.e. "EXAMINE [CHARACTER] ... STRENGTH XX..." text)...
31491 CALL 36725 ...
31494 POP IX Restore IX (points to start of character's current stats)
31496 LD A,(IX+6) If character's asleep flag is set...
31499 BIT 7,A ...
31501 JP NZ,31507 ...then skip ahead to 31507
31504 LD A,(IX+7) Load A with index of character's current status text
If character is asleep, then A holds the value from IX+6 with bit 7 set. Resetting bit 7 leaves 12, index of "[CHARACTER] IS ASLEEP" text.
31507 AND 127 Reset bit 7 of A...
31509 LD B,A ...and load into B
31510 LD HL,46116 Point HL at start of characters' "current status" texts
31513 CALL 34845 Advance HL to B-th entry in list of zero-terminated strings
31516 CALL 36725 Print text at HL
31519 LD A,19 Draw window 19...
31521 CALL 36987 ...
31524 LD A,(23493) Load C with x-coordinate of left edge of current window to draw (characters)...
31527 LD C,A ...
31528 LD A,(23494) Load B with y-coordinate of top edge of current window to draw (characters)...
31531 LD B,A ...
31532 LD A,71 Store 71 (white INK, black PAPER, BRIGHT) at 23695...
31534 LD (23695),A ...
The operand of the instruction at 31537 represents the graphic index of the selected character. This is modified by the instructions at 31446 and 31474.
31537 LD A,0 Draw the selected character...
31539 CALL 29960 ...
31542 CALL 38749 Display "PRESS SPACE OR FIRE TO CONTINUE" window and wait for space / fire
31545 JP 30428 Reset Gimbal-white-out-safe flag, redraw current room and return to main game loop
Examine object
31548 LD IX,25395 Point IX at Magic Knight's inventory
31552 LD B,5 Load B with 5 (as there are 5 inventory slots)
31554 LD HL,45890 Point HL at "EXAMINE WHICH OBJECT?" text
31557 LD DE,0 Set DE to zero so command summary window is not updated with additional text
31560 CALL 34914 Show list of objects (window or menu) and handle selection if a menu
31563 LD HL,25395 Point HL at Magic Knight's inventory
31566 CALL 34864 Point DE at name of a selected object in object names table and print in command summary window
31569 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
31572 LD A,(30467) Load A with index of Current Object
31575 LD E,0 Load E with 0 (weight)
31577 CALL 34160 Point HL to weight of object A
31580 CALL 35887 Insert numeric / text stats of an object into "EXAMINE OBJECT" window text
31583 LD A,20 Draw window 20...
31585 CALL 36987 ...
31588 LD HL,46033 Print "      EXAMINE" text...
31591 CALL 36725 ...
31594 LD A,(30467) Load B with index of Current Object...
31597 LD B,A ...
31598 CALL 34842 Advance HL to B-th entry in object names table
31601 CALL 36725 Print the object's name
31604 LD HL,46038 Print " EXAMINE" text...
31607 CALL 36725 ...
31610 LD A,21 Draw window 21...
31612 CALL 36987 ...
31615 LD A,(23493) Load C with x-coordinate of left edge of current window to draw (characters)...
31618 LD C,A ...
31619 LD A,(23494) Load B with y-coordinate of top edge of current window to draw (characters)...
31622 LD B,A ...
31623 INC B Increase y-coordinate so object is drawn within the window rather than overlapping the upper frame
31624 LD A,(30467) Load A with index of Current Object
31627 CALL 38539 Set terrain interaction data for character blocks spanned by the object and draw the object
31630 CALL 38749 Display "PRESS SPACE OR FIRE TO CONTINUE" window and wait for space / fire
31633 JP 30428 Reset Gimbal-white-out-safe flag, redraw current room and return to main game loop
Prev: 31153 Up: Map Next: 31636