Prev: 9DEE Up: Map Next: 9E7A
9E35: Test an object against one landscape piece
Used by the routine at hit_slope.
Called by hit_slope for each of a landscape piece's collision records. The object's box is in box_x-box_width, its x, bottom line, height and width (made by place_collision_box). Bits 6-7 of the record's flags pick one of four slope shapes -- the same slope mirrored left to right and upside down (test_slope_reversed, test_slope_upside_down, test_slope_both_ways); which way each faces is not yet worked out. A touch leaves scratch_count 1 and the depth into the slope in touch_depth.
All four shapes ran in the build's sessions; the RET after the four tests cannot be reached.
Input
IX The collision record
test_landscape_piece 9E35 XOR A The object's box
9E36 LD (scratch_count),A
9E39 LD HL,(box_x)
9E3C LD DE,(box_height)
9E40 LD A,(IX+$04) The steepness
9E43 AND $07
9E45 LD C,A
9E46 LD A,(IX+$04) The shape
9E49 AND $C0
9E4B JR Z,test_landscape_piece_0
9E4D CP $40
9E4F JP Z,test_slope_reversed
9E52 CP $80
9E54 JP Z,test_slope_upside_down
9E57 CP $C0
9E59 JP Z,test_slope_both_ways
9E5C RET
test_landscape_piece_0 9E5D CALL test_slope The first shape
This entry point is used by the routine at test_slope_both_ways.
test_landscape_piece_1 9E60 LD A,(scratch_count) In range: no touch yet
9E63 AND A
9E64 RET Z
9E65 DEC A
9E66 LD (scratch_count),A
9E69 LD A,D The object's right edge short of the slope: no touch
9E6A ADD A,L
9E6B LD L,A
9E6C LD A,(IX+$00)
9E6F ADD A,B
9E70 SUB L
9E71 RET NC
9E72 NEG How far in
9E74 LD (touch_depth),A
9E77 JP overlap_found
Prev: 9DEE Up: Map Next: 9E7A