Prev: D368 Up: Map Next: D479
D446: Draw Maroc's sprite graphic
Follows previous routine which has calculated Maroc's sprite rotation and 'floating' height at D368. If Maroc's sprite has changed (either its height or graphic frame) it's erased before drawing the new one.
Input
C Used as a change flag, initialized at 0 in previous routine at D430, and used to determine if anything has changed with Maroc's sprite (not zero if so).
Check if Maroc's vertical pixel position (height) has changed from the earlier calculation:
D446 LD A,($EAC1) Get Maroc's vertical pixel position
D449 LD D,A Store in D register
D44A LD A,($EAD2) Get Maroc's vertical pixel position, with the earlier vertical offset added
D44D CP D Is it the same?
D44E JR Z,$D451
D450 INC C If not, increment the (flag) C register
D451 LD A,C Check the (flag) C register
D452 CP $00 If it's still zero, there's no change to either (a) Maroc's sprite address offset, or (b) his vertical pixel height offset (based on his movement speed), so skip the next instructions as there's no need to erase the existing sprite.
D454 JR Z,$D461
Either Maroc's height offset (based on his speed) or his sprite graphic frame has changed in one of the earlier calculations, so the old sprite needs erasing.
D456 LD A,$00 Set draw/erase flag to 0 (ERASE)
D458 LD ($EACF),A
D45B LD HL,($EACD) Retrieve Maroc sprite's graphic address from the (previous) graphic address buffer
D45E CALL $DB98 Erase the graphic
Draw Maroc's sprite graphic
D461 LD A,($EAC1) Maroc's vertical (Y-axis) screen position
D464 LD ($EAD2),A Copy into graphics buffer
D467 LD A,$01 Set draw/erase flag to 1 (DRAW)
D469 LD ($EACF),A
D46C LD A,($EAE9) Check if the UNSEEN spell (spell #9) is currently active
D46F CP $09
D471 JR Z,$D479 If so, there's no need to draw Maroc's sprite graphic, as he's invisible, so skip the next two instructions
D473 LD HL,($EAC2) Maroc's sprite graphics frame address pointer (in table at 97C3)
D476 CALL $DB98 Draw Maroc's sprite
Prev: D368 Up: Map Next: D479