shithub: pokered

Download patch

ref: c169073eed4f0362ef42170098a141a2fcbd71d0
parent: b96ef8d2d495b8c39f703742e8c1965c774fc54f
author: YamaArashi <shadow962@live.com>
date: Sat Jul 18 16:49:52 EDT 2015

misc

--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -10,7 +10,6 @@
 HOF_TEAM      EQU PARTY_LENGTH * HOF_MON
 HOF_TEAM_CAPACITY EQU 50
 
-
 A_BUTTON EQU %00000001
 B_BUTTON EQU %00000010
 SELECT   EQU %00000100
--- a/engine/HoF_room_pc.asm
+++ b/engine/HoF_room_pc.asm
@@ -29,7 +29,7 @@
 	ld c, 128
 	call DelayFrames
 	xor a
-	ld [wWhichTrade], a
+	ld [wNumCreditsMonsDisplayed - 1], a ; not read
 	ld [wNumCreditsMonsDisplayed], a
 	jp Credits
 
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -796,9 +796,9 @@
 	dec a
 	ret nz
 ; if it's the end of the ball shaking subanimation, check if more shakes are left and restart the subanimation
-	ld a,[wWhichTrade] ; number of shakes
+	ld a,[wNumShakes] ; number of shakes
 	dec a ; decrement number of shakes
-	ld [wWhichTrade],a
+	ld [wNumShakes],a
 	ret z
 ; if there are shakes left, restart the subanimation
 	ld a,[W_SUBANIMSUBENTRYADDR]
@@ -1998,11 +1998,11 @@
 	ret
 
 Func_796ae: ; 796ae (1e:56ae)
-	ld a, [$ff41]
+	ld a, [rSTAT]
 	and $3
 	jr nz, Func_796ae
 	ld a, [hl]
-	ld [$ff43], a
+	ld [rSCX], a
 	inc hl
 	ld a, [hl]
 	cp d
@@ -2895,7 +2895,7 @@
 	; store these for later
 	ld a,b
 	and a,$F
-	ld [wWhichTrade],a
+	ld [wNumShakes],a
 
 	ld hl,.PokeBallAnimations
 	; choose which toss animation to use
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6298,7 +6298,7 @@
 	dec de
 	dec de
 	xor a
-	ld [wHPBarMaxHP], a
+	ld [wLearningMovesFromDayCare], a
 	predef WriteMonMoves ; get moves based on current level
 .loadMovePPs
 	ld hl, wEnemyMonMoves
--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -254,7 +254,7 @@
 	ld a, [wd0b5]
 	ld [wd11e], a
 	predef LearnMoveFromLevelUp
-	ld hl, wccd3
+	ld hl, wCanEvolveFlags
 	ld a, [wWhichPokemon]
 	ld c, a
 	ld b, $1
--- a/engine/battle/init_battle_variables.asm
+++ b/engine/battle/init_battle_variables.asm
@@ -19,7 +19,7 @@
 	ld hl, wcf1d
 	ld [hli], a
 	ld [hl], a
-	ld hl, wccd3
+	ld hl, wCanEvolveFlags
 	ld b, $3c
 .loop
 	ld [hli], a
--- a/engine/cable_club.asm
+++ b/engine/cable_club.asm
@@ -297,7 +297,7 @@
 	ld b, 0
 	ld a, [wTradeCenterPointerTableIndex]
 	cp $ff
-	jp z, LoadTitlescreenGraphics
+	jp z, DisplayTitleScreen
 	add a
 	ld c, a
 	add hl, bc
--- a/engine/evolution.asm
+++ b/engine/evolution.asm
@@ -20,11 +20,11 @@
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED], a
 	ld [hTilesetType], a
-	ld a, [wHPBarMaxHP]
+	ld a, [wEvoOldSpecies]
 	ld [wcf1d], a
 	ld c, $0
 	call EvolutionSetWholeScreenPalette
-	ld a, [wHPBarMaxHP + 1]
+	ld a, [wEvoNewSpecies]
 	ld [wcf91], a
 	ld [wd0b5], a
 	call Evolution_LoadPic
@@ -32,13 +32,13 @@
 	ld hl, vBackPic
 	ld bc, 7 * 7
 	call CopyVideoData
-	ld a, [wHPBarMaxHP]
+	ld a, [wEvoOldSpecies]
 	ld [wcf91], a
 	ld [wd0b5], a
 	call Evolution_LoadPic
 	ld a, $1
 	ld [H_AUTOBGTRANSFERENABLED], a
-	ld a, [wHPBarMaxHP]
+	ld a, [wEvoOldSpecies]
 	call PlayCry
 	call WaitForSoundToFinish
 	ld c, BANK(Music_SafariZone)
@@ -49,23 +49,23 @@
 	ld c, $1
 	call EvolutionSetWholeScreenPalette
 	ld bc, $110
-.asm_7be63
+.animLoop
 	push bc
 	call Evolution_CheckForCancel
 	jr c, .evolutionCancelled
-	call Func_7bec2
+	call Evolution_BackAndForthAnim
 	pop bc
 	inc b
 	dec c
 	dec c
-	jr nz, .asm_7be63
+	jr nz, .animLoop
 	xor a
-	ld [wHPBarOldHP + 1], a
+	ld [wEvoCancelled], a
 	ld a, $31
-	ld [wHPBarOldHP], a
-	call Func_7bed6
-	ld a, [wHPBarMaxHP + 1]
-.afterCancellation
+	ld [wEvoMonTileOffset], a
+	call Evolution_ChangeMonPic ; show the new species pic
+	ld a, [wEvoNewSpecies]
+.done
 	ld [wcf1d], a
 	ld a, $ff
 	ld [wc0ee], a
@@ -81,7 +81,7 @@
 	pop bc
 	pop de
 	pop hl
-	ld a, [wHPBarOldHP + 1]
+	ld a, [wEvoCancelled]
 	and a
 	ret z
 	scf
@@ -88,10 +88,10 @@
 	ret
 .evolutionCancelled
 	pop bc
-	ld a, $1
-	ld [wHPBarOldHP + 1], a
-	ld a, [wHPBarMaxHP]
-	jr .afterCancellation
+	ld a, 1
+	ld [wEvoCancelled], a
+	ld a, [wEvoOldSpecies]
+	jr .done
 
 EvolutionSetWholeScreenPalette: ; 7beb4 (1e:7eb4)
 	ld b, $b
@@ -102,37 +102,38 @@
 	coord hl, 7, 2
 	jp LoadFlippedFrontSpriteByMonIndex
 
-Func_7bec2: ; 7bec2 (1e:7ec2)
+Evolution_BackAndForthAnim: ; 7bec2 (1e:7ec2)
+; show the mon change back and forth between the new and old species b times
 	ld a, $31
-	ld [wHPBarOldHP], a
-	call Func_7bed6
-	ld a, $cf
-	ld [wHPBarOldHP], a
-	call Func_7bed6
+	ld [wEvoMonTileOffset], a
+	call Evolution_ChangeMonPic
+	ld a, -$31
+	ld [wEvoMonTileOffset], a
+	call Evolution_ChangeMonPic
 	dec b
-	jr nz, Func_7bec2
+	jr nz, Evolution_BackAndForthAnim
 	ret
 
-Func_7bed6: ; 7bed6 (1e:7ed6)
+Evolution_ChangeMonPic: ; 7bed6 (1e:7ed6)
 	push bc
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED], a
 	coord hl, 7, 2
-	ld bc, $707
-	ld de, $d
-.asm_7bee3
+	lb bc, 7, 7
+	ld de, SCREEN_WIDTH - 7
+.loop
 	push bc
-.asm_7bee4
-	ld a, [wHPBarOldHP]
+.innerLoop
+	ld a, [wEvoMonTileOffset]
 	add [hl]
 	ld [hli], a
 	dec c
-	jr nz, .asm_7bee4
+	jr nz, .innerLoop
 	pop bc
 	add hl, de
 	dec b
-	jr nz, .asm_7bee3
-	ld a, $1
+	jr nz, .loop
+	ld a, 1
 	ld [H_AUTOBGTRANSFERENABLED], a
 	call Delay3
 	pop bc
--- a/engine/evos_moves.asm
+++ b/engine/evos_moves.asm
@@ -1,6 +1,6 @@
 ; try to evolve the mon in [wWhichPokemon]
 TryEvolvingMon: ; 3ad0e (e:6d0e)
-	ld hl, wccd3
+	ld hl, wCanEvolveFlags
 	xor a
 	ld [hl], a
 	ld a, [wWhichPokemon]
@@ -31,17 +31,17 @@
 	ld a, [hl]
 	cp $ff ; have we reached the end of the party?
 	jp z, .done
-	ld [wHPBarMaxHP], a
+	ld [wEvoOldSpecies], a
 	push hl
 	ld a, [wWhichPokemon]
 	ld c, a
-	ld hl, wccd3
+	ld hl, wCanEvolveFlags
 	ld b, $2
 	call Evolution_FlagAction
 	ld a, c
 	and a ; is the mon's bit set?
 	jp z, Evolution_PartyMonLoop ; if not, go to the next mon
-	ld a, [wHPBarMaxHP]
+	ld a, [wEvoOldSpecies]
 	dec a
 	ld b, 0
 	ld hl, EvosMovesPointerTable
@@ -110,7 +110,7 @@
 	ld [wd121], a
 	push hl
 	ld a, [hl]
-	ld [wHPBarMaxHP + 1], a
+	ld [wEvoNewSpecies], a
 	ld a, [wWhichPokemon]
 	ld hl, wPartyMonNicks
 	call GetPartyMonName
@@ -122,7 +122,7 @@
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED], a
 	coord hl, 0, 0
-	ld bc, $c14
+	lb bc, 12, 20
 	call ClearScreenArea
 	ld a, $1
 	ld [H_AUTOBGTRANSFERENABLED], a
@@ -137,7 +137,7 @@
 	ld a, [hl]
 	ld [wd0b5], a
 	ld [wLoadedMonSpecies], a
-	ld [wHPBarMaxHP + 1], a
+	ld [wEvoNewSpecies], a
 	ld a, MONSTER_NAME
 	ld [wNameListType], a
 	ld a, BANK(TrainerNames) ; bank is not used for monster names
@@ -357,7 +357,7 @@
 	ld bc, wPartyMon2 - wPartyMon1
 	call AddNTimes
 .next
-	ld b, $4
+	ld b, NUM_MOVES
 .checkCurrentMovesLoop ; check if the move to learn is already known
 	ld a, [hli]
 	cp d
@@ -377,7 +377,6 @@
 
 ; writes the moves a mon has at level [W_CURENEMYLVL] to [de]
 ; move slots are being filled up sequentially and shifted if all slots are full
-; [wHPBarMaxHP]: (?)
 WriteMonMoves: ; 3afb8 (e:6fb8)
 	call GetPredefRegisters
 	push hl
@@ -384,7 +383,7 @@
 	push de
 	push bc
 	ld hl, EvosMovesPointerTable
-	ld b, $0
+	ld b, 0
 	ld a, [wcf91]  ; cur mon ID
 	dec a
 	add a
@@ -411,25 +410,30 @@
 	ld a, [W_CURENEMYLVL]
 	cp b
 	jp c, .done       ; mon level < move level (assumption: learnset is sorted by level)
-	ld a, [wHPBarMaxHP]
+	ld a, [wLearningMovesFromDayCare]
 	and a
 	jr z, .skipMinLevelCheck
-	ld a, [wWhichTrade] ; min move level)
+	ld a, [wDayCareStartLevel]
 	cp b
 	jr nc, .nextMove2 ; min level >= move level
+
 .skipMinLevelCheck
+
+; check if the move is already known
 	push de
-	ld c, $4
-.moveAlreadyLearnedCheckLoop
+	ld c, NUM_MOVES
+.alreadyKnowsCheckLoop
 	ld a, [de]
 	inc de
 	cp [hl]
 	jr z, .nextMove
 	dec c
-	jr nz, .moveAlreadyLearnedCheckLoop
+	jr nz, .alreadyKnowsCheckLoop
+
+; try to find an empty move slot
 	pop de
 	push de
-	ld c, $4
+	ld c, NUM_MOVES
 .findEmptySlotLoop
 	ld a, [de]
 	and a
@@ -437,47 +441,55 @@
 	inc de
 	dec c
 	jr nz, .findEmptySlotLoop
-	pop de                        ; no empty move slots found
+
+; no empty move slots found
+	pop de                        
 	push de
 	push hl
 	ld h, d
 	ld l, e
 	call WriteMonMoves_ShiftMoveData ; shift all moves one up (deleting move 1)
-	ld a, [wHPBarMaxHP]
+	ld a, [wLearningMovesFromDayCare]
 	and a
 	jr z, .writeMoveToSlot
+
+; shift PP as well if learning moves from day care
 	push de
-	ld bc, $12
+	ld bc, wPartyMon1PP - (wPartyMon1Moves + 3)
 	add hl, bc
 	ld d, h
 	ld e, l
 	call WriteMonMoves_ShiftMoveData ; shift all move PP data one up
 	pop de
+
 .writeMoveToSlot
 	pop hl
 .writeMoveToSlot2
 	ld a, [hl]
 	ld [de], a
-	ld a, [wHPBarMaxHP]
+	ld a, [wLearningMovesFromDayCare]
 	and a
 	jr z, .nextMove
-	push hl            ; write move PP value
+
+; write move PP value if learning moves from day care
+	push hl            
 	ld a, [hl]
-	ld hl, $15
+	ld hl, wPartyMon1PP - wPartyMon1Moves
 	add hl, de
 	push hl
 	dec a
 	ld hl, Moves
-	ld bc, $6
+	ld bc, 6
 	call AddNTimes
-	ld de, wHPBarMaxHP
+	ld de, wBuffer
 	ld a, BANK(Moves)
 	call FarCopyData
-	ld a, [wHPBarNewHP + 1]
+	ld a, [wBuffer + 5]
 	pop hl
 	ld [hl], a
 	pop hl
 	jr .nextMove
+
 .done
 	pop bc
 	pop de
@@ -486,13 +498,13 @@
 
 ; shifts all move data one up (freeing 4th move slot)
 WriteMonMoves_ShiftMoveData: ; 3b04e (e:704e)
