Prev: 40369 Up: Map Next: 40408
40379: Test Horizontal Overlap
Used by the routine at TestBoxesOverlap.
Tests whether two boxes overlap horizontally. The result is stored in 23580.
Input
D Width of the second box
L Horizontal position of the second box
IX Address of the first box
TestHorizontalOverlap 40379 XOR A Clear the result.
40380 LD (23580),A Store it.
40383 LD A,(IX+0) Fetch the left edge of the first box.
40386 SUB L Subtract the left edge of the second box.
40387 JR C,TestHorizontalOverlap_Left Jump to TestHorizontalOverlap_Left if the first box starts to the left of the second.
40389 CP D Does the first box start within the width of the second?
40390 JR C,SetOverlapFlag Jump to SetOverlapFlag if so.
TestHorizontalOverlap_Left 40392 LD A,(IX+0) Fetch the left edge of the first box.
40395 CP L Is it to the right of the second box?
40396 RET NC Return if so, as the boxes do not overlap.
40397 ADD A,(IX+2) Add the width of the first box to get its right edge.
40400 CP L Is it to the left of the second box?
40401 RET C Return if so, as the boxes do not overlap.
This entry point is used by the routines at TestVerticalOverlap, TestSlopeCollision and FindMirroredSlopeOverlap.
SetOverlapFlag 40402 LD A,1 Set the result to 1.
40404 LD (23580),A Store it.
40407 RET Return.
Prev: 40369 Up: Map Next: 40408