shithub: pokecrystal

Download patch

ref: 6a570ebb8ecb72dc9d1373062c311dfbb1234dc3
parent: 09603bf0315862d7c008e08a9960e6111a0859f8
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sat Nov 7 16:04:54 EST 2015

more battle core labels

--- a/battle/ai/items.asm
+++ b/battle/ai/items.asm
@@ -731,8 +731,8 @@
 	callab ResetEnemyStatLevels
 	ld hl, PlayerSubStatus1
 	res SUBSTATUS_IN_LOVE, [hl]
-	callba Function3d4e1
-	callba Function3d57a
+	callba EnemySwitch
+	callba ResetBattleParticipants
 	xor a
 	ld [wd264], a
 	ld a, [wLinkMode]
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -5,7 +5,7 @@
 
 Function3c000: ; 3c000
 	xor a
-	ld [wc664], a
+	ld [wBattleParticipantsNotFainted], a
 	ld [wc6fc], a
 	ld [wd0ec], a
 	ld [BattleEnded], a
@@ -42,7 +42,7 @@
 	call NewEnemyMonStatus
 	call ResetEnemyStatLevels
 	call BreakAttraction
-	call Function3d4e1
+	call EnemySwitch
 
 .wild
 	ld c, 40
@@ -86,7 +86,7 @@
 	ld a, $9
 	call Function3d490
 	call LoadTileMapToTempTileMap
-	call Function3d57a
+	call ResetBattleParticipants
 	call InitBattleMon
 	call ResetPlayerStatLevels
 	call SendOutPkmnText
@@ -108,7 +108,7 @@
 	call NewEnemyMonStatus
 	call ResetEnemyStatLevels
 	call BreakAttraction
-	call Function3d4e1
+	call EnemySwitch
 	call SetEnemyTurn
 	call SpikesDamage
 
@@ -431,7 +431,7 @@
 	xor a
 	ld [wcfca], a
 	ld de, ANIM_CONFUSED
-	call Function3ee0f
+	call Call_PlayBattleAnim_OnlyIfVisible
 	call SwitchTurnCore
 	ld hl, BecameConfusedText
 	jp StdBattleTextBox
@@ -665,7 +665,7 @@
 	call SetPlayerTurn
 	callab UpdateMoveData
 	xor a
-	ld [wc732], a
+	ld [wPlayerCharging], a
 	ld a, [wPlayerMoveStruct + MOVE_EFFECT]
 	cp EFFECT_FURY_CUTTER
 	jr z, .asm_3c494
@@ -778,7 +778,7 @@
 ; 3c543
 
 
-Function3c543: ; 3c543
+TryEnemyFlee: ; 3c543
 	ld a, [wBattleMode]
 	dec a
 	jr nz, .Stay
@@ -939,14 +939,14 @@
 
 Function3c5fe: ; 3c5fe
 	call LoadTileMapToTempTileMap
-	call Function3c543
+	call TryEnemyFlee
 	jp c, WildFled_EnemyFled_LinkBattleCanceled
 	call SetEnemyTurn
 	ld a, $1
 	ld [wc70f], a
 	callab AI_SwitchOrTryItem
-	jr c, .asm_3c62f
-	call Function3c6de
+	jr c, .switch_item
+	call EnemyTurn_EndOpponentProtectEndureDestinyBond
 	call Function3d2e0
 	ret c
 	ld a, [wd232]
@@ -957,12 +957,12 @@
 	call HasEnemyFainted
 	jp z, HandleEnemyMonFaint
 
-.asm_3c62f
+.switch_item
 	call SetEnemyTurn
 	call ResidualDamage
 	jp z, HandleEnemyMonFaint
 	call RefreshBattleHuds
-	call Function3c6cf
+	call PlayerTurn_EndOpponentProtectEndureDestinyBond
 	call Function3d2e0
 	ret c
 	ld a, [wd232]
@@ -987,7 +987,7 @@
 	call SetEnemyTurn
 	callab AI_SwitchOrTryItem
 	push af
-	call Function3c6cf
+	call PlayerTurn_EndOpponentProtectEndureDestinyBond
 	pop bc
 	ld a, [wd232]
 	and a
@@ -1006,11 +1006,11 @@
 	push bc
 	call RefreshBattleHuds
 	pop af
-	jr c, .asm_3c6be
+	jr c, .switched_or_used_item
 	call LoadTileMapToTempTileMap
-	call Function3c543
+	call TryEnemyFlee
 	jp c, WildFled_EnemyFled_LinkBattleCanceled
-	call Function3c6de
+	call EnemyTurn_EndOpponentProtectEndureDestinyBond
 	call Function3d2e0
 	ret c
 	ld a, [wd232]
@@ -1021,7 +1021,7 @@
 	call HasEnemyFainted
 	jp z, HandleEnemyMonFaint
 
-.asm_3c6be
+.switched_or_used_item
 	call SetEnemyTurn
 	call ResidualDamage
 	jp z, HandleEnemyMonFaint
@@ -1031,21 +1031,21 @@
 	ret
 ; 3c6cf
 
-Function3c6cf: ; 3c6cf
+PlayerTurn_EndOpponentProtectEndureDestinyBond: ; 3c6cf
 	call SetPlayerTurn
-	call Function3c6fe
+	call EndUserDestinyBond
 	callab DoPlayerTurn
-	jp Function3c6ed
+	jp EndOpponentProtectEndureDestinyBond
 ; 3c6de
 
-Function3c6de: ; 3c6de
+EnemyTurn_EndOpponentProtectEndureDestinyBond: ; 3c6de
 	call SetEnemyTurn
-	call Function3c6fe
+	call EndUserDestinyBond
 	callab DoEnemyTurn
-	jp Function3c6ed
+	jp EndOpponentProtectEndureDestinyBond
 ; 3c6ed
 
-Function3c6ed: ; 3c6ed
+EndOpponentProtectEndureDestinyBond: ; 3c6ed
 	ld a, BATTLE_VARS_SUBSTATUS1_OPP
 	call GetBattleVarAddr
 	res SUBSTATUS_PROTECT, [hl]
@@ -1056,7 +1056,7 @@
 	ret
 ; 3c6fe
 
-Function3c6fe: ; 3c6fe
+EndUserDestinyBond: ; 3c6fe
 	ld a, BATTLE_VARS_SUBSTATUS5
 	call GetBattleVarAddr
 	res SUBSTATUS_DESTINY_BOND, [hl]
@@ -1107,14 +1107,14 @@
 
 	xor a
 	ld [wcfca], a
-	call Function3ee0f
+	call Call_PlayBattleAnim_OnlyIfVisible
 	call GetEighthMaxHP
 	ld de, PlayerToxicCount
 	ld a, [hBattleTurn]
 	and a
-	jr z, .asm_3c74d
+	jr z, .check_toxic
 	ld de, EnemyToxicCount
-.asm_3c74d
+.check_toxic
 
 	ld a, BATTLE_VARS_SUBSTATUS5
 	call GetBattleVar
@@ -1142,7 +1142,7 @@
 	ld a, BATTLE_VARS_SUBSTATUS4
 	call GetBattleVarAddr
 	bit SUBSTATUS_LEECH_SEED, [hl]
-	jr z, .asm_3c7a1
+	jr z, .not_seeded
 
 	call SwitchTurnCore
 	xor a
@@ -1151,7 +1151,7 @@
 	ld a, BATTLE_VARS_SUBSTATUS3_OPP
 	call GetBattleVar
 	and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
-	call z, Function3ee0f
+	call z, Call_PlayBattleAnim_OnlyIfVisible
 	call SwitchTurnCore
 
 	call GetEighthMaxHP
@@ -1161,7 +1161,7 @@
 	call RestoreHP
 	ld hl, LeechSeedSapsText
 	call StdBattleTextBox
-.asm_3c7a1
+.not_seeded
 
 	call HasUserFainted
 	jr z, .fainted
@@ -1169,16 +1169,16 @@
 	ld a, BATTLE_VARS_SUBSTATUS1
 	call GetBattleVarAddr
 	bit SUBSTATUS_NIGHTMARE, [hl]
-	jr z, .asm_3c7c5
+	jr z, .not_nightmare
 	xor a
 	ld [wcfca], a
 	ld de, ANIM_IN_NIGHTMARE
-	call Function3ee0f
+	call Call_PlayBattleAnim_OnlyIfVisible
 	call GetQuarterMaxHP
 	call SubtractHPFromUser
 	ld hl, HasANightmareText
 	call StdBattleTextBox
-.asm_3c7c5
+.not_nightmare
 
 	call HasUserFainted
 	jr z, .fainted
@@ -1186,25 +1186,25 @@
 	ld a, BATTLE_VARS_SUBSTATUS1
 	call GetBattleVarAddr
 	bit SUBSTATUS_CURSE, [hl]
-	jr z, .asm_3c7e9
+	jr z, .not_cursed
 
 	xor a
 	ld [wcfca], a
 	ld de, ANIM_IN_NIGHTMARE
-	call Function3ee0f
+	call Call_PlayBattleAnim_OnlyIfVisible
 	call GetQuarterMaxHP
 	call SubtractHPFromUser
 	ld hl, HurtByCurseText
 	call StdBattleTextBox
 
-.asm_3c7e9
+.not_cursed
 	ld hl, BattleMonHP
 	ld a, [hBattleTurn]
 	and a
-	jr z, .asm_3c7f4
+	jr z, .check_fainted
 	ld hl, EnemyMonHP
 
-.asm_3c7f4
+.check_fainted
 	ld a, [hli]
 	or [hl]
 	ret nz
@@ -2139,14 +2139,14 @@
 	or [hl]
 	jr nz, .asm_3cdba
 
-	call Function3d1f8
-	jr nc, .asm_3cda4
+	call AskUseNextPokemon
+	jr nc, .dont_flee
 
 	ld a, 1
 	ld [BattleEnded], a
 	ret
 