-	ld c, $3
-.asm_3b050
+	ld c, NUM_MOVES - 1
+.loop
 	inc de
 	ld a, [de]
 	ld [hli], a
 	dec c
-	jr nz, .asm_3b050
+	jr nz, .loop
 	ret
 
 Evolution_FlagAction: ; 3b057 (e:7057)
--- a/engine/experience.asm
+++ b/engine/experience.asm
@@ -10,15 +10,15 @@
 	push hl
 	ld hl, wLoadedMonExp + 2 ; current exp
 ; compare exp needed for level d with current exp
-	ld a, [H_MULTIPLICAND + 2]
+	ld a, [hExperience + 2]
 	ld c, a
 	ld a, [hld]
 	sub c
-	ld a, [H_MULTIPLICAND + 1]
+	ld a, [hExperience + 1]
 	ld c, a
 	ld a, [hld]
 	sbc c
-	ld a, [H_MULTIPLICAND]
+	ld a, [hExperience]
 	ld c, a
 	ld a, [hl]
 	sbc c
@@ -33,7 +33,7 @@
 	add a
 	add a
 	ld c, a
-	ld b, $0
+	ld b, 0
 	ld hl, GrowthRateTable
 	add hl, bc
 	call CalcDSquared
@@ -50,11 +50,11 @@
 	ld [H_DIVISOR], a
 	ld b, $4
 	call Divide
-	ld a, [H_MULTIPLICAND] ; (aliases: H_NUMTOPRINT)
+	ld a, [H_QUOTIENT + 1]
 	push af
-	ld a, [H_MULTIPLICAND+1]
+	ld a, [H_QUOTIENT + 2]
 	push af
-	ld a, [H_MULTIPLICAND+2]
+	ld a, [H_QUOTIENT + 3]
 	push af
 	call CalcDSquared
 	ld a, [hl]
@@ -61,85 +61,89 @@
 	and $7f
 	ld [H_MULTIPLIER], a
 	call Multiply
-	ld a, [H_MULTIPLICAND] ; (aliases: H_NUMTOPRINT)
+	ld a, [H_PRODUCT + 1]
 	push af
-	ld a, [H_MULTIPLICAND+1]
+	ld a, [H_PRODUCT + 2]
 	push af
-	ld a, [H_MULTIPLICAND+2]
+	ld a, [H_PRODUCT + 3]
 	push af
 	ld a, [hli]
 	push af
 	xor a
 	ld [H_MULTIPLICAND], a
-	ld [H_MULTIPLICAND+1], a
+	ld [H_MULTIPLICAND + 1], a
 	ld a, d
-	ld [H_MULTIPLICAND+2], a
+	ld [H_MULTIPLICAND + 2], a
 	ld a, [hli]
 	ld [H_MULTIPLIER], a
 	call Multiply
 	ld b, [hl]
-	ld a, [H_MULTIPLICAND+2]
+	ld a, [H_PRODUCT + 3]
 	sub b
-	ld [H_MULTIPLICAND+2], a
+	ld [H_PRODUCT + 3], a
 	ld b, $0
-	ld a, [H_MULTIPLICAND+1]
+	ld a, [H_PRODUCT + 2]
 	sbc b
-	ld [H_MULTIPLICAND+1], a
-	ld a, [H_MULTIPLICAND]
+	ld [H_PRODUCT + 2], a
+	ld a, [H_PRODUCT + 1]
 	sbc b
-	ld [H_MULTIPLICAND], a
+	ld [H_PRODUCT + 1], a
+; The difference of the linear term and the constant term consists of 3 bytes
+; starting at H_PRODUCT + 1. Below, hExperience (an alias of that address) will
+; be used instead for the further work of adding or subtracting the squared
+; term and adding the cubed term.
 	pop af
 	and $80
 	jr nz, .subtractSquaredTerm ; check sign
 	pop bc
-	ld a, [H_MULTIPLICAND+2]
+	ld a, [hExperience + 2]
 	add b
-	ld [H_MULTIPLICAND+2], a
+	ld [hExperience + 2], a
 	pop bc
-	ld a, [H_MULTIPLICAND+1]
+	ld a, [hExperience + 1]
 	adc b
-	ld [H_MULTIPLICAND+1], a
+	ld [hExperience + 1], a
 	pop bc
-	ld a, [H_MULTIPLICAND]
+	ld a, [hExperience]
 	adc b
-	ld [H_MULTIPLICAND], a
+	ld [hExperience], a
 	jr .addCubedTerm
 .subtractSquaredTerm
 	pop bc
-	ld a, [H_MULTIPLICAND+2]
+	ld a, [hExperience + 2]
 	sub b
-	ld [H_MULTIPLICAND+2], a
+	ld [hExperience + 2], a
 	pop bc
-	ld a, [H_MULTIPLICAND+1]
+	ld a, [hExperience + 1]
 	sbc b
-	ld [H_MULTIPLICAND+1], a
+	ld [hExperience + 1], a
 	pop bc
-	ld a, [H_MULTIPLICAND]
+	ld a, [hExperience]
 	sbc b
-	ld [H_MULTIPLICAND], a
+	ld [hExperience], a
 .addCubedTerm
 	pop bc
-	ld a, [H_MULTIPLICAND+2]
+	ld a, [hExperience + 2]
 	add b
-	ld [H_MULTIPLICAND+2], a
+	ld [hExperience + 2], a
 	pop bc
-	ld a, [H_MULTIPLICAND+1]
+	ld a, [hExperience + 1]
 	adc b
-	ld [H_MULTIPLICAND+1], a
+	ld [hExperience + 1], a
 	pop bc
-	ld a, [H_MULTIPLICAND]
+	ld a, [hExperience]
 	adc b
-	ld [H_MULTIPLICAND], a
+	ld [hExperience], a
 	ret
 
 ; calculates d*d
 CalcDSquared: ; 59010 (16:5010)
 	xor a
-	ld [H_MULTIPLICAND], a ; (aliases: H_NUMTOPRINT)
-	ld [H_MULTIPLICAND+1], a
+	ld [H_MULTIPLICAND], a
+	ld [H_MULTIPLICAND + 1], a
 	ld a, d
-	ld [H_MULTIPLICAND+2], a
-	ld [H_MULTIPLIER], a ; (aliases: H_DIVISOR, H_REMAINDER, H_POWEROFTEN)
+	ld [H_MULTIPLICAND + 2], a
+	ld [H_MULTIPLIER], a
 	jp Multiply
 
 ; each entry has the following scheme:
--- a/engine/game_corner_slots.asm
+++ b/engine/game_corner_slots.asm
@@ -7,7 +7,7 @@
 	cp $ff
 	jr z, .printSomeonesKeys
 	callba AbleToPlaySlotsCheck
-	ld a, [wHiddenObjectFunctionArgument]
+	ld a, [wCanPlaySlots]
 	and a
 	ret z
 	ld a, [wLuckySlotHiddenObjectIndex]
--- a/engine/game_corner_slots2.asm
+++ b/engine/game_corner_slots2.asm
@@ -1,4 +1,4 @@
-AbleToPlaySlotsCheck ; 2ff09 (b:7f09)
+AbleToPlaySlotsCheck: ; 2ff09 (b:7f09)
 	ld a, [wSpriteStateData1 + 2]
 	and $8
 	jr z, .done ; not able
@@ -19,7 +19,7 @@
 	call PrintPredefTextID
 	xor a
 .done
-	ld [wWhichTrade], a
+	ld [wCanPlaySlots], a
 	ret
 
 GameCornerCoinCaseText: ; 2ff32 (b:7f32)
--- a/engine/give_pokemon.asm
+++ b/engine/give_pokemon.asm
@@ -1,13 +1,16 @@
 _GivePokemon: ; 4fda5 (13:7da5)
+; returns success in carry
+; and whether the mon was added to the party in [wAddedToParty]
 	call EnableAutoTextBoxDrawing
 	xor a
-	ld [wccd3], a
+	ld [wAddedToParty], a
 	ld a, [wPartyCount]
 	cp PARTY_LENGTH
-	jr c, .asm_4fe01
+	jr c, .addToParty
 	ld a, [W_NUMINBOX]
 	cp MONS_PER_BOX
-	jr nc, .asm_4fdf9
+	jr nc, .boxFull
+; add to box
 	xor a
 	ld [W_ENEMYBATTSTATUS3], a
 	ld a, [wcf91]
@@ -19,15 +22,15 @@
 	ld a, [wCurrentBoxNum]
 	and $7f
 	cp 9
-	jr c, .asm_4fdec
+	jr c, .singleDigitBoxNum
 	sub 9
 	ld [hl], "1"
 	inc hl
 	add "0"
-	jr .asm_4fdee
-.asm_4fdec
+	jr .next
+.singleDigitBoxNum
 	add "1"
-.asm_4fdee
+.next
 	ld [hli], a
 	ld [hl], "@"
 	ld hl, SetToBoxText
@@ -34,17 +37,17 @@
 	call PrintText
 	scf
 	ret
-.asm_4fdf9
+.boxFull
 	ld hl, BoxIsFullText
 	call PrintText
 	and a
 	ret
-.asm_4fe01
+.addToParty
 	call SetPokedexOwnedFlag
 	call AddPartyMon
-	ld a, $1
+	ld a, 1
 	ld [wDoNotWaitForButtonPressAfterDisplayingText], a
-	ld [wccd3], a
+	ld [wAddedToParty], a
 	scf
 	ret
 
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -55,7 +55,7 @@
 DisplayMonFrontSpriteInBox: ; 5dbd9 (17:5bd9)
 ; Displays a pokemon's front sprite in a pop-up window.
 ; [wcf91] = pokemon interal id number
-	ld a, $1
+	ld a, 1
 	ld [H_AUTOBGTRANSFERENABLED], a
 	call Delay3
 	xor a
@@ -85,7 +85,7 @@
 	call EnableAutoTextBoxDrawing
 	ld a, $1
 	ld [wDoNotWaitForButtonPressAfterDisplayingText], a
-	ld a, [wWhichTrade]
+	ld a, [wHiddenObjectFunctionArgument]
 	call PrintPredefTextID
 	ret
 
@@ -310,7 +310,7 @@
 
 GymTrashScript: ; 5ddfc (17:5dfc)
 	call EnableAutoTextBoxDrawing
-	ld a, [wWhichTrade]
+	ld a, [wHiddenObjectFunctionArgument]
 	ld [wcd5b], a
 
 ; Don't do the trash can puzzle if it's already been done.
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -128,7 +128,7 @@
 	TX_ASM
 	xor a
 	ld [wda38], a
-	ld a, [wWhichTrade]
+	ld a, [wHiddenObjectFunctionArgument]
 	push af
 	and $f
 	ld [$ffdb], a
--- a/engine/items/itemfinder.asm
+++ b/engine/items/itemfinder.asm
@@ -1,14 +1,14 @@
 HiddenItemNear: ; 7481f (1d:481f)
 	ld hl, HiddenItemCoords
-	ld b, $0
-.asm_74824
-	ld de, $0003
+	ld b, 0
+.loop
+	ld de, 3
 	ld a, [W_CURMAP]
 	call IsInRestOfArray
 	ret nc ; return if current map has no hidden items
 	push bc
 	push hl
-	ld hl, wd6f0
+	ld hl, wObtainedHiddenItemsFlags
 	ld c, b
 	ld b, $2
 	predef FlagActionPredef
@@ -22,28 +22,30 @@
 	inc hl
 	ld e, [hl]
 	inc hl
-	jr nz, .asm_74824
+	jr nz, .loop ; if the item has already been obtained
+; check if the item is within 4-5 tiles (depending on the direction of item)
 	ld a, [W_YCOORD]
-	call Func_7486b
+	call Sub5ClampTo0
 	cp d
-	jr nc, .asm_74824
+	jr nc, .loop
 	ld a, [W_YCOORD]
-	add $4
+	add 4
 	cp d
-	jr c, .asm_74824
+	jr c, .loop
 	ld a, [W_XCOORD]
-	call Func_7486b
+	call Sub5ClampTo0
 	cp e
-	jr nc, .asm_74824
+	jr nc, .loop
 	ld a, [W_XCOORD]
-	add $5
+	add 5
 	cp e
-	jr c, .asm_74824
+	jr c, .loop
 	scf
 	ret
 
-Func_7486b: ; 7486b (1d:486b)
-	sub $5
+Sub5ClampTo0: ; 7486b (1d:486b)
+; subtract 5 but clamp to 0
+	sub 5
 	cp $f0
 	ret c
 	xor a
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -1216,11 +1216,11 @@
 	ld bc,-19
 	add hl,bc ; hl now points to experience
 ; update experience to minimum for new level
-	ld a,[$ff96]
+	ld a,[hExperience]
 	ld [hli],a
-	ld a,[$ff97]
+	ld a,[hExperience + 1]
 	ld [hli],a
-	ld a,[$ff98]
+	ld a,[hExperience + 2]
 	ld [hl],a
 	pop hl
 	ld a,[wWhichPokemon]
@@ -1618,8 +1618,8 @@
 	jp PrintText
 .inBattle
 	xor a
-	ld [wWhichTrade],a ; initialize variable that indicates if any pokemon were woken up to zero
-	ld b,~SLP & $FF
+	ld [wWereAnyMonsAsleep],a
+	ld b,~SLP & $ff
 	ld hl,wPartyMon1Status
 	call WakeUpEntireParty
 	ld a,[W_ISINBATTLE]
@@ -1638,7 +1638,7 @@
 	and b ; remove Sleep status
 	ld [hl],a
 	call LoadScreenTilesFromBuffer2 ; restore saved screen
-	ld a,[wWhichTrade]
+	ld a,[wWereAnyMonsAsleep]
 	and a ; were any pokemon asleep before playing the flute?
 	ld hl,PlayedFluteNoEffectText
 	jp z,PrintText ; if no pokemon were asleep
@@ -1662,9 +1662,9 @@
 ; INPUT:
 ; hl must point to status of first pokemon in party (player's or enemy's)
 ; b must equal ~SLP
-; [wWhichTrade] should be initialized to 0
+; [wWereAnyMonsAsleep] should be initialized to 0
 ; OUTPUT:
