Prev: 30602 Up: Map Next: 31153
30880: Process command to give an object
Used by the routines at 27176 and 31153.
30880 CALL 38075 Play upward scale sound
30883 LD IX,25395 Point IX at Magic Knight's inventory
30887 LD B,5 Load B with 5 (as there are five inventory slots)
30889 LD HL,45810 Point HL at "GIVE WHICH OBJECT?" text
30892 LD DE,45817 Point DE at "GIVE" text
30895 CALL 34914 Show list of objects (window or menu) and handle selection if a menu
30898 LD HL,25395 Point HL at Magic Knight's inventory
30901 CALL 34864 Point DE at name of a selected object in object names table and print in command summary window
30904 LD DE,45820 Point DE at "TO" text...
30907 CALL 38693 ...and print in command summary window at bottom of screen
30910 LD HL,44058 Point HL to "GIVE AN OBJECT TO ?" text
30913 LD DE,0 Set DE to zero so command summary window is not updated with additional text
30916 CALL 35141 Display and process input for character selection menu (current room's characters only), setting Current Character
30919 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
30922 LD A,(30615) Load A with index of Current Character
30925 CALL 34186 Point IX at current inventory of character in A
30928 LD A,(IX+4) Load A with contents of character's last inventory slot
30931 OR A If inventory slot is not empty...
30932 JP NZ,34460 ...then display "[CHARACTER]'S HANDS ARE FULL" window and return to game
30935 LD BC,1280 Load B (number of inventory slots) with 5 and C (running total of character's carried weight) with 0
30938 LD A,(IX+0) Load index of object in character's current inventory slot into A
30941 OR A If object index is zero (i.e. there is nothing in this slot and we have reached the end of the inventory)...
30942 JR Z,30953 ...then jump ahead to 30953 (IX now points to first empty inventory slot)
30944 CALL 34126 Load A with weight of object A
30947 ADD A,C Add weight of object to C...
30948 LD C,A ...
30949 INC IX Advance to next inventory slot
30951 DJNZ 30938 Decrease B and loop back for next slot
30953 LD A,(30467) Load A with index of Current Object
30956 CALL 34126 Load A with weight of object A
30959 ADD A,C Add weight of Current Object to total weight currently held by the character...
30960 LD C,A ...in C
30961 LD A,(30615) Load A with index of Current Character
30964 LD E,0 Point HL at strength of character whose index is A...
30966 CALL 34174 ...
30969 LD A,(HL) Load character's strength into A
30970 CP C If total weight in C is greater than character's strength in A...
30971 JP C,34466 ...then display "[CHARACTER] IS NOT STRONG ENOUGH" window and return to game
30974 CALL 34137 Load happiness of Current Character into A
30977 CP 25 If character's happiness is less than 25...
30979 JP C,34472 ...then display "[CHARACTER] DOES NOT WANT THAT" window and return to game
30982 LD A,(30467) Load B with index of Current Object...
30985 LD B,A ...
30986 LD A,(30615) Load A with index of Current Character
30989 OR A If Current Character is not 0 (Gimbal)...
30990 JP NZ,31009 ...then skip ahead to 31009
30993 LD A,B Load index of Current Object into A...
30994 CP 24 If Current Object is not the Willow Rod...
30996 JR NZ,31006 ...then skip ahead to 31006
30998 LD A,(25328) Set Gimbal's can-help flag... (see trivia)
31001 OR 1 ...
31003 LD (25328),A ...
31006 JP 31135 Skip ahead to 31135
31009 CP 1 If Current Character is not Thor...
31011 JP NZ,31038 ...then skip ahead to 31038
31014 LD A,B Load index of Current Object into A
31015 CP 3 If Current Object is not Miolnir...
31017 JR NZ,31035 ...then skip ahead to 31035
31019 LD A,(25336) Set Thor's can-help flag...
31022 OR 1 ...
31024 LD (25336),A ...
31027 LD A,10 Change Thor's "current status" text to 10 (ready to help)...
31029 LD (25338),A ...
31032 JP 31135 Skip ahead to 31135 [bug]
31035 JP 31135 Skip ahead to 31135
31038 CP 2 If Current Character is not Florin...
31040 JP NZ,31059 ...then skip ahead to 31059
31043 LD A,B Load index of Current Object into A
31044 CP 11 If object is not the Broken Talisman...
31046 JR NZ,31056 ...then skip ahead to 31056
31048 LD A,(25344) Set Florin's can-help flag...
31051 OR 1 ...
31053 LD (25344),A ...
31056 JP 31135 Skip ahead to 31135
31059 CP 3 If Current Character is not Orik...
31061 JP NZ,31068 ...then skip ahead to 31068
31064 LD A,B Load index of Current Object into A
31065 JP 31135 Skip ahead to 31135
31068 CP 4 If Current Character is not Samsun...
31070 JP NZ,31092 ...then skip ahead to 31092
31073 LD A,B Load index of Current Object into A
31074 CP 8 If object is not 8 (Javelin)...
31076 JR NZ,31089 ...then skip ahead to 31089
31078 LD A,(25360) Set Samsun's can-help flag...
31081 OR 1 ...
31083 LD (25360),A ...
31086 JP 31135 Skip ahead to 31135 [bug]
31089 JP 31135 Skip ahead to 31135
31092 CP 5 If Current Character is not Elrand...
31094 JP NZ,31111 ...then skip ahead to 31111
31097 LD A,B Load index of Current Object into A
31098 CP 40 [bug]
31100 LD A,(25368) Set Elrand's can-help flag...
31103 OR 1 ...
31105 LD (25368),A ...
31108 JP 31135 Skip ahead to 31135
31111 CP 6 If Current Character is not Rosmar...
31113 JP NZ,31135 ...then skip ahead to 31135
31116 LD A,B Load index of Current Object into A
31117 CP 36 If object is not 36 (Pocket Laser)...
31119 JR NZ,31132 ...then skip ahead to 31132
31121 LD A,(25376) Set Rosmar's can-help flag...
31124 OR 1 ...
31126 LD (25376),A ...
31129 JP 31135 Skip ahead to 31135 [bug]
31132 JP 31135 Skip ahead to 31135
31135 LD A,(30467) Load index of Current Object into first empty inventory slot of character...
31138 LD (IX+0),A ...
31141 LD C,A ...and into C
31142 LD B,5 Load B with 5 (as there are 5 inventory slots to check)
31144 LD HL,25395 Point HL at Magic Knight's inventory
31147 CALL 38674 Remove object C from Magic Knight's inventory (and tidy up remainder of slots)
31150 JP 30410 Display Magic Knight's current inventory and return to game
Prev: 30602 Up: Map Next: 31153