shithub: pokered

Download patch

ref: 132d0367522b7acce602b146ca69bfad87ef96c6
parent: 64cfbcce7a71e6e75553575490fd60cbd61a5665
author: YamaArashi <shadow962@live.com>
date: Wed Aug 12 18:14:31 EDT 2015

named more variables

--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -76,11 +76,11 @@
 	ld b, [hl]
 	ld a, [wPlayerID + 1]
 	cp b
-	ld a, $0
+	ld a, 0
 	jr z, .next
 .tradedMon
 	call BoostExp ; traded mon exp boost
-	ld a, $1
+	ld a, 1
 .next
 	ld [wGainBoostedExp], a
 	ld a, [W_ISINBATTLE]
@@ -92,12 +92,12 @@
 ; add the gained exp to the party mon's exp
 	ld b, [hl]
 	ld a, [H_QUOTIENT + 3]
-	ld [wcf4c], a
+	ld [wExpAmountGained + 1], a
 	add b
 	ld [hld], a
 	ld b, [hl]
 	ld a, [H_QUOTIENT + 2]
-	ld [wcf4b], a
+	ld [wExpAmountGained], a
 	adc b
 	ld [hl], a
 	jr nc, .noCarry
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -836,7 +836,7 @@
 	call ClearScreen
 	call LoadHpBarAndStatusTilePatterns
 	xor a
-	ld [wcc5b], a
+	ld [wUnusedCC5B], a
 	ld a, [hSerialConnectionStatus]
 	cp USING_EXTERNAL_CLOCK
 	jr z, .usingExternalClock
--- a/engine/game_corner_slots2.asm
+++ b/engine/game_corner_slots2.asm
@@ -3,7 +3,7 @@
 	and $8
 	jr z, .done ; not able
 	ld b, COIN_CASE
-	predef IsItemInBag_  ; IsItemInBag_
+	predef GetQuantityOfItemInBag
 	ld a, b
 	and a
 	ld b, (GameCornerCoinCaseText_id - TextPredefs) / 2 + 1
--- a/engine/hall_of_fame.asm
+++ b/engine/hall_of_fame.asm
@@ -243,7 +243,7 @@
 	call HoFPrintTextAndDelay
 	ld hl, DexRatingText
 	call HoFPrintTextAndDelay
-	ld hl, wcc5d
+	ld hl, wDexRatingText
 
 HoFPrintTextAndDelay: ; 703e2 (1c:43e2)
 	call PrintText
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -1324,7 +1324,7 @@
 BaitRockCommon: ; df7f (3:5f7f)
 	ld [W_ANIMATIONID],a
 	xor a
-	ld [wcc5b],a
+	ld [wAnimationType],a
 	ld [H_WHOSETURN],a
 	ld [de],a ; zero escape factor (for bait), zero bait factor (for rock)
 .randomLoop ; loop until a random number less than 5 is generated
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -150,7 +150,7 @@
 	ld de, CableClubOptionsText
 	call PlaceString
 	xor a
-	ld [wcd37], a
+	ld [wUnusedCD37], a
 	ld [wd72d], a
 	ld hl, wTopMenuItemY
 	ld a, $7
--- a/engine/mon_party_sprites.asm
+++ b/engine/mon_party_sprites.asm
@@ -13,7 +13,7 @@
 	ld hl, wPartyMenuHPBarColors
 	ld a, [wCurrentMenuItem]
 	ld c, a
-	ld b, $0
+	ld b, 0
 	add hl, bc
 	ld a, [hl]
 
@@ -42,7 +42,7 @@
 	jp DelayFrame
 .resetSprites
 	push bc
-	ld hl, wcc5b
+	ld hl, wMonPartySpritesSavedOAM
 	ld de, wOAMBuffer
 	ld bc, $60
 	call CopyData
@@ -86,7 +86,7 @@
 ; that each frame lasts for green HP, yellow HP, and red HP in order.
 ; On the naming screen, the yellow HP speed is always used.
 PartyMonSpeeds: ; 71769 (1c:5769)
-	db $05,$10,$20
+	db 5, 16, 32
 
 LoadMonPartySpriteGfx: ; 7176c (1c:576c)
 ; Load mon party sprite tile patterns into VRAM during V-blank.
