![]() |
Routines |
| Prev: 50242 | Up: Map | Next: 50406 |
|
Used by the routine at BlockMovement.
Brings the speed along 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 be killed: bit 7 of the extra flags means that it kills whatever it runs into, and bit 5 means that it kills whatever runs into it. Bit 6 is set to flag an object as killed. An object that is hit and can be moved takes on the speed along x of the object that hit it.
|
||||||||||||||||||
|
Walk the object table.
|
||||||||||||||||||
| BlockMovementInX | 50327 | LD IY,23432 | Point IY at PlayerBottomObject. | |||||||||||||||
| 50331 | LD B,56 | Set a counter of 56 objects. | ||||||||||||||||
|
Skip unless the object is solid and already overlaps along y and z.
|
||||||||||||||||||
| BlockMovementInX_Next | 50333 | CALL TestObjectSolid | Jump to BlockMovementInX_Advance if the object is not present or is ignored. | |||||||||||||||
| 50336 | JR Z,BlockMovementInX_Advance | |||||||||||||||||
| 50338 | CALL TestOverlapInY | Jump to BlockMovementInX_Advance if the objects do not overlap along y. | ||||||||||||||||
| 50341 | JR NC,BlockMovementInX_Advance | |||||||||||||||||
| 50343 | CALL TestOverlapInZ | Jump to BlockMovementInX_Advance if the objects do not overlap along z. | ||||||||||||||||
| 50346 | JR NC,BlockMovementInX_Advance | |||||||||||||||||
|
Test whether they overlap along x after the move.
|
||||||||||||||||||
| BlockMovementInX_Test | 50348 | CALL TestOverlapInX | Jump to BlockMovementInX_Advance if the objects do not overlap along x after the move. | |||||||||||||||
| 50351 | JR NC,BlockMovementInX_Advance | |||||||||||||||||
|
Flag the object as blocked along x, then apply the kill flags.
|
||||||||||||||||||
| 50353 | SET 0,(IX+12) | Flag the object as blocked along x. | ||||||||||||||||
| 50357 | LD A,(IX+13) | Fetch the extra flags and move the bit that it kills what it hits into bit 6. | ||||||||||||||||
| 50360 | RRCA | |||||||||||||||||
| 50361 | AND %01000000 | Keep the bit that flags the other object as killed. | ||||||||||||||||
| 50363 | OR (IY+13) | Set it in the extra flags of the other object, if the object kills what it runs into. | ||||||||||||||||
| 50366 | LD (IY+13),A | |||||||||||||||||
| 50369 | RLCA | Move the bit that the other object kills what hits it into bit 6. | ||||||||||||||||
| 50370 | AND %01000000 | Keep the bit that flags the object as killed. | ||||||||||||||||
| 50372 | OR (IX+13) | Set it in the extra flags of the object, if the other object kills what runs into it. | ||||||||||||||||
| 50375 | LD (IX+13),A | |||||||||||||||||
|
Pass the speed along x to the other object if it can be moved.
|
||||||||||||||||||
| 50378 | BIT 2,(IY+7) | Jump to BlockMovementInX_Slow if the other object cannot be moved. | ||||||||||||||||
| 50382 | JR Z,BlockMovementInX_Slow | |||||||||||||||||
| 50384 | LD A,(IX+9) | Give the speed along x to the other object. | ||||||||||||||||
| 50387 | LD (IY+9),A | |||||||||||||||||
|
Slow the move along x and test this object again.
|
||||||||||||||||||
| BlockMovementInX_Slow | 50390 | LD A,C | Fetch the speed along x. | |||||||||||||||
| 50391 | CALL BringSpeedCloserToZero | Bring it closer to zero. | ||||||||||||||||
| 50394 | LD C,A | Store it. | ||||||||||||||||
| 50395 | RET Z | Return if the speed is now zero. | ||||||||||||||||
| 50396 | JR BlockMovementInX_Test | Jump to BlockMovementInX_Test. | ||||||||||||||||
|
Move on to the next object.
|
||||||||||||||||||
| BlockMovementInX_Advance | 50398 | LD DE,32 | Point IY at the next object. | |||||||||||||||
| 50401 | ADD IY,DE | |||||||||||||||||
| 50403 | DJNZ BlockMovementInX_Next | Jump to BlockMovementInX_Next until all of the objects have been tested. | ||||||||||||||||
| 50405 | RET | Return. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: 50242 | Up: Map | Next: 50406 |