shithub: pokered

Download patch

ref: 07dd7056372288de7bb5b64f9416d741adb3b499
parent: a0ed5bd4aa28745d4d3a47471636d2b9f4235b67
author: YamaArashi <shadow962@live.com>
date: Tue Jul 14 15:46:52 EDT 2015

hall of fame / credits

--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -8,7 +8,7 @@
 
 HOF_MON       EQU $10
 HOF_TEAM      EQU PARTY_LENGTH * HOF_MON
-NUM_HOF_TEAMS EQU 50
+HOF_TEAM_CAPACITY EQU 50
 
 
 A_BUTTON EQU %00000001
--- a/engine/HoF_room_pc.asm
+++ b/engine/HoF_room_pc.asm
@@ -6,10 +6,10 @@
 	call DisableLCD
 	ld hl, vFont
 	ld bc, $800 / 2
-	call Func_74171
+	call ZeroMemory
 	ld hl, vChars2 + $600
 	ld bc, $200 / 2
-	call Func_74171
+	call ZeroMemory
 	ld hl, vChars2 + $7e0
 	ld bc, $10
 	ld a, $ff
@@ -30,12 +30,12 @@
 	call DelayFrames
 	xor a
 	ld [wWhichTrade], a
-	ld [wTrainerEngageDistance], a
+	ld [wNumCreditsMonsDisplayed], a
 	jp Credits
 
-Func_740ba: ; 740ba (1d:40ba)
+FadeInCreditsText: ; 740ba (1d:40ba)
 	ld hl, HoFGBPalettes
-	ld b, $4
+	ld b, 4
 .asm_740bf
 	ld a, [hli]
 	ld [rBGP], a
@@ -52,7 +52,7 @@
 	call FillMiddleOfScreenWithWhite
 
 	; display the next monster from CreditsMons
-	ld hl,wTrainerEngageDistance
+	ld hl,wNumCreditsMonsDisplayed
 	ld c,[hl] ; how many monsters have we displayed so far?
 	inc [hl]
 	ld b,0
@@ -65,62 +65,69 @@
 	call GetMonHeader
 	call LoadFrontSpriteByMonIndex
 	ld hl,vBGMap0 + $c
-	call Func_74164
+	call CopyTileMapToVRAM
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED],a
 	call LoadScreenTilesFromBuffer1
 	ld hl,vBGMap0
-	call Func_74164
+	call CopyTileMapToVRAM
 	ld a,$A7
-	ld [$FF4B],a
+	ld [rWX],a
 	ld hl,vBGMap1
-	call Func_74164
+	call CopyTileMapToVRAM
 	call FillMiddleOfScreenWithWhite
-	ld a,$FC
+	ld a,%11111100 ; make the mon a black silhouette 
 	ld [rBGP],a
+
+; scroll the mon left by one tile 7 times
 	ld bc,7
-.next
-	call Func_74140
+.scrollLoop1
+	call ScrollCreditsMonLeft
 	dec c
-	jr nz,.next
-	ld c,$14
-.next2
-	call Func_74140
-	ld a,[$FF4B]
+	jr nz,.scrollLoop1
+
+; scroll the mon left by one tile 20 times
+; This time, we have to move the window left too in order to hide the text that
+; is wrapping around to the right side of the screen. 
+	ld c,20
+.scrollLoop2
+	call ScrollCreditsMonLeft
+	ld a,[rWX]
 	sub 8
-	ld [$FF4B],a
+	ld [rWX],a
 	dec c
-	jr nz,.next2
+	jr nz,.scrollLoop2
+
 	xor a
 	ld [hWY],a
-	ld a,$C0
+	ld a,%11000000
 	ld [rBGP],a
 	ret
 
 INCLUDE "data/credit_mons.asm"
 
-Func_74140: ; 74140 (1d:4140)
+ScrollCreditsMonLeft: ; 74140 (1d:4140)
 	ld h, b
 	ld l, $20
-	call Func_74152
+	call ScrollCreditsMonLeft_SetSCX
 	ld h, $0
 	ld l, $70
-	call Func_74152
+	call ScrollCreditsMonLeft_SetSCX
 	ld a, b
 	add $8
 	ld b, a
 	ret
 