-.asm_3cda4
+.dont_flee
 	call Function3d227
 	call Function3d2e0
 	jp c, WildFled_EnemyFled_LinkBattleCanceled
@@ -2251,7 +2251,7 @@
 	ld a, [wBattleResult]
 	and $c0
 	ld [wBattleResult], a
-	call ShareExperiencePoints
+	call DoOthersShareExperience
 	jr z, .asm_3ce72
 	ld hl, EnemyMonBaseStats
 	ld b, $7
@@ -2264,36 +2264,37 @@
 .asm_3ce72
 	ld hl, EnemyMonBaseStats
 	ld de, wc720
-	ld bc, $0007
+	ld bc, EnemyMonEnd - EnemyMonBaseStats
 	call CopyBytes
 	xor a
 	ld [wc71f], a
 	call GiveExperiencePoints
-	call ShareExperiencePoints
+	call DoOthersShareExperience
 	ret z
-	ld a, [wc664]
+
+	ld a, [wBattleParticipantsNotFainted]
 	push af
 	ld a, d
-	ld [wc664], a
+	ld [wBattleParticipantsNotFainted], a
 	ld hl, wc720
 	ld de, EnemyMonBaseStats
-	ld bc, $0007
+	ld bc, EnemyMonEnd - EnemyMonBaseStats
 	call CopyBytes
 	ld a, $1
 	ld [wc71f], a
 	call GiveExperiencePoints
 	pop af
-	ld [wc664], a
+	ld [wBattleParticipantsNotFainted], a
 	ret
 ; 3ceaa
 
-ShareExperiencePoints: ; 3ceaa
+DoOthersShareExperience: ; 3ceaa
 	ld a, [PartyCount]
 	ld b, a
 	ld hl, PartyMon1
 	ld c, 1
 	ld d, 0
-.asm_3ceb5
+.loop
 	push hl
 	push bc
 	ld bc, MON_HP
@@ -2302,7 +2303,7 @@
 	or [hl]
 	pop bc
 	pop hl
-	jr z, .asm_3ced1
+	jr z, .next
 
 	push hl
 	push bc
@@ -2313,12 +2314,12 @@
 	pop hl
 
 	cp EXP_SHARE
-	jr nz, .asm_3ced1
+	jr nz, .next
 	ld a, d
 	or c
 	ld d, a
 
-.asm_3ced1
+.next
 	sla c
 	push de
 	ld de, PARTYMON_STRUCT_LENGTH
@@ -2325,19 +2326,19 @@
 	add hl, de
 	pop de
 	dec b
-	jr nz, .asm_3ceb5
+	jr nz, .loop
 
 	ld a, d
 	ld e, 0
 	ld b, PARTY_LENGTH
-.asm_3cee1
+.loop2
 	srl a
-	jr nc, .asm_3cee6
+	jr nc, .okay
 	inc e
 
-.asm_3cee6
+.okay
 	dec b
-	jr nz, .asm_3cee1
+	jr nz, .loop2
 	ld a, e
 	and a
 	ret
@@ -2438,14 +2439,14 @@
 	and a
 	jr nz, .asm_3cf8f
 
-	call Function3d4e1
+	call EnemySwitch
 	jr .asm_3cf92
 
 .asm_3cf8f
-	call Function3d517
+	call EnemySwitch_SetMode
 
 .asm_3cf92
-	call Function3d57a
+	call ResetBattleParticipants
 	call SetEnemyTurn
 	call SpikesDamage
 	xor a
@@ -2676,30 +2677,30 @@
 	ld de, MUSIC_WILD_VICTORY
 	ld a, [wBattleMode]
 	dec a
-	jr nz, .asm_3d113
+	jr nz, .trainer_victory
 	push de
-	call ShareExperiencePoints
+	call DoOthersShareExperience
 	pop de
-	jr nz, .asm_3d11e
+	jr nz, .play_music
 	ld hl, wPayDayMoney
 	ld a, [hli]
 	or [hl]
-	jr nz, .asm_3d11e
-	ld a, [wc664]
+	jr nz, .play_music
+	ld a, [wBattleParticipantsNotFainted]
 	and a
-	jr z, .asm_3d121
-	jr .asm_3d11e
+	jr z, .lost
+	jr .play_music
 
-.asm_3d113
+.trainer_victory
 	ld de, MUSIC_GYM_VICTORY
 	call IsJohtoGymLeader
-	jr c, .asm_3d11e
+	jr c, .play_music
 	ld de, MUSIC_TRAINER_VICTORY
 
-.asm_3d11e
+.play_music
 	call PlayMusic
 
-.asm_3d121
+.lost
 	pop de
 	ret
 ; 3d123
@@ -2790,7 +2791,7 @@
 	jp z, WinTrainerBattle
 
 .notfainted
-	call Function3d1f8
+	call AskUseNextPokemon
 	jr nc, .asm_3d190
 	ld a, $1
 	ld [BattleEnded], a
@@ -2813,7 +2814,7 @@
 Function3d1aa: ; 3d1aa
 	ld a, [CurBattleMon]
 	ld c, a
-	ld hl, wc664
+	ld hl, wBattleParticipantsNotFainted
 	ld b, $0
 	predef FlagPredef
 	ld hl, EnemySubStatus3
@@ -2849,27 +2850,30 @@
 	ret
 ; 3d1f8
 
-Function3d1f8: ; 3d1f8
+AskUseNextPokemon: ; 3d1f8
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
+; We don't need to be here if we're in a Trainer battle,
+; as that decision is made for us.
 	ld a, [wBattleMode]
 	and a
 	dec a
 	ret nz
+
 	ld hl, BattleText_UseNextMon
 	call StdBattleTextBox
-.asm_3d20a
+.loop
 	lb bc, 1, 7
 	call PlaceYesNoBox
 	ld a, [MenuSelection2]
-	jr c, .asm_3d217
+	jr c, .pressed_b
 	and a
 	ret
 
-.asm_3d217
+.pressed_b
 	ld a, [MenuSelection2]
-	cp $1
-	jr z, .asm_3d20a
+	cp $1 ; YES
+	jr z, .loop
 	ld hl, PartyMon1Speed
 	ld de, EnemyMonSpeed
 	jp TryToRunAwayFromBattle
@@ -2877,17 +2881,17 @@
 
 Function3d227: ; 3d227
 	call EmptyBattleTextBox
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function3d2f7
 	call ForcePickPartyMonInBattle
 	ld a, [wLinkMode]
 	and a
-	jr z, .asm_3d241
+	jr z, .skip_link
 	ld a, $1
 	ld [wd0ec], a
 	call Function3e8e4
 
-.asm_3d241
+.skip_link
 	xor a
 	ld [wd0ec], a
 	call Function3d2e0
@@ -2916,7 +2920,7 @@
 	ld [LastPlayerMon], a
 	ld a, [CurPartyMon]
 	ld [CurBattleMon], a
-	call Function3d581
+	call AddBattleParticipant
 	call InitBattleMon
 	call ResetPlayerStatLevels
 	call ClearPalettes
@@ -2944,7 +2948,7 @@
 	ld [LastPlayerMon], a
 	ld a, [CurPartyMon]
 	ld [CurBattleMon], a
-	call Function3d581
+	call AddBattleParticipant
 	call InitBattleMon
 	call ResetPlayerStatLevels
 	call SendOutPkmnText
@@ -2961,17 +2965,17 @@
 Function3d2e0: ; 3d2e0
 	ld a, [wLinkMode]
 	cp LINK_MOBILE
-	jr nz, .asm_3d2ef ; It's not a mobile battle
+	jr nz, .not_mobile ; It's not a mobile battle
 
 	ld a, [wcd2b]
 	and a
-	jr z, .asm_3d2ef
+	jr z, .not_mobile
 
 ; We have a mobile battle and something else happened
 	scf
 	ret
 
-.asm_3d2ef
+.not_mobile
 	xor a
 	ret
 ; 3d2f1
@@ -3305,21 +3309,23 @@
 	call ResetEnemyStatLevels
 	call Function_SetEnemyPkmnAndSendOutAnimation
 	call BreakAttraction
-	call Function3d57a
+	call ResetBattleParticipants
 	ret
 ; 3d4e1
 
 
-Function3d4e1: ; 3d4e1
+EnemySwitch: ; 3d4e1
 	call Function3d714
-	jr nc, Function3d517
+	jr nc, EnemySwitch_SetMode
+	; Shift Mode
 	call ResetEnemyBattleVars
 	call Function3d533
-	jr c, .asm_3d4f1
+	jr c, .skip
 	call FindPkmnInOTPartyToSwitchIntoBattle
-.asm_3d4f1
+.skip
+	; 'b' contains the PartyNr of the Pkmn the AI will switch to
 	call LoadEnemyPkmnToSwitchTo
-	call Function3d74b
+	call OfferSwitch
 	push af
 	call Function3d7a0
 	call Function_BattleTextEnemySentOut
@@ -3326,22 +3332,23 @@
 	call Function_SetEnemyPkmnAndSendOutAnimation
 	pop af
 	ret c
+	; If we're here, then we're switching too
 	xor a
-	ld [wc664], a
+	ld [wBattleParticipantsNotFainted], a
 	ld [wc6fc], a
 	ld [wd0ec], a
 	inc a
 	ld [wEnemyIsSwitching], a
 	call LoadTileMapToTempTileMap
-	jp Function3e3ad
+	jp PlayerSwitch
 ; 3d517
 
-Function3d517: ; 3d517
+EnemySwitch_SetMode: ; 3d517
 	call ResetEnemyBattleVars
 	call Function3d533
-	jr c, .asm_3d522
+	jr c, .skip
 	call FindPkmnInOTPartyToSwitchIntoBattle
