shithub: pokered

Download patch

ref: 12db77201f7ba50241331c3949241a420f43d660
parent: 82512e449115aa9d004e24a3d1526dd32570c56d
author: YamaArashi <shadow962@live.com>
date: Fri Jul 24 10:57:49 EDT 2015

named more functions

--- a/engine/menu/pc.asm
+++ b/engine/menu/pc.asm
@@ -114,13 +114,13 @@
 	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 @@
 	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
--- a/engine/overworld/cable_club_npc.asm
+++ b/engine/overworld/cable_club_npc.asm
@@ -8,7 +8,7 @@
 	call DelayFrames
 	ld hl, CableClubNPCMakingPreparationsText
 	call PrintText
-	jp Func_7298
+	jp .didNotConnect
 .receivedPokedex
 	ld a, $1
 	ld [wMenuJoypadPollCount], a
@@ -71,31 +71,29 @@
 	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 @@
 	xor a
 	ld [wMenuJoypadPollCount], a
 	ret
-
-Func_72a8: ; 72a8 (1:72a8)
+.connected
 	xor a
 	ld [hld], a
 	ld [hl], a
--- a/engine/overworld/cinnabar_lab.asm
+++ b/engine/overworld/cinnabar_lab.asm
@@ -3,19 +3,19 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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)
--- a/hram.asm
+++ b/hram.asm
@@ -261,6 +261,11 @@
 
 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