This commit is contained in:
YamaArashi 2015-07-18 20:49:52 -07:00
parent b96ef8d2d4
commit c169073eed
61 changed files with 743 additions and 612 deletions

View file

@ -1,14 +1,14 @@
HiddenItemNear: ; 7481f (1d:481f)
ld hl, HiddenItemCoords
ld b, $0
.asm_74824
ld de, $0003
ld b, 0
.loop
ld de, 3
ld a, [W_CURMAP]
call IsInRestOfArray
ret nc ; return if current map has no hidden items
push bc
push hl
ld hl, wd6f0
ld hl, wObtainedHiddenItemsFlags
ld c, b
ld b, $2
predef FlagActionPredef
@ -22,28 +22,30 @@ HiddenItemNear: ; 7481f (1d:481f)
inc hl
ld e, [hl]
inc hl
jr nz, .asm_74824
jr nz, .loop ; if the item has already been obtained
; check if the item is within 4-5 tiles (depending on the direction of item)
ld a, [W_YCOORD]
call Func_7486b
call Sub5ClampTo0
cp d
jr nc, .asm_74824
jr nc, .loop
ld a, [W_YCOORD]
add $4
add 4
cp d
jr c, .asm_74824
jr c, .loop
ld a, [W_XCOORD]
call Func_7486b
call Sub5ClampTo0
cp e
jr nc, .asm_74824
jr nc, .loop
ld a, [W_XCOORD]
add $5
add 5
cp e
jr c, .asm_74824
jr c, .loop
scf
ret
Func_7486b: ; 7486b (1d:486b)
sub $5
Sub5ClampTo0: ; 7486b (1d:486b)
; subtract 5 but clamp to 0
sub 5
cp $f0
ret c
xor a