Prev: 33278 Up: Map Next: 33565
33312: Process command to blow an object
Used by the routines at 27176 and 31153.
Input
IY 23610
33312 LD A,(65532) Load Magic Knight's current action flags into A
33315 BIT 6,A If blow-enabled flag is unset...
33317 JP Z,27189 ...then jump into main game loop (process keyboard input and move Magic Knight, enter menus or execute other command)
33320 CALL 38075 Play upward scale sound
33323 LD IX,25395 Point IX at Magic Knight's current inventory
33327 LD B,5 Set B to 5 (as there are 5 inventory slots)
33329 LD HL,50891 Point HL at "BLOW WHICH OBJECT?" text
33332 LD DE,50902 Point DE at "BLOW" text
33335 CALL 34914 Display list of objects in Magic Knight's inventory and wait for one to be selected. Load its index into A
33338 LD HL,25395 Point DE at name of a selected object in object names table and print in command summary window...
33341 CALL 34864 ...
33344 LD A,(30467) If selected object is not the Elf-Horn...
33347 CP 38 ...
33349 JP NZ,33574 ...then confirm and process blow command (create dust or racket!) then return to game
33352 SET 2,(IY+65) Set characters-can't-move flag
33356 CALL 37654 Display / update command summary window at bottom of screen
33359 LD DE,50909 Point DE at "SUMMON" text...
33362 CALL 38693 ...and print in command summary window at bottom of screen
33365 LD HL,44069 Point HL at "SUMMON ?" text...
33368 PUSH HL ...and store
33369 CALL 35293 Display and handle full character selection menu
33372 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
33375 CALL 34402 Point HL at current position data for Current Character
33378 LD A,(65529) Load Magic Knight's current room into A
33381 CP (HL) If character is in the same room as Magic Knight...
33382 JP Z,34616 ...then display "[CHARACTER] IS ALREADY HERE!" message and return to game
33385 LD A,(HL) Load character's current room into A
33386 LD HL,51173 Point HL at "[CHARACTER] IS NO LONGER AROUND" text
33389 CP 100 If character's current room is 100...
33391 JP Z,34808 ...then display "[CHARACTER] IS NO LONGER AROUND" window then return to game
33394 LD A,(30615) Load A with index of Current Character
33397 CP 7 If character is The Banshee...
33399 JR Z,33435 ...skip over asleep / tiredness check as Banshee never sleeps or gets tired
33401 LD A,(30615) Load A with index of Current Character
33404 LD E,0 Point HL at property 0 (strength) of character...
33406 CALL 34174 ...
33409 PUSH HL Copy location from HL to IX...
33410 POP IX ...
33412 BIT 7,(IX+6) If character is asleep (bit 7 of the byte 6 bytes forward)...
33416 JP NZ,34598 ...then display "[CHARACTER] IS ASLEEP" message and return to game
33419 LD A,(IX+1) Load A with happiness of Current Character
33422 CP 40 If happiness is less than 40...
33424 JP C,34604 ...
33427 LD A,(IX+2) ...then display "[CHARACTER] DOES NOT WANT TO BE SUMMONED" message and return to game
33430 CP 30 If happiness is less than 30...
33432 JP C,34610 ...then display "[CHARACTER] IS TOO TIRED TO BE SUMMONED" message and return to game
33435 CALL 34402 Point HL at current position data for Current Character
33438 PUSH HL Store HL
33439 PUSH IX Store IX
33441 LD A,(65529) Load Magic Knight's current room into C...
33444 LD C,A ...
33445 LD A,(30615) Load B with index of Current Character...
33448 LD B,A ...
33449 CALL 36327 Assign a slot in room C to character B and get x- and y-coordinates in BC
33452 POP IX Restore IX
33454 POP HL Restore HL
33455 CP 4 If assigned slot number is 4 (i.e. already three characters in this room)...
33457 JP Z,34622 ...then display "[CHARACTER] DOES NOT WANT TO COME TO SUCH A CROWDED ROOM" message and return to game
33460 PUSH HL Store HL (current position data for Current Character)
33461 INC HL Load x-coordinate of character into C...
33462 LD (HL),C ...
33463 INC HL Load y-coordinate of character into B...
33464 LD (HL),B ...
33465 POP HL Restore HL (start of current position data for Current Character)
33466 LD A,(65529) Load Magic Knight's current room into A
33469 OR 128 Set bit 7 of room index data if it is not already set to denote that this character's entry needs to be animated (puff of smoke)
33471 LD (HL),A Load data into current room of Current Character
33472 LD A,(30615) Load A with index of Current Character
33475 CP 7 If character is The Banshee then skip over section dealing with decreasing summoned characters stats as Banshee's stats never change (see trivia)
33477 JP Z,33512
33480 LD A,(IX+0) Decrease character's strength by 10...
33483 SUB 10 ...
33485 LD (IX+0),A ...
33488 LD A,(IX+1) Decrease character's happiness by 5...
33491 SUB 5 ...
33493 LD (IX+1),A ...
33496 LD A,(IX+2) Decrease character's stamina by 12...
33499 SUB 12 ...
33501 LD (IX+2),A ...
33504 LD A,(25318) Decrease Magic Knight's spell power by 3...
33507 SUB 3 ...
33509 LD (25318),A ...
33512 LD A,(23378) If Release-Spell-cast score flag is not set...
33515 BIT 4,A ...
33517 JP Z,34628 ...then display "[CHARACTER] APPEARS IN A THICK PUFF OF SMOKE" window and return to game
33520 LD IX,(23503) Else load IX with address of index of next character to send home from table at 33565
33524 LD A,(30615) Load A with index of Current Character
33527 CP (IX+0) If data at IX does not match Current Character...
33530 JP NZ,34628 ...then display "[CHARACTER] APPEARS IN A THICK PUFF OF SMOKE" window and return to game (character is not to be sent home yet)
33533 LD (HL),100 Set character's current room to 100
33535 INC IX Advance IX to next character in sequence...
33537 LD (23503),IX ...and store this new pointer
33541 LD A,255 If index of next character to go home is 255...
33543 CP (IX+0) ...
33546 JP Z,33180 ...then jump to "well done" (i.e. game complete) routine
33549 CALL 33278 Flash border and screen (as in cast a spell)
33552 LD A,(23506) Add one to "characters sent home" score...
33555 INC A ...
33556 LD (23506),A ...
33559 LD HL,51194 Display "[CHARACTER] APPEARS IN SPIRIT FORM AS GIMBAL..." window and return to game...
33562 JP 34808 ...
Prev: 33278 Up: Map Next: 33565