Prev: 54429 Up: Map Next: 54524
54450: Draw Maroc's shadow and flickering barrier for SHIELD, PROTECT and DEFENCE spells
Follows previous section (54429).
Maroc flickering shield effect
  • Although Maroc's vertical position varies depending on his movement speed, his shadow remains at a fixed point on the screen (vertical pixel position 95)
  • When the SHIELD, PROTECT and DEFENCE spells are active, a flickering shield appears around Maroc
Draw Maroc's shadow:
54450 LD HL,(60100) Graphic address pointer for Maroc's shadow (39095)
54453 LD A,95 Vertical screen position - 95 pixels from top of playing area
54455 LD (60114),A
54458 CALL 56216 Draw shadow
Check for spells that generate a flickering effect
54461 LD A,(60137) Check currently active effect spell (a positive match for any of them jumps to 54488)
54464 CP 2 SHIELD spell active
54466 JR Z,54488
54468 CP 11 PROTECT spell active
54470 JR Z,54488
54472 CP 18 DEFENCE spell active
54474 JR Z,54488
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:
  • If the player deactivates any of the above 3 spells, the 'currently active effect spell' byte at 60137 is set to 255
  • This tells this routine to erase any 'barrier' graphics that might be on screen
54476 CP 255
54478 JR NZ,54524 If no 255 match, there's no effect spell graphics to draw/erase. Jump out of this routine to 54524.
SHIELD, PROTECT or DEFENCE have been deactivated, so make sure any on-screen barrier graphics are removed
54480 LD A,0
54482 LD (60137),A Set currently active effect spell to 0 (no spell active)
54485 LD (60111),A Set draw/erase flag to 0 (ERASE)
Draw/erase the flickering barrier graphics
54488 LD A,(60097) Get Maroc's vertical screen position, from top of playing area, in pixels
54491 LD (60114),A ...and copy into working graphic data buffer
54494 LD HL,(60566) Graphics address pointer for shield barrier graphics (39059/43500)
Work out which graphics frame to use for barrier graphic. Uses the game counter at 60074 to alternate frame graphics.
54497 LD A,(60074) Get the game counter byte
54500 AND 1 Check the lowest bit (bit 0) of the game counter (0 = even, 1 = odd)
54502 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.
54503 LD E,A Put offset into DE register pair
54504 LD D,0
54506 ADD HL,DE ...and add to the base graphic pointer address (39059)
54507 LD (60241),HL Store graphics address pointer to the frame that needs drawing
54510 CALL 56216 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.
54513 LD A,0
54515 LD (60111),A Set draw/erase flag to 0 (ERASE)
54518 LD HL,(60241) Retrieve address for barrier graphics frame
54521 CALL 56216 ...And erase the graphic
Prev: 54429 Up: Map Next: 54524