Prev: CD02 Up: Map Next: CD58
CD10: The ending: the front of the pit (graphic 152), and the end of the ending
The update routine for graphic 152 (UPDATES), in the ending's last record. While the record before it -- the last villain's -- is in use, the picture is drawn in white; when that empties, the last villain has sunk out of sight, and the tune for the end plays (TUNE_ENDING) and it is back to the menu by way of NEW_GAME.
ENDING_PICTURE is the update routine for graphics 153-157, the back of the pit, drawn in white every turn. DRAW_ENDING_PICTURE draws any of the ending's pictures: the screen position from the step bytes, the sprite (DRAW_SPRITE), and a rectangle of attributes over it in the colour in ENDING_COLOUR (FILL_ATTR_RECT).
Input
IX the record (the tenth)
ENDING_PIT_FRONT CD10 LD A,(IX-$10) the last villain gone: the end
CD13 AND A
CD14 JR Z,ENDING_OVER
ENDING_PICTURE CD16 LD A,$47 white
CD18 LD (ENDING_COLOUR),A
This entry point is used by the routine at ENDING_VILLAIN.
DRAW_ENDING_PICTURE CD1B LD A,(IX+$0A) where to draw it: the step bytes, which hold its place in the ending
CD1E LD (IX+$0E),A
CD21 LD A,(IX+$0B)
CD24 LD (IX+$0F),A
CD27 CALL DRAW_SPRITE_AT draw it
CD2A LD L,(IX+$0E) HL = its place in the attribute buffer (ATTR_ADDRESS)
CD2D LD H,(IX+$0F)
CD30 CALL ATTR_ADDRESS
CD33 LD A,(SPRITE_ROWS) C = the character rows it covers, from its height and y
CD36 LD C,A
CD37 LD A,(IX+$0B)
CD3A AND $07
CD3C ADD A,C
CD3D ADD A,$05
CD3F RRCA
CD40 RRCA
CD41 RRCA
CD42 AND $1F
CD44 LD C,A
CD45 LD A,(SPRITE_WIDTH) B = its width; colour them
CD48 LD B,A
CD49 LD A,(ENDING_COLOUR)
CD4C JP FILL_ATTR_RECT
ENDING_OVER CD4F LD DE,TUNE_ENDING the tune for the end, and the menu
CD52 CALL PLAY_TUNE
CD55 JP NEW_GAME
Prev: CD02 Up: Map Next: CD58