-.asm_3d522
+.skip
 	; 'b' contains the PartyNr of the Pkmn the AI will switch to
 	call LoadEnemyPkmnToSwitchTo
 	ld a, 1
@@ -3400,17 +3407,17 @@
 	ld a, $8
 	call Function3d490
 	call EmptyBattleTextBox
-	jp LoadMenuDataHeader_0x1d75
+	jp LoadPartyMenuDataHeader
 ; 3d57a
 
-Function3d57a: ; 3d57a
+ResetBattleParticipants: ; 3d57a
 	xor a
-	ld [wc664], a
+	ld [wBattleParticipantsNotFainted], a
 	ld [wc6fc], a
-Function3d581: ; 3d581
+AddBattleParticipant: ; 3d581
 	ld a, [CurBattleMon]
 	ld c, a
-	ld hl, wc664
+	ld hl, wBattleParticipantsNotFainted
 	ld b, SET_FLAG
 	push bc
 	predef FlagPredef
@@ -3677,7 +3684,7 @@
 	ret
 ; 3d74b
 
-Function3d74b: ; 3d74b
+OfferSwitch: ; 3d74b
 	ld a, [CurPartyMon]
 	push af
 	callab Battle_GetTrainerName
@@ -3687,10 +3694,10 @@
 	call PlaceYesNoBox
 	ld a, [MenuSelection2]
 	dec a
-	jr nz, .asm_3d79a
+	jr nz, .said_no
 	call Function3d2f7
 	call PickSwitchMonInBattle
-	jr c, .asm_3d791
+	jr c, .canceled_switch
 	ld a, [CurBattleMon]
 	ld [LastPlayerMon], a
 	ld a, [CurPartyMon]
@@ -3706,12 +3713,12 @@
 	and a
 	ret
 
-.asm_3d791
+.canceled_switch
 	call ClearPalettes
 	call DelayFrame
 	call Function3eda6
 
-.asm_3d79a
+.said_no
 	pop af
 	ld [CurPartyMon], a
 	scf
@@ -4098,7 +4105,7 @@
 	ld de, PlayerStats
 	ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK
 	call CopyBytes
-	call Function3ec2c
+	call ApplyStatusEffectOnPlayerStats
 	call BadgeStatBoosts
 	ret
 ; 3da74
@@ -4184,7 +4191,7 @@
 	ld de, EnemyStats
 	ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK
 	call CopyBytes
-	call Function3ec30
+	call ApplyStatusEffectOnEnemyStats
 	ld hl, BaseType1
 	ld de, EnemyMonType1
 	ld a, [hli]
@@ -4213,7 +4220,7 @@
 	ld [LastPlayerMon], a
 	ld a, [CurPartyMon]
 	ld [CurBattleMon], a
-	call Function3d581
+	call AddBattleParticipant
 	call InitBattleMon
 	call ResetPlayerStatLevels
 	call NewBattleMonStatus
@@ -4410,8 +4417,8 @@
 	call PlayStereoCry
 	ld a, [wc71a]
 	ld c, a
-	ld hl, wc664
-	ld b, $0
+	ld hl, wBattleParticipantsNotFainted
+	ld b, RESET_FLAG
 	predef FlagPredef
 	call PlayerMonFaintedAnimation
 	ld hl, BattleText_PkmnFainted
@@ -5217,7 +5224,7 @@
 	and a
 	jp nz, ItemsCantBeUsed
 
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 
 	ld a, [BattleType]
 	cp BATTLETYPE_TUTORIAL
@@ -5312,10 +5319,10 @@
 ; 3e28d
 
 BattleMenu_PKMN: ; 3e28d
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 Function3e290:
 	call ExitMenu
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call WhiteBGMap
 Function3e299:
 	call Function3d2fa
@@ -5445,21 +5452,21 @@
 	; fallthrough
 ; 3e3ad
 
-Function3e3ad: ; 3e3ad
+PlayerSwitch: ; 3e3ad
 	ld a, 1
 	ld [wPlayerIsSwitching], a
 	ld a, [wLinkMode]
 	and a
-	jr z, .asm_3e3c1
-	call LoadMenuDataHeader_0x1d75
+	jr z, .not_linked
+	call LoadPartyMenuDataHeader
 	call Function3e8e4
 	call WriteBackup
 
-.asm_3e3c1
+.not_linked
 	call Function3e7c1
 	ld a, [wLinkMode]
 	and a
-	jr nz, .asm_3e3cf
+	jr nz, .linked
 
 .switch
 	call BattleMonEntrance
@@ -5466,7 +5473,7 @@
 	and a
 	ret
 
-.asm_3e3cf
+.linked
 	ld a, [wBattleAction]
 	cp BATTLEACTION_E
 	jp z, .switch
@@ -5522,7 +5529,7 @@
 
 	ld a, [CurBattleMon]
 	ld [CurPartyMon], a
-	call Function3d581
+	call AddBattleParticipant
 	call InitBattleMon
 	call ResetPlayerStatLevels
 	call SendOutPkmnText
@@ -5548,7 +5555,7 @@
 
 	ld a, [CurPartyMon]
 	ld [CurBattleMon], a
-	call Function3d581
+	call AddBattleParticipant
 	call InitBattleMon
 	xor a
 	ld [wd265], a
@@ -6062,7 +6069,7 @@
 	ret nz
 	ld a, [wLinkMode]
 	and a
-	jr z, .asm_3e817
+	jr z, .not_linked
 	call EmptyBattleTextBox
 	call LoadTileMapToTempTileMap
 	ld a, [wd0ec]
@@ -6071,9 +6078,9 @@
 	call Call_LoadTempTileMapToTileMap
 	ld a, [wBattleAction]
 	cp BATTLEACTION_E
-	jp z, .asm_3e8bd
+	jp z, .struggle
 	cp BATTLEACTION_D
-	jp z, .asm_3e82c
+	jp z, .battle_action_d
 	cp BATTLEACTION_SWITCH1
 	jp nc, ResetVarsForSubstatusRage
 	ld [CurEnemyMoveNum], a
@@ -6080,64 +6087,65 @@
 	ld c, a
 	ld a, [EnemySubStatus1]
 	bit SUBSTATUS_ROLLOUT, a
-	jp nz, .asm_3e882
+	jp nz, .skip_load
 	ld a, [EnemySubStatus3]
 	and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE
-	jp nz, .asm_3e882
+	jp nz, .skip_load
 
 	ld hl, EnemySubStatus5
 	bit SUBSTATUS_ENCORED, [hl]
 	ld a, [LastEnemyMove]
-	jp nz, .asm_3e87f
+	jp nz, .finish
 	ld hl, EnemyMonMoves
 	ld b, 0
 	add hl, bc
 	ld a, [hl]
-	jp .asm_3e87f
+	jp .finish
 
-.asm_3e817
+.not_linked
 	ld hl, EnemySubStatus5
 	bit SUBSTATUS_ENCORED, [hl]
-	jr z, .asm_3e824
+	jr z, .skip_encore
 	ld a, [LastEnemyMove]
-	jp .asm_3e87f
+	jp .finish
 
-.asm_3e824
+.skip_encore
 	call CheckSubstatus_RechargeChargedRampageBideRollout
 	jp nz, ResetVarsForSubstatusRage
-	jr .asm_3e830
+	jr .continue
 
-.asm_3e82c
+.battle_action_d
 	ld a, $ff
-	jr .asm_3e87f
+	jr .finish
 
-.asm_3e830
+.continue
 	ld hl, EnemyMonMoves
 	ld de, EnemyMonPP
 	ld b, NUM_MOVES
-.asm_3e838
+.loop
 	ld a, [hl]
 	and a
-	jp z, .asm_3e8bd
+	jp z, .struggle
 	ld a, [EnemyDisabledMove]
 	cp [hl]
-	jr z, .asm_3e848
+	jr z, .disabled
 	ld a, [de]
 	and $3f
-	jr nz, .asm_3e84f
+	jr nz, .enough_pp
 
-.asm_3e848
+.disabled
 	inc hl
 	inc de
 	dec b
-	jr nz, .asm_3e838
-	jr .asm_3e8bd
+	jr nz, .loop
+	jr .struggle
 
-.asm_3e84f
+.enough_pp
 	ld a, [wBattleMode]
 	dec a
-	jr nz, .asm_3e882
-.asm_3e855
+	jr nz, .skip_load
+; wild
+.loop2
 	ld hl, EnemyMonMoves
 	call BattleRandom
 	and 3 ; TODO factor in NUM_MOVES
@@ -6149,30 +6157,30 @@
 	and $f
 	dec a
 	cp c
-	jr z, .asm_3e855
+	jr z, .loop2
 	ld a, [hl]
 	and a
-	jr z, .asm_3e855
+	jr z, .loop2
 	ld hl, EnemyMonPP
 	add hl, bc
 	ld b, a
 	ld a, [hl]
 	and $3f
-	jr z, .asm_3e855
+	jr z, .loop2
 	ld a, c
 	ld [CurEnemyMoveNum], a
 	ld a, b
 
-.asm_3e87f
+.finish
 	ld [CurEnemyMove], a
 
-.asm_3e882
+.skip_load
 	call SetEnemyTurn
 	callab UpdateMoveData
 	call CheckSubstatus_RechargeChargedRampageBideRollout
 	jr nz, .raging
 	xor a
-	ld [wc733], a
+	ld [wEnemyCharging], a
 
 .raging
 	ld a, [wEnemyMoveStruct + MOVE_EFFECT]
@@ -6184,13 +6192,13 @@
 .fury_cutter
 	ld a, [wEnemyMoveStruct + MOVE_EFFECT]
 	cp EFFECT_RAGE
-	jr z, .asm_3e8af
+	jr z, .no_rage
 	ld hl, EnemySubStatus4
 	res SUBSTATUS_RAGE, [hl]
 	xor a
 	ld [wEnemyRageCounter], a
 
