ref: d972564175bcee324877f1e016fafd349c50e7d3
parent: 0dc5ae04b82143b1cbff50a9d25ebe21326305ae
author: PikalaxALT <[email protected]>
date: Mon Nov 23 11:04:53 EST 2015
link and seer labels
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -7,7 +7,7 @@
xor a
ld [wBattleParticipantsNotFainted], a
ld [wc6fc], a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ld [BattleEnded], a
inc a
ld [wd264], a
@@ -302,7 +302,7 @@
call HandleHealingItems
call UpdateBattleMonInParty
call LoadTileMapToTempTileMap
- jp Function3c4df
+ jp HandleEncore
; 3c23c
CheckFaint_PlayerThenEnemy: ; 3c23c
@@ -461,7 +461,7 @@
jr z, .use_move
sub BATTLEACTION_SWITCH1
jr c, .use_move
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
cp $2
jr nz, .switch
ld a, [hLinkPlayerNumber]
@@ -486,7 +486,7 @@
jp .enemy_first
.use_move
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
and a
jp nz, .player_first
call CompareMovePriority
@@ -629,7 +629,7 @@
jr .encored
.not_encored
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
cp $2
jr z, .reset_rage
and a
@@ -638,7 +638,7 @@
and 1 << SUBSTATUS_BIDE
jr nz, .locked_in
xor a
- ld [wd235], a
+ ld [wMoveSelectionMenuType], a
inc a ; POUND
ld [FXAnimIDLo], a
call MoveSelectionScreen
@@ -714,16 +714,16 @@
ret
; 3c4df
-Function3c4df: ; 3c4df
+HandleEncore: ; 3c4df
ld a, [hLinkPlayerNumber]
cp $1
- jr z, .asm_3c4ea
- call .asm_3c4ed
- jr .asm_3c518
+ jr z, .player_1
+ call .do_player
+ jr .do_enemy
-.asm_3c4ea
- call .asm_3c518
-.asm_3c4ed
+.player_1
+ call .do_enemy
+.do_player
ld hl, PlayerSubStatus5
bit SUBSTATUS_ENCORED, [hl]
ret z
@@ -730,7 +730,7 @@
ld a, [PlayerEncoreCount]
dec a
ld [PlayerEncoreCount], a
- jr z, .asm_3c50a
+ jr z, .end_player_encore
ld hl, BattleMonPP
ld a, [CurMoveNum]
ld c, a
@@ -740,7 +740,7 @@
and $3f
ret nz
-.asm_3c50a
+.end_player_encore
ld hl, PlayerSubStatus5
res SUBSTATUS_ENCORED, [hl]
call SetEnemyTurn
@@ -747,7 +747,7 @@
ld hl, BattleText_TargetsEncoreEnded
jp StdBattleTextBox
-.asm_3c518
+.do_enemy
ld hl, EnemySubStatus5
bit SUBSTATUS_ENCORED, [hl]
ret z
@@ -754,7 +754,7 @@
ld a, [EnemyEncoreCount]
dec a
ld [EnemyEncoreCount], a
- jr z, .asm_3c535
+ jr z, .end_enemy_encore
ld hl, EnemyMonPP
ld a, [CurEnemyMoveNum]
ld c, a
@@ -764,7 +764,7 @@
and $3f
ret nz
-.asm_3c535
+.end_enemy_encore
ld hl, EnemySubStatus5
res SUBSTATUS_ENCORED, [hl]
call SetPlayerTurn
@@ -972,7 +972,7 @@
jp z, HandlePlayerMonFaint
call RefreshBattleHuds
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; 3c664
@@ -1022,7 +1022,7 @@
jp z, HandleEnemyMonFaint
call RefreshBattleHuds
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; 3c6cf
@@ -2004,7 +2004,8 @@
ret
; 3ccc2
-Function3ccc2: ; 3ccc2
+GetHalfHP: ; 3ccc2
+; unreferenced
ld hl, BattleMonHP
ld a, [hBattleTurn]
and a
@@ -2160,22 +2161,22 @@
jp c, WildFled_EnemyFled_LinkBattleCanceled
ld a, $1
- ld [wd0ec], a
+ ld [wPlayerAction], a
call Function3cf4a
jp z, WildFled_EnemyFled_LinkBattleCanceled
- jr Function3cdca
+ jr DoubleSwitch
.player_mon_not_fainted
ld a, $1
- ld [wd0ec], a
+ ld [wPlayerAction], a
call Function3cf4a
jp z, WildFled_EnemyFled_LinkBattleCanceled
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; 3cdca
-Function3cdca: ; 3cdca
+DoubleSwitch: ; 3cdca
ld a, [hLinkPlayerNumber]
cp $1
jr z, .player_1
@@ -2201,7 +2202,7 @@
.done
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; 3ce01
@@ -2412,7 +2413,7 @@
Function3cf4a: ; 3cf4a
ld hl, EnemyHPPal
ld e, HP_BAR_LENGTH_PX
- call Function3e12e
+ call UpdateHPPal
call WaitBGMap
callba Function2c012
ld a, [wLinkMode]
@@ -2419,7 +2420,7 @@
and a
jr z, .not_linked
- call Function3e8e4
+ call LinkBattleSendReceiveAction
ld a, [wBattleAction]
cp BATTLEACTION_FORFEIT
ret z
@@ -2459,7 +2460,7 @@
call SpikesDamage
xor a
ld [wEnemyMoveStruct + MOVE_ANIM], a
- ld [wd0ec], a
+ ld [wPlayerAction], a
inc a
ret
; 3cfa4
@@ -2813,10 +2814,10 @@
and a
ret nz
ld a, $1
- ld [wd0ec], a
+ ld [wPlayerAction], a
call Function3cf4a
jp z, WildFled_EnemyFled_LinkBattleCanceled
- jp Function3cdca
+ jp DoubleSwitch
; 3d1aa
PlayerMonFaintHappinessMod: ; 3d1aa
@@ -2896,12 +2897,12 @@
and a
jr z, .skip_link
ld a, $1
- ld [wd0ec], a
- call Function3e8e4
+ ld [wPlayerAction], a
+ call LinkBattleSendReceiveAction
.skip_link
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
call CheckMobileBattleError
jr c, .enemy_fainted_mobile_error
ld hl, EnemyMonHP
@@ -3344,7 +3345,7 @@
xor a
ld [wBattleParticipantsNotFainted], a
ld [wc6fc], a
- ld [wd0ec], a
+ ld [wPlayerAction], a
inc a
ld [wEnemyIsSwitching], a
call LoadTileMapToTempTileMap
@@ -3938,9 +3939,9 @@
jp .can_escape
.no_flee_item
- ld a, [wd267]
+ ld a, [wNumFleeAttempts]
inc a
- ld [wd267], a
+ ld [wNumFleeAttempts], a
ld a, [hli]
ld [hStringCmpString2 + 0], a
ld a, [hl]
@@ -3981,12 +3982,12 @@
ld a, [hQuotient + 1]
and a
jr nz, .can_escape
- ld a, [wd267]
+ ld a, [wNumFleeAttempts]
ld c, a
.loop
dec c
jr z, .cant_escape_2
- ld b, $1e
+ ld b, 30
ld a, [hQuotient + 2]
add b
ld [hQuotient + 2], a
@@ -4000,7 +4001,7 @@
cp b
jr nc, .can_escape
ld a, $1
- ld [wd0ec], a
+ ld [wPlayerAction], a
ld hl, BattleText_CantEscape2
jr .print_inescapable_text
@@ -4014,7 +4015,7 @@
.print_inescapable_text
call StdBattleTextBox
ld a, $1
- ld [wd266], a
+ ld [wFailedToFlee], a
call LoadTileMapToTempTileMap
and a
ret
@@ -4026,12 +4027,12 @@
jr z, .fled
call LoadTileMapToTempTileMap
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ld a, $f
ld [CurMoveNum], a
xor a
ld [CurPlayerMove], a
- call Function3e8e4
+ call LinkBattleSendReceiveAction
call Call_LoadTempTileMapToTileMap
call CheckMobileBattleError
jr c, .mobile
@@ -4886,7 +4887,7 @@
UpdatePlayerHPPal: ; 3df98
ld hl, PlayerHPPal
- jp Function3e12e
+ jp UpdateHPPal
; 3df9e
CheckDanger: ; 3df9e
@@ -4917,7 +4918,7 @@
PrintPlayerHUD: ; 3dfbf
ld de, BattleMonNick
hlcoord 10, 7
- call Function3e138
+ call ret_3e138
call PlaceString
push bc
@@ -5005,7 +5006,7 @@
call GetBaseData
ld de, EnemyMonNick
hlcoord 1, 0
- call Function3e138
+ call ret_3e138
call PlaceString
ld h, b
ld l, c
@@ -5028,12 +5029,12 @@
ld [MonType], a
callab GetGender
ld a, " "
- jr c, .asm_3e09a
+ jr c, .got_gender
ld a, "♂"
- jr nz, .asm_3e09a
+ jr nz, .got_gender
ld a, "♀"
-.asm_3e09a
+.got_gender
hlcoord 9, 1
ld [hl], a
@@ -5044,16 +5045,16 @@
predef PlaceNonFaintStatus
pop hl
pop bc
- jr nz, .asm_3e0be
+ jr nz, .skip_level
ld a, b
cp " "
- jr nz, .asm_3e0b5
+ jr nz, .print_level
dec hl
-.asm_3e0b5
+.print_level
ld a, [EnemyMonLevel]
ld [TempMonLevel], a
call PrintLevel
-.asm_3e0be
+.skip_level
ld hl, EnemyMonHP
ld a, [hli]
@@ -5061,14 +5062,14 @@
ld a, [hld]
ld [hMultiplicand + 2], a
or [hl]
- jr nz, .asm_3e0d1
+ jr nz, .not_fainted
ld c, a
ld e, a
ld d, HP_BAR_LENGTH
- jp .asm_3e11a
+ jp .draw_bar
-.asm_3e0d1
+.not_fainted
xor a
ld [hMultiplicand], a
ld a, HP_BAR_LENGTH_PX
@@ -5081,7 +5082,7 @@
ld [hMultiplier], a
ld a, b
and a
- jr z, .asm_3e105
+ jr z, .less_than_256_max
ld a, [hMultiplier]
srl b
rr a
@@ -5099,12 +5100,12 @@
ld a, b
ld [hProduct + 2], a
-.asm_3e105
+.less_than_256_max
ld a, [hProduct + 2]
ld [hDividend + 0], a
ld a, [hProduct + 3]
ld [hDividend + 1], a
- ld a, $2
+ ld a, 2
ld b, a
call Divide
ld a, [hQuotient + 2]
@@ -5113,7 +5114,7 @@
ld d, a
ld c, a
-.asm_3e11a
+.draw_bar
xor a
ld [wd10a], a
hlcoord 2, 2
@@ -5124,11 +5125,11 @@
UpdateEnemyHPPal: ; 3e127
ld hl, EnemyHPPal
- call Function3e12e
+ call UpdateHPPal
ret
; 3e12e
-Function3e12e: ; 3e12e
+UpdateHPPal: ; 3e12e
ld b, [hl]
call SetHPPal
ld a, [hl]
@@ -5137,7 +5138,7 @@
jp FinishBattleAnim
; 3e138
-Function3e138: ; 3e138
+ret_3e138: ; 3e138
ret
; 3e139
@@ -5192,7 +5193,7 @@
BattleMenu_Fight: ; 3e192
xor a
- ld [wd267], a
+ ld [wNumFleeAttempts], a
call Call_LoadTempTileMapToTileMap
and a
ret
@@ -5242,13 +5243,13 @@
jr z, .contest
callba BattlePack
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
and a
jr z, .didnt_use_item
jr .got_item
.tutorial
- callba Function107bb
+ callba TutorialPack
ld a, POKE_BALL
ld [CurItem], a
call DoItemEffect
@@ -5448,7 +5449,7 @@
ld a, [CurBattleMon]
ld [LastPlayerMon], a
ld a, $2
- ld [wd0ec], a
+ ld [wPlayerAction], a
call ClearPalettes
call DelayFrame
call ClearSprites
@@ -5468,7 +5469,7 @@
and a
jr z, .not_linked
call LoadStandardMenuDataHeader
- call Function3e8e4
+ call LinkBattleSendReceiveAction
call WriteBackup
.not_linked
@@ -5585,9 +5586,9 @@
ld de, EnemyMonSpeed
call TryToRunAwayFromBattle
ld a, $0
- ld [wd266], a
+ ld [wFailedToFlee], a
ret c
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
and a
ret nz
jp BattleMenu
@@ -5608,27 +5609,27 @@
MoveSelectionScreen: ; 3e4bc
call IsMobileBattle
- jr nz, .asm_3e4c8
- callba Function100b9f
+ jr nz, .not_mobile
+ callba MobileMoveSelectionScreen
ret
-.asm_3e4c8
+.not_mobile
ld hl, EnemyMonMoves
- ld a, [wd235]
+ ld a, [wMoveSelectionMenuType]
dec a
- jr z, .asm_3e4e2
+ jr z, .got_menu_type
dec a
- jr z, .asm_3e4dd
- call Function3e786
- ret z
+ jr z, .ether_elixer_menu
+ call CheckPlayerHasUsableMoves
+ ret z ; use Struggle
ld hl, BattleMonMoves
- jr .asm_3e4e2
+ jr .got_menu_type
-.asm_3e4dd
+.ether_elixer_menu
ld a, MON_MOVES
call GetPartyParamLocation
-.asm_3e4e2
+.got_menu_type
ld de, wListMoves_MoveIndicesBuffer
ld bc, NUM_MOVES
call CopyBytes
@@ -5638,44 +5639,44 @@
hlcoord 4, 17 - NUM_MOVES - 1
ld b, 4
ld c, 14
- ld a, [wd235]
+ ld a, [wMoveSelectionMenuType]
cp $2
- jr nz, .asm_3e503
+ jr nz, .got_dims
hlcoord 4, 17 - NUM_MOVES - 1 - 4
ld b, 4
ld c, 14
-.asm_3e503
+.got_dims
call TextBox
hlcoord 6, 17 - NUM_MOVES
- ld a, [wd235]
+ ld a, [wMoveSelectionMenuType]
cp $2
- jr nz, .asm_3e513
+ jr nz, .got_start_coord
hlcoord 6, 17 - NUM_MOVES - 4
-.asm_3e513
+.got_start_coord
ld a, SCREEN_WIDTH
ld [Buffer1], a
predef ListMoves
ld b, 5
- ld a, [wd235]
+ ld a, [wMoveSelectionMenuType]
cp $2
ld a, 17 - NUM_MOVES
- jr nz, .asm_3e52c
+ jr nz, .got_default_coord
ld b, 5
ld a, 17 - NUM_MOVES - 4
-.asm_3e52c
+.got_default_coord
ld [wcfa1], a
ld a, b
ld [wcfa2], a
- ld a, [wd235]
+ ld a, [wMoveSelectionMenuType]
cp $1
- jr z, .asm_3e53e
+ jr z, .skip_inc
ld a, [CurMoveNum]
inc a
-.asm_3e53e
+.skip_inc
ld [MenuSelection2], a
ld a, $1
ld [wcfaa], a
@@ -5685,19 +5686,19 @@
ld a, $1
ld [wcfa4], a
ld c, $2c
- ld a, [wd235]
+ ld a, [wMoveSelectionMenuType]
dec a
ld b, $c1
- jr z, .asm_3e569
+ jr z, .okay
dec a
ld b, $c3
- jr z, .asm_3e569
+ jr z, .okay
ld a, [wLinkMode]
and a
- jr nz, .asm_3e569
+ jr nz, .okay
ld b, $c7
-.asm_3e569
+.okay
ld a, b
ld [wcfa8], a
ld a, c
@@ -5706,22 +5707,22 @@
ld [wcfa6], a
ld a, $10
ld [wcfa7], a
-.asm_3e57a
- ld a, [wd235]
+.menu_loop
+ ld a, [wMoveSelectionMenuType]
and a
- jr z, .asm_3e58e
+ jr z, .battle_player_moves
dec a
- jr nz, .asm_3e5a3
+ jr nz, .interpret_joypad
hlcoord 11, 14
ld de, .string_3e61c
call PlaceString
- jr .asm_3e5a3
+ jr .interpret_joypad
-.asm_3e58e
+.battle_player_moves
call MoveInfoBox
- ld a, [wSwitchMon]
+ ld a, [wMoveSwapBuffer]
and a
- jr z, .asm_3e5a3
+ jr z, .interpret_joypad
hlcoord 5, 13
ld bc, SCREEN_WIDTH
dec a
@@ -5728,42 +5729,42 @@
call AddNTimes
ld [hl], "▷"
-.asm_3e5a3
+.interpret_joypad
ld a, $1
ld [hBGMapMode], a
call Function1bd3
- bit 6, a ; D_UP
- jp nz, .asm_3e61d
- bit 7, a ; D_DOWN
- jp nz, .asm_3e62e
- bit 2, a ; B_BUTTON
- jp nz, .asm_3e643
- bit 1, a ; A_BUTTON
+ bit D_UP_F, a
+ jp nz, .pressed_up
+ bit D_DOWN_F, a
+ jp nz, .pressed_down
+ bit SELECT_F, a
+ jp nz, .pressed_select
+ bit B_BUTTON_F, a
push af
xor a
- ld [wSwitchMon], a
+ ld [wMoveSwapBuffer], a
ld a, [MenuSelection2]
dec a
ld [MenuSelection2], a
ld b, a
- ld a, [wd235]
+ ld a, [wMoveSelectionMenuType]
dec a
- jr nz, .asm_3e5d0
+ jr nz, .not_enemy_moves_process_b
pop af
ret
-.asm_3e5d0
+.not_enemy_moves_process_b
dec a
ld a, b
ld [CurMoveNum], a
- jr nz, .asm_3e5d9
+ jr nz, .use_move
pop af
ret
-.asm_3e5d9
+.use_move
pop af
ret nz
@@ -5774,16 +5775,16 @@
add hl, bc
ld a, [hl]
and $3f
- jr z, .asm_3e610
+ jr z, .no_pp_left
ld a, [PlayerDisableCount]
swap a
and $f
dec a
cp c
- jr z, .asm_3e60b
+ jr z, .move_disabled
ld a, [wc6e1]
and a
- jr nz, .asm_3e606
+ jr nz, .skip2
ld a, [MenuSelection2]
ld hl, BattleMonMoves
ld c, a
@@ -5791,19 +5792,19 @@
add hl, bc
ld a, [hl]
-.asm_3e606
+.skip2
ld [CurPlayerMove], a
xor a
ret
-.asm_3e60b
+.move_disabled
ld hl, BattleText_TheMoveIsDisabled
- jr .asm_3e613
+ jr .place_textbox_start_over
-.asm_3e610
+.no_pp_left
ld hl, BattleText_TheresNoPPLeftForThisMove
-.asm_3e613
+.place_textbox_start_over
call StdBattleTextBox
call Call_LoadTempTileMapToTileMap
jp MoveSelectionScreen
@@ -5813,17 +5814,17 @@
db "@"
; 3e61d
-.asm_3e61d
+.pressed_up
ld a, [MenuSelection2]
and a
- jp nz, .asm_3e57a
+ jp nz, .menu_loop
ld a, [wd0eb]
inc a
ld [MenuSelection2], a
- jp .asm_3e57a
+ jp .menu_loop
; 3e62e
-.asm_3e62e ; 3e62e
+.pressed_down ; 3e62e
ld a, [MenuSelection2]
ld b, a
ld a, [wd0eb]
@@ -5831,20 +5832,20 @@
inc a
endr
cp b
- jp nz, .asm_3e57a
+ jp nz, .menu_loop
ld a, $1
ld [MenuSelection2], a
- jp .asm_3e57a
+ jp .menu_loop
; 3e643
-.asm_3e643 ; 3e643
- ld a, [wSwitchMon]
+.pressed_select ; 3e643
+ ld a, [wMoveSwapBuffer]
and a
- jr z, .asm_3e6bf
+ jr z, .start_swap
ld hl, BattleMonMoves
- call .asm_3e6a5
+ call .swap_bytes
ld hl, BattleMonPP
- call .asm_3e6a5
+ call .swap_bytes
ld hl, PlayerDisableCount
ld a, [hl]
swap a
@@ -5852,20 +5853,20 @@
ld b, a
ld a, [MenuSelection2]
cp b
- jr nz, .asm_3e671
+ jr nz, .not_swapping_disabled_move
ld a, [hl]
and $f
ld b, a
- ld a, [wSwitchMon]
+ ld a, [wMoveSwapBuffer]
swap a
add b
ld [hl], a
- jr .asm_3e682
+ jr .swap_moves_in_party_struct
-.asm_3e671
- ld a, [wSwitchMon]
+.not_swapping_disabled_move
+ ld a, [wMoveSwapBuffer]
cp b
- jr nz, .asm_3e682
+ jr nz, .swap_moves_in_party_struct
ld a, [hl]
and $f
ld b, a
@@ -5874,28 +5875,29 @@
add b
ld [hl], a
-.asm_3e682
+.swap_moves_in_party_struct
+; Fixes the COOLTRAINER glitch
ld a, [PlayerSubStatus5]
bit SUBSTATUS_TRANSFORMED, a
- jr nz, .asm_3e69e
+ jr nz, .transformed
ld hl, PartyMon1Moves
ld a, [CurBattleMon]
call GetPartyLocation
push hl
- call .asm_3e6a5
+ call .swap_bytes
pop hl
ld bc, MON_PP - MON_MOVES
add hl, bc
- call .asm_3e6a5
+ call .swap_bytes
-.asm_3e69e
+.transformed
xor a
- ld [wSwitchMon], a
+ ld [wMoveSwapBuffer], a
jp MoveSelectionScreen
-.asm_3e6a5
+.swap_bytes
push hl
- ld a, [wSwitchMon]
+ ld a, [wMoveSwapBuffer]
dec a
ld c, a
ld b, 0
@@ -5915,9 +5917,9 @@
ld [de], a
ret
-.asm_3e6bf
+.start_swap
ld a, [MenuSelection2]
- ld [wSwitchMon], a
+ ld [wMoveSwapBuffer], a
jp MoveSelectionScreen
; 3e6c8
@@ -5933,7 +5935,7 @@
ld a, [PlayerDisableCount]
and a
- jr z, .asm_3e6f4
+ jr z, .not_disabled
swap a
and $f
@@ -5940,7 +5942,7 @@
ld b, a
ld a, [MenuSelection2]
cp b
- jr nz, .asm_3e6f4
+ jr nz, .not_disabled
hlcoord 1, 10
ld de, .Disabled
@@ -5947,7 +5949,7 @@
call PlaceString
jr .done
-.asm_3e6f4
+.not_disabled
ld hl, MenuSelection2
dec [hl]
call SetPlayerTurn
@@ -5974,7 +5976,7 @@
ld a, [hl]
and $3f
ld [StringBuffer1], a
- call Function3e75f
+ call .PrintPP
hlcoord 1, 9
ld de, .Type
@@ -6000,7 +6002,7 @@
; 3e75f
-Function3e75f: ; 3e75f
+.PrintPP: ; 3e75f
hlcoord 5, 11
ld a, [wLinkMode] ; What's the point of this check?
cp LINK_MOBILE
@@ -6023,13 +6025,13 @@
ret
; 3e786
-Function3e786: ; 3e786
+CheckPlayerHasUsableMoves: ; 3e786
ld a, STRUGGLE
ld [CurPlayerMove], a
ld a, [PlayerDisableCount]
and a
ld hl, BattleMonPP
- jr nz, .asm_3e79f
+ jr nz, .disabled
ld a, [hli]
or [hl]
@@ -6039,29 +6041,29 @@
or [hl]
and $3f
ret nz
- jr .asm_3e7b4
+ jr .force_struggle
-.asm_3e79f
+.disabled
swap a
and $f
ld b, a
ld d, $5
xor a
-.asm_3e7a7
+.loop
dec d
- jr z, .asm_3e7b2
+ jr z, .done
ld c, [hl]
inc hl
dec b
- jr z, .asm_3e7a7
+ jr z, .loop
or c
- jr .asm_3e7a7
+ jr .loop
-.asm_3e7b2
+.done
and a
ret nz
-.asm_3e7b4
+.force_struggle
ld hl, BattleText_PkmnHasNoMovesLeft
call StdBattleTextBox
ld c, 60
@@ -6081,9 +6083,9 @@
jr z, .not_linked
call EmptyBattleTextBox
call LoadTileMapToTempTileMap
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
and a
- call z, Function3e8e4
+ call z, LinkBattleSendReceiveAction
call Call_LoadTempTileMapToTileMap
ld a, [wBattleAction]
cp BATTLEACTION_E
@@ -6247,8 +6249,8 @@
ret
; 3e8e4
-Function3e8e4: ; 3e8e4
- callba Function100a09
+LinkBattleSendReceiveAction: ; 3e8e4
+ callba _LinkBattleSendReceiveAction
ret
; 3e8eb
@@ -6569,13 +6571,13 @@
xor a
ld [hli], a
-; Full HP...
+; Full HP..
ld a, [EnemyMonMaxHP]
ld [hli], a
ld a, [EnemyMonMaxHP + 1]
ld [hl], a
-; ...unless it's a RoamMon
+; ..unless it's a RoamMon
ld a, [BattleType]
cp a, BATTLETYPE_ROAMING
jr nz, .Moves
@@ -6678,7 +6680,7 @@
call CopyBytes
.Finish
-; Only the first five base stats are copied...
+; Only the first five base stats are copied..
ld hl, BaseStats
ld de, EnemyMonBaseStats
ld b, BaseSpecialDefense - BaseStats
@@ -8759,8 +8761,8 @@
ld [AttackMissed], a
ld [TempWildMonSpecies], a
ld [OtherTrainerClass], a
- ld [wd266], a
- ld [wd267], a
+ ld [wFailedToFlee], a
+ ld [wNumFleeAttempts], a
ld [wForcedSwitch], a
ld [wd0d8], a
ld [wKeyItemsPocketCursor], a
@@ -8768,13 +8770,13 @@
ld [wd0d2], a
ld [CurMoveNum], a
ld [wBallsPocketCursor], a
- ld [wd0d6], a
- ld [wd0e4], a
- ld [wd0e0], a
- ld [wd0df], a
- ld [wd0e1], a
+ ld [wLastPocket], a
+ ld [wMenuScrollPosition], a
+ ld [wKeyItemsPocketScrollPosition], a
+ ld [wItemsPocketScrollPosition], a
+ ld [wBallsPocketScrollPosition], a
ld hl, PlayerSubStatus1
- ld b, $18
+ ld b, EnemyFuryCutterCount - PlayerSubStatus1
.loop
ld [hli], a
dec b
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -9028,7 +9028,7 @@
ld [wd0ec], a
call LoadStandardMenuDataHeader
- ld hl, Function3e8e4
+ ld hl, LinkBattleSendReceiveAction
call CallBattleCore
call WriteBackup
@@ -9044,7 +9044,7 @@
ret z
call LoadStandardMenuDataHeader
- ld hl, Function3e8e4
+ ld hl, LinkBattleSendReceiveAction
call CallBattleCore
ld a, [OTPartyCount]
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -176,6 +176,10 @@
const LINK_COLOSSEUM
const LINK_MOBILE
+SERIAL_TIMECAPSULE EQU $60
+SERIAL_TRADECENTER EQU $70
+SERIAL_BATTLE EQU $80
+
HMENURETURN_SCRIPT EQU %10000000
HMENURETURN_ASM EQU %11111111
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -2362,7 +2362,7 @@
ld hl, _ChangeBox_menudataheader
call CopyMenuDataHeader
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
hlcoord 0, 4
lb bc, 8, 9
call TextBox
--- a/engine/decorations.asm
+++ b/engine/decorations.asm
@@ -399,7 +399,7 @@
ld [hBGMapMode], a
call InitScrollingMenu
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
ld a, [wcf73]
cp 2
--- a/engine/evolve.asm
+++ b/engine/evolve.asm
@@ -9,7 +9,7 @@
EvolveAfterBattle: ; 421e6
xor a
- ld [wd268], a
+ ld [wMonTriedToEvolve], a
dec a
ld [CurPartyMon], a
push hl
@@ -201,7 +201,7 @@
ld a, [TempMonLevel]
ld [CurPartyLevel], a
ld a, $1
- ld [wd268], a
+ ld [wMonTriedToEvolve], a
push hl
@@ -349,7 +349,7 @@
ld a, [wBattleMode]
and a
ret nz
- ld a, [wd268]
+ ld a, [wMonTriedToEvolve]
and a
call nz, RestartMapMusic
ret
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -40,7 +40,7 @@
call Function28499
call Function28434
xor a
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
call Function87d
ld a, [hLinkPlayerNumber]
cp $2
@@ -474,7 +474,7 @@
ld b, $a
.asm_283b7
call DelayFrame
- call Function908
+ call LinkCommunicationsSignalDataReceived
dec b
jr nz, .asm_283b7
xor a
@@ -1213,7 +1213,7 @@
call Function28ef8
callba Function16d673
xor a
- ld hl, wcf51
+ ld hl, wOtherPlayerLinkMode
rept 3
ld [hli], a
endr
@@ -1221,7 +1221,7 @@
ld a, $1
ld [MenuSelection2], a
inc a
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
jp Function2888b
; 28803
@@ -1468,9 +1468,9 @@
ld [MenuSelection2], a
dec a
ld [wd002], a
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
callba Function16d6ce
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
cp $f
jp z, Function287e3
ld [wd003], a
@@ -1483,7 +1483,7 @@
jp nc, Function28b87
xor a
ld [wcf57], a
- ld [wcf52], a
+ ld [wOtherPlayerLinkAction], a
hlcoord 0, 12
ld b, $4
ld c, $12
@@ -1497,7 +1497,7 @@
.asm_28a58
xor a
ld [wcf57], a
- ld [wcf52], a
+ ld [wOtherPlayerLinkAction], a
ld a, [wd003]
ld hl, OTPartySpecies
ld c, a
@@ -1524,7 +1524,7 @@
ld de, String28ece
call PlaceString
ld a, $1
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
callba Function16d6ce
ld c, $64
call DelayFrames
@@ -1591,9 +1591,9 @@
ld a, $ec
ldcoord_a 9, 17
ld a, $f
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
callba Function16d6ce
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
cp $f
jr nz, .asm_28ade
@@ -1634,7 +1634,7 @@
; 28b68
Function28b68: ; 28b68
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
hlcoord 6, 9
ld bc, SCREEN_WIDTH
call AddNTimes
@@ -1662,7 +1662,7 @@
Function28b87: ; 28b87
xor a
ld [wcf57], a
- ld [wcf52], a
+ ld [wOtherPlayerLinkAction], a
hlcoord 0, 12
ld b, $4
ld c, $12
@@ -1731,7 +1731,7 @@
.asm_28c33
ld a, $1
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
hlcoord 0, 12
ld b, 4
ld c, 18
@@ -1744,9 +1744,9 @@
.asm_28c54
ld a, $2
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
callba Function16d6ce
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
dec a
jr nz, .asm_28c7b
hlcoord 0, 12
@@ -1959,7 +1959,7 @@
.asm_28e49
ld a, b
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
push bc
call Function862
pop bc
@@ -1969,7 +1969,7 @@
ld a, b
and a
jr z, .asm_28e63
- ld a, [wcf52]
+ ld a, [wOtherPlayerLinkAction]
cp b
jr nz, .asm_28e49
@@ -2148,11 +2148,11 @@
; 29c7b
Special_EnterTimeCapsule: ; 29c7b
- ld c, $a
+ ld c, 10
call DelayFrames
ld a, $4
call Function29f17
- ld c, $28
+ ld c, 40
call DelayFrames
xor a
ld [hVBlank], a
@@ -2210,15 +2210,15 @@
; 29ce8
Special_SetBitsForLinkTradeRequest: ; 29ce8
- ld a, $1
- ld [wcf56], a
+ ld a, LINK_TRADECENTER - 1
+ ld [wPlayerLinkAction], a
ld [wd265], a
ret
; 29cf1
Special_SetBitsForBattleRequest: ; 29cf1
- ld a, $2
- ld [wcf56], a
+ ld a, LINK_COLOSSEUM - 1
+ ld [wPlayerLinkAction], a
ld [wd265], a
ret
; 29cfa
@@ -2232,14 +2232,14 @@
ld [rSC], a
ld a, $80
ld [rSC], a
- xor a
- ld [wcf56], a
+ xor a ; LINK_TIMECAPSULE - 1
+ ld [wPlayerLinkAction], a
ld [wd265], a
ret
; 29d11
Special_WaitForLinkedFriend: ; 29d11
- ld a, [wcf56]
+ ld a, [wPlayerLinkAction]
and a
jr z, .asm_29d2f
ld a, $2
@@ -2295,9 +2295,9 @@
jr .asm_29d39
.asm_29d79
- call Function908
+ call LinkCommunicationsSignalDataReceived
call DelayFrame
- call Function908
+ call LinkCommunicationsSignalDataReceived
ld c, $32
call DelayFrames
ld a, $1
@@ -2312,7 +2312,7 @@
Special_CheckLinkTimeout: ; 29d92
ld a, $1
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
ld hl, wcf5b
ld a, $3
ld [hli], a
@@ -2334,7 +2334,7 @@
Function29dba: ; 29dba
ld a, $5
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
ld hl, wcf5b
ld a, $3
ld [hli], a
@@ -2355,17 +2355,17 @@
ld a, b
or c
jr nz, .asm_29de0
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
cp $5
jr nz, .asm_29e03
ld a, $6
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
ld hl, wcf5b
ld a, $1
ld [hli], a
ld [hl], $32
call Function29e0c
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
cp $6
jr z, .asm_29e08
@@ -2426,7 +2426,7 @@
ld b, $a
.asm_29e49
call DelayFrame
- call Function908
+ call LinkCommunicationsSignalDataReceived
dec b
jr nz, .asm_29e49
ret
@@ -2467,14 +2467,14 @@
ld a, [wd265]
call Function29f17
push af
- call Function908
+ call LinkCommunicationsSignalDataReceived
call DelayFrame
- call Function908
+ call LinkCommunicationsSignalDataReceived
pop af
ld b, a
ld a, [wd265]
cp b
- jr nz, .asm_29eaa
+ jr nz, .fail
ld a, [wd265]
inc a
ld [wLinkMode], a
@@ -2484,7 +2484,7 @@
ld [ScriptVar], a
ret
-.asm_29eaa
+.fail
xor a
ld [ScriptVar], a
ret
@@ -2532,7 +2532,7 @@
; 29efa
Special_FailedLinkToPast: ; 29efa
- ld c, $28
+ ld c, 40
call DelayFrames
ld a, $e
jp Function29f17
@@ -2539,7 +2539,7 @@
; 29f04
Function29f04: ; 29f04
- ld c, $3
+ ld c, 3
call DelayFrames
ld a, -1
ld [hLinkPlayerNumber], a
@@ -2553,26 +2553,26 @@
Function29f17: ; 29f17
add $d0
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
ld [wcf57], a
ld a, $2
ld [hVBlank], a
call DelayFrame
call DelayFrame
-.asm_29f29
+.receive_loop
call Function83b
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
ld b, a
and $f0
cp $d0
- jr z, .asm_29f40
- ld a, [wcf52]
+ jr z, .done
+ ld a, [wOtherPlayerLinkAction]
ld b, a
and $f0
cp $d0
- jr nz, .asm_29f29
+ jr nz, .receive_loop
-.asm_29f40
+.done
xor a
ld [hVBlank], a
ld a, b
--- a/engine/mail.asm
+++ b/engine/mail.asm
@@ -398,9 +398,9 @@
ld a, [wCurMessageIndex]
ld [wMenuCursorBuffer], a
ld a, [OBPals + 8 * 6]
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld [OBPals + 8 * 6], a
ld a, [MenuSelection2]
ld [wCurMessageIndex], a
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -477,9 +477,9 @@
ld a, [wd045]
ld [wMenuCursorBuffer], a
ld a, [wd045 + 1]
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld [wd045 + 1], a
ld a, [MenuSelection2]
ld [wd045], a
@@ -658,7 +658,7 @@
dbw 0, CurMart
dba PlaceMenuItemName
dba .PrintBCDPrices
- dba Function244c3
+ dba UpdateItemDescription
; 15e30
.PrintBCDPrices: ; 15e30
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -1,7 +1,7 @@
Pack: ; 10000
ld hl, Options
- set 4, [hl]
+ set NO_TEXT_SCROLL, [hl]
call Function1068a
.loop
call JoyTextDelay
@@ -14,9 +14,9 @@
.done
ld a, [wcf65]
- ld [wd0d6], a
+ ld [wLastPocket], a
ld hl, Options
- res 4, [hl]
+ res NO_TEXT_SCROLL, [hl]
ret
; 10026
@@ -65,11 +65,11 @@
call CopyMenuDataHeader
ld a, [wItemsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0df]
- ld [wd0e4], a
+ ld a, [wItemsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0df], a
+ ld a, [wMenuScrollPosition]
+ ld [wItemsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wItemsPocketCursor], a
ld b, $7
@@ -93,11 +93,11 @@
call CopyMenuDataHeader
ld a, [wKeyItemsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0e0]
- ld [wd0e4], a
+ ld a, [wKeyItemsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0e0], a
+ ld a, [wMenuScrollPosition]
+ ld [wKeyItemsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wKeyItemsPocketCursor], a
ld b, $3
@@ -164,7 +164,7 @@
Jumptable_10137: ; 10137
dw Function10159
- dw Function10492_ret
+ dw QuitItemSubmenu
; 1013b
MenuDataHeader_0x1013b: ; 0x1013b
@@ -185,8 +185,8 @@
Jumptable_10153: ; 10153
dw Function10159
- dw Function103fd
- dw Function10492_ret
+ dw GiveItem
+ dw QuitItemSubmenu
; 10159
Function10159: ; 10159
@@ -223,11 +223,11 @@
call CopyMenuDataHeader
ld a, [wBallsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0e1]
- ld [wd0e4], a
+ ld a, [wBallsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0e1], a
+ ld a, [wMenuScrollPosition]
+ ld [wBallsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wBallsPocketCursor], a
ld b, $1
@@ -267,32 +267,32 @@
jr .tossable_unselectable
.usable
- ld hl, MenuDataHeader_0x10249
+ ld hl, MenuDataHeader_UsableKeyItem
ld de, Jumptable_1026a
jr .build_menu
.selectable_usable
- ld hl, MenuDataHeader_0x10274
+ ld hl, MenuDataHeader_UsableItem
ld de, Jumptable_10291
jr .build_menu
.tossable_selectable
- ld hl, MenuDataHeader_0x10299
+ ld hl, MenuDataHeader_UnusableItem
ld de, Jumptable_102ac
jr .build_menu
.tossable_unselectable
- ld hl, MenuDataHeader_0x102b0
+ ld hl, MenuDataHeader_UnusableKeyItem
ld de, Jumptable_102c7
jr .build_menu
.unusable
- ld hl, MenuDataHeader_0x102cd
+ ld hl, MenuDataHeader_HoldableKeyItem
ld de, Jumptable_102ea
jr .build_menu
.selectable_unusable
- ld hl, MenuDataHeader_0x102f2
+ ld hl, MenuDataHeader_HoldableItem
ld de, Jumptable_1030b
.build_menu
push de
@@ -307,15 +307,15 @@
jp [hl]
; 10249 (4:4249)
-MenuDataHeader_0x10249: ; 0x10249
+MenuDataHeader_UsableKeyItem: ; 0x10249
db $40 ; flags
db 01, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10251
+ dw .MenuData2
db 1 ; default option
; 0x10251
-MenuData2_0x10251: ; 0x10251
+.MenuData2: ; 0x10251
db $c0 ; flags
db 5 ; items
db "USE@"
@@ -326,22 +326,22 @@
; 0x1026a
Jumptable_1026a: ; 1026a
- dw Function10311
- dw Function103fd
- dw Function10364
- dw Function103c2
- dw Function10492_ret
+ dw UseItem
+ dw GiveItem
+ dw TossMenu
+ dw RegisterItem
+ dw QuitItemSubmenu
; 10274
-MenuDataHeader_0x10274: ; 0x10274
+MenuDataHeader_UsableItem: ; 0x10274
db $40 ; flags
db 03, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x1027c
+ dw .MenuData2
db 1 ; default option
; 0x1027c
-MenuData2_0x1027c: ; 0x1027c
+.MenuData2: ; 0x1027c
db $c0 ; flags
db 4 ; items
db "USE@"
@@ -351,21 +351,21 @@
; 0x10291
Jumptable_10291: ; 10291
- dw Function10311
- dw Function103fd
- dw Function10364
- dw Function10492_ret
+ dw UseItem
+ dw GiveItem
+ dw TossMenu
+ dw QuitItemSubmenu
; 10299
-MenuDataHeader_0x10299: ; 0x10299
+MenuDataHeader_UnusableItem: ; 0x10299
db %01000000 ; flags
db 07, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x102a1
+ dw .MenuData2
db 1 ; default option
; 0x102a1
-MenuData2_0x102a1: ; 0x102a1
+.MenuData2: ; 0x102a1
db $c0 ; flags
db 2 ; items
db "USE@"
@@ -373,19 +373,19 @@
; 0x102ac
Jumptable_102ac: ; 102ac
- dw Function10311
- dw Function10492_ret
+ dw UseItem
+ dw QuitItemSubmenu
; 102b0
-MenuDataHeader_0x102b0: ; 0x102b0
+MenuDataHeader_UnusableKeyItem: ; 0x102b0
db %01000000 ; flags
db 05, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x102b8
+ dw .MenuData2
db 1 ; default option
; 0x102b8
-MenuData2_0x102b8: ; 0x102b8
+.MenuData2: ; 0x102b8
db $c0 ; flags
db 3 ; items
db "USE@"
@@ -394,20 +394,20 @@
; 0x102c7
Jumptable_102c7: ; 102c7
- dw Function10311
- dw Function103c2
- dw Function10492_ret
+ dw UseItem
+ dw RegisterItem
+ dw QuitItemSubmenu
; 102cd
-MenuDataHeader_0x102cd: ; 0x102cd
+MenuDataHeader_HoldableKeyItem: ; 0x102cd
db $40 ; flags
db 03, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x102d5
+ dw .MenuData2
db 1 ; default option
; 0x102d5
-MenuData2_0x102d5: ; 0x102d5
+.MenuData2: ; 0x102d5
db $c0 ; flags
db 4 ; items
db "GIVE@"
@@ -417,21 +417,21 @@
; 0x102ea
Jumptable_102ea: ; 102ea
- dw Function103fd
- dw Function10364
- dw Function103c2
- dw Function10492_ret
+ dw GiveItem
+ dw TossMenu
+ dw RegisterItem
+ dw QuitItemSubmenu
; 102f2
-MenuDataHeader_0x102f2: ; 0x102f2
+MenuDataHeader_HoldableItem: ; 0x102f2
db $40 ; flags
db 05, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x102fa
+ dw .MenuData2
db 1 ; default option
; 0x102fa
-MenuData2_0x102fa: ; 0x102fa
+.MenuData2: ; 0x102fa
db $c0 ; flags
db 3 ; items
db "GIVE@"
@@ -440,12 +440,12 @@
; 0x1030b
Jumptable_1030b: ; 1030b
- dw Function103fd
- dw Function10364
- dw Function10492_ret
+ dw GiveItem
+ dw TossMenu
+ dw QuitItemSubmenu
; 10311
-Function10311: ; 10311
+UseItem: ; 10311
callba CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .jumptable
@@ -464,7 +464,7 @@
; 1035c
.Oak: ; 1032d (4:432d)
- ld hl, UnknownText_0x10af3
+ ld hl, Text_ThisIsntTheTime
call Function10889
ret
@@ -498,30 +498,30 @@
ret
; 10364 (4:4364)
-Function10364: ; 10364
- ld hl, UnknownText_0x10ae4
+TossMenu: ; 10364
+ ld hl, Text_ThrowAwayHowMany
call Function10889
callba Function24fbf
push af
call ExitMenu
pop af
- jr c, .asm_1039c
- call Function10a1d
- ld hl, UnknownText_0x10ae9
+ jr c, .finish
+ call Pack_GetItemName
+ ld hl, Text_ConfirmThrowAway
call MenuTextBox
call YesNoBox
push af
call ExitMenu
pop af
- jr c, .asm_1039c
+ jr c, .finish
ld hl, NumItems
- ld a, [wd107]
+ ld a, [ItemCountBuffer]
call TossItem
- call Function10a1d
- ld hl, UnknownText_0x10aee
+ call Pack_GetItemName
+ ld hl, Text_ThrewAway
call Function10889
-.asm_1039c
+.finish
ret
; 1039d
@@ -538,23 +538,23 @@
.asm_103aa
xor a
ld [wBallsPocketCursor], a
- ld [wd0e1], a
+ ld [wBallsPocketScrollPosition], a
ret
.asm_103b2
xor a
ld [wItemsPocketCursor], a
- ld [wd0df], a
+ ld [wItemsPocketScrollPosition], a
ret
.asm_103ba
xor a
ld [wKeyItemsPocketCursor], a
- ld [wd0e0], a
+ ld [wKeyItemsPocketScrollPosition], a
ret
; 103c2
-Function103c2: ; 103c2
+RegisterItem: ; 103c2
callba CheckSelectableItem
ld a, [wItemAttributeParamBuffer]
and a
@@ -564,7 +564,7 @@
rrca
and $c0
ld b, a
- ld a, [wd107]
+ ld a, [ItemCountBuffer]
inc a
and $3f
or b
@@ -571,20 +571,20 @@
ld [WhichRegisteredItem], a
ld a, [CurItem]
ld [RegisteredItem], a
- call Function10a1d
+ call Pack_GetItemName
ld de, SFX_FULL_HEAL
call WaitPlaySFX
- ld hl, UnknownText_0x10afd
+ ld hl, Text_RegisteredItem
call Function10889
ret
.asm_103f6
- ld hl, UnknownText_0x10b02
+ ld hl, Text_CantRegister
call Function10889
ret
; 103fd
-Function103fd: ; 103fd
+GiveItem: ; 103fd
ld a, [PartyCount]
and a
jp z, Function10486
@@ -652,7 +652,7 @@
db "@"
; 0x10492
-Function10492_ret: ; 10492
+QuitItemSubmenu: ; 10492
ret
; 10493
@@ -661,18 +661,18 @@
ld hl, Options
set 4, [hl]
call Function1068a
-.asm_1049b
+.loop
call JoyTextDelay
ld a, [wJumptableIndex]
bit 7, a
- jr nz, .asm_104ad
+ jr nz, .end
call Function104b9
call DelayFrame
- jr .asm_1049b
+ jr .loop
-.asm_104ad
+.end
ld a, [wcf65]
- ld [wd0d6], a
+ ld [wLastPocket], a
ld hl, Options
res 4, [hl]
ret
@@ -723,11 +723,11 @@
call CopyMenuDataHeader
ld a, [wItemsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0df]
- ld [wd0e4], a
+ ld a, [wItemsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0df], a
+ ld a, [wMenuScrollPosition]
+ ld [wItemsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wItemsPocketCursor], a
ld b, $7
@@ -751,11 +751,11 @@
call CopyMenuDataHeader
ld a, [wKeyItemsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0e0]
- ld [wd0e4], a
+ ld a, [wKeyItemsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0e0], a
+ ld a, [wMenuScrollPosition]
+ ld [wKeyItemsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wKeyItemsPocketCursor], a
ld b, $3
@@ -773,7 +773,7 @@
xor a
ld [hBGMapMode], a
call WaitBGMap_DrawPackGFX
- ld hl, UnknownText_0x10b0c
+ ld hl, Text_PackEmptyString
call Function10889
call Function10866
ret
@@ -802,11 +802,11 @@
call CopyMenuDataHeader
ld a, [wBallsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0e1]
- ld [wd0e4], a
+ ld a, [wBallsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0e1], a
+ ld a, [wMenuScrollPosition]
+ ld [wBallsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wBallsPocketCursor], a
ld b, $1
@@ -898,7 +898,7 @@
.Oak: ; 10645 (4:4645)
- ld hl, UnknownText_0x10af3
+ ld hl, Text_ThisIsntTheTime
call Function10889
ret
@@ -951,7 +951,7 @@
Function1068a: ; 1068a
xor a
ld [wJumptableIndex], a
- ld a, [wd0d6]
+ ld a, [wLastPocket]
and $3
ld [wcf65], a
inc a
@@ -1008,33 +1008,33 @@
call CopyMenuDataHeader
ld a, [wItemsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0df]
- ld [wd0e4], a
+ ld a, [wItemsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0df], a
+ ld a, [wMenuScrollPosition]
+ ld [wItemsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wItemsPocketCursor], a
ret
.KeyItemsPocket: ; 106ff (4:46ff)
- ld a, $2
+ ld a, 2
call InitPocket
ld hl, MenuDataHeader_0x10a97
call CopyMenuDataHeader
ld a, [wKeyItemsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0e0]
- ld [wd0e4], a
+ ld a, [wKeyItemsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0e0], a
+ ld a, [wMenuScrollPosition]
+ ld [wKeyItemsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wKeyItemsPocketCursor], a
ret
.TMHMPocket: ; 10726 (4:4726)
- ld a, $3
+ ld a, 3
call InitPocket
call WaitBGMap_DrawPackGFX
callba Function2c76f
@@ -1043,17 +1043,17 @@
ret
.BallsPocket: ; 1073b (4:473b)
- ld a, $1
+ ld a, 1
call InitPocket
ld hl, MenuDataHeader_0x10ac7
call CopyMenuDataHeader
ld a, [wBallsPocketCursor]
ld [wMenuCursorBuffer], a
- ld a, [wd0e1]
- ld [wd0e4], a
+ ld a, [wBallsPocketScrollPosition]
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
- ld [wd0e1], a
+ ld a, [wMenuScrollPosition]
+ ld [wBallsPocketScrollPosition], a
ld a, [MenuSelection2]
ld [wBallsPocketCursor], a
ret
@@ -1120,17 +1120,17 @@
ret
; 107bb
-Function107bb: ; 107bb
+TutorialPack: ; 107bb
call Function106a5
ld a, [InputType]
or a
- jr z, .asm_107ca
+ jr z, .loop
callba _DudeAutoInput_RightA
-.asm_107ca
+.loop
call Function107d7
call Function1076f
- jr c, .asm_107ca
+ jr c, .loop
xor a
ld [wcf66], a
ret
@@ -1138,13 +1138,13 @@
Function107d7: ; 107d7
ld a, [wJumptableIndex]
- ld hl, Jumptable_107e1
+ ld hl, .jumptable
call Function1086b
jp [hl]
; 107e1
-Jumptable_107e1: ; 107e1 (4:47e1)
+.jumptable: ; 107e1 (4:47e1)
dw Function107e9
dw Function1083b
dw Function10807
@@ -1161,11 +1161,11 @@
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x107f7
+ dw .MenuData2
db 1 ; default option
; 0x107f7
-MenuData2_0x107f7: ; 0x107f7
+.MenuData2: ; 0x107f7
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1172,11 +1172,11 @@
dbw 0, OTPartyMons
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10807
Function10807: ; 10807 (4:4807)
- ld a, $2
+ ld a, 2
ld hl, MenuDataHeader_0x1080e
jr Function1085a
; 1080e (4:480e)
@@ -1185,11 +1185,11 @@
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10816
+ dw .MenuData2
db 1 ; default option
; 0x10816
-MenuData2_0x10816: ; 0x10816
+.MenuData2: ; 0x10816
db $ae ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -1196,11 +1196,11 @@
dbw 0, OTPartyMon1Exp + 2
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10826
Function10826: ; 10826 (4:4826)
- ld a, $3
+ ld a, 3
call InitPocket
call WaitBGMap_DrawPackGFX
callba Function2c76f
@@ -1209,7 +1209,7 @@
ret
Function1083b: ; 1083b (4:483b)
- ld a, $1
+ ld a, 1
ld hl, MenuDataHeader_0x10842
jr Function1085a
; 10842 (4:4842)
@@ -1218,11 +1218,11 @@
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x1084a
+ dw .MenuData2
db 1 ; default option
; 0x1084a
-MenuData2_0x1084a: ; 0x1084a
+.MenuData2: ; 0x1084a
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1229,7 +1229,7 @@
dbw 0, OTPartyMon1CaughtGender
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 1085a
Function1085a: ; 1085a (4:485a)
@@ -1374,7 +1374,7 @@
ret
.asm_10923
callba Function2490c
- ld hl, UnknownText_0x10b07
+ ld hl, Text_MoveItemWhere
call Function10889
scf
ret
@@ -1410,13 +1410,19 @@
ld bc, $60 tiles
ld a, BANK(PackMenuGFX)
call FarCopyBytes
+
+; Background (blue if male, pink if female)
hlcoord 0, 1
ld bc, 11 * SCREEN_WIDTH
ld a, $24
call ByteFill
+
+; This is where the items themselves will be listed.
hlcoord 5, 1
lb bc, 11, 15
call ClearBox
+
+; ◀▶ POCKET ▼▲ ITEMS
hlcoord 0, 0
ld a, $28
ld c, SCREEN_WIDTH
@@ -1425,10 +1431,13 @@
inc a
dec c
jr nz, .loop
+
call DrawPocketName
- call Function109a5
- hlcoord 0, 12
- lb bc, 4, 18
+ call PlacePackGFX
+
+; Place the textbox for displaying the item description
+ hlcoord 0, SCREEN_HEIGHT - 4 - 2
+ lb bc, 4, SCREEN_WIDTH - 2
call TextBox
call EnableLCD
call DrawPackGFX
@@ -1435,21 +1444,21 @@
ret
; 109a5
-Function109a5: ; 109a5
+PlacePackGFX: ; 109a5
hlcoord 0, 3
ld a, $50
- ld de, 15
+ ld de, SCREEN_WIDTH - 5
ld b, 3
-.asm_109af
+.row
ld c, 5
-.asm_109b1
+.column
ld [hli], a
inc a
dec c
- jr nz, .asm_109b1
+ jr nz, .column
add hl, de
dec b
- jr nz, .asm_109af
+ jr nz, .row
ret
; 109bb
@@ -1487,21 +1496,33 @@
; 109e1
.tilemap: ; 109e1
- db $00, $04, $04, $04, $01, $06, $07, $08, $09, $0a, $02, $05, $05, $05, $03
- db $00, $04, $04, $04, $01, $15, $16, $17, $18, $19, $02, $05, $05, $05, $03
- db $00, $04, $04, $04, $01, $0b, $0c, $0d, $0e, $0f, $02, $05, $05, $05, $03
- db $00, $04, $04, $04, $01, $10, $11, $12, $13, $14, $02, $05, $05, $05, $03
+ db $00, $04, $04, $04, $01 ; top border
+ db $06, $07, $08, $09, $0a ; Items
+ db $02, $05, $05, $05, $03 ; bottom border
+
+ db $00, $04, $04, $04, $01 ; top border
+ db $15, $16, $17, $18, $19 ; Balls
+ db $02, $05, $05, $05, $03 ; bottom border
+
+ db $00, $04, $04, $04, $01 ; top border
+ db $0b, $0c, $0d, $0e, $0f ; Key Items
+ db $02, $05, $05, $05, $03 ; bottom border
+
+ db $00, $04, $04, $04, $01 ; top border
+ db $10, $11, $12, $13, $14 ; TM/HM
+ db $02, $05, $05, $05, $03 ; bottom border
; 10a1d
-Function10a1d: ; 10a1d
+Pack_GetItemName: ; 10a1d
ld a, [CurItem]
- ld [wd265], a
+ ld [wNamedObjectIndexBuffer], a
call GetItemName
call CopyName1
ret
; 10a2a
-Function10a2a: ; 10a2a
+Pack_ClearTilemap: ; 10a2a
+; unreferenced
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, " "
@@ -1540,7 +1561,7 @@
dbw 0, NumItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10a67
MenuDataHeader_0x10a67: ; 0x10a67
@@ -1558,7 +1579,7 @@
dbw 0, NumItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10a7f
MenuDataHeader_0x10a7f: ; 0x10a7f
@@ -1576,7 +1597,7 @@
dbw 0, NumKeyItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10a97
MenuDataHeader_0x10a97: ; 0x10a97
@@ -1594,7 +1615,7 @@
dbw 0, NumKeyItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10aaf
MenuDataHeader_0x10aaf: ; 0x10aaf
@@ -1612,7 +1633,7 @@
dbw 0, NumBalls
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10ac7
MenuDataHeader_0x10ac7: ; 0x10ac7
@@ -1630,34 +1651,34 @@
dbw 0, NumBalls
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
; 10adf
-UnknownText_0x10adf: ; 0x10adf
+Text_PackNoItems: ; 0x10adf
; No items.
text_jump UnknownText_0x1c0b9a
db "@"
; 0x10ae4
-UnknownText_0x10ae4: ; 0x10ae4
+Text_ThrowAwayHowMany: ; 0x10ae4
; Throw away how many?
text_jump UnknownText_0x1c0ba5
db "@"
; 0x10ae9
-UnknownText_0x10ae9: ; 0x10ae9
+Text_ConfirmThrowAway: ; 0x10ae9
; Throw away @ @ (S)?
text_jump UnknownText_0x1c0bbb
db "@"
; 0x10aee
-UnknownText_0x10aee: ; 0x10aee
+Text_ThrewAway: ; 0x10aee
; Threw away @ (S).
text_jump UnknownText_0x1c0bd8
db "@"
; 0x10af3
-UnknownText_0x10af3: ; 0x10af3
+Text_ThisIsntTheTime: ; 0x10af3
; OAK: ! This isn't the time to use that!
text_jump UnknownText_0x1c0bee
db "@"
@@ -1669,25 +1690,25 @@
db "@"
; 0x10afd
-UnknownText_0x10afd: ; 0x10afd
+Text_RegisteredItem: ; 0x10afd
; Registered the @ .
text_jump UnknownText_0x1c0c2e
db "@"
; 0x10b02
-UnknownText_0x10b02: ; 0x10b02
+Text_CantRegister: ; 0x10b02
; You can't register that item.
text_jump UnknownText_0x1c0c45
db "@"
; 0x10b07
-UnknownText_0x10b07: ; 0x10b07
+Text_MoveItemWhere: ; 0x10b07
; Where should this be moved to?
text_jump UnknownText_0x1c0c63
db "@"
; 0x10b0c
-UnknownText_0x10b0c: ; 0x10b0c
+Text_PackEmptyString: ; 0x10b0c
;
text_jump UnknownText_0x1c0c83
db "@"
--- a/engine/pokecenter_pc.asm
+++ b/engine/pokecenter_pc.asm
@@ -590,9 +590,9 @@
ld a, [wd0d7]
ld [wMenuCursorBuffer], a
ld a, [wd0dd]
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld [wd0dd], a
ld a, [MenuSelection2]
ld [wd0d7], a
@@ -659,7 +659,7 @@
dbw 0, PCItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
- dba Function244c3
+ dba UpdateItemDescription
PC_DisplayText: ; 15a20
call MenuTextBox
--- a/event/buena.asm
+++ b/event/buena.asm
@@ -66,7 +66,7 @@
SpecialBuenaPrize: ; 8afd4
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld a, $1
ld [MenuSelection], a
call Function8b0d6
--- a/event/elevator.asm
+++ b/event/elevator.asm
@@ -130,7 +130,7 @@
call InitScrollingMenu
call UpdateSprites
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
call HandleScrollingMenu
call WriteBackup
ld a, [wcf73]
--- a/event/kurt.asm
+++ b/event/kurt.asm
@@ -26,7 +26,7 @@
call LoadStandardMenuDataHeader
ld c, $1
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld [wKurtApricornQuantity], a
.loop
push bc
--- a/event/poke_seer.asm
+++ b/event/poke_seer.asm
@@ -1,12 +1,19 @@
-SEER_INTRO EQU 0
-SEER_CANT_TELL EQU 1
-SEER_MET_AT EQU 2
-SEER_TIME_LEVEL EQU 3
-SEER_TRADED EQU 4
-SEER_CANCEL EQU 5
-SEER_EGG EQU 6
-SEER_LEVEL_ONLY EQU 7
+ const_def
+ const SEER_INTRO
+ const SEER_CANT_TELL
+ const SEER_MET_AT
+ const SEER_TIME_LEVEL
+ const SEER_TRADED
+ const SEER_CANCEL
+ const SEER_EGG
+ const SEER_LEVEL_ONLY
+ const_def
+ const SEERACTION_MET
+ const SEERACTION_TRADED
+ const SEERACTION_CANT_TELL_1
+ const SEERACTION_CANT_TELL_2
+ const SEERACTION_LEVEL_ONLY
SpecialPokeSeer: ; 4f0bc
ld a, SEER_INTRO
@@ -44,7 +51,7 @@
SeerAction: ; 4f0ee
- ld a, [wd002]
+ ld a, [wSeerAction]
ld hl, SeerActions
rst JumpTable
ret
@@ -100,29 +107,30 @@
ld a, MON_CAUGHTDATA
call GetPartyParamLocation
ld a, [hli]
- ld [wd03b], a
+ ld [wSeerCaughtData], a
ld a, [hld]
- ld [wd03b + 1], a
+ ld [wSeerCaughtGender], a
or [hl]
- jr z, .asm_4f170
+ jr z, .error
- ld a, 1
- ld [wd002], a
+ ld a, SEERACTION_TRADED
+ ld [wSeerAction], a
ld a, MON_ID
call GetPartyParamLocation
ld a, [PlayerID]
cp [hl]
- jr nz, .asm_4f15f
+ jr nz, .traded
inc hl
ld a, [PlayerID + 1]
- jr nz, .asm_4f15f
+ ; cp [hl]
+ jr nz, .traded
- ld a, 0
- ld [wd002], a
+ ld a, SEERACTION_MET
+ ld [wSeerAction], a
-.asm_4f15f
+.traded
call GetCaughtLevel
call GetCaughtOT
call GetCaughtName
@@ -131,9 +139,9 @@
and a
ret
-.asm_4f170
- ld a, 2
- ld [wd002], a
+.error
+ ld a, SEERACTION_CANT_TELL_1
+ ld [wSeerAction], a
ret
; 4f176
@@ -142,7 +150,7 @@
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
call AddNTimes
- ld de, wd003
+ ld de, wSeerNickname
ld bc, PKMN_NAME_LENGTH
call CopyBytes
ret
@@ -150,12 +158,12 @@
GetCaughtLevel: ; 4f18c
ld a, "@"
- ld hl, wd036
+ ld hl, wSeerCaughtLevelString
ld bc, 4
call ByteFill
; caught level
- ld a, [wd03b]
+ ld a, [wSeerCaughtData]
and $3f
jr z, .unknown
cp 1 ; hatched from an egg
@@ -163,15 +171,15 @@
ld a, 5 ; egg hatch level
- ld [wd038 + 2], a
- ld hl, wd036
- ld de, wd038 + 2
+ ld [wSeerCaughtLevel], a
+ ld hl, wSeerCaughtLevelString
+ ld de, wSeerCaughtLevel
lb bc, PRINTNUM_RIGHTALIGN | 1, 3
call PrintNum
ret
.unknown
- ld de, wd036
+ ld de, wSeerCaughtLevelString
ld hl, .unknown_level
ld bc, 4
call CopyBytes
@@ -183,7 +191,7 @@
; 4f1c5
GetCaughtTime: ; 4f1c5
- ld a, [wd03b]
+ ld a, [wSeerCaughtData]
and $c0
jr z, .none
@@ -194,13 +202,13 @@
call GetNthString
ld d, h
ld e, l
- ld hl, wd01f
+ ld hl, wSeerTimeOfDay
call CopyName2
and a
ret
.none
- ld de, wd01f
+ ld de, wSeerTimeOfDay
call UnknownCaughtData
ret
; 4f1e6
@@ -213,7 +221,7 @@
UnknownCaughtData: ; 4f1f8
ld hl, .unknown
- ld bc, $000b
+ ld bc, NAME_LENGTH
call CopyBytes
ret
; 4f202
@@ -223,35 +231,35 @@
; 4f20a
GetCaughtLocation: ; 4f20a
- ld a, [wd03b + 1]
+ ld a, [wSeerCaughtGender]
and $7f
- jr z, .asm_4f22e
+ jr z, .Unknown
cp $7f
- jr z, .asm_4f234
+ jr z, .event
cp $7e
- jr z, .asm_4f23b
+ jr z, .fail
ld e, a
callba GetLandmarkName
ld hl, StringBuffer1
- ld de, wd00e
- ld bc, $0011
+ ld de, wSeerCaughtLocation
+ ld bc, 17
call CopyBytes
and a
ret
-.asm_4f22e
- ld de, wd00e
+.Unknown
+ ld de, wSeerCaughtLocation
jp UnknownCaughtData
-.asm_4f234
- ld a, $4
- ld [wd002], a
+.event
+ ld a, SEERACTION_LEVEL_ONLY
+ ld [wSeerAction], a
scf
ret
-.asm_4f23b
- ld a, $3
- ld [wd002], a
+.fail
+ ld a, SEERACTION_CANT_TELL_2
+ ld [wSeerAction], a
scf
ret
; 4f242
@@ -261,17 +269,19 @@
ld hl, PartyMonOT
ld bc, NAME_LENGTH
call AddNTimes
- ld de, wd02a
- ld bc, $000b
+ ld de, wSeerOTName
+ ld bc, NAME_LENGTH
call CopyBytes
+
+; this routine is useless in Western localizations
ld hl, .male
- ld a, [wd03b + 1]
+ ld a, [wSeerCaughtGender]
bit 7, a
- jr z, .asm_4f264
+ jr z, .got_grammar
ld hl, .female
-.asm_4f264
- ld de, wd034 + 1
+.got_grammar
+ ld de, wSeerOTNameGrammar
ld a, "@"
ld [de], a
ret
@@ -360,7 +370,7 @@
SeerAdvice: ; 4f2b4
ld a, MON_LEVEL
call GetPartyParamLocation
- ld a, [wd038 + 2]
+ ld a, [wSeerCaughtLevel]
ld c, a
ld a, [hl]
sub c
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -247,8 +247,8 @@
; 83b
Function83b:: ; 83b
- ld hl, wcf56
- ld de, wcf51
+ ld hl, wPlayerLinkAction
+ ld de, wOtherPlayerLinkMode
ld c, $2
ld a, $1
ld [hFFCC], a
@@ -274,7 +274,7 @@
Function862:: ; 862
call LoadTileMapToTempTileMap
- callab Function4000
+ callab PlaceWaitingText
call Function87d
jp Call_LoadTempTileMapToTileMap
; 871
@@ -282,102 +282,106 @@
Function871:: ; 871
call LoadTileMapToTempTileMap
- callab Function4000
+ callab PlaceWaitingText
jp Function87d
; 87d
+; One "giant" leap for machinekind
-
Function87d:: ; 87d
ld a, $ff
- ld [wcf52], a
-.asm_882
- call Function8c1
+ ld [wOtherPlayerLinkAction], a
+.loop
+ call LinkCommunicationsSendReceive
call DelayFrame
call Function82b
- jr z, .asm_89e
+ jr z, .check
push hl
ld hl, wcf5c
dec [hl]
- jr nz, .asm_89d
+ jr nz, .skip
dec hl
dec [hl]
- jr nz, .asm_89d
+ jr nz, .skip
pop hl
xor a
jp Function833
-.asm_89d
+.skip
pop hl
-.asm_89e
- ld a, [wcf52]
+.check
+ ld a, [wOtherPlayerLinkAction]
inc a
- jr z, .asm_882
- ld b, $a
-.asm_8a6
+ jr z, .loop
+
+ ld b, 10
+.receive
call DelayFrame
- call Function8c1
+ call LinkCommunicationsSendReceive
dec b
- jr nz, .asm_8a6
- ld b, $a
-.asm_8b1
+ jr nz, .receive
+
+ ld b, 10
+.acknowledge
call DelayFrame
- call Function908
+ call LinkCommunicationsSignalDataReceived
dec b
- jr nz, .asm_8b1
- ld a, [wcf52]
- ld [wcf51], a
+ jr nz, .acknowledge
+
+ ld a, [wOtherPlayerLinkAction]
+ ld [wOtherPlayerLinkMode], a
ret
; 8c1
-Function8c1:: ; 8c1
+LinkCommunicationsSendReceive:: ; 8c1
push bc
- ld b, $60
+ ld b, SERIAL_TIMECAPSULE
ld a, [wLinkMode]
- cp $1
- jr z, .asm_8d7
- ld b, $60
- jr c, .asm_8d7
- cp $2
- ld b, $70
- jr z, .asm_8d7
- ld b, $80
+ cp LINK_TIMECAPSULE
+ jr z, .got_high_nybble
+ ld b, SERIAL_TIMECAPSULE
+ jr c, .got_high_nybble
+ cp LINK_TRADECENTER
+ ld b, SERIAL_TRADECENTER
+ jr z, .got_high_nybble
+ ld b, SERIAL_BATTLE
-.asm_8d7
- call Function8f3
- ld a, [wcf56]
+.got_high_nybble
+ call .Receive
+ ld a, [wPlayerLinkAction]
add b
ld [hSerialSend], a
ld a, [hLinkPlayerNumber]
cp $2
- jr nz, .asm_8ee
+ jr nz, .player_1
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
-.asm_8ee
- call Function8f3
+.player_1
+ call .Receive
pop bc
ret
; 8f3
-Function8f3:: ; 8f3
+.Receive ; 8f3
ld a, [hSerialReceive]
- ld [wcf51], a
+ ld [wOtherPlayerLinkMode], a
and $f0
cp b
ret nz
xor a
ld [hSerialReceive], a
- ld a, [wcf51]
+ ld a, [wOtherPlayerLinkMode]
and $f
- ld [wcf52], a
+ ld [wOtherPlayerLinkAction], a
ret
; 908
-Function908:: ; 908
+LinkCommunicationsSignalDataReceived:: ; 908
+; Let the other system know that the data has been received.
xor a
ld [hSerialSend], a
ld a, [hLinkPlayerNumber]
--- a/home/text.asm
+++ b/home/text.asm
@@ -880,10 +880,10 @@
; [$03][addr]
ld a, [hli]
- ld [wd0e4 + 2], a
+ ld [wMenuScrollPosition + 2], a
ld c, a
ld a, [hli]
- ld [wd0e4 + 2 + 1], a
+ ld [wMenuScrollPosition + 2 + 1], a
ld b, a
ret
; 148b
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -4,7 +4,7 @@
call GetItemName
call CopyName1
ld a, 1
- ld [wd0ec], a
+ ld [wPlayerAction], a
ld a, [CurItem]
dec a
ld hl, ItemEffects
@@ -1209,7 +1209,7 @@
ld [wd1e9], a
callba EvolvePokemon
- ld a, [wd268]
+ ld a, [wMonTriedToEvolve]
and a
jr z, .NoEffect
@@ -1220,7 +1220,7 @@
.DecidedNotToUse
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; ee3d
@@ -1293,7 +1293,7 @@
RareCandy_StatBooster_ExitMenu: ; ee9f
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
jp ClearPalettes
; eea6
@@ -1930,7 +1930,7 @@
StatusHealer_ExitMenu: ; f29e (3:729e)
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
StatusHealer_ClearPalettes: ; f2a2 (3:72a2)
call ClearPalettes
ret
@@ -2233,10 +2233,10 @@
EscapeRope: ; f44f
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
callba EscapeRopeFunction
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
cp 1
call z, UseDisposableItem
ret
@@ -2298,7 +2298,7 @@
.asm_f4a6
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; f4ab
@@ -2547,7 +2547,7 @@
xor a
ld [CurMoveNum], a
ld a, $2
- ld [wd235], a
+ ld [wMoveSelectionMenuType], a
callba MoveSelectionScreen
pop bc
@@ -2701,7 +2701,7 @@
PPRestoreItem_Cancel: ; f6e0
call ClearPalettes
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; f6e8
@@ -2802,7 +2802,7 @@
SacredAsh: ; f753
callba _SacredAsh
- ld a, [wd0ec]
+ ld a, [wPlayerAction]
cp $1
ret nz
call UseDisposableItem
@@ -2973,7 +2973,7 @@
; Item wasn't used.
ld a, $2
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; f7d6
@@ -2988,7 +2988,7 @@
; Item wasn't used.
ld a, $2
- ld [wd0ec], a
+ ld [wPlayerAction], a
ret
; f7e8
@@ -3018,7 +3018,7 @@
CantUseItemMessage: ; f804
; Item couldn't be used.
xor a
- ld [wd0ec], a
+ ld [wPlayerAction], a
jp PrintText
; f80b
--- a/main.asm
+++ b/main.asm
@@ -4,7 +4,7 @@
SECTION "bank1", ROMX, BANK[$1]
-Function4000:: ; 4000
+PlaceWaitingText:: ; 4000
hlcoord 3, 10
ld b, 1
ld c, 11
@@ -5710,11 +5710,11 @@
ld [hl], a
ld [wItemQuantityBuffer], a
jr nz, .yup
- ld a, [wd0e2]
+ ld a, [wTMHMPocketScrollPosition]
and a
jr z, .yup
dec a
- ld [wd0e2], a
+ ld [wTMHMPocketScrollPosition], a
.yup
scf
@@ -9901,7 +9901,7 @@
; 244c3
-Function244c3: ; 0x244c3
+UpdateItemDescription: ; 0x244c3
ld a, [MenuSelection]
ld [CurSpecies], a
hlcoord 0, 12
@@ -10216,7 +10216,7 @@
ld hl, wcfa6
bit 7, [hl]
jp z, xor_a
- ld hl, wd0e4
+ ld hl, wMenuScrollPosition
ld a, [hl]
and a
jr z, .xor_dec_up
@@ -10231,7 +10231,7 @@
ld hl, wcfa6
bit 7, [hl]
jp z, xor_a
- ld hl, wd0e4
+ ld hl, wMenuScrollPosition
ld a, [wMenuData2Items]
add [hl]
ld b, a
@@ -10246,7 +10246,7 @@
; 246fc
Function246fc: ; 246fc
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld c, a
ld a, [MenuSelection2]
add c
@@ -10276,10 +10276,10 @@
ld a, [wcf95]
call GetFarByte
ld [wd144], a
-; if ([wd144] + 1) < [wMenuData2Items] + [wd0e4]: [wd0e4] = max(([wd144] + 1) - [wMenuData2Items], 0)
+; if ([wd144] + 1) < [wMenuData2Items] + [wMenuScrollPosition]: [wMenuScrollPosition] = max(([wd144] + 1) - [wMenuData2Items], 0)
ld a, [wMenuData2Items]
ld c, a
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
add c
ld c, a
ld a, [wd144]
@@ -10295,10 +10295,10 @@
xor a
.store
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
.skip
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld c, a
ld a, [wMenuCursorBuffer]
add c
@@ -10311,7 +10311,7 @@
.asm_2475a
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld a, $1
ld [wMenuCursorBuffer], a
@@ -10413,7 +10413,7 @@
ld a, [wMenuData2Flags]
bit 4, a
jr z, .asm_2480d
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
and a
jr z, .asm_2480d
ld a, [wMenuBorderTopCoord]
@@ -10431,7 +10431,7 @@
ld b, a
ld c, $0
.asm_2481a
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
add c
ld [wcf77], a
ld a, c
@@ -10508,7 +10508,7 @@
and a
jr z, .asm_248b7
ld b, a
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
cp b
jr nc, .asm_248b7
ld c, a
@@ -10558,7 +10558,7 @@
push de
push hl
ld e, a
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
add e
ld e, a
ld d, $0
@@ -13540,7 +13540,7 @@
ld a, [MenuSelection2]
dec a
ld b, a
- ld a, [wd0e2]
+ ld a, [wTMHMPocketScrollPosition]
add b
ld b, a
ld a, [wd265]
@@ -13584,7 +13584,7 @@
ld a, b
bit 7, a
jr nz, .skip
- ld hl, wd0e2
+ ld hl, wTMHMPocketScrollPosition
ld a, [hl]
and a
jp z, Function2c915
@@ -13605,7 +13605,7 @@
jr z, .loop
dec b
jr nz, .loop
- ld hl, wd0e2
+ ld hl, wTMHMPocketScrollPosition
inc [hl]
call Function2c9e2
jp Function2c946
@@ -13737,7 +13737,7 @@
Function2cab5: ; 2cab5 (b:4ab5)
ld hl, TMsHMs
- ld a, [wd0e2]
+ ld a, [wTMHMPocketScrollPosition]
ld b, a
inc b
ld c, 0
@@ -13820,11 +13820,11 @@
dec a
ld [hl], a
ret nz
- ld a, [wd0e2]
+ ld a, [wTMHMPocketScrollPosition]
and a
ret z
dec a
- ld [wd0e2], a
+ ld [wTMHMPocketScrollPosition], a
ret
Function2cb2a: ; 2cb2a (b:4b2a)
@@ -14186,7 +14186,7 @@
endr
ld [hl], a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld [CriticalHit], a
ld [BattleMonSpecies], a
ld [wBattleParticipantsNotFainted], a
--- a/maps/PokeCenter2F.asm
+++ b/maps/PokeCenter2F.asm
@@ -91,7 +91,7 @@
writetext Text_PleaseWait
special Special_CheckLinkTimeout
iffalse .LinkTimedOut
- copybytetovar wcf51
+ copybytetovar wOtherPlayerLinkMode
iffalse .LinkedToFirstGen
special Special_CheckBothSelectedSameRoom
iffalse .IncompatibleRooms
@@ -193,7 +193,7 @@
writetext Text_PleaseWait
special Special_CheckLinkTimeout
iffalse .LinkTimedOut
- copybytetovar wcf51
+ copybytetovar wOtherPlayerLinkMode
iffalse .LinkedToFirstGen
special Special_CheckBothSelectedSameRoom
iffalse .IncompatibleRooms
@@ -320,7 +320,7 @@
writetext Text_PleaseWait
special Special_CheckLinkTimeout
iffalse .LinkTimedOut
- copybytetovar wcf51
+ copybytetovar wOtherPlayerLinkMode
iffalse .OK
special Special_CheckBothSelectedSameRoom
writetext Text_IncompatibleRooms
--- a/misc/mobile_12.asm
+++ b/misc/mobile_12.asm
@@ -346,7 +346,7 @@
call Function48cdc
ld a, [wMenuCursorBuffer]
ld b, a
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld c, a
push bc
ld a, [wd474]
@@ -358,7 +358,7 @@
ld [wMenuCursorBuffer], a
ld a, $29
.asm_4833f
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
callba Function104148
.asm_48348
call HandleScrollingMenu
@@ -370,7 +370,7 @@
ld a, b
ld [wMenuCursorBuffer], a
ld a, c
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld a, d
push af
call ExitMenu
@@ -398,21 +398,21 @@
and a
jr .asm_483b7
.asm_48390
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
sub d
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
jr nc, .asm_483af
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
jr .asm_483af
.asm_4839f
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
add d
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
cp e
jr c, .asm_483af
ld a, e
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
jr .asm_483af
.asm_483af
ld hl, MenuSelection2
--- a/misc/mobile_22_2.asm
+++ b/misc/mobile_22_2.asm
@@ -805,7 +805,7 @@
ld a, [wd030]
ld [wMenuCursorBuffer], a
ld a, [wd031]
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld a, [wd032]
and a
jr z, .asm_8b7e0
@@ -856,13 +856,13 @@
ld c, a
ld a, [MenuSelection2]
ld [wd030], a
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld [wd031], a
ret
; 8b832
Function8b832: ; 8b832
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld hl, wMenuData2Items
sub [hl]
jr nc, Function8b84b
@@ -871,7 +871,7 @@
; 8b83e
Function8b83e: ; 8b83e
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
ld hl, wMenuData2Items
add [hl]
cp $24
@@ -879,7 +879,7 @@
ld a, $24
Function8b84b: ; 8b84b
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld a, [MenuSelection2]
ld [wMenuCursorBuffer], a
ret
@@ -994,7 +994,7 @@
hlcoord 19, 13
ld a, $11
ld [hl], a
- ld a, [wd0e4]
+ ld a, [wMenuScrollPosition]
cp $24
ret c
hlcoord 0, 13
@@ -1018,7 +1018,7 @@
Function8b94a: ; 8b94a
ld [wd033], a
xor a
- ld [wd0e4], a
+ ld [wMenuScrollPosition], a
ld [wd032], a
ld [wd0e3], a
ld [wd031], a
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -171,6 +171,7 @@
ld [hFFC9], a
ld [hMobile], a
ei
+
ld a, [wLinkMode]
push af
xor a
@@ -1620,49 +1621,49 @@
ret
; 100a09
-Function100a09: ; 100a09
- call Function100a2e
+_LinkBattleSendReceiveAction: ; 100a09
+ call .StageForSend
ld [wd431], a
- callba Function4000
+ callba PlaceWaitingText
ld a, [wLinkMode]
cp LINK_MOBILE
- jr nz, .asm_100a2a
+ jr nz, .not_mobile
call Function100a87
call Function100da5
callba FinishBattleAnim
- jr .asm_100a2d
+ jr .done
-.asm_100a2a
+.not_mobile
call Function100a53
-.asm_100a2d
+.done
ret
; 100a2e
-Function100a2e: ; 100a2e
- ld a, [wd0ec]
+.StageForSend: ; 100a2e
+ ld a, [wPlayerAction]
and a
- jr nz, .asm_100a48
+ jr nz, .switch
ld a, [CurPlayerMove]
- ld b, $e
+ ld b, BATTLEACTION_E
cp STRUGGLE
- jr z, .asm_100a4f
- ld b, $d
+ jr z, .struggle
+ ld b, BATTLEACTION_D
cp $ff
- jr z, .asm_100a4f
+ jr z, .struggle
ld a, [CurMoveNum]
- jr .asm_100a50
+ jr .use_move
-.asm_100a48
+.switch
ld a, [CurPartyMon]
- add $4
- jr .asm_100a50
+ add BATTLEACTION_SWITCH1
+ jr .use_move
-.asm_100a4f
+.struggle
ld a, b
-.asm_100a50
+.use_move
and $f
ret
; 100a53
@@ -1669,29 +1670,32 @@
Function100a53: ; 100a53
ld a, [wd431]
- ld [wcf56], a
+ ld [wPlayerLinkAction], a
ld a, $ff
- ld [wcf52], a
-.asm_100a5e
- call Function8c1
+ ld [wOtherPlayerLinkAction], a
+.waiting
+ call LinkCommunicationsSendReceive
call DelayFrame
- ld a, [wcf52]
+ ld a, [wOtherPlayerLinkAction]
inc a
- jr z, .asm_100a5e
- ld b, $a
-.asm_100a6c
+ jr z, .waiting
+
+ ld b, 10
+.receive
call DelayFrame
- call Function8c1
+ call LinkCommunicationsSendReceive
dec b
- jr nz, .asm_100a6c
- ld b, $a
-.asm_100a77
+ jr nz, .receive
+
+ ld b, 10
+.acknowledge
call DelayFrame
- call Function908
+ call LinkCommunicationsSignalDataReceived
dec b
- jr nz, .asm_100a77
- ld a, [wcf52]
- ld [wd430], a
+ jr nz, .acknowledge
+
+ ld a, [wOtherPlayerLinkAction]
+ ld [wBattleAction], a
ret
; 100a87
@@ -1850,10 +1854,10 @@
ret
; 100b9f
-Function100b9f: ; 100b9f
+MobileMoveSelectionScreen: ; 100b9f
xor a
ld [wd0e3], a
- callba Function3e786
+ callba CheckPlayerHasUsableMoves
ret z
call Function100dd8
jp c, xor_a_dec_a
@@ -2148,7 +2152,7 @@
Function100dc0: ; 100dc0
ld a, [wLinkMode]
- cp $4
+ cp LINK_MOBILE
jr nz, .asm_100dd0
ld hl, wcd2a
bit 3, [hl]
@@ -2794,16 +2798,16 @@
res 4, [hl]
ld hl, GameTimerPause
bit 7, [hl]
- jr z, .asm_101210
+ jr z, .skip
ld hl, wdc41
set 4, [hl]
-.asm_101210
+.skip
call Function10209c
xor a
ld [wdc5f], a
ld [wdc60], a
- ld a, $4
+ ld a, LINK_MOBILE
ld [wLinkMode], a
ret
; 101220
@@ -7958,16 +7962,16 @@
ld c, $0
ld hl, SwarmFlags
bit 4, [hl]
- jr nz, .asm_10379c
+ jr nz, .already_set
ld c, $1
ld hl, SwarmFlags
set 4, [hl]
-.asm_10379c
+.already_set
push bc
callba Link_SaveGame
pop bc
- jr c, .asm_1037b5
+ jr c, .failed_to_save
ld a, $1
ld [ScriptVar], a
ld a, c
@@ -7976,7 +7980,7 @@
callba Function1006fd
ret
-.asm_1037b5
+.failed_to_save
xor a
ld [ScriptVar], a
ld a, c
@@ -7989,19 +7993,19 @@
Function1037c2: ; 1037c2
call Function103823
- jr c, .asm_1037de
+ jr c, .nope
ld a, [wdc5f]
and a
- jr z, .asm_1037de
+ jr z, .nope
ld hl, UnknownText_0x1037e6
call PrintText
call YesNoBox
- jr c, .asm_1037de
+ jr c, .nope
ld a, $1
ld [ScriptVar], a
ret
-.asm_1037de
+.nope
xor a
ld [wdc5f], a
ld [ScriptVar], a
--- a/wram.asm
+++ b/wram.asm
@@ -1298,9 +1298,10 @@
wcf42:: ds 2
wcf44:: ds 1
wcf45:: ds 12
-wcf51:: ds 1
-wcf52:: ds 4
-wcf56:: ds 1
+; addresses dealing with serial comms
+wOtherPlayerLinkMode:: ds 1
+wOtherPlayerLinkAction:: ds 4
+wPlayerLinkAction:: ds 1
wcf57:: ds 4
wcf5b:: ds 1
wcf5c:: ds 1
@@ -1509,6 +1510,18 @@
wTempMail:: mailmsg wTempMail
ds wTempMail - @
+wSeerAction:: ds 1
+wSeerNickname:: ds PKMN_NAME_LENGTH
+wSeerCaughtLocation:: ds 17
+wSeerTimeOfDay:: ds NAME_LENGTH
+wSeerOTName:: ds NAME_LENGTH
+wSeerOTNameGrammar:: ds 1
+wSeerCaughtLevelString:: ds 4
+wSeerCaughtLevel:: ds 1
+wSeerCaughtData:: ds 1
+wSeerCaughtGender:: ds 1
+ ds wSeerAction - @
+
wd002::
PhoneScriptBank::
LuckyNumberDigit1Buffer::
@@ -1683,7 +1696,7 @@
CurMoveNum:: ; d0d5
ds 1
-wd0d6:: ds 1
+wLastPocket:: ds 1
wd0d7:: ds 1
wPartyMenuCursor::
wd0d8:: ds 1
@@ -1692,18 +1705,22 @@
wBallsPocketCursor:: ds 1
wTMHMPocketCursor:: ds 1
wd0dd:: ds 2
-wd0df:: ds 1
-wd0e0:: ds 1
-wd0e1:: ds 1
-wd0e2:: ds 1
+wItemsPocketScrollPosition:: ds 1
+wKeyItemsPocketScrollPosition:: ds 1
+wBallsPocketScrollPosition:: ds 1
+wTMHMPocketScrollPosition:: ds 1
wMoveSwapBuffer::
wSwitchMon::
wd0e3:: ds 1
-wd0e4:: ds 4
+wMenuScrollPosition:: ds 4
wQueuedScriptBank:: ds 1
wQueuedScriptAddr:: ds 2
wd0eb:: ds 1
wFieldMoveSucceeded::
+wPlayerAction::
+; 0 - use move
+; 1 - use item
+; 2 - switch
wd0ec:: ds 1
VramState:: ; d0ed
@@ -2034,7 +2051,7 @@
UnownLetter:: ; d234
ds 1
-wd235:: ds 1
+wMoveSelectionMenuType:: ds 1
CurBaseData:: ; d236
BaseDexNo:: ; d236
@@ -2098,9 +2115,9 @@
wCurTMHM::
wTypeMatchup::
wd265:: ds 1
-wd266:: ds 1
-wd267:: ds 1
-wd268:: ds 1
+wFailedToFlee:: ds 1
+wNumFleeAttempts:: ds 1
+wMonTriedToEvolve:: ds 1
TimeOfDay:: ; d269
ds 1