-Func_74152: ; 74152 (1d:4152)
-	ld a, [$ff44]
+ScrollCreditsMonLeft_SetSCX: ; 74152 (1d:4152)
+	ld a, [rLY]
 	cp l
-	jr nz, Func_74152
+	jr nz, ScrollCreditsMonLeft_SetSCX
 	ld a, h
 	ld [rSCX], a
-.asm_7415a
-	ld a, [$ff44]
+.loop
+	ld a, [rLY]
 	cp h
-	jr z, .asm_7415a
+	jr z, .loop
 	ret
 
 HoFGBPalettes: ; 74160 (1d:4160)
@@ -129,7 +136,7 @@
 	db %11100000
 	db %11110000
 
-Func_74164: ; 74164 (1d:4164)
+CopyTileMapToVRAM: ; 74164 (1d:4164)
 	ld a, l
 	ld [H_AUTOBGTRANSFERDEST], a
 	ld a, h
@@ -138,14 +145,15 @@
 	ld [H_AUTOBGTRANSFERENABLED], a
 	jp Delay3
 
-Func_74171: ; 74171 (1d:4171)
-	ld [hl], $0
+ZeroMemory: ; 74171 (1d:4171)
+; zero bc bytes at hl
+	ld [hl], 0
 	inc hl
 	inc hl
 	dec bc
 	ld a, b
 	or c
-	jr nz, Func_74171
+	jr nz, ZeroMemory
 	ret
 
 FillFourRowsWithBlack: ; 7417b (1d:417b)
@@ -162,26 +170,26 @@
 Credits: ; 7418e (1d:418e)
 	ld de, CreditsOrder
 	push de
-.asm_74192
+.nextCreditsScreen
 	pop de
 	hlCoord 9, 6
 	push hl
 	call FillMiddleOfScreenWithWhite
 	pop hl
-.asm_7419b
+.nextCreditsCommand
 	ld a, [de]
 	inc de
 	push de
 	cp $ff
-	jr z, .asm_741d5
+	jr z, .fadeInTextAndShowMon
 	cp $fe
-	jr z, .asm_741dc
+	jr z, .showTextAndShowMon
 	cp $fd
-	jr z, .asm_741e6
+	jr z, .fadeInText
 	cp $fc
-	jr z, .asm_741ed
+	jr z, .showText
 	cp $fb
-	jr z, .asm_741f4
+	jr z, .showCopyrightText
 	cp $fa
 	jr z, .showTheEnd
 	push hl
@@ -189,7 +197,7 @@
 	ld hl, CreditsTextPointers
 	add a
 	ld c, a
-	ld b, $0
+	ld b, 0
 	add hl, bc
 	ld e, [hl]
 	inc hl
@@ -205,32 +213,32 @@
 	ld bc, SCREEN_WIDTH * 2
 	add hl, bc
 	pop de
-	jr .asm_7419b
-.asm_741d5
-	call Func_740ba
+	jr .nextCreditsCommand
+.fadeInTextAndShowMon
+	call FadeInCreditsText
 	ld c, 90
-	jr .asm_741de
-.asm_741dc
+	jr .next1
+.showTextAndShowMon
 	ld c, 110
-.asm_741de
+.next1
 	call DelayFrames
 	call DisplayCreditsMon
-	jr .asm_74192
-.asm_741e6
-	call Func_740ba
+	jr .nextCreditsScreen
+.fadeInText
+	call FadeInCreditsText
 	ld c, 120
-	jr .asm_741ef
-.asm_741ed
+	jr .next2
+.showText
 	ld c, 140
-.asm_741ef
+.next2
 	call DelayFrames
-	jr .asm_74192
-.asm_741f4
+	jr .nextCreditsScreen
+.showCopyrightText
 	push de
 	callba LoadCopyrightTiles
 	pop de
 	pop de
-	jr .asm_7419b
+	jr .nextCreditsCommand
 .showTheEnd
 	ld c, 16
 	call DelayFrames
@@ -246,7 +254,7 @@
 	hlCoord 4, 9
 	inc de
 	call PlaceString
-	jp Func_740ba
+	jp FadeInCreditsText
 
 TheEndTextString: ; 74229 (1d:4229)
 ; "T H E  E N D"
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -1973,7 +1973,7 @@
 	push hl
 .asm_79680
 	call Func_796ae