-.asm_3e8af
+.no_rage
 	ld a, [wEnemyMoveStruct + MOVE_EFFECT]
 	cp EFFECT_PROTECT
 	ret z
@@ -6200,9 +6208,9 @@
 	ld [EnemyProtectCount], a
 	ret
 
-.asm_3e8bd
+.struggle
 	ld a, STRUGGLE
-	jr .asm_3e87f
+	jr .finish
 ; 3e8c1
 
 ResetVarsForSubstatusRage: ; 3e8c1
@@ -6918,16 +6926,16 @@
 ; 3ec2c
 
 
-Function3ec2c: ; 3ec2c
+ApplyStatusEffectOnPlayerStats: ; 3ec2c
 	ld a, 1
-	jr Function3ec31
+	jr ApplyStatusEffectOnStats
 ; 3ec30
 
-Function3ec30: ; 3ec30
+ApplyStatusEffectOnEnemyStats: ; 3ec30
 	xor a
 ; 3ec31
 
-Function3ec31: ; 3ec31
+ApplyStatusEffectOnStats: ; 3ec31
 	ld [hBattleTurn], a
 	call ApplyPrzEffectOnSpeed
 	jp ApplyBrnEffectOnAttack
@@ -6936,7 +6944,7 @@
 ApplyPrzEffectOnSpeed: ; 3ec39
 	ld a, [hBattleTurn]
 	and a
-	jr z, .asm_3ec5a
+	jr z, .enemy
 	ld a, [BattleMonStatus]
 	and 1 << PAR
 	ret z
@@ -6950,14 +6958,14 @@
 	rr b
 	ld [hli], a
 	or b
-	jr nz, .asm_3ec58
+	jr nz, .player_ok
 	ld b, $1
 
-.asm_3ec58
+.player_ok
 	ld [hl], b
 	ret
 
-.asm_3ec5a
+.enemy
 	ld a, [EnemyMonStatus]
 	and 1 << PAR
 	ret z
@@ -6971,10 +6979,10 @@
 	rr b
 	ld [hli], a
 	or b
-	jr nz, .asm_3ec74
+	jr nz, .enemy_ok
 	ld b, $1
 
-.asm_3ec74
+.enemy_ok
 	ld [hl], b
 	ret
 ; 3ec76
@@ -6982,7 +6990,7 @@
 ApplyBrnEffectOnAttack: ; 3ec76
 	ld a, [hBattleTurn]
 	and a
-	jr z, .asm_3ec93
+	jr z, .enemy
 	ld a, [BattleMonStatus]
 	and 1 << BRN
 	ret z
@@ -6994,14 +7002,14 @@
 	rr b
 	ld [hli], a
 	or b
-	jr nz, .asm_3ec91
+	jr nz, .player_ok
 	ld b, $1
 
-.asm_3ec91
+.player_ok
 	ld [hl], b
 	ret
 
-.asm_3ec93
+.enemy
 	ld a, [EnemyMonStatus]
 	and 1 << BRN
 	ret z
@@ -7013,10 +7021,10 @@
 	rr b
 	ld [hli], a
 	or b
-	jr nz, .asm_3eca9
+	jr nz, .enemy_ok
 	ld b, $1
 
-.asm_3eca9
+.enemy_ok
 	ld [hl], b
 	ret
 ; 3ecab
@@ -7024,12 +7032,12 @@
 ApplyStatLevelMultiplierOnAllStats: ; 3ecab
 ; Apply StatLevelMultipliers on all 5 Stats
 	ld c, 0
-.asm_3ecad
+.stat_loop
 	call ApplyStatLevelMultiplier
 	inc c
 	ld a, c
 	cp 5
-	jr nz, .asm_3ecad
+	jr nz, .stat_loop
 	ret
 ; 3ecb7
 
@@ -7042,17 +7050,17 @@
 	ld hl, BattleMonAttack
 	ld de, PlayerStats
 	ld bc, PlayerAtkLevel
-	jr z, .asm_3ecd2
+	jr z, .got_pointers
 	ld hl, EnemyMonAttack
 	ld de, EnemyStats
 	ld bc, EnemyAtkLevel
 
-.asm_3ecd2
+.got_pointers
 	add c
 	ld c, a
-	jr nc, .asm_3ecd7
+	jr nc, .okay
 	inc b
-.asm_3ecd7
+.okay
 	ld a, [bc]
 	pop bc
 	ld b, a
@@ -7063,9 +7071,9 @@
 	ld a, c
 	add e
 	ld e, a
-	jr nc, .asm_3ece6
+	jr nc, .okay2
 	inc d
-.asm_3ece6
+.okay2
 	pop bc
 	push hl
 	ld hl, .StatLevelMultipliers
@@ -7095,24 +7103,24 @@
 	sub 999 % $100
 	ld a, [hQuotient + 1]
 	sbc 999 / $100
-	jp c, .asm_3ed1e
+	jp c, .okay3
 
 	ld a, 999 / $100
-	ld [$ffb5], a
+	ld [hQuotient + 1], a
 	ld a, 999 % $100
-	ld [$ffb6], a
+	ld [hQuotient + 2], a
 
-.asm_3ed1e
-	ld a, [$ffb5]
+.okay3
+	ld a, [hQuotient + 1]
 	ld [hli], a
 	ld b, a
-	ld a, [$ffb6]
+	ld a, [hQuotient + 2]
 	ld [hl], a
 	or b
-	jr nz, .asm_3ed29
+	jr nz, .okay4
 	inc [hl]
 
-.asm_3ed29
+.okay4
 	pop bc
 	ret
 ; 3ed2b
@@ -7162,18 +7170,18 @@
 
 ; Swap badges 3 (PlainBadge) and 5 (MineralBadge).
 	ld d, a
-	and %00000100
+	and (1 << PLAINBADGE)
 rept 2
 	add a
 endr
 	ld b, a
 	ld a, d
-	and %00010000
+	and (1 << MINERALBADGE)
 	rrca
 	rrca
 	ld c, a
 	ld a, d
-	and %11101011
+	and ((1 << ZEPHYRBADGE) | (1 << HIVEBADGE) | (1 << FOGBADGE) | (1 << STORMBADGE) | (1 << GLACIERBADGE) | (1 << RISINGBADGE))
 	or b
 	or c
 	ld b, a
@@ -7337,7 +7345,7 @@
 ; 3ee0f
 
 
-Function3ee0f: ; 3ee0f
+Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f
 	ld a, BATTLE_VARS_SUBSTATUS3
 	call GetBattleVar
 	and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
@@ -7385,24 +7393,25 @@
 	ld [CurPartyMon], a
 	ld bc, PartyMon1Species
 
-.asm_3ee50
-	ld hl, $0022
+.loop
+	ld hl, MON_HP
 	add hl, bc
 	ld a, [hli]
 	or [hl]
-	jp z, .asm_3f0b9
+	jp z, .skip_stats ; fainted
+
 	push bc
-	ld hl, wc664
+	ld hl, wBattleParticipantsNotFainted
 	ld a, [CurPartyMon]
 	ld c, a
-	ld b, $2
+	ld b, CHECK_FLAG
 	ld d, $0
 	predef FlagPredef
 	ld a, c
 	and a
 	pop bc
-	jp z, .asm_3f0b9
-	ld hl, $000c
+	jp z, .skip_stats
+	ld hl, MON_STAT_EXP + 1
 	add hl, bc
 	ld d, h
 	ld e, l
@@ -7409,20 +7418,20 @@
 	ld hl, EnemyMonBaseStats - 1
 	push bc
 	ld c, $5
-.asm_3ee7c
+.loop1
 	inc hl
 	ld a, [de]
 	add [hl]
 	ld [de], a
-	jr nc, .asm_3ee89
+	jr nc, .okay1
 	dec de
 	ld a, [de]
 	inc a
-	jr z, .asm_3eea4
+	jr z, .next
 	ld [de], a
 	inc de
 
-.asm_3ee89
+.okay1
 	push hl
 	push bc
 	ld a, MON_PKRUS
@@ -7431,31 +7440,31 @@
 	and a
 	pop bc
 	pop hl
-	jr z, .asm_3eea9
+	jr z, .skip
 	ld a, [de]
 	add [hl]
 	ld [de], a
-	jr nc, .asm_3eea9
+	jr nc, .skip
 	dec de
 	ld a, [de]
 	inc a
-	jr z, .asm_3eea4
+	jr z, .next
 	ld [de], a
 	inc de
-	jr .asm_3eea9
+	jr .skip
 
-.asm_3eea4
+.next
 	ld a, $ff
 	ld [de], a
 	inc de
 	ld [de], a
 
-.asm_3eea9
+.skip
 rept 2
 	inc de
 endr
 	dec c
-	jr nz, .asm_3ee7c
+	jr nz, .loop1
 	xor a
 	ld [hMultiplicand + 0], a
 	ld [hMultiplicand + 1], a
@@ -7464,27 +7473,27 @@
 	ld a, [EnemyMonLevel]
 	ld [hMultiplier], a
 	call Multiply
-	ld a, $7
+	ld a, 7
 	ld [hDivisor], a
-	ld b, $4
+	ld b, 4
 	call Divide
 	pop bc
-	ld hl, $0006
+	ld hl, MON_ID
 	add hl, bc
 	ld a, [PlayerID]
 	cp [hl]
-	jr nz, .asm_3eedd
+	jr nz, .boosted
 	inc hl
 	ld a, [PlayerID + 1]
 	cp [hl]
 	ld a, $0
-	jr z, .asm_3eee2
+	jr z, .no_boost
 
-.asm_3eedd
+.boosted
 	call DoubleExp
 	ld a, $1
 
-.asm_3eee2
+.no_boost
 	ld [StringBuffer2 + 2], a
 	ld a, [wBattleMode]
 	dec a
