Prev: BE26 Up: Map Next: BE8F
BE43: Select Next Tile
Used by the routine at CheckTerrainCollision.
Chooses the next tile for CheckTerrainCollision to check the object against, from the tiles that the object overlaps and the count in TileNumber, then carries on at FindTilesOverlapped.
SelectNextTile BE43 LD A,($5C1D) The tiles still to test.
BE46 CP $01 Jump to SelectNextTile_Column if A is not 01.
BE48 JR NZ,SelectNextTile_Column
BE4A LD A,($5C2A) The object reaches into the next column.
BE4D AND A Jump to SelectNextTile_Column if A is zero.
BE4E JR Z,SelectNextTile_Column
BE50 LD A,($5C2B) The object reaches into the zone above.
BE53 AND A Jump to SelectNextTile_Column if A is zero.
BE54 JR Z,SelectNextTile_Column
BE56 CALL SelectPreviousZone Call SelectPreviousZone.
BE59 CALL SelectNextColumn Call SelectNextColumn.
BE5C LD A,($5C2B) The object reaches into the zone above.
BE5F LD ($5C2D),A Update the segment screen row.
BE62 JP FindTilesOverlapped Jump to FindTilesOverlapped.
SelectNextTile_Column BE65 LD A,($5C2A) The object reaches into the next column.
BE68 AND A Jump to SelectNextTile_Current if A is zero.
BE69 JR Z,SelectNextTile_Current
BE6B LD A,($E41B) The slope direction.
BE6E AND A Jump to SelectNextTile_Current if A is zero.
BE6F JR Z,SelectNextTile_Current
BE71 XOR A Clear A.
BE72 LD ($E41B),A Update the slope direction.
BE75 CALL SelectNextColumn Call SelectNextColumn.
BE78 LD HL,($5C30) Fetch the word at BackToFrontFlag into HL.
BE7B LD ($BF81),HL The vertical position of the next tile.
BE7E JP FindTilesOverlapped Jump to FindTilesOverlapped.
SelectNextTile_Current BE81 CALL SelectPreviousZone Call SelectPreviousZone.
BE84 LD HL,($5C2E) Fetch the word at PieceColumn into HL.
BE87 LD ($BF7F),HL Update the tile position.
BE8A JP FindTilesOverlapped Jump to FindTilesOverlapped.
BE8D NOP Do nothing.
BE8E NOP Do nothing.
Prev: BE26 Up: Map Next: BE8F