-	ld a, [$ff44]
+	ld a, [rLY]
 	cp e
 	jr nz, .asm_79680
 	pop hl
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6856,7 +6856,7 @@
 InitBattleCommon: ; 3ef3d (f:6f3d)
 	ld a, [wMapPalOffset]
 	push af
-	ld hl, wd358
+	ld hl, wLetterPrintingDelayFlags
 	ld a, [hl]
 	push af
 	res 1, [hl]
@@ -6963,7 +6963,7 @@
 	call StartBattle
 	callab EndOfBattle
 	pop af
-	ld [wd358], a
+	ld [wLetterPrintingDelayFlags], a
 	pop af
 	ld [wMapPalOffset], a
 	ld a, [wd0d4]
--- a/engine/hall_of_fame.asm
+++ b/engine/hall_of_fame.asm
@@ -1,5 +1,5 @@
 AnimateHallOfFame: ; 701a0 (1c:41a0)
-	call Func_70423
+	call HoFFadeOutScreenAndMusic
 	call ClearScreen
 	ld c, 100
 	call DelayFrames
@@ -21,16 +21,16 @@
 	ld [wUpdateSpritesEnabled], a
 	ld [hTilesetType], a
 	ld [W_SPRITEFLIPPED], a
-	ld [wd358], a
-	ld [wTrainerScreenY], a
+	ld [wLetterPrintingDelayFlags], a ; no delay
+	ld [wHoFMonOrPlayer], a ; mon
 	inc a
 	ld [H_AUTOBGTRANSFERENABLED], a
-	ld hl, wd5a2
+	ld hl, wNumHoFTeams
 	ld a, [hl]
 	inc a
-	jr z, .asm_701eb
+	jr z, .skipInc ; don't wrap around to 0
 	inc [hl]
-.asm_701eb
+.skipInc
 	ld a, $90
 	ld [hWY], a
 	ld c, BANK(Music_HallOfFame)
@@ -38,23 +38,23 @@
 	call PlayMusic
 	ld hl, wPartySpecies
 	ld c, $ff
-.asm_701fb
+.partyMonLoop
 	ld a, [hli]
 	cp $ff
-	jr z, .asm_70241
+	jr z, .doneShowingParty
 	inc c
 	push hl
 	push bc
-	ld [wWhichTrade], a
+	ld [wHoFMonSpecies], a
 	ld a, c
-	ld [wTrainerEngageDistance], a
+	ld [wHoFPartyMonIndex], a
 	ld hl, wPartyMon1Level
 	ld bc, wPartyMon2 - wPartyMon1
 	call AddNTimes
 	ld a, [hl]
-	ld [wTrainerFacingDirection], a
-	call Func_70278
-	call Func_702e1
+	ld [wHoFMonLevel], a
+	call HoFShowMonOrPlayer
+	call HoFDisplayAndRecordMonInfo
 	ld c, 80
 	call DelayFrames
 	hlCoord 2, 13
@@ -69,8 +69,8 @@
 	call GBFadeOutToWhite
 	pop bc
 	pop hl
-	jr .asm_701fb
-.asm_70241
+	jr .partyMonLoop
+.doneShowingParty
 	ld a, c
 	inc a
 	ld hl, wHallOfFame
@@ -79,12 +79,12 @@
 	ld [hl], $ff
 	call SaveHallOfFameTeams
 	xor a
-	ld [wWhichTrade], a
+	ld [wHoFMonSpecies], a
 	inc a
-	ld [wTrainerScreenY], a
-	call Func_70278
+	ld [wHoFMonOrPlayer], a ; player
+	call HoFShowMonOrPlayer
 	call HoFDisplayPlayerStats
-	call Func_70423
+	call HoFFadeOutScreenAndMusic
 	xor a
 	ld [hWY], a
 	ld hl, rLCDC
@@ -94,69 +94,72 @@
 HallOfFameText: ; 7026b (1c:426b)
 	db "HALL OF FAME@"
 
-Func_70278: ; 70278 (1c:4278)
+HoFShowMonOrPlayer: ; 70278 (1c:4278)
 	call ClearScreen
 	ld a, $d0
 	ld [hSCY], a
 	ld a, $c0
 	ld [hSCX], a
