![]() |
Routines |
| Prev: 46253 | Up: Map | Next: 46310 |
|
Used by the routine at HandleWalking.
Plays the footsteps of the player walking, but only on every other frame of the walking animation. The number of cycles comes from the position of the player on the screen. The entry point at PlayFootstepsSound_EveryFrame plays them on every frame.
|
||||||||
|
Play on even frames of the walking animation.
|
||||||||
| PlayFootstepsSound | 46267 | LD A,(IX+0) | Fetch the graphic number of the object. | |||||
| 46270 | AND %00000001 | Test whether it is an odd frame of the animation. | ||||||
| 46272 | RET NZ | Return if it is. | ||||||
|
This entry point is used by the routine at HandleTurning.
|
||||||||
| PlayFootstepsSound_EveryFrame | 46273 | LD B,96 | Set the pitch. | |||||
| 46275 | LD A,(23458) | Fetch the frame counter from FrameCounter. | ||||||
|
This entry point is used by the routine at PlayGuardFootstepsSound.
One time in two the pitch is made from the height of the object instead.
|
||||||||
| PlayFootstepsSound_Position | 46278 | BIT 1,A | Jump to PlayFootstepsSound_Cycles if a random bit of the seed is not set. | |||||
| 46280 | JR Z,PlayFootstepsSound_Cycles | |||||||
| 46282 | LD A,(IX+3) | Fetch the Z coordinate of the object. | ||||||
| 46285 | CPL | Invert it. | ||||||
| 46286 | SRL A | Halve it. | ||||||
| 46288 | LD B,A | Use it as the pitch. | ||||||
|
The number of cycles is the high nibble of half of the X coordinate added to half of the negated Y coordinate, which is the horizontal position on the screen.
|
||||||||
| PlayFootstepsSound_Cycles | 46289 | LD A,(IX+1) | Fetch the X coordinate of the object. | |||||
| 46292 | SRL A | Halve it. | ||||||
| 46294 | LD C,A | Stash it in C. | ||||||
| 46295 | LD A,(IX+2) | Fetch the Y coordinate of the object. | ||||||
| 46298 | NEG | Negate it. | ||||||
| 46300 | SRL A | Halve it. | ||||||
| 46302 | ADD A,C | Add the halved X coordinate. | ||||||
| 46303 | RRCA | Move the high nibble into the low nibble. | ||||||
| 46304 | RRCA | |||||||
| 46305 | RRCA | |||||||
| 46306 | RRCA | |||||||
| 46307 | AND %00001111 | Keep the low nibble. | ||||||
| 46309 | LD C,A | Use it as the number of cycles. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 46253 | Up: Map | Next: 46310 |