Prev: 41921 Up: Map Next: 42036
41924: Process command to take an object
Used by the routine at 64623.
41924 LD HL,51392 Point HL at "[Current Command] AN OBJECT FROM ?" text (end of sub-menu title, after "WHO DO YOU WANT TO ")
41927 LD DE,52034 Point DE (command summary text pointer) at "[Current Command] SOMETHING FROM " text
41930 CALL 45963 Display and process input for character selection menu (current room's characters only), setting Current Character
41933 JP Z,41742 If there are no characters in the room then return to game
The operand of the instruction at 41936 represents the index of the Current Character used in multiple routines. This is modified by the instructions at 42686, 45789, 46067, 46147 and 46177.
41936 LD A,0 Point IX at current inventory of Current Character...
41938 CALL 45450 ...
41941 LD A,(IX+0) If the first inventory slot of the character is empty...
41944 OR A ...then set zero flag
41945 LD HL,52042 Point HL at "[Current Character's short name]'S HANDS ARE EMPTY" text
41948 JP Z,64261 If zero flag is set then display "[Character]'S HANDS ARE EMPTY" window (13) and return to game
41951 PUSH IX Store IX (start of inventory)
41953 LD B,5 Load B with 5 (five inventory slots)
41955 LD HL,51920 Point HL at "[Current Command] WHICH OBJECT ?" text
41958 LD DE,0 Load DE with zero (i.e. no command summary text)
41961 CALL 45809 Show list of objects in character's inventory as a menu and load A with selected item index
41964 PUSH AF Store AF (A = index of chosen object's inventory slot)
41965 CALL 63399 Print or update command summary window at top of screen
41968 LD DE,51928 Point DE at "[Current Command] THE " text...
41971 CALL 63349 ...and print in command summary window at top of screen
41974 POP AF Restore AF (A = index of chosen object's inventory slot)
41975 POP HL Restore HL (previously IX, pointer to current inventory of current character)
41976 CALL 45766 Print name of object in inventory slot A of inventory data at HL in command summary window
41979 LD DE,52039 Point DE at " FROM " text...
41982 CALL 63349 ...and print in command summary window at top of screen
41985 LD A,(41937) Load A with index of Current Character
41988 CALL 45792 Print character's name
41991 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
41994 LD A,(41779) Load A with index of Current Object...
41997 CALL 45685 ...and if this is 4 (Teddy Bear) then display "THE BEAR SAYS..." message and wait for fire to be pressed
42000 LD A,253 Decrease Current Character's happiness by 3...
42002 CALL 45434 ...
42005 LD HL,24852 Load A with index of object in Magic Knight's fifth inventory slot (carrying)...
42008 LD A,(HL) ...
42009 OR A If this is not zero (i.e. Magic Knight's hands are full)...
42010 JP NZ,64258 ...then display "YOUR HANDS ARE FULL" window and return to game
42013 CALL 45466 Check whether object has a weight greater than Magic Knight's surplus strength...
42016 JP P,64265 ...and if it does then display "THE [name of Current Object] IS TOO HEAVY FOR YOU" window and return to game
42019 CALL 45364 Load A with Current Character's happiness level...
42022 CP 30 and if this is less than 30...
42024 JP C,64270 ...then display "[Character] WANTS TO KEEP THE [Object]" window (13) and return to game
42027 LD A,(41937) Load A with index of Current Character
42030 LD HL,42069 Load HL with start address of table of start addresses of routines for characters having objects taken
42033 JP 64623 Load HL with address of Current Character's "take an object" routine and jump to it
Prev: 41921 Up: Map Next: 42036