Prev: E987 Up: Map Next: EA1D
E9DD: Check if FIRE pressed when servant or controllable spell cursor is on screen
For active cursor-type spells such as SERVANT, OPEN, REVEAL etc., pressing FIRE cancels the spell.
The exceptions are the FLAME and ELECTRIC spells, which keep the aiming cursor on-screen, allowing for multiple missiles to be fired without having to activate the spell from the scroll list again.
E9DD LD A,($EAD5) Flag indicating whether (any part of) graphic is visible on screen
E9E0 CP $00 0 = not visible, 1 = visible
E9E2 JP Z,$EA0D If not visible, the servant/eye cursor has moved off the bottom of the playing area.
Doing this cancels the spell, and in the case of the repeat-firing FLAME and ELECTRIC spells, it's the ONLY way to cancel the spell. Jump to EA0D for deactivation.
E9E5 LD A,($EB32) Check FIRE key controls
E9E8 CP $00
E9EA JP Z,$EAA0 If not pressed, jump straight to RET
FIRE control key pressed.
This routine determines what action needs to be taken when FIRE is pressed when the cursor icon/servant is active:
E9ED LD A,($EBCA) This byte's value holds the action to take when a servant/spell icon spell is cast
E9F0 CP $00 For non-cursor spells, this byte is zero
E9F2 JR Z,$E9FF ...so make sure it's not one of these
E9F4 LD C,A Temp store of byte's 'action-value' in C register
E9F5 AND $80 Check bit 7, which is set for missile type spells (MISSILE, FIREBALL etc.)
E9F7 JR Z,$E9FF
E9F9 LD A,C If it's set, retrieve the original byte...
E9FA AND $7F Filter out bit 7
E9FC LD ($EC98),A ...and store the remaining value
E9FF LD A,($EBC7) Check the spell type
EA02 CP $03 3 = ELECTRIC and FLAME spells
EA04 JR NZ,$EA0D
For the FLAME and ELECTRIC spells, the aiming cursor remains on screen after firing. So the energy cost of the spell is deducted from Maroc's energy bar each time a bolt is fired, rather than just at the point of casting.
EA06 LD A,($EBC6) First get the energy cost of the spell...
EA09 CALL $E3CC ...and reduce Maroc's energy accordingly.
EA0C RET ...In this case, there's no more action to be taken re: the spell aiming cursor icon
For other spells, cancel the spell and get rid of the controllable sprite (flashing eye cursor, or servant):
EA0D LD A,$00 Set draw/erase flag to ERASE
EA0F LD ($EACF),A
EA12 LD ($EAEC),A Also reset the temp store scroll spell number pointer (I think)
EA15 LD HL,($EC94) Retrieve the graphic address pointer to the servant/cursor icon graphic
EA18 CALL $DB98 ...and erase the graphic from screen.
EA1B JR $EA72 Jump to the routine that resets the flashing attributes indicating an active spell, at the top right of the scroll
Prev: E987 Up: Map Next: EA1D