Prev: 42616 Up: Map Next: 42938
42638: Process command to examine yourself / a character / an object
Used by the routine at 64623.
42638 CALL 63399 Print or update command summary window at top of screen
42641 LD DE,52158 Point DE at "[Current Command] " text...
42644 CALL 63349 ...and print in command summary window at top of screen
42647 LD A,16 Draw "EXAMINE WHAT?" menu window...
42649 CALL 47185 ...
42652 LD HL,52162 Point HL at "[Current Command] WHAT ?" menu text...
42655 CALL 46902 ...and print to screen
42658 CALL 47502 Process keyboard / joystick input on a menu and load A with selected item index
42661 OR A If "OBJECT" selected...
42662 JP Z,42834 ...then skip ahead to 42834
42665 CP 1 If "CHARACTER" selected...
42667 JP Z,42715 ...then skip ahead to 42715
Examine yourself
42670 LD DE,52521 Point DE at "YOURSELF " text...
42673 CALL 63349 ...and print in command summary window at top of screen
42676 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
42679 LD A,18 Draw window 18...
42681 CALL 47193 ...
42684 LD A,32 Set Current Character index to 32...
42686 LD (41937),A ...as index of "MAGIC KNIGHT" text is 32 relative to start of characters' names at 58544
42689 LD HL,52311 Point HL at percentage completion text
42692 LD DE,52323 Point DE at time left text
42695 CALL 45522 Insert current time and score into "time left" and "percentage completion" texts
42698 LD HL,24768 Point HL at start of Magic Knight's current stats
42701 LD A,37 Set graphic index to 37...
42703 LD (42827),A ...and store as operand to instruction at 42826
42706 LD A,(24846) Load Magic Knight's attribute value into...
42709 LD (49193),A ...content attribute slot of window 19 (examine portrait frame)
42712 JP 42763 Skip ahead to 42763 (display window as in examine character)
Examine character
42715 LD HL,51408 Point HL at "[Current Command] ?" text (end of sub-menu title, after "WHO DO YOU WANT TO ")
42718 LD DE,0 Load DE with zero (i.e. no command summary text)
42721 CALL 45963 Display and process input for character selection menu (current room's characters only), setting Current Character
42724 JP Z,41742 If there are no characters in the room then return to game
42727 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
42730 LD A,5 Increase Current Character's happiness by 5...
42732 CALL 45434 ...
42735 LD A,18 Draw window 18...
42737 CALL 47193 ...
42740 LD A,(41937) Load A with index of Current Character
42743 LD E,0 Point HL at start of character's stats...
42745 CALL 45406 ...
42748 PUSH HL Transfer address from HL...
42749 POP IX ...into IX
42751 LD A,(IX+5) Load character graphic index into A...
42754 LD (42827),A ...and modify operand of instruction at 42826 to match
42757 LD A,(IX+4) Load character's attribute value into...
42760 LD (49193),A ...content attribute slot of window 19 (examine portrait frame)
42763 CALL 42938 Insert numeric stats (at HL) of a character into "EXAMINE CHARACTER" window text
42766 PUSH HL Store HL (points to start of character's current stats)
42767 LD HL,52180 Print examine character window text (i.e. "EXAMINE [CHARACTER] ... STRENGTH XX..." text)...
42770 CALL 46902 ...
42773 POP IX Restore IX (points to start of character's current stats)
42775 LD B,10 Load B with 10 (index of "[Current Character's short name] IS ASLEEP" text)
42777 BIT 7,(IX+6) If character's asleep flag is set...
42781 JR NZ,42786 ...then skip ahead to 42786
42783 LD B,(IX+7) Load B with index of character's current status text
42786 LD A,(41937) If Current Character index is not 32 (Magic Knight, i.e. EXAMINE YOURSELF)...
42789 CP 32 ...
42791 JR NZ,42795 ...then skip ahead to 42795
42793 LD B,1 Load B with 1 (index of Magic Knight's current status text)
42795 RES 7,B Reset bit 7 of status text index (see trivia)
42797 LD HL,52301 Point HL at start of characters' "current status" texts
42800 CALL 63335 Advance HL to B-th entry in list of zero-terminated strings starting at HL...
42803 CALL 46902 ...and print
42806 LD A,(42827) If character graphic index is zero...
42809 OR A ...
42810 JR Z,42831 ...then skip ahead to 42831
42812 LD A,19 Draw window 19 (examine portrait frame)...
42814 CALL 47193 ...
42817 LD BC,(23408) Load BC with top-left coordinate of current window
42821 LD A,71 Store 71 (white INK, black PAPER, BRIGHT) at 23695...
42823 LD (23695),A ...
The operand of the instruction at 42826 represents the character's graphic index. This is modified by the instructions at 42703 and 42754.
42826 LD A,0 Load A with character's graphic index...
42828 CALL 63504 ...and draw this graphic at character coordinates (C, B) with width 2 and height 4
42831 JP 41739 Display "PRESS FIRE TO CONTINUE" window and wait for input and return to main game loop
Examine object
42834 CALL 45641 Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty
42837 JP Z,41742 If Magic Knight's inventory (carrying) is empty then return to game
42840 LD A,15 Set bottom edge of window 20 to 15...
42842 LD (49197),A ...
42845 LD IX,24848 Point IX at Magic Knight's current inventory (carrying)
42849 LD B,5 Load B with 5 (five inventory slots)
42851 LD HL,51920 Point HL at "[Current Command] WHICH OBJECT ?" text
42854 LD DE,0 Load DE with zero (i.e. no command summary text)
42857 CALL 45809 Show list of objects in Magic Knight's inventory (carrying) as a menu and load A with selected item index
42860 LD HL,24848 Point HL at start of characters' current inventories table
42863 CALL 45766 Print name of object in inventory slot A of inventory data at HL in command summary window
42866 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
42869 LD A,(41779) Load A with index of Current Object...
42872 CALL 45685 ...and if this is 4 (Teddy Bear) then display "THE BEAR SAYS..." message and wait for fire to be pressed
42875 LD E,0 Point HL to the start of the Current Object's record in object properties table...
42877 CALL 45390 ...
42880 PUSH HL Store HL (pointer to Current Object's properties)
42881 CALL 43000 Insert numeric / text properties of the object into "examine object" window text
42884 LD A,20 Draw window 20 ("EXAMINE OBJECT" window)...
42886 CALL 47193 ...
42889 LD HL,52251 Point HL at "      [Current Command]" text
42892 CALL 46902 ...and print to screen
42895 LD A,(41779) Load B with index of Current Object...
42898 LD B,A ...
42899 CALL 63332 ...and point HL at its entry in table of object names
42902 CALL 46902 Print the Current Object's name
42905 LD HL,52256 Point HL at object properties text...
42908 CALL 46902 ...and print to screen
42911 POP IX Restore IX (pointer to Current Object's properties)
42913 LD A,(IX+6) Set content attribute of window 21 (frame around object in "EXAMINE OBJECT" window)...
42916 LD (49209),A ...to match attribute of object
42919 LD A,21 Draw window 21...
42921 CALL 47193 ...
42924 LD BC,(23408) Load BC with top-left coordinate of current window
42928 INC B Increase y-coordinate by 1 (as object positions are based upon their bottom-left corner)
42929 LD A,(41779) Load A with index of Current Object
42932 CALL 48191 Set terrain interaction data for character blocks spanned by object and draw the object
42935 JP 41739 Display "PRESS FIRE TO CONTINUE" window and wait for input and return to main game loop
Prev: 42616 Up: Map Next: 42938