Prev: 54120 Up: Map Next: 54393
54342: Draw Maroc's sprite graphic
Follows previous routine which has calculated Maroc's sprite rotation and 'floating' height at 54120. 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 54320, 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:
54342 LD A,(60097) Get Maroc's vertical pixel position
54345 LD D,A Store in D register
54346 LD A,(60114) Get Maroc's vertical pixel position, with the earlier vertical offset added
54349 CP D Is it the same?
54350 JR Z,54353
54352 INC C If not, increment the (flag) C register
54353 LD A,C Check the (flag) C register
54354 CP 0 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.
54356 JR Z,54369
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.
54358 LD A,0 Set draw/erase flag to 0 (ERASE)
54360 LD (60111),A
54363 LD HL,(60109) Retrieve Maroc sprite's graphic address from the (previous) graphic address buffer
54366 CALL 56216 Erase the graphic
Draw Maroc's sprite graphic
54369 LD A,(60097) Maroc's vertical (Y-axis) screen position
54372 LD (60114),A Copy into graphics buffer
54375 LD A,1 Set draw/erase flag to 1 (DRAW)
54377 LD (60111),A
54380 LD A,(60137) Check if the UNSEEN spell (spell #9) is currently active
54383 CP 9
54385 JR Z,54393 If so, there's no need to draw Maroc's sprite graphic, as he's invisible, so skip the next two instructions
54387 LD HL,(60098) Maroc's sprite graphics frame address pointer (in table at 38851)
54390 CALL 56216 Draw Maroc's sprite
Prev: 54120 Up: Map Next: 54393