-; [wWhichTrade]: set to 1 if any pokemon were asleep
+; [wWereAnyMonsAsleep]: set to 1 if any pokemon were asleep
 WakeUpEntireParty: ; e1e5 (3:61e5)
 	ld de,44
 	ld c,6
@@ -1674,7 +1674,7 @@
 	and a,SLP ; is pokemon asleep?
 	jr z,.notAsleep
 	ld a,1
-	ld [wWhichTrade],a ; indicate that a pokemon had to be woken up
+	ld [wWereAnyMonsAsleep],a ; indicate that a pokemon had to be woken up
 .notAsleep
 	pop af
 	and b ; remove Sleep status
@@ -1874,7 +1874,7 @@
 	ld a,[wWhichPokemon]
 	push af
 	ld a,[wcf91]
-	ld [wWhichTrade],a
+	ld [wPPRestoreItem],a
 .chooseMon
 	xor a
 	ld [wUpdateSpritesEnabled],a
@@ -1884,13 +1884,13 @@
 	jr nc,.chooseMove
 	jp .itemNotUsed
 .chooseMove
-	ld a,[wWhichTrade]
+	ld a,[wPPRestoreItem]
 	cp a,ELIXER
 	jp nc,.useElixir ; if Elixir or Max Elixir
 	ld a,$02
 	ld [wMoveMenuType],a
 	ld hl,RaisePPWhichTechniqueText
-	ld a,[wWhichTrade]
+	ld a,[wPPRestoreItem]
 	cp a,ETHER ; is it a PP Up?
 	jr c,.printWhichTechniqueMessage ; if so, print the raise PP message
 	ld hl,RestorePPWhichTechniqueText ; otherwise, print the restore PP message
@@ -1911,7 +1911,7 @@
 	call GetMoveName
 	call CopyStringToCF4B ; copy name to wcf4b
 	pop hl
-	ld a,[wWhichTrade]
+	ld a,[wPPRestoreItem]
 	cp a,ETHER
 	jr nc,.useEther ; if Ether or Max Ether
 .usePPUp
@@ -1973,7 +1973,7 @@
 	add hl,bc ; hl now points to move's PP
 	ld a,[wd11e]
 	ld b,a ; b = max PP
-	ld a,[wWhichTrade]
+	ld a,[wPPRestoreItem]
 	cp a,MAX_ETHER
 	jr z,.fullyRestorePP
 	ld a,[hl] ; move PP
@@ -2005,7 +2005,7 @@
 	jr .storeNewAmount
 .useElixir
 ; decrement the item ID so that ELIXER becomes ETHER and MAX_ELIXER becomes MAX_ETHER
-	ld hl,wWhichTrade
+	ld hl,wPPRestoreItem
 	dec [hl]
 	dec [hl]
 	xor a
@@ -2701,13 +2701,13 @@
 	ld d, a
 	callab CalcExperience
 	pop de
-	ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND)
+	ld a, [hExperience]
 	ld [de], a
 	inc de
-	ld a, [$ff97]
+	ld a, [hExperience + 1]
 	ld [de], a
 	inc de
-	ld a, [$ff98]
+	ld a, [hExperience + 2]
 	ld [de], a
 	inc de
 	xor a
--- a/engine/menu/league_pc.asm
+++ b/engine/menu/league_pc.asm
@@ -12,7 +12,7 @@
 	ld [hTilesetType], a
 	ld [W_SPRITEFLIPPED], a
 	ld [wUpdateSpritesEnabled], a
-	ld [wTrainerScreenX], a
+	ld [wHoFTeamIndex2], a
 	ld [wHoFTeamNo], a
 	ld a, [wNumHoFTeams]
 	ld b, a
@@ -27,13 +27,13 @@
 	ld hl, wHoFTeamNo
 	inc [hl]
 	push bc
-	ld a, [wTrainerScreenX]
-	ld [wHoFMonSpecies], a
+	ld a, [wHoFTeamIndex2]
+	ld [wHoFTeamIndex], a
 	callba LoadHallOfFameTeams
 	call LeaguePCShowTeam
 	pop bc
 	jr c, .doneShowingTeams
-	ld hl, wTrainerScreenX
+	ld hl, wHoFTeamIndex2
 	inc [hl]
 	ld a, [hl]
 	cp b
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -1,17 +1,16 @@
 MainMenu: ; 5af2 (1:5af2)
 ; Check save file
-	call Func_5bff
+	call InitOptions
 	xor a
-	ld [wd08a],a
+	ld [wOptionsInitialized],a
 	inc a
-	ld [wd088],a
-	call Func_609e
-	jr nc,.next0
+	ld [wSaveFileStatus],a
+	call CheckForPlayerNameInSRAM
+	jr nc,.mainMenuLoop
 
-	; Predef 52 loads the save from SRAM to RAM
 	predef LoadSAV
 
-.next0
+.mainMenuLoop
 	ld c,20
 	call DelayFrames
 	xor a ; LINK_STATE_NONE
@@ -30,9 +29,10 @@
 	call LoadFontTilePatterns
 	ld hl,wd730
 	set 6,[hl]
-	ld a,[wd088]
+	ld a,[wSaveFileStatus]
 	cp a,1
-	jr z,.next1
+	jr z,.noSaveFile
+; there's a save file
 	coord hl, 0, 0
 	ld b,6
 	ld c,13
@@ -41,7 +41,7 @@
 	ld de,ContinueText
 	call PlaceString
 	jr .next2
-.next1
+.noSaveFile
 	coord hl, 0, 0
 	ld b,4
 	ld c,13
@@ -63,31 +63,33 @@
 	ld [wTopMenuItemY],a
 	ld a,$B
 	ld [wMenuWatchedKeys],a
-	ld a,[wd088]
+	ld a,[wSaveFileStatus]
 	ld [wMaxMenuItem],a
 	call HandleMenuInput
-	bit 1,a
-	jp nz,LoadTitlescreenGraphics ; load title screen (gfx and arrangement)
+	bit 1,a ; pressed B?
+	jp nz,DisplayTitleScreen ; if so, go back to the title screen
 	ld c,20
 	call DelayFrames
 	ld a,[wCurrentMenuItem]
 	ld b,a
-	ld a,[wd088]
+	ld a,[wSaveFileStatus]
 	cp a,2
-	jp z,.next3
-	inc b ; adjust MenuArrow_Counter
-.next3
+	jp z,.skipInc
+; If there's no save file, increment the current menu item so that the numbers
+; are the same whether or not there's a save file.
+	inc b
+.skipInc
 	ld a,b
 	and a
-	jr z,.next4 ; if press_A on Continue
+	jr z,.choseContinue
 	cp a,1
-	jp z,Func_5d52 ; if press_A on NewGame
-	call DisplayOptionMenu ; if press_a on Options
+	jp z,StartNewGame
+	call DisplayOptionMenu
 	ld a,1
-	ld [wd08a],a
-	jp .next0
-.next4
-	call ContinueGame
+	ld [wOptionsInitialized],a
+	jp .mainMenuLoop
+.choseContinue
+	call DisplayContinueGameInfo
 	ld hl,wd126
 	set 5,[hl]
 .inputLoop
@@ -100,7 +102,7 @@
 	bit 0,a
 	jr nz,.pressedA
 	bit 1,a
-	jp nz,.next0 ; pressedB
+	jp nz,.mainMenuLoop ; pressed B
 	jr .inputLoop
 .pressedA
 	call GBPalWhiteOutWithDelay3
@@ -122,10 +124,10 @@
 	call SpecialWarpIn
 	jp SpecialEnterMap
 
-Func_5bff: ; 5bff (1:5bff)
-	ld a,1
+InitOptions: ; 5bff (1:5bff)
+	ld a,1 ; no delay
 	ld [wLetterPrintingDelayFlags],a
-	ld a,3
+	ld a,3 ; medium speed
 	ld [W_OPTIONS],a
 	ret
 
@@ -301,7 +303,7 @@
 	TX_FAR _LinkCanceledText
 	db "@"
 
-Func_5d52: ; 5d52 (1:5d52)
+StartNewGame: ; 5d52 (1:5d52)
 	ld hl, wd732
 	res 1, [hl]
 	call OakSpeech
@@ -337,12 +339,12 @@
 	db "COLOSSEUM",    $4e
 	db "CANCEL@"
 
-ContinueGame: ; 5db5 (1:5db5)
+DisplayContinueGameInfo: ; 5db5 (1:5db5)
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED], a
 	coord hl, 4, 7
-	ld b, $8
-	ld c, $e
+	ld b, 8
+	ld c, 14
 	call TextBoxBorder
 	coord hl, 5, 9
 	ld de, SaveScreenInfoText
@@ -351,12 +353,12 @@
 	ld de, wPlayerName
 	call PlaceString
 	coord hl, 17, 11
-	call Func_5e2f
+	call PrintNumBadges
 	coord hl, 16, 13
-	call Func_5e42
+	call PrintNumOwnedMons
 	coord hl, 13, 15
-	call Func_5e55
-	ld a, $1
+	call PrintPlayTime
+	ld a, 1
 	ld [H_AUTOBGTRANSFERENABLED], a
 	ld c, 30
 	jp DelayFrames
@@ -377,17 +379,17 @@
 	ld de, wPlayerName
 	call PlaceString
 	coord hl, 17, 4
-	call Func_5e2f
+	call PrintNumBadges
 	coord hl, 16, 6
-	call Func_5e42
+	call PrintNumOwnedMons
 	coord hl, 13, 8
-	call Func_5e55
+	call PrintPlayTime
 	ld a, $1
 	ld [H_AUTOBGTRANSFERENABLED], a
 	ld c, 30
 	jp DelayFrames
 
-Func_5e2f: ; 5e2f (1:5e2f)
+PrintNumBadges: ; 5e2f (1:5e2f)
 	push hl
 	ld hl, W_OBTAINEDBADGES
 	ld b, $1
@@ -397,7 +399,7 @@
 	ld bc, $102
 	jp PrintNumber
 
-Func_5e42: ; 5e42 (1:5e42)
+PrintNumOwnedMons: ; 5e42 (1:5e42)
 	push hl
 	ld hl, wPokedexOwned
 	ld b, wPokedexOwnedEnd - wPokedexOwned
@@ -407,7 +409,7 @@
 	ld bc, $103
 	jp PrintNumber
 
-Func_5e55: ; 5e55 (1:5e55)
+PrintPlayTime: ; 5e55 (1:5e55)
 	ld de, W_PLAYTIMEHOURS + 1
 	ld bc, $103
 	call PrintNumber
@@ -678,28 +680,32 @@
 	db 7 ; default X coordinate (Medium)
 	db $ff ; terminator
 
-Func_609e: ; 609e (1:609e)
-	ld a, $a
-	ld [$0], a
+CheckForPlayerNameInSRAM: ; 609e (1:609e)
+; Check if the player name data in SRAM has a string terminator character
+; (indicating that a name may have been saved there) and return whether it does
+; in carry.
+	ld a, SRAM_ENABLE
+	ld [MBC1SRamEnable], a
 	ld a, $1
-	ld [$6000], a
-	ld [$4000], a
+	ld [MBC1SRamBankingMode], a
+	ld [MBC1SRamBank], a
 	ld b, $b
-	ld hl, $a598
-.asm_60b0
+	ld hl, sPlayerName
+.loop
 	ld a, [hli]
-	cp $50
-	jr z, .asm_60c1
+	cp "@"
+	jr z, .found
 	dec b
-	jr nz, .asm_60b0
+	jr nz, .loop
+; not found
 	xor a
-	ld [$0], a
-	ld [$6000], a
+	ld [MBC1SRamEnable], a
+	ld [MBC1SRamBankingMode], a
 	and a
 	ret
-.asm_60c1
+.found
 	xor a
-	ld [$0], a
-	ld [$6000], a
+	ld [MBC1SRamEnable], a
+	ld [MBC1SRamBankingMode], a
 	scf
 	ret
--- a/engine/menu/pokedex.asm
+++ b/engine/menu/pokedex.asm
@@ -71,8 +71,8 @@
 	ld [wd11e],a
 	ld a,[wd11e]
 	push af
-	ld a,[wWhichTrade]
-	push af
+	ld a,[wDexMaxSeenMon]
+	push af ; this doesn't need to be preserved
 	ld hl,wPokedexSeen
 	call IsPokemonBitSet
 	ld b,2
@@ -108,7 +108,7 @@
 	ld b,1
 .exitSideMenu
 	pop af
-	ld [wWhichTrade],a
+	ld [wDexMaxSeenMon],a
 	pop af
 	ld [wd11e],a
 	pop af
@@ -207,7 +207,7 @@
 	jr .maxSeenPokemonLoop
 .storeMaxSeenPokemon
 	ld a,b
-	ld [wWhichTrade],a ; max seen pokemon
+	ld [wDexMaxSeenMon],a
 .loop
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED],a
@@ -218,7 +218,7 @@
 	ld a,[wListScrollOffset]
 	ld [wd11e],a
 	ld d,7
-	ld a,[wWhichTrade]
+	ld a,[wDexMaxSeenMon]
 	cp a,7
 	jr nc,.printPokemonLoop
 	ld d,a
@@ -294,9 +294,9 @@
 	bit 7,a ; was Down pressed?
 	jr z,.checkIfRightPressed
 .downPressed ; scroll down one row
-	ld a,[wWhichTrade]
+	ld a,[wDexMaxSeenMon]
 	cp a,7
-	jp c,.loop
+	jp c,.loop ; can't if the list is shorter than 7
 	sub a,7
 	ld b,a
 	ld a,[wListScrollOffset]
@@ -309,9 +309,9 @@
 	bit 4,a ; was Right pressed?
 	jr z,.checkIfLeftPressed
 .rightPressed ; scroll down 7 rows
-	ld a,[wWhichTrade]
+	ld a,[wDexMaxSeenMon]
 	cp a,7
-	jp c,.loop
+	jp c,.loop ; can't if the list is shorter than 7
 	sub a,6
 	ld b,a
 	ld a,[wListScrollOffset]
--- a/engine/menu/prize_menu.asm
+++ b/engine/menu/prize_menu.asm
@@ -231,18 +231,24 @@
 	pop af
 	ld b,a
 	call GivePokemon
