![]() |
Routines |
| Prev: BF3D | Up: Map | Next: BF6D |
|
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.
|
||||||||
| PlayFootstepSound | BF4B | CALL PlayFootstepSound_Step | Make the footstep sound. | |||||
| BF4E | LD A,(IX+$05) | Fetch the colour of the player. | ||||||
| BF51 | CP $45 | Return unless the player is cyan (INK:CYAN, PAPER:BLACK (BRIGHT)), who makes the footstep sound a second time. | ||||||
| BF53 | RET NZ | |||||||
|
Increment the counter and make the sound if it is time for one.
|
||||||||
| PlayFootstepSound_Step | BF54 | LD HL,$96B3 | Point HL at the footstep counter at FootstepCounter. | |||||
| BF57 | INC (HL) | Increase the footstep counter by one. | ||||||
| BF58 | LD A,(HL) | Fetch the footstep counter. | ||||||
| BF59 | BIT 3,A | Jump to PlayFootstepSound_Low if bit 3 of the counter is zero. | ||||||
| BF5B | JR Z,PlayFootstepSound_Low | |||||||
| BF5D | AND %00000111 | Keep only bits 0-2. | ||||||
| BF5F | RET NZ | Return unless the footstep counter is a multiple of eight. | ||||||
| BF60 | LD BC,$4004 | Set the half-period in B to 40 and the number of cycles in C to 04. | ||||||
| BF63 | JR PlayWaveSequence | Jump to PlayWaveSequence to play the sound. | ||||||
| PlayFootstepSound_Low | BF65 | AND %00000111 | Keep only bits 0-2. | |||||
| BF67 | RET NZ | Return unless the footstep counter is a multiple of eight. | ||||||
| BF68 | LD BC,$6004 | Set the half-period in B to 60 and the number of cycles in C to 04. | ||||||
| BF6B | JR PlayWaveSequence | Jump to PlayWaveSequence to play the sound. | ||||||
| Prev: BF3D | Up: Map | Next: BF6D |