Prev: BE43 Up: Map Next: BEE7
BE8F: Start Terrain Check
Used by the routine at CheckTerrainCollision.
Sets up CheckTerrainCollision: keeps the size of the object in SegmentColumn and clears the working values, finds where the object will be after it has moved by its speeds using FindHorizontalMove and FindVerticalMove, and keeps its speeds. Carries on at FindTilesOverlapped.
Input
BC Size of the object
IX Address of the object
StartTerrainCheck BE8F LD ($CE43),BC Update the segment column.
BE93 XOR A Clear A.
BE94 LD ($5C2A),A The object does not reach the next column.
BE97 LD ($5C2B),A The object does not reach the zone above.
BE9A LD ($5C1D),A Update the tiles still to test.
BE9D LD ($5C35),A Update the collision status.
BEA0 LD ($E41B),A Update the slope direction.
BEA3 CALL FindHorizontalMove Call FindHorizontalMove.
BEA6 LD ($BF7F),HL Update the tile position.
BEA9 LD ($5C2E),HL Update the piece column.
BEAC CALL FindVerticalMove Call FindVerticalMove.
BEAF LD ($BF81),HL The vertical position after the move.
BEB2 LD ($5C30),HL Update the back to front flag.
BEB5 LD A,($5C25) The collision mode.
BEB8 INC A Advance A.
BEB9 JR Z,StartTerrainCheck_Ship Jump to StartTerrainCheck_Ship if the zero flag is set.
BEBB DEC A Step A back.
BEBC CALL Z,ReverseObjectSpeed Call ReverseObjectSpeed if the zero flag is set.
BEBF JR StartTerrainCheck_Speeds Jump to StartTerrainCheck_Speeds.
StartTerrainCheck_Ship BEC1 LD HL,($C8FE) Fetch the word at C8FE into HL.
BEC4 LD ($C8EC),HL Update the high byte of the ship's horizontal speed.
BEC7 LD HL,($C900) Fetch the word at C900 into HL.
BECA LD ($C8EE),HL Update the high byte of the ship's vertical speed.
StartTerrainCheck_Speeds BECD LD A,(IX+$07) Read offset 07 of IX.
BED0 LD ($BE8D),A Update the saved horizontal speed.
BED3 LD A,(IX+$09) Read offset 09 of IX.
BED6 NEG Negate A.
BED8 LD ($BE8E),A Update the saved vertical speed.
BEDB LD A,($CE43) The segment column.
BEDE LD ($5C2C),A Update the segment screen column.
BEE1 LD A,($CE44) The segment row.
BEE4 LD ($5C2D),A Update the segment screen row.
Continue on to FindTilesOverlapped.
Prev: BE43 Up: Map Next: BEE7