aboutsummaryrefslogtreecommitdiffstats
path: root/engine/items/itemfinder.asm
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-08-30 17:55:02 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-08-30 17:55:02 -0400
commitd2ed7674f499b1fd6c4059da40b8b42c6bf96995 (patch)
treef581489b522fc647477d7b36dee072d553c44fd1 /engine/items/itemfinder.asm
parentMake pokeyellow build to baserom. (diff)
parentMerge pull request #114 from YamaArashi/master (diff)
downloadpokeyellow-d2ed7674f499b1fd6c4059da40b8b42c6bf96995.tar.gz
pokeyellow-d2ed7674f499b1fd6c4059da40b8b42c6bf96995.tar.xz
pokeyellow-d2ed7674f499b1fd6c4059da40b8b42c6bf96995.zip
Merge branch 'master' of https://github.com/iimarckus/pokered
Doesn't build.
Diffstat (limited to 'engine/items/itemfinder.asm')
-rwxr-xr-xengine/items/itemfinder.asm34
1 files changed, 18 insertions, 16 deletions
diff --git a/engine/items/itemfinder.asm b/engine/items/itemfinder.asm
index d7e5b3ce..5da72388 100755
--- a/engine/items/itemfinder.asm
+++ b/engine/items/itemfinder.asm
@@ -1,16 +1,16 @@
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
+ ld b, FLAG_TEST
predef FlagActionPredef
ld a, c
pop hl
@@ -22,28 +22,30 @@ HiddenItemNear: ; 7481f (1d:481f)
inc hl
ld e, [hl]
inc hl
- jr nz, .asm_74824 ; 0x74845 $dd
+ 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 ; 0x7484e $d4
+ jr nc, .loop
ld a, [W_YCOORD]
- add $4
+ add 4
cp d
- jr c, .asm_74824 ; 0x74856 $cc
+ jr c, .loop
ld a, [W_XCOORD]
- call Func_7486b
+ call Sub5ClampTo0
cp e
- jr nc, .asm_74824 ; 0x7485f $c3
+ jr nc, .loop
ld a, [W_XCOORD]
- add $5
+ add 5
cp e
- jr c, .asm_74824 ; 0x74867 $bb
+ 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