-	ld a, [wWhichTrade]
+	ld a, [wHoFMonSpecies]
 	ld [wcf91], a
 	ld [wd0b5], a
 	ld [wBattleMonSpecies2], a
 	ld [wcf1d], a
-	ld a, [wTrainerScreenY]
+	ld a, [wHoFMonOrPlayer]
 	and a
-	jr z, .asm_7029d
+	jr z, .showMon
+; show player
 	call HoFLoadPlayerPics
-	jr .asm_702ab
-.asm_7029d
+	jr .next1
+.showMon
 	hlCoord 12, 5
 	call GetMonHeader
 	call LoadFrontSpriteByMonIndex
 	predef LoadMonBackPic
-.asm_702ab
+.next1
 	ld b, $b
 	ld c, $0
 	call GoPAL_SET
-	ld a, $e4
+	ld a, %11100100
 	ld [rBGP], a
-	ld c, $31
-	call Func_7036d
+	ld c, $31 ; back pic
+	call HoFLoadMonPlayerPicTileIDs
 	ld d, $a0
-	ld e, $4
+	ld e, 4
 	ld a, [wOnSGB]
 	and a
-	jr z, .asm_702c7
-	sla e
-.asm_702c7
-	call .asm_702d5
+	jr z, .next2
+	sla e ; scroll more slowly on SGB
+.next2
+	call .ScrollPic ; scroll back pic left
 	xor a
 	ld [hSCY], a
-	ld c, a
-	call Func_7036d
-	ld d, $0
-	ld e, $fc
-.asm_702d5
+	ld c, a ; front pic
+	call HoFLoadMonPlayerPicTileIDs
+	ld d, 0
+	ld e, -4
+; scroll front pic right
+
+.ScrollPic
 	call DelayFrame
 	ld a, [hSCX]
 	add e
 	ld [hSCX], a
 	cp d
-	jr nz, .asm_702d5
+	jr nz, .ScrollPic
 	ret
 
-Func_702e1: ; 702e1 (1c:42e1)
-	ld a, [wTrainerEngageDistance]
+HoFDisplayAndRecordMonInfo: ; 702e1 (1c:42e1)
+	ld a, [wHoFPartyMonIndex]
 	ld hl, wPartyMonNicks
 	call GetPartyMonName
-	call Func_702f0
-	jp Func_70404
+	call HoFDisplayMonInfo
+	jp HoFRecordMonInfo
 
-Func_702f0: ; 702f0 (1c:42f0)
+HoFDisplayMonInfo: ; 702f0 (1c:42f0)
 	hlCoord 0, 2
-	ld b, $9
-	ld c, $a
+	ld b, 9
+	ld c, 10
 	call TextBoxBorder
 	hlCoord 2, 6
 	ld de, HoFMonInfoText
@@ -164,14 +167,14 @@
 	hlCoord 1, 4
 	ld de, wcd6d
 	call PlaceString
-	ld a, [wTrainerFacingDirection]
+	ld a, [wHoFMonLevel]
 	hlCoord 8, 7
 	call PrintLevelCommon
-	ld a, [wWhichTrade]
+	ld a, [wHoFMonSpecies]
 	ld [wd0b5], a
 	hlCoord 3, 9
 	predef PrintMonType
-	ld a, [wWhichTrade]
+	ld a, [wHoFMonSpecies]
 	jp PlayCry
 
 HoFMonInfoText: ; 70329 (1c:4329)
@@ -197,8 +200,9 @@
 	call InterlaceMergeSpriteBuffers
 	ld c, $1
 
-Func_7036d: ; 7036d (1c:436d)
-	ld b, $0
+HoFLoadMonPlayerPicTileIDs: ; 7036d (1c:436d)
+; c = base tile ID
+	ld b, 0
 	hlCoord 12, 5
 	predef_jump CopyTileIDsFromList
 
@@ -261,14 +265,14 @@
 	TX_FAR _DexRatingText
 	db "@"
 
-Func_70404: ; 70404 (1c:4404)
+HoFRecordMonInfo: ; 70404 (1c:4404)
 	ld hl, wHallOfFame
 	ld bc, HOF_MON
-	ld a, [wTrainerEngageDistance]
+	ld a, [wHoFPartyMonIndex]
 	call AddNTimes
-	ld a, [wWhichTrade]
+	ld a, [wHoFMonSpecies]
 	ld [hli], a
