document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. ; Checks if the area has collided with the character
  2. ; @input    HL: _CHAR_X of the character
  3. ; @input    [_36B_AUXVARS + 0]: Left edge of the area
  4. ; @input    [_36B_AUXVARS + 1]: Right edge of the area
  5. ; @input    [_36B_AUXVARS + 2]: Upper edge of the area
  6. ; @input    [_36B_AUXVARS + 3]: Bottom edge of the area
  7. ; @output   Carry: Raised if there has been collision, lowered if not
  8. ; @output   HL: _CHAR_X of the character
  9. chk_area_coll_char:
  10.     ld      c,  [hl]        ; _CHAR_X
  11.     ld      a,  [_36B_AUXVARS + 0]  ; Left edge of the area
  12.     cp      c
  13.     ret     nc                      ; X coordinate of the character lower than the left edge
  14.     ld      a,  [_36B_AUXVARS + 1]  ; Right edge of the area
  15.     cp      c
  16.     jr      c,  chk_area_coll_char_0   ; X coordinate of the character higher than the right edge
  17.     inc     hl
  18.     ld      a,  [hld]       ; _CHAR_Y
  19.     ld      c,  a
  20.     ld      a,  [_36B_AUXVARS + 2]  ; Upper edge of the area
  21.     cp      c
  22.     ret     nc              ; Y coordinate of the character lower than the upper edge
  23.     ld      a,  [_36B_AUXVARS + 3]  ; Bottom edge of the area
  24.     cp      c
  25.     jr      c,  chk_area_coll_char_0   ; Y coordinate of the character higher than the bottom edge
  26.     ; Collision
  27.     scf                     ; We raise the carry flag
  28.     ret
  29. chk_area_coll_char_0:
  30.     xor     a               ; We lower the carry flag
  31.     ret
');