![]() |
Routines |
| Prev: CB9A | Up: Map | Next: CC38 |
|
Used by the routine at BlockMovement.
Brings the speed in Y of an object closer to zero until it does not run into any other object. This works in the same way as BlockMovementInX.
|
||||||||||||||||||
|
Test each object, then slow the Y speed if they overlap.
|
||||||||||||||||||
| BlockMovementInY | CBE9 | LD IY,$5C08 | Point IY at the first object in the table, ObjectsTable. | |||||||||||||||
| CBED | LD B,$28 | Set the number of objects to 28. | ||||||||||||||||
| BlockMovementInY_Next | CBEF | CALL TestObjectSolid | Test whether the object is present and not ignored. | |||||||||||||||
| CBF2 | JR Z,BlockMovementInY_Advance | Jump to BlockMovementInY_Advance if it is not. | ||||||||||||||||
| CBF4 | CALL TestOverlapInX | Test whether the objects overlap in X. | ||||||||||||||||
| CBF7 | JR NC,BlockMovementInY_Advance | Jump to BlockMovementInY_Advance if they do not. | ||||||||||||||||
| CBF9 | CALL TestOverlapInZ | Test whether the objects overlap in Z. | ||||||||||||||||
| CBFC | JR NC,BlockMovementInY_Advance | Jump to BlockMovementInY_Advance if they do not. | ||||||||||||||||
| BlockMovementInY_Test | CBFE | CALL TestOverlapInY | Test whether the objects overlap in Y after the move. | |||||||||||||||
| CC01 | JR NC,BlockMovementInY_Advance | Jump to BlockMovementInY_Advance if they do not. | ||||||||||||||||
| CC03 | SET 1,(IX+$0C) | Flag the object as blocked in Y. | ||||||||||||||||
| CC07 | LD A,(IX+$0D) | Fetch the flags of the object and move the bit that it destroys what it hits into bit 6. | ||||||||||||||||
| CC0A | RRCA | |||||||||||||||||
| CC0B | AND %01000000 | Keep the bit that flags the other object as destroyed. | ||||||||||||||||
| CC0D | OR (IY+$0D) | Set it in the flags of the other object, if the object destroys what it runs into. | ||||||||||||||||
| CC10 | LD (IY+$0D),A | |||||||||||||||||
| CC13 | RLCA | Move the bit that the other object destroys what it hits into bit 6. | ||||||||||||||||
| CC14 | AND %01000000 | Keep the bit that flags the object as destroyed. | ||||||||||||||||
| CC16 | OR (IX+$0D) | Set it in the flags of the object, if the other object destroys what runs into it. | ||||||||||||||||
| CC19 | LD (IX+$0D),A | |||||||||||||||||
| CC1C | BIT 2,(IY+$07) | Jump to BlockMovementInY_Slow if the other object cannot be moved. | ||||||||||||||||
| CC20 | JR Z,BlockMovementInY_Slow | |||||||||||||||||
| CC22 | LD A,(IX+$0A) | Fetch the speed in Y of the object. | ||||||||||||||||
| CC25 | LD (IY+$0A),A | Give it to the other object. | ||||||||||||||||
| BlockMovementInY_Slow | CC28 | LD A,L | Fetch the speed in Y. | |||||||||||||||
| CC29 | CALL BringSpeedCloserToZero | Bring it closer to zero. | ||||||||||||||||
| CC2C | LD L,A | Store it. | ||||||||||||||||
| CC2D | RET Z | Return if it is zero. | ||||||||||||||||
| CC2E | JR BlockMovementInY_Test | Jump to BlockMovementInY_Test to test it again. | ||||||||||||||||
| BlockMovementInY_Advance | CC30 | LD DE,$0020 | Set DE to the size of an object. | |||||||||||||||
| CC33 | ADD IY,DE | Point IY at the next object. | ||||||||||||||||
| CC35 | DJNZ BlockMovementInY_Next | Jump to BlockMovementInY_Next until all of the objects have been tested. | ||||||||||||||||
| CC37 | RET | Return. | ||||||||||||||||
| Prev: CB9A | Up: Map | Next: CC38 |