Prev: 48957 Up: Map Next: 49005
48971: Play Footstep Sound
Used by the routines at PlayerMovement and GamePlay_Start.
Makes the sound of a footstep when a player has moved. The footstep counter at FootstepCounter is incremented and a short tone is played whenever the low three bits are zero, which alternates between two pitches (using bit 3). A cyan player (the effect of a cyan orchid) is quicker, so the counter is incremented twice.
Input
IX Actor record
PlayFootstepSound 48971 CALL PlayFootstepSound_Step Make the footstep sound.
48974 LD A,(IX+5) Fetch the colour of the player.
48977 CP 69 Return unless the player is cyan (INK:CYAN, PAPER:BLACK (BRIGHT)), who makes the footstep sound a second time.
48979 RET NZ
Increment the counter and make the sound if it is time for one.
PlayFootstepSound_Step 48980 LD HL,38579 Point HL at the footstep counter at FootstepCounter.
48983 INC (HL) Increase the footstep counter by one.
48984 LD A,(HL) Fetch the footstep counter.
48985 BIT 3,A Jump to PlayFootstepSound_Low if bit 3 of the counter is zero.
48987 JR Z,PlayFootstepSound_Low
48989 AND %00000111 Keep only bits 0-2.
48991 RET NZ Return unless the footstep counter is a multiple of eight.
48992 LD BC,16388 Set the half-period in B to 64 and the number of cycles in C to 4.
48995 JR PlayWaveSequence Jump to PlayWaveSequence to play the sound.
PlayFootstepSound_Low 48997 AND %00000111 Keep only bits 0-2.
48999 RET NZ Return unless the footstep counter is a multiple of eight.
49000 LD BC,24580 Set the half-period in B to 96 and the number of cycles in C to 4.
49003 JR PlayWaveSequence Jump to PlayWaveSequence to play the sound.
Prev: 48957 Up: Map Next: 49005