@@ -372,7 +372,7 @@
 
 WriteMonPartySpriteOAM: ; 718c3 (1c:58c3)
 ; Write the OAM blocks for the first animation frame into the OAM buffer and
-; make a copy at wcc5b.
+; make a copy at wMonPartySpritesSavedOAM.
 	push af
 	ld c, $10
 	ld h, wOAMBuffer / $100
@@ -392,7 +392,7 @@
 ; we can flip back to it from the second frame by copying it back.
 .makeCopy
 	ld hl, wOAMBuffer
-	ld de, wcc5b
+	ld de, wMonPartySpritesSavedOAM
 	ld bc, $60
 	jp CopyData
 
--- a/engine/overworld/cinnabar_lab.asm
+++ b/engine/overworld/cinnabar_lab.asm
@@ -5,7 +5,7 @@
 	ld [wCurrentMenuItem], a
 	ld a, A_BUTTON | B_BUTTON
 	ld [wMenuWatchedKeys], a
-	ld a, [wcd37]
+	ld a, [wFilteredBagItemsCount]
 	dec a
 	ld [wMaxMenuItem], a
 	ld a, 2
@@ -12,7 +12,7 @@
 	ld [wTopMenuItemY], a
 	ld a, 1
 	ld [wTopMenuItemX], a
-	ld a, [wcd37]
+	ld a, [wFilteredBagItemsCount]
 	dec a
 	ld bc, 2
 	ld hl, 3
@@ -29,9 +29,9 @@
 	call HandleMenuInput
 	bit 1, a ; pressed B?
 	jr nz, .cancelledGivingFossil
-	ld hl, wcc5b
+	ld hl, wFilteredBagItems
 	ld a, [wCurrentMenuItem]
-	ld d, $0
+	ld d, 0
 	ld e, a
 	add hl, de
 	ld a, [hl]
@@ -90,9 +90,9 @@
 
 PrintFossilsInBag: ; 610c2 (18:50c2)
 ; Prints each fossil in the player's bag on a separate line in the menu.
-	ld hl, wcc5b
+	ld hl, wFilteredBagItems
 	xor a
-	ld [hFossilCounter], a
+	ld [hItemCounter], a
 .loop
 	ld a, [hli]
 	cp $ff
@@ -101,12 +101,12 @@
 	ld [wd11e], a
 	call GetItemName
 	coord hl, 2, 2
-	ld a, [hFossilCounter]
+	ld a, [hItemCounter]
 	ld bc, SCREEN_WIDTH * 2
 	call AddNTimes
 	ld de, wcd6d
 	call PlaceString
-	ld hl, hFossilCounter
+	ld hl, hItemCounter
 	inc [hl]
 	pop hl
 	jr .loop
--- a/engine/overworld/hidden_items.asm
+++ b/engine/overworld/hidden_items.asm
@@ -51,7 +51,7 @@
 
 HiddenCoins: ; 76799 (1d:6799)
 	ld b, COIN_CASE
-	predef IsItemInBag_
+	predef GetQuantityOfItemInBag
 	ld a, b
 	and a
 	ret z
--- a/engine/overworld/oaks_aide.asm
+++ b/engine/overworld/oaks_aide.asm
@@ -18,7 +18,7 @@
 .giveItem
 	ld hl, OaksAideHereYouGoText
 	call PrintText
-	ld a, [hOaksAideItemReward]
+	ld a, [hOaksAideRewardItem]
 	ld b, a
 	ld c, 1
 	call GiveItem
--- a/engine/pokedex_rating.asm
+++ b/engine/pokedex_rating.asm
@@ -33,7 +33,7 @@
 	callba PlayPokedexRatingSfx
 	jp WaitForTextScrollButtonPress
 .hallOfFame
-	ld de, wcc5b
+	ld de, wDexRatingNumMonsSeen
 	ld a, [hDexRatingNumMonsSeen]
 	ld [de], a
 	inc de
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -80,7 +80,7 @@
 	add_predef LoadTilesetHeader
 	add_predef LearnMoveFromLevelUp
 	add_predef LearnMove
-	add_predef IsItemInBag_
+	add_predef GetQuantityOfItemInBag
 	dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0
 	dbw $03,GiveItem
 	add_predef ChangeBGPalColor0_4Frames