+
+; If either the party or box was full, wait after displaying message.
 	push af
-	ld a,[wccd3] ; XXX is there room?
+	ld a,[wAddedToParty]
 	and a
 	call z,WaitForTextScrollButtonPress
 	pop af
+
+; If the mon couldn't be given to the player (because both the party and box
+; were full), return without subtracting coins.
 	ret nc
+
 .SubtractCoins
 	call LoadCoinsToSubtract
 	ld hl,hCoins + 1
 	ld de,wPlayerCoins + 1
 	ld c,$02 ; how many bytes
-	predef SubBCDPredef ; subtract coins (BCD daa operations)
+	predef SubBCDPredef
 	jp PrintPrizePrice
 .BagFull
 	ld hl,PrizeRoomBagIsFullTextPtr
--- a/engine/menu/status_screen.asm
+++ b/engine/menu/status_screen.asm
@@ -297,8 +297,8 @@
 	push af
 	xor a
 	ld [hTilesetType], a
-	ld [$ffba], a
-	ld bc, $0005
+	ld [H_AUTOBGTRANSFERENABLED], a
+	ld bc, NUM_MOVES + 1
 	ld hl, wMoves
 	call FillMemory
 	ld hl, wLoadedMonMoves
@@ -307,13 +307,13 @@
 	call CopyData
 	callab FormatMovesString
 	coord hl, 9, 2
-	ld bc, $050a
+	lb bc, 5, 10
 	call ClearScreenArea ; Clear under name
 	coord hl, 19, 3
 	ld [hl], $78
 	coord hl, 0, 8
-	ld b, $8
-	ld c, $12
+	ld b, 8
+	ld c, 18
 	call TextBoxBorder ; Draw move container
 	coord hl, 2, 9
 	ld de, wMovesString
@@ -387,9 +387,9 @@
 	jr nz, .PrintPP
 .PPDone
 	coord hl, 9, 3
-	ld de, EXPPointsText
+	ld de, StatusScreenExpText
 	call PlaceString
-	ld a, [wLoadedMonLevel] ; level
+	ld a, [wLoadedMonLevel]
 	push af
 	cp MAX_LEVEL
 	jr z, .Level100
@@ -407,11 +407,11 @@
 	coord hl, 12, 4
 	ld bc, $0307
 	call PrintNumber ; exp
-	call .asm_12c86
+	call CalcExpToLevelUp
 	ld de, wLoadedMonExp
 	coord hl, 7, 6
 	ld bc, $0307
-	call PrintNumber
+	call PrintNumber ; exp needed to level up
 	coord hl, 9, 0
 	call StatusScreen_ClearName
 	coord hl, 9, 1
@@ -422,7 +422,7 @@
 	coord hl, 9, 1
 	call PlaceString
 	ld a, $1
-	ld [$ffba], a
+	ld [H_AUTOBGTRANSFERENABLED], a
 	call Delay3
 	call WaitForTextScrollButtonPress ; wait for button
 	pop af
@@ -433,25 +433,26 @@
 	ld [$ff24], a
 	call GBPalWhiteOut
 	jp ClearScreen
-.asm_12c86 ; This does some magic with lvl/exp?
-	ld a, [wLoadedMonLevel] ; Load level
+
+CalcExpToLevelUp: ; 12c86 (4:6c86)
+	ld a, [wLoadedMonLevel]
 	cp MAX_LEVEL
-	jr z, .asm_12ca7  ; If 100
+	jr z, .atMaxLevel
 	inc a
 	ld d, a
 	callab CalcExperience
 	ld hl, wLoadedMonExp + 2
-	ld a, [$ff98]
+	ld a, [hExperience + 2]
 	sub [hl]
 	ld [hld], a
-	ld a, [$ff97]
+	ld a, [hExperience + 1]
 	sbc [hl]
 	ld [hld], a
-	ld a, [$ff96]
+	ld a, [hExperience]
 	sbc [hl]
 	ld [hld], a
 	ret
-.asm_12ca7
+.atMaxLevel
 	ld hl, wLoadedMonExp
 	xor a
 	ld [hli], a
@@ -459,11 +460,9 @@
 	ld [hl], a
 	ret
 
-EXPPointsText: ; 12caf (4:6caf)
-	db "EXP POINTS", $4e
-
-LevelUpText: ; 12cba (4:6cba)
-	db "LEVEL UP@"
+StatusScreenExpText: ; 12caf (4:6caf)
+	db   "EXP POINTS"
+	next "LEVEL UP@"
 
 StatusScreen_ClearName: ; 12cc3 (4:6cc3)
 	ld bc, 10
--- a/engine/oak_speech.asm
+++ b/engine/oak_speech.asm
@@ -19,9 +19,9 @@
 	ld [W_OPTIONS], a
 	pop af
 	ld [wLetterPrintingDelayFlags], a
-	ld a, [wd08a]
+	ld a, [wOptionsInitialized]
 	and a
-	call z, Func_5bff
+	call z, InitOptions
 	ld hl, NintenText
 	ld de, wPlayerName
 	ld bc, $b
--- a/engine/oam_dma.asm
+++ b/engine/oam_dma.asm
@@ -15,7 +15,7 @@
 DMARoutine:
 	; initiate DMA
 	ld a, wOAMBuffer / $100
-	ld [$ff46], a
+	ld [rDMA], a
 
 	; wait for DMA to finish
 	ld a, $28
--- 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 @@
 	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 @@
 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 @@
 	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 @@
 	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 @@
 	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,14 +130,14 @@
 	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]
@@ -144,17 +144,17 @@
 	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
--- a/engine/overworld/hidden_objects.asm
+++ b/engine/overworld/hidden_objects.asm
@@ -1,4 +1,4 @@
-Func_46981: ; 46981 (11:6981)
+IsPlayerOnDungeonWarp: ; 46981 (11:6981)
 	xor a
 	ld [wWhichDungeonWarp], a
 	ld a, [wd72d]
@@ -6,7 +6,7 @@
 	ret nz
 	call ArePlayerCoordsInArray
 	ret nc
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	ld [wWhichDungeonWarp], a
 	ld hl, wd72d
 	set 4, [hl]
@@ -58,7 +58,7 @@
 	ld [wHiddenObjectX], a
 	ld c, a
 	call CheckIfCoordsInFrontOfPlayerMatch
-	ld a, [$ffea]
+	ld a, [hCoordsInFrontOfPlayerMatch]
 	and a
 	jr z, .foundMatchingObject
 	inc hl
@@ -85,7 +85,7 @@
 	ret
 
 ; checks if the coordinates in front of the player's sprite match Y in b and X in c
-; [$ffea] = $00 if they match, $ff if they don't match
+; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match
 CheckIfCoordsInFrontOfPlayerMatch: ; 46a01 (11:6a01)
 	ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
 	cp SPRITE_FACING_UP
@@ -127,7 +127,7 @@
 .didNotMatch
 	ld a, $ff
 .done
-	ld [$ffea], a
+	ld [hCoordsInFrontOfPlayerMatch], a
 	ret
 
 INCLUDE "data/hidden_objects.asm"
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -210,9 +210,8 @@
 .moveDown
 	ld de, 2*SCREEN_WIDTH
 	add hl, de         ; move tile pointer two rows down
-	ld de, $100
-
-	ld bc, $400
+	lb de, 1, 0
+	lb bc, 4, SPRITE_FACING_DOWN
 	jr TryWalking
 .notDown
 	cp $80             ; $40 <= a < $80: up (or right)
@@ -223,8 +222,8 @@
 .moveUp
 	ld de, -2*SCREEN_WIDTH
 	add hl, de         ; move tile pointer two rows up
-	ld de, $ff00
-	ld bc, $804
+	lb de, -1, 0
+	lb bc, 8, SPRITE_FACING_UP
 	jr TryWalking
 .notUp
 	cp $c0             ; $80 <= a < $c0: left (or up)
@@ -235,8 +234,8 @@
 .moveLeft
 	dec hl
 	dec hl             ; move tile pointer two columns left
-	ld de, $ff
-	ld bc, $208
+	lb de, 0, -1
+	lb bc, 2, SPRITE_FACING_LEFT
 	jr TryWalking
 .notLeft              ; $c0 <= a: right (or down)
 	ld a, [wCurSpriteMovement2]
@@ -245,8 +244,8 @@
 .moveRight
 	inc hl
 	inc hl             ; move tile pointer two columns right
-	ld de, $1
-	ld bc, $10c
+	lb de, 0, 1
+	lb bc, 1, SPRITE_FACING_RIGHT
 	jr TryWalking
 
 ; changes facing direction by zeroing the movement delta and calling TryWalking
--- a/engine/palettes.asm
+++ b/engine/palettes.asm
@@ -328,10 +328,10 @@
 	ld [$fff9],a
 ; send RESET signal (P14=LOW, P15=LOW)
 	xor a
-	ld [$ff00],a
+	ld [rJOYP],a
 ; set P14=HIGH, P15=HIGH
 	ld a,$30
-	ld [$ff00],a
+	ld [rJOYP],a
 ;load length of packets (16 bytes)
 	ld b,$10
 .nextByte
@@ -348,10 +348,10 @@
 ; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0)
 	ld a,$20
 .next0
-	ld [$ff00],a
+	ld [rJOYP],a
 ; must set P14=HIGH,P15=HIGH between each "pulse"
 	ld a,$30
-	ld [$ff00],a
+	ld [rJOYP],a
 ; rotation will put next bit in 0th position (so  we can always use command
 ; "bit 0,d" to fetch the bit that has to be sent)
 	rr d
@@ -362,10 +362,10 @@
 	jr nz,.nextByte
 ; send bit 1 as a "stop bit" (end of parameter data)
 	ld a,$20
-	ld [$ff00],a
+	ld [rJOYP],a
 ; set P14=HIGH,P15=HIGH
 	ld a,$30
-	ld [$ff00],a
+	ld [rJOYP],a
 	xor a
 	ld [$fff9],a
 ; wait for about 70000 cycles
@@ -448,38 +448,38 @@
 	ld [$fff9], a
 	ei
 	call Wait7000
-	ld a, [rJOYP] ; $ff0
+	ld a, [rJOYP]
 	and $3
 	cp $3
 	jr nz, .asm_720fd
 	ld a, $20
-	ld [rJOYP], a ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
+	ld [rJOYP], a
+	ld a, [rJOYP]
+	ld a, [rJOYP]
 	call Wait7000
 	call Wait7000
 	ld a, $30
-	ld [rJOYP], a ; $ff0
+	ld [rJOYP], a
 	call Wait7000
 	call Wait7000
 	ld a, $10
-	ld [rJOYP], a ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
+	ld [rJOYP], a
+	ld a, [rJOYP]
+	ld a, [rJOYP]
+	ld a, [rJOYP]
+	ld a, [rJOYP]
+	ld a, [rJOYP]
+	ld a, [rJOYP]
 	call Wait7000
 	call Wait7000
 	ld a, $30
-	ld [rJOYP], a ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
-	ld a, [rJOYP] ; $ff0
+	ld [rJOYP], a
+	ld a, [rJOYP]
+	ld a, [rJOYP]
+	ld a, [rJOYP]
 	call Wait7000
 	call Wait7000
-	ld a, [rJOYP] ; $ff0
+	ld a, [rJOYP]
 	and $3
 	cp $3
 	jr nz, .asm_720fd
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -111,7 +111,7 @@
 	add_predef InternalClockTradeAnim
 	add_predef TrainerEngage
 	add_predef IndexToPokedex
-	add_predef DisplayPicCenteredOrUpperRight; 3B display pic?
+	add_predef DisplayPicCenteredOrUpperRight
 	add_predef UsedCut
 	add_predef ShowPokedexData
 	add_predef WriteMonMoves
@@ -128,15 +128,15 @@
 	add_predef DrawEnemyHUDAndHPBar
 	add_predef LoadTownMap_Nest
 	add_predef PrintMonType
-	add_predef EmotionBubble; 4C player exclamation
+	add_predef EmotionBubble
 	add_predef EmptyFunc3; return immediately
 	add_predef AskName
 	add_predef PewterGuys
 	add_predef SaveSAVtoSRAM2
-	add_predef LoadSAVCheckSum2
+	add_predef LoadSAV2
 	add_predef LoadSAV
 	add_predef SaveSAVtoSRAM1
-	add_predef DoInGameTradeDialogue ; 54 initiate trade
+	add_predef DoInGameTradeDialogue
 	add_predef HallOfFamePC
 	add_predef DisplayDexRating
 	dbw $1E, _LeaveMapAnim ; wrong bank
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -4,11 +4,11 @@
 	call ClearScreen
 	call LoadFontTilePatterns
 	call LoadTextBoxTilePatterns
-	call LoadSAVCheckSum
+	call LoadSAV0
 	jr c, .badsum
-	call LoadSAVCheckSum1
+	call LoadSAV1
 	jr c, .badsum
-	call LoadSAVCheckSum2
+	call LoadSAV2
 	jr c, .badsum
 	ld a, $2 ; good checksum
 	jr .goodsum
@@ -24,7 +24,7 @@
 	res 6, [hl]
 	ld a, $1 ; bad checksum
 .goodsum
-	ld [wd088], a ; checksum flag
+	ld [wSaveFileStatus], a
 	ret
 
 FileDataDestroyedText: ; 7361e (1c:761e)
@@ -31,7 +31,7 @@
 	TX_FAR _FileDataDestroyedText
 	db "@"
 
-LoadSAVCheckSum: ; 73623 (1c:7623)
+LoadSAV0: ; 73623 (1c:7623)
 	ld a, SRAM_ENABLE
 	ld [MBC1SRamEnable], a
 	ld a, $1
@@ -43,7 +43,9 @@
 	ld c, a
 	ld a, [sMainDataCheckSum] ; SAV's checksum
 	cp c
-	jp z, .Func_73652
+	jp z, .checkSumsMatched
+
+; If the computed checksum didn't match the saved on, try again.
 	ld hl, sPlayerName
 	ld bc, sMainDataCheckSum - sPlayerName
 	call SAVCheckSum
