Prev: 54756 Up: Map Next: 54797
54770: Play Sound Effect
Used by the routine at RunGame.
Plays one note of the sound effect that is in progress, which is called once each frame. SoundEffectCounter is the number of notes left, and SoundEffectType picks the sequence of pitches from the table at SoundEffectSequences. The notes are played from the last of the sequence to the first. There is only a sound effect for entering a room, with a sequence of four notes, and one for the player picking up or dropping an object, with five. The sequences that the table has for the numbers 2 and 3 are never used.
Return if no notes are left.
PlaySoundEffect 54770 LD HL,42825 Take the number of notes left, SoundEffectCounter.
54773 LD A,(HL) Fetch it.
54774 AND A Return if there are none.
54775 RET Z
54776 DEC (HL) Take one off.
Play the next note of the sequence.
54777 EX AF,AF' Keep the number of notes that were left in AF'.
54778 INC HL Move on to the type of the effect.
54779 LD A,(HL) Fetch it.
54780 LD BC,54797 Take the table of sequences, SoundEffectSequences.
54783 CALL GetTableEntry Call GetTableEntry to fetch the address of the sequence into HL.
54786 EX AF,AF' Get the number of notes that were left.
54787 LD C,A Put it in C.
54788 LD B,0 Clear B.
54790 ADD HL,BC Add it to the sequence, to point at the note.
54791 LD B,(HL) Fetch the pitch.
54792 LD C,12 Set the length of the tone.
54794 JP PlayWaveSequence Jump to PlayWaveSequence to make the tone.
View the equivalent code in;
New Room Sound
Item Sound
Prev: 54756 Up: Map Next: 54797