Routines |
Prev: D49D | Up: Map | Next: D4FC |
Follows previous section (D49D).
|
||||
Draw Maroc's shadow:
|
||||
D4B2 | LD HL,($EAC4) | Graphic address pointer for Maroc's shadow (98B7) | ||
D4B5 | LD A,$5F | Vertical screen position - 95 pixels from top of playing area | ||
D4B7 | LD ($EAD2),A | |||
D4BA | CALL $DB98 | Draw shadow | ||
Check for spells that generate a flickering effect
|
||||
D4BD | LD A,($EAE9) | Check currently active effect spell (a positive match for any of them jumps to D4D8) | ||
D4C0 | CP $02 | SHIELD spell active | ||
D4C2 | JR Z,$D4D8 | |||
D4C4 | CP $0B | PROTECT spell active | ||
D4C6 | JR Z,$D4D8 | |||
D4C8 | CP $12 | DEFENCE spell active | ||
D4CA | JR Z,$D4D8 | |||
If no matches to the above none of the spells is active. The next check is to see if any of the spells have just been deactivated:
|
||||
D4CC | CP $FF | |||
D4CE | JR NZ,$D4FC | If no 255 match, there's no effect spell graphics to draw/erase. Jump out of this routine to D4FC. | ||
SHIELD, PROTECT or DEFENCE have been deactivated, so make sure any on-screen barrier graphics are removed
|
||||
D4D0 | LD A,$00 | |||
D4D2 | LD ($EAE9),A | Set currently active effect spell to 0 (no spell active) | ||
D4D5 | LD ($EACF),A | Set draw/erase flag to 0 (ERASE) | ||
Draw/erase the flickering barrier graphics
|
||||
D4D8 | LD A,($EAC1) | Get Maroc's vertical screen position, from top of playing area, in pixels | ||
D4DB | LD ($EAD2),A | ...and copy into working graphic data buffer | ||
D4DE | LD HL,($EC96) | Graphics address pointer for shield barrier graphics (9893/A9EC) | ||
Work out which graphics frame to use for barrier graphic. Uses the game counter at EAAA to alternate frame graphics.
|
||||
D4E1 | LD A,($EAAA) | Get the game counter byte | ||
D4E4 | AND $01 | Check the lowest bit (bit 0) of the game counter (0 = even, 1 = odd) | ||
D4E6 | ADD A,A | Multiply by 2 If bit 0 = 0, offset will be 2 x 0 = 0, so frame 1 is used. If bit 0 = 1, offset will be 2 x 1 = 2, so a +2 offset to the graphics address which gives frame 2. |
||
D4E7 | LD E,A | Put offset into DE register pair | ||
D4E8 | LD D,$00 | |||
D4EA | ADD HL,DE | ...and add to the base graphic pointer address (9893) | ||
D4EB | LD ($EB51),HL | Store graphics address pointer to the frame that needs drawing | ||
D4EE | CALL $DB98 | Draw the barrier graphic on screen | ||
The barrier graphic is only drawn briefly - in fact, the very next routine immediately erases it. This is what creates the flicker effect.
|
||||
D4F1 | LD A,$00 | |||
D4F3 | LD ($EACF),A | Set draw/erase flag to 0 (ERASE) | ||
D4F6 | LD HL,($EB51) | Retrieve address for barrier graphics frame | ||
D4F9 | CALL $DB98 | ...And erase the graphic |
Prev: D49D | Up: Map | Next: D4FC |