Prev: 59033 Up: Map Next: 59219
59130: Draw active spell charges and icon on scroll
Used by the routine at 58945.
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.
59130 LD A,0 Reset the fire control value (back to 0)
59132 LD (60210),A
59135 CALL 57081 Clear the scroll area
Copy the currently selected spell data (16 bytes) from 28156 into a data store at 60357.
59138 LD HL,(60135) Address pointer for selected spell at 28156
59141 LD DE,60357 Data store/buffer for selected spell
59144 LD BC,16
59147 LDIR Copy the 16 bytes over
Print the spell name at the top (first line) of the scroll:
59149 LD HL,60365 Address pointer to the current selected spell name
59152 LD (60065),HL Store text address pointer for printing the spell name
59155 LD HL,20552 Set the screen display address to the top left of the scroll
59158 LD (60068),HL ...and store.
59161 LD A,8 Each spell name is 8 characters long (includes spaces for padding if name is shorter)
59163 LD (60067),A
59166 CALL 58080 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.
59169 LD A,131 Offset for graphics address table at 38851. Graphics pointer to spell icon graphics at 44775.
59171 CALL 57538 Setup graphics data, DE register pair now points to start of spell icon graphic
59174 LD HL,20560 Set position for spell icon at top of scroll
59177 LD A,(60360) Counter for number of spell 'charges'
59180 CP 4 If the spell has 4 or more charges...
59182 JR C,59186
59184 LD A,3 ...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.
59186 LD (60103),A Store the counter for the spell charge icons (up to 3)
59189 INC L Move right one character square
59190 LD (60068),HL Store the screen display address pointer
59193 EX DE,HL Switch into DE register
59194 CALL 56612 Draw the spell charge icon at the top of the scroll
59197 LD HL,(60068)
59200 INC L Move right one character square
59201 LD A,(60103) Retrieve and decrement the spell charge counter
59204 DEC A
59205 JR NZ,59186 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
59207 LD A,(60363) Graphics pointer offset for the icon graphic to use for this spell (icons at 41342)
59210 CALL 57538 Setup graphics ready to draw
59213 LD DE,20567 Set screen display address position to draw icon (top right of scroll)
59216 CALL 56612 Draw the spell icon
Prev: 59033 Up: Map Next: 59219