--- a/engine/predefs7.asm
+++ b/engine/predefs7.asm
@@ -21,7 +21,7 @@
 	ret c
 	ld hl, wd126
 	set 7, [hl]
-	ld hl, wcc5b
+	ld hl, wElevatorWarpMaps
 	ld a, [wWhichPokemon]
 	add a
 	ld d, 0
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -644,7 +644,7 @@
 	call AddNTimes
 	ld e, l
 	ld d, h
-	ld hl, wcc5b
+	ld hl, wHallOfFame
 	ld bc, HOF_TEAM
 	jr HallOfFame_Copy
 
@@ -653,7 +653,7 @@
 	ld de, sHallOfFame
 	ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1)
 	call HallOfFame_Copy
-	ld hl, wcc5b
+	ld hl, wHallOfFame
 	ld de, sHallOfFame + HOF_TEAM * (HOF_TEAM_CAPACITY - 1)
 	ld bc, HOF_TEAM
 	jr HallOfFame_Copy
@@ -663,7 +663,7 @@
 	ld bc, HOF_TEAM
 	ld a, [wHoFTeamIndex]
 	call AddNTimes
-	ld de, wcc5b
+	ld de, wHallOfFame
 	ld bc, HOF_TEAM
 	; fallthrough
 
--- a/engine/titlescreen.asm
+++ b/engine/titlescreen.asm
@@ -215,7 +215,7 @@
 	ld [wNewSoundID], a
 	call PlaySound
 	xor a
-	ld [wcc5b], a
+	ld [wUnusedCC5B], a
 
 ; Keep scrolling in new mons indefinitely until the user performs input.
 .awaitUserInterruptionLoop
--- a/engine/trade.asm
+++ b/engine/trade.asm
@@ -849,5 +849,5 @@
 Trade_ShowAnimation: ; 41676 (10:5676)
 	ld [W_ANIMATIONID], a
 	xor a
-	ld [wcc5b], a
+	ld [wAnimationType], a
 	predef_jump MoveAnimation
--- a/home.asm
+++ b/home.asm
@@ -2706,7 +2706,7 @@
 ; set zero flag if item isn't in player's bag
 ; else reset zero flag
 ; related to Pokémon Tower and ghosts
-	predef IsItemInBag_
+	predef GetQuantityOfItemInBag
 	ld a,b
 	and a
 	ret
--- a/hram.asm
+++ b/hram.asm
@@ -269,7 +269,7 @@
 
 H_CURRENTSPRITEOFFSET EQU $FFDA ; multiple of $10
 
-hFossilCounter EQU $FFDB
+hItemCounter EQU $FFDB
 
 hGymGateIndex EQU $FFDB
 
@@ -285,7 +285,7 @@
 hOaksAideResult       EQU $FFDB
 
 hOaksAideRequirement  EQU $FFDB ; required number of owned mons
-hOaksAideItemReward   EQU $FFDC
+hOaksAideRewardItem   EQU $FFDC
 hOaksAideNumMonsOwned EQU $FFDD
 
 hItemToRemoveID    EQU $FFDB
--- a/main.asm
+++ b/main.asm
@@ -4508,21 +4508,23 @@
 	ret
 
 
-IsItemInBag_: ; f8a5 (3:78a5)
+GetQuantityOfItemInBag: ; f8a5 (3:78a5)
+; In: b = item ID
+; Out: b = how many of that item are in the bag
 	call GetPredefRegisters
 	ld hl, wNumBagItems
-.asm_f8ab
+.loop
 	inc hl
 	ld a, [hli]
 	cp $ff
-	jr z, .asm_f8b7
+	jr z, .notInBag
 	cp b
-	jr nz, .asm_f8ab
+	jr nz, .loop
 	ld a, [hl]
 	ld b, a
 	ret
-.asm_f8b7
-	ld b, $0
+.notInBag
+	ld b, 0
 	ret
 
 FindPathToPlayer: ; f8ba (3:78ba)
--- a/scripts/celadonmartelevator.asm
+++ b/scripts/celadonmartelevator.asm
@@ -35,7 +35,7 @@
 	ld hl, CeladonMartElavatorFloors
 	call LoadItemList
 	ld hl, CeldaonMartElevatorWarpMaps
