Prev: CD10 Up: Map Next: CD9E
CD58: Update Ending Ghost
The routine for objects of type 90 to 97, the ghosts that are shown during the ending. A ghost moves sideways towards the large piece of the title graphic, and then drops down the screen and goes away. It does not start until the ghost before it has gone.
Wait for the previous ghost, then move sideways.
UpdateEndingGhost CD58 LD A,(IX+$00) Flip the sprite of the ghost to its other frame.
CD5B XOR $01
CD5D LD (IX+$00),A
CD60 LD A,(IX-$10) Return if the object before this one is a ghost that is still there.
CD63 SUB $90
CD65 CP $08
CD67 RET C
CD68 CALL PlayEndingGhostSound Play a tone that falls in pitch each time.
CD6B LD A,($BD28) Work out how far the ghost is from the middle of the large piece of the title graphic (plus 04), limited to four pixels.
CD6E ADD A,$04
CD70 CALL LimitDistance
CD73 AND A Jump to UpdateEndingGhost_Drop if the ghost has arrived.
CD74 JR Z,UpdateEndingGhost_Drop
CD76 ADD A,(IX+$0A) Move the ghost sideways by that amount.
CD79 LD (IX+$0A),A
Draw the ghost.
UpdateEndingGhost_Draw CD7C LD A,(IX+$00) Set the colour of the ghost from its sprite (bright red, magenta, green or cyan).
CD7F RRCA
CD80 AND $03
CD82 ADD A,$42
CD84 LD ($BC00),A
CD87 JP UpdateLogoPiece_Draw Draw the ghost.
Drop the ghost down the screen.
UpdateEndingGhost_Drop CD8A LD A,(IX+$0B) Move the ghost down the screen by four pixels, and jump to UpdateEndingGhost_Draw to draw it unless it has reached the bottom.
CD8D SUB $04
CD8F LD (IX+$0B),A
CD92 CP $30
CD94 JR NC,UpdateEndingGhost_Draw
CD96 XOR A Stop the falling tone and remove the ghost.
CD97 LD ($BBF9),A
CD9A LD (IX+$00),A
CD9D RET
Prev: CD10 Up: Map Next: CD9E