@@ -52,7 +54,7 @@
 	cp c
 	jp nz, SAVBadCheckSum
 
-.Func_73652 ; 73652 (1c:7652)
+.checkSumsMatched
 	ld hl, sPlayerName
 	ld de, wPlayerName
 	ld bc, 11
@@ -76,7 +78,7 @@
 	and a
 	jp SAVGoodChecksum
 
-LoadSAVCheckSum1: ; 73690 (1c:7690)
+LoadSAV1: ; 73690 (1c:7690)
 	ld a, SRAM_ENABLE
 	ld [MBC1SRamEnable], a
 	ld a, $1
@@ -96,7 +98,7 @@
 	and a
 	jp SAVGoodChecksum
 
-LoadSAVCheckSum2: ; 736bd (1c:76bd)
+LoadSAV2: ; 736bd (1c:76bd)
 	ld a, SRAM_ENABLE
 	ld [MBC1SRamEnable], a
 	ld a, $1
@@ -129,10 +131,11 @@
 	ld [MBC1SRamEnable], a
 	ret
 
-Func_73701: ; 73701 (1c:7701)
-	call LoadSAVCheckSum
-	call LoadSAVCheckSum1
-	jp LoadSAVCheckSum2
+LoadSAVIgnoreBadCheckSum: ; 73701 (1c:7701)
+; unused function that loads save data and ignores bad checksums
+	call LoadSAV0
+	call LoadSAV1
+	jp LoadSAV2
 
 SaveSAV: ; 7370a (1c:770a)
 	callba PrintSaveScreenText
@@ -140,7 +143,7 @@
 	call SaveSAVConfirm
 	and a   ;|0 = Yes|1 = No|
 	ret nz
-	ld a,[wd088]
+	ld a,[wSaveFileStatus]
 	dec a
 	jr z,.save
 	call SAVCheckRandomID
@@ -270,7 +273,7 @@
 
 SaveSAVtoSRAM: ; 73848 (1c:7848)
 	ld a, $2
-	ld [wd088], a
+	ld [wSaveFileStatus], a
 	call SaveSAVtoSRAM0
 	call SaveSAVtoSRAM1
 	jp SaveSAVtoSRAM2
@@ -277,7 +280,7 @@
 
 SAVCheckSum: ; 73856 (1c:7856)
 ;Check Sum (result[1 byte] is complemented)
-	ld d, $0
+	ld d, 0
 .loop
 	ld a, [hli]
 	add d
@@ -290,11 +293,11 @@
 	cpl
 	ret
 
-Func_73863: ; 73863 (1c:7863)
+CalcIndividualBoxCheckSums: ; 73863 (1c:7863)
 	ld hl, sBox1 ; sBox7
-	ld de, sBoxes1CheckSum2 ; sBoxes2CheckSum2
+	ld de, sBank2IndividualBoxChecksums ; sBank3IndividualBoxChecksums
 	ld b, NUM_BOXES / 2
-.asm_7386b
+.loop
 	push bc
 	push de
 	ld bc, wBoxMonNicksEnd - W_NUMINBOX
@@ -304,21 +307,23 @@
 	inc de
 	pop bc
 	dec b
-	jr nz, .asm_7386b
+	jr nz, .loop
 	ret
 
-Func_7387b: ; 7387b (1c:787b)
-	ld hl, PointerTable_73895
+GetBoxSRAMLocation: ; 7387b (1c:787b)
+; in: a = box num
+; out: b = box SRAM bank, hl = pointer to start of box
+	ld hl, BoxSRAMPointerTable
 	ld a, [wCurrentBoxNum]
 	and $7f
 	cp NUM_BOXES / 2
-	ld b, $2
-	jr c, .asm_7388c
+	ld b, 2
+	jr c, .next
 	inc b
 	sub NUM_BOXES / 2
-.asm_7388c
+.next
 	ld e, a
-	ld d, $0
+	ld d, 0
 	add hl, de
 	add hl, de
 	ld a, [hli]
@@ -326,7 +331,7 @@
 	ld l, a
 	ret
 
-PointerTable_73895: ; 73895 (1c:7895)
+BoxSRAMPointerTable: ; 73895 (1c:7895)
 	dw sBox1 ; sBox7
 	dw sBox2 ; sBox8
 	dw sBox3 ; sBox9
@@ -342,9 +347,9 @@
 	and a
 	ret nz ; return if No was chosen
 	ld hl, wCurrentBoxNum
-	bit 7, [hl]
-	call z, Func_73a29
-	call Func_7393f
+	bit 7, [hl] ; is it the first time player is changing the box?
+	call z, EmptyAllSRAMBoxes ; if so, empty all boxes in SRAM
+	call DisplayChangeBoxMenu
 	call UpdateSprites
 	ld hl, hFlags_0xFFF6
 	set 1, [hl]
@@ -353,17 +358,17 @@
 	res 1, [hl]
 	bit 1, a
 	ret nz
-	call Func_7387b
+	call GetBoxSRAMLocation
 	ld e, l
 	ld d, h
 	ld hl, W_NUMINBOX
-	call Func_7390e
+	call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM
 	ld a, [wCurrentMenuItem]
 	set 7, a
 	ld [wCurrentBoxNum], a
-	call Func_7387b
+	call GetBoxSRAMLocation
 	ld de, W_NUMINBOX
-	call Func_7390e
+	call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM
 	ld hl, W_MAPTEXTPTR
 	ld de, wChangeBoxSavedMapTextPointer
 	ld a, [hli]
@@ -384,7 +389,8 @@
 	TX_FAR _WhenYouChangeBoxText
 	db "@"
 
-Func_7390e: ; 7390e (1c:790e)
+CopyBoxToOrFromSRAM: ; 7390e (1c:790e)
+; copy an entire box from hl to de with b as the SRAM bank
 	push hl
 	ld a, SRAM_ENABLE
 	ld [MBC1SRamEnable], a
@@ -395,30 +401,33 @@
 	ld bc, wBoxMonNicksEnd - W_NUMINBOX
 	call CopyData
 	pop hl
+
+; mark the memory that the box was copied from as am empty box
 	xor a
 	ld [hli], a
 	dec a
 	ld [hl], a
+
 	ld hl, sBox1 ; sBox7
-	ld bc, sBoxes1CheckSum - sBox1
+	ld bc, sBank2AllBoxesChecksum - sBox1
 	call SAVCheckSum
-	ld [sBoxes1CheckSum], a ; sBoxes2CheckSum
-	call Func_73863
+	ld [sBank2AllBoxesChecksum], a ; sBank3AllBoxesChecksum
+	call CalcIndividualBoxCheckSums
 	xor a
 	ld [MBC1SRamBankingMode], a
 	ld [MBC1SRamEnable], a
 	ret
 
-Func_7393f: ; 7393f (1c:793f)
+DisplayChangeBoxMenu: ; 7393f (1c:793f)
 	xor a
 	ld [H_AUTOBGTRANSFERENABLED], a
-	ld a, $3
+	ld a, A_BUTTON | B_BUTTON
 	ld [wMenuWatchedKeys], a
-	ld a, $b
+	ld a, 11
 	ld [wMaxMenuItem], a
-	ld a, $1
+	ld a, 1
 	ld [wTopMenuItemY], a
-	ld a, $c
+	ld a, 12
 	ld [wTopMenuItemX], a
 	xor a
 	ld [wMenuWatchMovingOutOfBounds], a
@@ -427,14 +436,14 @@
 	ld [wCurrentMenuItem], a
 	ld [wLastMenuItem], a
 	coord hl, 0, 0
-	ld b, $2
-	ld c, $9
+	ld b, 2
+	ld c, 9
 	call TextBoxBorder
 	ld hl, ChooseABoxText
 	call PrintText
 	coord hl, 11, 0
-	ld b, $c
-	ld c, $7
+	ld b, 12
+	ld c, 7
 	call TextBoxBorder
 	ld hl, hFlags_0xFFF6
 	set 2, [hl]
@@ -446,37 +455,37 @@
 	ld a, [wCurrentBoxNum]
 	and $7f
 	cp 9
-	jr c, .asm_739a6
+	jr c, .singleDigitBoxNum
 	sub 9
 	coord hl, 8, 2
 	ld [hl], "1"
 	add "0"
-	jr .asm_739a8
-.asm_739a6
+	jr .next
+.singleDigitBoxNum
 	add "1"
-.asm_739a8
+.next
 	Coorda 9, 2
 	coord hl, 1, 2
 	ld de, BoxNoText
 	call PlaceString
-	call Func_73a84
+	call GetMonCountsForAllBoxes
 	coord hl, 18, 1
-	ld de, wWhichTrade
+	ld de, wBoxMonCounts
 	ld bc, SCREEN_WIDTH
 	ld a, $c
-.asm_739c2
+.loop
 	push af
 	ld a, [de]
-	and a
-	jr z, .asm_739c9
-	ld [hl], $78
-.asm_739c9
+	and a ; is the box empty?
+	jr z, .skipPlacingPokeball
+	ld [hl], $78 ; place pokeball tile next to box name if box not empty
+.skipPlacingPokeball
 	add hl, bc
 	inc de
 	pop af
 	dec a
-	jr nz, .asm_739c2
-	ld a, $1
+	jr nz, .loop
+	ld a, 1
 	ld [H_AUTOBGTRANSFERENABLED], a
 	ret
 
@@ -501,43 +510,46 @@
 BoxNoText: ; 73a21 (1c:7a21)
 	db "BOX No.@"
 
-Func_73a29: ; 73a29 (1c:7a29)
+EmptyAllSRAMBoxes: ; 73a29 (1c:7a29)
+; marks all boxes in SRAM as empty (initialisation for the first time the
+; player changes the box)
 	ld a, SRAM_ENABLE
 	ld [MBC1SRamEnable], a
 	ld a, $1
 	ld [MBC1SRamBankingMode], a
-	ld a, $2
+	ld a, 2
 	ld [MBC1SRamBank], a
-	call Func_73a4b
-	ld a, $3
+	call EmptySRAMBoxesInBank
+	ld a, 3
 	ld [MBC1SRamBank], a
-	call Func_73a4b
+	call EmptySRAMBoxesInBank
 	xor a
 	ld [MBC1SRamBankingMode], a
 	ld [MBC1SRamEnable], a
 	ret
 
-Func_73a4b: ; 73a4b (1c:7a4b)
+EmptySRAMBoxesInBank: ; 73a4b (1c:7a4b)
+; marks every box in the current SRAM bank as empty
 	ld hl, sBox1 ; sBox7
-	call Func_73a7f
+	call EmptySRAMBox
 	ld hl, sBox2 ; sBox8
-	call Func_73a7f
+	call EmptySRAMBox
 	ld hl, sBox3 ; sBox9
-	call Func_73a7f
+	call EmptySRAMBox
 	ld hl, sBox4 ; sBox10
-	call Func_73a7f
+	call EmptySRAMBox
 	ld hl, sBox5 ; sBox11
-	call Func_73a7f
+	call EmptySRAMBox
 	ld hl, sBox6 ; sBox12
-	call Func_73a7f
+	call EmptySRAMBox
 	ld hl, sBox1 ; sBox7
-	ld bc, sBoxes1CheckSum - sBox1
+	ld bc, sBank2AllBoxesChecksum - sBox1
 	call SAVCheckSum
-	ld [sBoxes1CheckSum], a ; sBoxes2CheckSum
-	call Func_73863
+	ld [sBank2AllBoxesChecksum], a ; sBank3AllBoxesChecksum
+	call CalcIndividualBoxCheckSums
 	ret
 
-Func_73a7f: ; 73a7f (1c:7a7f)
+EmptySRAMBox: ; 73a7f (1c:7a7f)
 	xor a
 	ld [hli], a
 	dec a
@@ -544,8 +556,8 @@
 	ld [hl], a
 	ret
 
-Func_73a84: ; 73a84 (1c:7a84)
-	ld hl, wWhichTrade
+GetMonCountsForAllBoxes: ; 73a84 (1c:7a84)
+	ld hl, wBoxMonCounts
 	push hl
 	ld a, SRAM_ENABLE
 	ld [MBC1SRamEnable], a
@@ -553,24 +565,27 @@
 	ld [MBC1SRamBankingMode], a
 	ld a, $2
 	ld [MBC1SRamBank], a
-	call Func_73ab8
+	call GetMonCountsForBoxesInBank
 	ld a, $3
 	ld [MBC1SRamBank], a
-	call Func_73ab8
+	call GetMonCountsForBoxesInBank
 	xor a
 	ld [MBC1SRamBankingMode], a
 	ld [MBC1SRamEnable], a
 	pop hl
+
+; copy the count for the current box from WRAM
 	ld a, [wCurrentBoxNum]
 	and $7f
 	ld c, a
-	ld b, $0
+	ld b, 0
 	add hl, bc
 	ld a, [W_NUMINBOX]
 	ld [hl], a
+
 	ret
 
-Func_73ab8: ; 73ab8 (1c:7ab8)
+GetMonCountsForBoxesInBank: ; 73ab8 (1c:7ab8)
 	ld a, [sBox1] ; sBox7
 	ld [hli], a
 	ld a, [sBox2] ; sBox8
@@ -646,7 +661,7 @@
 LoadHallOfFameTeams: ; 73b3f (1c:7b3f)
 	ld hl, sHallOfFame
 	ld bc, HOF_TEAM
-	ld a, [wWhichTrade]
+	ld a, [wHoFTeamIndex]
 	call AddNTimes
 	ld de, wcc5b
 	ld bc, HOF_TEAM
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -867,7 +867,7 @@
 	ld bc, $00f0
 	call CopyData
 	call EnableLCD
-	ld hl, wTrainerEngageDistance
+	ld hl, wSlotMachineWheel1Offset
 	ld a, $1c
 	ld [hli], a
 	ld [hli], a
--- a/engine/titlescreen.asm
+++ b/engine/titlescreen.asm
@@ -21,7 +21,7 @@
 	ld [wc0ef], a
 	ld [wc0f0], a
 
-LoadTitlescreenGraphics: ; 42dd (1:42dd)
+DisplayTitleScreen: ; 42dd (1:42dd)
 	call GBPalWhiteOut
 	ld a, $1
 	ld [H_AUTOBGTRANSFERENABLED], a
