ref: acd92eee94f0c8a7e0757ce2a1f486f08a4a9ad7
parent: ecd277204a1e32e923702a57a6212579635a9b4c
author: PikalaxALT <[email protected]>
date: Sun Dec 13 09:15:16 EST 2015
Pack
--- a/audio/sfx.asm
+++ b/audio/sfx.asm
@@ -206,8 +206,8 @@
musicheader 1, 8, Sfx_Unknown61_Ch8
; f0a22
-Sfx_Unknown62: ; f0a22
- musicheader 1, 8, Sfx_Unknown62_Ch8
+Sfx_SwitchPockets: ; f0a22
+ musicheader 1, 8, Sfx_SwitchPockets_Ch8
; f0a25
Sfx_Unknown63: ; f0a25
@@ -5226,7 +5226,7 @@
endchannel
; f258c
-Sfx_Unknown62_Ch8: ; f258c
+Sfx_SwitchPockets_Ch8: ; f258c
noise __, 5, $c1, $42
endchannel
; f2590
--- a/audio/sfx_pointers.asm
+++ b/audio/sfx_pointers.asm
@@ -97,7 +97,7 @@
dba Sfx_Unknown5F
dba Sfx_Unknown60
dba Sfx_Unknown61
- dba Sfx_Unknown62
+ dba Sfx_SwitchPockets
dba Sfx_Unknown63
dba Sfx_Burn
dba Sfx_TitleScreenEntrance
--- /dev/null
+++ b/battle/ai/redundant.asm
@@ -1,0 +1,198 @@
+AI_Redundant: ; 2c41a
+; Check if move effect c will fail because it's already been used.
+; Return z if the move is a good choice.
+; Return nz if the move is a bad choice.
+ ld a, c
+ ld de, 3
+ ld hl, .Moves
+ call IsInArray
+ jp nc, .NotRedundant
+ inc hl
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+.Moves: ; 2c42c
+ dbw EFFECT_DREAM_EATER, .DreamEater
+ dbw EFFECT_HEAL, .Heal
+ dbw EFFECT_LIGHT_SCREEN, .LightScreen
+ dbw EFFECT_MIST, .Mist
+ dbw EFFECT_FOCUS_ENERGY, .FocusEnergy
+ dbw EFFECT_CONFUSE, .Confuse
+ dbw EFFECT_TRANSFORM, .Transform
+ dbw EFFECT_REFLECT, .Reflect
+ dbw EFFECT_SUBSTITUTE, .Substitute
+ dbw EFFECT_LEECH_SEED, .LeechSeed
+ dbw EFFECT_DISABLE, .Disable
+ dbw EFFECT_ENCORE, .Encore
+ dbw EFFECT_SNORE, .Snore
+ dbw EFFECT_SLEEP_TALK, .SleepTalk
+ dbw EFFECT_MEAN_LOOK, .MeanLook
+ dbw EFFECT_NIGHTMARE, .Nightmare
+ dbw EFFECT_SPIKES, .Spikes
+ dbw EFFECT_FORESIGHT, .Foresight
+ dbw EFFECT_PERISH_SONG, .PerishSong
+ dbw EFFECT_SANDSTORM, .Sandstorm
+ dbw EFFECT_ATTRACT, .Attract
+ dbw EFFECT_SAFEGUARD, .Safeguard
+ dbw EFFECT_RAIN_DANCE, .RainDance
+ dbw EFFECT_SUNNY_DAY, .SunnyDay
+ dbw EFFECT_TELEPORT, .Teleport
+ dbw EFFECT_MORNING_SUN, .MorningSun
+ dbw EFFECT_SYNTHESIS, .Synthesis
+ dbw EFFECT_MOONLIGHT, .Moonlight
+ dbw EFFECT_SWAGGER, .Swagger
+ dbw EFFECT_FUTURE_SIGHT, .FutureSight
+ db -1
+
+.LightScreen: ; 2c487
+ ld a, [EnemyScreens]
+ bit SCREENS_LIGHT_SCREEN, a
+ ret
+
+.Mist: ; 2c48d
+ ld a, [EnemySubStatus4]
+ bit SUBSTATUS_MIST, a
+ ret
+
+.FocusEnergy: ; 2c493
+ ld a, [EnemySubStatus4]
+ bit SUBSTATUS_FOCUS_ENERGY, a
+ ret
+
+.Confuse: ; 2c499
+ ld a, [PlayerSubStatus3]
+ bit SUBSTATUS_CONFUSED, a
+ ret nz
+ ld a, [PlayerScreens]
+ bit SCREENS_SAFEGUARD, a
+ ret
+
+.Transform: ; 2c4a5
+ ld a, [EnemySubStatus5]
+ bit SUBSTATUS_TRANSFORMED, a
+ ret
+
+.Reflect: ; 2c4ab
+ ld a, [EnemyScreens]
+ bit SCREENS_REFLECT, a
+ ret
+
+.Substitute: ; 2c4b1
+ ld a, [EnemySubStatus4]
+ bit SUBSTATUS_SUBSTITUTE, a
+ ret
+
+.LeechSeed: ; 2c4b7
+ ld a, [PlayerSubStatus4]
+ bit SUBSTATUS_LEECH_SEED, a
+ ret
+
+.Disable: ; 2c4bd
+ ld a, [PlayerDisableCount]
+ and a
+ ret
+
+.Encore: ; 2c4c2
+ ld a, [PlayerSubStatus5]
+ bit SUBSTATUS_ENCORED, a
+ ret
+
+.Snore:
+.SleepTalk: ; 2c4c8
+ ld a, [EnemyMonStatus]
+ and SLP
+ jr z, .Redundant
+ jr .NotRedundant
+
+.MeanLook: ; 2c4d1
+ ld a, [EnemySubStatus5]
+ bit SUBSTATUS_CANT_RUN, a
+ ret
+
+.Nightmare: ; 2c4d7
+ ld a, [BattleMonStatus]
+ and a
+ jr z, .Redundant
+ ld a, [PlayerSubStatus1]
+ bit SUBSTATUS_NIGHTMARE, a
+ ret
+
+.Spikes: ; 2c4e3
+ ld a, [PlayerScreens]
+ bit SCREENS_SPIKES, a
+ ret
+
+.Foresight: ; 2c4e9
+ ld a, [PlayerSubStatus1]
+ bit SUBSTATUS_IDENTIFIED, a
+ ret
+
+.PerishSong: ; 2c4ef
+ ld a, [PlayerSubStatus1]
+ bit SUBSTATUS_PERISH, a
+ ret
+
+.Sandstorm: ; 2c4f5
+ ld a, [Weather]
+ cp WEATHER_SANDSTORM
+ jr z, .Redundant
+ jr .NotRedundant
+
+.Attract: ; 2c4fe
+ callba CheckOppositeGender
+ jr c, .Redundant
+ ld a, [PlayerSubStatus1]
+ bit SUBSTATUS_IN_LOVE, a
+ ret
+
+.Safeguard: ; 2c50c
+ ld a, [EnemyScreens]
+ bit SCREENS_SAFEGUARD, a
+ ret
+
+.RainDance: ; 2c512
+ ld a, [Weather]
+ cp WEATHER_RAIN
+ jr z, .Redundant
+ jr .NotRedundant
+
+.SunnyDay: ; 2c51b
+ ld a, [Weather]
+ cp WEATHER_SUN
+ jr z, .Redundant
+ jr .NotRedundant
+
+.DreamEater: ; 2c524
+ ld a, [BattleMonStatus]
+ and SLP
+ jr z, .Redundant
+ jr .NotRedundant
+
+.Swagger: ; 2c52d
+ ld a, [PlayerSubStatus3]
+ bit SUBSTATUS_CONFUSED, a
+ ret
+
+.FutureSight: ; 2c533
+ ld a, [EnemyScreens]
+ bit 5, a
+ ret
+
+.Heal:
+.MorningSun:
+.Synthesis:
+.Moonlight: ; 2c539
+ callba AICheckEnemyMaxHP
+ jr nc, .NotRedundant
+
+.Teleport:
+.Redundant: ; 2c541
+ ld a, 1
+ and a
+ ret
+
+.NotRedundant: ; 2c545
+ xor a
+ ret
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2412,7 +2412,7 @@
ld e, HP_BAR_LENGTH_PX
call UpdateHPPal
call WaitBGMap
- callba Function2c012
+ callba EnemySwitch_TrainerHud
ld a, [wLinkMode]
and a
jr z, .not_linked
@@ -4853,7 +4853,7 @@
lb bc, 5, 11
call ClearBox
- callba DrawPlayerExpBar
+ callba DrawPlayerHUDBorder
hlcoord 18, 9
ld [hl], $73 ; vertical bar
@@ -4995,7 +4995,7 @@
lb bc, 4, 11
call ClearBox
- callba Function2c0c5
+ callba DrawEnemyHUDBorder
ld a, [TempEnemyMonSpecies]
ld [CurSpecies], a
@@ -9610,7 +9610,7 @@
ld d, $0
ld e, ANIM_MON_NORMAL
predef AnimateFrontpic
- jr .skip_cry
+ jr .skip_cry ; cry is played during the animation
.cry_no_anim
ld a, $0f
@@ -9623,7 +9623,7 @@
cp BATTLETYPE_FISH
jr nz, .NotFishing
- callba MobileFn_106086
+ callba MobileFn_106086 ; update fishing records?
ld hl, HookedPokemonAttackedText
jr .PlaceBattleStartText
@@ -9639,7 +9639,7 @@
.PlaceBattleStartText
push hl
- callba Function2c000
+ callba BattleStart_TrainerHuds
pop hl
call StdBattleTextBox
--- a/battle/sliding_intro.asm
+++ b/battle/sliding_intro.asm
@@ -62,7 +62,7 @@
; 4e9d6
.subfunction3: ; 4e9d6
- ld hl, Sprites + 1
+ ld hl, Sprites + 1 ; x pixel
ld c, $12 ; 18
ld de, $4
.loop3
--- /dev/null
+++ b/battle/trainer_huds.asm
@@ -1,0 +1,275 @@
+wPlaceBallsDirection EQU $d003
+wTrainerHUDTiles EQU $d004
+wPlaceBallsX EQU $cfc4
+wPlaceBallsY EQU $cfc5
+GLOBAL wPlaceBallsDirection, wTrainerHUDTiles, wPlaceBallsX, wPlaceBallsY
+
+BattleStart_TrainerHuds: ; 2c000
+ ld a, $e4
+ ld [rOBP0], a
+ call LoadBallIconGFX
+ call ShowPlayerMonsRemaining
+ ld a, [wBattleMode]
+ dec a
+ ret z
+ jp ShowOTTrainerMonsRemaining
+; 2c012
+
+EnemySwitch_TrainerHud: ; 2c012
+ ld a, $e4
+ ld [rOBP0], a
+ call LoadBallIconGFX
+ jp ShowOTTrainerMonsRemaining
+; 2c01c
+
+ShowPlayerMonsRemaining: ; 2c01c
+ call DrawPlayerPartyIconHUDBorder
+ ld hl, PartyMon1HP
+ ld de, PartyCount
+ call StageBallTilesData
+ ; ldpixel wPlaceBallsX, 12, 12
+ ld a, 12 * 8
+ ld hl, wPlaceBallsX
+ ld [hli], a
+ ld [hl], a
+ ld a, 8
+ ld [wPlaceBallsDirection], a
+ ld hl, Sprites
+ jp LoadTrainerHudOAM
+; 2c03a
+
+ShowOTTrainerMonsRemaining: ; 2c03a
+ call DrawEnemyHUDBorder
+ ld hl, OTPartyMon1HP
+ ld de, OTPartyCount
+ call StageBallTilesData
+ ; ldpixel wPlaceBallsX, 9, 4
+ ld hl, wPlaceBallsX
+ ld a, 9 * 8
+ ld [hli], a
+ ld [hl], 4 * 8
+ ld a, -8
+ ld [wPlaceBallsDirection], a
+ ld hl, Sprites + PARTY_LENGTH * 4
+ jp LoadTrainerHudOAM
+; 2c059
+
+StageBallTilesData: ; 2c059
+ ld a, [de]
+ push af
+ ld de, Buffer1
+ ld c, PARTY_LENGTH
+ ld a, $34 ; empty slot
+.loop1
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .loop1
+ pop af
+ ld de, Buffer1
+.loop2
+ push af
+ call .GetHUDTile
+ inc de
+ pop af
+ dec a
+ jr nz, .loop2
+ ret
+; 2c075
+
+.GetHUDTile: ; 2c075
+ ld a, [hli]
+ and a
+ jr nz, .got_hp
+ ld a, [hl]
+ and a
+ ld b, $33 ; fainted
+ jr z, .fainted
+
+.got_hp
+rept 3
+ dec hl
+endr
+ ld a, [hl]
+ and a
+ ld b, $32 ; statused
+ jr nz, .load
+ dec b ; normal
+ jr .load
+
+.fainted
+rept 3
+ dec hl
+endr
+
+.load
+ ld a, b
+ ld [de], a
+ ld bc, PARTYMON_STRUCT_LENGTH + MON_HP - MON_STATUS
+ add hl, bc
+ ret
+; 2c095
+
+DrawPlayerHUDBorder: ; 2c095
+ ld hl, .tiles
+ ld de, wTrainerHUDTiles
+ ld bc, 4
+ call CopyBytes
+ hlcoord 18, 10
+ ld de, -1 ; start on right
+ jr PlaceHUDBorderTiles
+
+.tiles
+ db $73 ; right side
+ db $77 ; bottom right
+ db $6f ; bottom left
+ db $76 ; bottom side
+; 2c0ad
+
+DrawPlayerPartyIconHUDBorder: ; 2c0ad
+ ld hl, .tiles
+ ld de, wTrainerHUDTiles
+ ld bc, 4
+ call CopyBytes
+ hlcoord 18, 10
+ ld de, -1 ; start on right
+ jr PlaceHUDBorderTiles
+
+.tiles
+ db $73 ; right side
+ db $5c ; bottom right
+ db $6f ; bottom left
+ db $76 ; bottom side
+; 2c0c5
+
+DrawEnemyHUDBorder: ; 2c0c5
+ ld hl, .tiles
+ ld de, wTrainerHUDTiles
+ ld bc, 4
+ call CopyBytes
+ hlcoord 1, 2
+ ld de, 1 ; start on left
+ call PlaceHUDBorderTiles
+ ld a, [wBattleMode]
+ dec a
+ ret nz
+ ld a, [TempEnemyMonSpecies]
+ dec a
+ call CheckCaughtMon
+ ret z
+ hlcoord 1, 1
+ ld [hl], $5d
+ ret
+
+.tiles
+ db $6d ; left side
+ db $74 ; bottom left
+ db $78 ; bottom right
+ db $76 ; bottom side
+; 2c0f1
+
+PlaceHUDBorderTiles: ; 2c0f1
+ ld a, [wTrainerHUDTiles]
+ ld [hl], a
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld a, [StartFlypoint]
+ ld [hl], a
+ ld b, $8
+.loop
+ add hl, de
+ ld a, [MovementBuffer]
+ ld [hl], a
+ dec b
+ jr nz, .loop
+ add hl, de
+ ld a, [EndFlypoint]
+ ld [hl], a
+ ret
+; 2c10d
+
+LinkBattle_TrainerHuds: ; 2c10d
+ call LoadBallIconGFX
+ ld hl, PartyMon1HP
+ ld de, PartyCount
+ call StageBallTilesData
+ ld hl, wPlaceBallsX
+ ld a, 10 * 8
+ ld [hli], a
+ ld [hl], 8 * 8
+ ld a, $8
+ ld [wPlaceBallsDirection], a
+ ld hl, Sprites
+ call LoadTrainerHudOAM
+
+ ld hl, OTPartyMon1HP
+ ld de, OTPartyCount
+ call StageBallTilesData
+ ld hl, wPlaceBallsX
+ ld a, 10 * 8
+ ld [hli], a
+ ld [hl], 13 * 8
+ ld hl, Sprites + PARTY_LENGTH * 4
+ jp LoadTrainerHudOAM
+; 2c143
+
+LoadTrainerHudOAM: ; 2c143
+ ld de, Buffer1
+ ld c, PARTY_LENGTH
+.loop
+ ld a, [wPlaceBallsY]
+ ld [hli], a
+ ld a, [wPlaceBallsX]
+ ld [hli], a
+ ld a, [de]
+ ld [hli], a
+ ld a, $3
+ ld [hli], a
+ ld a, [wPlaceBallsX]
+ ld b, a
+ ld a, [wPlaceBallsDirection]
+ add b
+ ld [wPlaceBallsX], a
+ inc de
+ dec c
+ jr nz, .loop
+ ret
+; 2c165
+
+LoadBallIconGFX: ; 2c165
+ ld de, .gfx
+ ld hl, VTiles0 tile $31
+ lb bc, BANK(LoadBallIconGFX), 4
+ call Get2bpp_2
+ ret
+; 2c172
+
+.gfx: ; 2c172
+INCBIN "gfx/battle/balls.2bpp"
+; 2c1b2
+
+_ShowLinkBattleParticipants: ; 2c1b2
+ call ClearBGPalettes
+ call LoadFontsExtra
+ hlcoord 2, 3
+ ld b, 9
+ ld c, 14
+ call TextBox
+ hlcoord 4, 5
+ ld de, PlayerName
+ call PlaceString
+ hlcoord 4, 10
+ ld de, OTPlayerName
+ call PlaceString
+ hlcoord 9, 8
+ ld a, $69 ; "V"
+ ld [hli], a
+ ld [hl], $6a ; "S"
+ callba LinkBattle_TrainerHuds ; no need to callba
+ ld b, SCGB_08
+ call GetSGBLayout
+ call SetPalettes
+ ld a, $e4
+ ld [rOBP0], a
+ ret
+; 2c1ef
--- a/constants/sfx_constants.asm
+++ b/constants/sfx_constants.asm
@@ -98,7 +98,7 @@
const SFX_UNKNOWN_5F
const SFX_UNKNOWN_60
const SFX_UNKNOWN_61
- const SFX_UNKNOWN_62
+ const SFX_SWITCH_POCKETS
const SFX_UNKNOWN_63
const SFX_BURN
const SFX_TITLE_SCREEN_ENTRANCE
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -41,7 +41,7 @@
db $80 ; flags
db 0 ; items
dw MainMenuItems
- dw Function1f79
+ dw PlaceMenuStrings
dw MainMenuText
; 49d20
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -809,9 +809,9 @@
SellMenu: ; 15eb3
call DisableSpriteUpdates
- callba Function106a5
+ callba DepositSellInitPackBuffers
.asm_15ebc
- callba Function106be
+ callba DepositSellPack
ld a, [wcf66]
and a
jp z, Function15ece
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -1,19 +1,21 @@
+wCurrPocket EQU $cf65
+
Pack: ; 10000
ld hl, Options
set NO_TEXT_SCROLL, [hl]
- call Function1068a
+ call InitPackBuffers
.loop
call JoyTextDelay
ld a, [wJumptableIndex]
bit 7, a
jr nz, .done
- call Function10026
+ call .RunJumptable
call DelayFrame
jr .loop
.done
- ld a, [wcf65]
+ ld a, [wCurrPocket]
ld [wLastPocket], a
ld hl, Options
res NO_TEXT_SCROLL, [hl]
@@ -20,48 +22,48 @@
ret
; 10026
-Function10026: ; 10026
+.RunJumptable: ; 10026
ld a, [wJumptableIndex]
- ld hl, Jumptable_10030
- call Function1086b
+ ld hl, .Jumptable
+ call Pack_GetJumptablePointer
jp [hl]
+
; 10030
+.Jumptable: ; 10030 (4:4030)
+ jumptable_start
+ jumptable .InitGFX ; 0
+ jumptable .InitItemsPocket ; 1
+ jumptable .ItemsPocketMenu ; 2
+ jumptable .InitBallsPocket ; 3
+ jumptable .BallsPocketMenu ; 4
+ jumptable .InitKeyItemsPocket ; 5
+ jumptable .KeyItemsPocketMenu ; 6
+ jumptable .InitTMHMPocket ; 7
+ jumptable .TMHMPocketMenu ; 8
+ jumptable Pack_QuitNoScript ; 9
+ jumptable Pack_QuitRunScript ; 10
-Jumptable_10030: ; 10030 (4:4030)
- dw Function10046
- dw Function10056
- dw Function10067
- dw Function10186
- dw Function10198
- dw Function10094
- dw Function100a6
- dw Function100d3
- dw Function100e8
- dw Function10874
- dw Function1087e
-
-
-Function10046: ; 10046 (4:4046)
+.InitGFX: ; 10046 (4:4046)
xor a
ld [hBGMapMode], a
- call Function10955
+ call Pack_InitGFX
ld a, [wcf64]
ld [wJumptableIndex], a
- call Function10a40
+ call Pack_InitColors
ret
-Function10056: ; 10056 (4:4056)
+.InitItemsPocket: ; 10056 (4:4056)
xor a
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
- call Function10866
+ call Pack_JumptableNext
ret
-Function10067: ; 10067 (4:4067)
- ld hl, MenuDataHeader_0x10a4f
+.ItemsPocketMenu: ; 10067 (4:4067)
+ ld hl, ItemsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wItemsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -74,22 +76,22 @@
ld [wItemsPocketCursor], a
ld b, $7
ld c, $3
- call Function108d4
+ call Pack_InterpretJoypad
ret c
- call Function101c5
+ call .ItemBallsKey_LoadSubmenu
ret
-Function10094: ; 10094 (4:4094)
+.InitKeyItemsPocket: ; 10094 (4:4094)
ld a, $2
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
- call Function10866
+ call Pack_JumptableNext
ret
-Function100a6: ; 100a6 (4:40a6)
- ld hl, MenuDataHeader_0x10a7f
+.KeyItemsPocketMenu: ; 100a6 (4:40a6)
+ ld hl, KeyItemsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wKeyItemsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -102,39 +104,40 @@
ld [wKeyItemsPocketCursor], a
ld b, $3
ld c, $7
- call Function108d4
+ call Pack_InterpretJoypad
ret c
- call Function101c5
+ call .ItemBallsKey_LoadSubmenu
ret
-Function100d3: ; 100d3 (4:40d3)
+.InitTMHMPocket: ; 100d3 (4:40d3)
ld a, $3
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
xor a
ld [hBGMapMode], a
call WaitBGMap_DrawPackGFX
- call Function10866
+ call Pack_JumptableNext
ret
-Function100e8: ; 100e8 (4:40e8)
- callba Function2c76f
+.TMHMPocketMenu: ; 100e8 (4:40e8)
+ callba TMHMPocket
ld b, $5
ld c, $1
- call Function108d4
+ call Pack_InterpretJoypad
ret c
callba _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
- jr nz, .asm_1010a
- ld hl, MenuDataHeader_0x1013b
- ld de, Jumptable_10153
- jr .asm_10110
-.asm_1010a
- ld hl, MenuDataHeader_0x10124
- ld de, Jumptable_10137
-.asm_10110
+ jr nz, .use_quit
+ ld hl, .MenuDataHeader2
+ ld de, .Jumptable2
+ jr .load_jump
+
+.use_quit
+ ld hl, .MenuDataHeader1
+ ld de, .Jumptable1
+.load_jump
push de
call LoadMenuDataHeader
call InterpretMenu2
@@ -143,19 +146,19 @@
ret c
ld a, [MenuSelection2]
dec a
- call Function1086b
+ call Pack_GetJumptablePointer
jp [hl]
-; 10124 (4:4124)
-MenuDataHeader_0x10124: ; 0x10124
+; 10124 (4:4124)
+.MenuDataHeader1: ; 0x10124
db $40 ; flags
db 07, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x1012c
+ dw .MenuData2_1
db 1 ; default option
; 0x1012c
-MenuData2_0x1012c: ; 0x1012c
+.MenuData2_1: ; 0x1012c
db $c0 ; flags
db 2 ; items
db "USE@"
@@ -162,20 +165,22 @@
db "QUIT@"
; 0x10137
-Jumptable_10137: ; 10137
- dw Function10159
- dw QuitItemSubmenu
+.Jumptable1: ; 10137
+ jumptable_start
+ jumptable .UseItem
+ jumptable QuitItemSubmenu
+
; 1013b
-MenuDataHeader_0x1013b: ; 0x1013b
+.MenuDataHeader2: ; 0x1013b
db $40 ; flags
db 05, 13 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10143
+ dw .MenuData2_2
db 1 ; default option
; 0x10143
-MenuData2_0x10143: ; 0x10143
+.MenuData2_2: ; 0x10143
db $c0 ; flags
db 3 ; items
db "USE@"
@@ -183,43 +188,43 @@
db "QUIT@"
; 0x10153
-Jumptable_10153: ; 10153
- dw Function10159
+.Jumptable2: ; 10153
+ dw .UseItem
dw GiveItem
dw QuitItemSubmenu
; 10159
-Function10159: ; 10159
- callba Function2c7bf
+.UseItem: ; 10159
+ callba AskTeachTMHM
ret c
- callba Function2c7fb
- jr c, .asm_10179
+ callba ChooseMonToLearnTMHM
+ jr c, .declined
ld hl, Options
ld a, [hl]
push af
- res 4, [hl]
- callba Function2c867
+ res NO_TEXT_SCROLL, [hl]
+ callba TeachTMHM
pop af
ld [Options], a
-.asm_10179
+.declined
xor a
ld [hBGMapMode], a
- call Function10955
+ call Pack_InitGFX
call WaitBGMap_DrawPackGFX
- call Function10a40
+ call Pack_InitColors
ret
-Function10186: ; 10186 (4:4186)
+.InitBallsPocket: ; 10186 (4:4186)
ld a, $1
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
- call Function10866
+ call Pack_JumptableNext
ret
-Function10198: ; 10198 (4:4198)
- ld hl, MenuDataHeader_0x10aaf
+.BallsPocketMenu: ; 10198 (4:4198)
+ ld hl, BallsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wBallsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -232,12 +237,12 @@
ld [wBallsPocketCursor], a
ld b, $1
ld c, $5
- call Function108d4
+ call Pack_InterpretJoypad
ret c
- call Function101c5
+ call .ItemBallsKey_LoadSubmenu
ret
-Function101c5: ; 101c5 (4:41c5)
+.ItemBallsKey_LoadSubmenu: ; 101c5 (4:41c5)
callba _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
@@ -268,32 +273,32 @@
.usable
ld hl, MenuDataHeader_UsableKeyItem
- ld de, Jumptable_1026a
+ ld de, Jumptable_UseGiveTossRegisterQuit
jr .build_menu
.selectable_usable
ld hl, MenuDataHeader_UsableItem
- ld de, Jumptable_10291
+ ld de, Jumptable_UseGiveTossQuit
jr .build_menu
.tossable_selectable
ld hl, MenuDataHeader_UnusableItem
- ld de, Jumptable_102ac
+ ld de, Jumptable_UseQuit
jr .build_menu
.tossable_unselectable
ld hl, MenuDataHeader_UnusableKeyItem
- ld de, Jumptable_102c7
+ ld de, Jumptable_UseRegisterQuit
jr .build_menu
.unusable
ld hl, MenuDataHeader_HoldableKeyItem
- ld de, Jumptable_102ea
+ ld de, Jumptable_GiveTossRegisterQuit
jr .build_menu
.selectable_unusable
ld hl, MenuDataHeader_HoldableItem
- ld de, Jumptable_1030b
+ ld de, Jumptable_GiveTossQuit
.build_menu
push de
call LoadMenuDataHeader
@@ -303,10 +308,10 @@
ret c
ld a, [MenuSelection2]
dec a
- call Function1086b
+ call Pack_GetJumptablePointer
jp [hl]
-; 10249 (4:4249)
+; 10249 (4:4249)
MenuDataHeader_UsableKeyItem: ; 0x10249
db $40 ; flags
db 01, 13 ; start coords
@@ -325,12 +330,13 @@
db "QUIT@"
; 0x1026a
-Jumptable_1026a: ; 1026a
- dw UseItem
- dw GiveItem
- dw TossMenu
- dw RegisterItem
- dw QuitItemSubmenu
+Jumptable_UseGiveTossRegisterQuit: ; 1026a
+ jumptable_start
+ jumptable UseItem
+ jumptable GiveItem
+ jumptable TossMenu
+ jumptable RegisterItem
+ jumptable QuitItemSubmenu
; 10274
MenuDataHeader_UsableItem: ; 0x10274
@@ -350,11 +356,12 @@
db "QUIT@"
; 0x10291
-Jumptable_10291: ; 10291
- dw UseItem
- dw GiveItem
- dw TossMenu
- dw QuitItemSubmenu
+Jumptable_UseGiveTossQuit: ; 10291
+ jumptable_start
+ jumptable UseItem
+ jumptable GiveItem
+ jumptable TossMenu
+ jumptable QuitItemSubmenu
; 10299
MenuDataHeader_UnusableItem: ; 0x10299
@@ -372,9 +379,10 @@
db "QUIT@"
; 0x102ac
-Jumptable_102ac: ; 102ac
- dw UseItem
- dw QuitItemSubmenu
+Jumptable_UseQuit: ; 102ac
+ jumptable_start
+ jumptable UseItem
+ jumptable QuitItemSubmenu
; 102b0
MenuDataHeader_UnusableKeyItem: ; 0x102b0
@@ -393,10 +401,11 @@
db "QUIT@"
; 0x102c7
-Jumptable_102c7: ; 102c7
- dw UseItem
- dw RegisterItem
- dw QuitItemSubmenu
+Jumptable_UseRegisterQuit: ; 102c7
+ jumptable_start
+ jumptable UseItem
+ jumptable RegisterItem
+ jumptable QuitItemSubmenu
; 102cd
MenuDataHeader_HoldableKeyItem: ; 0x102cd
@@ -416,11 +425,12 @@
db "QUIT@"
; 0x102ea
-Jumptable_102ea: ; 102ea
- dw GiveItem
- dw TossMenu
- dw RegisterItem
- dw QuitItemSubmenu
+Jumptable_GiveTossRegisterQuit: ; 102ea
+ jumptable_start
+ jumptable GiveItem
+ jumptable TossMenu
+ jumptable RegisterItem
+ jumptable QuitItemSubmenu
; 102f2
MenuDataHeader_HoldableItem: ; 0x102f2
@@ -439,10 +449,12 @@
db "QUIT@"
; 0x1030b
-Jumptable_1030b: ; 1030b
- dw GiveItem
- dw TossMenu
- dw QuitItemSubmenu
+Jumptable_GiveTossQuit: ; 1030b
+ jumptable_start
+ jumptable GiveItem
+ jumptable TossMenu
+ jumptable QuitItemSubmenu
+
; 10311
UseItem: ; 10311
@@ -454,18 +466,19 @@
; 1031f
.jumptable: ; 1031f (4:431f)
- dw .Oak
- dw .Oak
- dw .Oak
- dw .Oak
- dw .Current
- dw .Party
- dw .Field
+ jumptable_start
+ jumptable .Oak
+ jumptable .Oak
+ jumptable .Oak
+ jumptable .Oak
+ jumptable .Current
+ jumptable .Party
+ jumptable .Field
; 1035c
.Oak: ; 1032d (4:432d)
ld hl, Text_ThisIsntTheTime
- call Function10889
+ call Pack_PrintTextNoScroll
ret
.Current: ; 10334 (4:4334)
@@ -479,18 +492,19 @@
call DoItemEffect
xor a
ld [hBGMapMode], a
- call Function10955
+ call Pack_InitGFX
call WaitBGMap_DrawPackGFX
- call Function10a40
+ call Pack_InitColors
ret
+
.NoPokemon
ld hl, TextJump_YouDontHaveAPkmn
- call Function10889
+ call Pack_PrintTextNoScroll
ret
.Field: ; 10355 (4:4355)
call DoItemEffect
- ld a, [wd0ec]
+ ld a, [wItemEffectSucceeded]
and a
jr z, .Oak
ld a, $a
@@ -497,10 +511,9 @@
ld [wJumptableIndex], a
ret
; 10364 (4:4364)
-
TossMenu: ; 10364
ld hl, Text_ThrowAwayHowMany
- call Function10889
+ call Pack_PrintTextNoScroll
callba Function24fbf
push af
call ExitMenu
@@ -519,35 +532,35 @@
call TossItem
call Pack_GetItemName
ld hl, Text_ThrewAway
- call Function10889
-
+ call Pack_PrintTextNoScroll
.finish
ret
; 1039d
Function1039d: ; 1039d
- ld a, [wcf65]
+; unreferenced
+ ld a, [wCurrPocket]
and a
- jr z, .asm_103b2
+ jr z, .items
dec a
- jr z, .asm_103aa
+ jr z, .balls
dec a
- jr z, .asm_103ba
+ jr z, .key
ret
-.asm_103aa
+.balls
xor a
ld [wBallsPocketCursor], a
ld [wBallsPocketScrollPosition], a
ret
-.asm_103b2
+.items
xor a
ld [wItemsPocketCursor], a
ld [wItemsPocketScrollPosition], a
ret
-.asm_103ba
+.key
xor a
ld [wKeyItemsPocketCursor], a
ld [wKeyItemsPocketScrollPosition], a
@@ -558,8 +571,8 @@
callba CheckSelectableItem
ld a, [wItemAttributeParamBuffer]
and a
- jr nz, .asm_103f6
- ld a, [wcf65]
+ jr nz, .cant_register
+ ld a, [wCurrPocket]
rrca
rrca
and $c0
@@ -575,12 +588,12 @@
ld de, SFX_FULL_HEAL
call WaitPlaySFX
ld hl, Text_RegisteredItem
- call Function10889
+ call Pack_PrintTextNoScroll
ret
-.asm_103f6
+.cant_register
ld hl, Text_CantRegister
- call Function10889
+ call Pack_PrintTextNoScroll
ret
; 103fd
@@ -587,10 +600,10 @@
GiveItem: ; 103fd
ld a, [PartyCount]
and a
- jp z, Function10486
+ jp z, .NoPokemon
ld a, [Options]
push af
- res 4, a
+ res NO_TEXT_SCROLL, a
ld [Options], a
ld a, $8
ld [PartyMenuActionText], a
@@ -598,7 +611,7 @@
callba LoadPartyMenuGFX
callba InitPartyMenuWithCancel
callba InitPartyMenuGFX
-.asm_10427
+.loop
callba WritePartyMenuTilemap
callba PrintPartyMenuText
call WaitBGMap
@@ -605,17 +618,15 @@
call SetPalettes
call DelayFrame
callba PartyMenuSelect
- jr c, .asm_10475
-
+ jr c, .finish
ld a, [CurPartySpecies]
cp EGG
- jr nz, .asm_10453
-
- ld hl, TextJump_AnEGGCantHoldAnItem
+ jr nz, .give
+ ld hl, .Egg
call PrintText
- jr .asm_10427
+ jr .loop
-.asm_10453
+.give
ld a, [wJumptableIndex]
push af
ld a, [wcf64]
@@ -622,31 +633,30 @@
push af
call GetCurNick
ld hl, StringBuffer1
- ld de, wd050
+ ld de, wd050_MonNick
ld bc, PKMN_NAME_LENGTH
call CopyBytes
- call Function12bd9
+ call TryGiveItemToPartymon
pop af
ld [wcf64], a
pop af
ld [wJumptableIndex], a
-.asm_10475
+.finish
pop af
ld [Options], a
xor a
ld [hBGMapMode], a
- call Function10955
+ call Pack_InitGFX
call WaitBGMap_DrawPackGFX
- call Function10a40
+ call Pack_InitColors
ret
-Function10486: ; 10486 (4:4486)
+.NoPokemon: ; 10486 (4:4486)
ld hl, TextJump_YouDontHaveAPkmn
- call Function10889
+ call Pack_PrintTextNoScroll
ret
; 1048d (4:448d)
-
-TextJump_AnEGGCantHoldAnItem: ; 0x1048d
+.Egg: ; 0x1048d
; An EGG can't hold an item.
text_jump Text_AnEGGCantHoldAnItem
db "@"
@@ -656,70 +666,69 @@
ret
; 10493
-
BattlePack: ; 10493
ld hl, Options
- set 4, [hl]
- call Function1068a
+ set NO_TEXT_SCROLL, [hl]
+ call InitPackBuffers
.loop
call JoyTextDelay
ld a, [wJumptableIndex]
bit 7, a
jr nz, .end
- call Function104b9
+ call .RunJumptable
call DelayFrame
jr .loop
.end
- ld a, [wcf65]
+ ld a, [wCurrPocket]
ld [wLastPocket], a
ld hl, Options
- res 4, [hl]
+ res NO_TEXT_SCROLL, [hl]
ret
; 104b9
-Function104b9: ; 104b9
+.RunJumptable: ; 104b9
ld a, [wJumptableIndex]
- ld hl, Jumptable_104c3
- call Function1086b
+ ld hl, .Jumptable
+ call Pack_GetJumptablePointer
jp [hl]
+
; 104c3
+.Jumptable: ; 104c3 (4:44c3)
+ jumptable_start
+ jumptable .InitGFX ; 0
+ jumptable .InitItemsPocket ; 1
+ jumptable .ItemsPocketMenu ; 2
+ jumptable .InitBallsPocket ; 3
+ jumptable .BallsPocketMenu ; 4
+ jumptable .InitKeyItemsPocket ; 5
+ jumptable .KeyItemsPocketMenu ; 6
+ jumptable .InitTMHMPocket ; 7
+ jumptable .TMHMPocketMenu ; 8
+ jumptable Pack_QuitNoScript ; 9
+ jumptable Pack_QuitRunScript ; 10
-Jumptable_104c3: ; 104c3 (4:44c3)
- dw Function104d9
- dw Function104e9
- dw Function104fa
- dw Function10594
- dw Function105a6
- dw Function10527
- dw Function10539
- dw Function10566
- dw Function10581
- dw Function10874
- dw Function1087e
-
-
-Function104d9: ; 104d9 (4:44d9)
+.InitGFX: ; 104d9 (4:44d9)
xor a
ld [hBGMapMode], a
- call Function10955
+ call Pack_InitGFX
ld a, [wcf64]
ld [wJumptableIndex], a
- call Function10a40
+ call Pack_InitColors
ret
-Function104e9: ; 104e9 (4:44e9)
+.InitItemsPocket: ; 104e9 (4:44e9)
xor a
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
- call Function10866
+ call Pack_JumptableNext
ret
-Function104fa: ; 104fa (4:44fa)
- ld hl, MenuDataHeader_0x10a4f
+.ItemsPocketMenu: ; 104fa (4:44fa)
+ ld hl, ItemsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wItemsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -732,22 +741,22 @@
ld [wItemsPocketCursor], a
ld b, $7
ld c, $3
- call Function108d4
+ call Pack_InterpretJoypad
ret c
- call Function105d3
+ call ItemSubmenu
ret
-Function10527: ; 10527 (4:4527)
+.InitKeyItemsPocket: ; 10527 (4:4527)
ld a, $2
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
- call Function10866
+ call Pack_JumptableNext
ret
-Function10539: ; 10539 (4:4539)
- ld hl, MenuDataHeader_0x10a7f
+.KeyItemsPocketMenu: ; 10539 (4:4539)
+ ld hl, KeyItemsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wKeyItemsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -760,14 +769,14 @@
ld [wKeyItemsPocketCursor], a
ld b, $3
ld c, $7
- call Function108d4
+ call Pack_InterpretJoypad
ret c
- call Function105d3
+ call ItemSubmenu
ret
-Function10566: ; 10566 (4:4566)
+.InitTMHMPocket: ; 10566 (4:4566)
ld a, $3
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
xor a
@@ -774,31 +783,31 @@
ld [hBGMapMode], a
call WaitBGMap_DrawPackGFX
ld hl, Text_PackEmptyString
- call Function10889
- call Function10866
+ call Pack_PrintTextNoScroll
+ call Pack_JumptableNext
ret
-Function10581: ; 10581 (4:4581)
- callba Function2c76f
+.TMHMPocketMenu: ; 10581 (4:4581)
+ callba TMHMPocket
ld b, $5
ld c, $1
- call Function108d4
+ call Pack_InterpretJoypad
ret c
xor a
- call Function105dc
+ call TMHMSubmenu
ret
-Function10594: ; 10594 (4:4594)
+.InitBallsPocket: ; 10594 (4:4594)
ld a, $1
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
- call Function10866
+ call Pack_JumptableNext
ret
-Function105a6: ; 105a6 (4:45a6)
- ld hl, MenuDataHeader_0x10aaf
+.BallsPocketMenu: ; 105a6 (4:45a6)
+ ld hl, BallsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wBallsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -811,21 +820,21 @@
ld [wBallsPocketCursor], a
ld b, $1
ld c, $5
- call Function108d4
+ call Pack_InterpretJoypad
ret c
- call Function105d3
+ call ItemSubmenu
ret
-Function105d3: ; 105d3 (4:45d3)
+ItemSubmenu: ; 105d3 (4:45d3)
callba CheckItemContext
ld a, [wItemAttributeParamBuffer]
-
-Function105dc: ; 105dc (4:45dc)
+TMHMSubmenu: ; 105dc (4:45dc)
and a
jr z, .NoUse
ld hl, .UsableMenuDataHeader
ld de, .UsableJumptable
jr .proceed
+
.NoUse
ld hl, .UnusableMenuDataHeader
ld de, .UnusableJumptable
@@ -838,10 +847,10 @@
ret c
ld a, [MenuSelection2]
dec a
- call Function1086b
+ call Pack_GetJumptablePointer
jp [hl]
-; 10601 (4:4601)
+; 10601 (4:4601)
.UsableMenuDataHeader: ; 0x10601
db $40 ; flags
db 07, 13 ; start coords
@@ -858,8 +867,9 @@
; 0x10614
.UsableJumptable: ; 10614
- dw .Use
- dw .Quit
+ jumptable_start
+ jumptable .Use
+ jumptable .Quit
; 10618
.UnusableMenuDataHeader: ; 0x10618
@@ -877,7 +887,8 @@
; 0x10627
.UnusableJumptable: ; 10627
- dw .Quit
+ jumptable_start
+ jumptable .Quit
; 10629
.Use: ; 10629
@@ -888,72 +899,70 @@
ret
.ItemFunctionJumptable: ; 10637 (4:4637)
- dw .Oak
- dw .Oak
- dw .Oak
- dw .Oak
- dw .Unused
- dw .BattleField
- dw .BattleOnly
+ jumptable_start
+ jumptable .Oak
+ jumptable .Oak
+ jumptable .Oak
+ jumptable .Oak
+ jumptable .Unused
+ jumptable .BattleField
+ jumptable .BattleOnly
-
.Oak: ; 10645 (4:4645)
ld hl, Text_ThisIsntTheTime
- call Function10889
+ call Pack_PrintTextNoScroll
ret
.Unused: ; 1064c (4:464c)
call DoItemEffect
- ld a, [wd0ec]
+ ld a, [wItemEffectSucceeded]
and a
- jr nz, .asm_1066c
+ jr nz, .ReturnToBattle
ret
.BattleField: ; 10656 (4:4656)
call DoItemEffect
- ld a, [wd0ec]
+ ld a, [wItemEffectSucceeded]
and a
- jr nz, .asm_1067e
+ jr nz, .quit_run_script
xor a
ld [hBGMapMode], a
- call Function10955
+ call Pack_InitGFX
call WaitBGMap_DrawPackGFX
- call Function10a40
+ call Pack_InitColors
ret
-.asm_1066c: ; 1066c (4:466c)
+.ReturnToBattle: ; 1066c (4:466c)
call ClearBGPalettes
- jr .asm_1067e
+ jr .quit_run_script
.BattleOnly: ; 10671 (4:4671)
call DoItemEffect
- ld a, [wd0ec]
+ ld a, [wItemEffectSucceeded]
and a
jr z, .Oak
cp $2
- jr z, .asm_10684
-.asm_1067e: ; 1067e (4:467e)
- ld a, $a
+ jr z, .didnt_use_item
+.quit_run_script: ; 1067e (4:467e)
+ ld a, Pack_QuitRunScriptTableIndex
ld [wJumptableIndex], a
ret
-.asm_10684: ; 10684 (4:4684)
+.didnt_use_item: ; 10684 (4:4684)
xor a
- ld [wd0ec], a
+ ld [wItemEffectSucceeded], a
ret
; 10689 (4:4689)
-
.Quit: ; 10689
ret
; 1068a
-
-Function1068a: ; 1068a
+InitPackBuffers: ; 1068a
xor a
ld [wJumptableIndex], a
ld a, [wLastPocket]
and $3
- ld [wcf65], a
+ ld [wCurrPocket], a
inc a
add a
dec a
@@ -961,50 +970,49 @@
xor a
ld [wcf66], a
xor a
- ld [wd0e3], a
+ ld [wSwitchItem], a
ret
; 106a5
-Function106a5: ; 106a5
+DepositSellInitPackBuffers: ; 106a5
xor a
ld [hBGMapMode], a
ld [wJumptableIndex], a
ld [wcf64], a
- ld [wcf65], a
+ ld [wCurrPocket], a
ld [wcf66], a
- ld [wd0e3], a
- call Function10955
- call Function10a40
+ ld [wSwitchItem], a
+ call Pack_InitGFX
+ call Pack_InitColors
ret
; 106be
-Function106be: ; 106be
-.asm_106be
- call Function106c7
- call Function1076f
- jr c, .asm_106be
+DepositSellPack: ; 106be
+.loop
+ call .RunJumptable
+ call DepositSellTutorial_InterpretJoypad
+ jr c, .loop
ret
; 106c7
-Function106c7: ; 106c7
+.RunJumptable: ; 106c7
ld a, [wJumptableIndex]
- ld hl, Jumptable_106d1
- call Function1086b
+ ld hl, .Jumptable
+ call Pack_GetJumptablePointer
jp [hl]
+
; 106d1
-
-Jumptable_106d1: ; 106d1 (4:46d1)
- dw .ItemsPocket
- dw .BallsPocket
- dw .KeyItemsPocket
- dw .TMHMPocket
-
-
+.Jumptable: ; 106d1 (4:46d1)
+ jumptable_start
+ jumptable .ItemsPocket
+ jumptable .BallsPocket
+ jumptable .KeyItemsPocket
+ jumptable .TMHMPocket
.ItemsPocket: ; 106d9 (4:46d9)
xor a
call InitPocket
- ld hl, MenuDataHeader_0x10a67
+ ld hl, PC_Mart_ItemsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wItemsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -1020,7 +1028,7 @@
.KeyItemsPocket: ; 106ff (4:46ff)
ld a, 2
call InitPocket
- ld hl, MenuDataHeader_0x10a97
+ ld hl, PC_Mart_KeyItemsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wKeyItemsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -1037,7 +1045,7 @@
ld a, 3
call InitPocket
call WaitBGMap_DrawPackGFX
- callba Function2c76f
+ callba TMHMPocket
ld a, [CurItem]
ld [CurItem], a
ret
@@ -1045,7 +1053,7 @@
.BallsPocket: ; 1073b (4:473b)
ld a, 1
call InitPocket
- ld hl, MenuDataHeader_0x10ac7
+ ld hl, PC_Mart_BallsPocketMenuDataHeader
call CopyMenuDataHeader
ld a, [wBallsPocketCursor]
ld [wMenuCursorBuffer], a
@@ -1059,61 +1067,60 @@
ret
InitPocket: ; 10762 (4:4762)
- ld [wcf65], a
+ ld [wCurrPocket], a
call ClearPocketList
call DrawPocketName
call WaitBGMap_DrawPackGFX
ret
-
-Function1076f: ; 1076f
- ld hl, wcf73
+DepositSellTutorial_InterpretJoypad: ; 1076f
+ ld hl, wMenuJoypad
ld a, [hl]
- and $1
- jr nz, .asm_10788
+ and A_BUTTON
+ jr nz, .a_button
ld a, [hl]
- and $2
- jr nz, .asm_1078f
+ and B_BUTTON
+ jr nz, .b_button
ld a, [hl]
- and $20
- jr nz, .asm_10795
+ and D_LEFT
+ jr nz, .d_left
ld a, [hl]
- and $10
- jr nz, .asm_107a8
+ and D_RIGHT
+ jr nz, .d_right
scf
ret
-.asm_10788
- ld a, $1
+.a_button
+ ld a, TRUE
ld [wcf66], a
and a
ret
-.asm_1078f
+.b_button
xor a
ld [wcf66], a
and a
ret
-.asm_10795
+.d_left
ld a, [wJumptableIndex]
dec a
and $3
ld [wJumptableIndex], a
push de
- ld de, SFX_UNKNOWN_62
+ ld de, SFX_SWITCH_POCKETS
call PlaySFX
pop de
scf
ret
-.asm_107a8
+.d_right
ld a, [wJumptableIndex]
inc a
and $3
ld [wJumptableIndex], a
push de
- ld de, SFX_UNKNOWN_62
+ ld de, SFX_SWITCH_POCKETS
call PlaySFX
pop de
scf
@@ -1121,15 +1128,14 @@
; 107bb
TutorialPack: ; 107bb
- call Function106a5
+ call DepositSellInitPackBuffers
ld a, [InputType]
or a
jr z, .loop
callba _DudeAutoInput_RightA
-
.loop
- call Function107d7
- call Function1076f
+ call .RunJumptable
+ call DepositSellTutorial_InterpretJoypad
jr c, .loop
xor a
ld [wcf66], a
@@ -1136,103 +1142,103 @@
ret
; 107d7
-Function107d7: ; 107d7
+.RunJumptable: ; 107d7
ld a, [wJumptableIndex]
ld hl, .jumptable
- call Function1086b
+ call Pack_GetJumptablePointer
jp [hl]
+
; 107e1
-
.jumptable: ; 107e1 (4:47e1)
- dw Function107e9
- dw Function1083b
- dw Function10807
- dw Function10826
+ jumptable_start
+ jumptable .Items
+ jumptable .Balls
+ jumptable .KeyItems
+ jumptable .TMHM
-
-Function107e9: ; 107e9 (4:47e9)
+.Items: ; 107e9 (4:47e9)
xor a
- ld hl, MenuDataHeader_0x107ef
- jr Function1085a
-; 107ef (4:47ef)
+ ld hl, .ItemsMenuDataHeader
+ jr .DisplayPocket
-MenuDataHeader_0x107ef: ; 0x107ef
+; 107ef (4:47ef)
+.ItemsMenuDataHeader: ; 0x107ef
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw .MenuData2
+ dw .ItemsMenuData2
db 1 ; default option
; 0x107f7
-.MenuData2: ; 0x107f7
+.ItemsMenuData2: ; 0x107f7
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
- dbw 0, OTPartyMons
+ dbw 0, wDudeNumItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
; 10807
-Function10807: ; 10807 (4:4807)
+.KeyItems: ; 10807 (4:4807)
ld a, 2
- ld hl, MenuDataHeader_0x1080e
- jr Function1085a
-; 1080e (4:480e)
+ ld hl, .KeyItemsMenuDataHeader
+ jr .DisplayPocket
-MenuDataHeader_0x1080e: ; 0x1080e
+; 1080e (4:480e)
+.KeyItemsMenuDataHeader: ; 0x1080e
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw .MenuData2
+ dw .KeyItemsMenuData2
db 1 ; default option
; 0x10816
-.MenuData2: ; 0x10816
+.KeyItemsMenuData2: ; 0x10816
db $ae ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
- dbw 0, OTPartyMon1Exp + 2
+ dbw 0, wDudeNumKeyItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
; 10826
-Function10826: ; 10826 (4:4826)
+.TMHM: ; 10826 (4:4826)
ld a, 3
call InitPocket
call WaitBGMap_DrawPackGFX
- callba Function2c76f
+ callba TMHMPocket
ld a, [CurItem]
ld [CurItem], a
ret
-Function1083b: ; 1083b (4:483b)
+.Balls: ; 1083b (4:483b)
ld a, 1
- ld hl, MenuDataHeader_0x10842
- jr Function1085a
-; 10842 (4:4842)
+ ld hl, .BallsMenuDataHeader
+ jr .DisplayPocket
-MenuDataHeader_0x10842: ; 0x10842
+; 10842 (4:4842)
+.BallsMenuDataHeader: ; 0x10842
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw .MenuData2
+ dw .BallsMenuData2
db 1 ; default option
; 0x1084a
-.MenuData2: ; 0x1084a
+.BallsMenuData2: ; 0x1084a
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
- dbw 0, OTPartyMon1CaughtGender
+ dbw 0, wDudeNumBalls
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
; 1085a
-Function1085a: ; 1085a (4:485a)
+.DisplayPocket: ; 1085a (4:485a)
push hl
call InitPocket
pop hl
@@ -1240,12 +1246,12 @@
call HandleScrollingMenu
ret
-Function10866: ; 10866 (4:4866)
+Pack_JumptableNext: ; 10866 (4:4866)
ld hl, wJumptableIndex
inc [hl]
ret
-Function1086b: ; 1086b
+Pack_GetJumptablePointer: ; 1086b
ld e, a
ld d, 0
rept 2
@@ -1257,7 +1263,7 @@
ret
; 10874
-Function10874: ; 10874 (4:4874)
+Pack_QuitNoScript: ; 10874 (4:4874)
ld hl, wJumptableIndex
set 7, [hl]
xor a
@@ -1264,17 +1270,17 @@
ld [wcf66], a
ret
-Function1087e: ; 1087e (4:487e)
+Pack_QuitRunScript: ; 1087e (4:487e)
ld hl, wJumptableIndex
set 7, [hl]
- ld a, $1
+ ld a, TRUE
ld [wcf66], a
ret
-Function10889: ; 10889 (4:4889)
+Pack_PrintTextNoScroll: ; 10889 (4:4889)
ld a, [Options]
push af
- set 4, a
+ set NO_TEXT_SCROLL, a
ld [Options], a
call PrintText
pop af
@@ -1283,10 +1289,8 @@
WaitBGMap_DrawPackGFX: ; 1089a (4:489a)
call WaitBGMap
-
-
DrawPackGFX: ; 1089d
- ld a, [wcf65]
+ ld a, [wCurrPocket]
and $3
ld e, a
ld d, $0
@@ -1296,7 +1300,6 @@
ld a, [PlayerGender]
bit 0, a
jr nz, .female
-
.male_dude
ld hl, PackGFXPointers
rept 2
@@ -1322,85 +1325,91 @@
dw PackGFX + $f0 * 2
; 108d4
-Function108d4: ; 108d4 (4:48d4)
- ld hl, wcf73
- ld a, [wd0e3]
+Pack_InterpretJoypad: ; 108d4 (4:48d4)
+ ld hl, wMenuJoypad
+ ld a, [wSwitchItem]
and a
- jr nz, .asm_10931
+ jr nz, .switching_item
ld a, [hl]
- and $1
- jr nz, .asm_108f8
+ and A_BUTTON
+ jr nz, .a_button
ld a, [hl]
- and $2
- jr nz, .asm_108fa
+ and B_BUTTON
+ jr nz, .b_button
ld a, [hl]
- and $20
- jr nz, .asm_10901
+ and D_LEFT
+ jr nz, .d_left
ld a, [hl]
- and $10
- jr nz, .asm_10912
+ and D_RIGHT
+ jr nz, .d_right
ld a, [hl]
- and $4
- jr nz, .asm_10923
+ and SELECT
+ jr nz, .select
scf
ret
-.asm_108f8
+
+.a_button
and a
ret
-.asm_108fa
- ld a, $9
+
+.b_button
+ ld a, Pack_QuitNoScriptTableIndex
ld [wJumptableIndex], a
scf
ret
-.asm_10901
+
+.d_left
ld a, b
ld [wJumptableIndex], a
ld [wcf64], a
push de
- ld de, SFX_UNKNOWN_62
+ ld de, SFX_SWITCH_POCKETS
call PlaySFX
pop de
scf
ret
-.asm_10912
+
+.d_right
ld a, c
ld [wJumptableIndex], a
ld [wcf64], a
push de
- ld de, SFX_UNKNOWN_62
+ ld de, SFX_SWITCH_POCKETS
call PlaySFX
pop de
scf
ret
-.asm_10923
- callba Function2490c
+
+.select
+ callba SwitchItemsInBag
ld hl, Text_MoveItemWhere
- call Function10889
+ call Pack_PrintTextNoScroll
scf
ret
-.asm_10931
+
+.switching_item
ld a, [hl]
- and $5
- jr nz, .asm_1093d
+ and A_BUTTON | SELECT
+ jr nz, .place_insert
ld a, [hl]
- and $2
- jr nz, .asm_1094f
+ and B_BUTTON
+ jr nz, .end_switch
scf
ret
-.asm_1093d
- callba Function2490c
+
+.place_insert
+ callba SwitchItemsInBag
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
-.asm_1094f
+.end_switch
xor a
- ld [wd0e3], a
+ ld [wSwitchItem], a
scf
ret
-
-Function10955: ; 10955
+Pack_InitGFX: ; 10955
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -1410,18 +1419,15 @@
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
@@ -1431,10 +1437,8 @@
inc a
dec c
jr nz, .loop
-
call DrawPocketName
call PlacePackGFX
-
; Place the textbox for displaying the item description
hlcoord 0, SCREEN_HEIGHT - 4 - 2
lb bc, 4, SCREEN_WIDTH - 2
@@ -1463,13 +1467,11 @@
; 109bb
DrawPocketName: ; 109bb
- ld a, [wcf65]
-
+ ld a, [wCurrPocket]
; * 15
ld d, a
swap a
sub d
-
ld d, 0
ld e, a
ld hl, .tilemap
@@ -1499,15 +1501,12 @@
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
@@ -1536,10 +1535,9 @@
call ClearBox
ret
-
-Function10a40: ; 10a40
+Pack_InitColors: ; 10a40
call WaitBGMap
- ld b, SCREEN_WIDTH
+ ld b, SCGB_14
call GetSGBLayout
call SetPalettes
call DelayFrame
@@ -1546,15 +1544,15 @@
ret
; 10a4f
-MenuDataHeader_0x10a4f: ; 0x10a4f
+ItemsPocketMenuDataHeader: ; 0x10a4f
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10a57
+ dw .MenuData2
db 1 ; default option
; 0x10a57
-MenuData2_0x10a57: ; 0x10a57
+.MenuData2: ; 0x10a57
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1564,15 +1562,15 @@
dba UpdateItemDescription
; 10a67
-MenuDataHeader_0x10a67: ; 0x10a67
+PC_Mart_ItemsPocketMenuDataHeader: ; 0x10a67
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10a6f
+ dw .MenuData2
db 1 ; default option
; 0x10a6f
-MenuData2_0x10a6f: ; 0x10a6f
+.MenuData2: ; 0x10a6f
db $2e ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1582,15 +1580,15 @@
dba UpdateItemDescription
; 10a7f
-MenuDataHeader_0x10a7f: ; 0x10a7f
+KeyItemsPocketMenuDataHeader: ; 0x10a7f
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10a87
+ dw .MenuData2
db 1 ; default option
; 0x10a87
-MenuData2_0x10a87: ; 0x10a87
+.MenuData2: ; 0x10a87
db $ae ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -1600,15 +1598,15 @@
dba UpdateItemDescription
; 10a97
-MenuDataHeader_0x10a97: ; 0x10a97
+PC_Mart_KeyItemsPocketMenuDataHeader: ; 0x10a97
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10a9f
+ dw .MenuData2
db 1 ; default option
; 0x10a9f
-MenuData2_0x10a9f: ; 0x10a9f
+.MenuData2: ; 0x10a9f
db $2e ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -1618,15 +1616,15 @@
dba UpdateItemDescription
; 10aaf
-MenuDataHeader_0x10aaf: ; 0x10aaf
+BallsPocketMenuDataHeader: ; 0x10aaf
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10ab7
+ dw .MenuData2
db 1 ; default option
; 0x10ab7
-MenuData2_0x10ab7: ; 0x10ab7
+.MenuData2: ; 0x10ab7
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1636,15 +1634,15 @@
dba UpdateItemDescription
; 10ac7
-MenuDataHeader_0x10ac7: ; 0x10ac7
+PC_Mart_BallsPocketMenuDataHeader: ; 0x10ac7
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
- dw MenuData2_0x10acf
+ dw .MenuData2
db 1 ; default option
; 0x10acf
-MenuData2_0x10acf: ; 0x10acf
+.MenuData2: ; 0x10acf
db $2e ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
@@ -1723,6 +1721,5 @@
PackMenuGFX:
INCBIN "gfx/misc/pack_menu.2bpp"
-
PackGFX:
INCBIN "gfx/misc/pack.2bpp"
--- a/engine/pokecenter_pc.asm
+++ b/engine/pokecenter_pc.asm
@@ -431,9 +431,9 @@
jr c, .asm_158b6
call DisableSpriteUpdates
call LoadStandardMenuDataHeader
- callba Function106a5
+ callba DepositSellInitPackBuffers
.asm_1589c
- callba Function106be
+ callba DepositSellPack
ld a, [wcf66]
and a
jr z, .asm_158b3
@@ -629,7 +629,7 @@
call Function156c7
.asm_159f2
- callba Function2490c
+ callba SwitchItemsInBag
.asm_159f8
jp .asm_15989
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -795,26 +795,26 @@
; Eggs can't hold items!
ld a, [CurPartySpecies]
cp EGG
- jr z, .asm_12ba6
+ jr z, .cancel
ld hl, GiveTakeItemMenuData
call LoadMenuDataHeader
call InterpretMenu2
call ExitMenu
- jr c, .asm_12ba6
+ jr c, .cancel
call GetCurNick
ld hl, StringBuffer1
- ld de, wd050
- ld bc, $b
+ ld de, wd050_MonNick
+ ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld a, [MenuSelection2]
cp 1
- jr nz, .asm_12ba0
+ jr nz, .take
call LoadStandardMenuDataHeader
call ClearPalettes
- call Function12ba9
+ call .GiveItem
call ClearPalettes
call LoadFontsBattleExtra
call ExitMenu
@@ -821,23 +821,23 @@
ld a, 0
ret
-.asm_12ba0
+.take
call TakePartyItem
ld a, 3
ret
-.asm_12ba6
+.cancel
ld a, 3
ret
; 12ba9
-Function12ba9: ; 12ba9
+.GiveItem: ; 12ba9
- callba Function106a5
+ callba DepositSellInitPackBuffers
.loop
- callba Function106be
+ callba DepositSellPack
ld a, [wcf66]
and a
@@ -852,7 +852,7 @@
and a
jr nz, .next
- call Function12bd9
+ call TryGiveItemToPartymon
jr .quit
.next
@@ -865,7 +865,7 @@
; 12bd9
-Function12bd9: ; 12bd9
+TryGiveItemToPartymon: ; 12bd9
call SpeechTextBox
call PartyMonItemName
@@ -872,17 +872,17 @@
call GetPartyItemLocation
ld a, [hl]
and a
- jr z, .asm_12bf4
+ jr z, .give_item_to_mon
push hl
ld d, a
callba ItemIsMail
pop hl
- jr c, .asm_12c01
+ jr c, .please_remove_mail
ld a, [hl]
- jr .asm_12c08
+ jr .already_holding_item
-.asm_12bf4
+.give_item_to_mon
call GiveItemToPokemon
ld hl, MadeHoldText
call MenuTextBoxBackup
@@ -889,17 +889,17 @@
call GivePartyItem
ret
-.asm_12c01
+.please_remove_mail
ld hl, PleaseRemoveMailText
call MenuTextBoxBackup
ret
-.asm_12c08
+.already_holding_item
ld [wd265], a
call GetItemName
ld hl, SwitchAlreadyHoldingText
call StartMenuYesNo
- jr c, .asm_12c4b
+ jr c, .abort
call GiveItemToPokemon
ld a, [wd265]
@@ -909,7 +909,7 @@
pop af
ld [CurItem], a
call ReceiveItemFromPokemon
- jr nc, .asm_12c3c
+ jr nc, .bag_full
ld hl, TookAndMadeHoldText
call MenuTextBoxBackup
@@ -918,7 +918,7 @@
call GivePartyItem
ret
-.asm_12c3c
+.bag_full
ld a, [wd265]
ld [CurItem], a
call ReceiveItemFromPokemon
@@ -925,7 +925,7 @@
ld hl, ItemStorageIsFullText
call MenuTextBoxBackup
-.asm_12c4b
+.abort
ret
; 12c4c
--- /dev/null
+++ b/engine/switch_items.asm
@@ -1,0 +1,274 @@
+SwitchItemsInBag: ; 2490c (9:490c)
+ ld a, [wSwitchItem]
+ and a
+ jr z, .init
+ ld b, a
+ ld a, [wCurrPocketCursorPosition]
+ inc a
+ cp b
+ jr z, .trivial
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a5c
+ ld a, [hl]
+ cp $ff
+ ret z
+ ld a, [wSwitchItem]
+ dec a
+ ld [wSwitchItem], a
+ call Function249a7
+ jp c, Function249d1
+ ld a, [wCurrPocketCursorPosition]
+ ld c, a
+ ld a, [wSwitchItem]
+ cp c
+ jr c, .asm_2497a
+ jr .asm_2494a
+
+.init
+ ld a, [wCurrPocketCursorPosition]
+ inc a
+ ld [wSwitchItem], a
+ ret
+
+.trivial
+ xor a
+ ld [wSwitchItem], a
+ ret
+
+.asm_2494a
+ ld a, [wSwitchItem]
+ call Function24a40
+ ld a, [wCurrPocketCursorPosition]
+ ld d, a
+ ld a, [wSwitchItem]
+ ld e, a
+ call Function24a6c
+ push bc
+ ld a, [wSwitchItem]
+ call Function24a5c
+ dec hl
+ push hl
+ call Function24a80
+ add hl, bc
+ ld d, h
+ ld e, l
+ pop hl
+ pop bc
+ call Function24aab
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a4d
+ xor a
+ ld [wSwitchItem], a
+ ret
+
+.asm_2497a
+ ld a, [wSwitchItem]
+ call Function24a40
+ ld a, [wCurrPocketCursorPosition]
+ ld d, a
+ ld a, [wSwitchItem]
+ ld e, a
+ call Function24a6c
+ push bc
+ ld a, [wSwitchItem]
+ call Function24a5c
+ ld d, h
+ ld e, l
+ call Function24a80
+ add hl, bc
+ pop bc
+ call CopyBytes
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a4d
+ xor a
+ ld [wSwitchItem], a
+ ret
+
+Function249a7: ; 249a7 (9:49a7)
+ ld a, [wSwitchItem]
+ call Function24a5c
+ ld d, h
+ ld e, l
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a5c
+ ld a, [de]
+ cp [hl]
+ jr nz, .asm_249cd
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a97
+ cp 99
+ jr z, .asm_249cd
+ ld a, [wSwitchItem]
+ call Function24a97
+ cp 99
+ jr nz, .asm_249cf
+.asm_249cd
+ and a
+ ret
+
+.asm_249cf
+ scf
+ ret
+
+Function249d1: ; 249d1 (9:49d1)
+ ld a, [wSwitchItem]
+ call Function24a5c
+ inc hl
+ push hl
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a5c
+ inc hl
+ ld a, [hl]
+ pop hl
+ add [hl]
+ cp 100
+ jr c, .asm_24a01
+ sub 99
+ push af
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a5c
+ inc hl
+ ld [hl], 99
+ ld a, [wSwitchItem]
+ call Function24a5c
+ inc hl
+ pop af
+ ld [hl], a
+ xor a
+ ld [wSwitchItem], a
+ ret
+
+.asm_24a01
+ push af
+ ld a, [wCurrPocketCursorPosition]
+ call Function24a5c
+ inc hl
+ pop af
+ ld [hl], a
+ ld hl, wMenuData2Addr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wSwitchItem]
+ cp [hl]
+ jr nz, .asm_24a25
+ dec [hl]
+ ld a, [wSwitchItem]
+ call Function24a5c
+ ld [hl], $ff
+ xor a
+ ld [wSwitchItem], a
+ ret
+
+.asm_24a25
+ dec [hl]
+ call Function24a80
+ push bc
+ ld a, [wSwitchItem]
+ call Function24a5c
+ pop bc
+ push hl
+ add hl, bc
+ pop de
+.asm_24a34
+ ld a, [hli]
+ ld [de], a
+ inc de
+ cp $ff
+ jr nz, .asm_24a34
+ xor a
+ ld [wSwitchItem], a
+ ret
+
+Function24a40: ; 24a40 (9:4a40)
+ call Function24a5c
+ ld de, wd002
+ call Function24a80
+ call CopyBytes
+ ret
+
+Function24a4d: ; 24a4d (9:4a4d)
+ call Function24a5c
+ ld d, h
+ ld e, l
+ ld hl, wd002
+ call Function24a80
+ call CopyBytes
+ ret
+
+Function24a5c: ; 24a5c (9:4a5c)
+ push af
+ call Function24a80
+ ld hl, wMenuData2Addr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ inc hl
+ pop af
+ call AddNTimes
+ ret
+
+Function24a6c: ; 24a6c (9:4a6c)
+ push hl
+ call Function24a80
+ ld a, d
+ sub e
+ jr nc, .asm_24a76
+ dec a
+ cpl
+.asm_24a76
+ ld hl, 0
+ call AddNTimes
+ ld b, h
+ ld c, l
+ pop hl
+ ret
+
+Function24a80: ; 24a80 (9:4a80)
+ push hl
+ ld a, [wcf94]
+ ld c, a
+ ld b, 0
+ ld hl, Unknown_24a91
+rept 2
+ add hl, bc
+endr
+ ld c, [hl]
+ inc hl
+ ld b, [hl]
+ pop hl
+ ret
+
+; 24a91 (9:4a91)
+
+Unknown_24a91: ; 24a91
+ dw 0, 1, 2
+; 24a97
+
+Function24a97: ; 24a97 (9:4a97)
+ push af
+ call Function24a80
+ ld a, c
+ cp $2
+ jr nz, .asm_24aa7
+ pop af
+ call Function24a5c
+ inc hl
+ ld a, [hl]
+ ret
+
+.asm_24aa7
+ pop af
+ ld a, $1
+ ret
+
+Function24aab: ; 24aab (9:4aab)
+.loop
+ ld a, [hld]
+ ld [de], a
+ dec de
+ dec bc
+ ld a, b
+ or c
+ jr nz, .loop
+ ret
--- /dev/null
+++ b/engine/tmhm2.asm
@@ -1,0 +1,592 @@
+TMHMPocket: ; 2c76f (b:476f)
+ ld a, $1
+ ld [hInMenu], a
+ call TMHM_PocketLoop
+ ld a, $0
+ ld [hInMenu], a
+ ret nc
+ call Function1bee
+ call WaitBGMap
+ ld a, [CurItem]
+ dec a
+ ld [ItemCountBuffer], a
+ ld hl, TMsHMs
+ ld c, a
+ ld b, 0
+ add hl, bc
+ ld a, [hl]
+ ld [wItemQuantityBuffer], a
+ call .ConvertItemToTMHMNumber
+ scf
+ ret
+
+.ConvertItemToTMHMNumber: ; 2c798 (b:4798)
+ ld a, [CurItem]
+ ld c, a
+ callab GetNumberedTMHM
+ ld a, c
+ ld [CurItem], a
+ ret
+
+ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7)
+ ld a, [CurItem]
+ ld c, a
+ callab GetTMHMNumber
+ ld a, c
+ ld [wCurTMHM], a
+ ret
+
+GetTMHMItemMove: ; 2c7b6 (b:47b6)
+ call ConvertCurItemIntoCurTMHM
+ predef GetTMHMMove
+ ret
+
+AskTeachTMHM: ; 2c7bf (b:47bf)
+ ld hl, Options
+ ld a, [hl]
+ push af
+ res NO_TEXT_SCROLL, [hl]
+ ld a, [CurItem]
+ cp TM01
+ jr c, .NotTMHM
+ call GetTMHMItemMove
+ ld a, [wCurTMHM]
+ ld [wPutativeTMHMMove], a
+ call GetMoveName
+ call CopyName1
+ ld hl, Text_BootedTM ; Booted up a TM
+ ld a, [CurItem]
+ cp HM01
+ jr c, .TM
+ ld hl, Text_BootedHM ; Booted up an HM
+.TM
+ call PrintText
+ ld hl, Text_ItContained
+ call PrintText
+ call YesNoBox
+.NotTMHM
+ pop bc
+ ld a, b
+ ld [Options], a
+ ret
+
+ChooseMonToLearnTMHM: ; 2c7fb
+ ld hl, StringBuffer2
+ ld de, wd066
+ ld bc, 12
+ call CopyBytes
+ call ClearBGPalettes
+ChooseMonToLearnTMHM_NoRefresh: ; 2c80a
+ callba LoadPartyMenuGFX
+ callba InitPartyMenuWithCancel
+ callba InitPartyMenuGFX
+ ld a, $3
+ ld [PartyMenuActionText], a
+.loopback
+ callba WritePartyMenuTilemap
+ callba PrintPartyMenuText
+ call WaitBGMap
+ call SetPalettes
+ call DelayFrame
+ callba PartyMenuSelect
+ push af
+ ld a, [CurPartySpecies]
+ cp EGG
+ pop bc ; now contains the former contents of af
+ jr z, .egg
+ push bc
+ ld hl, wd066
+ ld de, StringBuffer2
+ ld bc, 12
+ call CopyBytes
+ pop af ; now contains the original contents of af
+ ret
+
+.egg
+ push hl
+ push de
+ push bc
+ push af
+ ld de, SFX_WRONG
+ call PlaySFX
+ call WaitSFX
+ pop af
+ pop bc
+ pop de
+ pop hl
+ jr .loopback
+; 2c867
+
+TeachTMHM: ; 2c867
+ predef CanLearnTMHMMove
+
+ push bc
+ ld a, [CurPartyMon]
+ ld hl, PartyMonNicknames
+ call GetNick
+ pop bc
+
+ ld a, c
+ and a
+ jr nz, .compatible
+ push de
+ ld de, SFX_WRONG
+ call PlaySFX
+ pop de
+ ld hl, Text_TMHMNotCompatible
+ call PrintText
+ jr .nope
+
+.compatible
+ callab KnowsMove
+ jr c, .nope
+
+ predef LearnMove
+ ld a, b
+ and a
+ jr z, .nope
+
+ callba MobileFn_106049
+ ld a, [CurItem]
+ call IsHM
+ ret c
+
+ ld c, HAPPINESS_LEARNMOVE
+ callab ChangeHappiness
+ call ConsumeTM
+ jr .learned_move
+
+.nope
+ and a
+ ret
+
+.unused
+ ld a, 2
+ ld [wItemEffectSucceeded], a
+.learned_move
+ scf
+ ret
+; 2c8bf (b:48bf)
+
+Text_BootedTM: ; 0x2c8bf
+ ; Booted up a TM.
+ text_jump UnknownText_0x1c0373
+ db "@"
+; 0x2c8c4
+
+Text_BootedHM: ; 0x2c8c4
+ ; Booted up an HM.
+ text_jump UnknownText_0x1c0384
+ db "@"
+; 0x2c8c9
+
+Text_ItContained: ; 0x2c8c9
+ ; It contained @ . Teach @ to a #MON?
+ text_jump UnknownText_0x1c0396
+ db "@"
+; 0x2c8ce
+
+Text_TMHMNotCompatible: ; 0x2c8ce
+ ; is not compatible with @ . It can't learn @ .
+ text_jump UnknownText_0x1c03c2
+ db "@"
+; 0x2c8d3
+
+TMHM_PocketLoop: ; 2c8d3 (b:48d3)
+ xor a
+ ld [hBGMapMode], a
+ call TMHM_DisplayPocketItems
+ ld a, $2
+ ld [wcfa1], a
+ ld a, $7
+ ld [wcfa2], a
+ ld a, $1
+ ld [wcfa4], a
+ ld a, $5
+ sub d
+ inc a
+ cp $6
+ jr nz, .okay
+ dec a
+.okay
+ ld [wcfa3], a
+ ld a, $c
+ ld [wcfa5], a
+ xor a
+ ld [wcfa6], a
+ ld a, $20
+ ld [wcfa7], a
+ ld a, $f3
+ ld [wcfa8], a
+ ld a, [wTMHMPocketCursor]
+ inc a
+ ld [MenuSelection2], a
+ ld a, $1
+ ld [wcfaa], a
+ jr TMHM_ShowTMMoveDescription
+
+TMHM_JoypadLoop: ; 2c915 (b:4915)
+ call TMHM_DisplayPocketItems
+ call Function1bc9
+ ld b, a
+ ld a, [MenuSelection2]
+ dec a
+ ld [wTMHMPocketCursor], a
+ xor a
+ ld [hBGMapMode], a
+ ld a, [wcfa6]
+ bit 7, a
+ jp nz, TMHM_ScrollPocket
+ ld a, b
+ ld [wMenuJoypad], a
+ bit A_BUTTON_F, a
+ jp nz, TMHM_ChooseTMorHM
+ bit B_BUTTON_F, a
+ jp nz, TMHM_ExitPack
+ bit D_RIGHT_F, a
+ jp nz, TMHM_ExitPocket
+ bit D_LEFT_F, a
+ jp nz, TMHM_ExitPocket
+TMHM_ShowTMMoveDescription: ; 2c946 (b:4946)
+ call TMHM_CheckHoveringOverCancel
+ jp nc, TMHM_ExitPocket
+ hlcoord 0, 12
+ ld b, 4
+ ld c, SCREEN_WIDTH - 2
+ call TextBox
+ ld a, [CurItem]
+ cp NUM_TMS + NUM_HMS + 1
+ jr nc, TMHM_JoypadLoop
+ ld [wd265], a
+ predef GetTMHMMove
+ ld a, [wd265]
+ ld [CurSpecies], a
+ hlcoord 1, 14
+ call PrintMoveDesc
+ jp TMHM_JoypadLoop
+
+TMHM_ChooseTMorHM: ; 2c974 (b:4974)
+ call TMHM_PlaySFX_ReadText2
+ call CountTMsHMs ; This stores the count to wd265.
+ ld a, [MenuSelection2]
+ dec a
+ ld b, a
+ ld a, [wTMHMPocketScrollPosition]
+ add b
+ ld b, a
+ ld a, [wd265]
+ cp b
+ jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL
+TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a)
+ call TMHM_GetCurrentPocketPosition
+ ld a, [MenuSelection2]
+ ld b, a
+.loop
+ inc c
+ ld a, c
+ cp NUM_TMS + NUM_HMS + 1
+ jr nc, .okay
+ ld a, [hli]
+ and a
+ jr z, .loop
+ dec b
+ jr nz, .loop
+ ld a, c
+.okay
+ ld [CurItem], a
+ cp -1
+ ret
+
+TMHM_ExitPack: ; 2c9a5 (b:49a5)
+ call TMHM_PlaySFX_ReadText2
+_TMHM_ExitPack: ; 2c9a8 (b:49a8)
+ ld a, $2
+ ld [wMenuJoypad], a
+ and a
+ ret
+
+TMHM_ExitPocket: ; 2c9af (b:49af)
+ and a
+ ret
+
+TMHM_ScrollPocket: ; 2c9b1 (b:49b1)
+ ld a, b
+ bit 7, a
+ jr nz, .skip
+ ld hl, wTMHMPocketScrollPosition
+ ld a, [hl]
+ and a
+ jp z, TMHM_JoypadLoop
+ dec [hl]
+ call TMHM_DisplayPocketItems
+ jp TMHM_ShowTMMoveDescription
+
+.skip
+ call TMHM_GetCurrentPocketPosition
+ ld b, 5
+.loop
+ inc c
+ ld a, c
+ cp NUM_TMS + NUM_HMS + 1
+ jp nc, TMHM_JoypadLoop
+ ld a, [hli]
+ and a
+ jr z, .loop
+ dec b
+ jr nz, .loop
+ ld hl, wTMHMPocketScrollPosition
+ inc [hl]
+ call TMHM_DisplayPocketItems
+ jp TMHM_ShowTMMoveDescription
+
+TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2)
+ ld a, [BattleType]
+ cp BATTLETYPE_TUTORIAL
+ jp z, Tutorial_TMHMPocket
+
+ hlcoord 5, 2
+ lb bc, 10, 15
+ ld a, " "
+ call ClearBox
+ call TMHM_GetCurrentPocketPosition
+ ld d, $5
+.loop2
+ inc c
+ ld a, c
+ cp NUM_TMS + NUM_HMS + 1
+ jr nc, .NotTMHM
+ ld a, [hli]
+ and a
+ jr z, .loop2
+ ld b, a
+ ld a, c
+ ld [wd265], a
+ push hl
+ push de
+ push bc
+ call TMHMPocket_GetCurrentLineCoord
+ push hl
+ ld a, [wd265]
+ cp NUM_TMS + 1
+ jr nc, .HM
+ ld de, wd265
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+ call PrintNum
+ jr .okay
+
+.HM
+ push af
+ sub NUM_TMS
+ ld [wd265], a
+ ld [hl], "H"
+ inc hl
+ ld de, wd265
+ lb bc, PRINTNUM_RIGHTALIGN | 1, 2
+ call PrintNum
+ pop af
+ ld [wd265], a
+.okay
+ predef GetTMHMMove
+ ld a, [wd265]
+ ld [wPutativeTMHMMove], a
+ call GetMoveName
+ pop hl
+ ld bc, 3
+ add hl, bc
+ push hl
+ call PlaceString
+ pop hl
+ pop bc
+ ld a, c
+ push bc
+ cp NUM_TMS + 1
+ jr nc, .hm2
+ ld bc, SCREEN_WIDTH + 9
+ add hl, bc
+ ld [hl], "×"
+ inc hl
+ ld a, "0" ; why are we doing this?
+ pop bc
+ push bc
+ ld a, b
+ ld [wd265], a
+ ld de, wd265
+ lb bc, 1, 2
+ call PrintNum
+.hm2
+ pop bc
+ pop de
+ pop hl
+ dec d
+ jr nz, .loop2
+ jr .done
+
+.NotTMHM
+ call TMHMPocket_GetCurrentLineCoord
+rept 3
+ inc hl
+endr
+ push de
+ ld de, TMHM_String_Cancel
+ call PlaceString
+ pop de
+.done
+ ret
+
+TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86)
+ hlcoord 5, 0
+ ld bc, 2 * SCREEN_WIDTH
+ ld a, 6
+ sub d
+ ld e, a
+ ; AddNTimes
+.loop
+ add hl, bc
+ dec e
+ jr nz, .loop
+ ret
+; 2ca95 (b:4a95)
+
+Function2ca95: ; 2ca95
+; unreferenced
+ pop hl
+ ld bc, 3
+ add hl, bc
+ predef GetTMHMMove
+ ld a, [wd265]
+ ld [wPutativeTMHMMove], a
+ call GetMoveName
+ push hl
+ call PlaceString
+ pop hl
+ ret
+; 2caae
+
+TMHM_String_Cancel: ; 2caae
+ db "CANCEL@"
+; 2cab5
+
+TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5)
+ ld hl, TMsHMs
+ ld a, [wTMHMPocketScrollPosition]
+ ld b, a
+ inc b
+ ld c, 0
+.loop
+ inc c
+ ld a, [hli]
+ and a
+ jr z, .loop
+ dec b
+ jr nz, .loop
+ dec hl
+ dec c
+ ret
+
+Tutorial_TMHMPocket: ; 2caca (b:4aca)
+ hlcoord 9, 3
+ push de
+ ld de, TMHM_String_Cancel
+ call PlaceString
+ pop de
+ ret
+
+TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6)
+ push de
+ ld de, SFX_READ_TEXT_2
+ call PlaySFX
+ pop de
+ ret
+; 2cadf (b:4adf)
+
+Function2cadf: ; 2cadf
+; unreferenced
+ call ConvertCurItemIntoCurTMHM
+ call .CheckHaveRoomForTMHM
+ ld hl, .NoRoomText
+ jr nc, .print
+ ld hl, .ReceivedText
+ jp PrintText
+; 2caf0
+
+.NoRoomText: ; 0x2caf0
+ ; You have no room for any more @ S.
+ text_jump UnknownText_0x1c03fa
+ db "@"
+; 0x2caf5
+
+.ReceivedText: ; 0x2caf5
+ ; You received @ !
+ text_jump UnknownText_0x1c0421
+ db "@"
+; 0x2cafa
+
+.CheckHaveRoomForTMHM: ; 2cafa
+ ld a, [wd265]
+ dec a
+ ld hl, TMsHMs
+ ld b, 0
+ ld c, a
+ add hl, bc
+ ld a, [hl]
+ inc a
+ cp NUM_TMS * 2
+ ret nc
+ ld [hl], a
+ ret
+; 2cb0c
+
+ConsumeTM: ; 2cb0c (b:4b0c)
+ call ConvertCurItemIntoCurTMHM
+ ld a, [wd265]
+ dec a
+ ld hl, TMsHMs
+ ld b, 0
+ ld c, a
+ add hl, bc
+ ld a, [hl]
+ and a
+ ret z
+ dec a
+ ld [hl], a
+ ret nz
+ ld a, [wTMHMPocketScrollPosition]
+ and a
+ ret z
+ dec a
+ ld [wTMHMPocketScrollPosition], a
+ ret
+
+CountTMsHMs: ; 2cb2a (b:4b2a)
+ ld b, 0
+ ld c, NUM_TMS + NUM_HMS
+ ld hl, TMsHMs
+.loop
+ ld a, [hli]
+ and a
+ jr z, .skip
+ inc b
+.skip
+ dec c
+ jr nz, .loop
+ ld a, b
+ ld [wd265], a
+ ret
+
+PrintMoveDesc: ; 2cb3e
+ push hl
+ ld hl, MoveDescriptions
+ ld a, [CurSpecies]
+ dec a
+ ld c, a
+ ld b, 0
+rept 2
+ add hl, bc
+endr
+ ld a, [hli]
+ ld e, a
+ ld d, [hl]
+ pop hl
+ jp PlaceString
+; 2cb52
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -28,7 +28,8 @@
jp PrintText
; 1d57
-Function1d57:: ; 1d57
+ret_1d57:: ; 1d57
+; unreferenced
ret
; 1d58
@@ -423,9 +424,9 @@
ret
; 1f79
-Function1f79:: ; 1f79
+PlaceMenuStrings:: ; 1f79
push de
- ld hl, wcf97
+ ld hl, wMenuData2PointerTableAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -441,7 +442,7 @@
PlaceNthMenuStrings:: ; 1f8d
push de
ld a, [MenuSelection]
- call Function1fb1
+ call GetMenuDataPointerTableEntry
rept 2
inc hl
endr
@@ -454,7 +455,8 @@
; 1f9e
Function1f9e:: ; 1f9e
- call Function1fb1
+; unreferenced
+ call GetMenuDataPointerTableEntry
rept 2
inc hl
endr
@@ -466,7 +468,7 @@
MenuJumptable:: ; 1fa7
ld a, [MenuSelection]
- call Function1fb1
+ call GetMenuDataPointerTableEntry
ld a, [hli]
ld h, [hl]
ld l, a
@@ -473,10 +475,10 @@
jp [hl]
; 1fb1
-Function1fb1:: ; 1fb1
+GetMenuDataPointerTableEntry:: ; 1fb1
ld e, a
ld d, $0
- ld hl, wcf97
+ ld hl, wMenuData2PointerTableAddr
ld a, [hli]
ld h, [hl]
ld l, a
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -4,7 +4,7 @@
call GetItemName
call CopyName1
ld a, 1
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
ld a, [CurItem]
dec a
ld hl, ItemEffects
@@ -1220,7 +1220,7 @@
.DecidedNotToUse
xor a
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
ret
; ee3d
@@ -1293,7 +1293,7 @@
RareCandy_StatBooster_ExitMenu: ; ee9f
xor a
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
jp ClearPalettes
; eea6
@@ -1930,7 +1930,7 @@
StatusHealer_ExitMenu: ; f29e (3:729e)
xor a
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
StatusHealer_ClearPalettes: ; f2a2 (3:72a2)
call ClearPalettes
ret
@@ -2233,10 +2233,10 @@
EscapeRope: ; f44f
xor a
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
callba EscapeRopeFunction
- ld a, [wPlayerAction]
+ ld a, [wItemEffectSucceeded]
cp 1
call z, UseDisposableItem
ret
@@ -2298,7 +2298,7 @@
.asm_f4a6
xor a
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
ret
; f4ab
@@ -2701,7 +2701,7 @@
PPRestoreItem_Cancel: ; f6e0
call ClearPalettes
xor a
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
ret
; f6e8
@@ -2802,7 +2802,7 @@
SacredAsh: ; f753
callba _SacredAsh
- ld a, [wPlayerAction]
+ ld a, [wItemEffectSucceeded]
cp $1
ret nz
call UseDisposableItem
@@ -2973,7 +2973,7 @@
; Item wasn't used.
ld a, $2
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
ret
; f7d6
@@ -2988,7 +2988,7 @@
; Item wasn't used.
ld a, $2
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
ret
; f7e8
@@ -3018,7 +3018,7 @@
CantUseItemMessage: ; f804
; Item couldn't be used.
xor a
- ld [wPlayerAction], a
+ ld [wItemEffectSucceeded], a
jp PrintText
; f80b
--- a/main.asm
+++ b/main.asm
@@ -1,9 +1,7 @@
INCLUDE "includes.asm"
-
SECTION "bank1", ROMX, BANK[$1]
-
PlaceWaitingText:: ; 4000
hlcoord 3, 10
ld b, 1
@@ -55,7 +53,6 @@
PushOAMEnd
; 4049
-
INCLUDE "engine/map_objects.asm"
INCLUDE "engine/intro_menu.asm"
@@ -248,7 +245,6 @@
db -1 ; end
; 66de
-
INCLUDE "engine/math.asm"
ItemAttributes: ; 67c1
@@ -256,7 +252,6 @@
; 6ec1
INCLUDE "engine/npc_movement.asm"
-
GetFirstPokemonHappiness: ; 718d
ld hl, PartyMon1Happiness
ld bc, PARTYMON_STRUCT_LENGTH
@@ -291,7 +286,6 @@
jp CopyPokemonName_Buffer1_Buffer3
; 71c2
-
ChangeHappiness: ; 71c2
; Perform happiness action c on CurPartyMon
@@ -387,7 +381,6 @@
db +10, +6, +4 ; Gained a level in the place where it was caught
; 725a
-
StepHappiness:: ; 725a
; Raise the party's happiness by 1 point every other step cycle.
@@ -424,7 +417,6 @@
ret
; 7282
-
DaycareStep:: ; 7282
ld a, [wDaycareMan]
@@ -505,7 +497,6 @@
ret
; 7305
-
SpecialGiveShuckle: ; 7305
; Adding to the party.
@@ -579,7 +570,6 @@
db "SHUCKIE@"
; 737e
-
SpecialReturnShuckle: ; 737e
callba SelectMonFromParty
jr c, .refused
@@ -752,7 +742,6 @@
ret
; 747b
-
SECTION "bank2", ROMX, BANK[$2]
Function8000: ; 8000
@@ -844,7 +833,6 @@
ret
; 80a1
-
WritePersonXY:: ; 80a1
ld a, b
call CheckObjectVisibility
@@ -892,7 +880,6 @@
ret
; 80e7
-
CopyObjectStruct:: ; 80e7
call CheckObjectMask
and a
@@ -1188,7 +1175,6 @@
ret
; 8286
-
CopyTempObjectToObjectStruct: ; 8286
ld a, [wTempObjectCopyMapObjectIndex]
ld hl, OBJECT_MAP_OBJECT_INDEX
@@ -1390,7 +1376,6 @@
slow_step_right
; 839e
-
FollowNotExact:: ; 839e
push bc
ld a, c
@@ -1703,13 +1688,10 @@
sine_wave $100
; 854b
-
INCLUDE "engine/predef.asm"
-
INCLUDE "engine/color.asm"
-
SECTION "bank3", ROMX, BANK[$3]
CheckTime:: ; c000
@@ -1734,10 +1716,8 @@
db -1
; c01b
-
INCLUDE "engine/specials.asm"
-
_PrintNum:: ; c4c7
; Print c digits of the b-byte value from de to hl.
; Allows 2 to 7 digits. For 1-digit numbers, add
@@ -2042,7 +2022,6 @@
ret
; c658
-
HealParty: ; c658
xor a
ld [CurPartyMon], a
@@ -2157,7 +2136,6 @@
ret
; c6ea
-
ClearBuffer1: ; c6ea
xor a
ld hl, Buffer1
@@ -2181,7 +2159,6 @@
ret
; c706
-
GetPartyNick: ; c706
; write CurPartyMon nickname to StringBuffer1-3
ld hl, PartyMonNicknames
@@ -2197,7 +2174,6 @@
ret
; c721
-
CheckEngineFlag: ; c721
; Check engine flag de
; Return carry if flag is not set
@@ -2231,7 +2207,6 @@
db "@"
; c742
-
CheckPartyMove: ; c742
; Check if a monster in your party has move d.
@@ -2277,7 +2252,6 @@
ret
; c779
-
FieldMoveFailed: ; c779
ld hl, UnknownText_0xc780
call MenuTextBoxBackup
@@ -2300,13 +2274,11 @@
ret
; c796
-
.Jumptable: ; c796 (3:4796)
dw .CheckAble
dw .DoCut
dw .FailCut
-
.CheckAble: ; c79c (3:479c)
ld de, ENGINE_HIVEBADGE
call CheckBadge
@@ -2570,7 +2542,6 @@
ret
; c91a
-
.Jumptable: ; c91a (3:491a)
dw .TrySurf
dw .DoSurf
@@ -2577,7 +2548,6 @@
dw .FailSurf
dw .AlreadySurfing
-
.TrySurf: ; c922 (3:4922)
ld de, ENGINE_FOGBADGE
call CheckBadge
@@ -2673,7 +2643,6 @@
db "@"
; c9b8
-
GetSurfType: ; c9b8
; Surfing on Pikachu uses an alternate sprite.
; This is done by using a separate movement type.
@@ -2692,7 +2661,6 @@
ret
; c9cb
-
CheckDirection: ; c9cb
; Return carry if a tile permission prevents you
; from moving in the direction you're facing.
@@ -2725,7 +2693,6 @@
db FACE_RIGHT
; c9e7
-
TrySurfOW:: ; c9e7
; Checking a tile in the overworld.
; Return carry if surfing is allowed.
@@ -2775,7 +2742,6 @@
ret
; ca2c
-
AskSurfScript: ; ca2c
opentext
writetext AskSurfText
@@ -2790,7 +2756,6 @@
db "@" ; Want to SURF?
; ca3b
-
FlyFunction: ; ca3b
call ClearBuffer1
.asm_ca3e
@@ -2808,7 +2773,6 @@
dw .FailFly
; ca52
-
.TryFly: ; ca52
; Fly
ld de, ENGINE_STORMBADGE
@@ -3015,7 +2979,6 @@
db "@"
; 0xcb95
-
EscapeRopeFunction: ; cb95
call ClearBuffer1
ld a, $1
@@ -3568,7 +3531,6 @@
db "@"
; 0xce7d
-
HeadbuttFunction: ; ce7d
call TryHeadbuttFromMenu
and $7f
@@ -3661,7 +3623,6 @@
db "@"
; 0xceeb
-
RockSmashFunction: ; ceeb
call TryRockSmashFromMenu
and $7f
@@ -3783,7 +3744,6 @@
ld [ScriptVar], a
ret
-
FishFunction: ; cf8e
ld a, e
push af
@@ -4161,7 +4121,6 @@
db "@"
; 0xd186
-
TryCutOW:: ; d186
ld d, CUT
call CheckPartyMove
@@ -4221,7 +4180,6 @@
db "@"
; 0xd1d5
-
_ReceiveItem:: ; d1d5
call DoesHLEqualNumItems
jp nz, PutItemInPocket
@@ -4268,7 +4226,6 @@
jp ReceiveTMHM
; d20d
-
_TossItem:: ; d20d
call DoesHLEqualNumItems
jr nz, .remove
@@ -4652,8 +4609,6 @@
ret
; d3c4
-
-
ReceiveTMHM: ; d3c4
dec c
ld b, 0
@@ -4712,8 +4667,6 @@
ret
; d407
-
-
GetTMHMNumber:: ; d407
; Return the number of a TM/HM by item id c.
@@ -4735,7 +4688,6 @@
ret
; d417
-
GetNumberedTMHM: ; d417
; Return the item id of a TM/HM by number c.
@@ -4758,7 +4710,6 @@
ret
; d427
-
_CheckTossableItem:: ; d427
; Return 1 in wItemAttributeParamBuffer and carry if CurItem can't be removed from the bag.
ld a, ITEMATTR_PERMISSIONS
@@ -4841,7 +4792,6 @@
ret
; d486
-
GetItemPrice: ; d486
; Return the price of CurItem in de.
push hl
@@ -4857,7 +4807,6 @@
ret
; d497
-
Functiond497:: ; d497 (3:5497)
ld a, [wPlayerStepFlags]
and a
@@ -4928,7 +4877,6 @@
dw .fail1
dw .fail1
-
.fail1: ; d508 (3:5508)
ret
@@ -5557,7 +5505,6 @@
ret
; d88c
-
TryAddMonToParty: ; d88c
; Check if to copy wild Pkmn or generate new Pkmn
; Whose is it?
@@ -5881,7 +5828,6 @@
ret
; da6d
-
FillPP: ; da6d
push bc
ld b, NUM_MOVES
@@ -5997,7 +5943,6 @@
and a
ret
-
SentGetPkmnIntoFromBox: ; db3f
; Sents/Gets Pkmn into/from Box depending on Parameter
; wPokemonWithdrawDepositParameter == 0: get Pkmn into Party
@@ -6233,7 +6178,6 @@
ret
; dcb6
-
Functiondcb6: ; dcb6
ld a, b
ld hl, sBoxMons
@@ -6299,7 +6243,6 @@
ret
; dd21
-
Functiondd21: ; dd21
ld a, [wBreedMon1Species]
ld [CurPartySpecies], a
@@ -6472,7 +6415,6 @@
ld bc, BOXMON_STRUCT_LENGTH
jp CopyBytes
-
SentPkmnIntoBox: ; de6e
; Sents the Pkmn into one of Bills Boxes
; the data comes mainly from 'EnemyMon:'
@@ -6601,7 +6543,6 @@
ret
; df42
-
Functiondf42: ; df42
call CloseSRAM
and a
@@ -7348,7 +7289,6 @@
ret
; e3d9
-
TextJump_WasSentToBillsPC: ; 0xe3d9
; was sent to BILL's PC.
text_jump Text_WasSentToBillsPC
@@ -7459,7 +7399,7 @@
db $80 ; flags
db 0 ; items
dw .items
- dw Function1f79
+ dw PlaceMenuStrings
dw .strings
; 0xe47f
@@ -7564,7 +7504,6 @@
db "@"
; 0xe538
-
CheckCurPartyMonFainted: ; e538
ld hl, PartyMon1HP
ld de, PARTYMON_STRUCT_LENGTH
@@ -7595,7 +7534,6 @@
ret
; e559
-
BillsPC_WithdrawMenu: ; e559 (3:6559)
call LoadStandardMenuDataHeader
callba _WithdrawPKMN
@@ -7815,7 +7753,6 @@
ret
; e6ce
-
BugContest_SetCaughtContestMon: ; e6ce
ld a, [wContestMon]
and a
@@ -7858,10 +7795,8 @@
db "@"
; 0xe722
-
INCLUDE "items/item_effects.asm"
-
GetPokeBallWobble: ; f971 (3:7971)
; Returns whether a Poke Ball will wobble in the catch animation.
; Whether a Pokemon is caught is determined beforehand.
@@ -7952,7 +7887,6 @@
db 255, 255
; f9ea
-
KnowsMove: ; f9ea
ld a, MON_MOVES
call GetPartyParamLocation
@@ -7981,7 +7915,6 @@
db "@"
; 0xfa0b
-
SECTION "bank4", ROMX, BANK[$4]
INCLUDE "engine/pack.asm"
@@ -8116,7 +8049,6 @@
call EventFlagAction
ret
-
CheckFacingTileForStd:: ; 1365b
; Checks to see if the tile you're facing has a std script associated with it. If so, executes the script and returns carry.
ld a, c
@@ -8227,10 +8159,8 @@
endr
; 13d96
-
SECTION "bank5", ROMX, BANK[$5]
-
StopRTC: ; Unreferenced???
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
@@ -8257,7 +8187,6 @@
ret
; 14032
-
GetTimeOfDay:: ; 14032
; get time of day based on the current hour
ld a, [hHours] ; hour
@@ -8300,7 +8229,6 @@
db -1, 0
; 14056
-
StageRTCTimeForSave: ; 14056
call UpdateTime
ld hl, wRTC
@@ -8331,8 +8259,6 @@
ret
; 14089
-
-
StartClock:: ; 14089
call GetClock
call Function1409b
@@ -8400,8 +8326,6 @@
ret
; 140ed
-
-
Function140ed:: ; 140ed
call GetClock
call FixDays
@@ -8584,18 +8508,14 @@
INCLUDE "tilesets/data_1.asm"
-
SECTION "Roofs", ROMX, BANK[ROOFS]
INCLUDE "tilesets/roofs.asm"
-
SECTION "Tileset Data 2", ROMX, BANK[TILESETS_2]
INCLUDE "tilesets/data_2.asm"
-
-
SECTION "bank8", ROMX, BANK[$8]
INCLUDE "engine/clock_reset.asm"
@@ -8604,7 +8524,6 @@
INCLUDE "tilesets/data_3.asm"
-
SECTION "bank9", ROMX, BANK[$9]
StringBufferPointers:: ; 24000
@@ -8761,7 +8680,6 @@
ret
; 24423
-
Function24423: ; 24423
ld a, [VramState]
bit 0, a
@@ -8875,7 +8793,6 @@
ret
; 244c3
-
UpdateItemDescription: ; 0x244c3
ld a, [MenuSelection]
ld [CurSpecies], a
@@ -9015,7 +8932,6 @@
xor a
ret
-
Function245af:: ; 245af
xor a
ld [wcf73], a
@@ -9108,7 +9024,6 @@
ret
; 24644
-
.a_button: ; 24644
call Function1bee
ld a, [MenuSelection2]
@@ -9243,12 +9158,12 @@
ret
ClearObjectStructsa: ; 2471a
-; Get the value of (wcf95):(wcf96,wcf97) and store it in wd144.
- ld hl, wcf96
+; Get the value of (wMenuData2Bank):(wMenuData2Addr) and store it in wd144.
+ ld hl, wMenuData2Addr
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wcf95]
+ ld a, [wMenuData2Bank]
call GetFarByte
ld [wd144], a
; if ([wd144] + 1) < [wMenuData2Items] + [wMenuScrollPosition]: [wMenuScrollPosition] = max(([wd144] + 1) - [wMenuData2Items], 0)
@@ -9537,7 +9452,7 @@
add e
ld e, a
ld d, $0
- ld hl, wcf96
+ ld hl, wMenuData2Addr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -9553,12 +9468,12 @@
.asm_248f2
add hl, de
- ld a, [wcf95]
+ ld a, [wMenuData2Bank]
call GetFarByte
ld [MenuSelection], a
ld [CurItem], a
inc hl
- ld a, [wcf95]
+ ld a, [wMenuData2Bank]
call GetFarByte
ld [wcf75], a
pop hl
@@ -9566,272 +9481,8 @@
ret
; 2490c
+INCLUDE "engine/switch_items.asm"
-Function2490c: ; 2490c (9:490c)
- ld a, [wd0e3]
- and a
- jr z, .asm_2493d
- ld b, a
- ld a, [wcf77]
- inc a
- cp b
- jr z, .asm_24945
- ld a, [wcf77]
- call Function24a5c
- ld a, [hl]
- cp $ff
- ret z
- ld a, [wd0e3]
- dec a
- ld [wd0e3], a
- call Function249a7
- jp c, Function249d1
- ld a, [wcf77]
- ld c, a
- ld a, [wd0e3]
- cp c
- jr c, .asm_2497a
- jr .asm_2494a
-.asm_2493d
- ld a, [wcf77]
- inc a
- ld [wd0e3], a
- ret
-.asm_24945
- xor a
- ld [wd0e3], a
- ret
-.asm_2494a
- ld a, [wd0e3]
- call Function24a40
- ld a, [wcf77]
- ld d, a
- ld a, [wd0e3]
- ld e, a
- call Function24a6c
- push bc
- ld a, [wd0e3]
- call Function24a5c
- dec hl
- push hl
- call Function24a80
- add hl, bc
- ld d, h
- ld e, l
- pop hl
- pop bc
- call Function24aab
- ld a, [wcf77]
- call Function24a4d
- xor a
- ld [wd0e3], a
- ret
-.asm_2497a
- ld a, [wd0e3]
- call Function24a40
- ld a, [wcf77]
- ld d, a
- ld a, [wd0e3]
- ld e, a
- call Function24a6c
- push bc
- ld a, [wd0e3]
- call Function24a5c
- ld d, h
- ld e, l
- call Function24a80
- add hl, bc
- pop bc
- call CopyBytes
- ld a, [wcf77]
- call Function24a4d
- xor a
- ld [wd0e3], a
- ret
-
-Function249a7: ; 249a7 (9:49a7)
- ld a, [wd0e3]
- call Function24a5c
- ld d, h
- ld e, l
- ld a, [wcf77]
- call Function24a5c
- ld a, [de]
- cp [hl]
- jr nz, .asm_249cd
- ld a, [wcf77]
- call Function24a97
- cp $63
- jr z, .asm_249cd
- ld a, [wd0e3]
- call Function24a97
- cp $63
- jr nz, .asm_249cf
-.asm_249cd
- and a
- ret
-.asm_249cf
- scf
- ret
-
-Function249d1: ; 249d1 (9:49d1)
- ld a, [wd0e3]
- call Function24a5c
- inc hl
- push hl
- ld a, [wcf77]
- call Function24a5c
- inc hl
- ld a, [hl]
- pop hl
- add [hl]
- cp $64
- jr c, .asm_24a01
- sub $63
- push af
- ld a, [wcf77]
- call Function24a5c
- inc hl
- ld [hl], $63
- ld a, [wd0e3]
- call Function24a5c
- inc hl
- pop af
- ld [hl], a
- xor a
- ld [wd0e3], a
- ret
-.asm_24a01
- push af
- ld a, [wcf77]
- call Function24a5c
- inc hl
- pop af
- ld [hl], a
- ld hl, wcf96
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld a, [wd0e3]
- cp [hl]
- jr nz, .asm_24a25
- dec [hl]
- ld a, [wd0e3]
- call Function24a5c
- ld [hl], $ff
- xor a
- ld [wd0e3], a
- ret
-.asm_24a25
- dec [hl]
- call Function24a80
- push bc
- ld a, [wd0e3]
- call Function24a5c
- pop bc
- push hl
- add hl, bc
- pop de
-.asm_24a34
- ld a, [hli]
- ld [de], a
- inc de
- cp $ff
- jr nz, .asm_24a34
- xor a
- ld [wd0e3], a
- ret
-
-Function24a40: ; 24a40 (9:4a40)
- call Function24a5c
- ld de, wd002
- call Function24a80
- call CopyBytes
- ret
-
-Function24a4d: ; 24a4d (9:4a4d)
- call Function24a5c
- ld d, h
- ld e, l
- ld hl, wd002
- call Function24a80
- call CopyBytes
- ret
-
-Function24a5c: ; 24a5c (9:4a5c)
- push af
- call Function24a80
- ld hl, wcf96
- ld a, [hli]
- ld h, [hl]
- ld l, a
- inc hl
- pop af
- call AddNTimes
- ret
-
-Function24a6c: ; 24a6c (9:4a6c)
- push hl
- call Function24a80
- ld a, d
- sub e
- jr nc, .asm_24a76
- dec a
- cpl
-.asm_24a76
- ld hl, 0
- call AddNTimes
- ld b, h
- ld c, l
- pop hl
- ret
-
-Function24a80: ; 24a80 (9:4a80)
- push hl
- ld a, [wcf94]
- ld c, a
- ld b, 0
- ld hl, Unknown_24a91
-rept 2
- add hl, bc
-endr
- ld c, [hl]
- inc hl
- ld b, [hl]
- pop hl
- ret
-; 24a91 (9:4a91)
-
-Unknown_24a91: ; 24a91
- dw 0, 1, 2
-; 24a97
-
-Function24a97: ; 24a97 (9:4a97)
- push af
- call Function24a80
- ld a, c
- cp $2
- jr nz, .asm_24aa7
- pop af
- call Function24a5c
- inc hl
- ld a, [hl]
- ret
-.asm_24aa7
- pop af
- ld a, $1
- ret
-
-Function24aab: ; 24aab (9:4aab)
- ld a, [hld]
- ld [de], a
- dec de
- dec bc
- ld a, b
- or c
- jr nz, Function24aab
- ret
-
PlaceMenuItemName: ; 0x24ab4
push de
ld a, [MenuSelection]
@@ -10054,7 +9705,6 @@
db "LEVEL@"
; 24c64
-
FindApricornsInBag: ; 24c64
; Checks the bag for Apricorns.
ld hl, Buffer1
@@ -10114,7 +9764,6 @@
db -1
; 24caf
-
MonMenuOptionStrings: ; 24caf
db "STATS@"
db "SWITCH@"
@@ -10460,7 +10109,6 @@
db "CANCEL@"
; 24ef2
-
LoadBattleMenu: ; 24ef2
ld hl, BattleMenuDataHeader
call LoadMenuDataHeader
@@ -10473,7 +10121,6 @@
ret
; 24f0b
-
SafariBattleMenu: ; 24f0b
; untranslated
ld hl, MenuDataHeader_0x24f4e
@@ -10496,7 +10143,6 @@
ret
; 24f2c
-
BattleMenuDataHeader: ; 24f2c
db $40 ; flags
db 12, 08 ; start coords
@@ -10520,7 +10166,6 @@
db "RUN@"
; 24f4e
-
MenuDataHeader_0x24f4e: ; 24f4e
db $40 ; flags
db 12, 00 ; start coords
@@ -10552,7 +10197,6 @@
ret
; 24f89
-
MenuDataHeader_0x24f89: ; 24f89
db $40 ; flags
db 12, 02 ; start coords
@@ -10584,7 +10228,6 @@
ret
; 24fbf
-
Function24fbf: ; 24fbf
ld hl, MenuDataHeader_0x250ed
call LoadMenuDataHeader
@@ -10592,7 +10235,6 @@
ret
; 24fc9
-
Function24fc9: ; 24fc9
callba GetItemPrice
Function24fcf: ; 24fcf
@@ -10735,7 +10377,6 @@
ret
; 25097
-
Function25097: ; 25097
ret
; 25098
@@ -11121,7 +10762,6 @@
ret
; 2709e
-
LevelUpHappinessMod: ; 2709e
ld a, [CurPartyMon]
ld hl, PartyMon1CaughtLocation
@@ -11263,7 +10903,6 @@
ret
; 27a2d
-
SECTION "bankA", ROMX, BANK[$A]
INCLUDE "engine/link.asm"
@@ -11450,7 +11089,6 @@
ret
; 2ba1a
-
ChrisBackpic: ; 2ba1a
INCBIN "gfx/misc/player.6x6.2bpp.lz"
; 2bbaa
@@ -11459,1158 +11097,25 @@
INCBIN "gfx/misc/dude.6x6.2bpp.lz"
; 2bcea
-
SECTION "bankB", ROMX, BANK[$B]
-Function2c000: ; 2c000
- ld a, $e4
- ld [rOBP0], a
- call Function2c165
- call Function2c01c
- ld a, [wBattleMode]
- dec a
- ret z
- jp Function2c03a
-; 2c012
+INCLUDE "battle/trainer_huds.asm"
-
-
-Function2c012: ; 2c012
- ld a, $e4
- ld [rOBP0], a
- call Function2c165
- jp Function2c03a
-; 2c01c
-
-Function2c01c: ; 2c01c
- call Function2c0ad
- ld hl, PartyMon1HP
- ld de, PartyCount
- call Function2c059
- ld a, $60
- ld hl, wcfc4
- ld [hli], a
- ld [hl], a
- ld a, $8
- ld [wd003], a
- ld hl, Sprites
- jp Function2c143
-; 2c03a
-
-
-
-Function2c03a: ; 2c03a
- call Function2c0c5
- ld hl, OTPartyMon1HP
- ld de, OTPartyCount
- call Function2c059
- ld hl, wcfc4
- ld a, $48
- ld [hli], a
- ld [hl], $20
- ld a, $f8
- ld [wd003], a
- ld hl, Sprites + $18
- jp Function2c143
-; 2c059
-
-
-Function2c059: ; 2c059
- ld a, [de]
- push af
- ld de, Buffer1
- ld c, $6
- ld a, $34
-.asm_2c062
- ld [de], a
- inc de
- dec c
- jr nz, .asm_2c062
- pop af
- ld de, Buffer1
-.asm_2c06b
- push af
- call Function2c075
- inc de
- pop af
- dec a
- jr nz, .asm_2c06b
- ret
-; 2c075
-
-Function2c075: ; 2c075
- ld a, [hli]
- and a
- jr nz, .asm_2c07f
- ld a, [hl]
- and a
- ld b, $33
- jr z, .asm_2c08b
-
-.asm_2c07f
-rept 3
- dec hl
-endr
- ld a, [hl]
- and a
- ld b, $32
- jr nz, .asm_2c08e
- dec b
- jr .asm_2c08e
-
-.asm_2c08b
-rept 3
- dec hl
-endr
-
-.asm_2c08e
- ld a, b
- ld [de], a
- ld bc, $32
- add hl, bc
- ret
-; 2c095
-
-DrawPlayerExpBar: ; 2c095
- ld hl, .data_2c0a9
- ld de, wd004
- ld bc, 4
- call CopyBytes
- hlcoord 18, 10
- ld de, -1
- jr Function2c0f1
-
-.data_2c0a9
- db $73
- db $77
- db $6f
- db $76
-; 2c0ad
-
-Function2c0ad: ; 2c0ad
- ld hl, .data_2c0c1
- ld de, wd004
- ld bc, 4
- call CopyBytes
- hlcoord 18, 10
- ld de, -1
- jr Function2c0f1
-
-.data_2c0c1
- db $73, $5c, $6f, $76
-; 2c0c5
-
-Function2c0c5: ; 2c0c5
- ld hl, .data_2c0ed
- ld de, wd004
- ld bc, 4
- call CopyBytes
- hlcoord 1, 2
- ld de, 1
- call Function2c0f1
- ld a, [wBattleMode]
- dec a
- ret nz
- ld a, [TempEnemyMonSpecies]
- dec a
- call CheckCaughtMon
- ret z
- hlcoord 1, 1
- ld [hl], $5d
- ret
-
-.data_2c0ed
- db $6d
- db $74
- db $78
- db $76
-; 2c0f1
-
-Function2c0f1: ; 2c0f1
- ld a, [wd004]
- ld [hl], a
- ld bc, SCREEN_WIDTH
- add hl, bc
- ld a, [StartFlypoint]
- ld [hl], a
- ld b, $8
-.asm_2c0ff
- add hl, de
- ld a, [MovementBuffer]
- ld [hl], a
- dec b
- jr nz, .asm_2c0ff
- add hl, de
- ld a, [EndFlypoint]
- ld [hl], a
- ret
-; 2c10d
-
-
-Function2c10d: ; 2c10d
- call Function2c165
- ld hl, PartyMon1HP
- ld de, PartyCount
- call Function2c059
- ld hl, wcfc4
- ld a, $50
- ld [hli], a
- ld [hl], $40
- ld a, $8
- ld [wd003], a
- ld hl, Sprites
- call Function2c143
- ld hl, OTPartyMon1HP
- ld de, OTPartyCount
- call Function2c059
- ld hl, wcfc4
- ld a, "@"
- ld [hli], a
- ld [hl], $68
- ld hl, Sprites + $18
- jp Function2c143
-; 2c143
-
-Function2c143: ; 2c143
- ld de, Buffer1
- ld c, $6
-.loop
- ld a, [wcfc5]
- ld [hli], a
- ld a, [wcfc4]
- ld [hli], a
- ld a, [de]
- ld [hli], a
- ld a, $3
- ld [hli], a
- ld a, [wcfc4]
- ld b, a
- ld a, [wd003]
- add b
- ld [wcfc4], a
- inc de
- dec c
- jr nz, .loop
- ret
-; 2c165
-
-Function2c165: ; 2c165
- ld de, GFX_2c172
- ld hl, VTiles0 tile $31
- lb bc, BANK(GFX_2c172), 4
- call Get2bpp_2
- ret
-; 2c172
-
-GFX_2c172: ; 2c172
-INCBIN "gfx/battle/balls.2bpp"
-; 2c1b2
-
-_ShowLinkBattleParticipants: ; 2c1b2
- call ClearBGPalettes
- call LoadFontsExtra
- hlcoord 2, 3
- ld b, 9
- ld c, 14
- call TextBox
- hlcoord 4, 5
- ld de, PlayerName
- call PlaceString
- hlcoord 4, 10
- ld de, OTPlayerName
- call PlaceString
- hlcoord 9, 8
- ld a, $69
- ld [hli], a
- ld [hl], $6a
- callba Function2c10d ; no need to callba
- ld b, SCGB_08
- call GetSGBLayout
- call SetPalettes
- ld a, $e4
- ld [rOBP0], a
- ret
-; 2c1ef
-
-
TrainerClassNames:: ; 2c1ef
- db "LEADER@"
- db "LEADER@"
- db "LEADER@"
- db "LEADER@"
- db "LEADER@"
- db "LEADER@"
- db "LEADER@"
- db "LEADER@"
- db "RIVAL@"
- db "#MON PROF.@"
- db "ELITE FOUR@"
- db "<PKMN> TRAINER@"
- db "ELITE FOUR@"
- db "ELITE FOUR@"
- db "ELITE FOUR@"
- db "CHAMPION@"
- db "LEADER@"
- db "LEADER@"
- db "LEADER@"
- db "SCIENTIST@"
- db "LEADER@"
- db "YOUNGSTER@"
- db "SCHOOLBOY@"
- db "BIRD KEEPER@"
- db "LASS@"
- db "LEADER@"
- db "COOLTRAINER@"
- db "COOLTRAINER@"
- db "BEAUTY@"
- db "#MANIAC@"
- db "ROCKET@"
- db "GENTLEMAN@"
- db "SKIER@"
- db "TEACHER@"
- db "LEADER@"
- db "BUG CATCHER@"
- db "FISHER@"
- db "SWIMMER♂@"
- db "SWIMMER♀@"
- db "SAILOR@"
- db "SUPER NERD@"
- db "RIVAL@"
- db "GUITARIST@"
- db "HIKER@"
- db "BIKER@"
- db "LEADER@"
- db "BURGLAR@"
- db "FIREBREATHER@"
- db "JUGGLER@"
- db "BLACKBELT@"
- db "ROCKET@"
- db "PSYCHIC@"
- db "PICNICKER@"
- db "CAMPER@"
- db "ROCKET@"
- db "SAGE@"
- db "MEDIUM@"
- db "BOARDER@"
- db "#FAN@"
- db "KIMONO GIRL@"
- db "TWINS@"
- db "#FAN@"
- db "<PKMN> TRAINER@"
- db "LEADER@"
- db "OFFICER@"
- db "ROCKET@"
- db "MYSTICALMAN@"
+INCLUDE "text/trainer_class_names.asm"
+INCLUDE "battle/ai/redundant.asm"
-
-AI_Redundant: ; 2c41a
-; Check if move effect c will fail because it's already been used.
-; Return z if the move is a good choice.
-; Return nz if the move is a bad choice.
- ld a, c
- ld de, 3
- ld hl, .Moves
- call IsInArray
- jp nc, .NotRedundant
- inc hl
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-
-.Moves: ; 2c42c
- dbw EFFECT_DREAM_EATER, .DreamEater
- dbw EFFECT_HEAL, .Heal
- dbw EFFECT_LIGHT_SCREEN, .LightScreen
- dbw EFFECT_MIST, .Mist
- dbw EFFECT_FOCUS_ENERGY, .FocusEnergy
- dbw EFFECT_CONFUSE, .Confuse
- dbw EFFECT_TRANSFORM, .Transform
- dbw EFFECT_REFLECT, .Reflect
- dbw EFFECT_SUBSTITUTE, .Substitute
- dbw EFFECT_LEECH_SEED, .LeechSeed
- dbw EFFECT_DISABLE, .Disable
- dbw EFFECT_ENCORE, .Encore
- dbw EFFECT_SNORE, .Snore
- dbw EFFECT_SLEEP_TALK, .SleepTalk
- dbw EFFECT_MEAN_LOOK, .MeanLook
- dbw EFFECT_NIGHTMARE, .Nightmare
- dbw EFFECT_SPIKES, .Spikes
- dbw EFFECT_FORESIGHT, .Foresight
- dbw EFFECT_PERISH_SONG, .PerishSong
- dbw EFFECT_SANDSTORM, .Sandstorm
- dbw EFFECT_ATTRACT, .Attract
- dbw EFFECT_SAFEGUARD, .Safeguard
- dbw EFFECT_RAIN_DANCE, .RainDance
- dbw EFFECT_SUNNY_DAY, .SunnyDay
- dbw EFFECT_TELEPORT, .Teleport
- dbw EFFECT_MORNING_SUN, .MorningSun
- dbw EFFECT_SYNTHESIS, .Synthesis
- dbw EFFECT_MOONLIGHT, .Moonlight
- dbw EFFECT_SWAGGER, .Swagger
- dbw EFFECT_FUTURE_SIGHT, .FutureSight
- db -1
-
-.LightScreen: ; 2c487
- ld a, [EnemyScreens]
- bit SCREENS_LIGHT_SCREEN, a
- ret
-
-.Mist: ; 2c48d
- ld a, [EnemySubStatus4]
- bit SUBSTATUS_MIST, a
- ret
-
-.FocusEnergy: ; 2c493
- ld a, [EnemySubStatus4]
- bit SUBSTATUS_FOCUS_ENERGY, a
- ret
-
-.Confuse: ; 2c499
- ld a, [PlayerSubStatus3]
- bit SUBSTATUS_CONFUSED, a
- ret nz
- ld a, [PlayerScreens]
- bit SCREENS_SAFEGUARD, a
- ret
-
-.Transform: ; 2c4a5
- ld a, [EnemySubStatus5]
- bit SUBSTATUS_TRANSFORMED, a
- ret
-
-.Reflect: ; 2c4ab
- ld a, [EnemyScreens]
- bit SCREENS_REFLECT, a
- ret
-
-.Substitute: ; 2c4b1
- ld a, [EnemySubStatus4]
- bit SUBSTATUS_SUBSTITUTE, a
- ret
-
-.LeechSeed: ; 2c4b7
- ld a, [PlayerSubStatus4]
- bit SUBSTATUS_LEECH_SEED, a
- ret
-
-.Disable: ; 2c4bd
- ld a, [PlayerDisableCount]
- and a
- ret
-
-.Encore: ; 2c4c2
- ld a, [PlayerSubStatus5]
- bit SUBSTATUS_ENCORED, a
- ret
-
-.Snore:
-.SleepTalk: ; 2c4c8
- ld a, [EnemyMonStatus]
- and SLP
- jr z, .Redundant
- jr .NotRedundant
-
-.MeanLook: ; 2c4d1
- ld a, [EnemySubStatus5]
- bit SUBSTATUS_CANT_RUN, a
- ret
-
-.Nightmare: ; 2c4d7
- ld a, [BattleMonStatus]
- and a
- jr z, .Redundant
- ld a, [PlayerSubStatus1]
- bit SUBSTATUS_NIGHTMARE, a
- ret
-
-.Spikes: ; 2c4e3
- ld a, [PlayerScreens]
- bit SCREENS_SPIKES, a
- ret
-
-.Foresight: ; 2c4e9
- ld a, [PlayerSubStatus1]
- bit SUBSTATUS_IDENTIFIED, a
- ret
-
-.PerishSong: ; 2c4ef
- ld a, [PlayerSubStatus1]
- bit SUBSTATUS_PERISH, a
- ret
-
-.Sandstorm: ; 2c4f5
- ld a, [Weather]
- cp WEATHER_SANDSTORM
- jr z, .Redundant
- jr .NotRedundant
-
-.Attract: ; 2c4fe
- callba CheckOppositeGender
- jr c, .Redundant
- ld a, [PlayerSubStatus1]
- bit SUBSTATUS_IN_LOVE, a
- ret
-
-.Safeguard: ; 2c50c
- ld a, [EnemyScreens]
- bit SCREENS_SAFEGUARD, a
- ret
-
-.RainDance: ; 2c512
- ld a, [Weather]
- cp WEATHER_RAIN
- jr z, .Redundant
- jr .NotRedundant
-
-.SunnyDay: ; 2c51b
- ld a, [Weather]
- cp WEATHER_SUN
- jr z, .Redundant
- jr .NotRedundant
-
-.DreamEater: ; 2c524
- ld a, [BattleMonStatus]
- and SLP
- jr z, .Redundant
- jr .NotRedundant
-
-.Swagger: ; 2c52d
- ld a, [PlayerSubStatus3]
- bit SUBSTATUS_CONFUSED, a
- ret
-
-.FutureSight: ; 2c533
- ld a, [EnemyScreens]
- bit 5, a
- ret
-
-.Heal:
-.MorningSun:
-.Synthesis:
-.Moonlight: ; 2c539
- callba AICheckEnemyMaxHP
- jr nc, .NotRedundant
-
-.Teleport:
-.Redundant: ; 2c541
- ld a, 1
- and a
- ret
-
-.NotRedundant: ; 2c545
- xor a
- ret
-
-
INCLUDE "event/move_deleter.asm"
INCLUDE "engine/mysterygift2.asm"
-Function2c76f: ; 2c76f (b:476f)
- ld a, $1
- ld [hInMenu], a
- call Function2c8d3
- ld a, $0
- ld [hInMenu], a
- ret nc
- call Function1bee
- call WaitBGMap
- ld a, [CurItem]
- dec a
- ld [wd107], a
- ld hl, TMsHMs
- ld c, a
- ld b, $0
- add hl, bc
- ld a, [hl]
- ld [wItemQuantityBuffer], a
- call Function2c798
- scf
- ret
+INCLUDE "engine/tmhm2.asm"
-Function2c798: ; 2c798 (b:4798)
- ld a, [CurItem]
- ld c, a
- callab GetNumberedTMHM
- ld a, c
- ld [CurItem], a
- ret
-
-ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7)
- ld a, [CurItem]
- ld c, a
- callab GetTMHMNumber
- ld a, c
- ld [wCurTMHM], a
- ret
-
-GetTMHMItemMove: ; 2c7b6 (b:47b6)
- call ConvertCurItemIntoCurTMHM
- predef GetTMHMMove
- ret
-
-Function2c7bf: ; 2c7bf (b:47bf)
- ld hl, Options
- ld a, [hl]
- push af
- res 4, [hl]
- ld a, [CurItem]
- cp TM01
- jr c, .NotTMHM
- call GetTMHMItemMove
- ld a, [wCurTMHM]
- ld [wPutativeTMHMMove], a
- call GetMoveName
- call CopyName1
- ld hl, UnknownText_0x2c8bf ; Booted up a TM
- ld a, [CurItem]
- cp HM01
- jr c, .TM
- ld hl, UnknownText_0x2c8c4 ; Booted up an HM
-.TM
- call PrintText
- ld hl, UnknownText_0x2c8c9
- call PrintText
- call YesNoBox
-.NotTMHM
- pop bc
- ld a, b
- ld [Options], a
- ret
-
-
-Function2c7fb: ; 2c7fb
- ld hl, StringBuffer2
- ld de, wd066
- ld bc, $c
- call CopyBytes
- call ClearBGPalettes
-
-Function2c80a: ; 2c80a
- callba LoadPartyMenuGFX
- callba InitPartyMenuWithCancel
- callba InitPartyMenuGFX
- ld a, $3
- ld [PartyMenuActionText], a
-.loopback
- callba WritePartyMenuTilemap
- callba PrintPartyMenuText
- call WaitBGMap
- call SetPalettes
- call DelayFrame
- callba PartyMenuSelect
- push af
- ld a, [CurPartySpecies]
- cp EGG
- pop bc ; now contains the former contents of af
- jr z, .egg
- push bc
- ld hl, wd066
- ld de, StringBuffer2
- ld bc, $c
- call CopyBytes
- pop af ; now contains the original contents of af
- ret
-
-.egg
- push hl
- push de
- push bc
- push af
- ld de, SFX_WRONG
- call PlaySFX
- call WaitSFX
- pop af
- pop bc
- pop de
- pop hl
- jr .loopback
-; 2c867
-
-Function2c867: ; 2c867
- predef CanLearnTMHMMove
-
- push bc
- ld a, [CurPartyMon]
- ld hl, PartyMonNicknames
- call GetNick
- pop bc
-
- ld a, c
- and a
- jr nz, .compatible
- push de
- ld de, SFX_WRONG
- call PlaySFX
- pop de
- ld hl, UnknownText_0x2c8ce
- call PrintText
- jr .nope
-
-.compatible
- callab KnowsMove
- jr c, .nope
-
- predef LearnMove
- ld a, b
- and a
- jr z, .nope
-
- callba MobileFn_106049
- ld a, [CurItem]
- call IsHM
- ret c
-
- ld c, HAPPINESS_LEARNMOVE
- callab ChangeHappiness
- call Function2cb0c
- jr .asm_2c8bd
-
-.nope
- and a
- ret
-
-.asm_2c8b8
- ld a, $2
- ld [wd0ec], a
-
-.asm_2c8bd
- scf
- ret
-; 2c8bf (b:48bf)
-
-UnknownText_0x2c8bf: ; 0x2c8bf
- ; Booted up a TM.
- text_jump UnknownText_0x1c0373
- db "@"
-; 0x2c8c4
-
-UnknownText_0x2c8c4: ; 0x2c8c4
- ; Booted up an HM.
- text_jump UnknownText_0x1c0384
- db "@"
-; 0x2c8c9
-
-UnknownText_0x2c8c9: ; 0x2c8c9
- ; It contained @ . Teach @ to a #MON?
- text_jump UnknownText_0x1c0396
- db "@"
-; 0x2c8ce
-
-UnknownText_0x2c8ce: ; 0x2c8ce
- ; is not compatible with @ . It can't learn @ .
- text_jump UnknownText_0x1c03c2
- db "@"
-; 0x2c8d3
-
-Function2c8d3: ; 2c8d3 (b:48d3)
- xor a
- ld [hBGMapMode], a
- call Function2c9e2
- ld a, $2
- ld [wcfa1], a
- ld a, $7
- ld [wcfa2], a
- ld a, $1
- ld [wcfa4], a
- ld a, $5
- sub d
- inc a
- cp $6
- jr nz, .asm_2c8f1
- dec a
-.asm_2c8f1
- ld [wcfa3], a
- ld a, $c
- ld [wcfa5], a
- xor a
- ld [wcfa6], a
- ld a, $20
- ld [wcfa7], a
- ld a, $f3
- ld [wcfa8], a
- ld a, [wTMHMPocketCursor]
- inc a
- ld [MenuSelection2], a
- ld a, $1
- ld [wcfaa], a
- jr Function2c946
-
-Function2c915: ; 2c915 (b:4915)
- call Function2c9e2
- call Function1bc9
- ld b, a
- ld a, [MenuSelection2]
- dec a
- ld [wTMHMPocketCursor], a
- xor a
- ld [hBGMapMode], a
- ld a, [wcfa6]
- bit 7, a
- jp nz, Function2c9b1
- ld a, b
- ld [wcf73], a
- bit 0, a
- jp nz, Function2c974
- bit 1, a
- jp nz, Function2c9a5
- bit 4, a
- jp nz, Function2c9af
- bit 5, a
- jp nz, Function2c9af
-
-Function2c946: ; 2c946 (b:4946)
- call Function2c98a
- jp nc, Function2c9af
- hlcoord 0, 12
- ld b, $4
- ld c, $12
- call TextBox
- ld a, [CurItem]
- cp $3a
- jr nc, Function2c915
- ld [wd265], a
- predef GetTMHMMove
- ld a, [wd265]
- ld [CurSpecies], a
- hlcoord 1, 14
- call PrintMoveDesc
- jp Function2c915
-
-Function2c974: ; 2c974 (b:4974)
- call Function2cad6
- call Function2cb2a
- ld a, [MenuSelection2]
- dec a
- ld b, a
- ld a, [wTMHMPocketScrollPosition]
- add b
- ld b, a
- ld a, [wd265]
- cp b
- jr z, asm_2c9a8
-
-Function2c98a: ; 2c98a (b:498a)
- call Function2cab5
- ld a, [MenuSelection2]
- ld b, a
-.asm_2c991
- inc c
- ld a, c
- cp $3a
- jr nc, .asm_2c99f
- ld a, [hli]
- and a
- jr z, .asm_2c991
- dec b
- jr nz, .asm_2c991
- ld a, c
-.asm_2c99f
- ld [CurItem], a
- cp $ff
- ret
-
-Function2c9a5: ; 2c9a5 (b:49a5)
- call Function2cad6
-
-asm_2c9a8: ; 2c9a8 (b:49a8)
- ld a, $2
- ld [wcf73], a
- and a
- ret
-
-Function2c9af: ; 2c9af (b:49af)
- and a
- ret
-
-Function2c9b1: ; 2c9b1 (b:49b1)
- ld a, b
- bit 7, a
- jr nz, .skip
- ld hl, wTMHMPocketScrollPosition
- ld a, [hl]
- and a
- jp z, Function2c915
- dec [hl]
- call Function2c9e2
- jp Function2c946
-
-.skip
- call Function2cab5
- ld b, $5
-.loop
- inc c
- ld a, c
- cp NUM_TMS + NUM_HMS + 1
- jp nc, Function2c915
- ld a, [hli]
- and a
- jr z, .loop
- dec b
- jr nz, .loop
- ld hl, wTMHMPocketScrollPosition
- inc [hl]
- call Function2c9e2
- jp Function2c946
-
-Function2c9e2: ; 2c9e2 (b:49e2)
- ld a, [BattleType]
- cp BATTLETYPE_TUTORIAL
- jp z, Function2caca
-
- hlcoord 5, 2
- lb bc, 10, 15
- ld a, " "
- call ClearBox
- call Function2cab5
- ld d, $5
-.loop2
- inc c
- ld a, c
- cp NUM_TMS + NUM_HMS + 1
- jr nc, .NotTMHM
- ld a, [hli]
- and a
- jr z, .loop2
- ld b, a
- ld a, c
- ld [wd265], a
- push hl
- push de
- push bc
- call Function2ca86
- push hl
- ld a, [wd265]
- cp NUM_TMS + 1
- jr nc, .HM
- ld de, wd265
- lb bc, PRINTNUM_LEADINGZEROS | 1, 2
- call PrintNum
- jr .okay
-
-.HM
- push af
- sub NUM_TMS
- ld [wd265], a
- ld [hl], "H"
- inc hl
- ld de, wd265
- lb bc, PRINTNUM_RIGHTALIGN | 1, 2
- call PrintNum
- pop af
- ld [wd265], a
-.okay
- predef GetTMHMMove
- ld a, [wd265]
- ld [wPutativeTMHMMove], a
- call GetMoveName
- pop hl
- ld bc, $3
- add hl, bc
- push hl
- call PlaceString
- pop hl
- pop bc
- ld a, c
- push bc
- cp NUM_TMS + 1
- jr nc, .hm2
- ld bc, $1d
- add hl, bc
- ld [hl], $f1
- inc hl
- ld a, "0" ; why are we doing this?
- pop bc
- push bc
- ld a, b
- ld [wd265], a
- ld de, wd265
- lb bc, 1, 2
- call PrintNum
-.hm2
- pop bc
- pop de
- pop hl
- dec d
- jr nz, .loop2
- jr .done
-
-.NotTMHM
- call Function2ca86
-rept 3
- inc hl
-endr
- push de
- ld de, String_2caae
- call PlaceString
- pop de
-.done
- ret
-
-Function2ca86: ; 2ca86 (b:4a86)
- hlcoord 5, 0
- ld bc, $28
- ld a, 6
- sub d
- ld e, a
-.loop
- add hl, bc
- dec e
- jr nz, .loop
- ret
-; 2ca95 (b:4a95)
-
-Function2ca95: ; 2ca95
- pop hl
- ld bc, 3
- add hl, bc
- predef GetTMHMMove
- ld a, [wd265]
- ld [wPutativeTMHMMove], a
- call GetMoveName
- push hl
- call PlaceString
- pop hl
- ret
-; 2caae
-
-String_2caae: ; 2caae
- db "CANCEL@"
-; 2cab5
-
-Function2cab5: ; 2cab5 (b:4ab5)
- ld hl, TMsHMs
- ld a, [wTMHMPocketScrollPosition]
- ld b, a
- inc b
- ld c, 0
-.loop
- inc c
- ld a, [hli]
- and a
- jr z, .loop
- dec b
- jr nz, .loop
- dec hl
- dec c
- ret
-
-Function2caca: ; 2caca (b:4aca)
- hlcoord 9, 3
- push de
- ld de, String_2caae
- call PlaceString
- pop de
- ret
-
-Function2cad6: ; 2cad6 (b:4ad6)
- push de
- ld de, SFX_READ_TEXT_2
- call PlaySFX
- pop de
- ret
-; 2cadf (b:4adf)
-
-Function2cadf: ; 2cadf
- call ConvertCurItemIntoCurTMHM
- call Function2cafa
- ld hl, UnknownText_0x2caf0
- jr nc, .asm_2caed
- ld hl, UnknownText_0x2caf5
-
-.asm_2caed
- jp PrintText
-; 2caf0
-
-UnknownText_0x2caf0: ; 0x2caf0
- ; You have no room for any more @ S.
- text_jump UnknownText_0x1c03fa
- db "@"
-; 0x2caf5
-
-UnknownText_0x2caf5: ; 0x2caf5
- ; You received @ !
- text_jump UnknownText_0x1c0421
- db "@"
-; 0x2cafa
-
-Function2cafa: ; 2cafa
- ld a, [wd265]
- dec a
- ld hl, TMsHMs
- ld b, 0
- ld c, a
- add hl, bc
- ld a, [hl]
- inc a
- cp NUM_TMS * 2
- ret nc
- ld [hl], a
- ret
-; 2cb0c
-
-Function2cb0c: ; 2cb0c (b:4b0c)
- call ConvertCurItemIntoCurTMHM
- ld a, [wd265]
- dec a
- ld hl, TMsHMs
- ld b, 0
- ld c, a
- add hl, bc
- ld a, [hl]
- and a
- ret z
- dec a
- ld [hl], a
- ret nz
- ld a, [wTMHMPocketScrollPosition]
- and a
- ret z
- dec a
- ld [wTMHMPocketScrollPosition], a
- ret
-
-Function2cb2a: ; 2cb2a (b:4b2a)
- ld b, $0
- ld c, $39
- ld hl, TMsHMs
-.asm_2cb31
- ld a, [hli]
- and a
- jr z, .asm_2cb36
- inc b
-.asm_2cb36
- dec c
- jr nz, .asm_2cb31
- ld a, b
- ld [wd265], a
- ret
-
-
-PrintMoveDesc: ; 2cb3e
- push hl
- ld hl, MoveDescriptions
- ld a, [CurSpecies]
- dec a
- ld c, a
- ld b, 0
-rept 2
- add hl, bc
-endr
- ld a, [hli]
- ld e, a
- ld d, [hl]
- pop hl
- jp PlaceString
-; 2cb52
-
MoveDescriptions:: ; 2cb52
INCLUDE "battle/moves/move_descriptions.asm"
; 2ed44
-
Function2ed44: ; 2ed44
call ConvertBerriesToBerryJuice
ld hl, PartyMon1PokerusStatus
@@ -12780,7 +11285,6 @@
ret
; 2ee2f
-
FindFirstAliveMon: ; 2ee2f
xor a
ld [hMapAnims], a
@@ -12816,7 +11320,6 @@
ret
; 2ee6c
-
PlayBattleMusic: ; 2ee6c
push hl
@@ -12919,7 +11422,6 @@
ret
; 2ef18
-
ClearBattleRAM: ; 2ef18
xor a
ld [wd0ec], a
@@ -12971,7 +11473,6 @@
ret
; 2ef6e
-
FillBox: ; 2ef6e
; Fill wc2c6-aligned box width b height c
; with iterating tile starting from hFillBox at hl.
@@ -13030,17 +11531,14 @@
ret
; 2ef9f
-
SECTION "Tileset Data 4", ROMX, BANK[TILESETS_4]
INCLUDE "tilesets/data_4.asm"
-
SECTION "Effect Commands", ROMX, BANK[$D]
INCLUDE "battle/effect_commands.asm"
-
SECTION "Enemy Trainers", ROMX, BANK[$E]
INCLUDE "battle/ai/items.asm"
@@ -13048,7 +11546,6 @@
AIScoring: ; 38591
INCLUDE "battle/ai/scoring.asm"
-
GetTrainerClassName: ; 3952d
ld hl, RivalName
ld a, c
@@ -13125,7 +11622,6 @@
INCLUDE "trainers/trainers.asm"
-
SECTION "Battle Core", ROMX, BANK[$F]
INCLUDE "battle/core.asm"
@@ -13132,10 +11628,8 @@
INCLUDE "battle/effect_command_pointers.asm"
-
SECTION "bank10", ROMX, BANK[$10]
-
INCLUDE "engine/pokedex.asm"
INCLUDE "battle/moves/moves.asm"
@@ -13190,7 +11684,6 @@
db -2
; 44207
-
DoDexSearchSlowpokeFrame: ; 44207
ld a, [wDexSearchSlowpokeFrame]
ld hl, .SpriteData
@@ -13447,7 +11940,6 @@
ret
; 44378
-
PokedexDataPointerTable: ; 0x44378
INCLUDE "data/pokedex/entry_pointers.asm"
@@ -13571,7 +12063,6 @@
GFX_48e71: ; 48e71
INCBIN "gfx/unknown/048e71.2bpp"
-
DrawKrisPackGFX: ; 48e81
ld hl, PackFGFXPointers
rept 2
@@ -13606,54 +12097,52 @@
call GetSGBLayout
xor a
ld [wItemAttributeParamBuffer], a
- call Function492a5
+ call .GetMoveTutorMove
ld [wd265], a
ld [wPutativeTMHMMove], a
call GetMoveName
call CopyName1
- callba Function2c7fb
- jr c, .asm_4929c
- jr .asm_49291
+ callba ChooseMonToLearnTMHM
+ jr c, .cancel
+ jr .enter_loop
-.asm_49289
- callba Function2c80a
- jr c, .asm_4929c
-
-.asm_49291
- call Function492b9
- jr nc, .asm_49289
+.loop
+ callba ChooseMonToLearnTMHM_NoRefresh
+ jr c, .cancel
+.enter_loop
+ call CheckCanLearnMoveTutorMove
+ jr nc, .loop
xor a
ld [ScriptVar], a
- jr .asm_492a1
+ jr .quit
-.asm_4929c
- ld a, $ff
+.cancel
+ ld a, -1
ld [ScriptVar], a
-
-.asm_492a1
+.quit
call CloseSubmenu
ret
; 492a5
-Function492a5: ; 492a5
+.GetMoveTutorMove: ; 492a5
ld a, [ScriptVar]
- cp $1
- jr z, .asm_492b3
- cp $2
- jr z, .asm_492b6
+ cp 1
+ jr z, .flamethrower
+ cp 2
+ jr z, .thunderbolt
ld a, ICE_BEAM
ret
-.asm_492b3
+.flamethrower
ld a, FLAMETHROWER
ret
-.asm_492b6
+.thunderbolt
ld a, THUNDERBOLT
ret
; 492b9
-Function492b9: ; 492b9
+CheckCanLearnMoveTutorMove: ; 492b9
ld hl, MenuDataHeader_0x4930a
call LoadMenuDataHeader
@@ -13672,12 +12161,12 @@
ld de, SFX_WRONG
call PlaySFX
pop de
- ld a, BANK(UnknownText_0x2c8ce)
- ld hl, UnknownText_0x2c8ce
+ ld a, BANK(Text_TMHMNotCompatible)
+ ld hl, Text_TMHMNotCompatible
call FarPrintText
jr .didnt_learn
-.can_learn
+.can_learn
callab KnowsMove
jr c, .didnt_learn
@@ -13754,7 +12243,6 @@
ret
; 49346
-
Function49346: ; 49346 (12:5346)
hlcoord 0, 0, AttrMap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
@@ -13848,7 +12336,6 @@
RGB 00, 00, 00
; 49409
-
Function49409:: ; 49409
ld hl, Palette_49418
ld de, UnknBGPals + 8 * 7
@@ -14401,7 +12888,6 @@
ret
; 4ae78
-
SECTION "bank13", ROMX, BANK[$13]
SwapTextboxPalettes:: ; 4c000
@@ -14493,10 +12979,8 @@
ret
; 4c075
-
INCLUDE "tilesets/palette_maps.asm"
-
TileCollisionTable:: ; 4ce1f
; 00 land
; 01 water
@@ -14563,7 +13047,6 @@
ret
; 4cf45
-
SaveMenu_LoadEDTile: ; 4cf45 (13:4f45)
ld a, [hCGB]
and a
@@ -14642,7 +13125,6 @@
ld sp, hl
ret
-
CheckSave:: ; 4cffe
ld a, BANK(s1_a008)
call GetSRAMBank
@@ -14665,10 +13147,8 @@
ret
; 4d01e
-
INCLUDE "engine/map_triggers.asm"
-
Function4d15b:: ; 4d15b
ld hl, wc608
ld a, [wd196]
@@ -14824,7 +13304,6 @@
ret
; 4d35b
-
Function4d35b: ; 4d35b
ld h, d
ld l, e
@@ -15219,7 +13698,6 @@
Tilesets::
INCLUDE "tilesets/tileset_headers.asm"
-
FlagPredef: ; 4d7c1
; Perform action b on flag c in flag array hl.
; If checking a flag, check flag array d:hl unless d is 0.
@@ -15749,7 +14227,6 @@
ret
; 4db3b
-
GiveANickname_YesNo: ; 4db3b
ld hl, TextJump_GiveANickname
call PrintText
@@ -15762,7 +14239,6 @@
db "@"
; 0x4db49
-
SetCaughtData: ; 4db49
ld a, [PartyCount]
dec a
@@ -15839,7 +14315,6 @@
ret
; 4dbb8
-
SetEggMonCaughtData: ; 4dbb8 (13:5bb8)
ld a, [CurPartyMon]
ld hl, PartyMon1CaughtLevel
@@ -15996,7 +14471,6 @@
jr .loop
; 4dc7b
-
INCLUDE "engine/stats_screen.asm"
CatchTutorial:: ; 4e554
@@ -16056,26 +14530,26 @@
ret
.LoadDudeData: ; 4e5b7 (13:65b7)
- ld hl, OTPartyMon1
- ld [hl], BULBASAUR
+ ld hl, wDudeNumItems
+ ld [hl], 1
inc hl
ld [hl], POTION
inc hl
- ld [hl], POUND
+ ld [hl], 1
inc hl
- ld [hl], $ff
- ld hl, OTPartyMon1Exp + 2
- ld [hl], $0
+ ld [hl], -1
+ ld hl, wDudeNumKeyItems
+ ld [hl], 0
inc hl
- ld [hl], $ff
- ld hl, OTPartyMon1CaughtGender
- ld a, $1
+ ld [hl], -1
+ ld hl, wDudeNumBalls
+ ld a, 1
ld [hli], a
- ld a, $5
+ ld a, POKE_BALL ; 5
rept 2
ld [hli], a
endr
- ld [hl], $ff
+ ld [hl], -1
ret
; 4e5da (13:65da)
@@ -16121,7 +14595,6 @@
db "@"
; 0x4e8c2
-
Function4e8c2: ; 4e8c2
call ClearBGPalettes
call ClearTileMap
@@ -16174,7 +14647,6 @@
ret
; 4e929
-
Function4e929: ; mobile function
ld h, b
ld l, c
@@ -16265,10 +14737,8 @@
FemaleTrainersEnd:
; 4e980
-
INCLUDE "battle/sliding_intro.asm"
-
Function4ea0a: ; 4ea0a
ld a, c
push af
@@ -16301,8 +14771,6 @@
ret
; 4ea44
-
-
CheckBattleScene: ; 4ea44
; Return carry if battle scene is turned off.
@@ -16352,12 +14820,10 @@
ret
; 4ea82
-
INCLUDE "misc/gbc_only.asm"
INCLUDE "event/poke_seer.asm"
-
SECTION "bank14", ROMX, BANK[$14]
INCLUDE "engine/party_menu.asm"
@@ -16403,7 +14869,6 @@
ret
; 5088b
-
Function5088b: ; 5088b
ld bc, wd018_Mon
jr Function50893
@@ -16504,10 +14969,8 @@
ret
; 5090d
-
INCLUDE "text/types.asm"
-
Function50a28: ; 50a28
ld hl, Strings50a42
ld a, [TrainerClass]
@@ -16604,7 +15067,6 @@
.CooltrainerF db "エりート♀@"
; 50b0a
-
DrawPlayerHP: ; 50b0a
ld a, $1
jr DrawHP
@@ -16689,7 +15151,6 @@
ret
; 50b7b
-
PrintTempMonStats: ; 50b7b
; Print TempMon's stats at hl, with spacing bc.
push bc
@@ -16732,7 +15193,6 @@
next "@"
; 50bdd
-
GetGender: ; 50bdd
; Return the gender of a given monster (CurPartyMon/CurOTMon/CurWildMon).
; When calling this function, a should be set to an appropriate MonType value.
@@ -16745,7 +15205,6 @@
; This is determined by comparing the Attack and Speed DVs
; with the species' gender ratio.
-
; Figure out what type of monster struct we're looking at.
; 0: PartyMon
@@ -16775,7 +15234,6 @@
ld hl, EnemyMonDVs
jr .DVs
-
; Get our place in the party/box.
.PartyMon
@@ -16783,7 +15241,6 @@
ld a, [CurPartyMon]
call AddNTimes
-
.DVs
; sBoxMon data is read directly from SRAM.
@@ -16810,7 +15267,6 @@
cp BOXMON
call z, CloseSRAM
-
; We need the gender ratio to do anything with this.
push bc
ld a, [CurPartySpecies]
@@ -16823,7 +15279,6 @@
ld a, BANK(BaseData)
call GetFarByte
-
; The higher the ratio, the more likely the monster is to be female.
cp $ff
@@ -16985,7 +15440,6 @@
ret
; 50d0a
-
PlaceStatusString: ; 50d0a
push de
rept 2
@@ -17171,7 +15625,6 @@
ret
; 50e1b
-
CalcLevel: ; 50e1b
ld a, [TempMonSpecies]
ld [CurSpecies], a
@@ -17205,8 +15658,6 @@
ret
; 50e47
-
-
CalcExpAtLevel: ; 50e47
; (a/b)*n**3 + c*n**2 + d*n - e
ld a, [BaseGrowthRate]
@@ -17557,7 +16008,6 @@
ret
; 51077
-
GetFrontpic: ; 51077
ld a, [CurPartySpecies]
ld [CurSpecies], a
@@ -17765,7 +16215,6 @@
ret
; 511c5
-
FixPicBank: ; 511c5
; This is a thing for some reason.
push hl
@@ -17827,7 +16276,6 @@
ret
; 0x5120d
-
GetTrainerPic: ; 5120d
ld a, [TrainerClass]
and a
@@ -17871,8 +16319,6 @@
ret
; 5125d
-
-
DecompressPredef: ; 5125d
; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de.
@@ -17898,7 +16344,6 @@
ret
; 5127c
-
Function5127c: ; 5127c
push de
push bc
@@ -18182,16 +16627,12 @@
INCBIN "gfx/misc/unknown_egg.5x5.2bpp.lz"
; 53e2e
-
SECTION "bank19", ROMX, BANK[$19]
INCLUDE "text/phone/extra.asm"
-
-
SECTION "bank20", ROMX, BANK[$20]
-
DoPlayerMovement:: ; 80000
call GetMovementInput
@@ -18206,7 +16647,6 @@
ret
; 80017
-
GetMovementInput: ; 80017
ld a, [hJoyDown]
@@ -18228,7 +16668,6 @@
ret
; 8002d
-
GetPlayerMovement: ; 8002d
ld a, [PlayerState]
@@ -18312,7 +16751,6 @@
ret
; 800b7
-
CheckTileMovement: ; 800b7
; Tiles such as waterfalls and warps move the player
; in a given direction, overriding input.
@@ -18428,7 +16866,6 @@
ret
; 80147
-
CheckTurning: ; 80147
; If the player is turning, change direction first. This also lets
; the player change facing without moving by tapping a direction.
@@ -18459,7 +16896,6 @@
ret
; 8016b
-
TryStep: ; 8016b
; Surfing actually calls TrySurfStep directly instead of passing through here.
@@ -18526,7 +16962,6 @@
ret
; 801c0
-
TrySurfStep: ; 801c0
call CheckWaterPermissions
@@ -18563,7 +16998,6 @@
ret
; 801f3
-
TryJumpLedge: ; 801f3
ld a, [PlayerNextTile]
ld e, a
@@ -18604,7 +17038,6 @@
db FACE_UP | FACE_LEFT
; 80226
-
CheckEdgeWarp: ; 80226
; Bug: Since no case is made for STANDING here, it will check
@@ -18650,7 +17083,6 @@
db $70, $78, $76, $7e
; 8025f
-
DoStep: ; 8025f
ld e, a
ld d, 0
@@ -18731,7 +17163,6 @@
db $80 + movement_turn_head_right
; 802b3
-
StandInPlace: ; 802b3
ld a, 0
ld [wd04e], a
@@ -18741,7 +17172,6 @@
ret
; 802bf
-
WalkInPlace: ; 802bf
ld a, 0
ld [wd04e], a
@@ -18751,7 +17181,6 @@
ret
; 802cb
-
CheckForcedMovementInput: ; 802cb
; When sliding on ice, input is forced to remain in the same direction.
@@ -18777,7 +17206,6 @@
db D_DOWN, D_UP, D_LEFT, D_RIGHT
; 802ec
-
GetMovementAction: ; 802ec
; Poll player input and update movement info.
@@ -18837,7 +17265,6 @@
dw TileDown
; 80341
-
IsNPCInFront: ; 80341
; Returns 0 if there is an NPC in front that you can't move
; Returns 1 if there is no NPC in front
@@ -18876,7 +17303,6 @@
ret
; 8036f
-
Function8036f: ; 8036f
ld hl, BikeFlags
@@ -18915,7 +17341,6 @@
ret
; 8039e
-
CheckLandPermissions: ; 8039e
; Return 0 if walking onto land and tile permissions allow it.
; Otherwise, return carry.
@@ -18960,7 +17385,6 @@
ret
; 803ca
-
CheckRiding: ; 803ca
ld a, [PlayerState]
@@ -18970,7 +17394,6 @@
ret
; 803d3
-
CheckWalkable: ; 803d3
; Return 0 if tile a is land. Otherwise, return carry.
@@ -18981,7 +17404,6 @@
ret
; 803da
-
CheckSurfable: ; 803da
; Return 0 if tile a is water, or 1 if land.
; Otherwise, return carry.
@@ -19010,7 +17432,6 @@
ret
; 803ee
-
PlayBump: ; 803ee
call CheckSFX
@@ -19020,7 +17441,6 @@
ret
; 803f9
-
WaterToLandSprite: ; 803f9
push bc
ld a, PLAYER_NORMAL
@@ -19030,7 +17450,6 @@
ret
; 80404
-
CheckStandingOnIce:: ; 80404
ld a, [wd04e]
cp 0
@@ -19053,7 +17472,6 @@
ret
; 80422
-
Function80422:: ; 80422
ld hl, wc2de
ld a, movement_step_sleep_1
@@ -19066,8 +17484,6 @@
ret
; 80430
-
-
INCLUDE "engine/engine_flags.asm"
; 80648
@@ -19272,7 +17688,6 @@
INCBIN "gfx/misc/trainer_card.2bpp"
; 88825
-
GetPlayerBackpic: ; 88825
ld a, [PlayerGender]
bit 0, a
@@ -19319,8 +17734,6 @@
ret
; 88874
-
-
DrawIntroPlayerPic: ; 88874
; Draw the player pic at (6,4).
@@ -19355,7 +17768,6 @@
ret
; 888a9
-
ChrisPic: ; 888a9
INCBIN "gfx/misc/chris.7x7.2bpp"
; 88bb9
@@ -19364,7 +17776,6 @@
INCBIN "gfx/misc/kris.7x7.2bpp"
; 88ec9
-
GetKrisBackpic: ; 88ec9
; Kris's backpic is uncompressed.
ld de, KrisBackpic
@@ -19378,7 +17789,6 @@
INCBIN "gfx/misc/kris_back.6x6.2bpp"
; 89116
-
String_89116:
db "-----@"
; 8911c
@@ -19390,7 +17800,6 @@
INCLUDE "event/battle_tower.asm"
INCLUDE "misc/mobile_22_2.asm"
-
SECTION "bank23", ROMX, BANK[$23]
Predef35: ; 8c000
@@ -19398,7 +17807,6 @@
ret
; 8c001
-
INCLUDE "engine/timeofdaypals.asm"
INCLUDE "engine/battle_start.asm"
@@ -19432,13 +17840,11 @@
INCLUDE "data/wild/fish.asm"
INCLUDE "engine/slot_machine.asm"
-
SECTION "Phone Engine", ROMX, BANK[$28]
INCLUDE "engine/more_phone_scripts.asm"
INCLUDE "engine/buena_phone_scripts.asm"
-
SECTION "Phone Text", ROMX, BANK[$29]
INCLUDE "text/phone/anthony_overworld.asm"
@@ -19463,7 +17869,6 @@
INCLUDE "tilesets/data_5.asm"
-
SECTION "bank2E", ROMX, BANK[$2E]
INCLUDE "engine/events_3.asm"
@@ -19513,8 +17918,6 @@
scripttalkafter
; 0xbe699
-
-
SECTION "bank30", ROMX, BANK[$30]
INCLUDE "gfx/overworld/sprites_1.asm"
@@ -19523,7 +17926,6 @@
INCLUDE "gfx/overworld/sprites_2.asm"
-
SECTION "bank32", ROMX, BANK[$32]
INCLUDE "battle/bg_effects.asm"
@@ -19585,7 +17987,6 @@
INCBIN "gfx/credits/theend.2bpp"
; cbe2e
-
SECTION "bank33", ROMX, BANK[$33]
DisplayCaughtContestMonStats: ; cc000
@@ -19702,12 +18103,10 @@
ret
; cc0d6
-
INCLUDE "battle/anim_commands.asm"
INCLUDE "battle/anim_objects.asm"
-
SECTION "Pic Animations 1", ROMX, BANK[$34]
INCLUDE "gfx/pics/animation.asm"
@@ -19748,18 +18147,15 @@
INCLUDE "gfx/pics/unown_bitmask_pointers.asm"
INCLUDE "gfx/pics/unown_bitmasks.asm"
-
SECTION "Pic Animations 2", ROMX, BANK[$35]
INCLUDE "gfx/pics/frame_pointers.asm"
INCLUDE "gfx/pics/kanto_frames.asm"
-
SECTION "bank36", ROMX, BANK[$36]
FontInversed: INCBIN "gfx/misc/font_inversed.1bpp"
-
SECTION "Pic Animations 3", ROMX, BANK[$36]
INCLUDE "gfx/pics/johto_frames.asm"
@@ -19766,12 +18162,10 @@
INCLUDE "gfx/pics/unown_frame_pointers.asm"
INCLUDE "gfx/pics/unown_frames.asm"
-
SECTION "Tileset Data 6", ROMX, BANK[TILESETS_6]
INCLUDE "tilesets/data_6.asm"
-
SECTION "bank38", ROMX, BANK[$38]
Functione0000: ; e0000
@@ -19936,7 +18330,6 @@
INCLUDE "misc/mobile_40.asm"
-
SECTION "bank41", ROMX, BANK[$41]
INCLUDE "misc/gfx_41.asm"
@@ -19951,7 +18344,6 @@
INCLUDE "misc/mobile_42.asm"
-
SECTION "Intro Logo", ROMX, BANK[$42]
IntroLogoGFX: ; 109407
@@ -19958,13 +18350,10 @@
INCBIN "gfx/intro/logo.2bpp.lz"
; 109847
-
INCLUDE "misc/unused_title.asm"
-
INCLUDE "engine/title.asm"
-
INCLUDE "misc/mobile_45.asm"
INCLUDE "misc/mobile_46.asm"
@@ -19984,7 +18373,6 @@
INCLUDE "text/phone/extra3.asm"
-
SECTION "bank5E", ROMX, BANK[$5E]
_UpdateBattleHUDs:
@@ -19998,10 +18386,8 @@
ret
; 17801f (5e:401f)
-
INCLUDE "misc/mobile_5f.asm"
-
SECTION "Common Text 1", ROMX, BANK[$6C]
INCLUDE "text/common.asm"
@@ -20024,23 +18410,18 @@
INCLUDE "text/phone/elm.asm"
INCLUDE "text/phone/trainers1.asm"
-
-
SECTION "Common Text 2", ROMX, BANK[$6F]
INCLUDE "text/common_2.asm"
-
SECTION "Common Text 3", ROMX, BANK[$70]
INCLUDE "text/common_3.asm"
-
SECTION "Common Text 4", ROMX, BANK[$71]
INCLUDE "text/common_4.asm"
-
SECTION "bank72", ROMX, BANK[$72]
ItemNames::
@@ -20053,13 +18434,10 @@
INCLUDE "engine/landmarks.asm"
-
SECTION "bank75", ROMX, BANK[$75]
-
SECTION "bank76", ROMX, BANK[$76]
-
SECTION "bank77", ROMX, BANK[$77]
UnownFont: ; 1dc000
@@ -20074,14 +18452,10 @@
MobileLvIcon: ; 1dc599
INCBIN "gfx/mobile/lv.1bpp"
-
-
SECTION "Tileset Data 7", ROMX, BANK[TILESETS_7]
INCLUDE "tilesets/data_7.asm"
-
-
SECTION "bank77_2", ROMX, BANK[$77]
Function1dd6a9: ; 1dd6a9
@@ -20151,10 +18525,8 @@
String_PM: db "PM@" ; 1dd6ff
; 1dd702
-
INCLUDE "engine/diploma.asm"
-
LoadSGBPokedexGFX: ; 1ddf1c
ld hl, LZ_1ddf33
ld de, VTiles2 tile $31
@@ -20326,8 +18698,6 @@
ret
; 1de28a
-
-
_DudeAutoInput_A:: ; 1de28a
ld hl, DudeAutoInput_A
jr _DudeAutoInput
@@ -20349,7 +18719,6 @@
ret
; 1de29f
-
DudeAutoInputs:
DudeAutoInput_A: ; 1de29f
@@ -20380,7 +18749,6 @@
db NO_INPUT, $ff ; end
; 1de2c5
-
Function1de2c5: ; 1de2c5
ld hl, StringBuffer1
.loop
@@ -20542,28 +18910,22 @@
ret
; 1df238
-
SECTION "Tileset Data 8", ROMX, BANK[TILESETS_8]
INCLUDE "tilesets/data_8.asm"
-
SECTION "bank79", ROMX, BANK[$79]
-
SECTION "bank7A", ROMX, BANK[$7A]
-
SECTION "bank7B", ROMX, BANK[$7B]
INCLUDE "text/battle_tower.asm"
-
SECTION "bank7C", ROMX, BANK[$7C]
INCLUDE "data/battle_tower_2.asm"
-
SECTION "bank7D", ROMX, BANK[$7D]
db $cc, $6b, $1e ; XXX
@@ -20610,15 +18972,12 @@
Unknown_1f5db4:
INCBIN "unknown/1f5db4.bin"
-
SECTION "bank7E", ROMX, BANK[$7E]
INCLUDE "data/battle_tower.asm"
INCLUDE "data/odd_eggs.asm"
-
SECTION "bank7F", ROMX, BANK[$7F]
-
SECTION "stadium2", ROMX[$8000-$220], BANK[$7F]
--- a/misc/mobile_22.asm
+++ b/misc/mobile_22.asm
@@ -1694,7 +1694,7 @@
Function89a8a: ; 89a8a
push af
- ld de, SFX_UNKNOWN_62
+ ld de, SFX_SWITCH_POCKETS
call PlaySFX
pop af
ret
--- /dev/null
+++ b/text/trainer_class_names.asm
@@ -1,0 +1,67 @@
+ db "LEADER@"
+ db "LEADER@"
+ db "LEADER@"
+ db "LEADER@"
+ db "LEADER@"
+ db "LEADER@"
+ db "LEADER@"
+ db "LEADER@"
+ db "RIVAL@"
+ db "#MON PROF.@"
+ db "ELITE FOUR@"
+ db "<PKMN> TRAINER@"
+ db "ELITE FOUR@"
+ db "ELITE FOUR@"
+ db "ELITE FOUR@"
+ db "CHAMPION@"
+ db "LEADER@"
+ db "LEADER@"
+ db "LEADER@"
+ db "SCIENTIST@"
+ db "LEADER@"
+ db "YOUNGSTER@"
+ db "SCHOOLBOY@"
+ db "BIRD KEEPER@"
+ db "LASS@"
+ db "LEADER@"
+ db "COOLTRAINER@"
+ db "COOLTRAINER@"
+ db "BEAUTY@"
+ db "#MANIAC@"
+ db "ROCKET@"
+ db "GENTLEMAN@"
+ db "SKIER@"
+ db "TEACHER@"
+ db "LEADER@"
+ db "BUG CATCHER@"
+ db "FISHER@"
+ db "SWIMMER♂@"
+ db "SWIMMER♀@"
+ db "SAILOR@"
+ db "SUPER NERD@"
+ db "RIVAL@"
+ db "GUITARIST@"
+ db "HIKER@"
+ db "BIKER@"
+ db "LEADER@"
+ db "BURGLAR@"
+ db "FIREBREATHER@"
+ db "JUGGLER@"
+ db "BLACKBELT@"
+ db "ROCKET@"
+ db "PSYCHIC@"
+ db "PICNICKER@"
+ db "CAMPER@"
+ db "ROCKET@"
+ db "SAGE@"
+ db "MEDIUM@"
+ db "BOARDER@"
+ db "#FAN@"
+ db "KIMONO GIRL@"
+ db "TWINS@"
+ db "#FAN@"
+ db "<PKMN> TRAINER@"
+ db "LEADER@"
+ db "OFFICER@"
+ db "ROCKET@"
+ db "MYSTICALMAN@"
\ No newline at end of file
--- a/wram.asm
+++ b/wram.asm
@@ -1471,6 +1471,7 @@
; something to do with menu
wcf71:: ds 1
wcf72:: ds 1
+wMenuJoypad::
wcf73:: ds 1
MenuSelection:: ; cf74
ds 1
@@ -1477,6 +1478,7 @@
wcf75:: ds 1
wcf76:: ds 1
+wCurrPocketCursorPosition::
wcf77:: ds 1
wcf78:: ds 9
@@ -1506,10 +1508,15 @@
; bit 0: ????
wMenuData2Items:: ds 1
+wMenuData2IndicesPointer::
wcf93:: ds 1
wcf94:: ds 1
+wMenuData2DisplayFunctionPointer::
+wMenuData2Bank::
wcf95:: ds 1 ; bank
+wMenuData2Addr::
wcf96:: ds 1 ; addr lo
+wMenuData2PointerTableAddr::
wcf97:: ds 1 ; addr hi
wcf98:: ds 3
wcf9b:: ds 3
@@ -1622,7 +1629,7 @@
wHoursSince:: ds 1
wDaysSince:: ds 1
- ds 40
+wRAM0End:: ; cfc0
SECTION "WRAM 1", WRAMX, BANK [1]
@@ -1851,6 +1858,7 @@
wTMHMPocketScrollPosition:: ds 1
wMoveSwapBuffer::
wSwitchMon::
+wSwitchItem::
wd0e3:: ds 1
wMenuScrollPosition:: ds 4
wQueuedScriptBank:: ds 1
@@ -1858,6 +1866,7 @@
wNumMoves::
wd0eb:: ds 1
wFieldMoveSucceeded::
+wItemEffectSucceeded::
wPlayerAction::
; 0 - use move
; 1 - use item
@@ -2284,6 +2293,21 @@
OTPartyCount:: ds 1 ; d280
OTPartySpecies:: ds PARTY_LENGTH ; d281
OTPartyEnd:: ds 1
+
+wDudeBag:: ; d288
+wDudeNumItems:: ds 1
+wDudeItems:: ds 2 * 4
+wDudeItemsEnd:: ds 1
+
+wDudeNumKeyItems:: ds 1 ; d292
+wDudeKeyItems:: ds 18
+wDudeKeyItemsEnd:: ds 1
+
+wDudeNumBalls:: ds 1 ; d2a6
+wDudeBalls:: ds 2 * 4
+wDudeBallsEnd:: ds 1
+wDudeBagEnd::
+ ds wDudeBag - @
OTPartyMons::
OTPartyMon1:: party_struct OTPartyMon1 ; d288