-	ld de, wcc5b
+	ld de, wElevatorWarpMaps
 	ld bc, CeldaonMartElevatorWarpMapsEnd - CeldaonMartElevatorWarpMaps
 	jp CopyData
 
--- a/scripts/celadonmartroof.asm
+++ b/scripts/celadonmartroof.asm
@@ -1,34 +1,35 @@
 CeladonMartRoofScript: ; 483d5 (12:43d5)
 	jp EnableAutoTextBoxDrawing
 
-CeladonMartRoofScript_483d8: ; 483d8 (12:43d8)
+CeladonMartRoofScript_GetDrinksInBag: ; 483d8 (12:43d8)
+; construct a list of all drinks in the player's bag
 	xor a
-	ld [wcd37], a
-	ld de, wcc5b
+	ld [wFilteredBagItemsCount], a
+	ld de, wFilteredBagItems
 	ld hl, CeladonMartRoofDrinkList
-.asm_483e2
+.loop
 	ld a, [hli]
 	and a
-	jr z, .asm_48404
+	jr z, .done
 	push hl
 	push de
 	ld [wd11e], a
 	ld b, a
-	predef IsItemInBag_
+	predef GetQuantityOfItemInBag
 	pop de
 	pop hl
 	ld a, b
 	and a
-	jr z, .asm_483e2
+	jr z, .loop ; if the item isn't in the bag
 	ld a, [wd11e]
 	ld [de], a
 	inc de
 	push hl
-	ld hl, wcd37
+	ld hl, wFilteredBagItemsCount
 	inc [hl]
 	pop hl
-	jr .asm_483e2
-.asm_48404
+	jr .loop
+.done
 	ld a, $ff
 	ld [de], a
 	ret
@@ -39,7 +40,7 @@
 	db LEMONADE
 	db $00
 
-CeladonMartRoofScript_4840c: ; 4840c (12:440c)
+CeladonMartRoofScript_GiveDrinkToGirl: ; 4840c (12:440c)
 	ld hl, wd730
 	set 6, [hl]
 	ld hl, CeladonMartRoofText_484ee
@@ -48,83 +49,84 @@
 	ld [wCurrentMenuItem], a
 	ld a, A_BUTTON | B_BUTTON
 	ld [wMenuWatchedKeys], a
-	ld a, [wcd37]
+	ld a, [wFilteredBagItemsCount]
 	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]
+	ld a, [wFilteredBagItemsCount]
 	dec a
-	ld bc, $2
-	ld hl, $3
+	ld bc, 2
+	ld hl, 3
 	call AddNTimes
 	dec l
 	ld b, l
-	ld c, $c
+	ld c, 12
 	coord hl, 0, 0
 	call TextBoxBorder
 	call UpdateSprites
-	call CeladonMartRoofScript_48532
+	call CeladonMartRoofScript_PrintDrinksInBag
 	ld hl, wd730
 	res 6, [hl]
 	call HandleMenuInput
 	bit 1, a ; pressed b
 	ret nz
-	ld hl, wcc5b
+	ld hl, wFilteredBagItems
 	ld a, [wCurrentMenuItem]
-	ld d, $0
+	ld d, 0
 	ld e, a
 	add hl, de
 	ld a, [hl]
-	ld [$ffdb], a
+	ld [hItemToRemoveID], a
 	cp FRESH_WATER
-	jr z, .asm_484b6
+	jr z, .gaveFreshWater
 	cp SODA_POP
-	jr z, .asm_48492
+	jr z, .gaveSodaPop
+; gave Lemonade
 	CheckEvent EVENT_GOT_TM49
-	jr nz, .asm_484e0
+	jr nz, .alreadyGaveDrink
 	ld hl, CeladonMartRoofText_48515
 	call PrintText
 	call RemoveItemByIDBank12
 	lb bc, TM_49, 1
 	call GiveItem
-	jr nc, .BagFull
+	jr nc, .bagFull
 	ld hl, ReceivedTM49Text
 	call PrintText
 	SetEvent EVENT_GOT_TM49
 	ret
-.asm_48492
+.gaveSodaPop
 	CheckEvent EVENT_GOT_TM48
-	jr nz, .asm_484e0
+	jr nz, .alreadyGaveDrink
 	ld hl, CeladonMartRoofText_48504
 	call PrintText
 	call RemoveItemByIDBank12
 	lb bc, TM_48, 1
 	call GiveItem
