Prev: 34907 Up: Map Next: 35101
34914: Show list of objects (window or menu) and handle selection if a menu
Used by the routines at 30439, 30602, 30880, 31370, 32258, 32390 and 33312.
Input
B Number of inventory slots to check
DE Points to summary command text (e.g. "BLOW"), or 0 for no summary text
HL Points to full command text (e.g. "BLOW WHICH OBJECT?", or "YOU ARE NOW CARRYING")
IX Points to a character's inventory
Output
A ASCII code for letter of selected menu item
34914 PUSH BC Store BC (B = number of inventory slots)
34915 PUSH DE Store DE
34916 PUSH HL Store HL
34917 PUSH IX Store IX
34919 CALL 38108 Set parameters for and play downward scale sound
34922 POP IX Restore IX
34924 POP HL Restore HL
34925 POP DE Restore DE
34926 POP BC Restore BC (B = number of inventory slots)
34927 LD A,(IX+0) Load first object in character's inventory into A
34930 OR A If nothing in first slot...
34931 JP Z,35069 ...jump ahead to 35069 (display "YOU ARE NOT CARRYING ANYTHING" message and return to game)
34934 LD A,105 Modify instruction at 34989 with 105, denoting window as a menu rather than information window...
34936 LD (34990),A ...
34939 PUSH BC Store BC (B = number of inventory slots)
34940 PUSH HL Store HL
34941 PUSH IX Store IX
34943 LD A,D If DE is zero (i.e. summary command text unset)...
34944 OR E ...
34945 JR Z,34955 ...jump ahead to 34955
34947 PUSH DE Store DE
34948 CALL 37654 Display / update command summary window at bottom of screen
34951 POP DE Restore DE
34952 CALL 38693 ...and print in command summary window at bottom of screen
34955 POP IX Restore IX
34957 POP HL Restore HL
34958 POP BC Restore BC (B = number of inventory slots)
This entry point is used by the routine at 34907.
34959 LD C,0 Load C (object counter) with zero
34961 PUSH BC Store BC (B = number of inventory slots)
34962 PUSH IX Store IX
34964 LD A,(IX+0) Load object from character's inventory (slot number C) into A
34967 OR A If nothing in this slot...
34968 JR Z,34975 ...then jump ahead to 34975
34970 INC C Increase count of objects in inventory
34971 INC IX Advance IX to next slot
34973 DJNZ 34964 Repeat for next slot
34975 POP IX Restore IX (points to start of inventory)
34977 LD A,C Copy number of objects into A
34978 OR A If number of objects is zero... (see trivia)
34979 JP Z,35078 ...then jump ahead to 35078
34982 LD A,C Copy number of objects into A
34983 ADD A,3 Add 3 to this (menu window padding)
34985 LD (41909),A Modify height of window 4 to accommodate list of C objects
34988 PUSH HL Store HL (pointer to full command text)
The operand of the instruction at 34989 represents the draw-hand-menu-cursor flag. This is modified by the instruction at 34936.
34989 LD A,0 Load A with draw-hand-menu-cursor flag
34991 CP 105 If this is not 105 (i.e. window is not a menu, but a simple information window)...
34993 JR NZ,35002 ...then jump ahead to 35002
34995 LD A,4 Draw a menu window...
34997 CALL 36979 ...
35000 JR 35007 ...and skip over "draw an information window" section
35002 LD A,4 Draw window 4...
35004 CALL 36987 ...
35007 LD A,64 Set character at 43221 (letter preceding menu items) to "@" (i.e. the character immediately before "A")...
35009 LD (43221),A ...
35012 POP HL Restore HL (pointer to full command text)...
35013 CALL 36725 ...and print the text
35016 POP BC Restore BC (B = number of remaining inventory slots)
35017 PUSH BC Store BC (B = number of remaining inventory slots)
35018 LD A,(IX+0) Load index of first object in inventory into A
35021 OR A If index is zero (i.e. if nothing in inventory)...
35022 JP Z,35064 ...then skip ahead to 35064
35025 LD B,A Copy index into B
35026 PUSH IX Store IX (pointer to start of inventory)
35028 LD HL,43221 Point HL to letter shortcut (currently set to "@" as at instruction 35007)...
35031 LD A,(HL) ...
35032 INC A ...
35033 LD (HL),A ...and increase index by one to change to "A"
35034 LD HL,43220 Point HL to 43220
35037 PUSH BC Store BC (B = index of an object)
35038 CALL 36725 Print text (i.e. "A] ") to screen
35041 POP BC Restore BC (B = index of an object)
35042 CALL 34842 Point HL to B-th entry in list of object names
35045 CALL 36725 Print object name to screen
35048 POP IX Restore IX (pointer to start of inventory)
35050 INC IX Advance IX to next inventory slot
35052 POP BC Restore BC (B = number of remaining inventory slots)
35053 DJNZ 35017 Repeat loop for next object in inventory, decreasing B (number of remaining inventory slots)
35055 LD A,(34990) If window is a menu, rather than information window...
35058 CP 105 ...
35060 CALL Z,37333 ...then process input for menu, and load ASCII code of shortcut for selected (i.e. SPACE or fire pressed) item into A...
35063 RET ...and return
35064 POP BC Restore BC
35065 CALL Z,37333 Process input for menu, and load ASCII code of shortcut for selected (i.e. SPACE or fire pressed) item into A
35068 RET Return
35069 LD A,13 Display "YOU ARE NOT CARRYING ANYTHING" window...
35071 POP HL ...restoring HL...
35072 LD HL,45447 ...
35075 JP 34768 ...and return to game
35078 PUSH HL Store HL (points to full command text, e.g. "BLOW WHICH OBJECT?", or "YOU ARE NOW CARRYING")
35079 LD A,4 Modify height of window 4...
35081 LD (41909),A ...
35084 LD A,4 Draw window 4...
35086 CALL 36987 ...
35089 POP HL Restore HL (points to window title line, e.g. "BLOW WHICH OBJECT?", or "YOU ARE NOW CARRYING")
35090 CALL 36725 Print the text
35093 LD HL,41236 Point HL at
NOTHING AT ALL
text...
35096 CALL 36725 ...and print
35099 POP BC Restore BC
35100 RET Return
Prev: 34907 Up: Map Next: 35101