Prev: 29330 Up: Map Next: 29619
29488: Process command to drop an object
Used by the routine at 55726.
Input
IY 23610
29488 CALL 33834 Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty
29491 JP Z,29482 If Magic Knight's inventory (carrying) is empty then return to game
29494 LD IX,25164 Point IX at start of Magic Knight's current inventory (carrying)
29498 LD B,5 Load B with 5 (five inventory slots)
29500 LD HL,38904 Point HL at "DROP WHICH OBJECT ?" text
29503 LD DE,38916 Point DE at "DROP THE " text
29506 CALL 33952 Show list of objects in Magic Knight's inventory (carrying) as a menu and load A with selected item index
29509 LD HL,25164 Point HL at start of Magic Knight's current inventory (carrying)
29512 CALL 33911 Print name of selected object in Magic Knight's current inventory (carrying) in command summary window
29515 CALL 55115 Display execute / reject command window and return here if execute chosen, else exit to main game loop
29518 BIT 1,(IY+89) If "USE TRANSPORTER" command is enabled (i.e. Magic Knight is standing on a transporter pad)...
29522 JP NZ,55349 ...then display "YOU CANNOT DROP THE [Object] HERE" window (29) and return to game
The operand of the instruction at 29525 represents the index of the Current Object used in multiple routines. This is modified by the instructions at 29414 and 33916.
29525 LD A,0 Load index of current object into A
29527 CP 16 If object is Quark Bomb...
29529 JP Z,29613 ...then skip ahead to 29613
29532 LD E,0 Load E with 0 (prepare to check drop-status flag)
29534 CALL 33525 Point HL to byte 0 of the A-th record in object properties table
29537 BIT 4,(HL) If object's drop-status flag is set...
29539 JP NZ,55197 ...then display "YOU CANNOT DROP THE [object]" window (13) and return to game
29542 BIT 7,(HL) If object's is-breakable flag is set...
29544 JP NZ,29597 ...then skip ahead to 29597
29547 LD A,(29526) Load A with index of Current Object
29550 LD C,A Copy into C
29551 PUSH BC Store BC (C = index of Current Object)
29552 LD B,5 Load B with 5 (five inventory slots)
29554 LD HL,25164 Point HL at start of Magic Knight's current inventory (carrying)
29557 CALL 36254 Remove object C from Magic Knight's current inventory (carrying)
29560 POP BC Restore BC (C = index of Current Object)
29561 LD A,C Load current object's index into A
29562 ADD A,A Multiply object index by 3...
29563 ADD A,C ...
29564 LD C,A ...and load back into C
29565 LD B,0 Load B with zero
29567 LD HL,25286 Point HL at start of objects' current positions table at 25286
29570 ADD HL,BC Add three times Current Object's index as offset to point HL at position data of current object
29571 LD A,(23701) Load A with Magic Knight's current room
29574 LD (HL),A Set object's current room to be same as Magic Knight's
29575 INC HL Advance HL to x-coordinate of object
29576 LD B,0 Set B to zero
29578 LD A,(25156) Load A with Magic Knight's current x-coordinate (pixels)
29581 AND 7 Get x-coordinate in terms of pixels within current character block (i.e. lowest 3 bits of x-coordinate)
29583 JR Z,29586 If this is zero (i.e. Magic Knight at left-most pixel in character block) then skip ahead to 29586...
29585 INC B ...else increase B
29586 CALL 33757 Load Magic Knight's coordinates (in characters) into DE
29589 LD A,B Load B into A
29590 ADD A,E Add Magic Knight's x-coordinate to A
29591 LD (HL),A Set this as object's x-coordinate
29592 INC HL Advance HL to y-coordinate of object
29593 LD (HL),D Set this to same as Magic Knight's y-coordinate
29594 JP 29467 Show Magic Knight's current inventory and jump back to main game loop
29597 LD A,(29526) Load A with index of Current Object
29600 LD C,A Copy into C
29601 LD B,5 Load B with 5 (five inventory slots)
29603 LD HL,25164 Point HL at start of Magic Knight's current inventory (carrying)
29606 CALL 36254 Remove object C from Magic Knight's current inventory (carrying)
29609 LD C,15 Set object to drop to Broken Glass
29611 JR 29561 Jump back to 29561 to drop the Broken Glass
29613 LD HL,44862 Point HL at "YOU HAVE DESTROYED YOURSELF BY DROPPING THE..." text
29616 JP 55685 Jump to "game over" window routine and return to control selection menu
Prev: 29330 Up: Map Next: 29619