-	ld a, [wTrainerFacingDirection]
+	ld a, [wHoFMonLevel]
 	ld [hli], a
 	ld e, l
 	ld d, h
@@ -276,7 +280,7 @@
 	ld bc, $b
 	jp CopyData
 
-Func_70423: ; 70423 (1c:4423)
+HoFFadeOutScreenAndMusic: ; 70423 (1c:4423)
 	ld a, $a
 	ld [wcfc8], a
 	ld [wcfc9], a
--- a/engine/menu/bills_pc.asm
+++ b/engine/menu/bills_pc.asm
@@ -2,13 +2,13 @@
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED], a
 	call SaveScreenTilesToBuffer2
-	ld a, [wd5a2]
+	ld a, [wNumHoFTeams]
 	and a
 	jr nz, .asm_213f3
 	ld a, [wd74b]
 	bit 5, a
 	jr z, .asm_213ea
-	ld a, [wd5a2]
+	ld a, [wNumHoFTeams]
 	and a
 	jr nz, .asm_213f3
 	hlCoord 0, 0
@@ -53,7 +53,7 @@
 	hlCoord 2, 6
 	ld de, OaksPCText
 	call PlaceString
-	ld a, [wd5a2]
+	ld a, [wNumHoFTeams]
 	and a
 	jr z, .asm_2145a
 	ld a, $4
--- a/engine/menu/league_pc.asm
+++ b/engine/menu/league_pc.asm
@@ -13,30 +13,32 @@
 	ld [W_SPRITEFLIPPED], a
 	ld [wUpdateSpritesEnabled], a
 	ld [wTrainerScreenX], a
-	ld [wcd42], a
-	ld a, [wd5a2]
+	ld [wHoFTeamNo], a
+	ld a, [wNumHoFTeams]
 	ld b, a
-	cp NUM_HOF_TEAMS + 1
-	jr c, .first
-	ld b, NUM_HOF_TEAMS
+	cp HOF_TEAM_CAPACITY + 1
+	jr c, .loop
+; If the total number of hall of fame teams is greater than the storage
+; capacity, then calculate the number of the first team that is still recorded.
+	ld b, HOF_TEAM_CAPACITY
 	sub b
-	ld [wcd42], a
-.first
-	ld hl, wcd42
+	ld [wHoFTeamNo], a
+.loop
+	ld hl, wHoFTeamNo
 	inc [hl]
 	push bc
 	ld a, [wTrainerScreenX]
-	ld [wWhichTrade], a
+	ld [wHoFMonSpecies], a
 	callba LoadHallOfFameTeams
-	call Func_765e5
+	call LeaguePCShowTeam
 	pop bc
-	jr c, .second
+	jr c, .doneShowingTeams
 	ld hl, wTrainerScreenX
 	inc [hl]
 	ld a, [hl]
 	cp b
-	jr nz, .first
-.second
+	jr nz, .loop
+.doneShowingTeams
 	pop af
 	ld [hTilesetType], a
 	pop af
@@ -48,11 +50,11 @@
 	call GoPAL_SET_CF1C
 	jp GBPalNormal
 
-Func_765e5: ; 765e5 (1d:65e5)
+LeaguePCShowTeam: ; 765e5 (1d:65e5)
 	ld c, PARTY_LENGTH
 .loop
 	push bc
-	call Func_76610
+	call LeaguePCShowMon
 	call WaitForTextScrollButtonPress
 	ld a, [hJoyHeld]
 	bit 1, a
@@ -75,18 +77,18 @@
 	scf
 	ret
 
-Func_76610: ; 76610 (1d:6610)
+LeaguePCShowMon: ; 76610 (1d:6610)
 	call GBPalWhiteOutWithDelay3
 	call ClearScreen
 	ld hl, wHallOfFame
 	ld a, [hli]
-	ld [wWhichTrade], a
+	ld [wHoFMonSpecies], a
 	ld [wcf91], a
 	ld [wd0b5], a
 	ld [wBattleMonSpecies2], a
 	ld [wcf1d], a
 	ld a, [hli]
-	ld [wTrainerFacingDirection], a
+	ld [wHoFMonLevel], a
 	ld de, wcd6d
 	ld bc, $000B
 	call CopyData
