Prev: 44755 Up: Map Next: 44834
44781: Play Movement Sound
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:
Speed Sound
Slow Movement Sound
Fast Movement Sound
Input
IX The address of the object
PlayMovementSound 44781 LD HL,41479 Point HL at the sound counter.
44784 INC (HL) Add one to the counter.
44785 LD A,(IX+5) Fetch the speed of the object.
44788 CP 12 Jump to PlayMovementSound_Fast if the speed is 12 or more.
44790 JR NC,PlayMovementSound_Fast
44792 LD A,(HL) Fetch the counter.
44793 BIT 2,A Jump to PlayMovementSound_Low unless bit 2 of the counter is set.
44795 JR Z,PlayMovementSound_Low
44797 AND %00000011 Return unless this is every fourth frame.
44799 RET NZ
44800 LD BC,16388 Choose the high tone.
44803 JR PlayWaveSequence Play it.
Play the low tone of a slow movement.
PlayMovementSound_Low 44805 AND %00000011 Return unless this is every fourth frame.
44807 RET NZ
44808 LD BC,24580 Choose the low tone.
44811 JR PlayWaveSequence Play it.
Play a tone every other frame when the object is going fast.
PlayMovementSound_Fast 44813 LD A,(HL) Fetch the counter.
44814 BIT 1,A Jump to PlayMovementSound_FastLow unless bit 1 of the counter is set.
44816 JR Z,PlayMovementSound_FastLow
44818 AND %00000001 Return unless this is every other frame.
44820 RET NZ
44821 LD BC,16388 Choose the high tone.
44824 JR PlayWaveSequence Play it.
Play the low tone of a fast movement.
PlayMovementSound_FastLow 44826 AND %00000001 Return unless this is every other frame.
44828 RET NZ
44829 LD BC,24580 Choose the low tone.
44832 JR PlayWaveSequence Play it.
View the equivalent code in;
Prev: 44755 Up: Map Next: 44834