summaryrefslogtreecommitdiff
path: root/engine/items/itemfinder.asm
diff options
context:
space:
mode:
authorU-Fish-PC\Daniel <corrnondacqb@yahoo.com>2014-05-22 18:13:20 -0400
committerU-Fish-PC\Daniel <corrnondacqb@yahoo.com>2014-05-22 18:13:20 -0400
commit15427f532085846ab6b51719be687951a094cb6c (patch)
treeedea9b189e91641a12dd521756894df84aeeace7 /engine/items/itemfinder.asm
parentea3ba4cde3706b7c77efb705555ec0c86321cbe2 (diff)
Pull a lot of engine out of main.asm
Diffstat (limited to 'engine/items/itemfinder.asm')
-rwxr-xr-xengine/items/itemfinder.asm51
1 files changed, 51 insertions, 0 deletions
diff --git a/engine/items/itemfinder.asm b/engine/items/itemfinder.asm
new file mode 100755
index 00000000..4ec2a23f
--- /dev/null
+++ b/engine/items/itemfinder.asm
@@ -0,0 +1,51 @@
+HiddenItemNear: ; 7481f (1d:481f)
+ ld hl, HiddenItemCoords
+ ld b, $0
+.asm_74824
+ ld de, $0003
+ ld a, [W_CURMAP]
+ call IsInArrayCummulativeCount
+ ret nc ; return if current map has no hidden items
+ push bc
+ push hl
+ ld hl, $d6f0
+ ld c, b
+ ld b, $2
+ ld a, $10
+ call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
+ ld a, c
+ pop hl
+ pop bc
+ inc b
+ and a
+ inc hl
+ ld d, [hl]
+ inc hl
+ ld e, [hl]
+ inc hl
+ jr nz, .asm_74824 ; 0x74845 $dd
+ ld a, [W_YCOORD]
+ call Func_7486b
+ cp d
+ jr nc, .asm_74824 ; 0x7484e $d4
+ ld a, [W_YCOORD]
+ add $4
+ cp d
+ jr c, .asm_74824 ; 0x74856 $cc
+ ld a, [W_XCOORD]
+ call Func_7486b
+ cp e
+ jr nc, .asm_74824 ; 0x7485f $c3
+ ld a, [W_XCOORD]
+ add $5
+ cp e
+ jr c, .asm_74824 ; 0x74867 $bb
+ scf
+ ret
+
+Func_7486b: ; 7486b (1d:486b)
+ sub $5
+ cp $f0
+ ret c
+ xor a
+ ret