@@ -105,11 +107,11 @@
 	ld de, HallOfFameNoText
 	call PlaceString
 	hlCoord 16, 15
-	ld de, wcd42
+	ld de, wHoFTeamNo
 	ld bc, $0103
 	call PrintNumber
-	ld b, BANK(Func_702f0)
-	ld hl, Func_702f0
+	ld b, BANK(HoFDisplayMonInfo)
+	ld hl, HoFDisplayMonInfo
 	jp Bankswitch
 
 HallOfFameNoText: ; 76670 (1d:6670)
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -109,7 +109,7 @@
 	ld [wd52a],a
 	ld c,10
 	call DelayFrames
-	ld a,[wd5a2]
+	ld a,[wNumHoFTeams]
 	and a
 	jp z,SpecialEnterMap
 	ld a,[W_CURMAP] ; map ID
@@ -124,7 +124,7 @@
 
 Func_5bff: ; 5bff (1:5bff)
 	ld a,1
-	ld [wd358],a
+	ld [wLetterPrintingDelayFlags],a
 	ld a,3
 	ld [W_OPTIONS],a
 	ret
@@ -131,7 +131,7 @@
 
 LinkMenu: ; 5c0a (1:5c0a)
 	xor a
-	ld [wd358], a
+	ld [wLetterPrintingDelayFlags], a
 	ld hl, wd72e
 	set 6, [hl]
 	ld hl, TextTerminator_6b20
@@ -452,7 +452,7 @@
 	ld [wCurrentMenuItem],a
 	ld [wLastMenuItem],a
 	inc a
-	ld [wd358],a
+	ld [wLetterPrintingDelayFlags],a
 	ld [wTrainerScreenY],a
 	ld a,3 ; text speed cursor Y coordinate
 	ld [wTopMenuItemY],a
--- a/engine/oak_speech.asm
+++ b/engine/oak_speech.asm
@@ -1,5 +1,5 @@
 SetDefaultNames: ; 60ca (1:60ca)
-	ld a, [wd358]
+	ld a, [wLetterPrintingDelayFlags]
 	push af
 	ld a, [W_OPTIONS]
 	push af
@@ -18,7 +18,7 @@
 	pop af
 	ld [W_OPTIONS], a
 	pop af
-	ld [wd358], a
+	ld [wLetterPrintingDelayFlags], a
 	ld a, [wd08a]
 	and a
 	call z, Func_5bff
@@ -193,7 +193,7 @@
 
 MovePicLeft: ; 6288 (1:6288)
 	ld a,119
-	ld [$FF4B],a
+	ld [rWX],a
 	call DelayFrame
 
 	ld a,$E4
@@ -200,11 +200,11 @@
 	ld [rBGP],a
 .next
 	call DelayFrame
-	ld a,[$FF4B]
+	ld a,[rWX]
 	sub 8
 	cp $FF
 	ret z
-	ld [$FF4B],a
+	ld [rWX],a
 	jr .next
 
 Predef3B: ; 62a1 (1:62a1)
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -26,7 +26,7 @@
 	db "@"
 
 .asm_ef82
-	ld [wcd4d], a
+	ld [wCutTile], a
 	ld a, $1
 	ld [wcd6a], a
 	ld a, [wWhichPokemon]
@@ -76,7 +76,7 @@
 	ld [wWhichAnimationOffsets], a
 	ld a, $e4
 	ld [rOBP1], a
-	ld a, [wcd4d]
+	ld a, [wCutTile]
 	cp $52
 	jr z, .asm_f020
 	ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row
--- a/engine/overworld/cut2.asm
+++ b/engine/overworld/cut2.asm
@@ -1,5 +1,5 @@
 Func_79e96: ; 79e96 (1e:5e96)
-	ld a, [wcd4d]
+	ld a, [wCutTile]
 	cp $52
 	jr z, .asm_79ec8
 	ld c, $8
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -620,9 +620,9 @@
 	ret
 
 SaveHallOfFameTeams: ; 73b0d (1c:7b0d)
-	ld a, [wd5a2]
+	ld a, [wNumHoFTeams]
 	dec a
-	cp NUM_HOF_TEAMS
+	cp HOF_TEAM_CAPACITY
 	jr nc, .asm_73b28
 	ld hl, sHallOfFame
 	ld bc, HOF_TEAM
