![]() |
Routines |
| Prev: AED3 | Up: Map | Next: AF22 |
|
Used by the routine at MovePlayerForward.
Plays a tone every few frames while a figure is moving, and alternates between a high and a low tone. A figure which is going slowly makes the sound every fourth frame, and a figure which is going fast every other frame.
The sounds played by this routine are:
|
||||||||||||||
| PlayMovementSound | AEED | LD HL,$A207 | Point HL at the sound counter. | |||||||||||
| AEF0 | INC (HL) | Add one to the counter. | ||||||||||||
| AEF1 | LD A,(IX+$05) | Fetch the speed of the object. | ||||||||||||
| AEF4 | CP $0C | Jump to PlayMovementSound_Fast if the speed is 0C or more. | ||||||||||||
| AEF6 | JR NC,PlayMovementSound_Fast | |||||||||||||
| AEF8 | LD A,(HL) | Fetch the counter. | ||||||||||||
| AEF9 | BIT 2,A | Jump to PlayMovementSound_Low unless bit 2 of the counter is set. | ||||||||||||
| AEFB | JR Z,PlayMovementSound_Low | |||||||||||||
| AEFD | AND %00000011 | Return unless this is every fourth frame. | ||||||||||||
| AEFF | RET NZ | |||||||||||||
| AF00 | LD BC,$4004 | Choose the high tone. | ||||||||||||
| AF03 | JR PlayWaveSequence | Play it. | ||||||||||||
|
Play the low tone of a slow movement.
|
||||||||||||||
| PlayMovementSound_Low | AF05 | AND %00000011 | Return unless this is every fourth frame. | |||||||||||
| AF07 | RET NZ | |||||||||||||
| AF08 | LD BC,$6004 | Choose the low tone. | ||||||||||||
| AF0B | JR PlayWaveSequence | Play it. | ||||||||||||
|
Play a tone every other frame when the object is going fast.
|
||||||||||||||
| PlayMovementSound_Fast | AF0D | LD A,(HL) | Fetch the counter. | |||||||||||
| AF0E | BIT 1,A | Jump to PlayMovementSound_FastLow unless bit 1 of the counter is set. | ||||||||||||
| AF10 | JR Z,PlayMovementSound_FastLow | |||||||||||||
| AF12 | AND %00000001 | Return unless this is every other frame. | ||||||||||||
| AF14 | RET NZ | |||||||||||||
| AF15 | LD BC,$4004 | Choose the high tone. | ||||||||||||
| AF18 | JR PlayWaveSequence | Play it. | ||||||||||||
|
Play the low tone of a fast movement.
|
||||||||||||||
| PlayMovementSound_FastLow | AF1A | AND %00000001 | Return unless this is every other frame. | |||||||||||
| AF1C | RET NZ | |||||||||||||
| AF1D | LD BC,$6004 | Choose the low tone. | ||||||||||||
| AF20 | JR PlayWaveSequence | Play it. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: AED3 | Up: Map | Next: AF22 |