summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xengine/menu/pc.asm12
-rwxr-xr-xengine/overworld/cable_club_npc.asm23
-rwxr-xr-xengine/overworld/cinnabar_lab.asm35
-rw-r--r--hram.asm5
4 files changed, 39 insertions, 36 deletions
diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm
index a804abb2..78b35b95 100755
--- a/engine/menu/pc.asm
+++ b/engine/menu/pc.asm
@@ -114,13 +114,13 @@ AccessedMyPCText: ; 17f32 (5:7f32)
TX_FAR _AccessedMyPCText
db "@"
-; removes one of the specified item ID [$FFdb] from bag (if existent)
+; removes one of the specified item ID [hItemToRemoveID] from bag (if existent)
RemoveItemByID: ; 17f37 (5:7f37)
ld hl, wBagItems
- ld a, [$ffdb]
+ ld a, [hItemToRemoveID]
ld b, a
xor a
- ld [$ffdc], a
+ ld [hItemToRemoveIndex], a
.asm_17f40
ld a, [hli]
cp $ff
@@ -128,14 +128,14 @@ RemoveItemByID: ; 17f37 (5:7f37)
cp b
jr z, .asm_17f4f
inc hl
- ld a, [$ffdc]
+ ld a, [hItemToRemoveIndex]
inc a
- ld [$ffdc], a
+ ld [hItemToRemoveIndex], a
jr .asm_17f40
.asm_17f4f
ld a, $1
ld [wItemQuantity], a
- ld a, [$ffdc]
+ ld a, [hItemToRemoveIndex]
ld [wWhichPokemon], a
ld hl, wNumBagItems
jp RemoveItemFromInventory
diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm
index 65837150..a2feba06 100755
--- a/engine/overworld/cable_club_npc.asm
+++ b/engine/overworld/cable_club_npc.asm
@@ -8,7 +8,7 @@ CableClubNPC: ; 71c5 (1:71c5)
call DelayFrames
ld hl, CableClubNPCMakingPreparationsText
call PrintText
- jp Func_7298
+ jp .didNotConnect
.receivedPokedex
ld a, $1
ld [wMenuJoypadPollCount], a
@@ -71,31 +71,29 @@ CableClubNPC: ; 71c5 (1:71c5)
ld hl, wUnknownSerialCounter
ld a, [hli]
inc a
- jr nz, Func_72a8
+ jr nz, .connected
ld a, [hl]
inc a
- jr nz, Func_72a8
- ld b, $a
-.asm_7273
+ jr nz, .connected
+ ld b, 10
+.syncLoop
call DelayFrame
call Serial_SendZeroByte
dec b
- jr nz, .asm_7273
+ jr nz, .syncLoop
call CloseLinkConnection
ld hl, CableClubNPCLinkClosedBecauseOfInactivityText
call PrintText
- jr Func_7298
+ jr .didNotConnect
.failedToEstablishConnection
ld hl, CableClubNPCAreaReservedFor2FriendsLinkedByCableText
call PrintText
- jr Func_7298
+ jr .didNotConnect
.choseNo
call CloseLinkConnection
ld hl, CableClubNPCPleaseComeAgainText
call PrintText
- ; fall through
-
-Func_7298: ; 7298 (1:7298)
+.didNotConnect
xor a
ld hl, wUnknownSerialCounter
ld [hli], a
@@ -105,8 +103,7 @@ Func_7298: ; 7298 (1:7298)
xor a
ld [wMenuJoypadPollCount], a
ret
-
-Func_72a8: ; 72a8 (1:72a8)
+.connected
xor a
ld [hld], a
ld [hl], a
diff --git a/engine/overworld/cinnabar_lab.asm b/engine/overworld/cinnabar_lab.asm
index 1b96b4c6..5337255c 100755
--- a/engine/overworld/cinnabar_lab.asm
+++ b/engine/overworld/cinnabar_lab.asm
@@ -3,19 +3,19 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
set 6, [hl]
xor a
ld [wCurrentMenuItem], a
- ld a, $3
+ ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, [wcd37]
dec a
ld [wMaxMenuItem], a
- ld a, $2
+ ld a, 2
ld [wTopMenuItemY], a
- ld a, $1
+ ld a, 1
ld [wTopMenuItemX], a
ld a, [wcd37]
dec a
- ld bc, $2
- ld hl, $3
+ ld bc, 2
+ ld hl, 3
call AddNTimes
dec l
ld b, l
@@ -23,12 +23,12 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
coord hl, 0, 0
call TextBoxBorder
call UpdateSprites
- call Func_610c2
+ call PrintFossilsInBag
ld hl, wd730
res 6, [hl]
call HandleMenuInput
- bit 1, a
- jr nz, .asm_610a7
+ bit 1, a ; pressed B?
+ jr nz, .cancelledGivingFossil
ld hl, wcc5b
ld a, [wCurrentMenuItem]
ld d, $0
@@ -57,17 +57,17 @@ GiveFossilToCinnabarLab: ; 61006 (18:5006)
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
- jr nz, .asm_610a7
+ jr nz, .cancelledGivingFossil
ld hl, LabFossil_610b3
call PrintText
ld a, [W_FOSSILITEM]
- ld [$ffdb], a
+ ld [hItemToRemoveID], a
callba RemoveItemByID
ld hl, LabFossil_610b8
call PrintText
SetEvents EVENT_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL
ret
-.asm_610a7
+.cancelledGivingFossil
ld hl, LabFossil_610bd
call PrintText
ret
@@ -88,11 +88,12 @@ LabFossil_610bd: ; 610bd (18:50bd)
TX_FAR _Lab4Text_610bd
db "@"
-Func_610c2: ; 610c2 (18:50c2)
+PrintFossilsInBag: ; 610c2 (18:50c2)
+; Prints each fossil in the player's bag on a separate line in the menu.
ld hl, wcc5b
xor a
- ld [$ffdb], a
-.asm_610c8
+ ld [hFossilCounter], a
+.loop
ld a, [hli]
cp $ff
ret z
@@ -100,15 +101,15 @@ Func_610c2: ; 610c2 (18:50c2)
ld [wd11e], a
call GetItemName
coord hl, 2, 2
- ld a, [$ffdb]
+ ld a, [hFossilCounter]
ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld de, wcd6d
call PlaceString
- ld hl, $ffdb
+ ld hl, hFossilCounter
inc [hl]
pop hl
- jr .asm_610c8
+ jr .loop
; loads the names of the fossil item and the resulting mon
LoadFossilItemAndMonName: ; 610eb (18:50eb)
diff --git a/hram.asm b/hram.asm
index 27da5c22..c74e53d7 100644
--- a/hram.asm
+++ b/hram.asm
@@ -261,6 +261,11 @@ hTilesetType EQU $FFD7
H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10
+hFossilCounter EQU $FFDB
+
+hItemToRemoveID EQU $FFDB
+hItemToRemoveIndex EQU $FFDC
+
hVendingMachineItem EQU $FFDB
hVendingMachinePrice EQU $FFDC ; 3-byte BCD number