Prev: 44615 Up: Map Next: 44861
44635: Process command to wear / unwear an object
Used by the routine at 64623.
44635 LD A,11 Draw window 11...
44637 CALL 47185 ...
44640 LD HL,56380 Point HL at wear/unwear menu text...
44643 CALL 46902 ...and print to screen
44646 CALL 47502 Process keyboard / joystick input on a menu and load A with selected item index
44649 JR NZ,44745 If UNWEAR selected then skip ahead to 44745
44651 CALL 45641 Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty
44654 JP Z,41742 If Magic Knight's inventory (carrying) is empty then return to game
44657 LD IX,24848 Point IX at Magic Knight's current inventory (carrying)
44661 LD B,5 Load B with 5 (five inventory slots)
44663 LD HL,56397 Point HL at "[Current Command] WHICH OBJECT ?" text
44666 LD DE,56391 Point DE at "UN[Current Command] THE " text
44669 CALL 45809 Show list of objects in Magic Knight's inventory (carrying) as a menu and load A with selected item index
44672 LD HL,24848 Point HL at start of Magic Knight's current inventory (carrying)
44675 CALL 45766 Print name of object in inventory slot A of inventory data at HL in command summary window
44678 LD A,(41779) If Current Object (selected object) is the Disquise (1)...
44681 CP 1 ...
44683 JP Z,44824 ...then skip ahead to 44824
44686 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
44689 LD A,(41779) Load A with index of Current Object...
44692 CALL 45685 ...and if this is 4 (Teddy Bear) then display "THE BEAR SAYS..." message and wait for fire to be pressed
44695 LD HL,24857 If last slot in Magic Knight's current inventory (wearing) is not empty...
44698 LD A,(HL) ...
44699 OR A ...then reset zero flag, otherwise set
44700 LD HL,56404 Point HL at "YOU ARE [Current Command]ING TOO MUCH" text
44703 JP NZ,64261 If zero flag is reset then display "YOU ARE [Command]ING TOO MUCH" window (13) and return to game
44706 LD A,(41779) Load A with index of Current Object
44709 LD E,1 If object's can-be-worn flag is reset...
44711 CALL 45390 ...
44714 BIT 3,(HL) ...then set zero flag, otherwise reset
44716 LD HL,56419 Point HL at "YOU CANNOT [Current Command] THAT " text
44719 JP Z,64261 If zero flag is set then display "YOU CANNOT [Command] THAT" window (13) and return to game
44722 LD A,(41779) Load C with index of Current Object...
44725 LD C,A ...
44726 LD B,5 Load B with 5 (five inventory slots)
44728 PUSH BC Store BC (B = number of slots to process, C = Current Object)
44729 LD HL,24848 Point HL at start of Magic Knight's current inventory (carrying)
44732 CALL 48341 Remove object C from this inventory
44735 POP BC Restore BC (B = number of slots to process, C = Current Object)
44736 LD HL,24853 Point HL at Magic Knight's current inventory (wearing)...
44739 CALL 45380 ...and wait for interrupt then load object C into the first empty slot
44742 JP 41727 Show Magic Knight's current inventory and jump back to main game loop
44745 CALL 45631 Display "YOU ARE NOT WEARING ANYTHING" window and set zero flag if Magic Knight's inventory (wearing) is empty
44748 JP Z,41742 If Magic Knight's inventory (wearing) is empty then return to game
44751 LD IX,24853 Point IX at Magic Knight's current inventory (wearing)
44755 LD B,5 Load B with 5 (five inventory slots)
44757 LD HL,56395 Point HL at "UN[Current Command] WHICH OBJECT ?" text
44760 LD DE,56389 Point DE at "UN[Current Command] THE " text
44763 CALL 45809 Show list of objects in Magic Knight's inventory (wearing) as a menu and load A with selected item index
44766 LD HL,24853 Point HL at Magic Knight's current inventory (wearing)
44769 CALL 45766 Print name of object in inventory slot A of inventory data at HL in command summary window
44772 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
44775 LD A,(41779) Load A with index of Current Object and if this is 4 (Teddy Bear) then display "THE BEAR SAYS..." message and wait for fire to be pressed (see trivia)
44778 CALL 45685
44781 LD HL,24852 Load A with index of object in Magic Knight's fifth inventory slot (carrying)...
44784 LD A,(HL) ...
44785 OR A If this is not zero (i.e. Magic Knight's hands are full)...
44786 JP NZ,64258 ...then display "YOUR HANDS ARE FULL" window (13) and return to game
44789 LD A,(41779) Load C with index of Current Object...
44792 LD C,A ...
44793 LD B,5 Load B with 5 (five inventory slots)
44795 PUSH BC Store BC (B = number of slots to process, C = Current Object)
44796 LD HL,24853 Point HL at Magic Knight's current inventory (wearing)
44799 CALL 48341 Remove object C from Magic Knight's current inventory (wearing)
44802 POP BC Restore BC (B = number of slots to process, C = Current Object)
44803 LD HL,24848 Point HL at start of Magic Knight's current inventory (carrying)...
44806 CALL 45380 ...and wait for interrupt then load object C into the first empty slot
44809 LD A,(41779) If Current Object (selected object) is not the Disquise (1)...
44812 CP 1 ...
44814 JP NZ,41727 ...then show Magic Knight's current inventory and jump back to main game loop
44817 XOR A Set current disquise to zero...
44818 LD (23438),A ...
44821 JP 41727 Show Magic Knight's current inventory and jump back to main game loop
44824 LD HL,56429 Point HL at "WHICH DISQUISE DO YOU WANT TO [Current Command]?" full menu text
44827 LD DE,49140 Adjust height of window 13 to accommodate text...
44830 CALL 45617 ...
44833 PUSH HL Store HL (pointer to menu text to print)
44834 LD A,13 Draw menu window 13...
44836 CALL 47185 ...
44839 POP HL Restore HL (pointer to menu text to print)
44840 CALL 46902 Print text to screen
44843 CALL 47502 Process keyboard / joystick input on a menu and load A with selected item index
44846 INC A Add one to selected item index to give selected disquise index...
44847 LD (44854),A ...and store as operand to instruction at 44853
44850 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
The operand of the instruction at 44853 represents the index of the selected disquise to wear. This is modified by the instruction at 44847.
44853 LD A,0 Load A with selected disquise index...
44855 LD (23438),A ...and store at 23438 as current disquise
44858 JP 44689 Jump back to 44689 (i.e. try to wear selected disquise)
Prev: 44615 Up: Map Next: 44861