Prev: E699 Up: Map Next: E753
E6FA: Draw active spell charges and icon on scroll
Used by the routine at E641.
When fire is pressed in a scroll list, the spell is initiated, and the spell text description displayed on the scroll.
The user has to re-confirm the selection by pressing fire again, which activates the spell.
E6FA LD A,$00 Reset the fire control value (back to 0)
E6FC LD ($EB32),A
E6FF CALL $DEF9 Clear the scroll area
Copy the currently selected spell data (16 bytes) from 6DFC into a data store at EBC5.
E702 LD HL,($EAE7) Address pointer for selected spell at 6DFC
E705 LD DE,$EBC5 Data store/buffer for selected spell
E708 LD BC,$0010
E70B LDIR Copy the 16 bytes over
Print the spell name at the top (first line) of the scroll:
E70D LD HL,$EBCD Address pointer to the current selected spell name
E710 LD ($EAA1),HL Store text address pointer for printing the spell name
E713 LD HL,$5048 Set the screen display address to the top left of the scroll
E716 LD ($EAA4),HL ...and store.
E719 LD A,$08 Each spell name is 8 characters long (includes spaces for padding if name is shorter)
E71B LD ($EAA3),A
E71E CALL $E2E0 Print the spell name text on the scroll
Set display address and point at the spell icon graphics. Determine how many spell 'charges' are left.
E721 LD A,$83 Offset for graphics address table at 97C3. Graphics pointer to spell icon graphics at AEE7.
E723 CALL $E0C2 Setup graphics data, DE register pair now points to start of spell icon graphic
E726 LD HL,$5050 Set position for spell icon at top of scroll
E729 LD A,($EBC8) Counter for number of spell 'charges'
E72C CP $04 If the spell has 4 or more charges...
E72E JR C,$E732
E730 LD A,$03 ...Set the number to 3, as a maximum of 3 icons are printed on the scroll
Print the spell charge icons at the top of the scroll:
spell counter icon
Up to 3 icons are drawn. If the player has 4 or more 'charges' for a spell, three icons are displayed.
E732 LD ($EAC7),A Store the counter for the spell charge icons (up to 3)
E735 INC L Move right one character square
E736 LD ($EAA4),HL Store the screen display address pointer
E739 EX DE,HL Switch into DE register
E73A CALL $DD24 Draw the spell charge icon at the top of the scroll
E73D LD HL,($EAA4)
E740 INC L Move right one character square
E741 LD A,($EAC7) Retrieve and decrement the spell charge counter
E744 DEC A
E745 JR NZ,$E732 Has it reached zero? If not, go back and draw the next icon
This routine draws the appropriate flashing icon for the selected spell in the top right of the scroll:
spell icon
E747 LD A,($EBCB) Graphics pointer offset for the icon graphic to use for this spell (icons at A17E)
E74A CALL $E0C2 Setup graphics ready to draw
E74D LD DE,$5057 Set screen display address position to draw icon (top right of scroll)
E750 CALL $DD24 Draw the spell icon
Prev: E699 Up: Map Next: E753