--- a/home/init.asm
+++ b/home/init.asm
@@ -23,17 +23,17 @@
 	xor a
 	ld [rIF], a
 	ld [rIE], a
-	ld [$ff43], a
-	ld [$ff42], a
+	ld [rSCX], a
+	ld [rSCY], a
 	ld [rSB], a
 	ld [rSC], a
 	ld [rWX], a
-	ld [$ff4a], a
-	ld [$ff06], a
-	ld [$ff07], a
+	ld [rWY], a
+	ld [rTMA], a
+	ld [rTAC], a
 	ld [rBGP], a
 	ld [rOBP0], a
-	ld [$ff49], a
+	ld [rOBP1], a
 
 	ld a, rLCDC_ENABLE_MASK
 	ld [rLCDC], a
@@ -66,10 +66,10 @@
 
 	xor a
 	ld [hTilesetType], a
-	ld [$ff41], a
+	ld [rSTAT], a
 	ld [hSCX], a
 	ld [hSCY], a
-	ld [$ff0f], a
+	ld [rIF], a
 	ld a, 1 << VBLANK + 1 << TIMER + 1 << SERIAL
 	ld [rIE], a
 
--- a/hram.asm
+++ b/hram.asm
@@ -90,6 +90,8 @@
 ; temp value used when swapping bytes
 hSwapTemp EQU $FF95
 
+hExperience EQU $FF96 ; 3 bytes, big endian
+
 ; Multiplcation and division variables are meant
 ; to overlap for back-to-back usage. Big endian.
 
@@ -260,6 +262,8 @@
 hQuotient2 EQU $FFE7
 
 hSpriteVRAMSlotAndFacing EQU $FFE9
+
+hCoordsInFrontOfPlayerMatch EQU $FFEA
 
 hSpriteAnimFrameCounter EQU $FFEA
 
--- a/macros.asm
+++ b/macros.asm
@@ -14,7 +14,7 @@
 percent EQUS "* $ff / 100"
 
 lb: MACRO ; r, hi, lo
-	ld \1, (\2) << 8 + (\3)
+	ld \1, (\2) << 8 + ((\3) & $ff)
 	ENDM
 
 
--- a/main.asm
+++ b/main.asm
@@ -3743,7 +3743,7 @@
 	dec de
 	dec de
 	xor a
-	ld [wHPBarMaxHP], a
+	ld [wLearningMovesFromDayCare], a
 	predef WriteMonMoves
 	pop de
 	ld a, [wPlayerID]  ; set trainer ID to player ID
@@ -3758,13 +3758,13 @@
 	callab CalcExperience
 	pop de
 	inc de
-	ld a, [H_MULTIPLICAND] ; write experience
+	ld a, [hExperience] ; write experience
 	ld [de], a
 	inc de
-	ld a, [H_MULTIPLICAND+1]
+	ld a, [hExperience + 1]
 	ld [de], a
 	inc de
-	ld a, [H_MULTIPLICAND+2]
+	ld a, [hExperience + 2]
 	ld [de], a
 	xor a
 	ld b, $a
--- a/scripts/agatha.asm
+++ b/scripts/agatha.asm
@@ -67,7 +67,7 @@
 	ld [hJoyHeld], a
 	ld [wSimulatedJoypadStatesEnd], a
 	ld [wSimulatedJoypadStatesIndex], a
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $3
 	jr c, .asm_764b4
 	ld hl, wd865
--- a/scripts/bruno.asm
+++ b/scripts/bruno.asm
@@ -67,7 +67,7 @@
 	ld [hJoyHeld], a
 	ld [wSimulatedJoypadStatesEnd], a
 	ld [wSimulatedJoypadStatesIndex], a
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $3
 	jr c, .asm_7635d
 	ld hl, wd864
--- a/scripts/ceruleancity.asm
+++ b/scripts/ceruleancity.asm
@@ -42,7 +42,7 @@
 	ld hl, CeruleanCityCoords1
 	call ArePlayerCoordsInArray
 	jr nc, .asm_194f7
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	ld a, $8
 	ld b, SPRITE_FACING_DOWN
--- a/scripts/daycarem.asm
+++ b/scripts/daycarem.asm
@@ -9,19 +9,19 @@
 	call SaveScreenTilesToBuffer2
 	ld a, [W_DAYCARE_IN_USE]
 	and a
-	jp nz, DayCareMScript_562e1
-	ld hl, DayCareMText_5640f
+	jp nz, .daycareInUse
+	ld hl, DayCareIntroText
 	call PrintText
 	call YesNoChoice
 	ld a, [wCurrentMenuItem]
 	and a
-	ld hl, DayCareMText_5643b
-	jp nz, DayCareMScript_56409
+	ld hl, DayCareComeAgainText
+	jp nz, .done
 	ld a, [wPartyCount]
 	dec a
-	ld hl, DayCareMText_56445
-	jp z, DayCareMScript_56409
-	ld hl, DayCareMText_56414
+	ld hl, DayCareOnlyHaveOneMonText
+	jp z, .done
+	ld hl, DayCareWhichMonText
 	call PrintText
 	xor a
 	ld [wUpdateSpritesEnabled], a
@@ -33,17 +33,17 @@
 	call RestoreScreenTilesAndReloadTilePatterns
 	call LoadGBPal
 	pop af
-	ld hl, DayCareMText_56437
-	jp c, DayCareMScript_56409
+	ld hl, DayCareAllRightThenText
+	jp c, .done
 	callab KnowsHMMove
-	ld hl, DayCareMText_5644a
-	jp c, DayCareMScript_56409
+	ld hl, DayCareCantAcceptMonWithHMText
+	jp c, .done
 	xor a
 	ld [wPartyAndBillsPCSavedMenuItem], a
 	ld a, [wWhichPokemon]
 	ld hl, wPartyMonNicks
 	call GetPartyMonName
-	ld hl, DayCareMText_56419
+	ld hl, DayCareWillLookAfterMonText
 	call PrintText
 	ld a, 1
 	ld [W_DAYCARE_IN_USE], a
@@ -55,10 +55,10 @@
 	call RemovePokemon
 	ld a, [wcf91]
 	call PlayCry
-	ld hl, DayCareMText_5641e
-	jp DayCareMScript_56409
+	ld hl, DayCareComeSeeMeInAWhileText
+	jp .done
 
-DayCareMScript_562e1: ; 562e1 (15:62e1)
+.daycareInUse
 	xor a
 	ld hl, W_DAYCAREMONNAME
 	call GetPartyMonName
@@ -68,40 +68,41 @@
 	callab CalcLevelFromExperience
 	ld a, d
 	cp MAX_LEVEL
-	jr c, .asm_56315
+	jr c, .skipCalcExp
+
 	ld d, MAX_LEVEL
 	callab CalcExperience
 	ld hl, wDayCareMonExp
-	ld a, [H_NUMTOPRINT]
+	ld a, [hExperience]
 	ld [hli], a
-	ld a, [$ff97]
+	ld a, [hExperience + 1]
 	ld [hli], a
-	ld a, [$ff98]
+	ld a, [hExperience + 2]
 	ld [hl], a
 	ld d, MAX_LEVEL
 
-.asm_56315
+.skipCalcExp
 	xor a
-	ld [wTrainerEngageDistance], a
+	ld [wDayCareNumLevelsGrown], a
 	ld hl, wDayCareMonBoxLevel
 	ld a, [hl]
-	ld [wTrainerSpriteOffset], a
+	ld [wDayCareStartLevel], a
 	cp d
 	ld [hl], d
-	ld hl, DayCareMText_56432
-	jr z, .asm_56333
-	ld a, [wTrainerSpriteOffset]
+	ld hl, DayCareMonNeedsMoreTimeText
+	jr z, .next
+	ld a, [wDayCareStartLevel]
 	ld b, a
 	ld a, d
 	sub b
-	ld [wTrainerEngageDistance], a
-	ld hl, DayCareMText_56423
+	ld [wDayCareNumLevelsGrown], a
+	ld hl, DayCareMonHasGrownText
 
-.asm_56333
+.next
 	call PrintText
 	ld a, [wPartyCount]
 	cp PARTY_LENGTH
-	ld hl, DayCareMText_56440
+	ld hl, DayCareNoRoomForMonText
 	jp z, .asm_56403
 	ld de, wTrainerFacingDirection
 	xor a
@@ -112,7 +113,7 @@
 	ld a, $1
 	ld [hli], a
 	ld [hl], $0
-	ld a, [wTrainerEngageDistance]
+	ld a, [wDayCareNumLevelsGrown]
 	inc a
 	ld b, a
 	ld c, $2
@@ -126,13 +127,13 @@
 	pop hl
 	dec b
 	jr nz, .asm_56357
-	ld hl, DayCareMText_56428
+	ld hl, DayCareOweMoneyText
 	call PrintText
 	ld a, $13
 	ld [wTextBoxID], a
 	call DisplayTextBoxID
 	call YesNoChoice
-	ld hl, DayCareMText_56437
+	ld hl, DayCareAllRightThenText
 	ld a, [wCurrentMenuItem]
 	and a
 	jp nz, .asm_56403
@@ -144,13 +145,13 @@
 	ld [hMoney + 2], a
 	call HasEnoughMoney
 	jr nc, .asm_56396
-	ld hl, DayCareMText_56454
+	ld hl, DayCareNotEnoughMoneyText
 	jp .asm_56403
 
 .asm_56396
 	xor a
 	ld [W_DAYCARE_IN_USE], a
-	ld hl, wTrainerEngageDistance
+	ld hl, wDayCareNumLevelsGrown
 	ld [hli], a
 	inc hl
 	ld de, wPlayerMoney + 2
@@ -161,7 +162,7 @@
 	ld a, MONEY_BOX
 	ld [wTextBoxID], a
 	call DisplayTextBoxID
-	ld hl, DayCareMText_5644f
+	ld hl, DayCareHeresYourMonText
 	call PrintText
 	ld a, DAYCARE_TO_PARTY
 	ld [wMoveMonType], a
@@ -178,10 +179,12 @@
 	ld d, h
 	ld e, l
 	ld a, 1
-	ld [wHPBarMaxHP], a
+	ld [wLearningMovesFromDayCare], a
 	predef WriteMonMoves
 	pop bc
 	pop af
+
+; set mon's HP to max
 	ld hl, wPartyMon1HP
 	call AddNTimes
 	ld d, h
@@ -193,73 +196,74 @@
 	inc de
 	ld a, [hl]
 	ld [de], a
+
 	ld a, [wcf91]
 	call PlayCry
-	ld hl, DayCareMText_5642d
-	jr DayCareMScript_56409
+	ld hl, DayCareGotMonBackText
+	jr .done
 
 .asm_56403
-	ld a, [wTrainerSpriteOffset]
+	ld a, [wDayCareStartLevel]
 	ld [wDayCareMonBoxLevel], a
 
-DayCareMScript_56409: ; 56409 (15:6409)
+.done
 	call PrintText
 	jp TextScriptEnd
 
-DayCareMText_5640f: ; 5640f (15:640f)
-	TX_FAR _DayCareMText_5640f
+DayCareIntroText: ; 5640f (15:640f)
+	TX_FAR _DayCareIntroText
 	db "@"
 
-DayCareMText_56414: ; 56414 (15:6414)
-	TX_FAR _DayCareMText_56414
+DayCareWhichMonText: ; 56414 (15:6414)
+	TX_FAR _DayCareWhichMonText
 	db "@"
 
-DayCareMText_56419: ; 56419 (15:6419)
-	TX_FAR _DayCareMText_56419
+DayCareWillLookAfterMonText: ; 56419 (15:6419)
+	TX_FAR _DayCareWillLookAfterMonText
 	db "@"
 
-DayCareMText_5641e: ; 5641e (15:641e)
-	TX_FAR _DayCareMText_5641e
+DayCareComeSeeMeInAWhileText: ; 5641e (15:641e)
+	TX_FAR _DayCareComeSeeMeInAWhileText
 	db "@"
 
-DayCareMText_56423: ; 56423 (15:6423)
-	TX_FAR _DayCareMText_56423
+DayCareMonHasGrownText: ; 56423 (15:6423)
+	TX_FAR _DayCareMonHasGrownText
 	db "@"
 
-DayCareMText_56428: ; 56428 (15:6428)
-	TX_FAR _DayCareMText_56428
+DayCareOweMoneyText: ; 56428 (15:6428)
+	TX_FAR _DayCareOweMoneyText
 	db "@"
 
-DayCareMText_5642d: ; 5642d (15:642d)
-	TX_FAR _DayCareMText_5642d
+DayCareGotMonBackText: ; 5642d (15:642d)
+	TX_FAR _DayCareGotMonBackText
 	db "@"
 
-DayCareMText_56432: ; 56432 (15:6432)
-	TX_FAR _DayCareMText_56432
+DayCareMonNeedsMoreTimeText: ; 56432 (15:6432)
+	TX_FAR _DayCareMonNeedsMoreTimeText
 	db "@"
 
-DayCareMText_56437: ; 56437 (15:6437)
-	TX_FAR _DayCareMText_56437
-DayCareMText_5643b: ; 5643b (15:643b)
-	TX_FAR _DayCareMText_5643b
+DayCareAllRightThenText: ; 56437 (15:6437)
+	TX_FAR _DayCareAllRightThenText
+DayCareComeAgainText: ; 5643b (15:643b)
+	TX_FAR _DayCareComeAgainText
 	db "@"
 
-DayCareMText_56440: ; 56440 (15:6440)
-	TX_FAR _DayCareMText_56440
+DayCareNoRoomForMonText: ; 56440 (15:6440)
+	TX_FAR _DayCareNoRoomForMonText
 	db "@"
 
-DayCareMText_56445: ; 56445 (15:6445)
-	TX_FAR _DayCareMText_56445
+DayCareOnlyHaveOneMonText: ; 56445 (15:6445)
+	TX_FAR _DayCareOnlyHaveOneMonText
 	db "@"
 
-DayCareMText_5644a: ; 5644a (15:644a)
-	TX_FAR _DayCareMText_5644a
+DayCareCantAcceptMonWithHMText: ; 5644a (15:644a)
+	TX_FAR _DayCareCantAcceptMonWithHMText
 	db "@"
 