@@ -7495,9 +7504,9 @@
 	ld a, [hl]
 	cp LUCKY_EGG
 	call z, DoubleExp
-	ld a, [$ffb6]
+	ld a, [hQuotient + 2]
 	ld [StringBuffer2 + 1], a
-	ld a, [$ffb5]
+	ld a, [hQuotient + 1]
 	ld [StringBuffer2], a
 	ld a, [CurPartyMon]
 	ld hl, PartyMonNicknames
@@ -7505,28 +7514,28 @@
 	ld hl, Text_PkmnGainedExpPoint
 	call BattleTextBox
 	ld a, [StringBuffer2 + 1]
-	ld [$ffb6], a
+	ld [hQuotient + 2], a
 	ld a, [StringBuffer2]
-	ld [$ffb5], a
+	ld [hQuotient + 1], a
 	pop bc
 	call Function3f136
 	push bc
 	call LoadTileMapToTempTileMap
 	pop bc
-	ld hl, $000a
+	ld hl, MON_EXP + 2
 	add hl, bc
 	ld d, [hl]
-	ld a, [$ffb6]
+	ld a, [hQuotient + 2]
 	add d
 	ld [hld], a
 	ld d, [hl]
-	ld a, [$ffb5]
+	ld a, [hQuotient + 1]
 	adc d
 	ld [hl], a
-	jr nc, .asm_3ef3d
+	jr nc, .skip2
 	dec hl
 	inc [hl]
-	jr nz, .asm_3ef3d
+	jr nz, .skip2
 	ld a, $ff
 rept 2
 	ld [hli], a
@@ -7533,7 +7542,7 @@
 endr
 	ld [hl], a
 
-.asm_3ef3d
+.skip2
 	ld a, [CurPartyMon]
 	ld e, a
 	ld d, $0
@@ -7546,14 +7555,14 @@
 	ld d, MAX_LEVEL
 	callab CalcExpAtLevel
 	pop bc
-	ld hl, $000a
+	ld hl, MON_EXP + 2
 	add hl, bc
 	push bc
-	ld a, [hMultiplicand]
+	ld a, [hQuotient]
 	ld b, a
-	ld a, [$ffb5]
+	ld a, [hQuotient + 1]
 	ld c, a
-	ld a, [$ffb6]
+	ld a, [hQuotient + 2]
 	ld d, a
 	ld a, [hld]
 	sub d
@@ -7561,7 +7570,7 @@
 	sbc c
 	ld a, [hl]
 	sbc b
-	jr c, .asm_3ef74
+	jr c, .max_exp
 	ld a, b
 	ld [hli], a
 	ld a, c
@@ -7569,7 +7578,7 @@
 	ld a, d
 	ld [hld], a
 
-.asm_3ef74
+.max_exp
 	xor a ; PARTYMON
 	ld [MonType], a
 	predef CopyPkmnToTempMon
@@ -7579,9 +7588,10 @@
 	add hl, bc
 	ld a, [hl]
 	cp MAX_LEVEL
-	jp nc, .asm_3f0b9
+	jp nc, .skip_stats
 	cp d
-	jp z, .asm_3f0b9
+	jp z, .skip_stats
+; <NICKNAME> grew to level ##!
 	ld [wc719], a
 	ld a, [CurPartyLevel]
 	push af
@@ -7594,17 +7604,17 @@
 	ld [CurSpecies], a
 	ld [wd265], a
 	call GetBaseData
-	ld hl, $0025
+	ld hl, MON_MAXHP + 1
 	add hl, bc
 	ld a, [hld]
 	ld e, a
 	ld d, [hl]
 	push de
-	ld hl, $0024
+	ld hl, MON_MAXHP
 	add hl, bc
 	ld d, h
 	ld e, l
-	ld hl, $000a
+	ld hl, MON_EXP + 2
 	add hl, bc
 	push bc
 	ld b, $1
@@ -7611,7 +7621,7 @@
 	predef CalcPkmnStats
 	pop bc
 	pop de
-	ld hl, $0025
+	ld hl, MON_MAXHP + 1
 	add hl, bc
 	ld a, [hld]
 	sub e
@@ -7630,7 +7640,7 @@
 	ld d, a
 	ld a, [CurPartyMon]
 	cp d
-	jr nz, .asm_3f035
+	jr nz, .skip_animation
 	ld de, BattleMonHP
 	ld a, [hli]
 	ld [de], a
@@ -7639,27 +7649,27 @@
 	ld [de], a
 	ld de, BattleMonMaxHP
 	push bc
-	ld bc, $000c
+	ld bc, PARTYMON_STRUCT_LENGTH - MON_MAXHP
 	call CopyBytes
 	pop bc
-	ld hl, $001f
+	ld hl, MON_LEVEL
 	add hl, bc
 	ld a, [hl]
 	ld [BattleMonLevel], a
 	ld a, [PlayerSubStatus5]
 	bit SUBSTATUS_TRANSFORMED, a
-	jr nz, .asm_3f012
-	ld hl, $0026
+	jr nz, .transformed
+	ld hl, MON_ATK
 	add hl, bc
 	ld de, PlayerStats
-	ld bc, $000a
+	ld bc, PARTYMON_STRUCT_LENGTH - MON_ATK
 	call CopyBytes
 
-.asm_3f012
+.transformed
 	xor a
 	ld [wd265], a
 	call ApplyStatLevelMultiplierOnAllStats
-	callab Function3ec2c
+	callab ApplyStatusEffectOnPlayerStats
 	callab BadgeStatBoosts
 	callab UpdatePlayerHUD
 	call EmptyBattleTextBox
@@ -7667,13 +7677,13 @@
 	ld a, $1
 	ld [hBGMapMode], a
 
-.asm_3f035
+.skip_animation
 	callba LevelUpHappinessMod
 	ld a, [CurBattleMon]
 	ld b, a
 	ld a, [CurPartyMon]
 	cp b
-	jr z, .asm_3f057
+	jr z, .skip_animation2
 	ld de, SFX_HIT_END_OF_EXP_BAR
 	call PlaySFX
 	call WaitSFX
@@ -7681,7 +7691,7 @@
 	call StdBattleTextBox
 	call LoadTileMapToTempTileMap
 
-.asm_3f057
+.skip_animation2
 	xor a ; PARTYMON
 	ld [MonType], a
 	predef CopyPkmnToTempMon
@@ -7706,7 +7716,7 @@
 	ld a, [wc719]
 	ld b, a
 
-.asm_3f093
+.level_loop
 	inc b
 	ld a, b
 	ld [CurPartyLevel], a
@@ -7715,7 +7725,7 @@
 	pop bc
 	ld a, b
 	cp c
-	jr nz, .asm_3f093
+	jr nz, .level_loop
 	pop af
 	ld [CurPartyLevel], a
 	ld hl, EvolvableFlags
@@ -7726,26 +7736,26 @@
 	pop af
 	ld [CurPartyLevel], a
 
-.asm_3f0b9
+.skip_stats
 	ld a, [PartyCount]
 	ld b, a
 	ld a, [CurPartyMon]
 	inc a
 	cp b
-	jr z, .asm_3f0d1
+	jr z, .done
 	ld [CurPartyMon], a
 	ld a, MON_SPECIES
 	call GetPartyParamLocation
 	ld b, h
 	ld c, l
-	jp .asm_3ee50
+	jp .loop
 
-.asm_3f0d1
-	jp Function3d57a
+.done
+	jp ResetBattleParticipants
 ; 3f0d4
 
 Function3f0d4: ; 3f0d4
-	ld a, [wc664]
+	ld a, [wBattleParticipantsNotFainted]
 	ld b, a
 	ld c, $6
 	ld d, $0
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -723,22 +723,22 @@
 	ld hl, JohtoBadges
 
 	; risingbadge
-	bit 7, [hl]
+	bit RISINGBADGE, [hl]
 	ld a, MAX_LEVEL + 1
 	jr nz, .getlevel
 
 	; stormbadge
-	bit 5, [hl]
+	bit STORMBADGE, [hl]
 	ld a, 70
 	jr nz, .getlevel
 
 	; fogbadge
-	bit 3, [hl]
+	bit FOGBADGE, [hl]
 	ld a, 50
 	jr nz, .getlevel
 
 	; hivebadge
-	bit 1, [hl]
+	bit HIVEBADGE, [hl]
 	ld a, 30
 	jr nz, .getlevel
 
@@ -1017,9 +1017,9 @@
 
 	ld a, [hBattleTurn]
 	and a
-	ld a, [wc732] ; player
+	ld a, [wPlayerCharging] ; player
 	jr z, .end
-	ld a, [wc733] ; enemy
+	ld a, [wEnemyCharging] ; enemy
 .end
 	and a
 	ret
@@ -2129,13 +2129,13 @@
 	ld a, BATTLE_VARS_MOVE_EFFECT
 	call GetBattleVar
 	cp EFFECT_MULTI_HIT
-	jr z, .multihit_conversion_doublehit_twineedle
+	jr z, .multihit
 	cp EFFECT_CONVERSION
-	jr z, .multihit_conversion_doublehit_twineedle
+	jr z, .conversion
 	cp EFFECT_DOUBLE_HIT
-	jr z, .multihit_conversion_doublehit_twineedle
+	jr z, .doublehit
 	cp EFFECT_TWINEEDLE
-	jr z, .multihit_conversion_doublehit_twineedle
+	jr z, .twineedle
 	cp EFFECT_TRIPLE_KICK
 	jr z, .triplekick
 	xor a
@@ -2159,7 +2159,10 @@
 .fly_dig
 ; clear sprite
 	jp Function37ec7
-.multihit_conversion_doublehit_twineedle
+.multihit
+.conversion
+.doublehit
+.twineedle
 	ld a, [wKickCounter]
 	and 1
 	xor 1