@@ -636,10 +636,10 @@
 .asm_73b28
 	ld hl, sHallOfFame + HOF_TEAM
 	ld de, sHallOfFame
-	ld bc, HOF_TEAM * (NUM_HOF_TEAMS - 1)
+	ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1)
 	call HallOfFame_Copy
 	ld hl, wcc5b
-	ld de, sHallOfFame + HOF_TEAM * (NUM_HOF_TEAMS - 1)
+	ld de, sHallOfFame + HOF_TEAM * (HOF_TEAM_CAPACITY - 1)
 	ld bc, HOF_TEAM
 	jr HallOfFame_Copy
 
--- a/engine/titlescreen.asm
+++ b/engine/titlescreen.asm
@@ -12,7 +12,7 @@
 	call CopyFixedLengthText
 	xor a
 	ld [hWY], a
-	ld [wd358], a
+	ld [wLetterPrintingDelayFlags], a
 	ld hl, wd732
 	ld [hli], a
 	ld [hli], a
@@ -284,7 +284,7 @@
 
 Func_44cf: ; 44cf (1:44cf)
 .wait
-	ld a, [$ff44] ; rLY
+	ld a, [rLY]
 	cp l
 	jr nz, .wait
 
@@ -292,7 +292,7 @@
 	ld [rSCX], a
 
 .wait2
-	ld a, [$ff44] ; rLY
+	ld a, [rLY]
 	cp h
 	jr z, .wait2
 	ret
--- a/engine/titlescreen2.asm
+++ b/engine/titlescreen2.asm
@@ -69,7 +69,7 @@
 
 .ScrollBetween ; 37292 (d:7292)
 .wait
-	ld a, [$ff44] ; rLY
+	ld a, [rLY] ; rLY
 	cp l
 	jr nz, .wait
 
@@ -77,7 +77,7 @@
 	ld [rSCX], a
 
 .wait2
-	ld a, [$ff44] ; rLY
+	ld a, [rLY] ; rLY
 	cp h
 	jr z, .wait2
 	ret
--- a/home.asm
+++ b/home.asm
@@ -3538,18 +3538,18 @@
 
 ; This function is used to wait a short period after printing a letter to the
 ; screen unless the player presses the A/B button or the delay is turned off
-; through the [wd730] or [wd358] flags.
+; through the [wd730] or [wLetterPrintingDelayFlags] flags.
 PrintLetterDelay:: ; 38d3 (0:38d3)
 	ld a,[wd730]
 	bit 6,a
 	ret nz
-	ld a,[wd358]
+	ld a,[wLetterPrintingDelayFlags]
 	bit 1,a
 	ret z
 	push hl
 	push de
 	push bc
-	ld a,[wd358]
+	ld a,[wLetterPrintingDelayFlags]
 	bit 0,a
 	jr z,.waitOneFrame
 	ld a,[W_OPTIONS]
--- a/home/init.asm
+++ b/home/init.asm
@@ -27,7 +27,7 @@
 	ld [$ff42], a
 	ld [rSB], a
 	ld [rSC], a
-	ld [$ff4b], a
+	ld [rWX], a
 	ld [$ff4a], a
 	ld [$ff06], a
 	ld [$ff07], a
--- a/home/text.asm
+++ b/home/text.asm
@@ -368,13 +368,13 @@
 	ret
 
 TextCommandProcessor:: ; 1b40 (0:1b40)
-	ld a,[wd358]
+	ld a,[wLetterPrintingDelayFlags]
 	push af
 	set 1,a
 	ld e,a
 	ld a,[$fff4]
 	xor e
-	ld [wd358],a
+	ld [wLetterPrintingDelayFlags],a
 	ld a,c
 	ld [wcc3a],a
 	ld a,b
@@ -385,7 +385,7 @@
 	cp a, "@" ; terminator
 	jr nz,.doTextCommand
 	pop af
-	ld [wd358],a
+	ld [wLetterPrintingDelayFlags],a
 	ret
 .doTextCommand
 	push hl
--- a/scripts/halloffameroom.asm
+++ b/scripts/halloffameroom.asm
@@ -21,13 +21,13 @@
 
 HallofFameRoomScript2: ; 5a4bb (16:64bb)
 	call Delay3