-DayCareMText_5644f: ; 5644f (15:644f)
-	TX_FAR _DayCareMText_5644f
+DayCareHeresYourMonText: ; 5644f (15:644f)
+	TX_FAR _DayCareHeresYourMonText
 	db "@"
 
-DayCareMText_56454: ; 56454 (15:6454)
-	TX_FAR _DayCareMText_56454
+DayCareNotEnoughMoneyText: ; 56454 (15:6454)
+	TX_FAR _DayCareNotEnoughMoneyText
 	db "@"
--- a/scripts/lance.asm
+++ b/scripts/lance.asm
@@ -60,7 +60,7 @@
 	jp nc, CheckFightingMapTrainers
 	xor a
 	ld [hJoyHeld], a
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $3
 	jr nc, .asm_5a325
 	ld a, $1
--- a/scripts/lorelei.asm
+++ b/scripts/lorelei.asm
@@ -68,7 +68,7 @@
 	ld [hJoyHeld], a
 	ld [wSimulatedJoypadStatesEnd], a
 	ld [wSimulatedJoypadStatesIndex], a
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $3
 	jr c, .asm_76206
 	ld hl, wd863
--- a/scripts/mansion3.asm
+++ b/scripts/mansion3.asm
@@ -65,7 +65,7 @@
 	ret nz
 	call ArePlayerCoordsInArray
 	ret nc
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	ld [wWhichDungeonWarp], a
 	ld hl, wd72d
 	set 4, [hl]
--- a/scripts/mtmoonpokecenter.asm
+++ b/scripts/mtmoonpokecenter.asm
@@ -25,51 +25,51 @@
 	TX_ASM
 	ld a, [wd7c6]
 	add a
-	jp c, .asm_49353
+	jp c, .alreadyBoughtMagikarp
 	ld hl, MtMoonPokecenterText_4935c
 	call PrintText
-	ld a, $13
+	ld a, MONEY_BOX
 	ld [wTextBoxID], a
 	call DisplayTextBoxID
 	call YesNoChoice
 	ld a, [wCurrentMenuItem]
 	and a
-	jp nz, .asm_4934e
+	jp nz, .choseNo
 	ld [hMoney], a
 	ld [hMoney + 2], a
 	ld a, $5
 	ld [hMoney + 1], a
 	call HasEnoughMoney
-	jr nc, .asm_faa09
+	jr nc, .enoughMoney
 	ld hl, MtMoonPokecenterText_49366
-	jr .asm_49356
-.asm_faa09
+	jr .printText
+.enoughMoney
 	ld bc,(MAGIKARP << 8) | 5
 	call GivePokemon
-	jr nc, .asm_49359
+	jr nc, .done
 	xor a
-	ld [wWhichTrade], a
-	ld [wTrainerFacingDirection], a
+	ld [wPriceTemp], a
+	ld [wPriceTemp + 2], a
 	ld a, $5
-	ld [wTrainerEngageDistance], a
-	ld hl, wTrainerFacingDirection
+	ld [wPriceTemp + 1], a
+	ld hl, wPriceTemp + 2
 	ld de, wPlayerMoney + 2
 	ld c, $3
 	predef SubBCDPredef
-	ld a, $13
+	ld a, MONEY_BOX
 	ld [wTextBoxID], a
 	call DisplayTextBoxID
 	ld hl, wd7c6
 	set 7, [hl]
-	jr .asm_49359
-.asm_4934e
+	jr .done
+.choseNo
 	ld hl, MtMoonPokecenterText_49361
-	jr .asm_49356
-.asm_49353
+	jr .printText
+.alreadyBoughtMagikarp
 	ld hl, MtMoonPokecenterText_4936b
-.asm_49356
+.printText
 	call PrintText
-.asm_49359
+.done
 	jp TextScriptEnd
 
 MtMoonPokecenterText_4935c: ; 4935c (12:535c)
--- a/scripts/museum1f.asm
+++ b/scripts/museum1f.asm
@@ -96,11 +96,11 @@
 	ld hl, wd754
 	set 0, [hl]
 	xor a
-	ld [wMuseumPriceTemp], a
-	ld [wMuseumPriceTemp + 1], a
+	ld [wPriceTemp], a
+	ld [wPriceTemp + 1], a
 	ld a, $50
-	ld [wMuseumPriceTemp + 2], a
-	ld hl, wMuseumPriceTemp + 2
+	ld [wPriceTemp + 2], a
+	ld hl, wPriceTemp + 2
 	ld de, wPlayerMoney + 2
 	ld c, $3
 	predef SubBCDPredef
--- a/scripts/oakslab.asm
+++ b/scripts/oakslab.asm
@@ -307,7 +307,7 @@
 	ld a, $d
 	ld [hSpriteIndexOrTextID], a
 	call DisplayTextID
-	ld a, [wTrainerEngageDistance]
+	ld a, [wRivalStarterBallSpriteIndex]
 	cp $2
 	jr nz, .asm_1cd28
 	ld a, HS_STARTER_BALL_1
@@ -323,7 +323,7 @@
 	ld [wcc4d], a
 	predef HideObject
 	call Delay3
-	ld a, [wWhichTrade]
+	ld a, [wRivalStarterTemp]
 	ld [W_RIVALSTARTER], a
 	ld [wcf91], a
 	ld [wd11e], a
@@ -806,9 +806,9 @@
 OaksLabText2: ; 1d102 (7:5102)
 	TX_ASM
 	ld a, STARTER2
-	ld [wWhichTrade], a
+	ld [wRivalStarterTemp], a
 	ld a, $3
-	ld [wTrainerEngageDistance], a
+	ld [wRivalStarterBallSpriteIndex], a
 	ld a, STARTER1
 	ld b, $2
 	jr OaksLabScript_1d133
@@ -817,9 +817,9 @@
 OaksLabText3: ; 1d113 (7:5113)
 	TX_ASM
 	ld a, STARTER3
-	ld [wWhichTrade], a
+	ld [wRivalStarterTemp], a
 	ld a, $4
-	ld [wTrainerEngageDistance], a
+	ld [wRivalStarterBallSpriteIndex], a
 	ld a, STARTER2
 	ld b, $3
 	jr OaksLabScript_1d133
@@ -828,9 +828,9 @@
 OaksLabText4: ; 1d124 (7:5124)
 	TX_ASM
 	ld a, STARTER1
-	ld [wWhichTrade], a
+	ld [wRivalStarterTemp], a
 	ld a, $2
-	ld [wTrainerEngageDistance], a
+	ld [wRivalStarterBallSpriteIndex], a
 	ld a, STARTER3
 	ld b, $4
 
@@ -858,13 +858,13 @@
 	ld a, $9
 	ld [H_SPRITEDATAOFFSET], a
 	call GetPointerWithinSpriteStateData1
-	ld [hl], $0
+	ld [hl], SPRITE_FACING_DOWN
 	ld a, $1
 	ld [H_SPRITEINDEX], a
 	ld a, $9
 	ld [H_SPRITEDATAOFFSET], a
 	call GetPointerWithinSpriteStateData1
-	ld [hl], $c
+	ld [hl], SPRITE_FACING_RIGHT
 	ld hl, wd730
 	set 6, [hl]
 	predef StarterDex  ; StarterDex
--- a/scripts/pewterpokecenter.asm
+++ b/scripts/pewterpokecenter.asm
@@ -26,15 +26,16 @@
 	ld c, 32
 	call DelayFrames
 	ld hl, JigglypuffFacingDirections
-	ld de, wTrainerFacingDirection
-	ld bc, $0004
+	ld de, wJigglypuffFacingDirections
+	ld bc, 4
 	call CopyData
-	ld a, [wSpriteStateData1 + $32]
-	ld hl, wTrainerFacingDirection
-.asm_5c5c3
+
+	ld a, [wSpriteStateData1 + 3 * $10 + $2]
+	ld hl, wJigglypuffFacingDirections
+.findMatchingFacingDirectionLoop
 	cp [hl]
 	inc hl
-	jr nz, .asm_5c5c3
+	jr nz, .findMatchingFacingDirectionLoop
 	dec hl
 	push hl
 	ld c, BANK(Music_JigglypuffSong)
@@ -41,24 +42,29 @@
 	ld a, MUSIC_JIGGLYPUFF_SONG
 	call PlayMusic
 	pop hl
-.asm_5c5d1
+.loop
 	ld a, [hl]
-	ld [wSpriteStateData1 + $32], a
+	ld [wSpriteStateData1 + 3 * $10 + $2], a
+
+; rotate the array
 	push hl
-	ld hl, wTrainerFacingDirection
-	ld de, wTrainerEngageDistance
-	ld bc, $0004
+	ld hl, wJigglypuffFacingDirections
+	ld de, wJigglypuffFacingDirections - 1
+	ld bc, 4
 	call CopyData
-	ld a, [wTrainerEngageDistance]
-	ld [wcd42], a
+	ld a, [wJigglypuffFacingDirections - 1]
+	ld [wJigglypuffFacingDirections + 3], a
 	pop hl
+
 	ld c, 24
 	call DelayFrames
+
 	ld a, [wc026]
 	ld b, a
 	ld a, [wc027]
 	or b
-	jr nz, .asm_5c5d1
+	jr nz, .loop
+
 	ld c, 48
 	call DelayFrames
 	call PlayDefaultMusic
--- a/scripts/safarizoneentrance.asm
+++ b/scripts/safarizoneentrance.asm
@@ -26,7 +26,7 @@
 	ld [hJoyHeld], a
 	ld a, SPRITE_FACING_RIGHT
 	ld [wSpriteStateData1 + 9], a
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	jr z, .asm_7520f
 	ld a, $2
--- a/scripts/seafoamislands1.asm
+++ b/scripts/seafoamislands1.asm
@@ -10,7 +10,7 @@
 	call CheckBoulderCoords
 	ret nc
 	ld hl, wd7e8
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	jr nz, .asm_44819
 	set 6, [hl]
@@ -36,7 +36,7 @@
 	ld a, $9f
 	ld [wDungeonWarpDestinationMap], a
 	ld hl, Seafoam1HolesCoords
-	jp Func_46981
+	jp IsPlayerOnDungeonWarp
 
 Seafoam1HolesCoords: ; 44846 (11:4846)
 	db $06,$11
--- a/scripts/seafoamislands2.asm
+++ b/scripts/seafoamislands2.asm
@@ -8,7 +8,7 @@
 	call CheckBoulderCoords
 	ret nc
 	ld hl, wd87f
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	jr nz, .asm_46340
 	set 0, [hl]
@@ -34,7 +34,7 @@
 	ld a, $a0
 	ld [wDungeonWarpDestinationMap], a
 	ld hl, Seafoam2HolesCoords
-	jp Func_46981
+	jp IsPlayerOnDungeonWarp
 
 Seafoam2HolesCoords: ; 4636d (11:636d)
 	db $06,$12
--- a/scripts/seafoamislands3.asm
+++ b/scripts/seafoamislands3.asm
@@ -8,7 +8,7 @@
 	call CheckBoulderCoords
 	ret nc
 	ld hl, wd880
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	jr nz, .asm_4647c
 	set 0, [hl]
@@ -34,7 +34,7 @@
 	ld a, $a1
 	ld [wDungeonWarpDestinationMap], a
 	ld hl, Seafoam3HolesCoords
-	jp Func_46981
+	jp IsPlayerOnDungeonWarp
 
 Seafoam3HolesCoords: ; 464a9 (11:64a9)
 	db $06,$13
--- a/scripts/seafoamislands4.asm
+++ b/scripts/seafoamislands4.asm
@@ -8,7 +8,7 @@
 	call CheckBoulderCoords
 	ret nc
 	ld hl, wd881
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	jr nz, .asm_465b8
 	set 0, [hl]
@@ -35,7 +35,7 @@
 	ld a, $a2
 	ld [wDungeonWarpDestinationMap], a
 	ld hl, Seafoam4HolesCoords
-	call Func_46981
+	call IsPlayerOnDungeonWarp
 	ld a, [wd732]
 	bit 4, a
 	ret nz
--- a/scripts/seafoamislands5.asm
+++ b/scripts/seafoamislands5.asm
@@ -34,7 +34,7 @@
 	ld hl, CoordsData_467fe
 	call ArePlayerCoordsInArray
 	ret nc
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $3
 	jr nc, .asm_467e6
 	ld a, $40
@@ -81,7 +81,7 @@
 	call ArePlayerCoordsInArray
 	ld a, $0
 	jr nc, .asm_46849
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	jr nz, .asm_46837
 	ld de, RLEMovementData_46859
--- a/scripts/silphco7.asm
+++ b/scripts/silphco7.asm
@@ -142,7 +142,7 @@
 	ld [H_SPRITEINDEX], a
 	call SetSpriteMovementBytesToFF
 	ld de, MovementData_51c7d
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	ld [wcf0d], a
 	cp $1
 	jr z, .asm_51c6c
--- a/scripts/vermiliondock.asm
+++ b/scripts/vermiliondock.asm
@@ -57,15 +57,15 @@
 	ld bc, $0078
 	ld a, $14
 	call FillMemory
-	ld a, $1
-	ld [$ffba], a
+	ld a, 1
+	ld [H_AUTOBGTRANSFERENABLED], a
 	call Delay3
 	xor a
-	ld [$ffba], a
-	ld [wWhichTrade], a
-	ld [$ff49], a
-	ld a, $58
-	ld [wTrainerEngageDistance], a
+	ld [H_AUTOBGTRANSFERENABLED], a
+	ld [wSSAnneSmokeDriftAmount], a
+	ld [rOBP1], a
+	ld a, 88
+	ld [wSSAnneSmokeX], a
 	ld hl, wMapViewVRAMPointer
 	ld c, [hl]
 	inc hl
@@ -88,11 +88,11 @@
 	push hl
 	push de
 	call ScheduleEastColumnRedraw
-	call VermilionDock_1dc59
+	call VermilionDock_EmitSmokePuff
 	pop de
 	ld b, $10
 .asm_1dc11
-	call VermilionDock_1dc42
+	call VermilionDock_AnimSmokePuffDriftRight
 	ld c, $8
 .asm_1dc16
 	call VermilionDock_1dc7c
