![]() |
Routines |
| Prev: 52515 | Up: Map | Next: 52620 |
|
Used by the routine at HandleTumbleweed.
Checks the walls for each speed on its own, so that the object slides along a wall instead of stopping. For each speed it sets the heading to the direction of that speed, and checks the walls with the other speed set to zero.
|
||||||||
|
Check the walls for the horizontal speed.
|
||||||||
| CheckWallsEachWay | 52544 | LD A,(41492) | Fetch HorizontalSpeed. | |||||
| 52547 | AND A | Jump to CheckWallsEachWay_Vertical if it is zero. | ||||||
| 52548 | JR Z,CheckWallsEachWay_Vertical | |||||||
| 52550 | LD A,64 | Use heading one. | ||||||
| 52552 | JP P,CheckWallsEachWay_SetHorizontal | Jump to CheckWallsEachWay_SetHorizontal if the speed is not negative. | ||||||
| 52555 | OR %10000000 | Use heading three. | ||||||
|
Set the heading, zero VerticalSpeed, and check the walls.
|
||||||||
| CheckWallsEachWay_SetHorizontal | 52557 | LD C,A | Keep the heading in C. | |||||
| 52558 | LD A,(IX+6) | Fetch the heading and flags. | ||||||
| 52561 | AND %00111111 | Keep the other bits. | ||||||
| 52563 | OR C | Put in the new heading. | ||||||
| 52564 | LD (IX+6),A | Set the heading and flags. | ||||||
| 52567 | LD A,(41493) | Fetch VerticalSpeed. | ||||||
| 52570 | PUSH AF | Stash the vertical speed on the stack. | ||||||
| 52571 | XOR A | Set VerticalSpeed to 0. | ||||||
| 52572 | LD (41493),A | |||||||
| 52575 | CALL TestMove | Call TestMove. | ||||||
| 52578 | POP AF | Restore the vertical speed from the stack. | ||||||
| 52579 | LD (41493),A | Set VerticalSpeed. | ||||||
|
Check the walls for the vertical speed.
|
||||||||
| CheckWallsEachWay_Vertical | 52582 | LD A,(41493) | Fetch VerticalSpeed. | |||||
| 52585 | AND A | Return if it is zero. | ||||||
| 52586 | RET Z | |||||||
| 52587 | LD A,0 | Use heading zero. | ||||||
| 52589 | JP P,CheckWallsEachWay_SetVertical | Jump to CheckWallsEachWay_SetVertical if the speed is not negative. | ||||||
| 52592 | OR %10000000 | Use heading two. | ||||||
|
Set the heading, zero HorizontalSpeed, and check the walls.
|
||||||||
| CheckWallsEachWay_SetVertical | 52594 | LD C,A | Keep the heading in C. | |||||
| 52595 | LD A,(IX+6) | Fetch the heading and flags. | ||||||
| 52598 | AND %00111111 | Keep the other bits. | ||||||
| 52600 | OR C | Put in the new heading. | ||||||
| 52601 | LD (IX+6),A | Set the heading and flags. | ||||||
| 52604 | LD A,(41492) | Fetch HorizontalSpeed. | ||||||
| 52607 | PUSH AF | Stash the horizontal speed on the stack. | ||||||
| 52608 | XOR A | Set HorizontalSpeed to 0. | ||||||
| 52609 | LD (41492),A | |||||||
| 52612 | CALL CheckWalls | Call CheckWalls. | ||||||
| 52615 | POP AF | Restore the horizontal speed from the stack. | ||||||
| 52616 | LD (41492),A | Set HorizontalSpeed. | ||||||
| 52619 | RET | Return. | ||||||
| Prev: 52515 | Up: Map | Next: 52620 |