Prev: 30222 Up: Map Next: 30540
30439: Process command to drop an object
Used by the routines at 27176 and 31153.
30439 CALL 38075 Play upward scale sound
30442 LD IX,25395 Point IX at start of Magic Knight's inventory
30446 LD B,5 Load B with 5, as there are five inventory slots to check
30448 LD HL,45429 Point HL at "DROP WHICH OBJECT?" text
30451 LD DE,45440 Point DE at "DROP" text
30454 CALL 34914 Show list of objects (window or menu) and handle selection if a menu
30457 LD HL,25395 Point HL at start of Magic Knight's current inventory
30460 CALL 34864 Point DE at name of a selected object in object names table and print in command summary window
30463 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
The operand of the instruction at 30466 represents the index of the Current Object used in multiple routines. This is modified by the instructions at 30342 and 34871.
30466 LD A,0 Load A with index of Current Object
30468 LD E,1 Load E with 1 (drop-status)
30470 CALL 34160 Point HL to drop-status of object A
30473 BIT 0,(HL) If drop-status is not zero, i.e. object can't be dropped then...
30475 JP NZ,34442 ...jump to 34442 (display "YOU CAN'T DROP THAT OBJECT" window and return to game)
30478 LD A,(30467) Load A with index of Current Object
30481 CP 16 If not object 16 (i.e. not Glowing Bottle)...
30483 JR NZ,30490 ...skip ahead to 30490...
30485 CALL 30540 ...else smash Glowing Bottle and release Banshee...
30488 JR 30504 ...and skip ahead to 30504
30490 LD A,(30467) Load A with index of Current Object
30493 LD C,A Copy into C
30494 PUSH BC Store BC
30495 LD B,5 Load B with 5
30497 LD HL,25395 Point HL at start of Magic Knight's current inventory
30500 CALL 38674 Remove object C from Magic Knight's inventory (and tidy up remainder of slots)
30503 POP BC Restore BC
30504 LD A,C Load Current Object's index into A
30505 ADD A,A Multiply object index by 3...
30506 ADD A,C ...
30507 LD C,A ...and load back into C
30508 LD B,0 Load B with zero
30510 LD HL,25464 Point HL at start of objects' current positions table at 25464
30513 ADD HL,BC Add three times Current Object's index as offset to point HL at position data of Current Object
30514 LD A,(65529) Load A with Magic Knight's current room
30517 LD (HL),A Set object's current room to be same as Magic Knight's
30518 INC HL Advance HL to x-coordinate of object
30519 LD B,0 Set B to zero
30521 LD A,(25387) Load Magic Knight's current x-coordinate into A
30524 AND 7 Get x-coordinate in terms of pixels within current character block (i.e. lowest 3 bits of x-coordinate)
30526 JR Z,30529 If this is zero (i.e. Magic Knight at left-most pixel in character block) then skip ahead to 30529...
30528 INC B ...else increase B
30529 CALL 34385 Load Magic Knight's coordinates (in characters) into DE
30532 LD A,B Load B into A
30533 ADD A,E Add Magic Knight's x-coordinate to A
30534 LD (HL),A Set this as object's x-coordinate
30535 INC HL Advance HL to y-coordinate of object
30536 LD (HL),D Set this to same as Magic Knight's y-coordinate
30537 JP 30410 Display Magic Knight's current inventory and return to game
Prev: 30222 Up: Map Next: 30540