-	jr nc, .BagFull
+	jr nc, .bagFull
 	ld hl, CeladonMartRoofText_4850a
 	call PrintText
 	SetEvent EVENT_GOT_TM48
 	ret
-.asm_484b6
+.gaveFreshWater
 	CheckEvent EVENT_GOT_TM13
-	jr nz, .asm_484e0
+	jr nz, .alreadyGaveDrink
 	ld hl, CeladonMartRoofText_484f3
 	call PrintText
 	call RemoveItemByIDBank12
 	lb bc, TM_13, 1
 	call GiveItem
-	jr nc, .BagFull
+	jr nc, .bagFull
 	ld hl, CeladonMartRoofText_484f9
 	call PrintText
 	SetEvent EVENT_GOT_TM13
 	ret
-.BagFull
+.bagFull
 	ld hl, CeladonMartRoofText_48526
 	jp PrintText
-.asm_484e0
+.alreadyGaveDrink
 	ld hl, CeladonMartRoofText_4852c
 	jp PrintText
 
@@ -181,11 +183,11 @@
 	db $0d
 	db "@"
 
-CeladonMartRoofScript_48532: ; 48532 (12:4532)
-	ld hl, wcc5b
+CeladonMartRoofScript_PrintDrinksInBag: ; 48532 (12:4532)
+	ld hl, wFilteredBagItems
 	xor a
-	ld [$ffdb], a
-.asm_48538
+	ld [hItemCounter], a
+.loop
 	ld a, [hli]
 	cp $ff
 	ret z
@@ -193,15 +195,15 @@
 	ld [wd11e], a
 	call GetItemName
 	coord hl, 2, 2
-	ld a, [$ffdb]
+	ld a, [hItemCounter]
 	ld bc, SCREEN_WIDTH * 2
 	call AddNTimes
 	ld de, wcd6d
 	call PlaceString
-	ld hl, $ffdb
+	ld hl, hItemCounter
 	inc [hl]
 	pop hl
-	jr .asm_48538
+	jr .loop
 
 CeladonMartRoofTextPointers: ; 4855b (12:455b)
 	dw CeladonMartRoofText1
@@ -217,11 +219,11 @@
 
 CeladonMartRoofText2: ; 4856c (12:456c)
 	TX_ASM
-	call CeladonMartRoofScript_483d8
-	ld a, [wcd37]
+	call CeladonMartRoofScript_GetDrinksInBag
+	ld a, [wFilteredBagItemsCount]
 	and a
-	jr z, .asm_4858f
-	ld a, $1
+	jr z, .noDrinksInBag
+	ld a, 1
 	ld [wDoNotWaitForButtonPressAfterDisplayingText], a
 	ld hl, CeladonMartRoofText4
 	call PrintText
@@ -228,13 +230,13 @@
 	call YesNoChoice
 	ld a, [wCurrentMenuItem]
 	and a
-	jr nz, .asm_48595
-	call CeladonMartRoofScript_4840c
-	jr .asm_48595
-.asm_4858f
+	jr nz, .done
+	call CeladonMartRoofScript_GiveDrinkToGirl
+	jr .done
+.noDrinksInBag
 	ld hl, CeladonMartRoofText3
 	call PrintText
-.asm_48595
+.done
 	jp TextScriptEnd
 
 CeladonMartRoofText3: ; 48598 (12:4598)
--- a/scripts/ceruleanhousetrashed.asm
+++ b/scripts/ceruleanhousetrashed.asm
@@ -10,7 +10,7 @@
 CeruleanHouseTrashedText1: ; 1d68f (7:568f)
 	TX_ASM
 	ld b, $e4
-	predef IsItemInBag_
+	predef GetQuantityOfItemInBag
 	and b
 	jr z, .asm_f8734
 	ld hl, CeruleanHouseTrashedText_1d6b0
--- a/scripts/lab4.asm
+++ b/scripts/lab4.asm
@@ -5,12 +5,11 @@
 	dw Lab4Text1
 	dw Lab4Text2
 
-Lab4Script_75d38: ; 75d38 (1d:5d38)
+Lab4Script_GetFossilsInBag: ; 75d38 (1d:5d38)
 ; construct a list of all fossils in the player's bag
