![]() |
Routines |
| Prev: 52201 | Up: Map | Next: 52381 |
|
Used by the routine at BlockMovement.
Brings the speed in 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 triggered (bit 3 of its flags in byte 13) as something is standing on it. An object that can be moved takes on the speeds in X and Y of the object that it stands on, if it has none of its own.
|
||||||||||||||||||
|
Test each object, then slow the Z speed if they overlap.
|
||||||||||||||||||
| BlockMovementInZ | 52280 | LD IY,23560 | Point IY at the first object in the table, ObjectsTable. | |||||||||||||||
| 52284 | LD B,40 | Set the number of objects to 40. | ||||||||||||||||
| BlockMovementInZ_Next | 52286 | CALL TestObjectSolid | Test whether the object is present and not ignored. | |||||||||||||||
| 52289 | JR Z,BlockMovementInZ_Advance | Jump to BlockMovementInZ_Advance if it is not. | ||||||||||||||||
| 52291 | CALL TestOverlapInX | Test whether the objects overlap in X. | ||||||||||||||||
| 52294 | JR NC,BlockMovementInZ_Advance | Jump to BlockMovementInZ_Advance if they do not. | ||||||||||||||||
| 52296 | CALL TestOverlapInY | Test whether the objects overlap in Y. | ||||||||||||||||
| 52299 | JR NC,BlockMovementInZ_Advance | Jump to BlockMovementInZ_Advance if they do not. | ||||||||||||||||
| BlockMovementInZ_Test | 52301 | CALL TestOverlapInZ | Test whether the objects overlap in Z after the move. | |||||||||||||||
| 52304 | JR NC,BlockMovementInZ_Advance | Jump to BlockMovementInZ_Advance if they do not. | ||||||||||||||||
| 52306 | SET 2,(IX+12) | Flag the object as blocked in Z. | ||||||||||||||||
| 52310 | LD A,(IX+13) | Fetch the flags of the object and move the bit that it destroys what it hits into bit 6. | ||||||||||||||||
| 52313 | RRCA | |||||||||||||||||
| 52314 | AND %01000000 | Keep the bit that flags the other object as destroyed. | ||||||||||||||||
| 52316 | OR (IY+13) | Set it in the flags of the other object, if the object destroys what it runs into. | ||||||||||||||||
| 52319 | LD (IY+13),A | |||||||||||||||||
| 52322 | RLCA | Move the bit that the other object destroys what it hits into bit 6. | ||||||||||||||||
| 52323 | AND %01000000 | Keep the bit that flags the object as destroyed. | ||||||||||||||||
| 52325 | OR (IX+13) | Set it in the flags of the object, if the other object destroys what runs into it. | ||||||||||||||||
| 52328 | LD (IX+13),A | |||||||||||||||||
| 52331 | SET 3,(IY+13) | Flag the other object as triggered. | ||||||||||||||||
| 52335 | BIT 2,(IX+7) | Jump to BlockMovementInZ_Slow if the object cannot be moved. | ||||||||||||||||
| 52339 | JR Z,BlockMovementInZ_Slow | |||||||||||||||||
| 52341 | LD A,(IX+9) | Fetch the speed in X of the object and test it. | ||||||||||||||||
| 52344 | AND A | |||||||||||||||||
| 52345 | JR NZ,BlockMovementInZ_Y | Jump to BlockMovementInZ_Y if it has one. | ||||||||||||||||
| 52347 | LD A,(IY+9) | Take the speed in X of the other object. | ||||||||||||||||
| 52350 | LD (IX+9),A | |||||||||||||||||
| BlockMovementInZ_Y | 52353 | LD A,(IX+10) | Fetch the speed in Y of the object and test it. | |||||||||||||||
| 52356 | AND A | |||||||||||||||||
| 52357 | JR NZ,BlockMovementInZ_Slow | Jump to BlockMovementInZ_Slow if it has one. | ||||||||||||||||
| 52359 | LD A,(IY+10) | Take the speed in Y of the other object. | ||||||||||||||||
| 52362 | LD (IX+10),A | |||||||||||||||||
| BlockMovementInZ_Slow | 52365 | LD A,H | Fetch the speed in Z. | |||||||||||||||
| 52366 | CALL BringSpeedCloserToZero | Bring it closer to zero. | ||||||||||||||||
| 52369 | LD H,A | Store it. | ||||||||||||||||
| 52370 | RET Z | Return if it is zero. | ||||||||||||||||
| 52371 | JR BlockMovementInZ_Test | Jump to BlockMovementInZ_Test to test it again. | ||||||||||||||||
| BlockMovementInZ_Advance | 52373 | LD DE,32 | Set DE to the size of an object. | |||||||||||||||
| 52376 | ADD IY,DE | Point IY at the next object. | ||||||||||||||||
| 52378 | DJNZ BlockMovementInZ_Next | Jump to BlockMovementInZ_Next until all of the objects have been tested. | ||||||||||||||||
| 52380 | RET | Return. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: 52201 | Up: Map | Next: 52381 |