Prev: 52496 Up: Map Next: 52638
52568: Update Ending Ghost
The routine for objects of type 144 to 151, 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 52568 LD A,(IX+0) Flip the sprite of the ghost to its other frame.
52571 XOR 1
52573 LD (IX+0),A
52576 LD A,(IX-16) Return if the object before this one is a ghost that is still there.
52579 SUB 144
52581 CP 8
52583 RET C
52584 CALL PlayEndingGhostSound Play a tone that falls in pitch each time.
52587 LD A,(48424) Work out how far the ghost is from the middle of the large piece of the title graphic (plus 4), limited to four pixels.
52590 ADD A,4
52592 CALL LimitDistance
52595 AND A Jump to UpdateEndingGhost_Drop if the ghost has arrived.
52596 JR Z,UpdateEndingGhost_Drop
52598 ADD A,(IX+10) Move the ghost sideways by that amount.
52601 LD (IX+10),A
Draw the ghost.
UpdateEndingGhost_Draw 52604 LD A,(IX+0) Set the colour of the ghost from its sprite (bright red, magenta, green or cyan).
52607 RRCA
52608 AND 3
52610 ADD A,66
52612 LD (48128),A
52615 JP UpdateLogoPiece_Draw Draw the ghost.
Drop the ghost down the screen.
UpdateEndingGhost_Drop 52618 LD A,(IX+11) Move the ghost down the screen by four pixels, and jump to UpdateEndingGhost_Draw to draw it unless it has reached the bottom.
52621 SUB 4
52623 LD (IX+11),A
52626 CP 48
52628 JR NC,UpdateEndingGhost_Draw
52630 XOR A Stop the falling tone and remove the ghost.
52631 LD (48121),A
52634 LD (IX+0),A
52637 RET
Prev: 52496 Up: Map Next: 52638