Prev: 29488 Up: Map Next: 29756
29619: Process command to take an object
Used by the routine at 55726.
29619 LD HL,38647 Point HL at "TAKE AN OBJECT FROM ?" text (end of sub-menu title, after "WHO DO YOU WANT TO ")
29622 LD DE,39015 Point DE (command summary text pointer) at "TAKE SOMETHING FROM" text
29625 CALL 34122 Display and process input for character selection menu (current room's characters only), setting Current Character
29628 JP Z,29482 If there are no characters in the room then return to game
The operand of the instruction at 29631 represents the index of the Current Character used in multiple routines. This is modified by the instructions at 30271, 33804, 33814, 33934 and 34226.
29631 LD A,0 Point IX at current inventory of Current Character...
29633 CALL 33585 ...
29636 LD A,(IX+0) If the first inventory slot of the character is empty...
29639 OR A ...
29640 JP Z,55202 ...then display "[Character]'S HANDS ARE EMPTY" window (13) and return to game
29643 PUSH IX Store IX (start of inventory)
29645 LD B,5 Load B with 5 (five inventory slots)
29647 LD HL,38998 Point HL at "TAKE WHICH OBJECT ?" text
29650 LD DE,0 Load DE with zero (i.e. no command summary text)
29653 CALL 33952 Show list of objects in character's inventory as a menu and load A with selected item index
29656 PUSH AF Store AF (A = index of chosen object's inventory slot)
29657 CALL 54333 Print or update command summary window at top of screen
29660 LD DE,39010 Point DE at "TAKE THE" text...
29663 CALL 54283 ...and print in command summary window at top of screen
29666 POP AF Restore AF (A = index of chosen object's inventory slot)
29667 POP HL Restore HL (previously IX, pointer to current inventory of current character)
29668 CALL 33911 Print name of object in inventory slot A of inventory data at HL in command summary window
29671 LD DE,39023 Point DE at " FROM" text...
29674 CALL 54283 ...and print in command summary window at top of screen
29677 LD A,(29632) Load A with index of Current Character
29680 CALL 33937 Print character's name
29683 CALL 55115 Display execute / reject command window and return here if execute chosen, else exit to main game loop
29686 LD A,253 Decrease Current Character's happiness by 3...
29688 CALL 33569 ...
29691 LD IX,44238 Point IX at table of characters' wanted objects
29695 CALL 33863 If Current Character wants Current Object...
29698 JP Z,55207 ...then display "[Character] WANTS TO KEEP THE [Object]" window (13) and return to game
29701 LD HL,25168 Load A with index of object in Magic Knight's fifth inventory slot (carrying)...
29704 LD A,(HL) ...
29705 OR A If this is not zero (i.e. Magic Knight's hands are full)...
29706 JP NZ,55165 ...then display "YOUR HANDS ARE FULL" window and return to game
29709 CALL 33601 Check whether object has a weight greater than Magic Knight's surplus strength...
29712 JP P,55177 ...and if it does then display "THE [name of Current Object] IS TOO HEAVY FOR YOU" window and return to game
29715 CALL 33500 Load A with Current Character's happiness level...
29718 CP 30 and if this is less than 30...
29720 JP C,55207 ...then display "[Character] WANTS TO KEEP THE [Object]" window (13) and return to game
29723 LD A,(29632) Point IX at current inventory of Current Character...
29726 CALL 33585 ...
29729 PUSH IX Copy value from IX...
29731 POP HL ...to HL
29732 LD A,(29526) Load C with index of Current Object...
29735 LD C,A ...
29736 LD B,5 Load B with 5 (five inventory slots)
29738 CALL 36254 Remove object C from Current Character's inventory
29741 LD A,(29526) Load C with index of Current Object...
29744 LD C,A ...
29745 LD B,5 Load B with 5 (five inventory slots)
29747 LD HL,25164 Point HL at start of Magic Knight's current inventory (carrying)...
29750 CALL 33516 ...and load object C into the first empty slot
29753 JP 29467 Show Magic Knight's current inventory and jump back to main game loop
Prev: 29488 Up: Map Next: 29756