Prev: 48707 Up: Map Next: 48871
48783: 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 48783 LD (52803),BC Update the segment column.
48787 XOR A Clear A.
48788 LD (23594),A The object does not reach the next column.
48791 LD (23595),A The object does not reach the zone above.
48794 LD (23581),A Update the tiles still to test.
48797 LD (23605),A Update the collision status.
48800 LD (58395),A Update the slope direction.
48803 CALL FindHorizontalMove Call FindHorizontalMove.
48806 LD (49023),HL Update the tile position.
48809 LD (23598),HL Update the piece column.
48812 CALL FindVerticalMove Call FindVerticalMove.
48815 LD (49025),HL The vertical position after the move.
48818 LD (23600),HL Update the back to front flag.
48821 LD A,(23589) The collision mode.
48824 INC A Advance A.
48825 JR Z,StartTerrainCheck_Ship Jump to StartTerrainCheck_Ship if the zero flag is set.
48827 DEC A Step A back.
48828 CALL Z,ReverseObjectSpeed Call ReverseObjectSpeed if the zero flag is set.
48831 JR StartTerrainCheck_Speeds Jump to StartTerrainCheck_Speeds.
StartTerrainCheck_Ship 48833 LD HL,(51454) Fetch the word at 51454 into HL.
48836 LD (51436),HL Update the high byte of the ship's horizontal speed.
48839 LD HL,(51456) Fetch the word at 51456 into HL.
48842 LD (51438),HL Update the high byte of the ship's vertical speed.
StartTerrainCheck_Speeds 48845 LD A,(IX+7) Read offset 7 of IX.
48848 LD (48781),A Update the saved horizontal speed.
48851 LD A,(IX+9) Read offset 9 of IX.
48854 NEG Negate A.
48856 LD (48782),A Update the saved vertical speed.
48859 LD A,(52803) The segment column.
48862 LD (23596),A Update the segment screen column.
48865 LD A,(52804) The segment row.
48868 LD (23597),A Update the segment screen row.
Continue on to FindTilesOverlapped.
Prev: 48707 Up: Map Next: 48871