-
 	xor a
-	ld [wcd37], a
-	ld de, wcc5b
+	ld [wFilteredBagItemsCount], a
+	ld de, wFilteredBagItems
 	ld hl, FossilsList
 .loop
 	ld a, [hli]
@@ -20,7 +19,7 @@
 	push de
 	ld [wd11e], a
 	ld b, a
-	predef IsItemInBag_
+	predef GetQuantityOfItemInBag
 	pop de
 	pop hl
 	ld a, b
@@ -32,7 +31,7 @@
 	ld [de], a
 	inc de
 	push hl
-	ld hl, wcd37
+	ld hl, wFilteredBagItemsCount
 	inc [hl]
 	pop hl
 	jr .loop
@@ -53,8 +52,8 @@
 	jr nz, .asm_75d96
 	ld hl, Lab4Text_75dc6
 	call PrintText
-	call Lab4Script_75d38
-	ld a, [wcd37]
+	call Lab4Script_GetFossilsInBag
+	ld a, [wFilteredBagItemsCount]
 	and a
 	jr z, .asm_75d8d
 	callba GiveFossilToCinnabarLab
--- a/scripts/oakslab.asm
+++ b/scripts/oakslab.asm
@@ -449,13 +449,13 @@
 	ld a, [W_XCOORD]
 	cp $4
 	; move left or right depending on where the player is standing
-	jr nz, .asm_1ce5b
-	ld a, $c0
-	jr .asm_1ce5d
-.asm_1ce5b
-	ld a, $80
-.asm_1ce5d
-	ld [wcc5b], a
+	jr nz, .moveLeft
+	ld a, NPC_MOVEMENT_RIGHT
+	jr .next
+.moveLeft
+	ld a, NPC_MOVEMENT_LEFT
+.next
+	ld [wNPCMovementDirections], a
 
 	ld a, $e
 	ld [W_OAKSLABCURSCRIPT], a
@@ -855,7 +855,7 @@
 	ld [hl], SPRITE_FACING_RIGHT
 	ld hl, wd730
 	set 6, [hl]
-	predef StarterDex  ; StarterDex
+	predef StarterDex
 	ld hl, wd730
 	res 6, [hl]
 	call ReloadMapData
--- a/scripts/rockethideoutelevator.asm
+++ b/scripts/rockethideoutelevator.asm
@@ -35,7 +35,7 @@
 	ld hl, RocketHideoutElavatorFloors
 	call LoadItemList
 	ld hl, RocketHideoutElevatorWarpMaps
-	ld de, wcc5b
+	ld de, wElevatorWarpMaps
 	ld bc, RocketHideoutElevatorWarpMapsEnd - RocketHideoutElevatorWarpMaps
 	call CopyData
 	ret
--- a/scripts/route11gateupstairs.asm
+++ b/scripts/route11gateupstairs.asm
@@ -22,12 +22,12 @@
 	ld a, 30 ; pokemon needed
 	ld [hOaksAideRequirement], a
 	ld a, ITEMFINDER ; oak's aide reward
-	ld [hOaksAideItemReward], a
+	ld [hOaksAideRewardItem], a
 	ld [wd11e], a
 	call GetItemName
 	ld h, d
 	ld l, e
-	ld de, wcc5b
+	ld de, wOaksAideRewardItemName
 	ld bc, $000d
 	call CopyData
 	predef OaksAideScript
--- a/scripts/route15gateupstairs.asm
+++ b/scripts/route15gateupstairs.asm
@@ -12,11 +12,11 @@
 	ld a, 50 ; pokemon needed
 	ld [hOaksAideRequirement], a
 	ld a, EXP__ALL ; oak's aide reward
-	ld [hOaksAideItemReward], a
+	ld [hOaksAideRewardItem], a
 	ld [wd11e], a
 	call GetItemName
 	ld hl, wcd6d
-	ld de, wcc5b
+	ld de, wOaksAideRewardItemName
 	ld bc, $000d
 	call CopyData
 	predef OaksAideScript
--- a/scripts/route2gate.asm
+++ b/scripts/route2gate.asm
@@ -12,11 +12,11 @@
 	ld a, 10 ; pokemon needed
 	ld [hOaksAideRequirement], a
 	ld a, HM_05 ; oak's aide reward
