Prev: 32390 Up: Map Next: 32764
32655: Process and execute command to cast a spell
Used by the routines at 27176 and 31153.
32655 LD A,(65532) If cast-a-spell-enabled flag is not set...
32658 BIT 5,A ...
32660 JP Z,27189 ...then jump into main game loop (process keyboard input and move Magic Knight, enter menus or execute other command)
32663 CALL 38075 Play upward scale sound
32666 CALL 37654 Display / update command summary window at bottom of screen
32669 LD DE,49377 Point DE at "CAST A SPELL" text...
32672 CALL 38693 ...and print in command summary window at bottom of screen
32675 LD HL,49383 Point HL at byte before "WHICH SPELL DO YOU WANT TO CAST?" full menu text
32678 LD A,(HL) Load data into position of bottom edge of window data for "cast a spell" window...
32679 LD (42117),A ...
32682 INC HL Advance HL to start of actual text
32683 PUSH HL Store HL (pointer to menu text)
32684 LD A,30 Draw the "cast a spell" window...
32686 CALL 36979 ...
32689 POP HL Restore HL (pointer to menu text)
32690 CALL 36725 Print the text
32693 CALL 37333 Process input for menu, and load ASCII code of shortcut for selected (i.e. SPACE or fire pressed) item into A
32696 SUB 65 Subtract ASCII value of "A" to get numeric index of option selected
32698 LD (32726),A Store index of spell selected in this routine at 32726
If PROJECT PHYSICAL BODY spell has been selected then the command summary window shows "PROJECT PHYSICAL BODY TO..." rather than "CAST..." as with all other spells.
32701 CP 4 If spell number 4 (Project Physical Body) is selected...
32703 JR Z,32725 ...then skip ahead to 32725
32705 CALL 37654 Display / update command summary window at bottom of screen
32708 LD HL,50184 Point HL at "CAST CRYSTALLIUM SPECTRALIS" text (i.e. first in list of "CAST [SPELL]" strings)
32711 LD A,(32726) Load index of spell selected into B...
32714 LD B,A ...
32715 CALL 34845 Advance HL to B-th entry in list of zero-terminated strings
32718 EX DE,HL Swap DE (now points to "CAST [SPELL]" text) and HL (now points to "CAST A SPELL" text)
32719 CALL 38693 ...and print in command summary window at bottom of screen
32722 CALL 38725 Display execute / reject command window and return if execute chosen, else exit
The operand of the instruction at 32725 represents the index of the spell to cast. This is modified by the instruction at 32698.
32725 LD A,0 Load A with index of spell to cast
32727 OR A If spell is Crystallium Spectralis...
32728 JP Z,32764 ...then cast Crystallium Spectralis if possible, else display failure message
32731 CP 1 If spell is Candelium Illuminatus...
32733 JP Z,32823 ...then jump to 32823
32736 CP 2 If spell is Armouris Photonicus...
32738 JP Z,32903 ...then jump to 32903
32741 CP 3 If spell is Fumaticus Protectium...
32743 JP Z,32982 ...then jump to 32982
32746 CP 4 If spell is Project Physical Body...
32748 JP Z,33036 ...then jump to 33036
32751 CP 5 If spell is Release Spell...
32753 JP Z,33129 ...then jump to 33129
32756 CP 6 If spell is Quiticus Gamus...
32758 JP Z,33269 ...then jump to 33269
32761 JP 30428 Reset Gimbal-white-out-safe flag, redraw current room and return to main game loop
Prev: 32390 Up: Map Next: 32764