Prev: 49940 Up: Map Next: 49997
49970: Play Ghost Sound
Used by the routine at UpdateGhost.
Plays a sound for a ghost, if the ghost has been drawn in the view.
PlayGhostSound 49970 LD BC,49997 Point at the pitches of the ghost sound.
This entry point is used by the routine at UpdateMonster.
Plays a sound effect, using a pitch from a table, if the object at IX has been drawn in the view. The routine that draws a sprite (see DrawSprite) sets bit 1 of the flags of the object, and this routine clears it.
When it is used for a monster (see UpdateMonster), the pitches come from the ROM instead (see SoundPitchTables).
PlayFlaggedSound 49973 BIT 1,(IX+7) Check whether the object has been drawn in the view.
49977 RES 1,(IX+7) Clear the flag, ready for the next frame.
49981 RET Z Return if the object was not drawn, because it can't be heard.
49982 LD A,(48050) Fetch the low byte of the frame counter.
49985 AND %00001111 Keep only the lowest four bits, to choose one of the sixteen pitches.
49987 LD L,A Add it to the address of the table.
49988 LD H,0
49990 ADD HL,BC
49991 LD B,(HL) Fetch the pitch.
49992 LD C,12 Set the length of the sound.
49994 JP PlayTone Jump to PlayTone to play the tone.
View the equivalent code in;
Prev: 49940 Up: Map Next: 49997