Prev: 46798 Up: Map Next: 46843
46804: 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 96. 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 46804 LD B,96 Set the pitch to 96.
46806 LD A,(23298) Fetch FrameCounter.
This entry point is used by the routine at PlayMouseSound.
Use the height when bit 1 is set.
PlayFootstepsSound_EveryFrame_TestPitch 46809 BIT 1,A Jump to PlayFootstepsSound_EveryFrame_CountBeeps if bit 1 of the value is clear.
46811 JR Z,PlayFootstepsSound_EveryFrame_CountBeeps
46813 LD A,(IX+3) Fetch the height of the object.
46816 ADD A,64 Add 64.
46818 CPL Invert it.
46819 SRL A Halve it.
46821 LD B,A Use it as the pitch.
Make the beep count from the on-screen position.
PlayFootstepsSound_EveryFrame_CountBeeps 46822 LD A,(IX+1) Fetch the x position of the object.
46825 SRL A Halve it.
46827 LD C,A Keep it in C.
46828 LD A,(IX+2) Fetch the y position of the object.
46831 NEG Make it negative.
46833 SRL A Halve it.
46835 ADD A,C Add the halved x position.
46836 RRCA Move the upper four bits to the lowest four.
46837 RRCA
46838 RRCA
46839 RRCA
46840 AND %00001111 Keep only bits 0 to 3.
46842 LD C,A Keep the number of beeps in C.
Continue on to PlayWaveSequence.
Prev: 46798 Up: Map Next: 46843