Prev: 50327 Up: Map Next: 50485
50406: Block Movement In Y
Used by the routine at BlockMovement.
Brings the speed along y of an object closer to zero until it does not run into any other object. This works in the same way as BlockMovementInX.
Input
C Speed along x
L Speed along y
H Speed along z
IX The address of the object
Output
L The new speed along y
Walk the object table.
BlockMovementInY 50406 LD IY,23432 Point IY at PlayerBottomObject.
50410 LD B,56 Set a counter of 56 objects.
Skip unless the object is solid and already overlaps along x and z.
BlockMovementInY_Next 50412 CALL TestObjectSolid Jump to BlockMovementInY_Advance if the object is not present or is ignored.
50415 JR Z,BlockMovementInY_Advance
50417 CALL TestOverlapInX Jump to BlockMovementInY_Advance if the objects do not overlap along x.
50420 JR NC,BlockMovementInY_Advance
50422 CALL TestOverlapInZ Jump to BlockMovementInY_Advance if the objects do not overlap along z.
50425 JR NC,BlockMovementInY_Advance
Test whether they overlap along y after the move.
BlockMovementInY_Test 50427 CALL TestOverlapInY Jump to BlockMovementInY_Advance if the objects do not overlap along y after the move.
50430 JR NC,BlockMovementInY_Advance
Flag the object as blocked along y, then apply the kill flags.
50432 SET 1,(IX+12) Flag the object as blocked along y.
50436 LD A,(IX+13) Fetch the extra flags and move the bit that it kills what it hits into bit 6.
50439 RRCA
50440 AND %01000000 Keep the bit that flags the other object as killed.
50442 OR (IY+13) Set it in the extra flags of the other object, if the object kills what it runs into.
50445 LD (IY+13),A
50448 RLCA Move the bit that the other object kills what hits it into bit 6.
50449 AND %01000000 Keep the bit that flags the object as killed.
50451 OR (IX+13) Set it in the extra flags of the object, if the other object kills what runs into it.
50454 LD (IX+13),A
Pass the speed along y to the other object if it can be moved.
50457 BIT 2,(IY+7) Jump to BlockMovementInY_Slow if the other object cannot be moved.
50461 JR Z,BlockMovementInY_Slow
50463 LD A,(IX+10) Give the speed along y to the other object.
50466 LD (IY+10),A
Slow the move along y and test this object again.
BlockMovementInY_Slow 50469 LD A,L Fetch the speed along y.
50470 CALL BringSpeedCloserToZero Bring it closer to zero.
50473 LD L,A Store it.
50474 RET Z Return if the speed is now zero.
50475 JR BlockMovementInY_Test Jump to BlockMovementInY_Test.
Move on to the next object.
BlockMovementInY_Advance 50477 LD DE,32 Point IY at the next object.
50480 ADD IY,DE
50482 DJNZ BlockMovementInY_Next Jump to BlockMovementInY_Next until all of the objects have been tested.
50484 RET Return.
View the equivalent code in;
Prev: 50327 Up: Map Next: 50485