![]() |
Routines |
| Prev: D5E4 | Up: Map | Next: D60D |
|
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 02 and 03 are never used.
|
||||||||
|
Return if no notes are left.
|
||||||||
| PlaySoundEffect | D5F2 | LD HL,$A749 | Take the number of notes left, SoundEffectCounter. | |||||
| D5F5 | LD A,(HL) | Fetch it. | ||||||
| D5F6 | AND A | Return if there are none. | ||||||
| D5F7 | RET Z | |||||||
| D5F8 | DEC (HL) | Take one off. | ||||||
|
Play the next note of the sequence.
|
||||||||
| D5F9 | EX AF,AF' | Keep the number of notes that were left in AF'. | ||||||
| D5FA | INC HL | Move on to the type of the effect. | ||||||
| D5FB | LD A,(HL) | Fetch it. | ||||||
| D5FC | LD BC,$D60D | Take the table of sequences, SoundEffectSequences. | ||||||
| D5FF | CALL GetTableEntry | Call GetTableEntry to fetch the address of the sequence into HL. | ||||||
| D602 | EX AF,AF' | Get the number of notes that were left. | ||||||
| D603 | LD C,A | Put it in C. | ||||||
| D604 | LD B,$00 | Clear B. | ||||||
| D606 | ADD HL,BC | Add it to the sequence, to point at the note. | ||||||
| D607 | LD B,(HL) | Fetch the pitch. | ||||||
| D608 | LD C,$0C | Set the length of the tone. | ||||||
| D60A | JP PlayWaveSequence | Jump to PlayWaveSequence to make the tone. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: D5E4 | Up: Map | Next: D60D |