@@ -6307,12 +6310,12 @@
 	ld a, 1
 	ld [hl], a
 	ld hl, PlayerDamageTaken + 1
-	ld de, wc732 ; player
+	ld de, wPlayerCharging ; player
 	ld a, [hBattleTurn]
 	and a
 	jr z, .player
 	ld hl, EnemyDamageTaken + 1
-	ld de, wc733 ; enemy
+	ld de, wEnemyCharging ; enemy
 .player
 	ld a, [hld]
 	add a
@@ -8575,11 +8578,11 @@
 
 
 ResetTurn: ; 3747b
-	ld hl, wc732
+	ld hl, wPlayerCharging
 	ld a, [hBattleTurn]
 	and a
 	jr z, .player
-	ld hl, wc733
+	ld hl, wEnemyCharging
 
 .player
 	ld [hl], 1
@@ -8921,7 +8924,7 @@
 	call DelayFrames
 
 ; Transition into switchmon menu
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Function3d2f7
 
 	callba ForcePickSwitchMonInBattle
@@ -8971,9 +8974,9 @@
 ; Passed enemy PartyMon entrance
 	xor a
 	ld [wc718], a
-	ld hl, Function3d517
+	ld hl, EnemySwitch_SetMode
 	call CallBattleCore
-	ld hl, Function3d57a
+	ld hl, ResetBattleParticipants
 	call CallBattleCore
 	ld a, 1
 	ld [wTypeMatchup], a
@@ -8995,7 +8998,7 @@
 	ld a, 1
 	ld [wd0ec], a
 
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, Function3e8e4
 	call CallBattleCore
 	call WriteBackup
@@ -9011,7 +9014,7 @@
 	and a
 	ret z
 
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, Function3e8e4
 	call CallBattleCore
 
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -191,69 +191,69 @@
 	const MIRAGE_MAIL  ; $BD
 	const ITEM_BE      ; $BE
 
-	add_tm DYNAMICPUNCH
-	add_tm HEADBUTT
-	add_tm CURSE
-	add_tm ROLLOUT
-	const ITEM_C3
-	add_tm ROAR
-	add_tm TOXIC
-	add_tm ZAP_CANNON
-	add_tm ROCK_SMASH
-	add_tm PSYCH_UP
-	add_tm HIDDEN_POWER
-	add_tm SUNNY_DAY
-	add_tm SWEET_SCENT
-	add_tm SNORE
-	add_tm BLIZZARD
-	add_tm HYPER_BEAM
-	add_tm ICY_WIND
-	add_tm PROTECT
-	add_tm RAIN_DANCE
-	add_tm GIGA_DRAIN
-	add_tm ENDURE
-	add_tm FRUSTRATION
-	add_tm SOLARBEAM
-	add_tm IRON_TAIL
-	add_tm DRAGONBREATH
-	add_tm THUNDER
-	add_tm EARTHQUAKE
-	add_tm RETURN
-	add_tm DIG
-	const ITEM_DC
-	add_tm PSYCHIC
-	add_tm SHADOW_BALL
-	add_tm MUD_SLAP
-	add_tm DOUBLE_TEAM
-	add_tm ICE_PUNCH
-	add_tm SWAGGER
-	add_tm SLEEP_TALK
-	add_tm SLUDGE_BOMB
-	add_tm SANDSTORM
-	add_tm FIRE_BLAST
-	add_tm SWIFT
-	add_tm DEFENSE_CURL
-	add_tm THUNDERPUNCH
-	add_tm DREAM_EATER
-	add_tm DETECT
-	add_tm REST
-	add_tm ATTRACT
-	add_tm THIEF
-	add_tm STEEL_WING
-	add_tm FIRE_PUNCH
-	add_tm FURY_CUTTER
-	add_tm NIGHTMARE
+	add_tm DYNAMICPUNCH ; $BF
+	add_tm HEADBUTT     ; $C0
+	add_tm CURSE        ; $C1
+	add_tm ROLLOUT      ; $C2
+	const ITEM_C3       ; $C3
+	add_tm ROAR         ; $C4
+	add_tm TOXIC        ; $C5
+	add_tm ZAP_CANNON   ; $C6
+	add_tm ROCK_SMASH   ; $C7
+	add_tm PSYCH_UP     ; $C8
+	add_tm HIDDEN_POWER ; $C9
+	add_tm SUNNY_DAY    ; $CA
+	add_tm SWEET_SCENT  ; $CB
+	add_tm SNORE        ; $CC
+	add_tm BLIZZARD     ; $CD
+	add_tm HYPER_BEAM   ; $CE
+	add_tm ICY_WIND     ; $CF
+	add_tm PROTECT      ; $D0
+	add_tm RAIN_DANCE   ; $D1
+	add_tm GIGA_DRAIN   ; $D2
+	add_tm ENDURE       ; $D3
+	add_tm FRUSTRATION  ; $D4
+	add_tm SOLARBEAM    ; $D5
+	add_tm IRON_TAIL    ; $D6
+	add_tm DRAGONBREATH ; $D7
+	add_tm THUNDER      ; $D8
+	add_tm EARTHQUAKE   ; $D9
+	add_tm RETURN       ; $DA
+	add_tm DIG          ; $DB
+	const ITEM_DC       ; $DC
+	add_tm PSYCHIC      ; $DD
+	add_tm SHADOW_BALL  ; $DE
+	add_tm MUD_SLAP     ; $DF
+	add_tm DOUBLE_TEAM  ; $E0
+	add_tm ICE_PUNCH    ; $E1
+	add_tm SWAGGER      ; $E2
+	add_tm SLEEP_TALK   ; $E3
+	add_tm SLUDGE_BOMB  ; $E4
+	add_tm SANDSTORM    ; $E5
+	add_tm FIRE_BLAST   ; $E6
+	add_tm SWIFT        ; $E7
+	add_tm DEFENSE_CURL ; $E8
+	add_tm THUNDERPUNCH ; $E9
+	add_tm DREAM_EATER  ; $EA
+	add_tm DETECT       ; $EB
+	add_tm REST         ; $EC
+	add_tm ATTRACT      ; $ED
+	add_tm THIEF        ; $EE
+	add_tm STEEL_WING   ; $EF
+	add_tm FIRE_PUNCH   ; $F0
+	add_tm FURY_CUTTER  ; $F1
+	add_tm NIGHTMARE    ; $F2
 NUM_TMS = const_value - TM01 - 2
 
-	add_hm CUT
-	add_hm FLY
-	add_hm SURF
-	add_hm STRENGTH
-	add_hm FLASH
-	add_hm WHIRLPOOL
-	add_hm WATERFALL
+	add_hm CUT          ; $F3
+	add_hm FLY          ; $F4
+	add_hm SURF         ; $F5
+	add_hm STRENGTH     ; $F6
+	add_hm FLASH        ; $F7
+	add_hm WHIRLPOOL    ; $F8
+	add_hm WATERFALL    ; $F9
 NUM_HMS = const_value - HM01
-	const HM_08
+	const HM_08         ; $FA
 
 	add_mt FLAMETHROWER
 	add_mt THUNDERBOLT
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -165,3 +165,25 @@
 HMENURETURN_ASM    EQU %11111111
 
 NUM_MON_SUBMENU_ITEMS EQU 8
+
+	const_def
+	const ZEPHYRBADGE
+	const HIVEBADGE
+	const PLAINBADGE
+	const FOGBADGE
+	const MINERALBADGE
+	const STORMBADGE
+	const GLACIERBADGE
+	const RISINGBADGE
+NUM_JOHTO_BADGES EQU const_value
+	const_def
+	const BOULDERBADGE
+	const CASCADEBADGE
+	const THUNDERBADGE
+	const RAINBOWBADGE
+	const SOULBADGE
+	const MARSHBADGE
+	const VOLCANOBADGE
+	const EARTHBADGE
+NUM_KANTO_BADGES EQU const_value
+NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -1,5 +1,5 @@
 Function14a1a: ; 14a1a
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Function5e9a
 	call SpeechTextBox
 	call UpdateSprites
--- a/event/kurt.asm
+++ b/event/kurt.asm
@@ -23,7 +23,7 @@
 ; 0x88018
 
 Special_SelectApricornForKurt: ; 88018
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld c, $1
 	xor a
 	ld [wd0e4], a
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -103,7 +103,7 @@
 .AccessBankOfMom: ; 162a8
 	ld hl, UnknownText_0x1665d
 	call PrintText
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, MenuDataHeader_0x166b5
 	call CopyMenuDataHeader
 	call InterpretMenu2
@@ -148,7 +148,7 @@
 	ld [hl], a
 	ld a, $5
 	ld [wcf64], a
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function16517
 	call Function1656b
 	call Function16571
@@ -216,7 +216,7 @@
 	ld [hl], a
 	ld a, $5
 	ld [wcf64], a
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function16512
 	call Function1656b
 	call Function16571
--- a/event/move_deleter.asm
+++ b/event/move_deleter.asm
@@ -19,7 +19,7 @@
 	jr z, .asm_2c5ca
 	ld hl, UnknownText_0x2c5ea
 	call PrintText
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Function12f5b
 	push af
 	call Function2b74
--- a/home/map.asm
+++ b/home/map.asm
@@ -1961,7 +1961,7 @@
 FadeToMenu:: ; 2b29
 	xor a
 	ld [hBGMapMode], a
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba FadeBlackBGMap
 	call ClearSprites
 	call DisableSpriteUpdates
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -52,7 +52,7 @@
 	ret
 ; 1d6e
 
-LoadMenuDataHeader_0x1d75:: ; 1d6e
+LoadPartyMenuDataHeader:: ; 1d6e
 	ld hl, MenuDataHeader_0x1d75
 	call LoadMenuDataHeader
 	ret
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -1673,7 +1673,7 @@
 
 	ld a, [CurPartyMon]
 	ld c, a