@@ -105,7 +105,7 @@
 	dec e
 	jr nz, .asm_1dbfa
 	xor a
-	ld [$ff4a], a
+	ld [rWY], a
 	ld [hWY], a
 	call VermilionDock_1dc94
 	ld a, $90
@@ -122,33 +122,34 @@
 	dec [hl]
 	ret
 
-VermilionDock_1dc42: ; 1dc42 (7:5c42)
+VermilionDock_AnimSmokePuffDriftRight: ; 1dc42 (7:5c42)
 	push bc
 	push de
 	ld hl, wOAMBuffer + $11
-	ld a, [wWhichTrade]
+	ld a, [wSSAnneSmokeDriftAmount]
 	swap a
 	ld c, a
-	ld de, $0004
-.asm_1dc50
+	ld de, 4
+.loop
 	inc [hl]
 	inc [hl]
 	add hl, de
 	dec c
-	jr nz, .asm_1dc50
+	jr nz, .loop
 	pop de
 	pop bc
 	ret
 
-VermilionDock_1dc59: ; 1dc59 (7:5c59)
-	ld a, [wTrainerEngageDistance]
-	sub $10
-	ld [wTrainerEngageDistance], a
+VermilionDock_EmitSmokePuff: ; 1dc59 (7:5c59)
+; new smoke puff above the S.S. Anne's front smokestack
+	ld a, [wSSAnneSmokeX]
+	sub 16
+	ld [wSSAnneSmokeX], a
 	ld c, a
-	ld b, $64
-	ld a, [wWhichTrade]
+	ld b, 100 ; Y
+	ld a, [wSSAnneSmokeDriftAmount]
 	inc a
-	ld [wWhichTrade], a
+	ld [wSSAnneSmokeDriftAmount], a
 	ld a, $1
 	ld de, VermilionDockOAMBlock
 	call WriteOAMBlock
@@ -171,7 +172,7 @@
 	cp l
 	jr nz, .asm_1dc86
 	ld a, h
-	ld [$ff43], a
+	ld [rSCX], a
 .asm_1dc8e
 	ld a, [rLY]
 	cp h
--- a/scripts/victoryroad2.asm
+++ b/scripts/victoryroad2.asm
@@ -49,7 +49,7 @@
 	call CheckBoulderCoords
 	jp nc, CheckFightingMapTrainers
 	ld hl, wd7ee
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $2
 	jr z, .asm_5180b
 	bit 0, [hl]
--- a/scripts/victoryroad3.asm
+++ b/scripts/victoryroad3.asm
@@ -34,7 +34,7 @@
 	ld hl, .coordsData_449f9
 	call CheckBoulderCoords
 	jp nc, .asm_449fe
-	ld a, [wWhichTrade]
+	ld a, [wCoordIndex]
 	cp $1
 	jr nz, .asm_449dc
 	ld hl, wd126
@@ -60,11 +60,11 @@
 	db $FF
 
 .asm_449fe
-	ld a, $c2
+	ld a, VICTORY_ROAD_2
 	ld [wDungeonWarpDestinationMap], a
 	ld hl, .coordsData_449f9
-	call Func_46981
-	ld a, [wWhichTrade]
+	call IsPlayerOnDungeonWarp
+	ld a, [wCoordIndex]
 	cp $1
 	jr nz, .asm_44a1b
 	ld hl, wd72d
--- a/sram.asm
+++ b/sram.asm
@@ -29,8 +29,8 @@
 sBox4:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26
 sBox5:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188
 sBox6:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea
-sBoxes1CheckSum:: ds 1 ; ba4c
-sBoxes1CheckSum2:: ds 6 ; ba4d
+sBank2AllBoxesChecksum:: ds 1 ; ba4c
+sBank2IndividualBoxChecksums:: ds 6 ; ba4d
 
 
 SECTION "Saved Boxes 2", SRAM, BANK[3]
@@ -41,5 +41,5 @@
 sBox10:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26
 sBox11:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188
 sBox12:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea
-sBoxes2CheckSum:: ds 1 ; ba4c
-sBoxes2CheckSum2:: ds 6 ; ba4d
+sBank3AllBoxesChecksum:: ds 1 ; ba4c
+sBank3IndividualBoxChecksums:: ds 6 ; ba4d
--- a/text/maps/daycare_1.asm
+++ b/text/maps/daycare_1.asm
@@ -1,4 +1,4 @@
-_DayCareMText_5640f:: ; 8ab95 (22:6b95)
+_DayCareIntroText:: ; 8ab95 (22:6b95)
 	text "I run a DAYCARE."
 	line "Would you like me"
 	cont "to raise one of"
@@ -5,12 +5,12 @@
 	cont "your #MON?"
 	done
 
-_DayCareMText_56414:: ; 8abd4 (22:6bd4)
+_DayCareWhichMonText:: ; 8abd4 (22:6bd4)
 	text "Which #MON"
 	line "should I raise?"
 	prompt
 
-_DayCareMText_56419:: ; 8abf0 (22:6bf0)
+_DayCareWillLookAfterMonText:: ; 8abf0 (22:6bf0)
 	text "Fine, I'll look"
 	line "after @"
 	TX_RAM wcd6d
@@ -18,12 +18,12 @@
 	cont "for a while."
 	prompt
 
-_DayCareMText_5641e:: ; 8ac19 (22:6c19)
+_DayCareComeSeeMeInAWhileText:: ; 8ac19 (22:6c19)
 	text "Come see me in"
 	line "a while."
 	done
 
-_DayCareMText_56423:: ; 8ac32 (22:6c32)
+_DayCareMonHasGrownText:: ; 8ac32 (22:6c32)
 	text "Your @"
 	TX_RAM wcd6d
 	db $0
@@ -31,15 +31,13 @@
 
 	para "By level, it's"
 	line "grown by @"
-
-DayCareMText_8ac67:: ; 8ac67 (22:6c67)
-	TX_NUM wTrainerEngageDistance,$1,$3
+	TX_NUM wDayCareNumLevelsGrown,$1,$3
 	text "!"
 
 	para "Aren't I great?"
 	prompt
 
-_DayCareMText_56428:: ; 8ac7d (22:6c7d)
+_DayCareOweMoneyText:: ; 8ac7d (22:6c7d)
 	text "You owe me ¥@"
 	TX_BCD wcd3f, $c2
 	db $0
@@ -47,7 +45,7 @@
 	cont "of this #MON."
 	done
 
-_DayCareMText_5642d:: ; 8acae (22:6cae)
+_DayCareGotMonBackText:: ; 8acae (22:6cae)
 	text $52, " got"
 	line "@"
 	TX_RAM W_DAYCAREMONNAME
@@ -54,7 +52,7 @@
 	text " back!"
 	done
 
-_DayCareMText_56432:: ; 8acc1 (22:6cc1)
+_DayCareMonNeedsMoreTimeText:: ; 8acc1 (22:6cc1)
 	text "Back already?"
 	line "Your @"
 	TX_RAM wcd6d
--- a/text/maps/daycare_2.asm
+++ b/text/maps/daycare_2.asm
@@ -1,8 +1,8 @@
-_DayCareMText_56437:: ; 8c000 (23:4000)
+_DayCareAllRightThenText:: ; 8c000 (23:4000)
 	text "All right then,"
 	line "@@"
 
-_DayCareMText_5643b:: ; 8c013 (23:4013)
+_DayCareComeAgainText:: ; 8c013 (23:4013)
 IF DEF(_YELLOW)
 	text "Come again."
 ELSE
@@ -10,28 +10,28 @@
 ENDC
 	done
 
-_DayCareMText_56440:: ; 8c020 (23:4020)
+_DayCareNoRoomForMonText:: ; 8c020 (23:4020)
 	text "You have no room"
 	line "for this #MON!"
 	done
 
-_DayCareMText_56445:: ; 8c041 (23:4041)
+_DayCareOnlyHaveOneMonText:: ; 8c041 (23:4041)
 	text "You only have one"
 	line "#MON with you."
 	done
 
-_DayCareMText_5644a:: ; 8c063 (23:4063)
+_DayCareCantAcceptMonWithHMText:: ; 8c063 (23:4063)
 	text "I can't accept a"
 	line "#MON that"
 	cont "knows an HM move."
 	done
 
-_DayCareMText_5644f:: ; 8c090 (23:4090)
+_DayCareHeresYourMonText:: ; 8c090 (23:4090)
 	text "Thank you! Here's"
 	line "your #MON!"
 	prompt
 
-_DayCareMText_56454:: ; 8c0ad (23:40ad)
+_DayCareNotEnoughMoneyText:: ; 8c0ad (23:40ad)
 	text "Hey, you don't"
 	line "have enough ¥!"
 	done
--- a/wram.asm
+++ b/wram.asm
@@ -424,6 +424,10 @@
 wRLEByteCount:: ; ccd2
 	ds 1
 
+wAddedToParty:: ; ccd3
+; 0 = not added
+; 1 = added
+
 wSimulatedJoypadStatesEnd:: ; ccd3
 ; this is the end of the joypad states
 ; the list starts above this address and extends downwards in memory until here
@@ -431,7 +435,13 @@
 
 wParentMenuItem:: ; ccd3
 
-wccd3:: ds 1 ; used in battle, pokemon, PC and game corner stuff
+wCanEvolveFlags:: ; ccd3
+; 1 flag for each party member indicating whether it can evolve
+; The purpose of these flags is to track which mons levelled up during the
+; current battle at the end of the battle when evolution occurs.
+; Other methods of evolution simply set it by calling TryEvolvingMon.
+	ds 1
+
 wForceEvolution::
 wccd4:: ds 1 ; has a direct reference for simulated joypad stuff in vermillion and seafoam
 
@@ -634,9 +644,33 @@
 
 	ds 1
 
+wHoFTeamIndex:: ; cd3d
+
+wSSAnneSmokeDriftAmount:: ; cd3d
+; multiplied by 16 to get the number of times to go right by 2 pixels
+
+wRivalStarterTemp:: ; cd3d
+
+wBoxMonCounts:: ; cd3d
+; 12 bytes
+; array of the number of mons in each box
+
+wDexMaxSeenMon:: ; cd3d
+
+wPPRestoreItem:: ; cd3d
+
+wWereAnyMonsAsleep:: ; cd3d
+
+wCanPlaySlots:: ; cd3d
+
+wNumShakes:: ; cd3d
+
+wDayCareStartLevel:: ; cd3d
+; the level of the mon at the time it entered day care
+
 wWhichBadge:: ; cd3d
 
-wMuseumPriceTemp:: ; cd3d
+wPriceTemp:: ; cd3d
 ; 3-byte BCD number
 
 wTitleMonSpecies:: ; cd3d
@@ -701,6 +735,12 @@
 wTrainerSpriteOffset:: ; cd3d
 	ds 1
 
+wSSAnneSmokeX:: ; cd3e
+
+wRivalStarterBallSpriteIndex:: ; cd3e
+
+wDayCareNumLevelsGrown:: ; cd3e
+
 wOptionsBattleAnimCursorX:: ; cd3e
 
 wTrainerInfoTextBoxWidth:: ; cd3e
@@ -733,6 +773,8 @@
 wTrainerEngageDistance:: ; cd3e
 	ds 1
 
+wJigglypuffFacingDirections:: ; cd3f
+
 wOptionsBattleStyleCursorX:: ; cd3f
 
 wTrainerInfoTextBoxNextRowOffset:: ; cd3f
@@ -774,6 +816,10 @@
 wTrainerScreenY:: ; cd40
 	ds 1
 
+wHoFTeamIndex2:: ; cd41
+
+wHiddenItemOrCoinsIndex:: ; cd41
+
 wTradedPlayerMonOT:: ; cd41
 
 wHiddenObjectX:: ; cd41
@@ -962,6 +1008,8 @@
 ; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top)
 	ds 20 * 18
 
+wEvoOldSpecies:: ; cee9
+
 wBuffer:: ; cee9
 ; Temporary storage area of 30 bytes.
 
@@ -968,10 +1016,24 @@
 wTownMapCoords:: ; cee9
 ; lower nybble is x, upper nybble is y
 
+wLearningMovesFromDayCare:: ; cee9
+; whether WriteMonMoves is being used to make a mon learn moves from day care
+; non-zero if so
+
 wHPBarMaxHP:: ; cee9
-	ds 2
+	ds 1
+
+wEvoNewSpecies:: ; ceea
+	ds 1
+
+wEvoMonTileOffset:: ; ceeb
+
 wHPBarOldHP:: ; ceeb
-	ds 2
+	ds 1
+
+wEvoCancelled:: ; ceec
+	ds 1
+
 wHPBarNewHP:: ; ceed
 	ds 2
 wHPBarDelta:: ; ceef
@@ -1453,7 +1515,10 @@
 ; counts the number of subentries left in the current subanimation
 	ds 1
 
-wd088:: ds 1 ; savefile checksum (if file is corrupted)
+wSaveFileStatus::
+; 1 = no save file or save file is corrupted
+; 2 = save file exists and no corruption has been detected
+	ds 1
 
 W_NUMFBTILES:: ; d089
 ; number of tiles in current battle animation frame block
@@ -1462,6 +1527,8 @@
 wTradedMonMovingRight:: ; d08a
 ; $01 if mon is moving from left gameboy to right gameboy; $00 if vice versa
 
+wOptionsInitialized:: ; d08a
+
 wd08a:: ds 1 ; used with sprites and displaying the option menu on the main menu screen?
 
 wAnimCounter:: ; d08b
@@ -2079,6 +2146,8 @@
 	ds 1 ; end
 
 wCurrentBoxNum:: ; d5a0
+; bits 0-6: box number
+; bit 7: whether the player has changed boxes before
 	ds 2
 
 wNumHoFTeams:: ; d5a2
@@ -2319,8 +2388,11 @@
 
 	ds 134
 
-wd6f0:: ds 14 ; flags for hidden items?
-wd6fe:: ds 2 ; flags for hidden coins?
+wObtainedHiddenItemsFlags::
+	ds 14
+
+wObtainedHiddenCoinsFlags::
+	ds 2
 
 wWalkBikeSurfState:: ; d700
 ; $00 = walking