-	ld a, [wd358]
+	ld a, [wLetterPrintingDelayFlags]
 	push af
 	xor a
 	ld [wJoyIgnore], a
 	predef HallOfFamePC
 	pop af
-	ld [wd358], a
+	ld [wLetterPrintingDelayFlags], a
 	ld hl, W_FLAGS_D733
 	res 1, [hl]
 	inc hl
--- a/scripts/vermiliondock.asm
+++ b/scripts/vermiliondock.asm
@@ -167,13 +167,13 @@
 	ld h, $0
 	ld l, $80
 .asm_1dc86
-	ld a, [$ff44]
+	ld a, [rLY]
 	cp l
 	jr nz, .asm_1dc86
 	ld a, h
 	ld [$ff43], a
 .asm_1dc8e
-	ld a, [$ff44]
+	ld a, [rLY]
 	cp h
 	jr z, .asm_1dc8e
 	ret
--- a/sram.asm
+++ b/sram.asm
@@ -6,7 +6,7 @@
 
 	ds $100
 
-sHallOfFame:: ds HOF_TEAM * NUM_HOF_TEAMS ; a598
+sHallOfFame:: ds HOF_TEAM * HOF_TEAM_CAPACITY ; a598
 
 
 SECTION "Save Data", SRAM, BANK[1]
--- a/wram.asm
+++ b/wram.asm
@@ -601,6 +601,8 @@
 
 	ds 1
 
+wHoFMonSpecies:: ; cd3d
+
 wFieldMoves:: ; cd3d
 ; 4 bytes
 ; the current mon's field moves
@@ -642,6 +644,11 @@
 wTrainerSpriteOffset:: ; cd3d
 	ds 1
 
+wHoFPartyMonIndex:: ; cd3e
+
+wNumCreditsMonsDisplayed:: ; cd3e
+; the number of credits mons that have been displayed so far
+
 wBadgeNameTile:: ; cd3e
 ; first tile ID of the name being drawn
 
@@ -665,6 +672,8 @@
 wTrainerEngageDistance:: ; cd3e
 	ds 1
 
+wHoFMonLevel:: ; cd3f
+
 wBadgeOrFaceTiles:: ; cd3f
 ; 8 bytes
 ; a list of the first tile IDs of each badge or face (depending on whether the
@@ -686,6 +695,11 @@
 wcd3f:: ; used with daycare text for money amount
 	ds 1
 
+wHoFMonOrPlayer:: ; cd40
+; show mon or show player?
+; 0 = mon
+; 1 = player
+
 wSlotMachineWheel3Offset:: ; cd40
 
 wPlayerSpinInPlaceAnimSoundID:: ; cd40
@@ -710,6 +724,8 @@
 	ds 1
 ; a lot of the uses for these values use more than the said address
 
+wHoFTeamNo:: ; cd42
+
 wSlotMachineWheel1MiddleTile:: ; cd42
 
 wFieldMovesLeftmostXCoord:: ; cd42
@@ -776,7 +792,10 @@
 wSlotMachineWheel1SlipCounter:: ; cd4d
 ; wheel 1 can "slip" while this is non-zero
 
-wcd4d:: ds 1 ; used with cut and slot machine
+wCutTile:: ; cd4d
+; $3d = tree tile
+; $52 = grass tile
+	ds 1
 
 wSlotMachineWheel2SlipCounter:: ; cd4e
 ; wheel 2 can "slip" while this is non-zero
@@ -1695,7 +1714,12 @@
 
 	ds 1
 
-wd358:: ds 1 ; bit 0 set = no delay when printing text (W_OPTIONS is still checked though)
+wLetterPrintingDelayFlags:: ; d358
+; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if
+;        the delay has been disabled entirely through bit 1 of this variable
+;        or bit 6 of wd730.
+; bit 1: If 0, no delay.
+	ds 1
 
 wPlayerID:: ; d359
 	ds 2
@@ -1904,7 +1928,11 @@
 	ds 1 ; end
 
 wd5a0:: ds 2 ; current box number
-wd5a2:: ds 1 ; number of HOF teams
+
+wNumHoFTeams:: ; d5a2
+; number of HOF teams
+	ds 1
+
 wd5a3:: ds 1 ; unused? (written to when loading map data)
 
 wPlayerCoins:: ; d5a4