Prev: 43494 Up: Map Next: 43874
43636: Process command to throw an object
Used by the routine at 64623.
43636 LD IX,24848 Point IX at Magic Knight's current inventory (carrying)
43640 LD B,5 Load B with 5 (five inventory slots)
43642 LD HL,51920 Point HL at "[Current Command] WHICH OBJECT ?" text
43645 LD DE,51928 Point DE at "[Current Command] THE " text
43648 CALL 45809 Show list of objects in Magic Knight's inventory (carrying) as a menu and load A with selected item index
43651 LD HL,24848 Point HL at Magic Knight's current inventory (carrying)
43654 CALL 45766 Print name of object in inventory slot A of inventory data at HL in command summary window
43657 LD DE,55959 Point DE at " AT " text...
43660 CALL 63349 ...and print in command summary window at top of screen
43663 LD HL,51418 Point HL at "THROW AN OBJECT AT ?" text
43666 LD DE,0 Load DE with zero (i.e. no command summary text)
43669 CALL 45963 Display and process input for character selection menu (current room's characters only), setting Current Character
43672 JP Z,41742 If there are no characters in the room then return to game
43675 CALL 64207 Display execute / reject command window and return here if execute chosen, else exit to main game loop
43678 LD A,(41779) Load A with index of Current Object...
43681 CALL 45685 ...and if this is 4 (Teddy Bear) then display "THE BEAR SAYS..." message and wait for fire to be pressed
43684 LD HL,51933 Point HL at "THE [name of Current Object] BLEW UP..." text
43687 CP 5 If Current Object is the Stick of Dynamite (5)...
43689 JP Z,64582 ...then jump to "game over" window routine and return to control selection menu
43692 CP 14 If Current Object is the Boomerang (14)...
43694 JP Z,43868 ...then skip ahead to 43868 (game over)
43697 CP 25 If Current Object is not the Magic Missile (25)...
43699 JR NZ,43715 ...then skip ahead to 43715
43701 LD A,(41937) If Current Character is not Off-White Knight (0)...
43704 OR A ...
43705 JR NZ,43712 ...then skip ahead to 43712
43707 LD A,255 Set Off-White-Knight-sent-to-sleep flag to 255...
43709 LD (23403),A ...
43712 LD A,(41779) Load A with index of Current Object...
43715 LD E,0 Point HL to the start of the Current Object's record in object properties table...
43717 CALL 45390 ...
43720 PUSH HL Copy address into IX...
43721 POP IX ...
43723 LD A,(IX+0) Load A with Current Object's weight...
43726 AND 15 ...
43728 CP 12 ...and if this is 12 or greater...
43730 JP NC,43856 ...then skip ahead to 43856 (game over)
43733 BIT 6,(IX+1) If Current Object's can-be-thrown-and-is-lethal flag is set...
43737 JP NZ,43862 ...then skip ahead to 43862
43740 LD A,(41779) Load C with index of Current Object...
43743 LD C,A ...
43744 LD B,5 Load B with 5 (five inventory slots)
43746 LD HL,24848 Point IX at Magic Knight's current inventory (carrying)
43749 CALL 48341 Remove object C from Magic Knight's current inventory (carrying)
43752 LD A,(41779) Load C with index of Current Object...
43755 LD C,A ...
43756 CP 20 If Current Object is the Mirror (20)...
43758 CALL Z,41915 ...then load C with 7 (index of Broken Glass)
43761 CP 17 If Current Object is Bottle of Liquid (17)...
43763 CALL Z,41918 ...then load C with 8 (index of Broken Glass)
43766 CP 18 If Current Object is Bottle of Liquid (18)...
43768 CALL Z,41921 ...then load C with 9 (index of Broken Glass)
43771 CP 28 If Current Object is Empty Bottle (28)...
43773 CALL Z,41918 ...then load C with 8 (index of Broken Glass)
43776 CP 29 If Current Object is Empty Bottle (29)...
43778 CALL Z,41921 ...then load C with 9 (index of Broken Glass)
43781 LD A,C Load BC with three times index of Current Object...
43782 ADD A,A ...
43783 ADD A,C ...
43784 LD C,A ...
43785 LD B,0 ...
43787 LD HL,24922 Point HL at start of objects' current positions table at 24922
43790 ADD HL,BC Add three times Current Object's index as offset to point HL at position data of current object
43791 LD A,(23702) Set object's room to be Magic Knight's current room...
43794 LD (HL),A ...
43795 INC HL Advance HL to object's x-coordinate
43796 PUSH HL Store HL (pointer to x-coordinate)
43797 LD A,(41937) Load BC with three times index of character who was target of throw...
43800 LD C,A ...
43801 ADD A,A ...
43802 ADD A,C ...
43803 LD B,0 ...
43805 LD C,A ...
43806 LD HL,24899 Point HL at x-coordinate of first entry in characters' current positions table
43809 ADD HL,BC Add BC (three times character index) as offset
43810 EX DE,HL Swap DE (now pointer to Current Character's x-coordinate) and HL (now undefined)
43811 POP HL Restore HL (pointer to object's x-coordinate)
43812 LD A,(DE) Copy character's x-coordinate...
43813 LD (HL),A ...into object's x-coordinate
43814 INC DE Advance to character's y-coordinate
43815 INC HL Advance to object's y-coordinate
43816 LD A,(DE) Copy character's y-coordinate plus three...
43817 ADD A,3 ...
43819 LD (HL),A ...into object's y-coordinate
43820 CALL 46183 Set Magic Knight's available action flags
43823 LD A,(41779) Load A with index of Current Object
43826 CP 25 If Current Object is the Magic Missile (25)...
43828 JR Z,43840 ...then skip ahead to 43840
43830 CP 20 If Current Object is not the Mirror (20)...
43832 JR NZ,43850 ...then skip ahead to 43850
43834 LD HL,55986 Point HL at "THE [object] LANDED ON THE FLOOR BY [character] AND SMASHED..." text (see trivia)
43837 JP 64293 Display smashed object window (15) and return to game
Magic Missile thrown
43840 LD A,(41937) Load A with index of Current Character
43843 LD E,6 Point HL at character's flags...
43845 CALL 45406 ...
43848 SET 7,(HL) ...and set asleep flag
43850 LD HL,55964 Point HL at "THE [object] LANDED ON THE FLOOR BY [character]" text
43853 JP 64293 Display "THE [object] LANDED ON THE FLOOR BY [character]" window (15) and return to game
Weight of 12 or more
43856 LD HL,50845 Point HL at "YOU KILLED YOURSELF TRYING TO THROW..." text
43859 JP 64582 Display cyan "game over" window and return to control selection menu
Lethal if thrown
43862 LD HL,50864 Point HL at "YOU THREW THE [Object] AND KILLED [Character]" text
43865 JP 64582 Display cyan "game over" window and return to control selection menu
Boomerang
43868 LD HL,56035 Point HL at thrown Boomerang game over text
43871 JP 64582 Display cyan "game over" window and return to control selection menu
Prev: 43494 Up: Map Next: 43874