Prev: E7ED Up: Map Next: E852
E7FD: Check which spell is being cast
There are 5 sorts of spell type, the value stored in the current spell data byte at EBC7.
  • MOVE spell, which switches player control to Maroc (byte value = 1)
  • Spell which switches player control to a graphic/icon cursor, e.g. SERVANT, MISSILE, OPEN (byte value = 2)
  • Missile type spells that don't deactivate after a bolt is fired, reserved just for ELECTRIC and FLAME spells (byte value = 3)
  • Ongoing effect spell, e.g. SHIELD, WRAITHBANE (byte value = 4)
  • Instant effect spell, e.g. ENERGIZE, FREEZE, PORTAL (byte value = 5)
This routine checks for spell type, and jumps to the routine that deals with it.
Check for 'active effect' spell (type = 4):
E7FD LD A,($EBC7)
E800 CP $04
E802 JP Z,$EA1D Jump here if so, as casting this sort of spell may be cancelling an existing active spell.
Check for other types of spell:
E805 LD A,($EAE6) Get spell number counter (for spell list at 6FBC)
E808 LD ($EAEC),A ...and put in temporary store
E80B LD A,($EBC7) Get spell type
Check for MOVE spell
E80E CP $01
E810 JR NZ,$E819
E812 LD A,$20 Move spell selected. Set the spell selection byte accordingly.
E814 LD ($EAE1),A
E817 JR $E852
Check if spell is an 'instant effect' spell (ENERGIZE, HAIL, WAYSTONE, FREEZE, SUMMON, PORTAL, MESSAGE):
E819 CP $05
E81B JR NZ,$E826
Spell is an 'instant effect' spell. These spells have an energy cost to their casting (positive in the case of ENERGIZE).
E81D LD A,($EBC6) Get energy cost of spell. This is the second byte in each spell set at 6DFC, e.g.:
  • ENERGIZE = +64
  • HAIL = -1
  • WAYSTONE = -4
  • FREEZE = -4
  • SUMMON = -4
  • PORTAL = -8
E820 CALL $E3CC Reduce/increase Maroc's energy
E823 JP $EA72
The spell cast needs a controllable cursor (e.g. SERVANT, OPEN, MISSILE, FIND)
E826 LD A,$01
E828 LD ($EB50),A Set graphic address pointer frame offset (1 = no offset, start at first graphics frame)
E82B LD ($EC99),A Copy to controllable spell cursor/graphic frame buffer
E82E LD A,($EBCC) Get graphic number for controllable cursor.
This will either be a pointer to the servant graphic (9813/A0DC) or the flashing eye cursor (9817/A105)
E831 CALL $E0C2 Setup graphics (for servant or eye cursor)
Copy/initialize a few spell-related bytes in the spell data buffer:
E834 LD HL,($EB51) Get cursor graphics address pointer (9813/9817)
E837 LD ($EC94),HL ...and store in temporary game buffer
E83A LD A,($EB4F) Pre-graphics data byte, indicating frames & if graphic can be 'flipped'
E83D LD ($EC9A),A
E840 LD A,$28 Starting vertical position for the controllable graphic, in pixels, from the top of the playing area
E842 LD ($EAFF),A
E845 LD A,$70 Starting horizontal position for the controllable graphic, in pixels, from the left of the playing area
E847 LD ($EB00),A
E84A LD A,$30 Spell selection status - 48 = servant/cursor controllable spell
E84C LD ($EAE1),A
E84F JP $E929
Prev: E7ED Up: Map Next: E852