![]() |
Routines |
| Prev: C4E6 | Up: Map | Next: C5A9 |
|
Used by the routine at BlockMovement.
Brings the speed along z of an object closer to zero until it does not run into any other object. This works in the same way as BlockMovementInX, except that the object that is hit is flagged as touched (bit 3 of its extra flags) if the player is the object that hit it. An object which can be moved gives its speed along z to the other object, and takes on the speeds along x and y of the other object if it has none of its own.
|
||||||||||||||||||
|
Walk the object table.
|
||||||||||||||||||
| BlockMovementInZ | C535 | LD IY,$5B88 | Point IY at PlayerBottomObject. | |||||||||||||||
| C539 | LD B,$38 | Set a counter of 38 objects. | ||||||||||||||||
|
Skip unless the object is solid and already overlaps along x and y.
|
||||||||||||||||||
| BlockMovementInZ_Next | C53B | CALL TestObjectSolid | Jump to BlockMovementInZ_Advance if the object is not present or is ignored. | |||||||||||||||
| C53E | JR Z,BlockMovementInZ_Advance | |||||||||||||||||
| C540 | CALL TestOverlapInX | Jump to BlockMovementInZ_Advance if the objects do not overlap along x. | ||||||||||||||||
| C543 | JR NC,BlockMovementInZ_Advance | |||||||||||||||||
| C545 | CALL TestOverlapInY | Jump to BlockMovementInZ_Advance if the objects do not overlap along y. | ||||||||||||||||
| C548 | JR NC,BlockMovementInZ_Advance | |||||||||||||||||
|
Test whether they overlap along z after the move.
|
||||||||||||||||||
| BlockMovementInZ_Test | C54A | CALL TestOverlapInZ | Jump to BlockMovementInZ_Advance if the objects do not overlap along z after the move. | |||||||||||||||
| C54D | JR NC,BlockMovementInZ_Advance | |||||||||||||||||
|
Flag the object as blocked along z, then apply the kill flags.
|
||||||||||||||||||
| C54F | SET 2,(IX+$0C) | Flag the object as blocked along z. | ||||||||||||||||
| C553 | LD A,(IX+$0D) | Fetch the extra flags and move the bit that it kills what it hits into bit 6. | ||||||||||||||||
| C556 | RRCA | |||||||||||||||||
| C557 | AND %01000000 | Keep the bit that flags the other object as killed. | ||||||||||||||||
| C559 | OR (IY+$0D) | Set it in the extra flags of the other object, if the object kills what it runs into. | ||||||||||||||||
| C55C | LD (IY+$0D),A | |||||||||||||||||
| C55F | RLCA | Move the bit that the other object kills what hits it into bit 6. | ||||||||||||||||
| C560 | AND %01000000 | Keep the bit that flags the object as killed. | ||||||||||||||||
| C562 | OR (IX+$0D) | Set it in the extra flags of the object, if the other object kills what runs into it. | ||||||||||||||||
| C565 | LD (IX+$0D),A | |||||||||||||||||
|
Pass speeds if this object can be moved. Flag the other object as touched if the player is standing on it.
|
||||||||||||||||||
| C568 | BIT 2,(IX+$07) | Jump to BlockMovementInZ_Slow if the object cannot be moved. | ||||||||||||||||
| C56C | JR Z,BlockMovementInZ_Slow | |||||||||||||||||
| C56E | LD A,(IX+$00) | Fetch the sprite number and subtract 10. | ||||||||||||||||
| C571 | SUB $10 | |||||||||||||||||
| C573 | CP $20 | Jump to BlockMovementInZ_Carry if it is not the player. | ||||||||||||||||
| C575 | JR NC,BlockMovementInZ_Carry | |||||||||||||||||
| C577 | SET 3,(IY+$0D) | Flag the other object as touched. | ||||||||||||||||
|
Give the speed along z to the other object, and take its speeds along x and y if this object has none.
|
||||||||||||||||||
| BlockMovementInZ_Carry | C57B | LD A,(IX+$0B) | Give the speed along z to the other object. | |||||||||||||||
| C57E | LD (IY+$0B),A | |||||||||||||||||
| C581 | LD A,(IX+$09) | Fetch the speed along x and test it. | ||||||||||||||||
| C584 | AND A | |||||||||||||||||
| C585 | JR NZ,BlockMovementInZ_Y | Jump to BlockMovementInZ_Y if it has one. | ||||||||||||||||
| C587 | LD A,(IY+$09) | Take the speed along x of the other object. | ||||||||||||||||
| C58A | LD (IX+$09),A | |||||||||||||||||
| BlockMovementInZ_Y | C58D | LD A,(IX+$0A) | Fetch the speed along y and test it. | |||||||||||||||
| C590 | AND A | |||||||||||||||||
| C591 | JR NZ,BlockMovementInZ_Slow | Jump to BlockMovementInZ_Slow if it has one. | ||||||||||||||||
| C593 | LD A,(IY+$0A) | Take the speed along y of the other object. | ||||||||||||||||
| C596 | LD (IX+$0A),A | |||||||||||||||||
|
Slow the move along z and test this object again.
|
||||||||||||||||||
| BlockMovementInZ_Slow | C599 | LD A,H | Fetch the speed along z. | |||||||||||||||
| C59A | CALL BringSpeedCloserToZero | Bring it closer to zero. | ||||||||||||||||
| C59D | LD H,A | Store it. | ||||||||||||||||
| C59E | RET Z | Return if the speed is now zero. | ||||||||||||||||
| C59F | JR BlockMovementInZ_Test | Jump to BlockMovementInZ_Test. | ||||||||||||||||
|
Move on to the next object.
|
||||||||||||||||||
| BlockMovementInZ_Advance | C5A1 | LD DE,$0020 | Point IY at the next object. | |||||||||||||||
| C5A4 | ADD IY,DE | |||||||||||||||||
| C5A6 | DJNZ BlockMovementInZ_Next | Jump to BlockMovementInZ_Next until all of the objects have been tested. | ||||||||||||||||
| C5A8 | RET | Return. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: C4E6 | Up: Map | Next: C5A9 |