![]() |
Routines |
| Prev: 52037 | Up: Map | Next: 52201 |
|
Used by the routine at BlockMovement.
Brings the speed in X of an object closer to zero until it does not run into any other object. If the object does run into another, the objects may destroy each other: bit 7 of the flags in byte 13 of an object means that it destroys whatever it runs into, bit 5 means that it destroys whatever runs into it, and bit 6 means that the object is destroyed. An object that can be moved is pushed along at the same speed in X.
|
||||||||||||||||||
|
Test each object, then slow the X speed if they overlap.
|
||||||||||||||||||
| BlockMovementInX | 52122 | LD IY,23560 | Point IY at the first object in the table, ObjectsTable. | |||||||||||||||
| 52126 | LD B,40 | Set the number of objects to 40. | ||||||||||||||||
| BlockMovementInX_Next | 52128 | CALL TestObjectSolid | Test whether the object is present and not ignored. | |||||||||||||||
| 52131 | JR Z,BlockMovementInX_Advance | Jump to BlockMovementInX_Advance if it is not. | ||||||||||||||||
| 52133 | CALL TestOverlapInY | Test whether the objects overlap in Y. | ||||||||||||||||
| 52136 | JR NC,BlockMovementInX_Advance | Jump to BlockMovementInX_Advance if they do not. | ||||||||||||||||
| 52138 | CALL TestOverlapInZ | Test whether the objects overlap in Z. | ||||||||||||||||
| 52141 | JR NC,BlockMovementInX_Advance | Jump to BlockMovementInX_Advance if they do not. | ||||||||||||||||
| BlockMovementInX_Test | 52143 | CALL TestOverlapInX | Test whether the objects overlap in X after the move. | |||||||||||||||
| 52146 | JR NC,BlockMovementInX_Advance | Jump to BlockMovementInX_Advance if they do not. | ||||||||||||||||
| 52148 | SET 0,(IX+12) | Flag the object as blocked in X. | ||||||||||||||||
| 52152 | LD A,(IX+13) | Fetch the flags of the object and move the bit that it destroys what it hits into bit 6. | ||||||||||||||||
| 52155 | RRCA | |||||||||||||||||
| 52156 | AND %01000000 | Keep the bit that flags the other object as destroyed. | ||||||||||||||||
| 52158 | OR (IY+13) | Set it in the flags of the other object, if the object destroys what it runs into. | ||||||||||||||||
| 52161 | LD (IY+13),A | |||||||||||||||||
| 52164 | RLCA | Move the bit that the other object destroys what it hits into bit 6. | ||||||||||||||||
| 52165 | AND %01000000 | Keep the bit that flags the object as destroyed. | ||||||||||||||||
| 52167 | OR (IX+13) | Set it in the flags of the object, if the other object destroys what runs into it. | ||||||||||||||||
| 52170 | LD (IX+13),A | |||||||||||||||||
| 52173 | BIT 2,(IY+7) | Jump to BlockMovementInX_Slow if the other object cannot be moved. | ||||||||||||||||
| 52177 | JR Z,BlockMovementInX_Slow | |||||||||||||||||
| 52179 | LD A,(IX+9) | Fetch the speed in X of the object. | ||||||||||||||||
| 52182 | LD (IY+9),A | Give it to the other object. | ||||||||||||||||
| BlockMovementInX_Slow | 52185 | LD A,C | Fetch the speed in X. | |||||||||||||||
| 52186 | CALL BringSpeedCloserToZero | Bring it closer to zero. | ||||||||||||||||
| 52189 | LD C,A | Store it. | ||||||||||||||||
| 52190 | RET Z | Return if it is zero. | ||||||||||||||||
| 52191 | JR BlockMovementInX_Test | Jump to BlockMovementInX_Test to test it again. | ||||||||||||||||
| BlockMovementInX_Advance | 52193 | LD DE,32 | Set DE to the size of an object. | |||||||||||||||
| 52196 | ADD IY,DE | Point IY at the next object. | ||||||||||||||||
| 52198 | DJNZ BlockMovementInX_Next | Jump to BlockMovementInX_Next until all of the objects have been tested. | ||||||||||||||||
| 52200 | RET | Return. | ||||||||||||||||
| Prev: 52037 | Up: Map | Next: 52201 |