Prev: 59783 Up: Map Next: 59933
59869: 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.
59869 LD A,(60117) Flag indicating whether (any part of) graphic is visible on screen
59872 CP 0 0 = not visible, 1 = visible
59874 JP Z,59917 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 59917 for deactivation.
59877 LD A,(60210) Check FIRE key controls
59880 CP 0
59882 JP Z,60064 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:
59885 LD A,(60362) This byte's value holds the action to take when a servant/spell icon spell is cast
59888 CP 0 For non-cursor spells, this byte is zero
59890 JR Z,59903 ...so make sure it's not one of these
59892 LD C,A Temp store of byte's 'action-value' in C register
59893 AND 128 Check bit 7, which is set for missile type spells (MISSILE, FIREBALL etc.)
59895 JR Z,59903
59897 LD A,C If it's set, retrieve the original byte...
59898 AND 127 Filter out bit 7
59900 LD (60568),A ...and store the remaining value
59903 LD A,(60359) Check the spell type
59906 CP 3 3 = ELECTRIC and FLAME spells
59908 JR NZ,59917
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.
59910 LD A,(60358) First get the energy cost of the spell...
59913 CALL 58316 ...and reduce Maroc's energy accordingly.
59916 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):
59917 LD A,0 Set draw/erase flag to ERASE
59919 LD (60111),A
59922 LD (60140),A Also reset the temp store scroll spell number pointer (I think)
59925 LD HL,(60564) Retrieve the graphic address pointer to the servant/cursor icon graphic
59928 CALL 56216 ...and erase the graphic from screen.
59931 JR 60018 Jump to the routine that resets the flashing attributes indicating an active spell, at the top right of the scroll
Prev: 59783 Up: Map Next: 59933