; Checks if the area has collided with the character
; @input HL: _CHAR_X of the character
; @input [_36B_AUXVARS + 0]: Left edge of the area
; @input [_36B_AUXVARS + 1]: Right edge of the area
; @input [_36B_AUXVARS + 2]: Upper edge of the area
; @input [_36B_AUXVARS + 3]: Bottom edge of the area
; @output Carry: Raised if there has been collision, lowered if not
; @output HL: _CHAR_X of the character
chk_area_coll_char:
ld c, [hl] ; _CHAR_X
ld a, [_36B_AUXVARS + 0] ; Left edge of the area
cp c
ret nc ; X coordinate of the character lower than the left edge
ld a, [_36B_AUXVARS + 1] ; Right edge of the area
cp c
jr c, chk_area_coll_char_0 ; X coordinate of the character higher than the right edge
inc hl
ld a, [hld] ; _CHAR_Y
ld c, a
ld a, [_36B_AUXVARS + 2] ; Upper edge of the area
cp c
ret nc ; Y coordinate of the character lower than the upper edge
ld a, [_36B_AUXVARS + 3] ; Bottom edge of the area
cp c
jr c, chk_area_coll_char_0 ; Y coordinate of the character higher than the bottom edge
; Collision
scf ; We raise the carry flag
ret
chk_area_coll_char_0:
xor a ; We lower the carry flag
ret