Prev: 50164 Up: Map Next: 50229
50176: Play Movement Sound
Used by the routine at SpeedPlayerUp.
Plays a short tick, which is alternately high and low, once every few frames. The ticks are made twice as often when the object is moving quickly.
The sounds played by this routine are:
Speed Sound
Movement Sound
Input
IX Object
Count a step and choose the rate from the speed.
PlayMovementSound 50176 LD HL,48120 Point HL at the sound counter.
50179 INC (HL) Add one to the counter.
50180 LD A,(IX+5) Fetch the speed of the object.
50183 CP 12 Jump to PlayMovementSound_Fast if the object is moving quickly.
50185 JR NC,PlayMovementSound_Fast
Jump to PlayMovementSound_Low to make the low tick unless bit 2 of the step counter is set.
50187 LD A,(HL) Fetch the counter.
50188 BIT 2,A Jump to PlayMovementSound_Low unless bit 2 of the counter is set.
50190 JR Z,PlayMovementSound_Low
50192 AND %00000011 Keep the lowest two bits.
50194 RET NZ Return unless they are clear.
50195 LD BC,16388 Choose the high tone.
50198 JR PlayTone Play it.
Play the low tone of a slow movement.
PlayMovementSound_Low 50200 AND %00000011 Keep the lowest two bits.
50202 RET NZ Return unless they are clear.
50203 LD BC,24580 Choose the low tone.
50206 JR PlayTone Play it.
Play a tone every other frame when the object is going fast.
PlayMovementSound_Fast 50208 LD A,(HL) Fetch the counter.
50209 BIT 1,A Jump to PlayMovementSound_FastLow unless bit 1 of the counter is set.
50211 JR Z,PlayMovementSound_FastLow
50213 AND %00000001 Keep the lowest bit.
50215 RET NZ Return unless it is clear.
50216 LD BC,16388 Choose the high tone.
50219 JR PlayTone Play it.
Play the low tone of a fast movement.
PlayMovementSound_FastLow 50221 AND %00000001 Keep the lowest bit.
50223 RET NZ Return unless it is clear.
50224 LD BC,24580 Choose the low tone.
50227 JR PlayTone Play it.
View the equivalent code in;
Prev: 50164 Up: Map Next: 50229