-	ld [hOaksAideItemReward], a
+	ld [hOaksAideRewardItem], a
 	ld [wd11e], a
 	call GetItemName
 	ld hl, wcd6d
-	ld de, wcc5b
+	ld de, wOaksAideRewardItemName
 	ld bc, $000d
 	call CopyData
 	predef OaksAideScript
--- a/scripts/silphcoelevator.asm
+++ b/scripts/silphcoelevator.asm
@@ -35,7 +35,7 @@
 	ld hl, SilphCoElavatorFloors
 	call LoadItemList
 	ld hl, SilphCoElevatorWarpMaps
-	ld de, wcc5b
+	ld de, wElevatorWarpMaps
 	ld bc, SilphCoElevatorWarpMapsEnd - SilphCoElevatorWarpMaps
 	call CopyData
 	ret
--- a/scripts/vermilioncity.asm
+++ b/scripts/vermilioncity.asm
@@ -53,7 +53,7 @@
 	CheckEvent EVENT_SS_ANNE_LEFT
 	jr nz, .asm_19810
 	ld b, S_S__TICKET
-	predef IsItemInBag_
+	predef GetQuantityOfItemInBag
 	ld a, b
 	and a
 	ret nz
@@ -171,7 +171,7 @@
 	ld hl, SSAnneWelcomeText9
 	call PrintText
 	ld b, S_S__TICKET
-	predef IsItemInBag_
+	predef GetQuantityOfItemInBag
 	ld a, b
 	and a
 	jr nz, .asm_198e9
--- a/scripts/vermiliondock.asm
+++ b/scripts/vermiliondock.asm
@@ -106,7 +106,7 @@
 	xor a
 	ld [rWY], a
 	ld [hWY], a
-	call VermilionDock_1dc94
+	call VermilionDock_EraseSSAnne
 	ld a, $90
 	ld [hWY], a
 	ld a, $1
@@ -178,21 +178,29 @@
 	jr z, .asm_1dc8e
 	ret
 
-VermilionDock_1dc94: ; 1dc94 (7:5c94)
-	ld hl, wcc5b
-	ld bc, SCREEN_WIDTH * 9
-	ld a, $14
+VermilionDock_EraseSSAnne: ; 1dc94 (7:5c94)
+; Fill the area the S.S. Anne occupies in BG map 0 with water tiles.
+	ld hl, wVermilionDockTileMapBuffer
+	ld bc, (5 * 32) + SCREEN_WIDTH
+	ld a, $14 ; water tile
 	call FillMemory
 	ld hl, vBGMap0 + 10 * 32
-	ld de, wcc5b
-	ld bc, $000c
+	ld de, wVermilionDockTileMapBuffer
+	ld bc, (6 * 32) / 16
 	call CopyVideoData
-	ld hl, wOverworldMap + 10 + 7 * VERMILION_DOCK_WIDTH ; 10, 7
-	ld a, $d
+
+; Replace the blocks of the lower half of the ship with water blocks. This
+; leaves the upper half alone, but that doesn't matter because replacing any of
+; the blocks is unnecessary because the blocks the ship occupies are south of
+; the player and won't be redrawn when the player automatically walks north and
+; exits the map. This code could be removed without affecting anything.
+	ld hl, wOverworldMap + (5 + 3) + (2 + 3) * (VERMILION_DOCK_WIDTH + 6) ; (5, 2)
+	ld a, $d ; water block
 	ld [hli], a
 	ld [hli], a
 	ld [hli], a
 	ld [hl], a
+
 	ld a, SFX_SS_ANNE_HORN
 	call PlaySound
 	ld c, 120
--- a/text.asm
+++ b/text.asm
@@ -100,7 +100,7 @@
 	cont "I'm supposed to"
 	cont "give you an"
 	cont "@"
-	TX_RAM wcc5b
+	TX_RAM wOaksAideRewardItemName
 	text "!"
 
 	para "So, ", $52, "! Have"
@@ -124,7 +124,7 @@
 	text " kinds"
 	line "if you want the"
 	cont "@"
-	TX_RAM wcc5b
+	TX_RAM wOaksAideRewardItemName
 	text "."
 	done
 
@@ -136,7 +136,7 @@
 	db $0
 	line "kinds, come back"
 	cont "for @"
