summaryrefslogtreecommitdiff
path: root/engine/overworld/hidden_items.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/overworld/hidden_items.asm')
-rwxr-xr-xengine/overworld/hidden_items.asm44
1 files changed, 22 insertions, 22 deletions
diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm
index 94f20439..fee5b5bc 100755
--- a/engine/overworld/hidden_items.asm
+++ b/engine/overworld/hidden_items.asm
@@ -1,9 +1,9 @@
HiddenItems: ; 76688 (1d:6688)
ld hl, HiddenItemCoords
- call Func_76857
- ld [wTrainerScreenX], a
- ld hl, wd6f0
- ld a, [wTrainerScreenX]
+ call FindHiddenItemOrCoinsIndex
+ ld [wHiddenItemOrCoinsIndex], a
+ ld hl, wObtainedHiddenItemsFlags
+ ld a, [wHiddenItemOrCoinsIndex]
ld c, a
ld b, $2
predef FlagActionPredef
@@ -11,9 +11,9 @@ HiddenItems: ; 76688 (1d:6688)
and a
ret nz
call EnableAutoTextBoxDrawing
- ld a, $1
+ ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
- ld a, [wWhichTrade] ; item ID
+ ld a, [wHiddenObjectFunctionArgument] ; item ID
ld [wd11e], a
call GetItemName
tx_pre_jump FoundHiddenItemText
@@ -23,12 +23,12 @@ INCLUDE "data/hidden_item_coords.asm"
FoundHiddenItemText: ; 7675b (1d:675b)
TX_FAR _FoundHiddenItemText
TX_ASM
- ld a, [wWhichTrade] ; item ID
+ ld a, [wHiddenObjectFunctionArgument] ; item ID
ld b, a
ld c, 1
call GiveItem
jr nc, .BagFull
- ld hl, wd6f0
+ ld hl, wObtainedHiddenItemsFlags
ld a, [wTrainerScreenX]
ld c, a
ld b, $1
@@ -56,10 +56,10 @@ HiddenCoins: ; 76799 (1d:6799)
and a
ret z
ld hl, HiddenCoinCoords
- call Func_76857
- ld [wTrainerScreenX], a
- ld hl, wd6fe
- ld a, [wTrainerScreenX]
+ call FindHiddenItemOrCoinsIndex
+ ld [wHiddenItemOrCoinsIndex], a
+ ld hl, wObtainedHiddenCoinsFlags
+ ld a, [wHiddenItemOrCoinsIndex]
ld c, a
ld b, $2
predef FlagActionPredef
@@ -70,7 +70,7 @@ HiddenCoins: ; 76799 (1d:6799)
ld [hCoins - 1], a
ld [hCoins], a
ld [hCoins + 1], a
- ld a, [wWhichTrade]
+ ld a, [wHiddenObjectFunctionArgument]
sub COIN
cp 10
jr z, .bcd10
@@ -99,7 +99,7 @@ HiddenCoins: ; 76799 (1d:6799)
ld hl, hCoins + 1
ld c, $2
predef AddBCDPredef
- ld hl, wd6fe
+ ld hl, wObtainedHiddenCoinsFlags
ld a, [wTrainerScreenX]
ld c, a
ld b, $1
@@ -130,31 +130,31 @@ DroppedHiddenCoinsText: ; 7684d (1d:684d)
TX_FAR _DroppedHiddenCoinsText
db "@"
-Func_76857: ; 76857 (1d:6857)
- ld a, [wTrainerScreenY]
+FindHiddenItemOrCoinsIndex: ; 76857 (1d:6857)
+ ld a, [wHiddenObjectY]
ld d, a
- ld a, [wTrainerScreenX]
+ ld a, [wHiddenObjectX]
ld e, a
ld a, [W_CURMAP]
ld b, a
- ld c, $ff
+ ld c, -1
.loop
inc c
ld a, [hli]
cp $ff ; end of the list?
ret z ; if so, we're done here
cp b
- jr nz, .asm_76877
+ jr nz, .next1
ld a, [hli]
cp d
- jr nz, .asm_76878
+ jr nz, .next2
ld a, [hli]
cp e
jr nz, .loop
ld a, c
ret
-.asm_76877
+.next1
inc hl
-.asm_76878
+.next2
inc hl
jr .loop