-	ld hl, wc664
+	ld hl, wBattleParticipantsNotFainted
 	ld b, SET_FLAG
 	predef FlagPredef
 
--- a/main.asm
+++ b/main.asm
@@ -415,7 +415,7 @@
 	callba TryLoadSaveFile
 	jr c, .FailToLoad
 	callba Function150b9
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function5e85
 	ld a, $1
 	ld [hBGMapMode], a
@@ -5197,7 +5197,7 @@
 .outdoors
 	xor a
 	ld [hMapAnims], a
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call ClearSprites
 	callba _FlyMap
 	ld a, e
@@ -9707,7 +9707,7 @@
 
 InitNickname: ; e3de
 	push de
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call DisableSpriteUpdates
 	pop de
 	push de
@@ -9748,7 +9748,7 @@
 Functione41c: ; e41c (3:641c)
 	xor a
 	ld [hBGMapMode], a ; $ff00+$d4
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call ClearPCItemScreen
 	ld hl, Options
 	ld a, [hl]
@@ -9844,7 +9844,7 @@
 ; e4cd
 
 Functione4cd: ; e4cd
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Function44781
 	jr nc, .asm_e4e0
 	ld hl, UnknownText_0xe4f9
@@ -9871,7 +9871,7 @@
 ; 0xe4fe
 
 Functione4fe: ; e4fe (3:64fe)
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Functione2391
 	call Function222a
 	call ClearPCItemScreen
@@ -9947,7 +9947,7 @@
 
 
 Functione559: ; e559 (3:6559)
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Functione2583
 	call Function222a
 	call ClearPCItemScreen
@@ -13264,7 +13264,7 @@
 	cp 1
 	jr nz, .asm_12ba0
 
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call ClearPalettes
 	call Function12ba9
 	call ClearPalettes
@@ -13677,7 +13677,7 @@
 
 
 OpenPartyStats: ; 12e00
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call ClearSprites
 ; PartyMon
 	xor a
@@ -14739,7 +14739,7 @@
 ; 134dd
 
 Function134dd: ; 134dd
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, Elevator_WhichFloorText
 	call PrintText
 	call Elevator_GetCurrentFloorText
@@ -16613,7 +16613,7 @@
 ; 0x157d1
 
 KrisWithdrawItemMenu: ; 0x157d1
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba ClearPCItemScreen
 .asm_157da
 	call Function15985
@@ -16692,7 +16692,7 @@
 
 
 KrisTossItemMenu: ; 0x1585f
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba ClearPCItemScreen
 .asm_15868
 	call Function15985
@@ -16729,7 +16729,7 @@
 	call Function158b8
 	jr c, .asm_158b6
 	call DisableSpriteUpdates
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Function106a5
 .asm_1589c
 	callba Function106be
@@ -17034,7 +17034,7 @@
 
 HerbShop: ; 15a6e
 	call ReadMart
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, UnknownText_0x15e4a
 	call Function15fcd
 	call Function15c62
@@ -17048,7 +17048,7 @@
 	ld de, BargainShopData
 	call LoadMartPointer
 	call Function15c25
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, UnknownText_0x15e6d
 	call Function15fcd
 	call Function15c62
@@ -17067,7 +17067,7 @@
 
 Pharmacist: ; 15aae
 	call ReadMart
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, UnknownText_0x15e90
 	call Function15fcd
 	call Function15c62
@@ -17088,7 +17088,7 @@
 .ok
 	call LoadMartPointer
 	call Function15c25
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, UnknownText_0x15f83
 	call Function15fcd
 	call Function15c62
@@ -17173,7 +17173,7 @@
 ; 15b62
 
 .HowMayIHelpYou: ; 15b62
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, UnknownText_0x15f83
 	call PrintText
 	ld a, $1
@@ -17226,7 +17226,7 @@
 ; 15baf
 
 .AnythingElse: ; 15baf
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, UnknownText_0x15fb9
 	call PrintText
 	ld a, $1
@@ -19462,7 +19462,7 @@
 
 OverworldHatchEgg:: ; 16f5e
 	call ResetWindow
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function16f70
 	call Function2b4d
 	call RestartMapMusic
@@ -20304,7 +20304,7 @@
 	ld a, [hl]
 	push af
 	set 4, [hl]
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call ClearTileMap
 	ld hl, UnknownText_0x2004c
 	call PrintText
@@ -23968,7 +23968,7 @@
 	ld d, 0
 	add hl, de
 	ld [hl], -1
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, MenuDataHeader_0x269c5
 	call CopyMenuDataHeader
 	xor a
@@ -25065,7 +25065,7 @@
 	callba Function3ed9f
 	call ClearSGB
 	call WriteBackup
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call WaitBGMap
 	jp SetPalettes
 ; 27192
@@ -26846,7 +26846,7 @@
 	ld hl, UnknownText_0x28eb8
 	bccoord 1, 14
 	call PlaceWholeStringInBoxAtOnce
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	hlcoord 10, 7
 	ld b, $3
 	ld c, $7
@@ -27015,7 +27015,7 @@
 	ld a, [hli]
 	ld [wc731], a
 	ld a, [hl]
-	ld [wc732], a
+	ld [wPlayerCharging], a
 	ld hl, OTPartyMon1DVs
 	ld a, [wd003]
 	call GetPartyLocation
@@ -27030,7 +27030,7 @@
 	ld c, l
 	callba GetCaughtGender
 	ld a, c
-	ld [wc733], a
+	ld [wEnemyCharging], a
 	ld a, [DefaultFlypoint]
 	ld [CurPartyMon], a
 	ld hl, PartySpecies
@@ -28143,7 +28143,7 @@
 	call Function295e3
 	ld de, wc703
 	call Function295ef
-	ld a, [wc733]
+	ld a, [wEnemyCharging]
 	ld de, wc724
 	call Function295f6
 	ld de, wc731
@@ -32241,7 +32241,7 @@
 	ld [wd0e4], a
 	ld [CriticalHit], a
 	ld [BattleMonSpecies], a
-	ld [wc664], a
+	ld [wBattleParticipantsNotFainted], a
 	ld [CurBattleMon], a
 	ld [wd232], a
 	ld [TimeOfDayPal], a
@@ -34427,7 +34427,7 @@
 _KrisMailBoxMenu: ; 0x447a0
 	call InitMail
 	jr z, .nomail
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function44806
 	jp WriteBackup
 
@@ -38301,7 +38301,7 @@
 	call Function1ff8
 	call Function1bee
 	call WaitBGMap
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Function89de0
 	call Call_ExitMenu
 	call Function49351
@@ -38520,7 +38520,7 @@
 	call Function4a6d8
 	call Function1bee
 	call WaitBGMap
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld a, $5
 	call GetSRAMBank
 	ld a, [$aa4b]
@@ -56925,7 +56925,7 @@
 	hlcoord 0, 12
 	lb bc, 4, 18
 	call TextBox
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld hl, UnknownText_0x90a3f
 	call PrintText
 	hlcoord 9, 3
@@ -67846,7 +67846,7 @@
 	ret
 
 BillsPCDepositFuncStats: ; e24c8 (38:64c8)
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Functione2f7e
 	call ExitMenu
 	call PCMonInfo
@@ -67865,7 +67865,7 @@
 	push af
 	ld de, PCString_ReleasePKMN
 	call Functione2a6e
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	lb bc, 14, 11
 	call PlaceYesNoBox
 	ld a, [MenuSelection2]
@@ -68111,7 +68111,7 @@
 	ret
 
 .stats: ; e26c0 (38:66c0)
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Functione2f7e
 	call ExitMenu
 	call PCMonInfo
@@ -68128,7 +68128,7 @@
 	jr c, .FailedRelease
 	ld de, PCString_ReleasePKMN
 	call Functione2a6e
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	lb bc, 14, 11
 	call PlaceYesNoBox
 	ld a, [MenuSelection2]
@@ -68371,7 +68371,7 @@
 ; e28a5
 
 Functione28a5: ; e28a5
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Functione2f7e
 	call ExitMenu
 	call PCMonInfo
@@ -70009,7 +70009,7 @@
 ; e35aa
 
 Functione35aa: ; e35aa (38:75aa)
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Functione35e2
 .loop
 	xor a
@@ -74686,7 +74686,7 @@
 	jr c, .asm_fcce6
 	ld a, 2
 .asm_fcce6
-	ld [wc733], a
+	ld [wEnemyCharging], a
 
 	ld hl, PartyMon1Level
 	ld bc, PARTYMON_STRUCT_LENGTH
@@ -74750,7 +74750,7 @@
 
 	ld e, TRADE_OT_ID
 	call GetTradeAttribute
-	ld de, wc732
+	ld de, wPlayerCharging
 	call Functionfce15
 
 	ld hl, PartyMon1ID
--- a/misc/battle_tower_5c.asm
+++ b/misc/battle_tower_5c.asm
@@ -211,10 +211,11 @@
 	ret
 ; 170394
 
-Function170394: ; 170394
-	ld hl, $c608 + 11
-	ld d, $3
-.asm_170399
+ValidateBTParty: ; 170394
+; Check for and fix errors in party data
+	ld hl, wBT_OTTempPkmn1Species
+	ld d, BATTLETOWER_NROFPKMNS
+.pkmn_loop
 	push de
 	push hl
 	ld b, h
@@ -221,57 +222,55 @@
 	ld c, l
 	ld a, [hl]
 	and a
-	jr z, .asm_1703b1
-	cp $ff
-	jr z, .asm_1703b1
-	cp $fe
-	jr z, .asm_1703b1
-	cp $fd
-	jr z, .asm_1703b1
-	cp $fc
-	jr nz, .asm_1703b4
+idx = $ff
+rept ($ff +- NUM_POKEMON)
+	jr z, .invalid
+	cp idx
+idx = idx +- 1
+endr
+	jr nz, .valid
 