-	TX_RAM wcc5b
+	TX_RAM wOaksAideRewardItemName
 	text "."
 	done
 
@@ -154,7 +154,7 @@
 _OaksAideGotItemText:: ; 802d9 (20:42d9)
 	text $52, " got the"
 	line "@"
-	TX_RAM wcc5b
+	TX_RAM wOaksAideRewardItemName
 	text "!@@"
 
 _OaksAideNoRoomText:: ; 802ec (20:42ec)
@@ -162,7 +162,7 @@
 	line "don't have any"
 	cont "room for the"
 	cont "@"
-	TX_RAM wcc5b
+	TX_RAM wOaksAideRewardItemName
 	text "."
 	done
 
@@ -363,10 +363,10 @@
 
 _DexSeenOwnedText:: ; 8823e (22:423e)
 	text "#DEX   Seen:@"
-	TX_NUM wcc5b, 1, 3
+	TX_NUM wDexRatingNumMonsSeen, 1, 3
 	db $0
 	line "         Owned:@"
-	TX_NUM wcc5c, 1, 3
+	TX_NUM wDexRatingNumMonsOwned, 1, 3
 	db "@"
 
 _DexRatingText:: ; 88267 (22:4267)
@@ -1467,7 +1467,7 @@
 	text "a boosted"
 	cont "@@"
 _ExpPointsText:: ; 89bee (22:5bee)
-	TX_NUM wcf4b, 2, 4
+	TX_NUM wExpAmountGained, 2, 4
 	text " EXP. Points!"
 	prompt
 
--- a/wram.asm
+++ b/wram.asm
@@ -477,6 +477,26 @@
 
 	ds 2
 
+wUnusedCC5B:: ; cc5b
+
+wVermilionDockTileMapBuffer:: ; cc5b
+; 180 bytes
+
+wOaksAideRewardItemName:: ; cc5b
+
+wDexRatingNumMonsSeen:: ; cc5b
+
+wFilteredBagItems:: ; cc5b
+; List of bag items that has been filtered to a certain type of items,
+; such as drinks or fossils.
+
+wElevatorWarpMaps:: ; cc5b
+
+wMonPartySpritesSavedOAM:: ; cc5b
+; Saved copy of OAM for the first frame of the animation to make it easy to
+; flip back from the second frame.
+; $60 bytes
+
 wTrainerCardBlkPacket:: ; cc5b
 ; $40 bytes
 
@@ -493,11 +513,14 @@
 ; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon...
 
 wNPCMovementDirections:: ; cc5b
+	ds 1
 
-wcc5b:: ds 1 ; these upcoming values below are miscellaneous storage values
-wcc5c:: ds 1 ; used in pokedex evaluation as well
-wcc5d:: ds 1 ; used in pokedex evaluation
+wDexRatingNumMonsOwned:: ; cc5c
+	ds 1
 
+wDexRatingText:: ; cc5d
+	ds 1
+
 wSlotMachineSavedROMBank:: ; cc5e
 ; ROM back to return to when the player is done with the slot machine
 	ds 1
@@ -723,8 +746,12 @@
 
 wNPCMovementDirections2Index:: ; cd37
 
-wcd37:: ds 1 ; used in list menus, like the fossil lab menu or drink girl menu. Also used in link menu.
+wUnusedCD37:: ; cd37
 
+wFilteredBagItemsCount:: ; cd37
+; number of items in wFilteredBagItems list
+	ds 1
+
 wSimulatedJoypadStatesIndex:: ; cd38
 ; the next simulated joypad state is at wSimulatedJoypadStatesEnd plus this value minus 1
 ; 0 if the joypad state is not being simulated
@@ -1320,10 +1347,15 @@
 ; $30 bytes
 	ds 29
 
-wcf4b:: ds 1 ; storage buffer for various strings
-wcf4c:: ds 1 ; used with displaying EXP value, probably also overflowed with wcf4b
+wExpAmountGained:: ; cf4b
+; 2-byte big-endian number
+; the total amount of exp a mon gained
+
+wcf4b:: ds 2 ; storage buffer for various strings
+
 wGainBoostedExp:: ; cf4d
 	ds 1
+
 	ds 17
 
 wGymCityName:: ; cf5f