Prev: 32258 Up: Map Next: 32655
32390: Process and execute command to throw an object
Used by the routines at 27176 and 31153.
32390 LD A,(65532) If throw-enabled flag is not set...
32393 BIT 4,A ...
32395 JP Z,27189 ...then jump into main game loop (process keyboard input and move Magic Knight, enter menus or execute other command)
32398 CALL 38075 Play upward scale sound
32401 LD A,(23377) Set Gimbal-white-out-safe flag...
32404 OR 1 ...
32406 LD (23377),A ...
32409 LD IX,25395 Point IX at Magic Knight's inventory
32413 LD B,5 Load B with 5 (as 5 inventory slots)
32415 LD HL,50381 Point HL at "THROW WHICH OBJECT" text
32418 LD DE,50388 Point DE at "THROW" text
32421 CALL 34914 Show list of objects (window or menu) and handle selection if a menu
32424 LD HL,25395 Point HL at Magic Knight's inventory
32427 CALL 34864 Point DE at name of a selected object in object names table and print in command summary window
32430 LD DE,50391 Point DE at "AT" text...
32433 CALL 38693 ...and print in command summary window at bottom of screen
32436 LD HL,44083 Point HL at "THROW AN OBJECT AT ?" text
32439 LD DE,0 Set DE to zero so command summary window is not updated with additional text
32442 CALL 35141 Display and process input for character selection menu (current room's characters only), setting Current Character
32445 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
32448 LD A,(30467) Load A with index of Current Object
32451 LD E,0 Load E with 0 (weight)
32453 CALL 34160 Point HL to weight of object A
32456 PUSH HL Copy HL...
32457 POP IX ...into IX
32459 LD A,(IX+0) Load A with object's weight
32462 CP 12 If object has weight greater than 12...
32464 JP NC,32643 ...then kill Magic Knight and end game
32467 BIT 4,(IX+4) If object's lethal-if-thrown flag is set...
32471 JP NZ,32649 ...then kill the character who object was thrown at and end game
32474 BIT 5,(IX+4) If object's is-a-crystal flag is reset...
32478 JR Z,32487 ...then skip ahead to 32487
32480 LD A,(30615) If target of throw is Gimbal...
32483 OR A ...
32484 JP Z,32555 ...then skip ahead to 32555
32487 LD A,(30467) If object thrown is not the Glowing Bottle...
32490 CP 16 ...
32492 JP NZ,32499 ...then skip ahead to 32499
32495 CALL 30540 Remove Glowing Bottle from Magic Knight's inventory, smash it and release Banshee
32498 LD A,C Load index of Broken Glass into A (Current Object)
32499 LD C,A Load index of Current Object into C
32500 PUSH BC Store BC (C=Current Object)
32501 LD B,5 Load B with 5
32503 LD HL,25395 Point HL at Magic Knight's inventory
32506 CALL 38674 Remove object C from Magic Knight's inventory (and tidy up remainder of slots)
32509 POP BC Restore BC (C=Current Object)
32510 LD A,C Copy index of Current Object into A...
32511 ADD A,A ...and multiply by three...
32512 ADD A,C ...
32513 LD C,A Transfer into BC...
32514 LD B,0 ...
32516 LD HL,25464 Point HL to objects' current positions table
32519 ADD HL,BC Add three times Current Object's index as offset
32520 LD A,(65529) Set object's room to be Magic Knight's current room...
32523 LD (HL),A ...
32524 INC HL Advance HL to object's x-coordinate
32525 PUSH HL Store HL (pointer to x-coordinate)
32526 LD A,(30615) Load BC with three times index of character who was target of throw...
32529 LD C,A ...
32530 ADD A,A ...
32531 ADD A,C ...
32532 LD B,0 ...
32534 LD C,A ...
32535 LD HL,25441 Point HL at x-coordinate of first entry in characters' current positions table
32538 ADD HL,BC Add BC (three times character index) as offset
32539 EX DE,HL Swap DE (now pointer to Current Character's x-coordinate) and HL (now undefined)
32540 POP HL Restore HL (pointer to object's x-coordinate)
32541 LD A,(DE) Copy character's x-coordinate...
32542 LD (HL),A ...into object's x-coordinate
32543 INC DE Advance to character's y-coordinate
32544 INC HL Advance to object's y-coordinate
32545 LD A,(DE) Copy character's y-coordinate plus three...
32546 ADD A,3 ...
32548 LD (HL),A ...into object's y-coordinate
32549 CALL 35495 Set Magic Knight's available action flags
32552 JP 34724 Display "THE [OBJECT] LANDED ON THE FLOOR BY [CHARACTER]" window and return to game
32555 LD A,(23378) If Crystallium-Spectralis-cast score flag is not set...
32558 AND 1 ...
32560 JP Z,34700 ...then display "YOU HEAR A SHORT-RANGE TELEPATHIC WHISPER..." message and return to game
32563 LD A,(30467) Load A with index of Current Object
32566 LD B,223 Set blue and red crystal flags, reset green crystal flag in mask
32568 CP 21 If object is the Green Crystal...
32570 JR Z,32580 ...then skip ahead to 32580
32572 LD B,239 Set green and blue crystal flags, reset red crystal flag in mask
32574 CP 23 If object is the Red Crystal...
32576 JR Z,32580 ...then skip ahead to 32580
32578 LD B,247 Set green and red crystal flags, reset blue crystal flag in mask
32580 LD A,(29939) Load Gimbal's current attribute into A...
32583 AND B ...apply mask...
32584 LD (29939),A ...and store again
32587 PUSH AF Store AF (A=Gimbal's current attribute)
32588 LD A,(30467) Load C with index of Current Object...
32591 LD C,A ...
32592 LD B,5 Load B with 5 as there are 5 inventory slots
32594 LD HL,25395 Point HL at Magic Knight's inventory
32597 CALL 38674 Remove Current Object from Magic Knight's inventory and tidy up slots
32600 POP AF Restore AF (A=current red, green and blue crystal flags)
32601 CP 71 If R, G and B PAPER bits of Gimbal's attribute are not all reset...
32603 JR NZ,32624 ...skip ahead to 32624
32605 LD A,(23468) Set Gimbal-is-free game progress flag...
32608 OR 1 ...
32610 LD (23468),A ...
32613 LD A,11 Set Gimbal's "examine character" descriptive text to...
32615 LD (25330),A ...
32618 CALL 33278 Flash border and screen (as in cast a spell)
32621 JP 34646 Display "SUCCESS! GIMBAL IS FREE AT LAST!" window and return to game
32624 CALL 33278 Flash border and screen (as in cast a spell)
32627 LD A,(30467) Load A with index of Current Object
32630 CP 22 If object is the Blue Crystal...
32632 JP Z,34706 ...then display "THE BLUE CRYSTAL FLEW AT GIMBAL AND BURST..." window and return to game
32635 CP 23 If object is the Red Crystal...
32637 JP Z,34712 ...then display "THE RED CRYSTAL FLEW STRAIGHT AT GIMBAL AND TURNED INTO A GAS..." window and return to game
32640 JP 34718 Display "THE GREEN CRYSTAL FLEW AT GIMBAL AND SUCKED..." window and return to game
32643 LD HL,43504 Point HL at "YOU KILLED YOURSELF TRYING TO THROW SOMETHING AT [CHARACTER]" text
32646 JP 35101 Jump to "game over" window routine and exit
32649 LD HL,43539 Point HL at "YOU THREW SOMETHING AND KILLED [CHARACTER]" text
32652 JP 35101 Jump to "game over" window routine and exit
Prev: 32258 Up: Map Next: 32655