Prev: B6CE Up: Map Next: B6FB
B6D4: Play Footsteps Sound Every Frame
Used by the routine at HandleTurningLegs.
Plays the footsteps of the player walking, on every frame of the walking animation. The pitch starts as 60. When bit 1 of A is set it is made from the height of the object instead. The number of beeps depends on the position of the object on the screen.
Input
IX The address of the object
Start with a fixed pitch.
PlayFootstepsSound_EveryFrame B6D4 LD B,$60 Set the pitch to 60.
B6D6 LD A,($5B02) Fetch FrameCounter.
This entry point is used by the routine at PlayMouseSound.
Use the height when bit 1 is set.
PlayFootstepsSound_EveryFrame_TestPitch B6D9 BIT 1,A Jump to PlayFootstepsSound_EveryFrame_CountBeeps if bit 1 of the value is clear.
B6DB JR Z,PlayFootstepsSound_EveryFrame_CountBeeps
B6DD LD A,(IX+$03) Fetch the height of the object.
B6E0 ADD A,$40 Add 40.
B6E2 CPL Invert it.
B6E3 SRL A Halve it.
B6E5 LD B,A Use it as the pitch.
Make the beep count from the on-screen position.
PlayFootstepsSound_EveryFrame_CountBeeps B6E6 LD A,(IX+$01) Fetch the x position of the object.
B6E9 SRL A Halve it.
B6EB LD C,A Keep it in C.
B6EC LD A,(IX+$02) Fetch the y position of the object.
B6EF NEG Make it negative.
B6F1 SRL A Halve it.
B6F3 ADD A,C Add the halved x position.
B6F4 RRCA Move the upper four bits to the lowest four.
B6F5 RRCA
B6F6 RRCA
B6F7 RRCA
B6F8 AND %00001111 Keep only bits 0 to 3.
B6FA LD C,A Keep the number of beeps in C.
Continue on to PlayWaveSequence.
Prev: B6CE Up: Map Next: B6FB