-.asm_1703b1
-	ld a, $eb
+.invalid
+	ld a, SMEARGLE
 	ld [hl], a
 
-.asm_1703b4
+.valid
 	ld [CurSpecies], a
 	call GetBaseData
 	ld a, $5
 	call GetSRAMBank
-	ld a, [$b2fb]
+	ld a, [$b2fb] ; s5_b2fb ; max level?
 	call CloseSRAM
 	ld e, a
-	ld hl, $001f
+	ld hl, MON_LEVEL
 	add hl, bc
 	ld a, [hl]
-	cp $2
-	ld a, $2
-	jr c, .asm_1703d6
+	cp MIN_LEVEL
+	ld a, MIN_LEVEL
+	jr c, .load
 	ld a, [hl]
 	cp e
-	jr c, .asm_1703d7
+	jr c, .dont_load
 	ld a, e
 
-.asm_1703d6
+.load
 	ld [hl], a
 
-.asm_1703d7
+.dont_load
 	ld [CurPartyLevel], a
-	ld hl, $0002
+	ld hl, MON_MOVES
 	add hl, bc
-	ld d, $3
+	ld d, NUM_MOVES - 1
 	ld a, [hli]
 	and a
-	jr z, .asm_1703ea
-	cp $fc
-	jr nc, .asm_1703ea
-	jr .asm_1703f4
+	jr z, .not_move
+	cp NUM_ATTACKS + 1
+	jr nc, .not_move
+	jr .valid_move
 
-.asm_1703ea
+.not_move
 	dec hl
-	ld a, $1
+	ld a, POUND
 	ld [hli], a
 	xor a
 rept 2
@@ -278,27 +277,27 @@
 	ld [hli], a
 endr
 	ld [hl], a
-	jr .asm_1703ff
+	jr .done_moves
 
-.asm_1703f4
+.valid_move
 	ld a, [hl]
-	cp $fc
-	jr c, .asm_1703fb
+	cp NUM_ATTACKS + 1
+	jr c, .next
 	ld [hl], $0
 
-.asm_1703fb
+.next
 	inc hl
 	dec d
-	jr nz, .asm_1703f4
+	jr nz, .valid_move
 
-.asm_1703ff
-	ld hl, $0024
+.done_moves
+	ld hl, MON_MAXHP
 	add hl, bc
 	ld d, h
 	ld e, l
 	push hl
 	push de
-	ld hl, $000a
+	ld hl, MON_EXP + 2
 	add hl, bc
 	ld b, $1
 	predef CalcPkmnStats
@@ -317,7 +316,7 @@
 	add hl, bc
 	pop de
 	dec d
-	jp nz, .asm_170399
+	jp nz, .pkmn_loop
 	ret
 ; 170426
 
@@ -326,20 +325,20 @@
 ; 17042c
 
 Function17042c: ; 17042c
-	ld hl, OTPartyMon2ID
-	ld a, $7
-.asm_170431
+	ld hl, BT_TrainerTextIndex + $be
+	ld a, 7
+.loop
 	push af
 	push hl
-	ld c, $12
-.asm_170435
+	ld c, 18
+.loop2
 	ld a, [hli]
 	ld b, a
 	ld a, [hli]
 	and a
-	jr z, .asm_170451
+	jr z, .skip
 	cp $f
-	jr nc, .asm_17045b
+	jr nc, .exit_inner_loop
 	push hl
 	ld hl, Unknown_170470
 	dec a
@@ -349,21 +348,21 @@
 	ld a, [hl]
 	pop hl
 	cp b
-	jr c, .asm_17045b
-	jr z, .asm_17045b
+	jr c, .exit_inner_loop
+	jr z, .exit_inner_loop
 	jr .asm_170456
 
-.asm_170451
+.skip
 	ld a, b
 	cp $fc
-	jr nc, .asm_17045b
+	jr nc, .exit_inner_loop
 
 .asm_170456
 	dec c
-	jr nz, .asm_170435
-	jr .asm_170466
+	jr nz, .loop2
+	jr .dont_copy
 
-.asm_17045b
+.exit_inner_loop
 	pop de
 	push de
 	ld hl, Unknown_17047e
@@ -370,13 +369,13 @@
 	ld bc, BATTLETOWER_TRAINERDATALENGTH
 	call CopyBytes
 
-.asm_170466
+.dont_copy
 	pop hl
 	ld de, $00e0
 	add hl, de
 	pop af
 	dec a
-	jr nz, .asm_170431
+	jr nz, .loop
 	ret
 ; 170470
 
--- a/misc/crystal_misc.asm
+++ b/misc/crystal_misc.asm
@@ -430,7 +430,7 @@
 	ret
 
 .asm_17a92c
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function17a99e
 	ld hl, $d088
 	set 7, [hl]
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -2927,7 +2927,7 @@
 ; 0x8a241
 
 Function8a241: ; 8a241 (22:6241)
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function891fe
 	call Function8a262
 	jr nc, .asm_8a254
@@ -3455,7 +3455,7 @@
 ; 8a62c
 
 Function8a62c: ; 8a62c (22:662c)
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function891fe
 	xor a
 	call Function8b94a
@@ -3885,7 +3885,7 @@
 	jr c, .asm_8a9bb
 	push bc
 	push de
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	pop de
 	dec e
 	ld a, e
@@ -4141,7 +4141,7 @@
 
 Function8ab93: ; 8ab93 (22:6b93)
 	call WhiteBGMap
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	callba Function105688
 	call ClearSprites
 	call Function891fe
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -242,7 +242,7 @@
 	jr z, .asm_1001af
 	cp $f8
 	ret z
-	ret
+	ret   ; ????????????????????????????
 
 .asm_1001af
 	ld a, $d7
@@ -4483,7 +4483,7 @@
 
 Function101d95: ; 101d95
 	call Function101ee2
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	ld e, $e
 	call Function101ee4
 	ld hl, wcd29
@@ -6256,7 +6256,7 @@
 ; 1029cf
 
 Function1029cf: ; 1029cf
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	hlcoord 10, 7
 	ld b, $3
 	ld c, $8
@@ -6384,7 +6384,7 @@
 	ld a, [hli]
 	ld [wc731], a
 	ld a, [hl]
-	ld [wc732], a
+	ld [wPlayerCharging], a
 	ld a, [wcd4d]
 	dec a
 	ld hl, OTPartyMon1DVs
@@ -6401,7 +6401,7 @@
 	ld c, l
 	callba GetCaughtGender
 	ld a, c
-	ld [wc733], a
+	ld [wEnemyCharging], a
 	ret
 ; 102b12
 
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -1259,7 +1259,7 @@
 	call Function108a92
 	ld de, wc703
 	call Function108a9c
-	ld a, [wc733]
+	ld a, [wEnemyCharging]
 	ld de, wc724
 	call Function108aa3
 	ld de, wc731
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -7658,7 +7658,7 @@
 	ld a, [$c608 + 11]
 	ld [wc731], a
 	ld a, [$c608 + 12]
-	ld [wc732], a
+	ld [wPlayerCharging], a
 	ld hl, $c608 + 26
 	ld a, [hli]
 	ld [wc72f], a
@@ -7667,7 +7667,7 @@
 	ld bc, $c608 + 5
 	callba GetCaughtGender
 	ld a, c
-	ld [wc733], a
+	ld [wEnemyCharging], a
 	call SpeechTextBox
 	call FadeToMenu
 	callba Function108016
--- a/misc/mobile_5b.asm
+++ b/misc/mobile_5b.asm
@@ -884,7 +884,7 @@
 ; 16d43b
 
 Function16d43b: ; 16d43b
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call WhiteBGMap
 	call ClearTileMap
 	call ClearSprites
@@ -1034,7 +1034,7 @@
 ; 16d6ce
 
 Function16d6ce: ; 16d6ce
-	call LoadMenuDataHeader_0x1d75
+	call LoadPartyMenuDataHeader
 	call Function16d6e1
 	callba Function87d
 	call Call_ExitMenu
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -62,11 +62,11 @@
 	ld a, [hli]
 	ld [wc731], a
 	ld a, [hl]
-	ld [wc732], a
+	ld [wPlayerCharging], a
 	ld bc, $a82c
 	callba GetCaughtGender
 	ld a, c
-	ld [wc733], a
+	ld [wEnemyCharging], a
 	ld a, [wcd81]
 	ld [wc74e], a
 	call CloseSRAM
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -285,7 +285,7 @@
 	ld a, [$c608 + 11]
 	ld [wc731], a
 	ld a, [$c608 + 12]
-	ld [wc732], a
+	ld [wPlayerCharging], a
 	ld hl, $c608 + 26
 	ld a, [hli]
 	ld [wc72f], a
@@ -294,7 +294,7 @@
 	ld bc, $c608 + 5
 	callba GetCaughtGender
 	ld a, c
-	ld [wc733], a
+	ld [wEnemyCharging], a
 	call SpeechTextBox
 	call FadeToMenu
 	callba Function10804d
--- a/wram.asm
+++ b/wram.asm
@@ -488,7 +488,14 @@
 CurOTMon:: ; c663
 	ds 1
 
-wc664:: ds 1
+wBattleParticipantsNotFainted::
+; Bit array.  Bits 0 - 5 correspond to party members 1 - 6.
+; Bit set if the mon appears in battle.
+; Bit cleared if the mon faints.
+; Backed up if the enemy switches.
+; All bits cleared if the enemy faints.
+	ds 1
+
 TypeModifier:: ; c665
 ; >10: super-effective
 ;  10: normal
@@ -848,8 +855,8 @@
 wc72f:: ds 1
 wc730:: ds 1
 wc731:: ds 1
-wc732:: ds 1
-wc733:: ds 1
+wPlayerCharging:: ds 1
+wEnemyCharging:: ds 1
 wc734::
 BattleEnded:: ; c734
 	ds 1