Prev: 42247 Up: Map Next: 42395
42257: Process command to give an object
Used by the routine at 64623.
42257 CALL 45641 Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty
42260 JP Z,41742 If Magic Knight's inventory (carrying) is empty then return to game
42263 LD IX,24848 Point IX at Magic Knight's current inventory (carrying)
42267 LD B,5 Load B with 5 (five inventory slots)
42269 LD HL,51920 Point HL at "[Current Command] WHICH OBJECT ?" text
42272 LD DE,51928 Point DE at "[Current Command] THE " text
42275 CALL 45809 Show list of objects in Magic Knight's inventory (carrying) as a menu and load A with selected item index
42278 LD HL,24848 Point HL at Magic Knight's current inventory (carrying)
42281 CALL 45766 Print name of object in inventory slot A of inventory data at HL in command summary window
42284 LD DE,52105 Point DE at " TO " text...
42287 CALL 63349 ...and print in command summary window at top of screen
42290 LD HL,51400 Point HL at "[Current Command] AN OBJECT TO ?" text
42293 LD DE,0 Load DE with zero (i.e. no command summary text)
42296 CALL 45963 Display and process input for character selection menu (current room's characters only), setting Current Character
42299 JP Z,41742 If there are no characters in the room then return to game
42302 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
42305 LD A,(41779) Load A with index of Current Object...
42308 CALL 45685 ...and if this is 4 (Teddy Bear) then display "THE BEAR SAYS..." message and wait for fire to be pressed
42311 LD A,4 Increase Current Character's happiness by 4...
42313 CALL 45434 ...
42316 LD A,(41937) Point IX at current inventory of Current Character...
42319 CALL 45450 ...
42322 LD A,(IX+4) If last inventory slot of character is not zero...
42325 OR A ...(i.e. last inventory slot is occupied) then reset zero flag
42326 LD HL,52108 Point HL at "[Current Character's short name]'S HANDS ARE FULL" text
42329 JP NZ,64261 If zero flag is reset then display "[Character]'S HANDS ARE FULL" window (13) and return to game
42332 LD BC,1280 Load B with 5 (five inventory slots) and C with zero
42335 LD A,(IX+0) Load content of current inventory slot into A
42338 OR A If this inventory slot is empty...
42339 JR Z,42350 ...then skip ahead to 42350
42341 CALL 45351 Load A with weight of object in current slot...
42344 ADD A,C ...and add to C (running total weight)...
42345 LD C,A ...
42346 INC IX Advance to next inventory slot
42348 DJNZ 42335 Loop back to 42335 for next slot
42350 LD A,(41779) Load A with index of Current Object
42353 CALL 45351 Load A with weight of object being given...
42356 ADD A,C ...and add this to total in C also...
42357 LD C,A ...
42358 LD A,(41937) Load A with index of Current Character
42361 LD E,0 Point HL at character's current strength...
42363 CALL 45406 ...
42366 LD A,(HL) Load strength into A...
42367 AND 127 ...and reset bit 7 (unused)
42369 CP C If character's strength is not less than total weight of objects...
42370 JR NC,42378 ...then skip ahead to 42378
42372 LD HL,52126 Point HL at "[Current Character's short name] IS NOT STRONG ENOUGH" text
42375 JP 64261 Display "[Character] IS NOT STRONG ENOUGH" window (13) and return to game
42378 CALL 45364 Load A with Current Character's happiness level...
42381 CP 20 ...and if this is less than 20...
42383 JP C,64275 ...then display "[Character] DOES NOT WANT THE [Object]" window (13) and return to game
42386 LD A,(41937) Load A with index of Current Character
42389 LD HL,42413 Load HL with start address of table of start addresses of routines for characters having objects given
42392 JP 64623 Load HL with address of Current Character's "give an object" routine and jump to it
Prev: 42247 Up: Map Next: 42395