summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rwxr-xr-xengine/anim_hp_bar.asm6
-rw-r--r--engine/battle_tower.asm210
-rw-r--r--engine/battle_transition.asm (renamed from engine/battle_start.asm)86
-rwxr-xr-xengine/billspc.asm50
-rwxr-xr-xengine/billspctop.asm16
-rwxr-xr-xengine/breeding.asm (renamed from engine/breeding/egg.asm)34
-rwxr-xr-xengine/buy_sell_toss.asm4
-rwxr-xr-xengine/card_flip.asm85
-rw-r--r--engine/caught_data.asm247
-rw-r--r--engine/cgb_layouts.asm1071
-rwxr-xr-xengine/clock_reset.asm22
-rw-r--r--engine/color.asm956
-rw-r--r--engine/credits.asm708
-rwxr-xr-xengine/crystal_colors.asm336
-rwxr-xr-xengine/crystal_intro.asm575
-rwxr-xr-xengine/debug.asm95
-rwxr-xr-xengine/decorations.asm98
-rwxr-xr-xengine/delete_save_change_clock.asm10
-rw-r--r--engine/diploma.asm7
-rwxr-xr-xengine/dma_transfer.asm626
-rwxr-xr-xengine/dummy_game.asm8
-rw-r--r--engine/engine_flags.asm204
-rw-r--r--engine/european_mail.asm129
-rw-r--r--engine/events.asm110
-rw-r--r--engine/events_2.asm45
-rwxr-xr-xengine/events_3.asm223
-rwxr-xr-xengine/evolution_animation.asm14
-rwxr-xr-xengine/evolve.asm10
-rw-r--r--engine/experience.asm162
-rw-r--r--engine/facings.asm268
-rw-r--r--engine/fish.asm2
-rw-r--r--engine/fruit_trees.asm37
-rw-r--r--engine/gbc_only.asm149
-rwxr-xr-xengine/healmachineanim.asm265
-rwxr-xr-xengine/health.asm2
-rwxr-xr-xengine/init_gender.asm8
-rw-r--r--engine/init_hof_credits.asm79
-rw-r--r--engine/init_map.asm103
-rwxr-xr-xengine/intro_menu.asm142
-rw-r--r--engine/item_effects.asm3316
-rwxr-xr-xengine/items.asm4
-rw-r--r--engine/landmarks.asm208
-rwxr-xr-xengine/link.asm154
-rw-r--r--engine/link_2.asm91
-rwxr-xr-xengine/link_trade.asm24
-rwxr-xr-xengine/mail.asm26
-rwxr-xr-xengine/main_menu.asm10
-rwxr-xr-xengine/map_object_action.asm52
-rw-r--r--engine/map_objects.asm117
-rw-r--r--engine/map_objects_2.asm70
-rw-r--r--engine/map_palettes.asm86
-rw-r--r--engine/map_setup.asm16
-rw-r--r--engine/map_triggers.asm91
-rwxr-xr-xengine/mart.asm64
-rwxr-xr-xengine/menu.asm10
-rw-r--r--engine/menu_2.asm263
-rwxr-xr-xengine/mon_icons.asm54
-rwxr-xr-xengine/mon_menu.asm15
-rw-r--r--engine/mon_stats.asm486
-rwxr-xr-xengine/money.asm4
-rw-r--r--engine/more_phone_scripts.asm1660
-rwxr-xr-xengine/move_mon.asm74
-rwxr-xr-xengine/move_mon_wo_mail.asm2
-rw-r--r--engine/movement.asm41
-rwxr-xr-xengine/mystery_gift.asm (renamed from engine/mysterygift.asm)40
-rwxr-xr-xengine/mystery_gift_2.asm (renamed from engine/mysterygift2.asm)87
-rwxr-xr-xengine/namingscreen.asm81
-rwxr-xr-xengine/npc_movement.asm19
-rwxr-xr-xengine/npctrade.asm62
-rw-r--r--engine/odd_eggs.asm96
-rwxr-xr-xengine/options_menu.asm128
-rwxr-xr-xengine/overworld.asm795
-rw-r--r--engine/pack.asm68
-rw-r--r--engine/party_menu.asm8
-rw-r--r--engine/phone/buenas_password.asm (renamed from engine/buena_phone_scripts.asm)0
-rw-r--r--engine/phone/generic_calls.asm1266
-rw-r--r--engine/phone/phone.asm (renamed from engine/phone.asm)134
-rw-r--r--engine/phone/phone_callers.asm961
-rw-r--r--engine/phone/phone_gossip.asm698
-rw-r--r--engine/phone/phone_scripts.asm1886
-rw-r--r--engine/phone_scripts.asm3153
-rw-r--r--engine/player_gfx.asm263
-rwxr-xr-xengine/player_movement.asm95
-rwxr-xr-xengine/player_object.asm12
-rwxr-xr-xengine/player_step.asm2
-rwxr-xr-xengine/pokecenter_pc.asm62
-rw-r--r--engine/pokedex.asm78
-rw-r--r--engine/pokedex_2.asm286
-rw-r--r--engine/pokedex_3.asm162
-rwxr-xr-xengine/pokegear.asm296
-rwxr-xr-xengine/pokepic.asm2
-rw-r--r--engine/pokerus/apply_pokerus_tick.asm26
-rw-r--r--engine/pokerus/check_pokerus.asm25
-rw-r--r--engine/pokerus/pokerus.asm160
-rw-r--r--engine/predef.asm10
-rwxr-xr-xengine/print_party.asm362
-rwxr-xr-xengine/printer.asm18
-rwxr-xr-xengine/printer_serial.asm (renamed from engine/printer/serial.asm)36
-rwxr-xr-xengine/printnum.asm2
-rwxr-xr-xengine/prof_oaks_pc.asm44
-rw-r--r--engine/radio.asm33
-rw-r--r--engine/read_trainer_attributes.asm64
-rwxr-xr-xengine/read_trainer_party.asm398
-rw-r--r--engine/routines/battlestart_copytilemapatonce.asm3
-rw-r--r--engine/routines/checkbattlescene.asm47
-rw-r--r--engine/routines/checknickerrors.asm74
-rw-r--r--engine/routines/checksave.asm20
-rw-r--r--engine/routines/checktime.asm19
-rw-r--r--engine/routines/consumehelditem.asm80
-rw-r--r--engine/routines/correcterrorsinplayerparty.asm229
-rw-r--r--engine/routines/drawkrispackgfx.asm20
-rw-r--r--engine/routines/emptyallsrambanks.asm19
-rw-r--r--engine/routines/flagpredef.asm70
-rw-r--r--engine/routines/getbreedmonlevelgrowth.asm27
-rwxr-xr-xengine/routines/getpokeballwobble.asm88
-rw-r--r--engine/routines/getsquareroot.asm30
-rw-r--r--engine/routines/initlist.asm54
-rw-r--r--engine/routines/knowsmove.asm25
-rw-r--r--engine/routines/kurt_selectquantity_interpretjoypad.asm4
-rw-r--r--engine/routines/leveluphappinessmod.asm20
-rw-r--r--engine/routines/loadmappart.asm36
-rw-r--r--engine/routines/loadpushoam.asm21
-rw-r--r--engine/routines/newpokedexentry.asm52
-rw-r--r--engine/routines/phonering_copytilemapatonce.asm80
-rw-r--r--engine/routines/placegraphic.asm56
-rw-r--r--engine/routines/placewaitingtext.asm24
-rw-r--r--engine/routines/playslowcry.asm31
-rw-r--r--engine/routines/printhoursmins.asm64
-rw-r--r--engine/routines/returntobattle_useball.asm19
-rw-r--r--engine/routines/savemenu_copytilemapatonce.asm77
-rwxr-xr-xengine/routines/sine.asm (renamed from engine/sine.asm)0
-rw-r--r--engine/routines/switchpartymons.asm145
-rw-r--r--engine/routines/townmap_convertlinebreakcharacters.asm21
-rw-r--r--engine/routines/trademonfrontpic.asm38
-rw-r--r--engine/routines/updatebattlehuds.asm9
-rw-r--r--engine/routines/updateitemdescription.asm13
-rwxr-xr-xengine/rtc.asm26
-rw-r--r--engine/save.asm99
-rw-r--r--engine/scripting.asm265
-rwxr-xr-xengine/search.asm4
-rwxr-xr-xengine/select_menu.asm (renamed from engine/selectmenu.asm)4
-rw-r--r--engine/sgb_layouts.asm636
-rwxr-xr-xengine/slot_machine.asm35
-rw-r--r--engine/spawn_points.asm51
-rw-r--r--engine/specials.asm56
-rwxr-xr-xengine/sprite_anims.asm180
-rwxr-xr-xengine/sprites.asm78
-rw-r--r--engine/start_battle.asm197
-rwxr-xr-xengine/start_menu.asm (renamed from engine/startmenu.asm)120
-rwxr-xr-xengine/stats_screen.asm69
-rw-r--r--engine/std_scripts.asm24
-rw-r--r--engine/tempmon.asm127
-rwxr-xr-xengine/tile_events.asm68
-rwxr-xr-xengine/time.asm4
-rwxr-xr-xengine/time_capsule.asm147
-rwxr-xr-xengine/time_capsule/conversion.asm682
-rw-r--r--engine/time_capsule_2.asm39
-rw-r--r--engine/timeofdaypals.asm24
-rwxr-xr-xengine/timeset.asm101
-rw-r--r--engine/title.asm94
-rwxr-xr-xengine/tmhm.asm66
-rwxr-xr-xengine/tmhm2.asm22
-rwxr-xr-xengine/trade_animation.asm (renamed from engine/trade/animation.asm)29
-rwxr-xr-xengine/trainer_card.asm16
-rw-r--r--engine/trainer_scripts.asm31
-rwxr-xr-xengine/unown_dex.asm52
-rwxr-xr-xengine/unown_puzzle.asm5
-rwxr-xr-xengine/unowndex.asm118
-rw-r--r--engine/unused_title.asm201
-rwxr-xr-xengine/variables.asm8
-rwxr-xr-xengine/warp_connection.asm32
-rwxr-xr-xengine/wildmons.asm72
172 files changed, 19014 insertions, 12341 deletions
diff --git a/engine/anim_hp_bar.asm b/engine/anim_hp_bar.asm
index 6272ff7ea..78062b547 100755
--- a/engine/anim_hp_bar.asm
+++ b/engine/anim_hp_bar.asm
@@ -293,7 +293,7 @@ HPBarAnim_PaletteUpdate: ; d7b4
call SetHPPal
ld a, [wCurHPAnimPal]
ld c, a
- callba ApplyHPBarPals
+ farcall ApplyHPBarPals
ret
; d7c9
@@ -382,7 +382,10 @@ ShortHPBar_CalcPixelFrame: ; d839
and a
jr z, .return_zero
call AddNTimes
+
ld b, 0
+; This routine is buggy. If [wCurHPAnimMaxHP] * [wCurHPBarPixels] is divisible
+; by 48, the loop runs one extra time. To fix, uncomment the line below.
.loop
ld a, l
sub 6 * 8
@@ -390,6 +393,7 @@ ShortHPBar_CalcPixelFrame: ; d839
ld a, h
sbc $0
ld h, a
+ ; jr z, .done
jr c, .done
inc b
jr .loop
diff --git a/engine/battle_tower.asm b/engine/battle_tower.asm
new file mode 100644
index 000000000..b880a099b
--- /dev/null
+++ b/engine/battle_tower.asm
@@ -0,0 +1,210 @@
+Function_LoadOpponentTrainerAndPokemons: ; 1f8000
+ ld a, [rSVBK]
+ push af
+ ld a, BANK(BT_OTTrainer)
+ ld [rSVBK], a
+
+ ; Fill BT_OTTrainer with zeros
+ xor a
+ ld hl, BT_OTTrainer
+ ld bc, BT_OTTrainerEnd - BT_OTTrainer
+ call ByteFill
+
+ ; Write $ff into the Item-Slots
+ ld a, $ff
+ ld [BT_OTPkmn1Item], a
+ ld [BT_OTPkmn2Item], a
+ ld [BT_OTPkmn3Item], a
+
+ ; Set BT_OTTrainer as start address to write the following data to
+ ld de, BT_OTTrainer
+
+ ld a, [hRandomAdd]
+ ld b, a
+.resample ; loop to find a random trainer
+ call Random
+ ld a, [hRandomAdd]
+ add b
+ ld b, a ; b contains the nr of the trainer
+IF DEF(CRYSTAL11)
+ and (1 << 7) - 1
+ cp 70
+ELSE
+ and (1 << 5) - 1
+ cp 21
+ENDC
+ jr nc, .resample
+ ld b, a
+
+ ld a, BANK(sBTTrainers)
+ call GetSRAMBank
+
+ ld c, BATTLETOWER_NROFTRAINERS
+ ld hl, sBTTrainers
+.next_trainer
+ ld a, [hli]
+ cp b
+ jr z, .resample
+ dec c
+ jr nz, .next_trainer ; c <= 7 initialise all 7 trainers?
+
+ ld hl, sBTTrainers
+ ld a, [sNrOfBeatenBattleTowerTrainers]
+ ld c, a
+ ld a, b
+ ld b, 0
+ add hl, bc
+ ld [hl], a
+
+ call CloseSRAM
+
+ push af
+; Copy name (10 bytes) and class (1 byte) of trainer
+ ld hl, BattleTowerTrainers
+ ld bc, NAME_LENGTH
+ call AddNTimes
+ ld bc, NAME_LENGTH
+ call CopyBytes
+
+ call Function_LoadRandomBattleTowerPkmn
+ pop af
+
+ ld hl, BattleTowerTrainerData
+ ld bc, BATTLETOWER_TRAINERDATALENGTH
+ call AddNTimes
+ ld bc, BATTLETOWER_TRAINERDATALENGTH
+.copy_bt_trainer_data_loop
+ ld a, BANK(BattleTowerTrainerData)
+ call GetFarByte
+ ld [de], a
+ inc hl
+ inc de
+ dec bc
+ ld a, b
+ or c
+ jr nz, .copy_bt_trainer_data_loop
+
+ pop af
+ ld [rSVBK], a
+
+ ret
+
+
+Function_LoadRandomBattleTowerPkmn: ; 1f8081
+ ld c, BATTLETOWER_NROFPKMNS
+.loop
+ push bc
+ ld a, BANK(sBTPkmnPrevTrainer1)
+ call GetSRAMBank
+
+.FindARandomBattleTowerPkmn:
+ ; From Which LevelGroup are the Pkmn loaded
+ ; a = 1..10
+ ld a, [wBTChoiceOfLvlGroup] ; [$d800]
+ dec a
+ ld hl, BattleTowerMons
+ ld bc, BattleTowerMons2 - BattleTowerMons1
+ call AddNTimes
+
+ ld a, [hRandomAdd]
+ ld b, a
+.resample
+ call Random
+ ld a, [hRandomAdd]
+ add b
+ ld b, a
+ and $1f
+ cp BATTLETOWER_NRMONSPERLEVELBRACKET
+ jr nc, .resample
+ ; in register 'a' is the chosen Pkmn of the LevelGroup
+
+ ; Check if Pkmn was already loaded before
+ ; Check current and the 2 previous teams
+ ; includes check if item is double at the current team
+ ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH
+ call AddNTimes
+ ld a, [hli]
+ ld b, a
+ ld a, [hld]
+ ld c, a
+ ld a, [BT_OTPkmn1]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [BT_OTPkmn1Item]
+ cp c
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [BT_OTPkmn2]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [BT_OTPkmn2Item]
+ cp c
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [BT_OTPkmn3]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [BT_OTPkmn3Item]
+ cp c
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [sBTPkmnPrevTrainer1]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [sBTPkmnPrevTrainer2]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [sBTPkmnPrevTrainer3]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [sBTPkmnPrevPrevTrainer1]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [sBTPkmnPrevPrevTrainer2]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+ ld a, [sBTPkmnPrevPrevTrainer3]
+ cp b
+ jr z, .FindARandomBattleTowerPkmn
+
+ ld bc, PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH
+ call CopyBytes
+
+ ld a, [wNamedObjectIndexBuffer]
+ push af
+ push de
+ ld hl, - (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH)
+ add hl, de
+ ld a, [hl]
+ ld [wNamedObjectIndexBuffer], a
+ ld bc, PARTYMON_STRUCT_LENGTH
+ add hl, bc
+ push hl
+ call GetPokemonName
+ ld h, d
+ ld l, e
+ pop de
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+
+ pop de
+ pop af
+ ld [wNamedObjectIndexBuffer], a
+ pop bc
+ dec c
+ jp nz, .loop
+
+ ld a, [sBTPkmnPrevTrainer1]
+ ld [sBTPkmnPrevPrevTrainer1], a
+ ld a, [sBTPkmnPrevTrainer2]
+ ld [sBTPkmnPrevPrevTrainer2], a
+ ld a, [sBTPkmnPrevTrainer3]
+ ld [sBTPkmnPrevPrevTrainer3], a
+ ld a, [BT_OTPkmn1]
+ ld [sBTPkmnPrevTrainer1], a
+ ld a, [BT_OTPkmn2]
+ ld [sBTPkmnPrevTrainer2], a
+ ld a, [BT_OTPkmn3]
+ ld [sBTPkmnPrevTrainer3], a
+ call CloseSRAM
+ ret
+; 1f814e
+
+INCLUDE "data/battle_tower.asm"
diff --git a/engine/battle_start.asm b/engine/battle_transition.asm
index 627519daa..bef74ad29 100644
--- a/engine/battle_start.asm
+++ b/engine/battle_transition.asm
@@ -56,11 +56,11 @@ Predef_StartBattle: ; 8c20f
ld a, [wLinkMode]
cp LINK_MOBILE
jr z, .mobile
- callba ReanchorBGMap_NoOAMUpdate
+ farcall ReanchorBGMap_NoOAMUpdate
call UpdateSprites
call DelayFrame
call .NonMobile_LoadPokeballTiles
- call BattleStart_LoadEDTile
+ call BattleStart_CopyTilemapAtOnce
jr .resume
.mobile
@@ -196,9 +196,10 @@ FlashyTransitionToBattle: ; 8c314
StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
-; The screen flashes a different number of
-; times depending on the level of your lead
-; Pokemon relative to the opponent's.
+; The screen flashes a different number of times depending on the level of
+; your lead Pokemon relative to the opponent's.
+; BUG: BattleMonLevel and EnemyMonLevel are not set at this point, so whatever
+; values happen to be there will determine the animation.
ld de, 0
ld a, [BattleMonLevel]
add 3
@@ -207,10 +208,10 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
jr nc, .okay
set 0, e
.okay
- ld a, [wPermission]
+ ld a, [wEnvironment]
cp CAVE
jr z, .okay2
- cp PERM_5
+ cp ENVIRONMENT_5
jr z, .okay2
cp DUNGEON
jr z, .okay2
@@ -296,7 +297,7 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
; 8c3e8
StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
- callba Function5602
+ farcall Function5602
ld a, $5 ; BANK(LYOverrides)
ld [rSVBK], a
@@ -354,7 +355,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
ret
StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
- callba Function5602
+ farcall Function5602
ld a, $5 ; BANK(LYOverrides)
ld [rSVBK], a
call StartTrainerBattle_NextScene
@@ -362,19 +363,6 @@ StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
ld [wcf64], a
ret
-spintable_entry: MACRO
- db \1
- dw .wedge\2
- dwcoord \3, \4
-ENDM
-
-; quadrants
- const_def
- const UPPER_LEFT
- const UPPER_RIGHT
- const LOWER_LEFT
- const LOWER_RIGHT
-
StartTrainerBattle_SpinToBlack: ; 8c44f (23:444f)
xor a
ld [hBGMapMode], a
@@ -411,7 +399,19 @@ endr
ret
; 8c490 (23:4490)
+; quadrants
+ const_def
+ const UPPER_LEFT
+ const UPPER_RIGHT
+ const LOWER_LEFT
+ const LOWER_RIGHT
+
.spintable ; 8c490
+spintable_entry: MACRO
+ db \1
+ dw .wedge\2
+ dwcoord \3, \4
+ENDM
spintable_entry UPPER_LEFT, 1, 1, 6
spintable_entry UPPER_LEFT, 2, 0, 3
spintable_entry UPPER_LEFT, 3, 1, 0
@@ -497,7 +497,7 @@ endr
; 8c578
StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578)
- callba Function5602
+ farcall Function5602
ld a, $5 ; BANK(LYOverrides)
ld [rSVBK], a
call StartTrainerBattle_NextScene
@@ -651,11 +651,11 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
ld [rSVBK], a
call .copypals
push hl
- ld de, UnknBGPals + 7 palettes
+ ld de, UnknBGPals palette PAL_BG_TEXT
ld bc, 1 palettes
call CopyBytes
pop hl
- ld de, BGPals + 7 palettes
+ ld de, BGPals palette PAL_BG_TEXT
ld bc, 1 palettes
call CopyBytes
pop af
@@ -663,24 +663,24 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
ld a, $1
ld [hCGBPalUpdate], a
call DelayFrame
- call BattleStart_LoadEDTile
+ call BattleStart_CopyTilemapAtOnce
.nextscene ; 8c673 (23:4673)
call StartTrainerBattle_NextScene
ret
.copypals ; 8c677 (23:4677)
- ld de, UnknBGPals + 7 palettes
+ ld de, UnknBGPals palette PAL_BG_TEXT
call .copy
- ld de, BGPals + 7 palettes
+ ld de, BGPals palette PAL_BG_TEXT
call .copy
- ld de, UnknOBPals + 6 palettes
+ ld de, UnknOBPals palette PAL_OW_TREE
call .copy
- ld de, OBPals + 6 palettes
+ ld de, OBPals palette PAL_OW_TREE
call .copy
- ld de, UnknOBPals + 7 palettes
+ ld de, UnknOBPals palette PAL_OW_ROCK
call .copy
- ld de, OBPals + 7 palettes
+ ld de, OBPals palette PAL_OW_ROCK
.copy ; 8c698 (23:4698)
push hl
@@ -796,14 +796,8 @@ StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7)
sine_wave $100
; 8c768
-zoombox: macro
-; width, height, start y, start x
- db \1, \2
- dwcoord \3, \4
-endm
-
StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768)
- callba Function5602
+ farcall Function5602
ld de, .boxes
.loop
@@ -834,6 +828,11 @@ StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768)
; 8c792 (23:4792)
.boxes ; 8c792
+zoombox: macro
+; width, height, start y, start x
+ db \1, \2
+ dwcoord \3, \4
+endm
zoombox 4, 2, 8, 8
zoombox 6, 4, 7, 7
zoombox 8, 6, 6, 6
@@ -863,3 +862,12 @@ StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768)
jr nz, .row
ret
; 8c7c9 (23:47c9)
+
+Function8c7c9:
+; XXX
+ ld a, $1
+ ld [hBGMapMode], a
+ call WaitBGMap
+ xor a
+ ld [hBGMapMode], a
+ ret
diff --git a/engine/billspc.asm b/engine/billspc.asm
index 4d8bf1c48..2dd9a512f 100755
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -208,7 +208,7 @@ BillsPCDepositFuncRelease: ; e24e0 (38:64e0)
ld [CurPartyMon], a
xor a
ld [wPokemonWithdrawDepositParameter], a
- callba RemoveMonFromPartyOrBox
+ farcall RemoveMonFromPartyOrBox
call ReleasePKMN_ByePKMN
ld a, $0
ld [wJumptableIndex], a
@@ -472,7 +472,7 @@ BillsPC_Withdraw: ; e2675 (38:6675)
ld [CurPartyMon], a
ld a, PC_DEPOSIT
ld [wPokemonWithdrawDepositParameter], a
- callba RemoveMonFromPartyOrBox
+ farcall RemoveMonFromPartyOrBox
call ReleasePKMN_ByePKMN
ld a, $0
ld [wJumptableIndex], a
@@ -1108,7 +1108,7 @@ PCMonInfo: ; e2ac6 (38:6ac6)
predef GetUnownLetter
call GetBaseData
ld de, VTiles2 tile $00
- predef GetFrontpic
+ predef GetMonFrontpic
xor a
ld [wBillsPC_MonHasMail], a
ld a, [CurPartySpecies]
@@ -1125,7 +1125,7 @@ PCMonInfo: ; e2ac6 (38:6ac6)
ld a, $3
ld [MonType], a
- callba GetGender
+ farcall GetGender
jr c, .skip_gender
ld a, "♂"
jr nz, .printgender
@@ -1140,7 +1140,7 @@ PCMonInfo: ; e2ac6 (38:6ac6)
ret z
ld d, a
- callab ItemIsMail
+ callfar ItemIsMail
jr c, .mail
ld a, $5d ; item icon
jr .printitem
@@ -1656,7 +1656,7 @@ BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18)
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
- callba CheckCurPartyMonFainted
+ farcall CheckCurPartyMonFainted
jr c, .AllOthersFainted
ld a, [wBillsPC_MonHasMail]
and a
@@ -1773,7 +1773,7 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6)
ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes
call CloseSRAM
- callba CalcwBufferMonStats
+ farcall CalcwBufferMonStats
ret
.party
@@ -1783,7 +1783,7 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6)
call CopyNicknameToTemp
ld hl, PartyMonOT
call CopyOTNameToTemp
- ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
+ ld hl, PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
call AddNTimes
@@ -1816,7 +1816,7 @@ BillsPC_CopyMon: ; e2fd6 (38:6fd6)
ld bc, BOXMON_STRUCT_LENGTH
call CopyMonToTemp
call CloseSRAM
- callba CalcwBufferMonStats
+ farcall CalcwBufferMonStats
ret
DepositPokemon: ; e307c (38:707c)
@@ -1833,7 +1833,7 @@ DepositPokemon: ; e307c (38:707c)
jr c, .asm_boxisfull
xor a
ld [wPokemonWithdrawDepositParameter], a
- callba RemoveMonFromPartyOrBox
+ farcall RemoveMonFromPartyOrBox
ld a, [CurPartySpecies]
call PlayCry
hlcoord 0, 0
@@ -1888,7 +1888,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa)
jr c, .PartyFull
ld a, PC_DEPOSIT
ld [wPokemonWithdrawDepositParameter], a
- callba RemoveMonFromPartyOrBox
+ farcall RemoveMonFromPartyOrBox
ld a, [CurPartySpecies]
call PlayCry
hlcoord 0, 0
@@ -2020,7 +2020,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
.dw_return ; e322a
pop af
ld e, a
- callba MovePkmnWOMail_InsertMon_SaveGame
+ farcall MovePkmnWOMail_InsertMon_SaveGame
ret
; e3233
@@ -2056,7 +2056,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
call .CopyFromParty
ld a, $1
ld [wGameLogicPaused], a
- callba SaveGameData
+ farcall SaveGameData
xor a
ld [wGameLogicPaused], a
call .CopyToBox
@@ -2106,7 +2106,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
ld a, [wBillsPC_BackupLoadedBox]
dec a
ld e, a
- callba MovePkmnWOMail_SaveGame
+ farcall MovePkmnWOMail_SaveGame
ld a, [wBillsPC_BackupCursorPosition]
ld hl, wBillsPC_BackupScrollPosition
add [hl]
@@ -2123,10 +2123,10 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
ld bc, BOXMON_STRUCT_LENGTH
call CopyMonToTemp
call CloseSRAM
- callba CalcwBufferMonStats
+ farcall CalcwBufferMonStats
ld a, PC_DEPOSIT
ld [wPokemonWithdrawDepositParameter], a
- callba RemoveMonFromPartyOrBox
+ farcall RemoveMonFromPartyOrBox
ret
; e32fa
@@ -2134,12 +2134,12 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
ld a, [wBillsPC_LoadedBox]
dec a
ld e, a
- callba MovePkmnWOMail_SaveGame
+ farcall MovePkmnWOMail_SaveGame
ld a, [wBillsPC_CursorPosition]
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
- callba InsertPokemonIntoBox
+ farcall InsertPokemonIntoBox
ret
; e3316
@@ -2159,7 +2159,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
call CopyMonToTemp
xor a
ld [wPokemonWithdrawDepositParameter], a
- callba RemoveMonFromPartyOrBox
+ farcall RemoveMonFromPartyOrBox
ret
; e3346
@@ -2168,7 +2168,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
ld hl, wBillsPC_ScrollPosition
add [hl]
ld [CurPartyMon], a
- callba InsertPokemonIntoParty
+ farcall InsertPokemonIntoParty
ret
; e3357
@@ -2280,8 +2280,8 @@ BillsPC_InitGFX: ; e33e8 (38:73e8)
ret
; e3419 (38:7419)
-PCSelectLZ: INCBIN "gfx/pc.2bpp.lz"
-PCMailGFX: INCBIN "gfx/pc_mail.2bpp"
+PCSelectLZ: INCBIN "gfx/pc/pc.2bpp.lz"
+PCMailGFX: INCBIN "gfx/pc/pc_mail.2bpp"
; e34dd
PCString_ChooseaPKMN: db "Choose a <PK><MN>.@"
@@ -2523,7 +2523,7 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9)
ld a, [MenuSelection]
dec a
ld c, a
- callba PrintPCBox
+ farcall PrintPCBox
call BillsPC_ClearTilemap
and a
ret
@@ -2540,13 +2540,13 @@ BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9)
ld a, [wCurBox]
cp e
ret z
- callba ChangeBoxSaveGame
+ farcall ChangeBoxSaveGame
ret
.Name:
ld b, $4 ; box
ld de, wd002
- callba NamingScreen
+ farcall NamingScreen
call ClearTileMap
call LoadStandardFont
call LoadFontsBattleExtra
diff --git a/engine/billspctop.asm b/engine/billspctop.asm
index 115c90385..c36cbe45d 100755
--- a/engine/billspctop.asm
+++ b/engine/billspctop.asm
@@ -111,16 +111,16 @@ BillsPC_SeeYa: ; e4cb
BillsPC_MovePKMNMenu: ; e4cd
call LoadStandardMenuDataHeader
- callba IsAnyMonHoldingMail
+ farcall IsAnyMonHoldingMail
jr nc, .no_mail
ld hl, .Text_MonHoldingMail
call PrintText
jr .quit
.no_mail
- callba StartMovePkmnWOMail_SaveGame
+ farcall StartMovePkmnWOMail_SaveGame
jr c, .quit
- callba _MovePKMNWithoutMail
+ farcall _MovePKMNWithoutMail
call ReturnToMapFromSubmenu
call ClearPCItemScreen
@@ -136,7 +136,7 @@ BillsPC_MovePKMNMenu: ; e4cd
BillsPC_DepositMenu: ; e4fe (3:64fe)
call LoadStandardMenuDataHeader
- callba _DepositPKMN
+ farcall _DepositPKMN
call ReturnToMapFromSubmenu
call ClearPCItemScreen
call CloseWindow
@@ -205,7 +205,7 @@ CheckCurPartyMonFainted: ; e538
BillsPC_WithdrawMenu: ; e559 (3:6559)
call LoadStandardMenuDataHeader
- callba _WithdrawPKMN
+ farcall _WithdrawPKMN
call ReturnToMapFromSubmenu
call ClearPCItemScreen
call CloseWindow
@@ -231,7 +231,7 @@ UnknownText_0xe57e: ; 0xe57e
db "@"
BillsPC_ChangeBoxMenu: ; e583 (3:6583)
- callba _ChangeBox
+ farcall _ChangeBox
and a
ret
@@ -245,10 +245,10 @@ ClearPCItemScreen: ; e58b
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
- hlcoord 0,0
+ hlcoord 0, 0
lb bc, 10, 18
call TextBox
- hlcoord 0,12
+ hlcoord 0, 12
lb bc, 4, 18
call TextBox
call WaitBGMap2
diff --git a/engine/breeding/egg.asm b/engine/breeding.asm
index 326faaa6c..967694612 100755
--- a/engine/breeding/egg.asm
+++ b/engine/breeding.asm
@@ -231,10 +231,10 @@ HatchEggs: ; 16f70 (5:6f70)
push de
- callba SetEggMonCaughtData
- callba TrainerRankings_EggsHatched
+ farcall SetEggMonCaughtData
+ farcall TrainerRankings_EggsHatched
ld a, [CurPartyMon]
- ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
+ ld hl, PartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [hl]
@@ -263,7 +263,7 @@ HatchEggs: ; 16f70 (5:6f70)
ld [wd26b], a
call GetBaseData
ld a, [CurPartyMon]
- ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
+ ld hl, PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
push hl
@@ -309,7 +309,7 @@ HatchEggs: ; 16f70 (5:6f70)
ld a, [PlayerID + 1]
ld [hl], a
ld a, [CurPartyMon]
- ld hl, PartyMonOT ; wddff (aliases: PartyMonOT)
+ ld hl, PartyMonOT
ld bc, NAME_LENGTH
call AddNTimes
ld d, h
@@ -337,7 +337,7 @@ HatchEggs: ; 16f70 (5:6f70)
ld [MonType], a
push de
ld b, $0
- callba NamingScreen
+ farcall NamingScreen
pop hl
ld de, StringBuffer1
call InitName
@@ -649,7 +649,7 @@ GetEggFrontpic: ; 17224 (5:7224)
ld hl, BattleMonDVs
predef GetUnownLetter
pop de
- predef_jump GetFrontpic
+ predef_jump GetMonFrontpic
GetHatchlingFrontpic: ; 1723c (5:723c)
push de
@@ -659,7 +659,7 @@ GetHatchlingFrontpic: ; 1723c (5:723c)
ld hl, BattleMonDVs
predef GetUnownLetter
pop de
- predef_jump FrontpicPredef
+ predef_jump GetAnimatedFrontpicPredef
Hatch_UpdateFrontpicBGMapCenter: ; 17254 (5:7254)
push af
@@ -687,7 +687,7 @@ EggHatch_DoAnimFrame: ; 1727f (5:727f)
push hl
push de
push bc
- callab PlaySpriteAnimations
+ callfar PlaySpriteAnimations
call DelayFrame
pop bc
pop de
@@ -701,14 +701,14 @@ EggHatch_AnimationSequence: ; 1728f (5:728f)
push af
ld de, MUSIC_NONE
call PlayMusic
- callba BlankScreen
+ farcall BlankScreen
call DisableLCD
ld hl, EggHatchGFX
ld de, VTiles0 tile $00
ld bc, $20
ld a, BANK(EggHatchGFX)
call FarCopyBytes
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
ld de, VTiles2 tile $00
ld a, [wJumptableIndex]
call GetHatchlingFrontpic
@@ -803,7 +803,7 @@ EggHatch_CrackShell: ; 1736d (5:736d)
add 9 * 8 + 4
ld d, a
ld e, 11 * 8
- ld a, SPRITE_ANIM_INDEX_19
+ ld a, SPRITE_ANIM_INDEX_EGG_CRACK
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
@@ -813,11 +813,11 @@ EggHatch_CrackShell: ; 1736d (5:736d)
; 17393 (5:7393)
EggHatchGFX: ; 17393
-INCBIN "gfx/unknown/017393.2bpp"
+INCBIN "gfx/evo/egg_hatch.2bpp"
; 173b3
Hatch_InitShellFragments: ; 173b3 (5:73b3)
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
ld hl, .SpriteData
.loop
ld a, [hli]
@@ -833,7 +833,7 @@ Hatch_InitShellFragments: ; 173b3 (5:73b3)
push hl
push bc
- ld a, SPRITE_ANIM_INDEX_1C
+ ld a, SPRITE_ANIM_INDEX_EGG_HATCH
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
@@ -888,7 +888,7 @@ Special_DayCareMon1: ; 17421
call PrintText
ld a, [wBreedMon1Species]
call PlayCry
- ld a, [wDaycareLady]
+ ld a, [wDayCareLady]
bit 0, a
jr z, DayCareMonCursor
call ButtonSound
@@ -901,7 +901,7 @@ Special_DayCareMon2: ; 17440
call PrintText
ld a, [wBreedMon2Species]
call PlayCry
- ld a, [wDaycareMan]
+ ld a, [wDayCareMan]
bit 0, a
jr z, DayCareMonCursor
call ButtonSound
diff --git a/engine/buy_sell_toss.asm b/engine/buy_sell_toss.asm
index bd18cc83a..37bee86b1 100755
--- a/engine/buy_sell_toss.asm
+++ b/engine/buy_sell_toss.asm
@@ -6,7 +6,7 @@ SelectQuantityToToss: ; 24fbf
; 24fc9
SelectQuantityToBuy: ; 24fc9
- callba GetItemPrice
+ farcall GetItemPrice
RooftopSale_SelectQuantityToBuy: ; 24fcf
ld a, d
ld [Buffer1], a
@@ -19,7 +19,7 @@ RooftopSale_SelectQuantityToBuy: ; 24fcf
; 24fe1
SelectQuantityToSell: ; 24fe1
- callba GetItemPrice
+ farcall GetItemPrice
ld a, d
ld [Buffer1], a
ld a, e
diff --git a/engine/card_flip.asm b/engine/card_flip.asm
index cdf2be010..c0c4639ad 100755
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -499,12 +499,12 @@ CardFlip_DisplayCardFaceUp: ; e03ec
.Deck: ; e0459
; level, pic anchor (3x3)
- db "1",$4e, "1",$57, "1",$69, "1",$60
- db "2",$4e, "2",$57, "2",$69, "2",$60
- db "3",$4e, "3",$57, "3",$69, "3",$60
- db "4",$4e, "4",$57, "4",$69, "4",$60
- db "5",$4e, "5",$57, "5",$69, "5",$60
- db "6",$4e, "6",$57, "6",$69, "6",$60
+ db "1", $4e, "1", $57, "1", $69, "1", $60
+ db "2", $4e, "2", $57, "2", $69, "2", $60
+ db "3", $4e, "3", $57, "3", $69, "3", $60
+ db "4", $4e, "4", $57, "4", $69, "4", $60
+ db "5", $4e, "5", $57, "5", $69, "5", $60
+ db "6", $4e, "6", $57, "6", $69, "6", $60
; e0489
CardFlip_UpdateCoinBalanceDisplay: ; e0489
@@ -1185,14 +1185,14 @@ CardFlip_CheckWinCondition: ; e0637
.IsCoinCaseFull: ; e0833
ld a, [Coins]
- cp 9999 / $100
+ cp MAX_COINS / $100
jr c, .less
jr z, .check_low
jr .more
.check_low
ld a, [Coins + 1]
- cp 9999 % $100
+ cp MAX_COINS % $100
jr c, .less
.more
@@ -1415,7 +1415,6 @@ else
endc
endm
-
cardflip_cursor 11, 2, .Impossible
cardflip_cursor 12, 2, .Impossible
cardflip_cursor 13, 2, .PokeGroupPair
@@ -1665,78 +1664,24 @@ CardFlip_InitAttrPals: ; e0c37 (38:4c37)
; e0c93 (38:4c93)
.palettes ; e0c93
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 29, 25, 00
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 13, 30
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 08, 17, 30
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 08, 31, 08
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 17, 07, 31
- RGB 06, 19, 08
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 00, 00
- RGB 31, 00, 00
+INCLUDE "data/palettes/card_flip.pal"
; e0cdb
CardFlipLZ03: ; e0cdb
-INCBIN "gfx/unknown/0e0cdb.2bpp.lz"
+INCBIN "gfx/card_flip/card_flip_3.2bpp.lz"
CardFlipOffButtonGFX: ; e0cf6
-INCBIN "gfx/unknown/0e0cf6.2bpp"
+INCBIN "gfx/card_flip/off.2bpp"
CardFlipOnButtonGFX: ; e0d06
-INCBIN "gfx/unknown/0e0d06.2bpp"
+INCBIN "gfx/card_flip/on.2bpp"
CardFlipLZ01: ; e0d16
-INCBIN "gfx/unknown/0e0d16.2bpp.lz"
+INCBIN "gfx/card_flip/card_flip_1.2bpp.lz"
CardFlipLZ02: ; e0ea8
-INCBIN "gfx/unknown/0e0ea8.2bpp.lz"
+INCBIN "gfx/card_flip/card_flip_2.2bpp.lz"
CardFlipTilemap: ; e110c
- db $ef, $15, $27, $2a, $2a, $06, $27, $2a, $2a, $06, $27
- db $ef, $07, $27, $3e, $3f, $42, $43, $46, $47, $4a, $4b
- db $ef, $17, $26, $40, $41, $44, $45, $48, $49, $4c, $4d
- db $ef, $25, $04, $00, $01, $00, $01, $00, $01, $00, $01
- db $ef, $05, $14, $10, $11, $10, $11, $10, $11, $10, $11
- db $ef, $16, $24, $20, $21, $20, $21, $20, $21, $20, $21
- db $ef, $25, $04, $00, $02, $00, $02, $00, $02, $00, $02
- db $ef, $05, $14, $10, $12, $10, $12, $10, $12, $10, $12
- db $ef, $16, $24, $20, $22, $20, $22, $20, $22, $20, $22
- db $ef, $25, $04, $00, $03, $00, $03, $00, $03, $00, $03
- db $ef, $05, $14, $10, $13, $10, $13, $10, $13, $10, $13
- db $ef, $16, $24, $20, $23, $20, $23, $20, $23, $20, $23
+INCBIN "gfx/card_flip/card_flip.tilemap"
; e1190
diff --git a/engine/caught_data.asm b/engine/caught_data.asm
new file mode 100644
index 000000000..961782908
--- /dev/null
+++ b/engine/caught_data.asm
@@ -0,0 +1,247 @@
+CheckPartyFullAfterContest: ; 4d9e5
+ ld a, [wContestMon]
+ and a
+ jp z, .DidntCatchAnything
+ ld [CurPartySpecies], a
+ ld [CurSpecies], a
+ call GetBaseData
+ ld hl, PartyCount
+ ld a, [hl]
+ cp 6
+ jp nc, .TryAddToBox
+ inc a
+ ld [hl], a
+ ld c, a
+ ld b, $0
+ add hl, bc
+ ld a, [wContestMon]
+ ld [hli], a
+ ld [CurSpecies], a
+ ld a, $ff
+ ld [hl], a
+ ld hl, PartyMon1Species
+ ld a, [PartyCount]
+ dec a
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld d, h
+ ld e, l
+ ld hl, wContestMon
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call CopyBytes
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMonOT
+ call SkipNames
+ ld d, h
+ ld e, l
+ ld hl, PlayerName
+ call CopyBytes
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+ call GetPokemonName
+ ld hl, StringBuffer1
+ ld de, wMonOrItemNameBuffer
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+ call GiveANickname_YesNo
+ jr c, .Party_SkipNickname
+ ld a, [PartyCount]
+ dec a
+ ld [CurPartyMon], a
+ xor a
+ ld [MonType], a
+ ld de, wMonOrItemNameBuffer
+ callfar InitNickname
+
+.Party_SkipNickname:
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMonNicknames
+ call SkipNames
+ ld d, h
+ ld e, l
+ ld hl, wMonOrItemNameBuffer
+ call CopyBytes
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMon1Level
+ call GetPartyLocation
+ ld a, [hl]
+ ld [CurPartyLevel], a
+ call SetCaughtData
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMon1CaughtLocation
+ call GetPartyLocation
+ ld a, [hl]
+ and $80
+ ld b, $13
+ or b
+ ld [hl], a
+ xor a
+ ld [wContestMon], a
+ and a
+ ld [ScriptVar], a
+ ret
+
+.TryAddToBox: ; 4daa3
+ ld a, BANK(sBoxCount)
+ call GetSRAMBank
+ ld hl, sBoxCount
+ ld a, [hl]
+ cp MONS_PER_BOX
+ call CloseSRAM
+ jr nc, .BoxFull
+ xor a
+ ld [CurPartyMon], a
+ ld hl, wContestMon
+ ld de, wBufferMon
+ ld bc, BOXMON_STRUCT_LENGTH
+ call CopyBytes
+ ld hl, PlayerName
+ ld de, wBufferMonOT
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ callfar InsertPokemonIntoBox
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+ call GetPokemonName
+ call GiveANickname_YesNo
+ ld hl, StringBuffer1
+ jr c, .Box_SkipNickname
+ ld a, BOXMON
+ ld [MonType], a
+ ld de, wMonOrItemNameBuffer
+ callfar InitNickname
+ ld hl, wMonOrItemNameBuffer
+
+.Box_SkipNickname:
+ ld a, BANK(sBoxMonNicknames)
+ call GetSRAMBank
+ ld de, sBoxMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+ call CloseSRAM
+
+.BoxFull:
+ ld a, BANK(sBoxMon1Level)
+ call GetSRAMBank
+ ld a, [sBoxMon1Level]
+ ld [CurPartyLevel], a
+ call CloseSRAM
+ call SetBoxMonCaughtData
+ ld a, BANK(sBoxMon1CaughtLocation)
+ call GetSRAMBank
+ ld hl, sBoxMon1CaughtLocation
+ ld a, [hl]
+ and $80
+ ld b, $13
+ or b
+ ld [hl], a
+ call CloseSRAM
+ xor a
+ ld [wContestMon], a
+ ld a, $1
+ ld [ScriptVar], a
+ ret
+
+.DidntCatchAnything: ; 4db35
+ ld a, $2
+ ld [ScriptVar], a
+ ret
+
+GiveANickname_YesNo: ; 4db3b
+ ld hl, TextJump_GiveANickname
+ call PrintText
+ jp YesNoBox
+
+TextJump_GiveANickname: ; 0x4db44
+ ; Give a nickname to the @ you received?
+ text_jump UnknownText_0x1c12fc
+ db "@"
+
+SetCaughtData: ; 4db49
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMon1CaughtLevel
+ call GetPartyLocation
+SetBoxmonOrEggmonCaughtData: ; 4db53
+ ld a, [TimeOfDay]
+ inc a
+ rrca
+ rrca
+ ld b, a
+ ld a, [CurPartyLevel]
+ or b
+ ld [hli], a
+ ld a, [MapGroup]
+ ld b, a
+ ld a, [MapNumber]
+ ld c, a
+ cp MAP_POKECENTER_2F
+ jr nz, .NotPokecenter2F
+ ld a, b
+ cp GROUP_POKECENTER_2F
+ jr nz, .NotPokecenter2F
+
+ ld a, [BackupMapGroup]
+ ld b, a
+ ld a, [BackupMapNumber]
+ ld c, a
+
+.NotPokecenter2F:
+ call GetWorldMapLocation
+ ld b, a
+ ld a, [PlayerGender]
+ rrca
+ or b
+ ld [hl], a
+ ret
+
+SetBoxMonCaughtData: ; 4db83
+ ld a, BANK(sBoxMon1CaughtLevel)
+ call GetSRAMBank
+ ld hl, sBoxMon1CaughtLevel
+ call SetBoxmonOrEggmonCaughtData
+ call CloseSRAM
+ ret
+
+SetGiftBoxMonCaughtData: ; 4db92
+ push bc
+ ld a, BANK(sBoxMon1CaughtLevel)
+ call GetSRAMBank
+ ld hl, sBoxMon1CaughtLevel
+ pop bc
+ call SetGiftMonCaughtData
+ call CloseSRAM
+ ret
+
+SetGiftPartyMonCaughtData: ; 4dba3
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMon1CaughtLevel
+ push bc
+ call GetPartyLocation
+ pop bc
+SetGiftMonCaughtData: ; 4dbaf
+ xor a
+ ld [hli], a
+ ld a, $7e
+ rrc b
+ or b
+ ld [hl], a
+ ret
+
+SetEggMonCaughtData: ; 4dbb8 (13:5bb8)
+ ld a, [CurPartyMon]
+ ld hl, PartyMon1CaughtLevel
+ call GetPartyLocation
+ ld a, [CurPartyLevel]
+ push af
+ ld a, $1
+ ld [CurPartyLevel], a
+ call SetBoxmonOrEggmonCaughtData
+ pop af
+ ld [CurPartyLevel], a
+ ret
diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm
new file mode 100644
index 000000000..05834d35f
--- /dev/null
+++ b/engine/cgb_layouts.asm
@@ -0,0 +1,1071 @@
+; Replaces the functionality of sgb.asm to work with CGB hardware.
+
+CheckCGB: ; 8d55
+ ld a, [hCGB]
+ and a
+ ret
+; 8d59
+
+Predef_LoadSGBLayoutCGB: ; 8d59
+ ld a, b
+ cp SCGB_RAM
+ jr nz, .not_ram
+ ld a, [SGBPredef]
+.not_ram
+ cp SCGB_PARTY_MENU_HP_PALS
+ jp z, CGB_ApplyPartyMenuHPPals
+ call ResetBGPals
+ ld l, a
+ ld h, 0
+ add hl, hl
+ ld de, .dw
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .ReturnFromJumpTable
+ push de
+ jp hl
+; 8d79
+
+.ReturnFromJumpTable: ; 8d79
+ ret
+; 8d7a
+
+.dw ; 8d7a
+ dw _CGB_BattleGrayscale
+ dw _CGB_BattleColors
+ dw _CGB_PokegearPals
+ dw _CGB_StatsScreenHPPals
+ dw _CGB_Pokedex
+ dw _CGB_SlotMachine
+ dw _CGB06
+ dw _CGB07
+ dw _CGB_Diploma
+ dw _CGB_MapPals
+ dw _CGB_PartyMenu
+ dw _CGB_Evolution
+ dw _CGB0c
+ dw _CGB0d
+ dw _CGB_MoveList
+ dw _CGB0f
+ dw _CGB_PokedexSearchOption
+ dw _CGB11
+ dw _CGB_Pokepic
+ dw _CGB13
+ dw _CGB_PackPals
+ dw _CGB_TrainerCard
+ dw _CGB_PokedexUnownMode
+ dw _CGB_BillsPC
+ dw _CGB_UnownPuzzle
+ dw _CGB_GamefreakLogo ; called before copyright
+ dw _CGB_PlayerOrMonFrontpicPals
+ dw _CGB_TradeTube
+ dw _CGB_TrainerOrMonFrontpicPals
+ dw _CGB_MysteryGift
+ dw _CGB1e
+; 8db8
+
+_CGB_BattleGrayscale: ; 8db8
+ ld hl, PalPacket_9c66 + 1
+ ld de, UnknBGPals
+ ld c, 4
+ call CopyPalettes
+ ld hl, PalPacket_9c66 + 1
+ ld de, UnknBGPals palette PAL_BATTLE_BG_EXP
+ ld c, 4
+ call CopyPalettes
+ ld hl, PalPacket_9c66 + 1
+ ld de, UnknOBPals
+ ld c, 2
+ call CopyPalettes
+ jr _CGB_FinishBattleScreenLayout
+
+_CGB_BattleColors: ; 8ddb
+ ld de, UnknBGPals
+ call GetBattlemonBackpicPalettePointer
+ push hl
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER
+ call GetEnemyFrontpicPalettePointer
+ push hl
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY
+ ld a, [EnemyHPPal]
+ ld l, a
+ ld h, $0
+ add hl, hl
+ add hl, hl
+ ld bc, HPBarPals
+ add hl, bc
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY_HP
+ ld a, [PlayerHPPal]
+ ld l, a
+ ld h, $0
+ add hl, hl
+ add hl, hl
+ ld bc, HPBarPals
+ add hl, bc
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER_HP
+ ld hl, ExpBarPalette
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_EXP
+ ld de, UnknOBPals
+ pop hl
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_ENEMY
+ pop hl
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_PLAYER
+ ld a, SCGB_BATTLE_COLORS
+ ld [SGBPredef], a
+ call ApplyPals
+_CGB_FinishBattleScreenLayout: ; 8e23
+ call InitPartyMenuBGPal7
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, PAL_BATTLE_BG_ENEMY_HP
+ call ByteFill
+ hlcoord 0, 4, AttrMap
+ lb bc, 8, 10
+ ld a, PAL_BATTLE_BG_PLAYER
+ call FillBoxCGB
+ hlcoord 10, 0, AttrMap
+ lb bc, 7, 10
+ ld a, PAL_BATTLE_BG_ENEMY
+ call FillBoxCGB
+ hlcoord 0, 0, AttrMap
+ lb bc, 4, 10
+ ld a, PAL_BATTLE_BG_ENEMY_HP
+ call FillBoxCGB
+ hlcoord 10, 7, AttrMap
+ lb bc, 5, 10
+ ld a, PAL_BATTLE_BG_PLAYER_HP
+ call FillBoxCGB
+ hlcoord 10, 11, AttrMap
+ lb bc, 1, 9
+ ld a, PAL_BATTLE_BG_EXP
+ call FillBoxCGB
+ hlcoord 0, 12, AttrMap
+ ld bc, 6 * SCREEN_WIDTH
+ ld a, PAL_BATTLE_BG_TEXT
+ call ByteFill
+ ld hl, Palettes_979c
+ ld de, UnknOBPals palette PAL_BATTLE_OB_GRAY
+ ld bc, 6 palettes
+ ld a, BANK(UnknOBPals)
+ call FarCopyWRAM
+ call ApplyAttrMap
+ ret
+; 8e85
+
+
+InitPartyMenuBGPal7: ; 8e85
+ farcall Function100dc0
+Mobile_InitPartyMenuBGPal7: ; 8e8b
+ ld hl, Palette_b311
+ jr nc, .not_mobile
+ ld hl, Palette_b309
+.not_mobile
+ ld de, UnknBGPals palette 7
+ ld bc, 1 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ ret
+; 8e9f
+
+InitPartyMenuBGPal0: ; 8e9f
+ farcall Function100dc0
+ ld hl, Palette_b311
+ jr nc, .not_mobile
+ ld hl, Palette_b309
+.not_mobile
+ ld de, UnknBGPals palette 0
+ ld bc, 1 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ ret
+; 8eb9
+
+_CGB_PokegearPals: ; 8eb9
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .male
+ ld hl, FemalePokegearPals
+ jr .got_pals
+
+.male
+ ld hl, MalePokegearPals
+.got_pals
+ ld de, UnknBGPals
+ ld bc, 6 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 8edb
+
+_CGB_StatsScreenHPPals: ; 8edb
+ ld de, UnknBGPals
+ ld a, [wCurHPPal]
+ ld l, a
+ ld h, $0
+ add hl, hl
+ add hl, hl
+ ld bc, HPBarPals
+ add hl, bc
+ call LoadPalette_White_Col1_Col2_Black ; hp palette
+ ld a, [CurPartySpecies]
+ ld bc, TempMonDVs
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black ; mon palette
+ ld hl, ExpBarPalette
+ call LoadPalette_White_Col1_Col2_Black ; exp palette
+ ld hl, StatsScreenPagePals
+ ld de, UnknBGPals palette 3
+ ld bc, 3 palettes ; pink, green, and blue page palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ call WipeAttrMap
+
+ hlcoord 0, 0, AttrMap
+ lb bc, 8, SCREEN_WIDTH
+ ld a, $1 ; mon palette
+ call FillBoxCGB
+
+ hlcoord 10, 16, AttrMap
+ ld bc, 10
+ ld a, $2 ; exp palette
+ call ByteFill
+
+ hlcoord 13, 5, AttrMap
+ lb bc, 2, 2
+ ld a, $3 ; pink page palette
+ call FillBoxCGB
+
+ hlcoord 15, 5, AttrMap
+ lb bc, 2, 2
+ ld a, $4 ; green page palette
+ call FillBoxCGB
+
+ hlcoord 17, 5, AttrMap
+ lb bc, 2, 2
+ ld a, $5 ; blue page palette
+ call FillBoxCGB
+
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 8f52
+
+StatsScreenPagePals: ; 8f52
+; pink
+ RGB 31, 31, 31
+ RGB 31, 19, 31
+ RGB 31, 15, 31
+ RGB 00, 00, 00
+; green
+ RGB 31, 31, 31
+ RGB 21, 31, 14
+ RGB 17, 31, 00
+ RGB 00, 00, 00
+; blue
+ RGB 31, 31, 31
+ RGB 17, 31, 31
+ RGB 17, 31, 31
+ RGB 00, 00, 00
+; 8f6a
+
+StatsScreenPals: ; 8f6a
+; pink
+ RGB 31, 19, 31
+; green
+ RGB 21, 31, 14
+; blue
+ RGB 17, 31, 31
+; 8f70
+
+_CGB_Pokedex: ; 8f70
+ ld de, UnknBGPals
+ ld a, $1d
+ call GetPredefPal
+ call LoadHLPaletteIntoDE ; dex interface palette
+ ld a, [CurPartySpecies]
+ cp $ff
+ jr nz, .is_pokemon
+ ld hl, .PokedexQuestionMarkPalette
+ call LoadHLPaletteIntoDE ; green question mark palette
+ jr .got_palette
+
+.is_pokemon
+ call GetMonPalettePointer_
+ call LoadPalette_White_Col1_Col2_Black ; mon palette
+.got_palette
+ call WipeAttrMap
+ hlcoord 1, 1, AttrMap
+ lb bc, 7, 7
+ ld a, $1 ; green question mark palette
+ call FillBoxCGB
+ call InitPartyMenuOBPals
+ ld hl, .PokedexCursorPalette
+ ld de, UnknOBPals palette 7 ; green cursor palette
+ ld bc, 1 palettes
+ ld a, BANK(UnknOBPals)
+ call FarCopyWRAM
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 8fba
+
+.PokedexQuestionMarkPalette: ; 8fba
+ RGB 11, 23, 00
+ RGB 07, 17, 00
+ RGB 06, 16, 03
+ RGB 05, 12, 01
+
+.PokedexCursorPalette: ; 8fc2
+ RGB 00, 00, 00
+ RGB 11, 23, 00
+ RGB 07, 17, 00
+ RGB 00, 00, 00
+; 8fca
+
+_CGB_BillsPC: ; 8fca
+ ld de, UnknBGPals
+ ld a, $1d
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ ld a, [CurPartySpecies]
+ cp $ff
+ jr nz, .GetMonPalette
+ ld hl, .BillsPCOrangePalette
+ call LoadHLPaletteIntoDE
+ jr .Resume
+
+.GetMonPalette:
+ ld bc, TempMonDVs
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+.Resume:
+ call WipeAttrMap
+ hlcoord 1, 4, AttrMap
+ lb bc, 7, 7
+ ld a, $1
+ call FillBoxCGB
+ call InitPartyMenuOBPals
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 9009
+
+.Function9009: ; 9009
+ ld hl, .BillsPCOrangePalette
+ call LoadHLPaletteIntoDE
+ jr .asm_901a
+
+.unused
+ ld bc, TempMonDVs
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+.asm_901a
+ call WipeAttrMap
+ hlcoord 1, 1, AttrMap
+ lb bc, 7, 7
+ ld a, $1
+ call FillBoxCGB
+ call InitPartyMenuOBPals
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 9036
+
+.BillsPCOrangePalette: ; 9036
+ RGB 31, 15, 00
+ RGB 23, 12, 00
+ RGB 15, 07, 00
+ RGB 00, 00, 00
+; 903e
+
+_CGB_PokedexUnownMode: ; 903e
+ ld de, UnknBGPals
+ ld a, $1d
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ ld a, [CurPartySpecies]
+ call GetMonPalettePointer_
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ hlcoord 7, 5, AttrMap
+ lb bc, 7, 7
+ ld a, $1
+ call FillBoxCGB
+ call InitPartyMenuOBPals
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 906e
+
+_CGB_SlotMachine: ; 906e
+ ld hl, SlotMachinePals
+ ld de, UnknBGPals
+ ld bc, 16 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ call WipeAttrMap
+ hlcoord 0, 2, AttrMap
+ lb bc, 10, 3
+ ld a, $2
+ call FillBoxCGB
+ hlcoord 17, 2, AttrMap
+ lb bc, 10, 3
+ ld a, $2
+ call FillBoxCGB
+ hlcoord 0, 4, AttrMap
+ lb bc, 6, 3
+ ld a, $3
+ call FillBoxCGB
+ hlcoord 17, 4, AttrMap
+ lb bc, 6, 3
+ ld a, $3
+ call FillBoxCGB
+ hlcoord 0, 6, AttrMap
+ lb bc, 2, 3
+ ld a, $4
+ call FillBoxCGB
+ hlcoord 17, 6, AttrMap
+ lb bc, 2, 3
+ ld a, $4
+ call FillBoxCGB
+ hlcoord 4, 2, AttrMap
+ lb bc, 2, 12
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 3, 2, AttrMap
+ lb bc, 10, 1
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 16, 2, AttrMap
+ lb bc, 10, 1
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 0, 12, AttrMap
+ ld bc, $78
+ ld a, $7
+ call ByteFill
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 90f8
+
+_CGB06: ; 90f8
+ ld hl, PalPacket_9ca6 + 1
+ call CopyFourPalettes
+ call WipeAttrMap
+ ld de, UnknOBPals
+ ld a, $3c
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ hlcoord 0, 6, AttrMap
+ lb bc, 12, SCREEN_WIDTH
+ ld a, $1
+ call FillBoxCGB
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 9122
+
+_CGB07: ; 9122
+ ld b, 0
+ ld hl, .Jumptable
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp hl
+; 912d
+
+.Jumptable: ; 912d
+ dw .Function9133
+ dw .Function9166
+ dw .Function9180
+; 9133
+
+.Function9133: ; 9133
+ ld hl, .Palette_914e
+ ld de, UnknBGPals
+ call LoadHLPaletteIntoDE
+ ld hl, .Palette_9156
+ ld de, UnknOBPals
+ ld bc, 2 palettes
+ ld a, BANK(UnknOBPals)
+ call FarCopyWRAM
+ call WipeAttrMap
+ ret
+; 914e
+
+.Palette_914e: ; 914e
+ RGB 19, 31, 19
+ RGB 18, 23, 31
+ RGB 11, 21, 28
+ RGB 04, 16, 24
+
+.Palette_9156: ; 9156
+ RGB 29, 29, 29
+ RGB 20, 19, 20
+ RGB 19, 06, 04
+ RGB 03, 04, 06
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 00, 00
+ RGB 03, 04, 06
+; 9166
+
+.Function9166: ; 9166
+ ld de, UnknBGPals
+ ld a, $38
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+
+ ld de, UnknOBPals
+ ld a, $39
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrMap
+ ret
+; 9180
+
+.Function9180: ; 9180
+ ld hl, PalPacket_9c36 + 1
+ call CopyFourPalettes
+ ld de, UnknOBPals
+ ld a, $3a
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrMap
+ ret
+; 9195
+
+_CGB11: ; 9195
+ ld hl, Palettes_b789
+ ld de, UnknBGPals
+ ld bc, 5 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ call ApplyPals
+ call WipeAttrMap
+ call ApplyAttrMap
+ ret
+; 91ad
+
+_CGB_Diploma: ; 91ad
+ ld hl, DiplomaPalettes
+ ld de, UnknBGPals
+ ld bc, 16 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+
+ ld hl, PalPacket_9cb6 + 1
+ call CopyFourPalettes
+ call WipeAttrMap
+ call ApplyAttrMap
+ ret
+; 91c8
+
+_CGB_MapPals: ; 91c8
+ call LoadMapPals
+ ld a, SCGB_MAPPALS
+ ld [SGBPredef], a
+ ret
+; 91d1
+
+_CGB_PartyMenu: ; 91d1
+ ld hl, PalPacket_9c56 + 1
+ call CopyFourPalettes
+ call InitPartyMenuBGPal0
+ call InitPartyMenuBGPal7
+ call InitPartyMenuOBPals
+ call ApplyAttrMap
+ ret
+; 91e4
+
+_CGB_Evolution: ; 91e4
+ ld de, UnknBGPals
+ ld a, c
+ and a
+ jr z, .pokemon
+ ld a, $1a
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ jr .got_palette
+
+.pokemon
+ ld hl, PartyMon1DVs
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld c, l
+ ld b, h
+ ld a, [PlayerHPPal]
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld hl, Palettes_979c
+ ld de, UnknOBPals palette 2
+ ld bc, 6 palettes
+ ld a, BANK(UnknOBPals)
+ call FarCopyWRAM
+
+.got_palette
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 9228
+
+_CGB0c: ; 9228
+ ld hl, Palettes_b6f1
+ ld de, UnknBGPals
+ ld bc, 5 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ ld hl, Palettes_b719
+ ld de, UnknOBPals
+ ld bc, 2 palettes
+ ld a, BANK(UnknOBPals)
+ call FarCopyWRAM
+ ld a, SCGB_DIPLOMA
+ ld [SGBPredef], a
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 9251
+
+_CGB0d: ; 9251
+ ld hl, PalPacket_9cb6 + 1
+ call CopyFourPalettes
+ call WipeAttrMap
+ call ApplyAttrMap
+ ret
+; 925e
+
+_CGB_UnownPuzzle: ; 925e
+ ld hl, PalPacket_9bc6 + 1
+ call CopyFourPalettes
+ ld de, UnknOBPals
+ ld a, $4c
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ ld a, [rSVBK]
+ push af
+ ld a, BANK(UnknOBPals)
+ ld [rSVBK], a
+ ld hl, UnknOBPals
+ ld a, $1f
+ ld [hli], a
+ ld a, $0
+ ld [hl], a
+ pop af
+ ld [rSVBK], a
+ call WipeAttrMap
+ call ApplyAttrMap
+ ret
+; 9289
+
+_CGB_TrainerCard: ; 9289
+ ld de, UnknBGPals
+ xor a ; CHRIS
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, FALKNER ; KRIS
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, BUGSY
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, WHITNEY
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, MORTY
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, CHUCK
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, JASMINE
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, PRYCE
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, $24
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+
+ ; fill screen with opposite-gender palette for the card border
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, [PlayerGender]
+ and a
+ ld a, $1 ; kris
+ jr z, .got_gender
+ ld a, $0 ; chris
+.got_gender
+ call ByteFill
+ ; fill trainer sprite area with same-gender palette
+ hlcoord 14, 1, AttrMap
+ lb bc, 7, 5
+ ld a, [PlayerGender]
+ and a
+ ld a, $0 ; chris
+ jr z, .got_gender2
+ ld a, $1 ; kris
+.got_gender2
+ call FillBoxCGB
+ ; top-right corner still uses the border's palette
+ hlcoord 18, 1, AttrMap
+ ld [hl], $1
+ hlcoord 2, 11, AttrMap
+ lb bc, 2, 4
+ ld a, $1 ; falkner
+ call FillBoxCGB
+ hlcoord 6, 11, AttrMap
+ lb bc, 2, 4
+ ld a, $2 ; bugsy
+ call FillBoxCGB
+ hlcoord 10, 11, AttrMap
+ lb bc, 2, 4
+ ld a, $3 ; whitney
+ call FillBoxCGB
+ hlcoord 14, 11, AttrMap
+ lb bc, 2, 4
+ ld a, $4 ; morty
+ call FillBoxCGB
+ hlcoord 2, 14, AttrMap
+ lb bc, 2, 4
+ ld a, $5 ; chuck
+ call FillBoxCGB
+ hlcoord 6, 14, AttrMap
+ lb bc, 2, 4
+ ld a, $6 ; jasmine
+ call FillBoxCGB
+ hlcoord 10, 14, AttrMap
+ lb bc, 2, 4
+ ld a, $7 ; pryce
+ call FillBoxCGB
+ ; clair uses kris's palette
+ ld a, [PlayerGender]
+ and a
+ push af
+ jr z, .got_gender3
+ hlcoord 14, 14, AttrMap
+ lb bc, 2, 4
+ ld a, $1
+ call FillBoxCGB
+.got_gender3
+ pop af
+ ld c, $0
+ jr nz, .got_gender4
+ inc c
+.got_gender4
+ ld a, c
+ hlcoord 18, 1, AttrMap
+ ld [hl], a
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 9373
+
+_CGB_MoveList: ; 9373
+ ld de, UnknBGPals
+ ld a, $10
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ ld a, [PlayerHPPal]
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+ ld bc, HPBarPals
+ add hl, bc
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ hlcoord 11, 1, AttrMap
+ lb bc, 2, 9
+ ld a, $1
+ call FillBoxCGB
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 93a6
+
+_CGB0f: ; 93a6
+ ld hl, PalPacket_9c46 + 1
+ call CopyFourPalettes
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 93ba
+
+_CGB_PokedexSearchOption: ; 93ba
+ ld de, UnknBGPals
+ ld a, $1d
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 93d3
+
+_CGB_PackPals: ; 93d3
+; pack pals
+ ld a, [BattleType]
+ cp BATTLETYPE_TUTORIAL
+ jr z, .tutorial_male
+
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .tutorial_male
+
+ ld hl, .KrisPackPals
+ jr .got_gender
+
+.tutorial_male
+ ld hl, .ChrisPackPals
+
+.got_gender
+ ld de, UnknBGPals
+ ld bc, 8 palettes ; 6 palettes?
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ call WipeAttrMap
+ hlcoord 0, 0, AttrMap
+ lb bc, 1, 10
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 10, 0, AttrMap
+ lb bc, 1, 10
+ ld a, $2
+ call FillBoxCGB
+ hlcoord 7, 2, AttrMap
+ lb bc, 9, 1
+ ld a, $3
+ call FillBoxCGB
+ hlcoord 0, 7, AttrMap
+ lb bc, 3, 5
+ ld a, $4
+ call FillBoxCGB
+ hlcoord 0, 3, AttrMap
+ lb bc, 3, 5
+ ld a, $5
+ call FillBoxCGB
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 9439
+
+.ChrisPackPals: ; 9439
+INCLUDE "data/palettes/pack.pal"
+; 9469
+
+.KrisPackPals: ; 9469
+INCLUDE "data/palettes/pack_f.pal"
+; 9499
+
+_CGB_Pokepic: ; 9499
+ call _CGB_MapPals
+ ld de, SCREEN_WIDTH
+ hlcoord 0, 0, AttrMap
+ ld a, [wMenuBorderTopCoord]
+.loop
+ and a
+ jr z, .found_top
+ dec a
+ add hl, de
+ jr .loop
+
+.found_top
+ ld a, [wMenuBorderLeftCoord]
+ ld e, a
+ ld d, $0
+ add hl, de
+ ld a, [wMenuBorderTopCoord]
+ ld b, a
+ ld a, [wMenuBorderBottomCoord]
+ inc a
+ sub b
+ ld b, a
+ ld a, [wMenuBorderLeftCoord]
+ ld c, a
+ ld a, [wMenuBorderRightCoord]
+ sub c
+ inc a
+ ld c, a
+ ld a, $0
+ call FillBoxCGB
+ call ApplyAttrMap
+ ret
+; 94d0
+
+_CGB13: ; 94d0
+ ld hl, PalPacket_9ba6 + 1
+ call CopyFourPalettes
+ call WipeAttrMap
+ hlcoord 0, 4, AttrMap
+ lb bc, 10, SCREEN_WIDTH
+ ld a, $2
+ call FillBoxCGB
+ hlcoord 0, 6, AttrMap
+ lb bc, 6, SCREEN_WIDTH
+ ld a, $1
+ call FillBoxCGB
+ call ApplyAttrMap
+ call ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 94fa
+
+_CGB_GamefreakLogo: ; 94fa
+ ld de, UnknBGPals
+ ld a, $4e
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ ld hl, .Palette
+ ld de, UnknOBPals
+ call LoadHLPaletteIntoDE
+ ld hl, .Palette
+ ld de, UnknOBPals palette 1
+ call LoadHLPaletteIntoDE
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
+ ret
+; 9521
+
+.Palette: ; 9521
+ RGB 31, 31, 31
+ RGB 13, 11, 00
+ RGB 23, 12, 28
+ RGB 00, 00, 00
+; 9529
+
+_CGB_PlayerOrMonFrontpicPals: ; 9529
+ ld de, UnknBGPals
+ ld a, [CurPartySpecies]
+ ld bc, TempMonDVs
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
+ ret
+; 9542
+
+_CGB1e: ; 9542
+ ld de, UnknBGPals
+ ld a, [CurPartySpecies]
+ call GetMonPalettePointer_
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ call ApplyAttrMap
+ ret
+; 9555
+
+_CGB_TradeTube: ; 9555
+ ld hl, PalPacket_9cc6 + 1
+ call CopyFourPalettes
+ ld hl, PartyMenuOBPals
+ ld de, UnknOBPals
+ ld bc, 1 palettes
+ ld a, BANK(UnknOBPals)
+ call FarCopyWRAM
+ ld de, UnknOBPals palette 7
+ ld a, $1c
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrMap
+ ret
+; 9578
+
+_CGB_TrainerOrMonFrontpicPals: ; 9578
+ ld de, UnknBGPals
+ ld a, [CurPartySpecies]
+ ld bc, TempMonDVs
+ call GetFrontpicPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
+ ret
+; 9591
+
+_CGB_MysteryGift: ; 9591
+ ld hl, .Palettes
+ ld de, UnknBGPals
+ ld bc, 2 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ call ApplyPals
+ call WipeAttrMap
+ hlcoord 3, 7, AttrMap
+ lb bc, 8, 14
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 1, 5, AttrMap
+ lb bc, 1, 18
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 1, 16, AttrMap
+ lb bc, 1, 18
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 0, 0, AttrMap
+ lb bc, 17, 2
+ ld a, $1
+ call FillBoxCGB
+ hlcoord 18, 5, AttrMap
+ lb bc, 12, 1
+ ld a, $1
+ call FillBoxCGB
+ call ApplyAttrMap
+ ret
+; 95e0
+
+.Palettes: ; 95e0
+ RGB 31, 31, 31
+ RGB 16, 31, 14
+ RGB 05, 14, 21
+ RGB 05, 13, 10
+
+ RGB 31, 31, 31
+ RGB 11, 21, 25
+ RGB 05, 14, 21
+ RGB 00, 03, 19
+; 95f0
diff --git a/engine/clock_reset.asm b/engine/clock_reset.asm
index 4e6f588e9..c81271442 100755
--- a/engine/clock_reset.asm
+++ b/engine/clock_reset.asm
@@ -66,7 +66,7 @@ RestartClock: ; 20021 (8:4021)
.SetClock: ; 20051 (8:4051)
ld a, 1
ld [Buffer1], a ; which digit
- ld [Buffer2], a ; wd1eb (aliases: MovementType)
+ ld [Buffer2], a
ld a, 8
ld [Buffer3], a
call UpdateTime
@@ -151,7 +151,7 @@ RestartClock: ; 20021 (8:4021)
ret
.pressed_up
- ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
+ ld a, [Buffer1]
call ResetClock_GetWraparoundTime
ld a, [de]
inc a
@@ -163,7 +163,7 @@ RestartClock: ; 20021 (8:4021)
jr .done_scroll
.pressed_down
- ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
+ ld a, [Buffer1]
call ResetClock_GetWraparoundTime
ld a, [de]
dec a
@@ -176,14 +176,14 @@ RestartClock: ; 20021 (8:4021)
jr .done_scroll
.pressed_left
- ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
+ ld hl, Buffer1
dec [hl]
jr nz, .done_scroll
ld [hl], $3
jr .done_scroll
.pressed_right
- ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
+ ld hl, Buffer1
inc [hl]
ld a, [hl]
cp $4
@@ -202,21 +202,21 @@ RestartClock: ; 20021 (8:4021)
decoord 1, 8
ld a, [Buffer4]
ld b, a
- callba PrintDayOfWeek
+ farcall PrintDayOfWeek
ld a, [Buffer5]
ld b, a
ld a, [Buffer6]
ld c, a
decoord 11, 8
- callba PrintHoursMins
- ld a, [Buffer2] ; wd1eb (aliases: MovementType)
+ farcall PrintHoursMins
+ ld a, [Buffer2]
lb de, " ", " "
call .PlaceChars
- ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
+ ld a, [Buffer1]
lb de, "▲", "▼"
call .PlaceChars
- ld a, [Buffer1] ; wd1ea (aliases: MagikarpLength)
- ld [Buffer2], a ; wd1eb (aliases: MovementType)
+ ld a, [Buffer1]
+ ld [Buffer2], a
ret
; 20160 (8:4160)
diff --git a/engine/color.asm b/engine/color.asm
index 3bc431d22..afa8fe2e7 100644
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -1,5 +1,4 @@
-PALPACKET_LENGTH EQU $10
-INCLUDE "predef/sgb.asm"
+INCLUDE "engine/sgb_layouts.asm"
SHINY_ATK_BIT EQU 5
SHINY_DEF_VAL EQU 10
@@ -308,7 +307,7 @@ Function8bec:
ld a, [EnemySafeguardCount] ; value
and $3
call FillBoxCGB
- call LoadEDTile
+ call CopyTilemapAtOnce
ret
ApplyMonOrTrainerPals:
@@ -355,7 +354,7 @@ ApplyHPBarPals:
ld h, $0
add hl, hl
add hl, hl
- ld bc, Palettes_a8be
+ ld bc, HPBarPals
add hl, bc
ld bc, 4
ld a, $5
@@ -450,57 +449,9 @@ LoadMailPalettes:
ret
.MailPals:
- RGB 20, 31, 11
- RGB 31, 19, 00
- RGB 31, 10, 09
- RGB 00, 00, 00
-
- RGB 15, 20, 31
- RGB 30, 26, 00
- RGB 31, 12, 00
- RGB 00, 00, 00
+INCLUDE "data/palettes/mail.pal"
- RGB 24, 17, 31
- RGB 30, 26, 00
- RGB 08, 11, 31
- RGB 00, 00, 00
-
- RGB 31, 25, 17
- RGB 31, 18, 04
- RGB 28, 12, 05
- RGB 00, 00, 00
-
- RGB 19, 26, 31
- RGB 31, 05, 08
- RGB 31, 09, 31
- RGB 00, 00, 00
-
- RGB 31, 19, 28
- RGB 31, 21, 00
- RGB 12, 22, 00
- RGB 00, 00, 00
-
- RGB 19, 17, 23
- RGB 30, 26, 00
- RGB 31, 12, 00
- RGB 00, 00, 00
-
- RGB 07, 26, 31
- RGB 26, 26, 27
- RGB 31, 11, 11
- RGB 00, 00, 00
-
- RGB 21, 31, 21
- RGB 30, 26, 00
- RGB 31, 12, 00
- RGB 00, 00, 00
-
- RGB 07, 26, 31
- RGB 31, 31, 00
- RGB 00, 21, 00
- RGB 00, 00, 00
-
-INCLUDE "predef/cgb.asm"
+INCLUDE "engine/cgb_layouts.asm"
Function95f0:
; XXX
@@ -544,7 +495,7 @@ GetPredefPal:
add hl, hl
add hl, hl
add hl, hl
- ld bc, Palettes_9df6
+ ld bc, PredefPals
add hl, bc
ret
@@ -731,7 +682,7 @@ CGB_ApplyPartyMenuHPPals: ; 96f3 CGB layout $fc
ret
InitPartyMenuOBPals:
- ld hl, Palettes_b681
+ ld hl, PartyMenuOBPals
ld de, UnknOBPals
ld bc, 2 palettes
ld a, $5
@@ -740,7 +691,7 @@ InitPartyMenuOBPals:
GetBattlemonBackpicPalettePointer:
push de
- callba GetPartyMonDVs
+ farcall GetPartyMonDVs
ld c, l
ld b, h
ld a, [TempBattleMonSpecies]
@@ -750,7 +701,7 @@ GetBattlemonBackpicPalettePointer:
GetEnemyFrontpicPalettePointer:
push de
- callba GetEnemyMonDVs
+ farcall GetEnemyMonDVs
ld c, l
ld b, h
ld a, [TempEnemyMonSpecies]
@@ -805,42 +756,14 @@ Function9779: mobile
dec c
jr nz, .loop
ld hl, Palettes_979c
- ld de, UnknOBPals + 8 * 2
+ ld de, UnknOBPals palette 2
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
ret
Palettes_979c:
- RGB 31, 31, 31
- RGB 25, 25, 25
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 07
- RGB 31, 16, 01
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 19, 24
- RGB 30, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 25, 01
- RGB 05, 14, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 08, 12, 31
- RGB 01, 04, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 24, 18, 07
- RGB 20, 15, 03
- RGB 00, 00, 00
+INCLUDE "data/palettes/979c.pal"
Function97cc:
; XXX
@@ -1142,7 +1065,7 @@ SGBBorder_PushBGPals:
call DisableLCD
ld a, %11100100
ld [rBGP], a
- ld hl, Palettes_9df6
+ ld hl, PredefPals
ld de, VTiles1
ld bc, $1000
call CopyData
@@ -1351,540 +1274,43 @@ PalPacket_9dc6: db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $
PalPacket_9dd6: db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
PalPacket_9de6: db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea
-Palettes_9df6:
- RGB 31, 31, 31
- RGB 22, 25, 19
- RGB 16, 21, 30
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 27, 28, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 24, 28, 19
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 24, 24, 24
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 23, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 24, 21, 27
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 24, 16
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 25, 30, 26
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 25, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 20, 19
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 26, 19
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 27, 28, 27
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 24, 30, 23
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 29, 24, 29
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 26, 23, 29
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 25, 23, 20
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 29, 26, 18
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 21, 18
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 26, 25, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 22, 21, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 22, 25, 21
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 21, 22
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 20, 20
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 26, 26, 26
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 14, 09
- RGB 15, 20, 20
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 28, 22
- RGB 15, 20, 20
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 07, 07, 07
- RGB 02, 03, 03
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 22, 17
- RGB 16, 14, 19
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 18, 20, 27
- RGB 11, 15, 23
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 20, 10
- RGB 26, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 14, 19, 25
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 27, 22, 24
- RGB 21, 15, 23
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 28, 20, 15
- RGB 21, 14, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 20, 26, 16
- RGB 09, 20, 11
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 28, 15, 21
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 26, 20, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 26, 21, 22
- RGB 15, 15, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 23, 19, 13
- RGB 14, 12, 17
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 16, 18, 21
- RGB 10, 12, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 22, 15, 16
- RGB 17, 02, 05
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 15, 20, 20
- RGB 05, 16, 16
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 23, 15, 19
- RGB 14, 04, 12
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 20, 17, 18
- RGB 18, 13, 11
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 23, 21, 16
- RGB 12, 12, 10
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 30, 22, 24
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 26, 23, 16
- RGB 29, 14, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 18, 18, 18
- RGB 10, 10, 10
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 00, 23, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 31, 23, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 31, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 29, 26, 19
- RGB 27, 20, 14
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 24, 20, 10
- RGB 21, 00, 04
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 20, 10
- RGB 21, 00, 04
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 26, 16
- RGB 16, 12, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 15, 28, 26
- RGB 12, 22, 26
- RGB 03, 16, 14
-
- RGB 31, 31, 31
- RGB 15, 28, 26
- RGB 23, 24, 24
- RGB 00, 00, 00
-
- RGB 31, 31, 24
- RGB 07, 27, 19
- RGB 26, 20, 10
- RGB 19, 12, 08
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 31, 13, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 16, 18, 21
- RGB 10, 12, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 23, 21, 16
- RGB 12, 12, 10
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 14, 00
- RGB 07, 11, 15
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 26, 21, 22
- RGB 26, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 27, 04
- RGB 24, 20, 11
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 13, 25
- RGB 24, 20, 11
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 16, 19, 29
- RGB 24, 20, 11
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 18, 18, 18
- RGB 16, 10, 07
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 18, 18, 18
- RGB 16, 10, 07
-
- RGB 31, 31, 31
- RGB 20, 26, 16
- RGB 18, 18, 18
- RGB 16, 10, 07
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 18, 18, 18
- RGB 16, 10, 07
-
- RGB 31, 31, 31
- RGB 18, 18, 18
- RGB 26, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 28, 15, 21
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 26, 20, 00
- RGB 16, 19, 29
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 16, 02, 30
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 16, 13, 04
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 28, 04, 02
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 18, 23, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 24, 20, 11
- RGB 18, 13, 11
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 25, 30, 00
- RGB 25, 30, 00
-
- RGB 00, 00, 00
- RGB 08, 11, 11
- RGB 21, 21, 21
- RGB 31, 31, 31
+PredefPals:
+INCLUDE "data/palettes/predef.pal"
SGBBorderMap:
- db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
- db $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $54, $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54
- db $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54
- db $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54, $20, $54, $07, $14, $08, $14, $09, $14, $0a, $14, $0b, $14, $0c, $14, $0d, $14, $07, $14, $07, $14, $18, $14, $09, $14, $1a, $14, $1b, $14, $0d, $14, $0c, $14, $1c, $14, $29, $14, $07, $14, $20, $14, $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54
- db $31, $14, $32, $14, $07, $14, $07, $14, $32, $54, $36, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $38, $10, $27, $10, $32, $14, $07, $54, $07, $54, $32, $54, $31, $54
- db $05, $14, $06, $14, $07, $14, $07, $54, $06, $54, $1f, $10, $37, $10, $06, $14, $07, $14, $07, $54, $06, $54, $05, $54
- db $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $1f, $10, $37, $10, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54
- db $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $1f, $10, $37, $10, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54
- db $33, $14, $34, $14, $35, $14, $35, $54, $34, $54, $1f, $10, $37, $10, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54
- db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
- db $02, $54, $01, $54, $07, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $01, $14, $02, $14
- db $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14
- db $22, $54, $21, $54, $20, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $20, $14, $21, $14, $22, $14
- db $32, $54, $31, $54, $30, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $30, $14, $31, $14, $32, $14
- db $06, $54, $05, $54, $04, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $04, $14, $05, $14, $06, $14
- db $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14
- db $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14
- db $34, $54, $33, $54, $07, $54, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $33, $14, $34, $14
- db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $1f, $10, $37, $10, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
- db $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $1f, $10, $37, $10, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54
- db $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $1f, $10, $37, $10, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54
- db $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $1f, $10, $37, $10, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54
- db $31, $14, $32, $14, $07, $14, $07, $14, $32, $54, $1f, $10, $37, $10, $32, $14, $07, $54, $07, $54, $32, $54, $31, $54
- db $05, $14, $06, $14, $07, $14, $07, $54, $06, $54, $2e, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2f, $10, $2d, $10, $06, $14, $07, $14, $07, $54, $06, $54, $05, $54
- db $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $39, $14, $0e, $14, $09, $14, $0f, $14, $28, $14, $07, $14, $19, $14, $0c, $14, $1c, $14, $29, $14, $2a, $14, $2b, $14, $2c, $14, $39, $14, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54
- db $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54
- db $33, $14, $34, $14, $35, $14, $35, $54, $34, $54, $24, $54, $07, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54
- db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $20, $14, $21, $14, $22, $14, $23, $14, $23, $54, $22, $54, $21, $54, $20, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
+INCLUDE "data/sgb_border_map.asm"
SGBBorderPalettes:
- RGB 24, 06, 06
- RGB 24, 24, 26
- RGB 14, 15, 20
- RGB 04, 07, 10
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 18, 24, 18
- RGB 31, 26, 15
- RGB 26, 19, 10
- RGB 12, 07, 05
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 18, 06, 31
- RGB 31, 31, 29
- RGB 31, 12, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 12, 31, 06
- RGB 22, 26, 30
- RGB 16, 17, 21
- RGB 00, 03, 00
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
-
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
- RGB 31, 31, 25
+INCLUDE "data/palettes/sgb_border.pal"
SGBBorder:
-INCBIN "gfx/misc/sgb_border.2bpp"
+INCBIN "gfx/sgb/sgb_border.2bpp"
-Palettes_a8be:
+HPBarPals:
+; green
RGB 30, 26, 15
RGB 00, 23, 00
-
+; yellow
RGB 30, 26, 15
RGB 31, 21, 00
-
+; red
RGB 30, 26, 15
RGB 31, 00, 00
-Palettes_a8ca:
+ExpBarPalette:
+; blue
RGB 30, 26, 15
RGB 04, 17, 31
INCLUDE "gfx/pics/palette_pointers.asm"
-
-INCLUDE "gfx/trainers/palette_pointers.asm"
+INCLUDE "gfx/trainer_palettes.asm"
LoadMapPals:
- callba LoadSpecialMapPalette
+ farcall LoadSpecialMapPalette
jr c, .got_pals
; Which palette group is based on whether we're outside or inside
- ld a, [wPermission]
+ ld a, [wEnvironment]
and 7
ld e, a
ld d, 0
@@ -1948,10 +1374,10 @@ LoadMapPals:
call AddNTimes
ld de, UnknOBPals
ld bc, 8 palettes
- ld a, $5 ; BANK(UnknOBPals)
+ ld a, BANK(UnknOBPals)
call FarCopyWRAM
- ld a, [wPermission]
+ ld a, [wEnvironment]
cp TOWN
jr z, .outside
cp ROUTE
@@ -1967,13 +1393,13 @@ LoadMapPals:
add hl, de
ld a, [TimeOfDayPal]
and 3
- cp NITE
+ cp NITE_F
jr c, .morn_day
rept 4
inc hl
endr
.morn_day
- ld de, UnknBGPals + 6 palettes + 2
+ ld de, UnknBGPals palette PAL_BG_ROOF + 2
ld bc, 4
ld a, $5
call FarCopyWRAM
@@ -1983,10 +1409,10 @@ endr
dw .OutdoorColors ; unused
dw .OutdoorColors ; TOWN
dw .OutdoorColors ; ROUTE
- dw .IndoorColors ; INDOOR
+ dw .IndoorColors ; INDOOR
dw .DungeonColors ; CAVE
- dw .Perm5Colors ; PERM_5
- dw .IndoorColors ; GATE
+ dw .Perm5Colors ; ENVIRONMENT_5
+ dw .IndoorColors ; GATE
dw .DungeonColors ; DUNGEON
; Valid indices: $00 - $29
@@ -2027,324 +1453,34 @@ Palette_b311: ; b311 not mobile
RGB 00, 00, 00
TilesetBGPalette:
-INCLUDE "tilesets/bg.pal"
+INCLUDE "data/palettes/tileset_bg.pal"
MapObjectPals::
-INCLUDE "tilesets/ob.pal"
+INCLUDE "data/palettes/map_objects.pal"
RoofPals:
-INCLUDE "tilesets/roof.pal"
+INCLUDE "data/palettes/roofs.pal"
DiplomaPalettes:
- RGB 27, 31, 27
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 07, 06
- RGB 20, 02, 03
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 10, 31, 09
- RGB 04, 14, 01
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 08, 12, 31
- RGB 01, 04, 31
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 31, 07
- RGB 31, 16, 01
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 22, 16, 08
- RGB 13, 07, 01
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 15, 31, 31
- RGB 05, 17, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 11, 11, 19
- RGB 07, 07, 12
- RGB 00, 00, 00
-
-Palettes_b681:
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 10, 14, 20
- RGB 00, 00, 00
+INCLUDE "data/palettes/diploma.pal"
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 07, 07, 07
-
- RGB 31, 31, 31
- RGB 31, 31, 07
- RGB 31, 16, 01
- RGB 07, 07, 07
-
- RGB 31, 31, 31
- RGB 31, 19, 24
- RGB 30, 10, 06
- RGB 07, 07, 07
-
- RGB 31, 31, 31
- RGB 12, 25, 01
- RGB 05, 14, 00
- RGB 07, 07, 07
-
- RGB 31, 31, 31
- RGB 08, 12, 31
- RGB 01, 04, 31
- RGB 07, 07, 07
-
- RGB 31, 31, 31
- RGB 24, 18, 07
- RGB 20, 15, 03
- RGB 07, 07, 07
+PartyMenuOBPals:
+INCLUDE "data/palettes/party_menu.pal"
Palettes_b6f1:
- RGB 31, 31, 31
- RGB 18, 23, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 22, 00, 31
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 00, 00
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 25, 22, 00
- RGB 15, 20, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 23, 26, 31
- RGB 18, 23, 31
- RGB 00, 00, 00
+INCLUDE "data/palettes/b6f1.pal"
Palettes_b719:
- RGB 31, 31, 31
- RGB 07, 06, 03
- RGB 07, 06, 03
- RGB 07, 06, 03
-
- RGB 31, 31, 31
- RGB 31, 31, 00
- RGB 26, 22, 00
- RGB 00, 00, 00
+INCLUDE "data/palettes/b719.pal"
MalePokegearPals:
- RGB 28, 31, 20
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 00, 00, 31
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 15, 07, 00
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 31, 15, 00
- RGB 15, 07, 00
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 00, 00, 31
- RGB 31, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 15, 07, 00
- RGB 31, 00, 00
+INCLUDE "data/palettes/pokegear.pal"
FemalePokegearPals:
- RGB 28, 31, 20
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 00, 00, 31
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 15, 07, 00
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 10, 18, 31
- RGB 13, 06, 31
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 00, 00, 31
- RGB 31, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 15, 07, 00
- RGB 31, 00, 00
+INCLUDE "data/palettes/pokegear_f.pal"
Palettes_b789:
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 18, 18, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 10, 11, 31
- RGB 18, 18, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 31, 11
- RGB 18, 18, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 29, 26, 05
- RGB 18, 18, 18
- RGB 00, 00, 00
-
-Palettes_b7a9:
- RGB 31, 31, 31
- RGB 24, 25, 28
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 10, 06
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 15, 31, 00
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 15, 31
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 15, 21, 31
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 11
- RGB 31, 31, 06
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 16, 19, 29
- RGB 25, 22, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 10, 06
- RGB 31, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 25, 01
- RGB 05, 14, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 25, 01
- RGB 30, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 06
- RGB 20, 15, 03
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 06
- RGB 15, 21, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 06
- RGB 20, 15, 03
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 24, 21
- RGB 31, 13, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
+INCLUDE "data/palettes/b789.pal"
+SlotMachinePals:
+INCLUDE "data/palettes/slot_machine.pal"
diff --git a/engine/credits.asm b/engine/credits.asm
index 1888ef27d..0fe7685a6 100644
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -1,121 +1,7 @@
INCLUDE "includes.asm"
-SECTION "Credits", ROMX
-
- const_def
- const SATOSHI_TAJIRI
- const JUNICHI_MASUDA
- const TETSUYA_WATANABE
- const SHIGEKI_MORIMOTO
- const SOUSUKE_TAMADA
- const TAKENORI_OOTA
- const KEN_SUGIMORI
- const MOTOFUMI_FUJIWARA
- const ATSUKO_NISHIDA
- const MUNEO_SAITO
- const SATOSHI_OOTA
- const RENA_YOSHIKAWA
- const JUN_OKUTANI
- const HIRONOBU_YOSHIDA
- const ASUKA_IWASHITA
- const GO_ICHINOSE
- const MORIKAZU_AOKI
- const KOHJI_NISHINO
- const KENJI_MATSUSHIMA
- const TOSHINOBU_MATSUMIYA
- const SATORU_IWATA
- const NOBUHIRO_SEYA
- const KAZUHITO_SEKINE
- const TETSUJI_OOTA
- const NCL_SUPER_MARIO_CLUB
- const SARUGAKUCHO
- const AKITO_MORI
- const TAKAHIRO_HARADA
- const TOHRU_HASHIMOTO
- const NOBORU_MATSUMOTO
- const TAKEHIRO_IZUSHI
- const TAKASHI_KAWAGUCHI
- const TSUNEKAZU_ISHIHARA
- const HIROSHI_YAMAUCHI
- const KENJI_SAIKI
- const ATSUSHI_TADA
- const NAOKO_KAWAKAMI
- const HIROYUKI_ZINNAI
- const KUNIMI_KAWAMURA
- const HISASHI_SOGABE
- const KEITA_KAGAYA
- const YOSHINORI_MATSUDA
- const HITOMI_SATO
- const TORU_OSAWA
- const TAKAO_OHARA
- const YUICHIRO_ITO
- const TAKAO_SHIMIZU
- const PLANNING
- const KEITA_NAKAMURA
- const HIROTAKA_UEMURA
- const HIROAKI_TAMURA
- const NORIAKI_SAKAGUCHI
- const MIYUKI_SATO
- const GAKUZI_NOMOTO
- const AI_MASHIMA
- const MIKIHIRO_ISHIKAWA
- const HIDEYUKI_HASHIMOTO
- const SATOSHI_YAMATO
- const SHIGERU_MIYAMOTO
- const GAIL_TILDEN
- const NOB_OGASAWARA
- const SETH_MCMAHILL
- const HIROTO_ALEXANDER
- const TERESA_LILLYGREN
- const THOMAS_HERTZOG
- const ERIK_JOHNSON
- const HIRO_NAKAMURA
- const TERUKI_MURAKAWA
- const KAZUYOSHI_OSAWA
- const KIMIKO_NAKAMICHI
- const CREDIT_END
- const CREDIT_UNKNOWN
- const STAFF
- const DIRECTOR
- const CODIRECTOR
- const PROGRAMMERS
- const GRAPHICS_DIRECTOR
- const MONSTER_DESIGN
- const GRAPHICS_DESIGN
- const CREDIT_MUSIC
- const CREDIT_SOUND_EFFECTS
- const GAME_DESIGN
- const GAME_SCENARIO
- const TOOL_PROGRAMMING
- const PARAMETRIC_DESIGN
- const SCRIPT_DESIGN
- const MAP_DATA_DESIGN
- const MAP_DESIGN
- const PRODUCT_TESTING
- const SPECIAL_THANKS
- const PRODUCERS
- const EXECUTIVE_PRODUCER
- const POKEMON_ANIMATION
- const POKEDEX_TEXT
- const MOBILE_PRJ_LEADER
- const MOBILE_SYSTEM_AD
- const MOBILE_STADIUM_DIR
- const COORDINATION
- const COPYRIGHT
- const US_VERSION_STAFF
- const US_COORDINATION
- const TEXT_TRANSLATION
- const PAAD_TESTING
-
-const_value SET -7
- const CREDITS_THEEND
- const CREDITS_WAIT2
- const CREDITS_MUSIC
- const CREDITS_CLEAR
- const CREDITS_SCENE
- const CREDITS_WAIT
- const CREDITS_END
+SECTION "Credits", ROMX
Credits:: ; 109847
bit 6, b ; Hall Of Fame
@@ -196,7 +82,7 @@ Credits:: ; 109847
xor a
ld [hBGMapMode], a
ld [CreditsPos], a
- ld [wcd21], a
+ ld [CreditsUnusedCD21], a
ld [CreditsTimer], a
.execution_loop
@@ -491,7 +377,7 @@ ParseCredits: ; 1099aa
ld a, MUSIC_POST_CREDITS % $100
ld [MusicFadeID], a
ld a, MUSIC_POST_CREDITS / $100
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
ret
.get
@@ -635,7 +521,6 @@ GetCreditsPalette: ; 109b2c
.UpdatePals:
; Update the first three colors in both palette buffers.
-
push af
push hl
add UnknBGPals % $100
@@ -657,72 +542,8 @@ GetCreditsPalette: ; 109b2c
call CopyBytes
ret
-
CreditsPalettes:
-
-; Pichu
- RGB 31, 00, 31
- RGB 31, 25, 00
- RGB 11, 14, 31
- RGB 07, 07, 07
-
- RGB 31, 05, 05
- RGB 11, 14, 31
- RGB 11, 14, 31
- RGB 31, 31, 31
-
- RGB 31, 05, 05
- RGB 00, 00, 00
- RGB 31, 31, 31
- RGB 31, 31, 31
-
-; Smoochum
- RGB 31, 31, 31
- RGB 31, 27, 00
- RGB 26, 06, 31
- RGB 07, 07, 07
-
- RGB 03, 13, 31
- RGB 20, 00, 24
- RGB 26, 06, 31
- RGB 31, 31, 31
-
- RGB 03, 13, 31
- RGB 00, 00, 00
- RGB 31, 31, 31
- RGB 31, 31, 31
-
-; Ditto
- RGB 31, 31, 31
- RGB 23, 12, 28
- RGB 31, 22, 00
- RGB 07, 07, 07
-
- RGB 03, 20, 00
- RGB 31, 22, 00
- RGB 31, 22, 00
- RGB 31, 31, 31
-
- RGB 03, 20, 00
- RGB 00, 00, 00
- RGB 31, 31, 31
- RGB 31, 31, 31
-
-; Igglybuff
- RGB 31, 31, 31
- RGB 31, 10, 31
- RGB 31, 00, 09
- RGB 07, 07, 07
-
- RGB 31, 14, 00
- RGB 31, 00, 09
- RGB 31, 00, 09
- RGB 31, 31, 31
-
- RGB 31, 14, 00
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
+INCLUDE "data/palettes/credits.pal"
; 109bca
Credits_LoadBorderGFX: ; 109bca (42:5bca)
@@ -791,521 +612,6 @@ Credits_TheEnd: ; 109c11 (42:5c11)
; 109c24 (42:5c24)
-CreditsBorderGFX: INCBIN "gfx/credits/border.2bpp"
-
-CreditsMonsGFX:
-CreditsPichuGFX: INCBIN "gfx/credits/pichu.2bpp"
-CreditsSmoochumGFX: INCBIN "gfx/credits/smoochum.2bpp"
-CreditsDittoGFX: INCBIN "gfx/credits/ditto.2bpp"
-CreditsIgglybuffGFX: INCBIN "gfx/credits/igglybuff.2bpp"
-
-
-CreditsScript: ; 10acb4
-
-; Clear the banner.
- db CREDITS_CLEAR
-
-; Pokemon Crystal Version Staff
- db STAFF, 1
-
- db CREDITS_WAIT, 8
-
-; Play the credits music.
- db CREDITS_MUSIC
-
- db CREDITS_WAIT2, 10
-
- db CREDITS_WAIT, 1
-
-; Update the banner.
- db CREDITS_SCENE, 0 ; Pichu
-
- db DIRECTOR, 1
- db SATOSHI_TAJIRI, 2
-
- db CREDITS_WAIT, 12
-
- db CODIRECTOR, 1
- db JUNICHI_MASUDA, 2
-
- db CREDITS_WAIT, 12
-
- db PROGRAMMERS, 0
- db SOUSUKE_TAMADA, 1
- db HISASHI_SOGABE, 2
- db KEITA_KAGAYA, 3
- db YOSHINORI_MATSUDA, 4
-
- db CREDITS_WAIT, 12
-
- db PROGRAMMERS, 0
- db SHIGEKI_MORIMOTO, 1
- db TETSUYA_WATANABE, 2
- db TAKENORI_OOTA, 3
-
- db CREDITS_WAIT, 12
-
- db GRAPHICS_DIRECTOR, 1
- db KEN_SUGIMORI, 2
-
- db CREDITS_WAIT, 12
-
- db MONSTER_DESIGN, 0
- db KEN_SUGIMORI, 1
- db MOTOFUMI_FUJIWARA, 2
- db SHIGEKI_MORIMOTO, 3
- db HIRONOBU_YOSHIDA, 4
- db SATOSHI_OOTA, 5
-
- db CREDITS_WAIT, 12
-
- db MONSTER_DESIGN, 0
- db ATSUKO_NISHIDA, 1
- db MUNEO_SAITO, 2
- db RENA_YOSHIKAWA, 3
-
- db CREDITS_WAIT, 12
-
- db POKEMON_ANIMATION, 1
- db HIRONOBU_YOSHIDA, 2
- db JUN_OKUTANI, 3
-
- db CREDITS_WAIT, 12
-
-; Clear the banner.
- db CREDITS_CLEAR
-
- db CREDITS_WAIT, 1
-
-; Update the banner.
- db CREDITS_SCENE, 1 ; Smoochum
-
- db GRAPHICS_DESIGN, 0
- db HIRONOBU_YOSHIDA, 1
- db JUN_OKUTANI, 2
- db ASUKA_IWASHITA, 3
- db TETSUYA_WATANABE, 4
-
- db CREDITS_WAIT, 12
-
- db CREDIT_MUSIC, 0
- db JUNICHI_MASUDA, 1
- db MORIKAZU_AOKI, 2
- db GO_ICHINOSE, 3
-
- db CREDITS_WAIT, 12
-
- db CREDIT_SOUND_EFFECTS, 0
- db MORIKAZU_AOKI, 1
- db JUNICHI_MASUDA, 2
- db TETSUYA_WATANABE, 3
-
- db CREDITS_WAIT, 12
-
- db GAME_DESIGN, 0
- db JUNICHI_MASUDA, 1
- db SHIGEKI_MORIMOTO, 2
- db KOHJI_NISHINO, 3
-
- db CREDITS_WAIT, 12
-
- db GAME_DESIGN, 0
- db TETSUJI_OOTA, 1
- db HITOMI_SATO, 2
- db KENJI_MATSUSHIMA, 3
-
- db CREDITS_WAIT, 12
-
- db GAME_SCENARIO, 0
- db JUNICHI_MASUDA, 1
- db KOHJI_NISHINO, 2
- db TOSHINOBU_MATSUMIYA, 3
- db KENJI_MATSUSHIMA, 4
-
- db CREDITS_WAIT, 12
-
- db POKEDEX_TEXT, 1
- db TOSHINOBU_MATSUMIYA, 2
-
- db CREDITS_WAIT, 12
-
- db TOOL_PROGRAMMING, 1
- db SOUSUKE_TAMADA, 2
- db TAKENORI_OOTA, 3
-
- db CREDITS_WAIT, 12
-
- db PARAMETRIC_DESIGN, 1
- db KOHJI_NISHINO, 2
-
- db CREDITS_WAIT, 12
-
-; Clear the banner.
- db CREDITS_CLEAR
-
- db CREDITS_WAIT, 1
-
-; Update the banner.
- db CREDITS_SCENE, 2 ; Ditto
-
- db SCRIPT_DESIGN, 1
- db TETSUJI_OOTA, 2
- db NOBUHIRO_SEYA, 3
-
- db CREDITS_WAIT, 12
-
- db MAP_DATA_DESIGN, 1
- db TETSUJI_OOTA, 2
- db KAZUHITO_SEKINE, 3
-
- db CREDITS_WAIT, 12
-
- db MAP_DESIGN, 0
- db TETSUJI_OOTA, 1
- db KOHJI_NISHINO, 2
- db NOBUHIRO_SEYA, 3
-
- db CREDITS_WAIT, 12
-
- db COORDINATION, 1
- db HIROYUKI_ZINNAI, 2
-
- db CREDITS_WAIT, 12
-
- db PRODUCERS, 0
- db SATORU_IWATA, 1
- db SATOSHI_YAMATO, 2
- db SHIGERU_MIYAMOTO, 3
-
- db CREDITS_WAIT, 12
-
- db PRODUCERS, 1
- db TSUNEKAZU_ISHIHARA, 2
-
- db CREDITS_WAIT, 12
-
-; Clear the banner.
- db CREDITS_CLEAR
-
- db CREDITS_WAIT, 1
-
-; Update the banner.
- db CREDITS_SCENE, 3 ; Igglybuff
-
- db US_VERSION_STAFF, 2
-
- db CREDITS_WAIT, 9
-
- db US_COORDINATION, 1
- db GAIL_TILDEN, 2
- db HIRO_NAKAMURA, 3
-
- db CREDITS_WAIT, 12
-
- db US_COORDINATION, 1
- db JUNICHI_MASUDA, 2
- db SETH_MCMAHILL, 3
-
- db CREDITS_WAIT, 12
-
- db US_COORDINATION, 1
- db HIROTO_ALEXANDER, 2
- db TERESA_LILLYGREN, 3
-
- db CREDITS_WAIT, 12
-
- db TEXT_TRANSLATION, 1
- db NOB_OGASAWARA, 2
-
- db CREDITS_WAIT, 12
-
- db PROGRAMMERS, 1
- db TERUKI_MURAKAWA, 2
- db KAZUYOSHI_OSAWA, 3
-
- db CREDITS_WAIT, 12
-
- db PAAD_TESTING, 1
- db THOMAS_HERTZOG, 2
- db ERIK_JOHNSON, 3
-
- db CREDITS_WAIT, 12
-
- db PRODUCT_TESTING, 0
- db PLANNING, 1
-
- db CREDITS_WAIT, 12
-
- db PRODUCT_TESTING, 0
- db KEITA_NAKAMURA, 1
- db HIROTAKA_UEMURA, 2
- db HIROAKI_TAMURA, 3
- db NORIAKI_SAKAGUCHI, 4
-
- db CREDITS_WAIT, 12
-
- db PRODUCT_TESTING, 0
- db NCL_SUPER_MARIO_CLUB, 1
- db KENJI_SAIKI, 2
- db ATSUSHI_TADA, 3
- db MIYUKI_SATO, 4
-
- db CREDITS_WAIT, 12
-
- db SPECIAL_THANKS, 0
- db KIMIKO_NAKAMICHI, 1
- db AKITO_MORI, 2
-
- db CREDITS_WAIT, 12
-
- db SPECIAL_THANKS, 0
- db GAKUZI_NOMOTO, 1
- db AI_MASHIMA, 2
- db KUNIMI_KAWAMURA, 3
-
- db CREDITS_WAIT, 12
-
- db SPECIAL_THANKS, 0
- db MIKIHIRO_ISHIKAWA, 1
- db HIDEYUKI_HASHIMOTO, 2
-
- db CREDITS_WAIT, 12
-
- db EXECUTIVE_PRODUCER, 1
- db HIROSHI_YAMAUCHI, 2
-
- db CREDITS_WAIT, 12
-
- db COPYRIGHT, 1
-
- db CREDITS_WAIT, 9
-
-; Display "The End" graphic.
- db CREDITS_THEEND
-
- db CREDITS_WAIT, 20
-
- db CREDITS_END
-; 10ae13
-
-
-CreditsStrings:
- dw .SatoshiTajiri
- dw .JunichiMasuda
- dw .TetsuyaWatanabe
- dw .ShigekiMorimoto
- dw .SousukeTamada
- dw .TakenoriOota
- dw .KenSugimori
- dw .MotofumiFujiwara
- dw .AtsukoNishida
- dw .MuneoSaito
- dw .SatoshiOota
- dw .RenaYoshikawa
- dw .JunOkutani
- dw .HironobuYoshida
- dw .AsukaIwashita
- dw .GoIchinose
- dw .MorikazuAoki
- dw .KohjiNishino
- dw .KenjiMatsushima
- dw .ToshinobuMatsumiya
- dw .SatoruIwata
- dw .NobuhiroSeya
- dw .KazuhitoSekine
- dw .TetsujiOota
- dw .NclSuperMarioClub
- dw .Sarugakucho
- dw .AkitoMori
- dw .TakahiroHarada
- dw .TohruHashimoto
- dw .NoboruMatsumoto
- dw .TakehiroIzushi
- dw .TakashiKawaguchi
- dw .TsunekazuIshihara
- dw .HiroshiYamauchi
- dw .KenjiSaiki
- dw .AtsushiTada
- dw .NaokoKawakami
- dw .HiroyukiZinnai
- dw .KunimiKawamura
- dw .HisashiSogabe
- dw .KeitaKagaya
- dw .YoshinoriMatsuda
- dw .HitomiSato
- dw .ToruOsawa
- dw .TakaoOhara
- dw .YuichiroIto
- dw .TakaoShimizu
- dw .Planning
- dw .KeitaNakamura
- dw .HirotakaUemura
- dw .HiroakiTamura
- dw .NoriakiSakaguchi
- dw .MiyukiSato
- dw .GakuziNomoto
- dw .AiMashima
- dw .MikihiroIshikawa
- dw .HideyukiHashimoto
- dw .SatoshiYamato
- dw .ShigeruMiyamoto
- dw .GailTilden
- dw .NobOgasawara
- dw .SethMcMahill
- dw .HirotoAlexander
- dw .TeresaLillygren
- dw .ThomasHertzog
- dw .ErikJohnson
- dw .HiroNakamura
- dw .TerukiMurakawa
- dw .KazuyoshiOsawa
- dw .KimikoNakamichi
- dw .End
- dw .Unknown
- dw .Staff
- dw .Director
- dw .CoDirector
- dw .Programmers
- dw .GraphicsDirector
- dw .MonsterDesign
- dw .GraphicsDesign
- dw .Music
- dw .SoundEffects
- dw .GameDesign
- dw .GameScenario
- dw .ToolProgramming
- dw .ParametricDesign
- dw .ScriptDesign
- dw .MapDataDesign
- dw .MapDesign
- dw .ProductTesting
- dw .SpecialThanks
- dw .Producers
- dw .ExecutiveProducer
- dw .PokemonAnimation
- dw .PokedexText
- dw .MobilePrjLeader
- dw .MobileSystemAd
- dw .MobileStadiumDir
- dw .Coordination
- dw .Copyright
- dw .UsVersionStaff
- dw .UsCoordination
- dw .TextTranslation
- dw .PaadTesting
-
-.SatoshiTajiri: db " SATOSHI TAJIRI@" ; "たじり さとし@"
-.JunichiMasuda: db " JUNICHI MASUDA@" ; "ますだ じゅんいち@"
-.TetsuyaWatanabe: db " TETSUYA WATANABE@" ; "わたなべ てつや@"
-.ShigekiMorimoto: db " SHIGEKI MORIMOTO@" ; "もりもと しげき@"
-.SousukeTamada: db " SOUSUKE TAMADA@" ; "たまだ そうすけ@"
-.TakenoriOota: db " TAKENORI OOTA@" ; "おおた たけのり@"
-.KenSugimori: db " KEN SUGIMORI@" ; "すぎもり けん@"
-.MotofumiFujiwara: db " MOTOFUMI FUJIWARA@" ; "ふじわら もとふみ@"
-.AtsukoNishida: db " ATSUKO NISHIDA@" ; "にしだ あつこ@"
-.MuneoSaito: db " MUNEO SAITO@" ; "さいとう むねお@"
-.SatoshiOota: db " SATOSHI OOTA@" ; "おおた さとし@"
-.RenaYoshikawa: db " RENA YOSHIKAWA@" ; "よしかわ れな@"
-.JunOkutani: db " JUN OKUTANI@" ; "おくたに じゅん@"
-.HironobuYoshida: db " HIRONOBU YOSHIDA@" ; "よしだ ひろのぶ@"
-.AsukaIwashita: db " ASUKA IWASHITA@" ; "いわした あすか@"
-.GoIchinose: db " GO ICHINOSE@" ; "いちのせ ごう@"
-.MorikazuAoki: db " MORIKAZU AOKI@" ; "あおき もりかず@"
-.KohjiNishino: db " KOHJI NISHINO@" ; "にしの こうじ@"
-.KenjiMatsushima: db " KENJI MATSUSHIMA@" ; "まつしま けんじ@"
-.ToshinobuMatsumiya: db "TOSHINOBU MATSUMIYA@" ; "まつみや としのぶ@"
-.SatoruIwata: db " SATORU IWATA@" ; "いわた さとる@"
-.NobuhiroSeya: db " NOBUHIRO SEYA@" ; "せや のぶひろ@"
-.KazuhitoSekine: db " KAZUHITO SEKINE@" ; "せきね かずひと@"
-.TetsujiOota: db " TETSUJI OOTA@" ; "おおた てつじ@"
-.NclSuperMarioClub: db "NCL SUPER MARIO CLUB@" ; "スーパーマりォクラブ@"
-.Sarugakucho: db " SARUGAKUCHO@" ; "さるがくちょう@"
-.AkitoMori: db " AKITO MORI@" ; "もり あきと@"
-.TakahiroHarada: db " TAKAHIRO HARADA@" ; "はらだ たかひろ@"
-.TohruHashimoto: db " TOHRU HASHIMOTO@" ; "はしもと とおる@"
-.NoboruMatsumoto: db " NOBORU MATSUMOTO@" ; "まつもと のぼる@"
-.TakehiroIzushi: db " TAKEHIRO IZUSHI@" ; "いずし たけひろ@"
-.TakashiKawaguchi: db " TAKASHI KAWAGUCHI@" ; "かわぐち たかし@"
-.TsunekazuIshihara: db " TSUNEKAZU ISHIHARA@" ; "いしはら つねかず@"
-.HiroshiYamauchi: db " HIROSHI YAMAUCHI@" ; "やまうち ひろし@"
-.KenjiSaiki: db " KENJI SAIKI@" ; "さいき けんじ@"
-.AtsushiTada: db " ATSUSHI TADA@" ; "ただ あつし@"
-.NaokoKawakami: db " NAOKO KAWAKAMI@" ; "かわかみ なおこ@"
-.HiroyukiZinnai: db " HIROYUKI ZINNAI@" ; "じんない ひろゆき@"
-.KunimiKawamura: db " KUNIMI KAWAMURA@" ; "かわむら くにみ@"
-.HisashiSogabe: db " HISASHI SOGABE@" ; "そがべ ひさし@"
-.KeitaKagaya: db " KEITA KAGAYA@" ; "かがや けいた@"
-.YoshinoriMatsuda: db " YOSHINORI MATSUDA@" ; "まつだ よしのり@"
-.HitomiSato: db " HITOMI SATO@" ; "さとう ひとみ@"
-.ToruOsawa: db " TORU OSAWA@" ; "おおさわ とおる@"
-.TakaoOhara: db " TAKAO OHARA@" ; "おおはら たかお@"
-.YuichiroIto: db " YUICHIRO ITO@" ; "いとう ゆういちろう@"
-.TakaoShimizu: db " TAKAO SHIMIZU@" ; "しみず たかお@"
-.Planning: db " SPECIAL PRODUCTION"
- next " PLANNING" ; "きかくかいはつぶ@"
- next " & DEVELOPMENT DEPT.@"
-.KeitaNakamura: db " KEITA NAKAMURA@" ; "なかむら けいた@"
-.HirotakaUemura: db " HIROTAKA UEMURA@" ; "うえむら ひろたか@"
-.HiroakiTamura: db " HIROAKI TAMURA@" ; "たむら ひろあき@"
-.NoriakiSakaguchi: db " NORIAKI SAKAGUCHI@" ; "さかぐち のりあき@"
-.MiyukiSato: db " MIYUKI SATO@" ; "さとう みゆき@"
-.GakuziNomoto: db " GAKUZI NOMOTO@" ; "のもと がくじ@"
-.AiMashima: db " AI MASHIMA@" ; "ましま あい@"
-.MikihiroIshikawa: db " MIKIHIRO ISHIKAWA@" ; "いしかわ みきひろ@"
-.HideyukiHashimoto: db " HIDEYUKI HASHIMOTO@" ; "はしもと ひでゆき@"
-.SatoshiYamato: db " SATOSHI YAMATO@" ; "やまと さとし@"
-.ShigeruMiyamoto: db " SHIGERU MIYAMOTO@" ; "みやもと しげる@"
-.End: db " END@" ; "おしまい@"
-.Unknown: db " ????????@" ; "????????@"
-.GailTilden: db " GAIL TILDEN@"
-.NobOgasawara: db " NOB OGASAWARA@"
-.SethMcMahill: db " SETH McMAHILL@"
-.HirotoAlexander: db " HIROTO ALEXANDER@"
-.TeresaLillygren: db " TERESA LILLYGREN@"
-.ThomasHertzog: db " THOMAS HERTZOG@"
-.ErikJohnson: db " ERIK JOHNSON@"
-.HiroNakamura: db " HIRO NAKAMURA@"
-.TerukiMurakawa: db " TERUKI MURAKAWA@"
-.KazuyoshiOsawa: db " KAZUYOSHI OSAWA@"
-.KimikoNakamichi: db " KIMIKO NAKAMICHI@"
-.Staff: db " #MON" ; "ポケットモンスター"
- next " CRYSTAL VERSION" ; " クりスタル バージョン"
- next " STAFF@" ; " スタッフ@"
-.Director: db " DIRECTOR@" ; "エグゼクティブ ディレクター@"
-.CoDirector: db " CO-DIRECTOR@" ; "ディレクター@"
-.Programmers: db " PROGRAMMERS@" ; "プログラム@"
-.GraphicsDirector: db " GRAPHICS DIRECTOR@" ; "グラフィック ディレクター@"
-.MonsterDesign: db " MONSTER DESIGN@" ; "# デザイン@"
-.GraphicsDesign: db " GRAPHICS DESIGN@" ; "グラフィック デザイン@"
-.Music: db " MUSIC@" ; "おんがく@"
-.SoundEffects: db " SOUND EFFECTS@" ; "サウンド エフ→クト@"
-.GameDesign: db " GAME DESIGN@" ; "ゲームデザイン@"
-.GameScenario: db " GAME SCENARIO@" ; "シナりォ@"
-.ToolProgramming: db " TOOL PROGRAMMING@" ; "ツール プログラム@"
-.ParametricDesign: db " PARAMETRIC DESIGN@" ; "パラメーター せってい@"
-.ScriptDesign: db " SCRIPT DESIGN@" ; "スクりプト せってい@"
-.MapDataDesign: db " MAP DATA DESIGN@" ; "マップデータ せってい@"
-.MapDesign: db " MAP DESIGN@" ; "マップ デザイン@"
-.ProductTesting: db " PRODUCT TESTING@" ; "デバッグプレイ@"
-.SpecialThanks: db " SPECIAL THANKS@" ; "スぺシャルサンクス@"
-.Producers: db " PRODUCERS@" ; "プロデューサー@"
-.ExecutiveProducer: db " EXECUTIVE PRODUCER@" ; "エグゼクティブ プロデューサー@"
-.PokemonAnimation: db " #MON ANIMATION@" ; "# アニメーション@"
-.PokedexText: db " #DEX TEXT@" ; "ずかん テキスト@"
-.MobilePrjLeader: db " MOBILE PRJ. LEADER@" ; "モバイルプロジ→クト りーダー@"
-.MobileSystemAd: db " MOBILE SYSTEM AD.@" ; "モバイル システムアドバイザー@"
-.MobileStadiumDir: db "MOBILE STADIUM DIR.@" ; "モバイルスタジアム ディレクター@"
-.Coordination: db " COORDINATION@" ; "コーディネーター@"
-.UsVersionStaff: db " US VERSION STAFF@"
-.UsCoordination: db " US COORDINATION@"
-.TextTranslation: db " TEXT TRANSLATION@"
-.PaadTesting: db " PAAD TESTING@"
-
-.Copyright:
- ; (C) 1 9 9 5 - 2 0 0 1 N i n t e n d o
- db $60,$61,$62,$63,$64,$65,$66, $67, $68, $69, $6a, $6b, $6c
- ; (C) 1 9 9 5 - 2 0 0 1 C r e a t u r e s i n c .
- next $60,$61,$62,$63,$64,$65,$66, $6d, $6e, $6f, $70, $71, $72, $7a, $7b, $7c
- ; (C) 1 9 9 5 - 2 0 0 1 G A M E F R E A K i n c .
- next $60,$61,$62,$63,$64,$65,$66, $73, $74, $75, $76, $77, $78, $79, $7a, $7b, $7c
- db "@"
+INCLUDE "gfx/credits.asm"
+INCLUDE "data/credits_script.asm"
+INCLUDE "data/credits_strings.asm"
diff --git a/engine/crystal_colors.asm b/engine/crystal_colors.asm
new file mode 100755
index 000000000..43841a201
--- /dev/null
+++ b/engine/crystal_colors.asm
@@ -0,0 +1,336 @@
+GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile)
+ ld a, b
+ cp SCGB_RAM
+ jr nz, .not_ram
+ ld a, [SGBPredef]
+.not_ram
+ push af
+ farcall ResetBGPals
+ pop af
+ ld l, a
+ ld h, 0
+ add hl, hl
+ ld de, .dw
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .done
+ push de
+ jp hl
+.done
+ ret
+; 49330 (12:5330)
+
+.dw ; 49330
+
+ dw MG_Mobile_Layout00
+ dw MG_Mobile_Layout01
+ dw MG_Mobile_Layout02
+; 49336
+
+MG_Mobile_Layout_FillBox: ; 49336
+.row
+ push bc
+ push hl
+.col
+ ld [hli], a
+ dec c
+ jr nz, .col
+ pop hl
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .row
+ ret
+; 49346
+
+MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346)
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ xor a
+ call ByteFill
+ ret
+
+MG_Mobile_Layout_LoadPals: ; 49351 (12:5351)
+ ld de, UnknBGPals
+ ld hl, Palette_493e1
+ ld bc, 5 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ ld de, UnknBGPals palette PAL_BG_TEXT
+ ld hl, Palette_TextBG7
+ ld bc, 1 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ ret
+
+MG_Mobile_Layout00: ; 4936e (12:536e)
+ call MG_Mobile_Layout_LoadPals
+ call MG_Mobile_Layout_WipeAttrMap
+ call MG_Mobile_Layout_CreatePalBoxes
+ farcall ApplyAttrMap
+ farcall ApplyPals
+ ret
+
+MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384)
+ hlcoord 0, 0, AttrMap
+ lb bc, 4, 1
+ ld a, $1
+ call MG_Mobile_Layout_FillBox
+ lb bc, 2, 1
+ ld a, $2
+ call MG_Mobile_Layout_FillBox
+ lb bc, 6, 1
+ ld a, $3
+ call MG_Mobile_Layout_FillBox
+ hlcoord 1, 0, AttrMap
+ ld a, $1
+ lb bc, 3, 18
+ call MG_Mobile_Layout_FillBox
+ lb bc, 2, 18
+ ld a, $2
+ call MG_Mobile_Layout_FillBox
+ lb bc, 12, 18
+ ld a, $3
+ call MG_Mobile_Layout_FillBox
+ hlcoord 19, 0, AttrMap
+ lb bc, 4, 1
+ ld a, $1
+ call MG_Mobile_Layout_FillBox
+ lb bc, 2, 1
+ ld a, $2
+ call MG_Mobile_Layout_FillBox
+ lb bc, 6, 1
+ ld a, $3
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 12, AttrMap
+ ld bc, 6 * SCREEN_WIDTH
+ ld a, $7
+ call ByteFill
+ ret
+; 493e1 (12:53e1)
+
+Palette_493e1: ; 493e1
+INCLUDE "data/palettes/mg_mobile.pal"
+; 49409
+
+LoadOW_BGPal7:: ; 49409
+ ld hl, Palette_TextBG7
+ ld de, UnknBGPals palette PAL_BG_TEXT
+ ld bc, 1 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ ret
+; 49418
+
+Palette_TextBG7: ; 49418
+ RGB 31, 31, 31
+ RGB 08, 19, 28
+ RGB 05, 05, 16
+ RGB 00, 00, 00
+; 49420
+
+Function49420:: ; 49420 (12:5420)
+ ld hl, MansionPalette4
+ ld de, UnknBGPals palette PAL_BG_ROOF
+ ld bc, 1 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ ret
+; 4942f (12:542f)
+
+MG_Mobile_Layout01: ; 4942f
+ call MG_Mobile_Layout_LoadPals
+ ld de, UnknBGPals palette PAL_BG_TEXT
+ ld hl, Palette_49478
+ ld bc, 1 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ call MG_Mobile_Layout_WipeAttrMap
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ xor a
+ call ByteFill
+ hlcoord 0, 14, AttrMap
+ ld bc, 4 * SCREEN_WIDTH
+ ld a, $7
+ call ByteFill
+ ld a, [wd002]
+ bit 6, a
+ jr z, .asm_49464
+ call Function49480
+ jr .asm_49467
+
+.asm_49464
+ call Function49496
+
+.asm_49467
+ farcall ApplyAttrMap
+ farcall ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 49478
+
+Palette_49478: ; 49478
+ RGB 31, 31, 31
+ RGB 26, 31, 00
+ RGB 20, 16, 03
+ RGB 00, 00, 00
+; 49480
+
+Function49480: ; 49480
+ hlcoord 0, 0, AttrMap
+ lb bc, 4, SCREEN_WIDTH
+ ld a, $7
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 2, AttrMap
+ ld a, $4
+ ld [hl], a
+ hlcoord 19, 2, AttrMap
+ ld [hl], a
+ ret
+; 49496
+
+Function49496: ; 49496
+ hlcoord 0, 0, AttrMap
+ lb bc, 2, SCREEN_WIDTH
+ ld a, $7
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 1, AttrMap
+ ld a, $4
+ ld [hl], a
+ hlcoord 19, 1, AttrMap
+ ld [hl], a
+ ret
+; 494ac
+
+INCLUDE "tilesets/special_palettes.asm"
+
+MG_Mobile_Layout02: ; 49706
+ ld hl, Palette_49732
+ ld de, UnknBGPals
+ ld bc, 1 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ farcall ApplyPals
+ call MG_Mobile_Layout_WipeAttrMap
+ farcall ApplyAttrMap
+ ld hl, Palette_4973a
+ ld de, UnknOBPals
+ ld bc, 1 palettes
+ ld a, BANK(UnknOBPals)
+ call FarCopyWRAM
+ ret
+; 49732
+
+Palette_49732: ; 49732
+ RGB 31, 31, 31
+ RGB 23, 16, 07
+ RGB 23, 07, 07
+ RGB 03, 07, 20
+; 4973a
+
+Palette_4973a: ; 4973a
+ RGB 00, 00, 00
+ RGB 07, 05, 31
+ RGB 14, 18, 31
+ RGB 31, 31, 31
+; 49742
+
+Function49742: ; 49742
+ ld hl, Palette_49757
+ ld de, UnknBGPals
+ ld bc, $40
+ ld a, $5
+ call FarCopyWRAM
+ farcall ApplyPals
+ ret
+; 49757
+
+Palette_49757: ; 49757
+INCLUDE "data/palettes/49757.pal"
+; 49797
+
+_InitMG_Mobile_LinkTradePalMap: ; 49797
+ hlcoord 0, 0, AttrMap
+ lb bc, 16, 2
+ ld a, $4
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ ldcoord_a 0, 1, AttrMap
+ ldcoord_a 0, 14, AttrMap
+ hlcoord 2, 0, AttrMap
+ lb bc, 8, 18
+ ld a, $5
+ call MG_Mobile_Layout_FillBox
+ hlcoord 2, 8, AttrMap
+ lb bc, 8, 18
+ ld a, $6
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 16, AttrMap
+ lb bc, 2, SCREEN_WIDTH
+ ld a, $4
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 6, 1, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 17, 1, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 6, 9, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 17, 9, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $2
+ hlcoord 2, 16, AttrMap
+ ld [hli], a
+ ld a, $7
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
+ ld a, $2
+ ld [hl], a
+ hlcoord 2, 17, AttrMap
+ ld a, $3
+ ld bc, 6
+ call ByteFill
+ ret
+; 49811
+
+LoadTradeRoomBGPals: ; 49811
+ ld hl, TradeRoomPalette
+ ld de, UnknBGPals palette PAL_BG_GREEN
+ ld bc, 6 palettes
+ ld a, BANK(UnknBGPals)
+ call FarCopyWRAM
+ farcall ApplyPals
+ ret
+; 49826
+
+TradeRoomPalette: ; 49826
+INCLUDE "data/palettes/trade_room.pal"
+; 49856
+
+InitMG_Mobile_LinkTradePalMap: ; 49856
+ call _InitMG_Mobile_LinkTradePalMap
+ ret
+; 4985a
+
+Unknown_4985a: ; unreferenced
+ db $ab, $03, $57, $24, $ac, $0e, $13, $32
+ db $be, $30, $5b, $4c, $47, $60, $ed, $f2
+ db $ab, $03, $55, $26, $aa, $0a, $13, $3a
+ db $be, $28, $33, $24, $6e, $71, $df, $b0
+ db $a8, $00, $e5, $e0, $9a, $fc, $f4, $2c
+ db $fe, $4c, $a3, $5e, $c6, $3a, $ab, $4d
+ db $a8, $00, $b5, $b0, $de, $e8, $fc, $1c
+ db $ba, $66, $f7, $0e, $ba, $5e, $43, $bd
diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm
index fbb2dbc97..52b07331e 100755
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -18,12 +18,12 @@ Copyright_GFPresents: ; e4579
call SetPalettes
ld c, 10
call DelayFrames
- callab Copyright
+ callfar Copyright
call WaitBGMap
ld c, 100
call DelayFrames
call ClearTileMap
- callba GBCOnlyScreen
+ farcall GBCOnlyScreen
call .GetGFLogoGFX
.joy_loop
call JoyTextDelay
@@ -34,7 +34,7 @@ Copyright_GFPresents: ; e4579
bit 7, a
jr nz, .finish
call PlaceGameFreakPresents
- callba PlaySpriteAnimations
+ farcall PlaySpriteAnimations
call DelayFrame
jr .joy_loop
@@ -78,7 +78,7 @@ Copyright_GFPresents: ; e4579
pop af
ld [rSVBK], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO
call _InitSpriteAnimStruct
@@ -107,7 +107,7 @@ Copyright_GFPresents: ; e4579
; e465e
.StopGamefreakAnim: ; e465e
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call ClearTileMap
call ClearSprites
ld c, 16
@@ -183,7 +183,7 @@ PlaceGameFreakPresents_2: ; e46ba
.place_presents
ld [hl], 0
ld hl, .presents
- decoord 7,11
+ decoord 7, 11
ld bc, .end - .presents
call CopyBytes
call PlaceGameFreakPresents_AdvanceIndex
@@ -253,7 +253,7 @@ GameFreakLogoScene2: ; e470d (39:470d)
add $20
.asm_e4723
ld e, a
- callba BattleAnim_Sine_e
+ farcall BattleAnim_Sine_e
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], e
@@ -341,29 +341,7 @@ GameFreakLogoScene5: ; e47ab (39:47ab)
; e47ac (39:47ac)
GameFreakLogoPalettes: ; e47ac
-; Ditto's color as it turns into the Game Freak logo.
-; Fade from pink to orange.
-; One color per step.
- RGB 23, 12, 28
- RGB 23, 12, 27
- RGB 23, 13, 26
- RGB 23, 13, 24
-
- RGB 24, 14, 22
- RGB 24, 14, 20
- RGB 24, 15, 18
- RGB 24, 15, 16
-
- RGB 25, 16, 14
- RGB 25, 16, 12
- RGB 25, 17, 10
- RGB 25, 17, 08
-
- RGB 26, 18, 06
- RGB 26, 18, 04
- RGB 26, 19, 02
- RGB 26, 19, 00
-
+INCLUDE "data/palettes/crystal_intro/gamefreak_logo.pal"
; e47cc
GameFreakLogo: ; e47cc
@@ -390,7 +368,7 @@ CrystalIntro: ; e48ac
bit 7, a
jr nz, .done
call IntroSceneJumper
- callba PlaySpriteAnimations
+ farcall PlaySpriteAnimations
call DelayFrame
jp .loop
@@ -506,11 +484,11 @@ IntroScene1: ; e495b (39:495b)
ld [rSVBK], a
ld hl, Palette_365ad
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_365ad
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -521,7 +499,7 @@ IntroScene1: ; e495b (39:495b)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
@@ -579,11 +557,11 @@ IntroScene3: ; e49fd (39:49fd)
ld [rSVBK], a
ld hl, Palette_e5edd
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e5edd
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -645,11 +623,11 @@ IntroScene5: ; e4a7a (39:4a7a)
ld [rSVBK], a
ld hl, Palette_365ad
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_365ad
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -660,7 +638,7 @@ IntroScene5: ; e4a7a (39:4a7a)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
@@ -752,12 +730,12 @@ IntroScene7: ; e4b3f (39:4b3f)
ld hl, Palette_e5edd
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e5edd
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
@@ -771,9 +749,9 @@ IntroScene7: ; e4b3f (39:4b3f)
ld a, $90
ld [hWY], a
call Intro_ResetLYOverrides
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
depixel 13, 27, 4, 0
- ld a, SPRITE_ANIM_INDEX_26
+ ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE
call _InitSpriteAnimStruct
ld a, $f0
ld [wGlobalAnimXOffset], a
@@ -809,7 +787,7 @@ IntroScene8: ; e4bd3 (39:4bd3)
.finish
ld de, SFX_INTRO_SUICUNE_2
call PlaySFX
- callba DeinitializeAllSprites
+ farcall DeinitializeAllSprites
call NextIntroScene
ret
@@ -866,7 +844,7 @@ IntroScene10: ; e4c4f (39:4c4f)
.pichu
depixel 21, 16, 1, 0
- ld a, SPRITE_ANIM_INDEX_27
+ ld a, SPRITE_ANIM_INDEX_INTRO_PICHU
call _InitSpriteAnimStruct
ld de, SFX_INTRO_PICHU
call PlaySFX
@@ -874,7 +852,7 @@ IntroScene10: ; e4c4f (39:4c4f)
.wooper
depixel 22, 6
- ld a, SPRITE_ANIM_INDEX_28
+ ld a, SPRITE_ANIM_INDEX_INTRO_WOOPER
call _InitSpriteAnimStruct
ld de, SFX_INTRO_PICHU
call PlaySFX
@@ -910,11 +888,11 @@ IntroScene11: ; e4c86 (39:4c86)
ld [rSVBK], a
ld hl, Palette_365ad
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_365ad
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -925,7 +903,7 @@ IntroScene11: ; e4c86 (39:4c86)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
@@ -1037,11 +1015,11 @@ IntroScene13: ; e4d6d (39:4d6d)
ld [rSVBK], a
ld hl, Palette_e5edd
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e5edd
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -1052,9 +1030,9 @@ IntroScene13: ; e4d6d (39:4d6d)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
depixel 13, 11, 4, 0
- ld a, SPRITE_ANIM_INDEX_26
+ ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE
call _InitSpriteAnimStruct
ld de, MUSIC_CRYSTAL_OPENING
call PlayMusic
@@ -1099,7 +1077,7 @@ IntroScene14: ; e4dfa (39:4dfa)
ret
.asm_e4e2c
- callba DeinitializeAllSprites
+ farcall DeinitializeAllSprites
ret
.asm_e4e33
@@ -1146,11 +1124,11 @@ IntroScene15: ; e4e40 (39:4e40)
ld [rSVBK], a
ld hl, Palette_e77dd
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e77dd
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -1162,13 +1140,13 @@ IntroScene15: ; e4e40 (39:4e40)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call Intro_SetCGBPalUpdate
depixel 8, 5
- ld a, SPRITE_ANIM_INDEX_2A
+ ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN_F
call _InitSpriteAnimStruct
depixel 12, 0
- ld a, SPRITE_ANIM_INDEX_2B
+ ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE_AWAY
call _InitSpriteAnimStruct
xor a
ld [wIntroSceneFrameCounter], a
@@ -1220,11 +1198,11 @@ IntroScene17: ; e4ef5 (39:4ef5)
ld [rSVBK], a
ld hl, Palette_e6d6d
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e6d6d
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -1235,7 +1213,7 @@ IntroScene17: ; e4ef5 (39:4ef5)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
@@ -1294,11 +1272,11 @@ IntroScene19: ; e4f7e (39:4f7e)
ld [rSVBK], a
ld hl, Palette_e77dd
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e77dd
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -1310,14 +1288,14 @@ IntroScene19: ; e4f7e (39:4f7e)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
ld hl, wSpriteAnimDict
xor a
ld [hli], a
ld [hl], $7f
call Intro_SetCGBPalUpdate
depixel 12, 0
- ld a, SPRITE_ANIM_INDEX_2B
+ ld a, SPRITE_ANIM_INDEX_INTRO_SUICUNE_AWAY
call _InitSpriteAnimStruct
xor a
ld [wIntroSceneFrameCounter], a
@@ -1392,7 +1370,7 @@ IntroScene22: ; e5072 (39:5072)
jr nc, .done
ret
.done
- callba DeinitializeAllSprites
+ farcall DeinitializeAllSprites
call NextIntroScene
ret
@@ -1464,11 +1442,11 @@ IntroScene26: ; e50bb (39:50bb)
ld [rSVBK], a
ld hl, Palette_e679d
ld de, UnknBGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld hl, Palette_e679d
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
pop af
ld [rSVBK], a
@@ -1479,7 +1457,7 @@ IntroScene26: ; e50bb (39:50bb)
ld [hWX], a
ld a, $90
ld [hWY], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call Intro_SetCGBPalUpdate
xor a
ld [wIntroSceneFrameCounter], a
@@ -1572,52 +1550,12 @@ Intro_Scene24_ApplyPaletteFade: ; e5172 (39:5172)
; e519c (39:519c)
.FadePals: ; e519c
-; Fade to white.
- RGB 24, 12, 09
- RGB 31, 31, 31
- RGB 12, 00, 31
- RGB 00, 00, 00
-
- RGB 31, 19, 05
- RGB 31, 31, 31
- RGB 15, 05, 31
- RGB 07, 07, 07
-
- RGB 31, 21, 09
- RGB 31, 31, 31
- RGB 18, 09, 31
- RGB 11, 11, 11
-
- RGB 31, 23, 13
- RGB 31, 31, 31
- RGB 21, 13, 31
- RGB 15, 15, 15
-
- RGB 31, 25, 17
- RGB 31, 31, 31
- RGB 25, 17, 31
- RGB 19, 19, 19
-
- RGB 31, 27, 21
- RGB 31, 31, 31
- RGB 27, 21, 31
- RGB 23, 23, 23
-
- RGB 31, 29, 25
- RGB 31, 31, 31
- RGB 29, 26, 31
- RGB 27, 27, 27
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
+INCLUDE "data/palettes/crystal_intro/fade.pal"
; e51dc
CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
push de
- ld a, SPRITE_ANIM_INDEX_29
+ ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -1627,7 +1565,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
pop de
push de
- ld a, SPRITE_ANIM_INDEX_29
+ ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -1637,7 +1575,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
pop de
push de
- ld a, SPRITE_ANIM_INDEX_29
+ ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -1646,7 +1584,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
call ReinitSpriteAnimFrame
pop de
- ld a, SPRITE_ANIM_INDEX_29
+ ld a, SPRITE_ANIM_INDEX_INTRO_UNOWN
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
@@ -1685,7 +1623,7 @@ CrystalIntro_UnownFade: ; e5223 (39:5223)
push hl
push bc
ld hl, BGPals
- ld bc, 4 * 16
+ ld bc, 8 palettes
xor a
call ByteFill
pop bc
@@ -2150,85 +2088,8 @@ INCBIN "gfx/intro/003.tilemap.lz"
; e5edd
Palette_e5edd: ; e5edd
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 0, 4, 5
- RGB 1, 8, 5
- RGB 4, 12, 9
- RGB 24, 12, 9
-
- RGB 0, 4, 5
- RGB 9, 6, 8
- RGB 8, 16, 5
- RGB 5, 10, 4
-
- RGB 31, 31, 31
- RGB 9, 6, 8
- RGB 18, 9, 9
- RGB 13, 8, 9
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 2, 5, 22
- RGB 1, 5, 12
-
- RGB 31, 31, 31
- RGB 31, 10, 25
- RGB 31, 21, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 21, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
+INCLUDE "data/palettes/crystal_intro/intro_1.pal"
+; e5f5d
IntroUnownsGFX: ; e5f5d
INCBIN "gfx/intro/unowns.2bpp.lz"
@@ -2263,85 +2124,8 @@ INCBIN "gfx/intro/007.tilemap.lz"
; e65ad
Palette_365ad: ; e65ad
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 10, 0, 10
- RGB 19, 0, 19
- RGB 31, 0, 31
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
+INCLUDE "data/palettes/crystal_intro/intro_2.pal"
+; e662d
IntroCrystalUnownsGFX: ; e662d
INCBIN "gfx/intro/crystal_unowns.2bpp.lz"
@@ -2356,85 +2140,8 @@ INCBIN "gfx/intro/015.tilemap.lz"
; e679d
Palette_e679d: ; e679d
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
+INCLUDE "data/palettes/crystal_intro/intro_3.pal"
+; e681d
IntroSuicuneCloseGFX: ; e681d
INCBIN "gfx/intro/suicune_close.2bpp.lz"
@@ -2449,85 +2156,8 @@ INCBIN "gfx/intro/011.tilemap.lz"
; e6d6d
Palette_e6d6d: ; e6d6d
- RGB 24, 12, 9
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 24, 12, 9
- RGB 31, 31, 31
- RGB 8, 9, 31
- RGB 0, 0, 0
-
- RGB 24, 12, 9
- RGB 12, 20, 31
- RGB 19, 8, 31
- RGB 0, 0, 0
-
- RGB 12, 20, 31
- RGB 8, 9, 31
- RGB 19, 8, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 12, 20, 31
- RGB 8, 9, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
+INCLUDE "data/palettes/crystal_intro/intro_4.pal"
+; e6ded
IntroSuicuneJumpGFX: ; e6ded
INCBIN "gfx/intro/suicune_jump.2bpp.lz"
@@ -2554,85 +2184,7 @@ INCBIN "gfx/intro/013.tilemap.lz"
; e77dd
Palette_e77dd: ; e77dd
- RGB 24, 12, 9
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 24, 12, 9
- RGB 31, 31, 31
- RGB 8, 9, 31
- RGB 0, 0, 0
-
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
-
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
-
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
-
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
-
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
-
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
- RGB 24, 12, 9
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 12, 0, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 9, 0
- RGB 21, 9, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 20, 20
- RGB 11, 11, 11
- RGB 0, 0, 0
+INCLUDE "data/palettes/crystal_intro/intro_5.pal"
IntroUnownBackGFX: ; e785d
INCBIN "gfx/intro/unown_back.2bpp.lz"
@@ -2646,4 +2198,3 @@ IntroGrass3GFX: ; e7a1d
INCBIN "gfx/intro/grass3.2bpp"
IntroGrass4GFX: ; e7a5d
INCBIN "gfx/intro/grass4.2bpp"
-
diff --git a/engine/debug.asm b/engine/debug.asm
index 9c2bb35c2..588de7a64 100755
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -159,7 +159,7 @@ Function819a7: ; 819a7
ld [rSVBK], a
ld hl, Palette_819f4
ld de, BGPals
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ld a, $80
ld [rBGPI], a
@@ -193,93 +193,10 @@ Function819a7: ; 819a7
; 819f4
Palette_819f4: ; 819f4
- ; white
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- ; red
- RGB 31, 00, 00
- RGB 31, 00, 00
- RGB 31, 00, 00
- RGB 00, 00, 00
-
- ; green
- RGB 00, 31, 00
- RGB 00, 31, 00
- RGB 00, 31, 00
- RGB 00, 00, 00
-
- ; blue
- RGB 00, 00, 31
- RGB 00, 00, 31
- RGB 00, 00, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
+INCLUDE "data/palettes/debug/bg.pal"
Palette_81a34: ; 81a34
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
-
- ; red
- RGB 31, 31, 31
- RGB 31, 00, 00
- RGB 31, 00, 00
- RGB 00, 00, 00
-
- ; green
- RGB 31, 31, 31
- RGB 00, 31, 00
- RGB 00, 31, 00
- RGB 00, 00, 00
-
- ; blue
- RGB 31, 31, 31
- RGB 00, 00, 31
- RGB 00, 00, 31
- RGB 00, 00, 00
+INCLUDE "data/palettes/debug/ob.pal"
; 81a74
Function81a74: ; 81a74
@@ -398,7 +315,7 @@ Function81adb: ; 81adb
hlcoord 12, 3
call _PrepMonFrontpic
ld de, VTiles2 tile $31
- predef GetBackpic
+ predef GetMonBackpic
ld a, $31
ld [hGraphicStartTile], a
hlcoord 2, 4
@@ -424,12 +341,12 @@ Function81adb: ; 81adb
.asm_81b7a
ld a, [wd265]
ld [TrainerClass], a
- callab GetTrainerAttributes
+ callfar GetTrainerAttributes
ld de, StringBuffer1
hlcoord 4, 1
call PlaceString
ld de, VTiles2
- callab GetTrainerPic
+ callfar GetTrainerPic
xor a
ld [TempEnemyMonSpecies], a
ld [hGraphicStartTile], a
diff --git a/engine/decorations.asm b/engine/decorations.asm
index 4bd99c0a5..1e9effe97 100755
--- a/engine/decorations.asm
+++ b/engine/decorations.asm
@@ -541,69 +541,7 @@ GetDecorationSprite: ; 26a44
ret
; 26a4f
-decoration: MACRO
- ; type, name, command, event flag, tile/sprite
- db \1, \2, \3
- dw \4
- db \5
-ENDM
-
-DecorationAttributes: ; 26a4f
- decoration DECO_PLANT, $00, $0, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_PLANT, PUT_IT_AWAY, PUT_AWAY_BED, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_BED, FEATHERY_BED, SET_UP_BED, EVENT_DECO_BED_1, $1b
- decoration DECO_BED, PINK_BED, SET_UP_BED, EVENT_DECO_BED_2, $1c
- decoration DECO_BED, POLKADOT_BED, SET_UP_BED, EVENT_DECO_BED_3, $1d
- decoration DECO_BED, PIKACHU_BED, SET_UP_BED, EVENT_DECO_BED_4, $1e
- decoration DECO_PLANT, PUT_IT_AWAY, PUT_AWAY_CARPET, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_CARPET, RED_CARPET, SET_UP_CARPET, EVENT_DECO_CARPET_1, $08
- decoration DECO_CARPET, BLUE_CARPET, SET_UP_CARPET, EVENT_DECO_CARPET_2, $0b
- decoration DECO_CARPET, YELLOW_CARPET, SET_UP_CARPET, EVENT_DECO_CARPET_3, $0e
- decoration DECO_CARPET, GREEN_CARPET, SET_UP_CARPET, EVENT_DECO_CARPET_4, $11
- decoration DECO_PLANT, PUT_IT_AWAY, PUT_AWAY_PLANT, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_PLANT, MAGNAPLANT, SET_UP_PLANT, EVENT_DECO_PLANT_1, $20
- decoration DECO_PLANT, TROPICPLANT, SET_UP_PLANT, EVENT_DECO_PLANT_2, $21
- decoration DECO_PLANT, JUMBOPLANT, SET_UP_PLANT, EVENT_DECO_PLANT_3, $22
- decoration DECO_PLANT, PUT_IT_AWAY, PUT_AWAY_POSTER, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_PLANT, TOWN_MAP_D, SET_UP_POSTER, EVENT_DECO_PLANT_4, $1f
- decoration DECO_POSTER, PIKACHU, SET_UP_POSTER, EVENT_DECO_POSTER_1, $23
- decoration DECO_POSTER, CLEFAIRY, SET_UP_POSTER, EVENT_DECO_POSTER_2, $24
- decoration DECO_POSTER, JIGGLYPUFF, SET_UP_POSTER, EVENT_DECO_POSTER_3, $25
- decoration DECO_PLANT, PUT_IT_AWAY, PUT_AWAY_CONSOLE, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_PLANT, FAMICOM, SET_UP_CONSOLE, EVENT_DECO_FAMICOM, SPRITE_FAMICOM
- decoration DECO_PLANT, SUPER_NES, SET_UP_CONSOLE, EVENT_DECO_SNES, SPRITE_SNES
- decoration DECO_PLANT, NINTENDO_64, SET_UP_CONSOLE, EVENT_DECO_N64, SPRITE_N64
- decoration DECO_PLANT, VIRTUAL_BOY, SET_UP_CONSOLE, EVENT_DECO_VIRTUAL_BOY, SPRITE_VIRTUAL_BOY
- decoration DECO_PLANT, PUT_IT_AWAY, PUT_AWAY_BIG_DOLL, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_BIGDOLL, SNORLAX, SET_UP_BIG_DOLL, EVENT_DECO_BIG_SNORLAX_DOLL, SPRITE_BIG_SNORLAX
- decoration DECO_BIGDOLL, ONIX, SET_UP_BIG_DOLL, EVENT_DECO_BIG_ONIX_DOLL, SPRITE_BIG_ONIX
- decoration DECO_BIGDOLL, LAPRAS, SET_UP_BIG_DOLL, EVENT_DECO_BIG_LAPRAS_DOLL, SPRITE_BIG_LAPRAS
- decoration DECO_PLANT, PUT_IT_AWAY, PUT_AWAY_DOLL, EVENT_GAVE_KURT_APRICORNS, $00
- decoration DECO_DOLL, PIKACHU, SET_UP_DOLL, EVENT_DECO_PIKACHU_DOLL, SPRITE_PIKACHU
- decoration DECO_PLANT, SURF_PIKA_DOLL, SET_UP_DOLL, EVENT_DECO_SURFING_PIKACHU_DOLL, SPRITE_SURFING_PIKACHU
- decoration DECO_DOLL, CLEFAIRY, SET_UP_DOLL, EVENT_DECO_CLEFAIRY_DOLL, SPRITE_CLEFAIRY
- decoration DECO_DOLL, JIGGLYPUFF, SET_UP_DOLL, EVENT_DECO_JIGGLYPUFF_DOLL, SPRITE_JIGGLYPUFF
- decoration DECO_DOLL, BULBASAUR, SET_UP_DOLL, EVENT_DECO_BULBASAUR_DOLL, SPRITE_BULBASAUR
- decoration DECO_DOLL, CHARMANDER, SET_UP_DOLL, EVENT_DECO_CHARMANDER_DOLL, SPRITE_CHARMANDER
- decoration DECO_DOLL, SQUIRTLE, SET_UP_DOLL, EVENT_DECO_SQUIRTLE_DOLL, SPRITE_SQUIRTLE
- decoration DECO_DOLL, POLIWAG, SET_UP_DOLL, EVENT_DECO_POLIWAG_DOLL, SPRITE_POLIWAG
- decoration DECO_DOLL, DIGLETT, SET_UP_DOLL, EVENT_DECO_DIGLETT_DOLL, SPRITE_DIGLETT
- decoration DECO_DOLL, STARYU, SET_UP_DOLL, EVENT_DECO_STARMIE_DOLL, SPRITE_STARMIE
- decoration DECO_DOLL, MAGIKARP, SET_UP_DOLL, EVENT_DECO_MAGIKARP_DOLL, SPRITE_MAGIKARP
- decoration DECO_DOLL, ODDISH, SET_UP_DOLL, EVENT_DECO_ODDISH_DOLL, SPRITE_ODDISH
- decoration DECO_DOLL, GENGAR, SET_UP_DOLL, EVENT_DECO_GENGAR_DOLL, SPRITE_GENGAR
- decoration DECO_DOLL, SHELLDER, SET_UP_DOLL, EVENT_DECO_SHELLDER_DOLL, SPRITE_SHELLDER
- decoration DECO_DOLL, GRIMER, SET_UP_DOLL, EVENT_DECO_GRIMER_DOLL, SPRITE_GRIMER
- decoration DECO_DOLL, VOLTORB, SET_UP_DOLL, EVENT_DECO_VOLTORB_DOLL, SPRITE_VOLTORB
- decoration DECO_DOLL, WEEDLE, SET_UP_DOLL, EVENT_DECO_WEEDLE_DOLL, SPRITE_WEEDLE
- decoration DECO_DOLL, UNOWN, SET_UP_DOLL, EVENT_DECO_UNOWN_DOLL, SPRITE_UNOWN
- decoration DECO_DOLL, GEODUDE, SET_UP_DOLL, EVENT_DECO_GEODUDE_DOLL, SPRITE_GEODUDE
- decoration DECO_DOLL, MACHOP, SET_UP_DOLL, EVENT_DECO_MACHOP_DOLL, SPRITE_MACHOP
- decoration DECO_DOLL, TENTACOOL, SET_UP_DOLL, EVENT_DECO_TENTACOOL_DOLL, SPRITE_TENTACOOL
- decoration DECO_PLANT, GOLD_TROPHY, SET_UP_DOLL, EVENT_DECO_GOLD_TROPHY, SPRITE_GOLD_TROPHY
- decoration DECO_PLANT, SILVER_TROPHY, SET_UP_DOLL, EVENT_DECO_SILVER_TROPHY, SPRITE_SILVER_TROPHY
-; 26b8d
-
+INCLUDE "data/decoration_attributes.asm"
DecorationNames: ; 26b8d
db "CANCEL@"
@@ -908,16 +846,16 @@ DecoAction_putawayornament: ; 26dc9
DecoAction_FinishUp_Ornament: ; 26dd6
call QueryWhichSide
- ld a, [wd1ec]
+ ld a, [wSelectedDecoration]
ld [hl], a
- ld a, [wd1ed]
+ ld a, [wOtherDecoration]
ld [de], a
xor a
ret
; 26de3
DecoAction_SetItUp_Ornament: ; 26de3
- ld a, [wd1ec]
+ ld a, [wSelectedDecoration]
and a
jr z, .nothingthere
ld b, a
@@ -931,7 +869,7 @@ DecoAction_SetItUp_Ornament: ; 26de3
ld hl, StringBuffer4
call GetDecorationName
ld a, [MenuSelection]
- ld [wd1ec], a
+ ld [wSelectedDecoration], a
call .getwhichside
ld hl, DecoText_PutAwayAndSetUp
call MenuTextBoxBackup
@@ -940,7 +878,7 @@ DecoAction_SetItUp_Ornament: ; 26de3
.nothingthere
ld a, [MenuSelection]
- ld [wd1ec], a
+ ld [wSelectedDecoration], a
call .getwhichside
ld a, [MenuSelection]
ld hl, StringBuffer3
@@ -960,11 +898,11 @@ DecoAction_SetItUp_Ornament: ; 26de3
.getwhichside ; 26e33
ld a, [MenuSelection]
ld b, a
- ld a, [wd1ed]
+ ld a, [wOtherDecoration]
cp b
ret nz
xor a
- ld [wd1ed], a
+ ld [wOtherDecoration], a
ret
; 26e41
@@ -975,7 +913,7 @@ UnknownText_0x26e41: ; 0x26e41
; 0x26e46
DecoAction_PutItAway_Ornament: ; 26e46
- ld a, [wd1ec]
+ ld a, [wSelectedDecoration]
and a
jr z, .nothingthere
ld hl, StringBuffer3
@@ -983,7 +921,7 @@ DecoAction_PutItAway_Ornament: ; 26e46
ld a, $1
ld [Buffer5], a
xor a
- ld [wd1ec], a
+ ld [wSelectedDecoration], a
ld hl, DecoText_PutAwayTheDeco
call MenuTextBoxBackup
xor a
@@ -1015,9 +953,9 @@ DecoAction_AskWhichSide: ; 26e70
ld [Buffer2], a
call QueryWhichSide
ld a, [hl]
- ld [wd1ec], a
+ ld [wSelectedDecoration], a
ld a, [de]
- ld [wd1ed], a
+ ld [wOtherDecoration], a
xor a
ret
@@ -1430,9 +1368,19 @@ _GetDecorationSprite: ; 27085
ld c, a
push de
push hl
- callba GetDecorationSprite
+ farcall GetDecorationSprite
pop hl
pop de
ld a, c
ret
; 27092
+
+PadCoords_de: ; 27092
+ ld a, d
+ add 4
+ ld d, a
+ ld a, e
+ add 4
+ ld e, a
+ call GetBlockLocation
+ ret
diff --git a/engine/delete_save_change_clock.asm b/engine/delete_save_change_clock.asm
index 7a806ad01..e77874e1c 100755
--- a/engine/delete_save_change_clock.asm
+++ b/engine/delete_save_change_clock.asm
@@ -1,5 +1,5 @@
_ResetClock: ; 4d3b1
- callba BlankScreen
+ farcall BlankScreen
ld b, SCGB_DIPLOMA
call GetSGBLayout
call LoadStandardFont
@@ -127,7 +127,7 @@ ClockResetPassword: ; 4d41e
ld e, a
ld d, $0
add hl, de
- ld [hl], $61
+ ld [hl], "▲"
ret
.dpadinput ; 4d490
@@ -227,7 +227,7 @@ ClockResetPassword: ; 4d41e
ld c, $2
call .ComponentFromNumber
ld hl, sPlayerData + (PlayerName - wPlayerData)
- ld c, $5 ; PLAYER_NAME_LENGTH_J
+ ld c, NAME_LENGTH_JAPANESE - 1
call .ComponentFromString
ld hl, sPlayerData + (Money - wPlayerData)
ld c, $3
@@ -260,7 +260,7 @@ ClockResetPassword: ; 4d41e
ret
_DeleteSaveData: ; 4d54c
- callba BlankScreen
+ farcall BlankScreen
ld b, SCGB_DIPLOMA
call GetSGBLayout
call LoadStandardFont
@@ -276,7 +276,7 @@ _DeleteSaveData: ; 4d54c
ld a, [wMenuCursorY]
cp $1
ret z
- callba EmptyAllSRAMBanks
+ farcall EmptyAllSRAMBanks
ret
.Text_ClearAllSaveData: ; 0x4d580
diff --git a/engine/diploma.asm b/engine/diploma.asm
index c446ff86b..f1c67ea37 100644
--- a/engine/diploma.asm
+++ b/engine/diploma.asm
@@ -1,4 +1,3 @@
-
_Diploma: ; 1dd702
call PlaceDiplomaOnScreen
call WaitPressAorB_BlinkCursor
@@ -85,10 +84,10 @@ PrintDiplomaPage2: ; 1dd7ae
; 1dd805
DiplomaGFX: ; 1dd805
-INCBIN "gfx/unknown/1dd805.2bpp.lz"
+INCBIN "gfx/diploma/diploma.2bpp.lz"
DiplomaPage1Tilemap: ; 1ddc4b
-INCBIN "gfx/unknown/1ddc4b.tilemap"
+INCBIN "gfx/diploma/page1.tilemap"
DiplomaPage2Tilemap: ; 1dddb3
-INCBIN "gfx/unknown/1dddb3.tilemap"
+INCBIN "gfx/diploma/page2.tilemap"
diff --git a/engine/dma_transfer.asm b/engine/dma_transfer.asm
new file mode 100755
index 000000000..9d95c87b1
--- /dev/null
+++ b/engine/dma_transfer.asm
@@ -0,0 +1,626 @@
+HDMATransferAttrMapAndTileMapToWRAMBank3:: ; 104000
+ ld hl, .Function
+ jp CallInSafeGFXMode
+
+.Function:
+ decoord 0, 0, AttrMap
+ ld hl, wScratchAttrMap
+ call PadAttrMapForHDMATransfer
+ decoord 0, 0
+ ld hl, wScratchTileMap
+ call PadTilemapForHDMATransfer
+ ld a, $0
+ ld [rVBK], a
+ ld hl, wScratchTileMap
+ call HDMATransferToWRAMBank3
+ ld a, $1
+ ld [rVBK], a
+ ld hl, wScratchAttrMap
+ call HDMATransferToWRAMBank3
+ ret
+; 10402d
+
+HDMATransferTileMapToWRAMBank3:: ; 10402d
+ ld hl, .Function
+ jp CallInSafeGFXMode
+
+.Function:
+ decoord 0, 0
+ ld hl, wScratchTileMap
+ call PadTilemapForHDMATransfer
+ ld a, $0
+ ld [rVBK], a
+ ld hl, wScratchTileMap
+ call HDMATransferToWRAMBank3
+ ret
+; 104047
+
+HDMATransferAttrMapToWRAMBank3: ; 104047
+ ld hl, .Function
+ jp CallInSafeGFXMode
+
+.Function:
+ decoord 0, 0, AttrMap
+ ld hl, wScratchAttrMap
+ call PadAttrMapForHDMATransfer
+ ld a, $1
+ ld [rVBK], a
+ ld hl, wScratchAttrMap
+ call HDMATransferToWRAMBank3
+ ret
+; 104061
+
+ReloadMapPart:: ; 104061
+ ld hl, .Function
+ jp CallInSafeGFXMode
+
+.Function:
+ decoord 0, 0, AttrMap
+ ld hl, wScratchAttrMap
+ call PadAttrMapForHDMATransfer
+ decoord 0, 0
+ ld hl, wScratchTileMap
+ call PadTilemapForHDMATransfer
+ call DelayFrame
+
+ di
+ ld a, [rVBK]
+ push af
+ ld a, $1
+ ld [rVBK], a
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
+ ld a, $0
+ ld [rVBK], a
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
+ pop af
+ ld [rVBK], a
+ ei
+
+ ret
+
+Mobile_ReloadMapPart: ; 104099
+ ld hl, ReloadMapPart ; useless
+ ld hl, .Function
+ jp CallInSafeGFXMode
+
+.Function:
+ decoord 0, 0, AttrMap
+ ld hl, wScratchAttrMap
+ call PadAttrMapForHDMATransfer
+ decoord 0, 0
+ ld hl, wScratchTileMap
+ call PadTilemapForHDMATransfer
+ call DelayFrame
+
+ di
+ ld a, [rVBK]
+ push af
+ ld a, $1
+ ld [rVBK], a
+ ld hl, wScratchAttrMap
+ call HDMATransfer_NoDI
+ ld a, $0
+ ld [rVBK], a
+ ld hl, wScratchTileMap
+ call HDMATransfer_NoDI
+ pop af
+ ld [rVBK], a
+ ei
+
+ ret
+; 1040d4
+
+; XXX
+ ld hl, .unreferenced_1040da
+ jp CallInSafeGFXMode
+
+.unreferenced_1040da
+ ld a, $1
+ ld [rVBK], a
+ ld a, $3
+ ld [rSVBK], a
+ ld de, w3_d800
+ ld a, [hBGMapAddress + 1]
+ ld [rHDMA1], a
+ ld a, [hBGMapAddress]
+ ld [rHDMA2], a
+ ld a, d
+ ld [rHDMA3], a
+ ld a, e
+ ld [rHDMA4], a
+ ld a, $23
+ ld [hDMATransfer], a
+ call WaitDMATransfer
+ ret
+; 1040fb
+
+; XXX
+ ld hl, .unreferenced_104101
+ jp CallInSafeGFXMode
+
+.unreferenced_104101
+ ld a, $1
+ ld [rVBK], a
+ ld a, $3
+ ld [rSVBK], a
+ ld hl, w3_d800
+ call HDMATransferToWRAMBank3
+ ret
+; 104110
+
+OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 104110
+; OpenText
+ ld hl, .Function
+ jp CallInSafeGFXMode
+
+.Function:
+ ; Transfer AttrMap and Tilemap to BGMap
+ ; Fill vBGAttrs with $00
+ ; Fill vBGTiles with " "
+ decoord 0, 0, AttrMap
+ ld hl, wScratchAttrMap
+ call PadAttrMapForHDMATransfer
+ decoord 0, 0
+ ld hl, wScratchTileMap
+ call PadTilemapForHDMATransfer
+ call DelayFrame
+
+ di
+ ld a, [rVBK]
+ push af
+ ld a, $1
+ ld [rVBK], a
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait123Scanlines_toBGMap
+ ld a, $0
+ ld [rVBK], a
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait123Scanlines_toBGMap
+ pop af
+ ld [rVBK], a
+ ei
+ ret
+; 104148
+
+Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap: ; 104148 (41:4148)
+ ld hl, .Function
+ jp CallInSafeGFXMode
+
+.Function:
+ ; Transfer AttrMap and Tilemap to BGMap
+ ; Fill vBGAttrs with $00
+ ; Fill vBGTiles with $ff
+ decoord 0, 0, AttrMap
+ ld hl, wScratchAttrMap
+ call PadAttrMapForHDMATransfer
+ ld c, $ff
+ decoord 0, 0
+ ld hl, wScratchTileMap
+ call PadMapForHDMATransfer
+
+ ld a, $1
+ ld [rVBK], a
+ ld hl, wScratchAttrMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
+ ld a, $0
+ ld [rVBK], a
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines_toBGMap
+ ret
+; 104177
+
+CallInSafeGFXMode: ; 104177
+ ld a, [hBGMapMode]
+ push af
+ ld a, [hMapAnims]
+ push af
+ xor a
+ ld [hBGMapMode], a
+ ld [hMapAnims], a
+ ld a, [rSVBK]
+ push af
+ ld a, $6
+ ld [rSVBK], a
+ ld a, [rVBK]
+ push af
+
+ call ._hl_
+
+ pop af
+ ld [rVBK], a
+ pop af
+ ld [rSVBK], a
+ pop af
+ ld [hMapAnims], a
+ pop af
+ ld [hBGMapMode], a
+ ret
+; 10419c
+
+._hl_ ; 10419c
+ jp hl
+; 10419d
+
+
+HDMATransferToWRAMBank3: ; 10419d (41:419d)
+ call _LoadHDMAParameters
+ ld a, $23
+ ld [hDMATransfer], a
+
+WaitDMATransfer: ; 104a14
+.loop
+ call DelayFrame
+ ld a, [hDMATransfer]
+ and a
+ jr nz, .loop
+ ret
+
+HDMATransfer_Wait127Scanlines_toBGMap: ; 1041ad (41:41ad)
+; HDMA transfer from hl to [hBGMapAddress]
+; hBGMapAddress -> de
+; 2 * SCREEN_HEIGHT -> c
+ ld a, [hBGMapAddress + 1]
+ ld d, a
+ ld a, [hBGMapAddress]
+ ld e, a
+ ld c, 2 * SCREEN_HEIGHT
+ jr HDMATransfer_Wait127Scanlines
+
+HDMATransfer_Wait123Scanlines_toBGMap: ; 1041b7 (41:41b7)
+; HDMA transfer from hl to [hBGMapAddress]
+; hBGMapAddress -> de
+; 2 * SCREEN_HEIGHT -> c
+; $7b --> b
+ ld a, [hBGMapAddress + 1]
+ ld d, a
+ ld a, [hBGMapAddress]
+ ld e, a
+ ld c, 2 * SCREEN_HEIGHT
+ jr HDMATransfer_Wait123Scanlines
+; 1041c1 (41:41c1)
+
+HDMATransfer_NoDI: ; 1041c1
+; HDMA transfer from hl to [hBGMapAddress]
+; [hBGMapAddress] --> de
+; 2 * SCREEN_HEIGHT --> c
+ ld a, [hBGMapAddress + 1]
+ ld d, a
+ ld a, [hBGMapAddress]
+ ld e, a
+ ld c, 2 * SCREEN_HEIGHT
+
+ ; [rHDMA1, rHDMA2] = hl & $fff0
+ ld a, h
+ ld [rHDMA1], a
+ ld a, l
+ and $f0
+ ld [rHDMA2], a
+ ; [rHDMA3, rHDMA4] = de & $1ff0
+ ld a, d
+ and $1f
+ ld [rHDMA3], a
+ ld a, e
+ and $f0
+ ld [rHDMA4], a
+ ; b = c | %10000000
+ ld a, c
+ dec c
+ or $80
+ ld b, a
+ ; d = $7f - c + 1
+ ld a, $7f
+ sub c
+ ld d, a
+ ; while [rLY] >= d: pass
+.loop1
+ ld a, [rLY]
+ cp d
+ jr nc, .loop1
+ ; while not [rSTAT] & 3: pass
+.loop2
+ ld a, [rSTAT]
+ and $3
+ jr z, .loop2
+ ; load the 5th byte of HDMA
+ ld a, b
+ ld [rHDMA5], a
+ ; wait until rLY advances (c + 1) times
+ ld a, [rLY]
+ inc c
+ ld hl, rLY
+.loop3
+ cp [hl]
+ jr z, .loop3
+ ld a, [hl]
+ dec c
+ jr nz, .loop3
+ ld hl, rHDMA5
+ res 7, [hl]
+ ret
+; 104205
+
+HDMATransfer_Wait123Scanlines:
+ ld b, $7b
+ jr _continue_HDMATransfer
+
+
+HDMATransfer_Wait127Scanlines:
+ ld b, $7f
+_continue_HDMATransfer:
+; a lot of waiting around for hardware registers
+ ; [rHDMA1, rHDMA2] = hl & $fff0
+ ld a, h
+ ld [rHDMA1], a
+ ld a, l
+ and $f0 ; high nybble
+ ld [rHDMA2], a
+ ; [rHDMA3, rHDMA4] = de & $1ff0
+ ld a, d
+ and $1f ; lower 5 bits
+ ld [rHDMA3], a
+ ld a, e
+ and $f0 ; high nybble
+ ld [rHDMA4], a
+ ; e = c | %10000000
+ ld a, c
+ dec c
+ or $80
+ ld e, a
+ ; d = b - c + 1
+ ld a, b
+ sub c
+ ld d, a
+ ; while [rLY] >= d: pass
+.ly_loop
+ ld a, [rLY]
+ cp d
+ jr nc, .ly_loop
+
+ di
+ ; while [rSTAT] & 3: pass
+.rstat_loop_1
+ ld a, [rSTAT]
+ and $3
+ jr nz, .rstat_loop_1
+ ; while not [rSTAT] & 3: pass
+.rstat_loop_2
+ ld a, [rSTAT]
+ and $3
+ jr z, .rstat_loop_2
+ ; load the 5th byte of HDMA
+ ld a, e
+ ld [rHDMA5], a
+ ; wait until rLY advances (c + 1) times
+ ld a, [rLY]
+ inc c
+ ld hl, rLY
+.final_ly_loop
+ cp [hl]
+ jr z, .final_ly_loop
+ ld a, [hl]
+ dec c
+ jr nz, .final_ly_loop
+ ld hl, rHDMA5
+ res 7, [hl]
+ ei
+
+ ret
+; 10424e
+
+
+_LoadHDMAParameters: ; 10424e (41:424e)
+ ld a, h
+ ld [rHDMA1], a
+ ld a, l
+ ld [rHDMA2], a
+ ld a, [hBGMapAddress + 1]
+ and $1f
+ ld [rHDMA3], a
+ ld a, [hBGMapAddress]
+ ld [rHDMA4], a
+ ret
+
+PadTilemapForHDMATransfer: ; 10425f (41:425f)
+ ld c, " "
+ jr PadMapForHDMATransfer
+
+PadAttrMapForHDMATransfer: ; 104263 (41:4263)
+ ld c, $0
+
+PadMapForHDMATransfer: ; 104265 (41:4265)
+; pad a 20x18 map to 32x18 for HDMA transfer
+; back up the padding value in c to hMapObjectIndexBuffer
+ ld a, [hMapObjectIndexBuffer]
+ push af
+ ld a, c
+ ld [hMapObjectIndexBuffer], a
+
+; for each row on the screen
+ ld c, SCREEN_HEIGHT
+.loop1
+; for each tile in the row
+ ld b, SCREEN_WIDTH
+.loop2
+; copy from de to hl
+ ld a, [de]
+ inc de
+ ld [hli], a
+ dec b
+ jr nz, .loop2
+
+; load the original padding value of c into hl for 32 - 20 = 12 rows
+ ld a, [hMapObjectIndexBuffer]
+ ld b, BG_MAP_WIDTH - SCREEN_WIDTH
+.loop3
+ ld [hli], a
+ dec b
+ jr nz, .loop3
+
+ dec c
+ jr nz, .loop1
+
+; restore the original value of hMapObjectIndexBuffer
+ pop af
+ ld [hMapObjectIndexBuffer], a
+ ret
+
+
+_Get2bpp:: ; 104284
+ ; 2bpp when [rLCDC] & $80
+ ; switch to WRAM bank 6
+ ld a, [rSVBK]
+ push af
+ ld a, $6
+ ld [rSVBK], a
+
+ push bc
+ push hl
+
+ ; Copy c tiles of the 2bpp from b:de to wScratchTileMap
+ ld a, b ; bank
+ ld l, c ; number of tiles
+ ld h, $0
+ ; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ ld b, h
+ ld c, l
+ ld h, d ; address
+ ld l, e
+ ld de, wScratchTileMap
+ call FarCopyBytes
+
+ pop hl
+ pop bc
+
+ push bc
+ call DelayFrame
+ pop bc
+
+ ld d, h
+ ld e, l
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines
+
+ ; restore the previous bank
+ pop af
+ ld [rSVBK], a
+ ret
+; 1042b2
+
+_Get1bpp:: ; 1042b2
+ ; 1bpp when [rLCDC] & $80
+.loop
+ ld a, c
+ cp $10
+ jp c, .bankswitch
+ jp z, .bankswitch
+ push bc
+ push hl
+ push de
+ ld c, $10
+ call .bankswitch
+ pop de
+ ld hl, $80
+ add hl, de
+ ld d, h
+ ld e, l
+ pop hl
+ lb bc, 1, 0
+ add hl, bc
+ pop bc
+ ld a, c
+ sub $10
+ ld c, a
+ jr .loop
+; 1042d6
+
+.bankswitch ; 1042d6
+ ld a, [rSVBK]
+ push af
+ ld a, $6
+ ld [rSVBK], a
+
+ push bc
+ push hl
+
+ ld a, b
+ ld l, c
+ ld h, $0
+ add hl, hl ; multiply by 8
+ add hl, hl ; multiply by 8
+ add hl, hl ; multiply by 8
+ ld c, l
+ ld b, h
+ ld h, d
+ ld l, e
+ ld de, wScratchTileMap
+ call FarCopyBytesDouble_DoubleBankSwitch
+
+ pop hl
+ pop bc
+
+ push bc
+ call DelayFrame
+ pop bc
+
+ ld d, h
+ ld e, l
+ ld hl, wScratchTileMap
+ call HDMATransfer_Wait127Scanlines
+
+ pop af
+ ld [rSVBK], a
+ ret
+; 104303
+
+HDMATransfer_OnlyTopFourRows: ; 104303
+ ld hl, .Function
+ jp CallInSafeGFXMode
+; 104309
+
+.Function:
+ ld hl, wScratchTileMap
+ decoord 0, 0
+ call .Copy
+ ld hl, wScratchTileMap + $80
+ decoord 0, 0, AttrMap
+ call .Copy
+ ld a, $1
+ ld [rVBK], a
+ ld c, $8
+ ld hl, wScratchTileMap + $80
+ debgcoord 0, 0, VBGMap1
+ call HDMATransfer_Wait127Scanlines
+ ld a, $0
+ ld [rVBK], a
+ ld c, $8
+ ld hl, wScratchTileMap
+ debgcoord 0, 0, VBGMap1
+ call HDMATransfer_Wait127Scanlines
+ ret
+
+.Copy: ; 10433a (41:433a)
+ ld b, 4
+.outer_loop
+ ld c, SCREEN_WIDTH
+.inner_loop
+ ld a, [de]
+ ld [hli], a
+ inc de
+ dec c
+ jr nz, .inner_loop
+ ld a, l
+ add BG_MAP_WIDTH - SCREEN_WIDTH
+ ld l, a
+ ld a, h
+ adc $0
+ ld h, a
+ dec b
+ jr nz, .outer_loop
+ ret
+; 104350
diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm
index e5ef9b4cf..c315b8f38 100755
--- a/engine/dummy_game.asm
+++ b/engine/dummy_game.asm
@@ -10,7 +10,7 @@ _DummyGame: ; e1e5b (38:5e5b)
call DisableLCD
ld b, SCGB_DIPLOMA
call GetSGBLayout
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
ld hl, LZ_e2221
ld de, VTiles2 tile $00
call Decompress
@@ -47,7 +47,7 @@ _DummyGame: ; e1e5b (38:5e5b)
bit 7, a
jr nz, .quit
call .ExecuteJumptable
- callab PlaySpriteAnimations
+ callfar PlaySpriteAnimations
call DelayFrame
and a
ret
@@ -109,7 +109,7 @@ endr
.spawn_object
depixel 6, 3, 4, 4
- ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR
+ ld a, SPRITE_ANIM_INDEX_DUMMY_GAME
call _InitSpriteAnimStruct
ld a, 5
ld [wDummyGameNumberTriesRemaining], a
@@ -609,4 +609,4 @@ DummyGame_InterpretJoypad_AnimateCursor: ; e21a1 (38:61a1)
; e2221 (38:6221)
LZ_e2221: ; e2221
-INCBIN "gfx/unknown/0e2221.2bpp.lz"
+INCBIN "gfx/dummy_game/dummy_game.2bpp.lz"
diff --git a/engine/engine_flags.asm b/engine/engine_flags.asm
index 2b441bab4..acda9ede7 100644
--- a/engine/engine_flags.asm
+++ b/engine/engine_flags.asm
@@ -83,206 +83,4 @@ EngineFlagAction:: ; 80430
; 80462
-EngineFlags: ; 80462
-; All locations are in WRAM bank 1.
-engine_flag: MACRO
- dwb \1, 1 << \2
-ENDM
- ; location, bit
-
- ; pokegear
- engine_flag wPokegearFlags, 1 ; radio card ; $0
- engine_flag wPokegearFlags, 0 ; map card
- engine_flag wPokegearFlags, 2 ; phone card
- engine_flag wPokegearFlags, 3 ; expn card
- engine_flag wPokegearFlags, 7 ; on/off
-
- ; wDaycareMan, 7 ; daycare 1 on
- engine_flag wDaycareMan, 6 ; egg is ready
- ; wDaycareMan, 5 ; monster 1 and 2 are compatible
- engine_flag wDaycareMan, 0 ; monster 1 in daycare
-
- ; wDaycareLady, 7 = daycare 2 on
- engine_flag wDaycareLady, 0 ; monster 2 in daycare
-
- engine_flag wMomSavingMoney, 0 ; mom saving money ; $8
- engine_flag wMomSavingMoney, 7 ; dst
-
- engine_flag wUnusedTwoDayTimerOn, 0 ; unused, possibly related to a 2-day timer
-
- engine_flag StatusFlags, 0 ; pokedex
- engine_flag StatusFlags, 1 ; unown dex
- engine_flag StatusFlags, 3 ; pokerus
- engine_flag StatusFlags, 4 ; rocket signal on ch20
- engine_flag StatusFlags, 6 ; credits skip
- engine_flag StatusFlags, 7 ; bug contest on ; $10
- engine_flag StatusFlags2, 2 ; bug contest timer
- engine_flag StatusFlags2, 1 ; safari zone?
- engine_flag StatusFlags2, 0 ; rockets in radio tower
- engine_flag StatusFlags2, 4 ; bike shop call enabled (1024 bike steps reqd)
- engine_flag StatusFlags2, 5 ; give pokerus
- engine_flag StatusFlags2, 6 ; berry -> berry juice when trading?
- engine_flag StatusFlags2, 7 ; rockets in mahogany
-
- engine_flag BikeFlags, 0 ; strength active ; $18
- engine_flag BikeFlags, 1 ; always on bike (cant surf)
- engine_flag BikeFlags, 2 ; downhill (cycling road)
-
- engine_flag JohtoBadges, 0 ; zephyrbadge
- engine_flag JohtoBadges, 1 ; hivebadge
- engine_flag JohtoBadges, 2 ; plainbadge
- engine_flag JohtoBadges, 3 ; fogbadge
- engine_flag JohtoBadges, 4 ; mineralbadge
- engine_flag JohtoBadges, 5 ; stormbadge ; $20
- engine_flag JohtoBadges, 6 ; glacierbadge
- engine_flag JohtoBadges, 7 ; risingbadge
-
- engine_flag KantoBadges, 0 ; boulderbadge
- engine_flag KantoBadges, 1 ; cascadebadge
- engine_flag KantoBadges, 2 ; thunderbadge
- engine_flag KantoBadges, 3 ; rainbowbadge
- engine_flag KantoBadges, 4 ; soulbadge
- engine_flag KantoBadges, 5 ; marshbadge ; $28
- engine_flag KantoBadges, 6 ; volcanobadge
- engine_flag KantoBadges, 7 ; earthbadge
-
- ; unown sets
- engine_flag UnlockedUnowns, 0 ; 1
- engine_flag UnlockedUnowns, 1 ; 2
- engine_flag UnlockedUnowns, 2 ; 3
- engine_flag UnlockedUnowns, 3 ; 4
- engine_flag UnlockedUnowns, 4 ; 5
- engine_flag UnlockedUnowns, 5 ; 6 ; $30
- engine_flag UnlockedUnowns, 6 ; 7
- engine_flag UnlockedUnowns, 7 ; 8
-
- ; fly
- engine_flag VisitedSpawns, 0 ; your house
- engine_flag VisitedSpawns, 1 ; viridian pokecenter
- engine_flag VisitedSpawns, 2 ; pallet
- engine_flag VisitedSpawns, 3 ; viridian
- engine_flag VisitedSpawns, 4 ; pewter
- engine_flag VisitedSpawns, 5 ; cerulean ; $38
- engine_flag VisitedSpawns, 6 ; rock tunnel
- engine_flag VisitedSpawns, 7 ; vermilion
- engine_flag VisitedSpawns + 1, 0 ; lavender
- engine_flag VisitedSpawns + 1, 1 ; saffron
- engine_flag VisitedSpawns + 1, 2 ; celadon
- engine_flag VisitedSpawns + 1, 3 ; fuchsia
- engine_flag VisitedSpawns + 1, 4 ; cinnabar
- engine_flag VisitedSpawns + 1, 5 ; indigo plateau ; $40
- engine_flag VisitedSpawns + 1, 6 ; new bark
- engine_flag VisitedSpawns + 1, 7 ; cherrygrove
- engine_flag VisitedSpawns + 2, 0 ; violet
- ; union cave
- engine_flag VisitedSpawns + 2, 2 ; azalea
- engine_flag VisitedSpawns + 2, 3 ; cianwood
- engine_flag VisitedSpawns + 2, 4 ; goldenrod
- engine_flag VisitedSpawns + 2, 5 ; olivine
- engine_flag VisitedSpawns + 2, 6 ; ecruteak ; $48
- engine_flag VisitedSpawns + 2, 7 ; mahogany
- engine_flag VisitedSpawns + 3, 0 ; lake of rage
- engine_flag VisitedSpawns + 3, 1 ; blackthorn
- engine_flag VisitedSpawns + 3, 2 ; silver cave
- ; fast ship
- engine_flag VisitedSpawns + 3, 4 ; unused
-
- engine_flag wLuckyNumberShowFlag, 0 ; lucky number show
- engine_flag StatusFlags2, 3 ; ????
-
- engine_flag DailyFlags, 0 ; kurt making balls ; $50
- engine_flag DailyFlags, 1 ; ????
- engine_flag DailyFlags, 2 ; special wilddata?
- engine_flag DailyFlags, 3 ; time capsule (24h wait)
- engine_flag DailyFlags, 4 ; all fruit trees
- engine_flag DailyFlags, 5 ; shuckle given
- engine_flag DailyFlags, 6 ; goldenrod underground merchant closed
- engine_flag DailyFlags, 7 ; fought in trainer hall today
-
- engine_flag WeeklyFlags, 0 ; mt moon square clefairy ; $58
- engine_flag WeeklyFlags, 1 ; union cave lapras
- engine_flag WeeklyFlags, 2 ; goldenrod underground haircut used
- engine_flag WeeklyFlags, 3 ; goldenrod mall happiness event floor05 person07
- engine_flag WeeklyFlags, 4 ; tea in blues house
- engine_flag WeeklyFlags, 5 ; indigo plateau rival fight
- engine_flag WeeklyFlags, 6 ; move tutor
- engine_flag WeeklyFlags, 7 ; buenas password
-
- engine_flag SwarmFlags, 0 ; $60
- engine_flag SwarmFlags, 1 ; goldenrod dept store sale is on
-
- engine_flag GameTimerPause, 7 ; $62
-
- engine_flag PlayerGender, 0 ; player is female
-
- engine_flag wCelebiEvent, 2 ; have gs ball after kurt examined it
-
- ; rematches
- engine_flag wDailyRematchFlags, 0 ; jack
- engine_flag wDailyRematchFlags, 1 ; huey
- engine_flag wDailyRematchFlags, 2 ; gaven
- engine_flag wDailyRematchFlags, 3 ; beth ; $68
- engine_flag wDailyRematchFlags, 4 ; jose
- engine_flag wDailyRematchFlags, 5 ; reena
- engine_flag wDailyRematchFlags, 6 ; joey
- engine_flag wDailyRematchFlags, 7 ; wade
- engine_flag wDailyRematchFlags + 1, 0 ; ralph
- engine_flag wDailyRematchFlags + 1, 1 ; liz
- engine_flag wDailyRematchFlags + 1, 2 ; anthony
- engine_flag wDailyRematchFlags + 1, 3 ; todd ; $70
- engine_flag wDailyRematchFlags + 1, 4 ; gina
- engine_flag wDailyRematchFlags + 1, 5 ; arnie
- engine_flag wDailyRematchFlags + 1, 6 ; alan
- engine_flag wDailyRematchFlags + 1, 7 ; dana
- engine_flag wDailyRematchFlags + 2, 0 ; chad
- engine_flag wDailyRematchFlags + 2, 1 ; tully
- engine_flag wDailyRematchFlags + 2, 2 ; brent
- engine_flag wDailyRematchFlags + 2, 3 ; tiffany ; $78
- engine_flag wDailyRematchFlags + 2, 4 ; vance
- engine_flag wDailyRematchFlags + 2, 5 ; wilton
- engine_flag wDailyRematchFlags + 2, 6 ; parry
- engine_flag wDailyRematchFlags + 2, 7 ; erin
-
- engine_flag wDailyPhoneItemFlags, 0 ; beverly has nugget
- engine_flag wDailyPhoneItemFlags, 1 ; jose has star piece
- engine_flag wDailyPhoneItemFlags, 2 ; wade has item (see EVENT_WADE_HAS_*** in constants/event_flags.asm)
- engine_flag wDailyPhoneItemFlags, 3 ; gina has leaf stone ; $80
- engine_flag wDailyPhoneItemFlags, 4 ; alan has fire stone
- engine_flag wDailyPhoneItemFlags, 5 ; liz has thunderstone
- engine_flag wDailyPhoneItemFlags, 6 ; derek has nugget
- engine_flag wDailyPhoneItemFlags, 7 ; tully has water stone
-
- engine_flag wDailyPhoneItemFlags + 1, 0 ; tiffany has pink bow
- engine_flag wDailyPhoneItemFlags + 1, 1 ; wilton has item (see EVENT_WILTON_HAS_*** in constants/event_flags.asm)
-
- engine_flag wDailyPhoneTimeOfDayFlags, 0
- engine_flag wDailyPhoneTimeOfDayFlags, 1 ; $88
- engine_flag wDailyPhoneTimeOfDayFlags, 2
- engine_flag wDailyPhoneTimeOfDayFlags, 3
- engine_flag wDailyPhoneTimeOfDayFlags, 4
- engine_flag wDailyPhoneTimeOfDayFlags, 5
- engine_flag wDailyPhoneTimeOfDayFlags, 6
- engine_flag wDailyPhoneTimeOfDayFlags, 7
-
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 0
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 1 ; $90
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 2
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 3
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 4
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 5
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 6
- engine_flag wDailyPhoneTimeOfDayFlags + 1, 7
-
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 0
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 1 ; $98
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 2
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 3
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 4
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 5
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 6
- engine_flag wDailyPhoneTimeOfDayFlags + 2, 7
-
- engine_flag wPlayerSpriteSetupFlags, 2 ; female player has been transformed into male
-
- engine_flag SwarmFlags, 2 ; dunsparce swarm ; $a0
- engine_flag SwarmFlags, 3 ; yanma swarm
+INCLUDE "data/engine_flags.asm"
diff --git a/engine/european_mail.asm b/engine/european_mail.asm
new file mode 100644
index 000000000..8f037cc43
--- /dev/null
+++ b/engine/european_mail.asm
@@ -0,0 +1,129 @@
+IsMailEuropean: ; 1de5c8
+; return 1 if French
+; return 2 if German
+; return 3 if Italian
+; return 4 if Spanish
+; return 0 if none of the above
+ ld c, $0
+ ld hl, sPartyMon1MailAuthorNationality - sPartyMon1Mail
+ add hl, de
+ ld a, [hli]
+ cp "E"
+ ret nz
+ ld a, [hli]
+ inc c
+ cp "F"
+ ret z
+ inc c
+ cp "G"
+ ret z
+ inc c
+ cp "I"
+ ret z
+ inc c
+ cp "S"
+ ret z
+ ld c, $0
+ ret
+
+; The regular font.
+StandardEnglishFont: ; 1de5e6
+INCBIN "gfx/font/english.1bpp"
+
+; An extended font.
+FrenchGermanFont: ; 1de9e6
+INCBIN "gfx/font/french_german.1bpp"
+
+; An even more extended font.
+SpanishItalianFont: ; 1dede6
+INCBIN "gfx/font/spanish_italian.1bpp"
+
+HandleFrenchGermanMail: ; 1df1e6
+; called if mail is french or german
+; fix 's 't 'v
+ ld b, sPartyMon1MailAuthor - sPartyMon1Mail
+ ld h, d
+ ld l, e
+.loop
+ ld a, [hl]
+ cp $dc ; 's in french/german font
+ jr nz, .check_intermediate_chars
+ ld a, "'s"
+ jr .replace
+
+.check_intermediate_chars
+ sub "'s"
+ jr c, .dont_replace
+ cp "'v" - "'s" + 1
+ jr nc, .dont_replace
+ add $cd
+
+.replace
+ ld [hl], a
+
+.dont_replace
+ inc hl
+ dec b
+ jr nz, .loop
+ ret
+
+LireLeCourrierAnglais:
+DeutenEnglischenPost: ; 1df203
+; Cette fonction convertit certains des caractères anglais pour
+; leur équivalent dans le jeu de caractères français.
+; Diese Funktion wandelt bestimmte englische Zeichen, um ihre
+; Entsprechung in der Deutschen-Zeichensatz.
+ ld b, sPartyMon1MailAuthor - sPartyMon1Mail
+ ld h, d
+ ld l, e
+.loop
+ ld a, [hl]
+ cp "'s"
+ jr nz, .check_intermediate_chars
+ ld a, $dc
+ jr .replace
+
+.check_intermediate_chars
+ sub $cd
+ jr c, .dont_replace
+ cp "'v" - "'s" + 1
+ jr nc, .dont_replace
+ add "'s"
+
+.replace
+ ld [hl], a
+
+.dont_replace
+ inc hl
+ dec b
+ jr nz, .loop
+ ret
+
+HandleSpanishItalianMail: ; 1df220
+LeerCorreosIngleses:
+LeggiPostaInglese:
+; This function converts certain characters between
+; the English and Spanish/Italian character sets.
+; Esta función convierte ciertos caracteres entre
+; el juego de caracteres Inglés y Español.
+; Questa funzione converte alcuni caratteri tra
+; l'inglese e il set di caratteri italiani.
+ ld b, sPartyMon1MailAuthor - sPartyMon1Mail
+ ld h, d
+ ld l, e
+.loop
+ ld a, [hl]
+ and $f0
+ cp $d0
+ jr nz, .dont_replace
+ ld a, [hl]
+ add $8
+ and $f
+ or $d0
+ ld [hl], a
+
+.dont_replace
+ inc hl
+ dec b
+ jr nz, .loop
+ ret
diff --git a/engine/events.asm b/engine/events.asm
index b8d57118e..9b26893e7 100644
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -120,14 +120,14 @@ StartMap: ; 96724
ld hl, MapStatus
ld bc, wMapStatusEnd - MapStatus
call ByteFill
- callba InitCallReceiveDelay
+ farcall InitCallReceiveDelay
call ClearJoypad
EnterMap: ; 9673e
xor a
ld [wXYComparePointer], a
ld [wXYComparePointer + 1], a
call SetUpFiveStepWildEncounterCooldown
- callba RunMapSetupScript
+ farcall RunMapSetupScript
call DisableEvents
ld a, [hMapEntryMethod]
@@ -159,7 +159,7 @@ UnusedWait30Frames: ; 9676d
HandleMap: ; 96773
call ResetOverworldDelay
call HandleMapTimeAndJoypad
- callba HandleCmdQueue ; no need to farcall
+ farcall HandleCmdQueue ; no need to farcall
call MapEvents
; Not immediately entering a connected map will cause problems.
@@ -188,7 +188,7 @@ MapEvents: ; 96795
.events ; 967a1
call PlayerEvents
call DisableEvents
- callba ScriptEvents
+ farcall ScriptEvents
ret
; 967ae
@@ -227,16 +227,16 @@ HandleMapTimeAndJoypad: ; 967c1
; 967d1
HandleMapObjects: ; 967d1
- callba HandleNPCStep ; engine/map_objects.asm
- callba _HandlePlayerStep
+ farcall HandleNPCStep ; engine/map_objects.asm
+ farcall _HandlePlayerStep
call _CheckObjectEnteringVisibleRange
ret
; 967e1
HandleMapBackground: ; 967e1
- callba _UpdateSprites
- callba ScrollScreen
- callba PlaceMapNameSign
+ farcall _UpdateSprites
+ farcall ScrollScreen
+ farcall PlaceMapNameSign
ret
; 967f4
@@ -264,7 +264,7 @@ _CheckObjectEnteringVisibleRange: ; 96812
ld hl, wPlayerStepFlags
bit 6, [hl]
ret z
- callba CheckObjectEnteringVisibleRange
+ farcall CheckObjectEnteringVisibleRange
ret
; 9681f
@@ -286,7 +286,7 @@ PlayerEvents: ; 9681f
call RunMemScript
jr c, .ok
- call DoMapTrigger
+ call RunSceneScript
jr c, .ok
call CheckTimeEvents
@@ -300,7 +300,7 @@ PlayerEvents: ; 9681f
.ok
push af
- callba EnableScriptMode
+ farcall EnableScriptMode
pop af
ld [ScriptRunning], a
@@ -335,12 +335,12 @@ CheckTrainerBattle3: ; 96867
; 96874
CheckTileEvent: ; 96874
-; Check for warps, tile triggers or wild battles.
+; Check for warps, coord events, or wild battles.
call CheckWarpConnxnScriptFlag
jr z, .connections_disabled
- callba CheckMovingOffEdgeOfMap
+ farcall CheckMovingOffEdgeOfMap
jr c, .map_connection
call CheckWarpTile
@@ -350,7 +350,7 @@ CheckTileEvent: ; 96874
call CheckCoordEventScriptFlag
jr z, .coord_events_disabled
- call CheckCurrentMapXYTriggers
+ call CheckCurrentMapCoordEvents
jr c, .coord_event
.coord_events_disabled
@@ -437,19 +437,19 @@ Dummy_CheckScriptFlags3Bit5: ; 968e4
ret
; 968ec
-DoMapTrigger: ; 968ec
- ld a, [wCurrMapTriggerCount]
+RunSceneScript: ; 968ec
+ ld a, [wCurrMapSceneScriptCount]
and a
jr z, .nope
ld c, a
- call CheckTriggers
+ call CheckScenes
cp c
jr nc, .nope
ld e, a
ld d, 0
- ld hl, wCurrMapTriggerHeaderPointer
+ ld hl, wCurrMapSceneScriptHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -465,8 +465,8 @@ endr
ld hl, ScriptFlags
res 3, [hl]
- callba EnableScriptMode
- callba ScriptEvents
+ farcall EnableScriptMode
+ farcall ScriptEvents
ld hl, ScriptFlags
bit 3, [hl]
@@ -495,15 +495,15 @@ CheckTimeEvents: ; 9693a
bit 2, [hl] ; bug contest
jr z, .do_daily
- callba CheckBugContestTimer
+ farcall CheckBugContestTimer
jr c, .end_bug_contest
xor a
ret
.do_daily
- callba CheckDailyResetTimer
- callba CheckPokerusTick
- callba CheckPhoneCall
+ farcall CheckDailyResetTimer
+ farcall CheckPokerusTick
+ farcall CheckPhoneCall
ret c
.nothing
@@ -532,7 +532,7 @@ OWPlayerInput: ; 96974
jr nz, .NoAction
; Can't perform button actions while sliding on ice.
- callba CheckStandingOnIce
+ farcall CheckStandingOnIce
jr c, .NoAction
call CheckAPressOW
@@ -547,7 +547,7 @@ OWPlayerInput: ; 96974
.Action:
push af
- callba StopPlayerForEvent
+ farcall StopPlayerForEvent
pop af
scf
ret
@@ -559,9 +559,9 @@ CheckAPressOW: ; 96999
ret z
call TryObjectEvent
ret c
- call TryReadSign
+ call TryBGEvent
ret c
- call CheckFacingTileEvent
+ call TryTileCollisionEvent
ret c
xor a
ret
@@ -576,7 +576,7 @@ PlayTalkObject: ; 969ac
; 969b5
TryObjectEvent: ; 969b5
- callba CheckFacingObject
+ farcall CheckFacingObject
jr c, .IsObject
xor a
ret
@@ -617,14 +617,14 @@ TryObjectEvent: ; 969b5
ret
.pointers
- dbw PERSONTYPE_SCRIPT, .script
- dbw PERSONTYPE_ITEMBALL, .itemball
- dbw PERSONTYPE_TRAINER, .trainer
+ dbw OBJECTTYPE_SCRIPT, .script
+ dbw OBJECTTYPE_ITEMBALL, .itemball
+ dbw OBJECTTYPE_TRAINER, .trainer
; the remaining four are dummy events
- dbw PERSONTYPE_3, .three
- dbw PERSONTYPE_4, .four
- dbw PERSONTYPE_5, .five
- dbw PERSONTYPE_6, .six
+ dbw OBJECTTYPE_3, .three
+ dbw OBJECTTYPE_4, .four
+ dbw OBJECTTYPE_5, .five
+ dbw OBJECTTYPE_6, .six
db -1
; 96a04
@@ -681,19 +681,19 @@ TryObjectEvent: ; 969b5
ret
; 96a38
-TryReadSign: ; 96a38
- call CheckFacingSign
- jr c, .IsSign
+TryBGEvent: ; 96a38
+ call CheckFacingBGEvent
+ jr c, .is_bg_event
xor a
ret
-.IsSign:
+.is_bg_event:
ld a, [EngineBuffer3]
- ld hl, .signs
+ ld hl, .bg_events
rst JumpTable
ret
-.signs
+.bg_events
dw .read
dw .up
dw .down
@@ -736,7 +736,7 @@ TryReadSign: ; 96a38
ret
.itemifset
- call CheckSignFlag
+ call CheckBGEventFlag
jp nz, .dontread
call PlayTalkObject
call GetMapScriptHeaderBank
@@ -750,7 +750,7 @@ TryReadSign: ; 96a38
ret
.copy
- call CheckSignFlag
+ call CheckBGEventFlag
jr nz, .dontread
call GetMapScriptHeaderBank
ld de, EngineBuffer1
@@ -759,12 +759,12 @@ TryReadSign: ; 96a38
jr .dontread
.ifset
- call CheckSignFlag
+ call CheckBGEventFlag
jr z, .dontread
jr .thenread
.ifnotset
- call CheckSignFlag
+ call CheckBGEventFlag
jr nz, .dontread
.thenread
@@ -785,7 +785,7 @@ TryReadSign: ; 96a38
ret
; 96ad8
-CheckSignFlag: ; 96ad8
+CheckBGEventFlag: ; 96ad8
ld hl, EngineBuffer4
ld a, [hli]
ld h, [hl]
@@ -804,7 +804,7 @@ CheckSignFlag: ; 96ad8
; 96af0
PlayerMovement: ; 96af0
- callba DoPlayerMovement
+ farcall DoPlayerMovement
ld a, c
ld hl, .pointers
rst JumpTable
@@ -934,7 +934,7 @@ CountStep: ; 96b79
jr nz, .done
; If there is a special phone call, don't count the step.
- callba CheckSpecialPhoneCall
+ farcall CheckSpecialPhoneCall
jr c, .doscript
; If Repel wore off, don't count the step.
@@ -949,7 +949,7 @@ CountStep: ; 96b79
; Every 256 steps, increase the happiness of all your Pokemon.
jr nz, .skip_happiness
- callba StepHappiness
+ farcall StepHappiness
.skip_happiness
; Every 256 steps, offset from the happiness incrementor by 128 steps,
@@ -959,12 +959,12 @@ CountStep: ; 96b79
cp $80
jr nz, .skip_egg
- callba DoEggStep
+ farcall DoEggStep
jr nz, .hatch
.skip_egg
; Increase the EXP of (both) DayCare Pokemon by 1.
- callba DaycareStep
+ farcall DayCareStep
; Every four steps, deal damage to all Poisoned Pokemon
ld hl, PoisonStepCount
@@ -973,11 +973,11 @@ CountStep: ; 96b79
jr c, .skip_poison
ld [hl], 0
- callba DoPoisonStep
+ farcall DoPoisonStep
jr c, .doscript
.skip_poison
- callba DoBikeStep
+ farcall DoBikeStep
.done
xor a
diff --git a/engine/events_2.asm b/engine/events_2.asm
index 42e3ed8e4..12476bd31 100644
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -50,42 +50,42 @@ LoadScriptBDE:: ; 97c4f
ret
; 97c5f
-CheckFacingTileEvent:: ; 97c5f
+TryTileCollisionEvent:: ; 97c5f
call GetFacingTileCoord
ld [EngineBuffer1], a
ld c, a
- callba CheckFacingTileForStd
+ farcall CheckFacingTileForStdScript
jr c, .done
call CheckCutTreeTile
jr nz, .whirlpool
- callba TryCutOW
+ farcall TryCutOW
jr .done
.whirlpool
ld a, [EngineBuffer1]
call CheckWhirlpoolTile
jr nz, .waterfall
- callba TryWhirlpoolOW
+ farcall TryWhirlpoolOW
jr .done
.waterfall
ld a, [EngineBuffer1]
call CheckWaterfallTile
jr nz, .headbutt
- callba TryWaterfallOW
+ farcall TryWaterfallOW
jr .done
.headbutt
ld a, [EngineBuffer1]
call CheckHeadbuttTreeTile
jr nz, .surf
- callba TryHeadbuttOW
+ farcall TryHeadbuttOW
jr c, .done
jr .noevent
.surf
- callba TrySurfOW
+ farcall TrySurfOW
jr nc, .noevent
jr .done
@@ -111,7 +111,7 @@ RandomEncounter:: ; 97cc0
ld hl, StatusFlags2
bit 2, [hl] ; bug contest
jr nz, .bug_contest
- callba TryWildEncounter
+ farcall TryWildEncounter
jr nz, .nope
jr .ok
@@ -152,12 +152,12 @@ CanUseSweetScent:: ; 97cfd
ld hl, StatusFlags
bit 5, [hl]
jr nz, .no
- ld a, [wPermission]
+ ld a, [wEnvironment]
cp CAVE
jr z, .ice_check
cp DUNGEON
jr z, .ice_check
- callba CheckGrassCollision
+ farcall CheckGrassCollision
jr nc, .no
.ice_check
@@ -176,7 +176,7 @@ _TryWildEncounter_BugContest: ; 97d23
call TryWildEncounter_BugContest
ret nc
call ChooseWildEncounter_BugContest
- callba CheckRepelEffect
+ farcall CheckRepelEffect
ret
; 97d31
@@ -242,8 +242,8 @@ TryWildEncounter_BugContest: ; 97d64
ld b, 20 percent
.ok
- callba ApplyMusicEffectOnEncounterRate
- callba ApplyCleanseTagEffectOnEncounterRate
+ farcall ApplyMusicEffectOnEncounterRate
+ farcall ApplyCleanseTagEffectOnEncounterRate
call Random
ld a, [hRandomAdd]
cp b
@@ -253,20 +253,9 @@ TryWildEncounter_BugContest: ; 97d64
ret
; 97d87
-ContestMons: ; 97d87
- ; %, species, min, max
- db 20, CATERPIE, 7, 18
- db 20, WEEDLE, 7, 18
- db 10, METAPOD, 9, 18
- db 10, KAKUNA, 9, 18
- db 5, BUTTERFREE, 12, 15
- db 5, BEEDRILL, 12, 15
- db 10, VENONAT, 10, 16
- db 10, PARAS, 10, 17
- db 5, SCYTHER, 13, 14
- db 5, PINSIR, 13, 14
- db -1, VENOMOTH, 30, 40
-; 97db3
+
+INCLUDE "data/wild/bug_contest_mons.asm"
+
DoBikeStep:: ; 97db3
nop
@@ -627,7 +616,7 @@ CmdQueue_StoneTable: ; 97f42
ld hl, OBJECT_MOVEMENTTYPE
add hl, de
ld a, [hl]
- cp STEP_TYPE_SKYFALL_TOP
+ cp SPRITEMOVEDATA_STRENGTH_BOULDER
jr nz, .next
ld hl, OBJECT_NEXT_TILE
diff --git a/engine/events_3.asm b/engine/events_3.asm
index b6aaea3b7..3d662c332 100755
--- a/engine/events_3.asm
+++ b/engine/events_3.asm
@@ -1,14 +1,14 @@
ReturnFromMapSetupScript:: ; b8000
xor a
ld [hBGMapMode], a
- ; For some reson, GameFreak chose to use a callba here instead of just falling through.
+ ; For some reson, GameFreak chose to use a farcall here instead of just falling through.
; No other function in the game references the function at 2E:400A, here labeled
- ; ReturnFromMapSetupScript.inefficientcallba.
- callba .inefficientcallba ; this is a waste of 6 ROM bytes and 6 stack bytes
+ ; ReturnFromMapSetupScript.inefficient_farcall.
+ farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes
ret
; b800a
-.inefficientcallba ; b800a
+.inefficient_farcall ; b800a
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
@@ -18,7 +18,7 @@ ReturnFromMapSetupScript:: ; b8000
call .CheckNationalParkGate
jr z, .nationalparkgate
- call GetMapPermission
+ call GetMapEnvironment
cp GATE
jr nz, .not_gate
@@ -45,7 +45,7 @@ ReturnFromMapSetupScript:: ; b8000
ld [wLandmarkSignTimer], a
call LoadMapNameSignGFX
call InitMapNameFrame
- callba HDMATransfer_OnlyTopFourRows
+ farcall HDMATransfer_OnlyTopFourRows
ret
.dont_do_map_sign
@@ -78,7 +78,7 @@ ReturnFromMapSetupScript:: ; b8000
ret z
cp LAV_RADIO_TOWER
ret z
- cp UNDERGROUND
+ cp UNDERGROUND_PATH
ret z
cp INDIGO_PLATEAU
ret z
@@ -113,7 +113,7 @@ PlaceMapNameSign:: ; b8098 (2e:4098)
jr nz, .skip2
call InitMapNameFrame
call PlaceMapNameCenterAlign
- callba HDMATransfer_OnlyTopFourRows
+ farcall HDMATransfer_OnlyTopFourRows
.skip2
ld a, $80
ld a, $70
@@ -151,7 +151,7 @@ InitMapNameFrame: ; b80d3
PlaceMapNameCenterAlign: ; b80e1 (2e:40e1)
ld a, [wCurrentLandmark]
ld e, a
- callba GetLandmarkName
+ farcall GetLandmarkName
call .GetNameLength
ld a, SCREEN_WIDTH
sub c
@@ -283,30 +283,30 @@ CheckForHiddenItems: ; b8172
ld a, [YCoord]
add SCREEN_HEIGHT / 4
ld [Buffer3], a
-; Get the pointer for the first signpost header in the map...
- ld hl, wCurrentMapSignpostHeaderPointer
+; Get the pointer for the first BG event header in the map...
+ ld hl, wCurrMapBGEventHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
-; ... before even checking to see if there are any signposts on this map.
- ld a, [wCurrentMapSignpostCount]
+; ... before even checking to see if there are any BG events on this map.
+ ld a, [wCurrMapBGEventCount]
and a
- jr z, .nosignpostitems
-; For i = 1:wCurrentMapSignpostCount...
+ jr z, .nobgeventitems
+; For i = 1:wCurrMapBGEventCount...
.loop
-; Store the counter in Buffer2, and store the signpost header pointer in the stack.
+; Store the counter in Buffer2, and store the BG event header pointer in the stack.
ld [Buffer2], a
push hl
-; Get the Y coordinate of the signpost.
+; Get the Y coordinate of the BG event.
call .GetFarByte
ld e, a
-; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost.
+; Is the Y coordinate of the BG event on the screen? If not, go to the next BG event.
ld a, [Buffer3]
sub e
jr c, .next
cp SCREEN_HEIGHT / 2
jr nc, .next
-; Is the X coordinate of the signpost on the screen? If not, go to the next signpost.
+; Is the X coordinate of the BG event on the screen? If not, go to the next BG event.
call .GetFarByte
ld d, a
ld a, [Buffer4]
@@ -314,9 +314,9 @@ CheckForHiddenItems: ; b8172
jr c, .next
cp SCREEN_WIDTH / 2
jr nc, .next
-; Is this signpost a hidden item? If not, go to the next signpost.
+; Is this BG event a hidden item? If not, go to the next BG event.
call .GetFarByte
- cp SIGNPOST_ITEM
+ cp BGEVENT_ITEM
jr nz, .next
; Has this item already been found? If not, set off the Itemfinder.
ld a, [Buffer1]
@@ -332,16 +332,16 @@ CheckForHiddenItems: ; b8172
jr z, .itemnearby
.next
-; Restore the signpost header pointer and increment it by the length of a signpost header.
+; Restore the BG event header pointer and increment it by the length of a BG event header.
pop hl
ld bc, 5
add hl, bc
-; Restore the signpost counter and decrement it. If it hits zero, there are no hidden items in range.
+; Restore the BG event counter and decrement it. If it hits zero, there are no hidden items in range.
ld a, [Buffer2]
dec a
jr nz, .loop
-.nosignpostitems
+.nobgeventitems
xor a
ret
@@ -360,7 +360,7 @@ CheckForHiddenItems: ; b8172
TreeMonEncounter: ; b81ea
- callba TrainerRankings_TreeEncounters
+ farcall TrainerRankings_TreeEncounters
xor a
ld [TempWildMonSpecies], a
@@ -455,55 +455,7 @@ GetTreeMonSet: ; b823f
ret
; b825e
-TreeMonMaps: ; b825e
-treemon_map: macro
- map \1
- db \2 ; treemon set
-endm
- treemon_map ROUTE_26, 4
- treemon_map ROUTE_27, 4
- treemon_map ROUTE_28, 0
- treemon_map ROUTE_29, 3
- treemon_map ROUTE_30, 3
- treemon_map ROUTE_31, 3
- treemon_map ROUTE_32, 4
- treemon_map ROUTE_33, 2
- treemon_map ROUTE_34, 3
- treemon_map ROUTE_35, 3
- treemon_map ROUTE_36, 3
- treemon_map ROUTE_37, 3
- treemon_map ROUTE_38, 3
- treemon_map ROUTE_39, 3
- treemon_map ROUTE_40, 0
- treemon_map ROUTE_41, 0
- treemon_map ROUTE_42, 2
- treemon_map ROUTE_43, 5
- treemon_map ROUTE_44, 1
- treemon_map ROUTE_45, 1
- treemon_map ROUTE_46, 1
- treemon_map NEW_BARK_TOWN, 0
- treemon_map CHERRYGROVE_CITY, 0
- treemon_map VIOLET_CITY, 0
- treemon_map AZALEA_TOWN, 2
- treemon_map CIANWOOD_CITY, 0
- treemon_map GOLDENROD_CITY, 0
- treemon_map OLIVINE_CITY, 0
- treemon_map ECRUTEAK_CITY, 0
- treemon_map MAHOGANY_TOWN, 0
- treemon_map LAKE_OF_RAGE, 5
- treemon_map BLACKTHORN_CITY, 0
- treemon_map SILVER_CAVE_OUTSIDE, 0
- treemon_map ILEX_FOREST, 6
- db -1
-; b82c5
-
-RockMonMaps: ; b82c5
- treemon_map CIANWOOD_CITY, 7
- treemon_map ROUTE_40, 7
- treemon_map DARK_CAVE_VIOLET_ENTRANCE, 7
- treemon_map SLOWPOKE_WELL_B1F, 7
- db -1
-; b82d2
+INCLUDE "data/wild/treemon_maps.asm"
GetTreeMons: ; b82d2
; Return the address of TreeMon table a in hl.
@@ -533,128 +485,7 @@ GetTreeMons: ; b82d2
ret
; b82e8
-TreeMons: ; b82e8
- dw TreeMons1
- dw TreeMons1
- dw TreeMons2
- dw TreeMons3
- dw TreeMons4
- dw TreeMons5
- dw TreeMons6
- dw RockMons
- dw TreeMons1
-
-; Two tables each (normal, rare).
-; Structure:
-; db %, species, level
-
-TreeMons1: ; b82fa
- db 50, SPEAROW, 10
- db 15, SPEAROW, 10
- db 15, SPEAROW, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
- db 50, SPEAROW, 10
- db 15, HERACROSS, 10
- db 15, HERACROSS, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
-TreeMons2: ; b8320
- db 50, SPEAROW, 10
- db 15, EKANS, 10
- db 15, SPEAROW, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
- db 50, SPEAROW, 10
- db 15, HERACROSS, 10
- db 15, HERACROSS, 10
- db 10, AIPOM, 10
- db 5, AIPOM, 10
- db 5, AIPOM, 10
- db -1
-
-TreeMons3: ; b8346
- db 50, HOOTHOOT, 10
- db 15, SPINARAK, 10
- db 15, LEDYBA, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
-TreeMons4: ; b836c
- db 50, HOOTHOOT, 10
- db 15, EKANS, 10
- db 15, HOOTHOOT, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
-TreeMons5: ; b8392
- db 50, HOOTHOOT, 10
- db 15, VENONAT, 10
- db 15, HOOTHOOT, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db 5, EXEGGCUTE, 10
- db -1
-
-TreeMons6: ; b83b8
- db 50, HOOTHOOT, 10
- db 15, PINECO, 10
- db 15, PINECO, 10
- db 10, NOCTOWL, 10
- db 5, BUTTERFREE, 10
- db 5, BEEDRILL, 10
- db -1
-
- db 50, HOOTHOOT, 10
- db 15, CATERPIE, 10
- db 15, WEEDLE, 10
- db 10, HOOTHOOT, 10
- db 5, METAPOD, 10
- db 5, KAKUNA, 10
- db -1
-
-RockMons: ; b83de
- db 90, KRABBY, 15
- db 10, SHUCKLE, 15
- db -1
-; b83e5
+INCLUDE "data/wild/treemons.asm"
GetTreeMon: ; b83e5
push hl
diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm
index 2f1c4c522..dd09f9eda 100755
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -36,7 +36,7 @@ EvolutionAnimation: ; 4e5e1
ld de, MUSIC_NONE
call PlayMusic
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
ld de, .GFX
ld hl, VTiles0
@@ -106,7 +106,7 @@ EvolutionAnimation: ; 4e5e1
ld c, $0
call .GetSGBLayout
call .PlayEvolvedSFX
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call .check_statused
jr c, .no_anim
@@ -143,7 +143,7 @@ EvolutionAnimation: ; 4e5e1
ld c, $0
call .GetSGBLayout
call .PlayEvolvedSFX
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call .check_statused
ret c
@@ -168,7 +168,7 @@ EvolutionAnimation: ; 4e5e1
ld a, $1
ld [wBoxAlignment], a
ld de, VTiles2
- predef FrontpicPredef
+ predef GetAnimatedFrontpicPredef
xor a
ld [wBoxAlignment], a
ret
@@ -263,7 +263,7 @@ EvolutionAnimation: ; 4e5e1
call GetPartyLocation
ld b, h
ld c, l
- callba CheckFaintedFrzSlp
+ farcall CheckFaintedFrzSlp
ret
; 4e7a6
@@ -316,7 +316,7 @@ EvolutionAnimation: ; 4e5e1
.GenerateBallOfLight: ; 4e7e8
push de
depixel 9, 11
- ld a, SPRITE_ANIM_INDEX_13
+ ld a, SPRITE_ANIM_INDEX_EVOLUTION_BALL_OF_LIGHT
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
@@ -337,7 +337,7 @@ EvolutionAnimation: ; 4e5e1
.AnimateBallsOfLight: ; 4e80c
push bc
- callab PlaySpriteAnimations
+ callfar PlaySpriteAnimations
; a = (([hVBlankCounter] + 4) / 2) % NUM_PALETTES
ld a, [hVBlankCounter]
and %1110
diff --git a/engine/evolve.asm b/engine/evolve.asm
index 3dc5d20b7..c335229d6 100755
--- a/engine/evolve.asm
+++ b/engine/evolve.asm
@@ -133,13 +133,13 @@ EvolveAfterBattle_MasterLoop
; TR_NITE
ld a, [TimeOfDay]
- cp NITE
+ cp NITE_F
jp nz, .dont_evolve_3
jr .proceed
.happiness_daylight
ld a, [TimeOfDay]
- cp NITE
+ cp NITE_F
jp z, .dont_evolve_3
jr .proceed
@@ -225,7 +225,7 @@ EvolveAfterBattle_MasterLoop
ld [hBGMapMode], a
call ClearSprites
- callba EvolutionAnimation
+ farcall EvolutionAnimation
push af
call ClearSprites
@@ -247,7 +247,7 @@ EvolveAfterBattle_MasterLoop
push hl
ld hl, Text_EvolvedIntoPKMN
call PrintTextBoxText
- callba TrainerRankings_MonsEvolved
+ farcall TrainerRankings_MonsEvolved
ld de, MUSIC_NONE
call PlayMusic
@@ -312,7 +312,7 @@ EvolveAfterBattle_MasterLoop
ld hl, TempMonDVs
predef GetUnownLetter
- callab UpdateUnownDex
+ callfar UpdateUnownDex
.skip_unown
pop de
diff --git a/engine/experience.asm b/engine/experience.asm
new file mode 100644
index 000000000..c33aaf02a
--- /dev/null
+++ b/engine/experience.asm
@@ -0,0 +1,162 @@
+CalcLevel: ; 50e1b
+ ld a, [TempMonSpecies]
+ ld [CurSpecies], a
+ call GetBaseData
+ ld d, 1
+.next_level
+ inc d
+ ld a, d
+ cp (MAX_LEVEL + 1) % $100
+ jr z, .got_level
+ call CalcExpAtLevel
+ push hl
+ ld hl, TempMonExp + 2
+ ld a, [hProduct + 3]
+ ld c, a
+ ld a, [hld]
+ sub c
+ ld a, [hProduct + 2]
+ ld c, a
+ ld a, [hld]
+ sbc c
+ ld a, [hProduct + 1]
+ ld c, a
+ ld a, [hl]
+ sbc c
+ pop hl
+ jr nc, .next_level
+
+.got_level
+ dec d
+ ret
+
+CalcExpAtLevel: ; 50e47
+; (a/b)*n**3 + c*n**2 + d*n - e
+ ld a, [BaseGrowthRate]
+ add a
+ add a
+ ld c, a
+ ld b, 0
+ ld hl, GrowthRates
+ add hl, bc
+; Cube the level
+ call .LevelSquared
+ ld a, d
+ ld [hMultiplier], a
+ call Multiply
+
+; Multiply by a
+ ld a, [hl]
+ and $f0
+ swap a
+ ld [hMultiplier], a
+ call Multiply
+; Divide by b
+ ld a, [hli]
+ and $f
+ ld [hDivisor], a
+ ld b, 4
+ call Divide
+; Push the cubic term to the stack
+ ld a, [hQuotient + 0]
+ push af
+ ld a, [hQuotient + 1]
+ push af
+ ld a, [hQuotient + 2]
+ push af
+; Square the level and multiply by the lower 7 bits of c
+ call .LevelSquared
+ ld a, [hl]
+ and $7f
+ ld [hMultiplier], a
+ call Multiply
+; Push the absolute value of the quadratic term to the stack
+ ld a, [hProduct + 1]
+ push af
+ ld a, [hProduct + 2]
+ push af
+ ld a, [hProduct + 3]
+ push af
+ ld a, [hli]
+ push af
+; Multiply the level by d
+ xor a
+ ld [hMultiplicand + 0], a
+ ld [hMultiplicand + 1], a
+ ld a, d
+ ld [hMultiplicand + 2], a
+ ld a, [hli]
+ ld [hMultiplier], a
+ call Multiply
+; Subtract e
+ ld b, [hl]
+ ld a, [hProduct + 3]
+ sub b
+ ld [hMultiplicand + 2], a
+ ld b, $0
+ ld a, [hProduct + 2]
+ sbc b
+ ld [hMultiplicand + 1], a
+ ld a, [hProduct + 1]
+ sbc b
+ ld [hMultiplicand], a
+; If bit 7 of c is set, c is negative; otherwise, it's positive
+ pop af
+ and $80
+ jr nz, .subtract
+; Add c*n**2 to (d*n - e)
+ pop bc
+ ld a, [hProduct + 3]
+ add b
+ ld [hMultiplicand + 2], a
+ pop bc
+ ld a, [hProduct + 2]
+ adc b
+ ld [hMultiplicand + 1], a
+ pop bc
+ ld a, [hProduct + 1]
+ adc b
+ ld [hMultiplicand], a
+ jr .done_quadratic
+
+.subtract
+; Subtract c*n**2 from (d*n - e)
+ pop bc
+ ld a, [hProduct + 3]
+ sub b
+ ld [hMultiplicand + 2], a
+ pop bc
+ ld a, [hProduct + 2]
+ sbc b
+ ld [hMultiplicand + 1], a
+ pop bc
+ ld a, [hProduct + 1]
+ sbc b
+ ld [hMultiplicand], a
+
+.done_quadratic
+; Add (a/b)*n**3 to (d*n - e +/- c*n**2)
+ pop bc
+ ld a, [hProduct + 3]
+ add b
+ ld [hMultiplicand + 2], a
+ pop bc
+ ld a, [hProduct + 2]
+ adc b
+ ld [hMultiplicand + 1], a
+ pop bc
+ ld a, [hProduct + 1]
+ adc b
+ ld [hMultiplicand], a
+ ret
+
+.LevelSquared: ; 50eed
+ xor a
+ ld [hMultiplicand + 0], a
+ ld [hMultiplicand + 1], a
+ ld a, d
+ ld [hMultiplicand + 2], a
+ ld [hMultiplier], a
+ jp Multiply
+
+INCLUDE "data/growth_rates.asm"
diff --git a/engine/facings.asm b/engine/facings.asm
deleted file mode 100644
index ee9efec3f..000000000
--- a/engine/facings.asm
+++ /dev/null
@@ -1,268 +0,0 @@
-Facings: ; 4049
- dw FacingStepDown0
- dw FacingStepDown1
- dw FacingStepDown2
- dw FacingStepDown3
- dw FacingStepUp0
- dw FacingStepUp1
- dw FacingStepUp2
- dw FacingStepUp3
- dw FacingStepLeft0
- dw FacingStepLeft1
- dw FacingStepLeft2
- dw FacingStepLeft3
- dw FacingStepRight0
- dw FacingStepRight1
- dw FacingStepRight2
- dw FacingStepRight3
- dw FacingFishDown
- dw FacingFishUp
- dw FacingFishLeft
- dw FacingFishRight
- dw FacingEmote
- dw FacingShadow
- dw FacingBigDollAsymmetric
- dw FacingBigDollSymmetric
- dw FacingWeirdTree0
- dw FacingWeirdTree1
- dw FacingWeirdTree2
- dw FacingWeirdTree3
- dw FacingBoulderDust1
- dw FacingBoulderDust2
- dw FacingGrass1
- dw FacingGrass2
-FacingsEnd: dw 0
-
-NUM_FACINGS EQU (FacingsEnd - Facings) / 2
-
-
-; Tables used as a reference to transform OAM data.
-
-; Format:
-; db y, x, attributes, tile index
-
-; Attributes:
-X_FLIP EQU 1 << OAM_X_FLIP
-Y_FLIP EQU 1 << OAM_Y_FLIP
-BEHIND_BG EQU 1 << OAM_PRIORITY
-
-
-FacingStepDown0:
-FacingStepDown2:
-FacingWeirdTree0:
-FacingWeirdTree2: ; standing down
- db 4 ; #
- db 0, 0, 0, $00
- db 0, 8, 0, $01
- db 8, 0, 2, $02
- db 8, 8, 2, $03
-; 409c
-
-FacingStepDown1: ; walking down 1
- db 4 ; #
- db 0, 0, 0, $80
- db 0, 8, 0, $81
- db 8, 0, 2, $82
- db 8, 8, 2, $83
-; 40ad
-
-FacingStepDown3: ; walking down 2
- db 4 ; #
- db 0, 8, X_FLIP, $80
- db 0, 0, X_FLIP, $81
- db 8, 8, 2 | X_FLIP, $82
- db 8, 0, 2 | X_FLIP, $83
-; 40be
-
-FacingStepUp0:
-FacingStepUp2: ; standing up
- db 4 ; #
- db 0, 0, 0, $04
- db 0, 8, 0, $05
- db 8, 0, 2, $06
- db 8, 8, 2, $07
-; 40cf
-
-FacingStepUp1: ; walking up 1
- db 4 ; #
- db 0, 0, 0, $84
- db 0, 8, 0, $85
- db 8, 0, 2, $86
- db 8, 8, 2, $87
-; 40e0
-
-FacingStepUp3: ; walking up 2
- db 4 ; #
- db 0, 8, X_FLIP, $84
- db 0, 0, X_FLIP, $85
- db 8, 8, 2 | X_FLIP, $86
- db 8, 0, 2 | X_FLIP, $87
-; 40f1
-
-FacingStepLeft0:
-FacingStepLeft2: ; standing left
- db 4 ; #
- db 0, 0, 0, $08
- db 0, 8, 0, $09
- db 8, 0, 2, $0a
- db 8, 8, 2, $0b
-; 4102
-
-FacingStepRight0:
-FacingStepRight2: ; standing right
- db 4 ; #
- db 0, 8, X_FLIP, $08
- db 0, 0, X_FLIP, $09
- db 8, 8, 2 | X_FLIP, $0a
- db 8, 0, 2 | X_FLIP, $0b
-; 4113
-
-FacingStepLeft1:
-FacingStepLeft3: ; walking left
- db 4 ; #
- db 0, 0, 0, $88
- db 0, 8, 0, $89
- db 8, 0, 2, $8a
- db 8, 8, 2, $8b
-; 4124
-
-FacingStepRight1:
-FacingStepRight3: ; walking right
- db 4 ; #
- db 0, 8, X_FLIP, $88
- db 0, 0, X_FLIP, $89
- db 8, 8, 2 | X_FLIP, $8a
- db 8, 0, 2 | X_FLIP, $8b
-; 4135
-
-FacingFishDown: ; fishing down
- db 5 ; #
- db 0, 0, 0, $00
- db 0, 8, 0, $01
- db 8, 0, 2, $02
- db 8, 8, 2, $03
- db 16, 0, 4, $fc
-; 414a
-
-FacingFishUp: ; fishing up
- db 5 ; #
- db 0, 0, 0, $04
- db 0, 8, 0, $05
- db 8, 0, 2, $06
- db 8, 8, 2, $07
- db -8, 0, 4, $fc
-; 415f
-
-FacingFishLeft: ; fishing left
- db 5 ; #
- db 0, 0, 0, $08
- db 0, 8, 0, $09
- db 8, 0, 2, $0a
- db 8, 8, 2, $0b
- db 5, -8, 4 | X_FLIP, $fd
-; 4174
-
-FacingFishRight: ; fishing right
- db 5 ; #
- db 0, 8, X_FLIP, $08
- db 0, 0, X_FLIP, $09
- db 8, 8, 2 | X_FLIP, $0a
- db 8, 0, 2 | X_FLIP, $0b
- db 5, 16, 4, $fd
-; 4189
-
-FacingEmote: ; emote
- db 4 ; #
- db 0, 0, 4, $f8
- db 0, 8, 4, $f9
- db 8, 0, 4, $fa
- db 8, 8, 4, $fb
-; 419a
-
-FacingShadow: ; shadow
- db 2 ; #
- db 0, 0, 4, $fc
- db 0, 8, 4 | X_FLIP, $fc
-; 41a3
-
-FacingBigDollSymmetric: ; big snorlax or lapras doll
- db 16 ; #
- db 0, 0, 0, $00
- db 0, 8, 0, $01
- db 8, 0, 0, $02
- db 8, 8, 0, $03
- db 16, 0, 0, $04
- db 16, 8, 0, $05
- db 24, 0, 0, $06
- db 24, 8, 0, $07
- db 0, 24, X_FLIP, $00
- db 0, 16, X_FLIP, $01
- db 8, 24, X_FLIP, $02
- db 8, 16, X_FLIP, $03
- db 16, 24, X_FLIP, $04
- db 16, 16, X_FLIP, $05
- db 24, 24, X_FLIP, $06
- db 24, 16, X_FLIP, $07
-; 41e4
-
-FacingWeirdTree1: ; 41e4
- db 4 ; #
- db 0, 0, 0, $04
- db 0, 8, 0, $05
- db 8, 0, 0, $06
- db 8, 8, 0, $07
-; 41f5
-
-FacingWeirdTree3: ; 41f5
- db 4 ; #
- db 0, 8, X_FLIP, $04
- db 0, 0, X_FLIP, $05
- db 8, 8, X_FLIP, $06
- db 8, 0, X_FLIP, $07
-; 4206
-
-FacingBigDollAsymmetric: ; big doll other than snorlax or lapras
- db 14 ; #
- db 0, 0, 0, $00
- db 0, 8, 0, $01
- db 8, 0, 0, $04
- db 8, 8, 0, $05
- db 16, 8, 0, $07
- db 24, 8, 0, $0a
- db 0, 24, 0, $03
- db 0, 16, 0, $02
- db 8, 24, X_FLIP, $02
- db 8, 16, 0, $06
- db 16, 24, 0, $09
- db 16, 16, 0, $08
- db 24, 24, X_FLIP, $04
- db 24, 16, 0, $0b
-; 423f
-
-FacingBoulderDust1: ; boulder dust 1
- db 4 ; #
- db 0, 0, 4, $fe
- db 0, 8, 4, $fe
- db 8, 0, 4, $fe
- db 8, 8, 4, $fe
-; 4250
-
-FacingBoulderDust2: ; boulder dust 2
- db 4 ; #
- db 0, 0, 4, $ff
- db 0, 8, 4, $ff
- db 8, 0, 4, $ff
- db 8, 8, 4, $ff
-; 4261
-
-FacingGrass1: ; 4261
- db 2 ; #
- db 8, 0, 4, $fe
- db 8, 8, 4 | X_FLIP, $fe
-; 426a
-
-FacingGrass2: ; 426a
- db 2 ; #
- db 9, -1, 4, $fe
- db 9, 9, 4 | X_FLIP, $fe
-; 4273
diff --git a/engine/fish.asm b/engine/fish.asm
index 44fe57b25..c571bba56 100644
--- a/engine/fish.asm
+++ b/engine/fish.asm
@@ -81,7 +81,7 @@ endr
ld a, [TimeOfDay]
and 3
- cp NITE
+ cp NITE_F
jr c, .time_species
inc hl
inc hl
diff --git a/engine/fruit_trees.asm b/engine/fruit_trees.asm
index 6a40fb05c..595e41824 100644
--- a/engine/fruit_trees.asm
+++ b/engine/fruit_trees.asm
@@ -58,7 +58,7 @@ CheckFruitTree: ; 44055
; 4405f
PickedFruitTree: ; 4405f
- callba TrainerRankings_FruitPicked
+ farcall TrainerRankings_FruitPicked
ld b, 1
jp GetFruitTreeFlag
; 4406a
@@ -102,38 +102,9 @@ GetFruitTreeItem: ; 4408a
ret
; 44097
-FruitTreeItems: ; 44097
- db BERRY
- db BERRY
- db BERRY
- db BERRY
- db PSNCUREBERRY
- db PSNCUREBERRY
- db BITTER_BERRY
- db BITTER_BERRY
- db PRZCUREBERRY
- db PRZCUREBERRY
- db MYSTERYBERRY
- db MYSTERYBERRY
- db ICE_BERRY
- db ICE_BERRY
- db MINT_BERRY
- db BURNT_BERRY
- db RED_APRICORN
- db BLU_APRICORN
- db BLK_APRICORN
- db WHT_APRICORN
- db PNK_APRICORN
- db GRN_APRICORN
- db YLW_APRICORN
- db BERRY
- db PSNCUREBERRY
- db BITTER_BERRY
- db PRZCUREBERRY
- db ICE_BERRY
- db MINT_BERRY
- db BURNT_BERRY
-; 440b5
+
+INCLUDE "data/items/fruit_trees.asm"
+
FruitBearingTreeText: ; 440b5
text_jump _FruitBearingTreeText
diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm
new file mode 100644
index 000000000..a77a44d72
--- /dev/null
+++ b/engine/gbc_only.asm
@@ -0,0 +1,149 @@
+GBCOnlyScreen: ; 4ea82
+
+ ld a, [hCGB]
+ and a
+ ret nz
+
+ ld de, MUSIC_NONE
+ call PlayMusic
+
+ call ClearTileMap
+
+ ld hl, GBCOnlyGFX
+ ld de, $d000
+ ld a, [rSVBK]
+ push af
+ ld a, 0
+ ld [rSVBK], a
+ call Decompress
+ pop af
+ ld [rSVBK], a
+
+ ld de, $d000
+ ld hl, VTiles2
+ lb bc, BANK(GBCOnlyGFX), $54
+ call Get2bpp
+
+ ld de, Font
+ ld hl, VTiles1
+ lb bc, BANK(Font), $80
+ call Get1bpp
+
+ call DrawGBCOnlyScreen
+
+ call WaitBGMap
+
+; better luck next time
+.loop
+ call DelayFrame
+ jr .loop
+; 4eac5
+
+
+DrawGBCOnlyScreen: ; 4eac5
+
+ call DrawGBCOnlyBorder
+
+ ; Pokemon
+ hlcoord 3, 2
+ ld b, 14
+ ld c, 4
+ ld a, $8
+ call DrawGBCOnlyGraphic
+
+ ; Crystal
+ hlcoord 5, 6
+ ld b, 10
+ ld c, 2
+ ld a, $40
+ call DrawGBCOnlyGraphic
+
+ ld de, GBCOnlyString
+ hlcoord 1, 10
+ call PlaceString
+
+ ret
+; 4eaea
+
+
+DrawGBCOnlyBorder: ; 4eaea
+
+ hlcoord 0, 0
+ ld [hl], 0 ; top-left
+
+ inc hl
+ ld a, 1 ; top
+ call .FillRow
+
+ ld [hl], 2 ; top-right
+
+ hlcoord 0, 1
+ ld a, 3 ; left
+ call .FillColumn
+
+ hlcoord 19, 1
+ ld a, 4 ; right
+ call .FillColumn
+
+ hlcoord 0, 17
+ ld [hl], 5 ; bottom-left
+
+ inc hl
+ ld a, 6 ; bottom
+ call .FillRow
+
+ ld [hl], 7 ; bottom-right
+ ret
+; 4eb15
+
+.FillRow: ; 4eb15
+ ld c, SCREEN_WIDTH - 2
+.next_column
+ ld [hli], a
+ dec c
+ jr nz, .next_column
+ ret
+; 4eb1c
+
+.FillColumn: ; 4eb1c
+ ld de, SCREEN_WIDTH
+ ld c, SCREEN_HEIGHT - 2
+.next_row
+ ld [hl], a
+ add hl, de
+ dec c
+ jr nz, .next_row
+ ret
+; 4eb27
+
+
+DrawGBCOnlyGraphic: ; 4eb27
+ ld de, SCREEN_WIDTH
+.y
+ push bc
+ push hl
+.x
+ ld [hli], a
+ inc a
+ dec b
+ jr nz, .x
+ pop hl
+ add hl, de
+ pop bc
+ dec c
+ jr nz, .y
+ ret
+; 4eb38
+
+
+GBCOnlyString: ; 4eb38
+ db "This Game Pak is"
+ next "designed only for"
+ next "use on the"
+ next "Game Boy Color.@"
+; 4eb76
+
+
+GBCOnlyGFX: ; 4eb76
+INCBIN "gfx/sgb/gbc_only.2bpp.lz"
+; 4f0bc
diff --git a/engine/healmachineanim.asm b/engine/healmachineanim.asm
deleted file mode 100755
index 5162b3830..000000000
--- a/engine/healmachineanim.asm
+++ /dev/null
@@ -1,265 +0,0 @@
-HealMachineAnim: ; 12324
- ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon.
- ld a, [PartyCount]
- and a
- ret z
- ; The location of the healing machine relative to the player is stored in ScriptVar.
- ; 0: Up and left (Pokemon Center)
- ; 1: Left (Elm's Lab)
- ; 2: Up (Hall of Fame)
- ld a, [ScriptVar]
- ld [Buffer1], a
- ld a, [rOBP1]
- ld [Buffer2], a
- call .DoJumptableFunctions
- ld a, [Buffer2]
- call DmgToCgbObjPal1
- ret
-; 1233e
-
-.DoJumptableFunctions: ; 1233e
- xor a
- ld [Buffer3], a
-.jumpable_loop
- ld a, [Buffer1]
- ld e, a
- ld d, 0
- ld hl, .Pointers
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld a, [Buffer3]
- ld e, a
- inc a
- ld [Buffer3], a
- add hl, de
- ld a, [hl]
- cp 5
- jr z, .finish
- ld hl, .Jumptable
- rst JumpTable
- jr .jumpable_loop
-
-.finish
- ret
-; 12365
-
-.Pointers: ; 12365
- dw .Pokecenter
- dw .ElmLab
- dw .HallOfFame
-; 1236b
-
-.Pokecenter: ; 1236b
- db 0, 1, 3, 5
-.ElmLab: ; 1236f
- db 0, 1, 3, 5
-.HallOfFame: ; 12373
- db 0, 2, 4, 5
-; 12377
-
-.Jumptable: ; 12377
- dw .LoadGFX
- dw .PC_LoadBallsOntoMachine
- dw .HOF_LoadBallsOntoMachine
- dw .PlayHealMusic
- dw .HOF_PlaySFX
- dw .dummy_5 ; never encountered
-; 12383
-
-.LoadGFX: ; 12383
- call .LoadPalettes
- ld de, .HealMachineGFX
- ld hl, VTiles0 tile $7c
- lb bc, BANK(.HealMachineGFX), $2
- call Request2bpp
- ret
-; 12393
-
-.PC_LoadBallsOntoMachine: ; 12393
- ld hl, Sprites + $80
- ld de, .PC_ElmsLab_OAM
- call .PlaceHealingMachineTile
- call .PlaceHealingMachineTile
- jr .LoadBallsOntoMachine
-
-.HOF_LoadBallsOntoMachine: ; 123a1
- ld hl, Sprites + $80
- ld de, .HOF_OAM
-
-.LoadBallsOntoMachine: ; 123a7
- ld a, [PartyCount]
- ld b, a
-.party_loop
- call .PlaceHealingMachineTile
- push de
- ld de, SFX_SECOND_PART_OF_ITEMFINDER
- call PlaySFX
- pop de
- ld c, 30
- call DelayFrames
- dec b
- jr nz, .party_loop
- ret
-; 123bf
-
-.PlayHealMusic: ; 123bf
- ld de, MUSIC_HEAL
- call PlayMusic
- jp .FlashPalettes8Times
-; 123c8
-
-.HOF_PlaySFX: ; 123c8
- ld de, SFX_GAME_FREAK_LOGO_GS
- call PlaySFX
- call .FlashPalettes8Times
- call WaitSFX
- ld de, SFX_BOOT_PC
- call PlaySFX
- ret
-; 123db
-
-.dummy_5 ; 123db
- ret
-; 123dc
-
-.PC_ElmsLab_OAM: ; 123dc
- dsprite 4, 0, 4, 2, $7c, $16
- dsprite 4, 0, 4, 6, $7c, $16
- dsprite 4, 6, 4, 0, $7d, $16
- dsprite 4, 6, 5, 0, $7d, $36 ; xflip
- dsprite 5, 3, 4, 0, $7d, $16
- dsprite 5, 3, 5, 0, $7d, $36 ; xflip
- dsprite 6, 0, 4, 0, $7d, $16
- dsprite 6, 0, 5, 0, $7d, $36 ; xflip
-; 123fc
-
-.HealMachineGFX: ; 123fc
-INCBIN "gfx/unknown/0123fc.2bpp"
-; 1241c
-
-.HOF_OAM: ; 1241c
- dsprite 7, 4, 10, 1, $7d, $16
- dsprite 7, 4, 10, 6, $7d, $16
- dsprite 7, 3, 9, 5, $7d, $16
- dsprite 7, 3, 11, 2, $7d, $16
- dsprite 7, 1, 9, 1, $7d, $16
- dsprite 7, 1, 11, 5, $7d, $16
-; 12434
-
-.LoadPalettes: ; 12434
- call IsCGB
- jr nz, .cgb
- ld a, %11100000
- ld [rOBP1], a
- ret
-
-.cgb
- ld hl, .palettes
- ld de, OBPals + 8 * 6
- ld bc, 8
- ld a, $5
- call FarCopyWRAM
- ld a, $1
- ld [hCGBPalUpdate], a
- ret
-; 12451
-
-.palettes ; 12451
- RGB 31, 31, 31
- RGB 31, 19, 10
- RGB 31, 07, 01
- RGB 00, 00, 00
-; 12459
-
-.FlashPalettes8Times: ; 12459
- ld c, $8
-.palette_loop
- push bc
- call .FlashPalettes
- ld c, 10
- call DelayFrames
- pop bc
- dec c
- jr nz, .palette_loop
- ret
-; 12469
-
-.FlashPalettes: ; 12469
- call IsCGB
- jr nz, .go
- ld a, [rOBP1]
- xor %00101000
- ld [rOBP1], a
- ret
-
-.go
- ld a, [rSVBK]
- push af
- ld a, $5
- ld [rSVBK], a
-
- ld hl, OBPals + 8 * 6
- ld a, [hli]
- ld e, a
- ld a, [hli]
- ld d, a
- push de
- ld c, $3
-.palette_loop_2
- ld a, [hli]
- ld e, a
- ld a, [hld]
- ld d, a
- dec hl
- ld a, d
- ld [hld], a
- ld a, e
- ld [hli], a
- inc hl
- inc hl
- inc hl
- dec c
- jr nz, .palette_loop_2
- pop de
- dec hl
- ld a, d
- ld [hld], a
- ld a, e
- ld [hl], a
-
- pop af
- ld [rSVBK], a
- ld a, $1
- ld [hCGBPalUpdate], a
- ret
-; 124a3
-
-.PlaceHealingMachineTile: ; 124a3
- push bc
- ld a, [Buffer1]
- bcpixel 2, 4
- cp $1 ; ElmsLab
- jr z, .okay
- bcpixel 0, 0
-
-.okay
- ld a, [de]
- add c
- inc de
- ld [hli], a
- ld a, [de]
- add b
- inc de
- ld [hli], a
- ld a, [de]
- inc de
- ld [hli], a
- ld a, [de]
- inc de
- ld [hli], a
- pop bc
- ret
-; 124c1
diff --git a/engine/health.asm b/engine/health.asm
index 1c926f677..0f7ba156d 100755
--- a/engine/health.asm
+++ b/engine/health.asm
@@ -49,7 +49,7 @@ HealPartyMon: ; c677
ld a, [hl]
ld [bc], a
- callba RestoreAllPP
+ farcall RestoreAllPP
ret
ComputeHPBarPixels: ; c699
diff --git a/engine/init_gender.asm b/engine/init_gender.asm
index ff5babdf9..092a1c9ea 100755
--- a/engine/init_gender.asm
+++ b/engine/init_gender.asm
@@ -20,7 +20,7 @@ InitCrystalData: ; 48000
ret
; 4802f
-INCLUDE "misc/mobile_12.asm"
+INCLUDE "mobile/mobile_12.asm"
InitGender: ; 48dcb (12:4dcb)
call InitGenderScreen
@@ -68,9 +68,9 @@ InitGenderScreen: ; 48e14 (12:4e14)
ld a, $10
ld [MusicFade], a
ld a, MUSIC_NONE
- ld [MusicFadeIDLo], a
+ ld [MusicFadeID], a
ld a, $0
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
ld c, 8
call DelayFrames
call ClearBGPalettes
@@ -92,7 +92,7 @@ LoadGenderScreenPal: ; 48e47 (12:4e47)
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
- callba ApplyPals
+ farcall ApplyPals
ret
; 48e5c (12:4e5c)
diff --git a/engine/init_hof_credits.asm b/engine/init_hof_credits.asm
new file mode 100644
index 000000000..0f55a10ab
--- /dev/null
+++ b/engine/init_hof_credits.asm
@@ -0,0 +1,79 @@
+InitDisplayForHallOfFame: ; 4e881
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ call DisableLCD
+ call LoadStandardFont
+ call LoadFontsBattleExtra
+ hlbgcoord 0, 0
+ ld bc, VBGMap1 - VBGMap0
+ ld a, " "
+ call ByteFill
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ xor a
+ call ByteFill
+ xor a
+ ld [hSCY], a
+ ld [hSCX], a
+ call EnableLCD
+ ld hl, .SavingRecordDontTurnOff
+ call PrintText
+ call WaitBGMap2
+ call SetPalettes
+ ret
+
+.SavingRecordDontTurnOff: ; 0x4e8bd
+ ; SAVING RECORD… DON'T TURN OFF!
+ text_jump UnknownText_0x1bd39e
+ db "@"
+
+InitDisplayForRedCredits: ; 4e8c2
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ call DisableLCD
+ call LoadStandardFont
+ call LoadFontsBattleExtra
+ hlbgcoord 0, 0
+ ld bc, VBGMap1 - VBGMap0
+ ld a, " "
+ call ByteFill
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ xor a
+ call ByteFill
+ ld hl, UnknBGPals
+ ld c, 4 tiles
+.load_white_palettes
+ ld a, (palred 31 + palgreen 31 + palblue 31) % $100
+ ld [hli], a
+ ld a, (palred 31 + palgreen 31 + palblue 31) / $100
+ ld [hli], a
+ dec c
+ jr nz, .load_white_palettes
+ xor a
+ ld [hSCY], a
+ ld [hSCX], a
+ call EnableLCD
+ call WaitBGMap2
+ call SetPalettes
+ ret
+
+ResetDisplayBetweenHallOfFameMons: ; 4e906
+ ld a, [rSVBK]
+ push af
+ ld a, $6
+ ld [rSVBK], a
+ ld hl, wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
+ ld a, " "
+ call ByteFill
+ hlbgcoord 0, 0
+ ld de, wDecompressScratch
+ ld b, 0
+ ld c, 4 tiles
+ call Request2bpp
+ pop af
+ ld [rSVBK], a
+ ret
diff --git a/engine/init_map.asm b/engine/init_map.asm
new file mode 100644
index 000000000..d73a5acf5
--- /dev/null
+++ b/engine/init_map.asm
@@ -0,0 +1,103 @@
+ReanchorBGMap_NoOAMUpdate:: ; 6454
+ call DelayFrame
+ ld a, [hOAMUpdate]
+ push af
+
+ ld a, $1
+ ld [hOAMUpdate], a
+ ld a, [hBGMapMode]
+ push af
+ xor a
+ ld [hBGMapMode], a
+
+ call .ReanchorBGMap
+
+ pop af
+ ld [hBGMapMode], a
+ pop af
+ ld [hOAMUpdate], a
+ ld hl, VramState
+ set 6, [hl]
+ ret
+
+.ReanchorBGMap:
+ xor a
+ ld [hLCDCPointer], a
+ ld [hBGMapMode], a
+ ld a, $90
+ ld [hWY], a
+ call OverworldTextModeSwitch
+ ld a, VBGMap1 / $100
+ call .LoadBGMapAddrIntoHRAM
+ call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
+ farcall LoadOW_BGPal7
+ farcall ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ xor a
+ ld [hBGMapMode], a
+ ld [hWY], a
+ farcall HDMATransfer_FillBGMap0WithBlack ; no need to farcall
+ ld a, VBGMap0 / $100
+ call .LoadBGMapAddrIntoHRAM
+ xor a
+ ld [wBGMapAnchor], a
+ ld a, VBGMap0 / $100
+ ld [wBGMapAnchor + 1], a
+ xor a
+ ld [hSCX], a
+ ld [hSCY], a
+ call ApplyBGMapAnchorToObjects
+ ret
+
+.LoadBGMapAddrIntoHRAM: ; 64b9
+ ld [hBGMapAddress + 1], a
+ xor a
+ ld [hBGMapAddress], a
+ ret
+
+LoadFonts_NoOAMUpdate:: ; 64bf
+ ld a, [hOAMUpdate]
+ push af
+ ld a, $1
+ ld [hOAMUpdate], a
+
+ call .LoadGFX
+
+ pop af
+ ld [hOAMUpdate], a
+ ret
+
+.LoadGFX:
+ call LoadFontsExtra
+ ld a, $90
+ ld [hWY], a
+ call SafeUpdateSprites
+ call LoadStandardFont
+ ret
+
+HDMATransfer_FillBGMap0WithBlack: ; 64db
+ ld a, [rSVBK]
+ push af
+ ld a, $6
+ ld [rSVBK], a
+
+ ld a, "<BLACK>" ; $60
+ ld hl, wDecompressScratch
+ ld bc, wScratchAttrMap - wDecompressScratch
+ call ByteFill
+ ld a, wDecompressScratch / $100
+ ld [rHDMA1], a
+ ld a, wDecompressScratch % $100
+ ld [rHDMA2], a
+ ld a, (VBGMap0 % $8000) / $100
+ ld [rHDMA3], a
+ ld a, (VBGMap0 % $8000) % $100
+ ld [rHDMA4], a
+ ld a, $3f
+ ld [hDMATransfer], a
+ call DelayFrame
+
+ pop af
+ ld [rSVBK], a
+ ret
diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm
index 8e3c90204..c73535459 100755
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -6,7 +6,7 @@ _MainMenu: ; 5ae8
ld a, e
ld [wMapMusic], a
call PlayMusic
- callba MainMenu
+ farcall MainMenu
jp StartTitleScreen
; 5b04
@@ -56,13 +56,13 @@ NewGame_ClearTileMapEtc: ; 5b44
MysteryGift: ; 5b54
call UpdateTime
- callba DoMysteryGiftIfDayHasPassed
- callba DoMysteryGift
+ farcall DoMysteryGiftIfDayHasPassed
+ farcall DoMysteryGift
ret
; 5b64
OptionsMenu: ; 5b64
- callba _OptionsMenu
+ farcall _OptionsMenu
ret
; 5b6b
@@ -86,14 +86,14 @@ NewGame: ; 5b6b
; 5b8f
AreYouABoyOrAreYouAGirl: ; 5b8f
- callba Mobile_AlwaysReturnNotCarry ; some mobile stuff
+ farcall Mobile_AlwaysReturnNotCarry ; some mobile stuff
jr c, .ok
- callba InitGender
+ farcall InitGender
ret
.ok
ld c, 0
- callba InitMobileProfile ; mobile
+ farcall InitMobileProfile ; mobile
ret
; 5ba7
@@ -111,8 +111,8 @@ _ResetWRAM: ; 5bae
xor a
call ByteFill
- ld hl, wd000
- ld bc, wGameData - wd000
+ ld hl, wRAM1Start
+ ld bc, wGameData - wRAM1Start
xor a
call ByteFill
@@ -199,8 +199,6 @@ _ResetWRAM: ; 5bae
ld [Coins], a
ld [Coins + 1], a
-START_MONEY EQU 3000
-
IF START_MONEY / $10000
ld a, START_MONEY / $10000
ENDC
@@ -214,19 +212,19 @@ ENDC
ld [wWhichMomItem], a
ld hl, MomItemTriggerBalance
- ld [hl], 2300 / $10000
+ ld [hl], MOM_MONEY / $10000
inc hl
- ld [hl], 2300 / $100 % $100
+ ld [hl], MOM_MONEY / $100 % $100
inc hl
- ld [hl], 2300 % $100
+ ld [hl], MOM_MONEY % $100
call InitializeNPCNames
- callba InitDecorations
+ farcall InitDecorations
- callba DeletePartyMonMail
+ farcall DeletePartyMonMail
- callba DeleteMobileEventIndex
+ farcall DeleteMobileEventIndex
call ResetGameTime
ret
@@ -318,8 +316,8 @@ InitializeNPCNames: ; 5ce9
InitializeWorld: ; 5d23
call ShrinkPlayer
- callba SpawnPlayer
- callba _InitializeStartDay
+ farcall SpawnPlayer
+ farcall _InitializeStartDay
ret
; 5d33
@@ -351,9 +349,9 @@ LoadOrRegenerateLuckyIDNumber: ; 5d33
; 5d65
Continue: ; 5d65
- callba TryLoadSaveFile
+ farcall TryLoadSaveFile
jr c, .FailToLoad
- callba _LoadData
+ farcall _LoadData
call LoadStandardMenuDataHeader
call DisplaySaveInfoOnContinue
ld a, $1
@@ -375,18 +373,18 @@ Continue: ; 5d65
ld a, $8
ld [MusicFade], a
ld a, MUSIC_NONE % $100
- ld [MusicFadeIDLo], a
+ ld [MusicFadeID], a
ld a, MUSIC_NONE / $100
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
call ClearBGPalettes
call Continue_MobileAdapterMenu
call CloseWindow
call ClearTileMap
ld c, 20
call DelayFrames
- callba JumpRoamMons
- callba MysteryGift_CopyReceivedDecosToPC ; Mystery Gift
- callba Function140ae ; time-related
+ farcall JumpRoamMons
+ farcall MysteryGift_CopyReceivedDecosToPC ; Mystery Gift
+ farcall Function140ae ; time-related
ld a, [wSpawnAfterChampion]
cp SPAWN_LANCE
jr z, .SpawnAfterE4
@@ -418,7 +416,7 @@ PostCreditsSpawn: ; 5de7
; 5df0
Continue_MobileAdapterMenu: ; 5df0
- callba Mobile_AlwaysReturnNotCarry ; mobile check
+ farcall Mobile_AlwaysReturnNotCarry ; mobile check
ret nc
; the rest of this stuff is never reached because
@@ -429,20 +427,20 @@ Continue_MobileAdapterMenu: ; 5df0
ld a, 5
ld [MusicFade], a
ld a, MUSIC_MOBILE_ADAPTER_MENU % $100
- ld [MusicFadeIDLo], a
+ ld [MusicFadeID], a
ld a, MUSIC_MOBILE_ADAPTER_MENU / $100
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
ld c, 20
call DelayFrames
ld c, $1
- callba InitMobileProfile ; mobile
- callba _SaveData
+ farcall InitMobileProfile ; mobile
+ farcall _SaveData
ld a, 8
ld [MusicFade], a
ld a, MUSIC_NONE % $100
- ld [MusicFadeIDLo], a
+ ld [MusicFadeID], a
ld a, MUSIC_NONE / $100
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
ld c, 35
call DelayFrames
ret
@@ -468,7 +466,7 @@ Continue_CheckRTC_RestartClock: ; 5e48
call CheckRTCStatus
and %10000000 ; Day count exceeded 16383
jr z, .pass
- callba RestartClock
+ farcall RestartClock
ld a, c
and a
jr z, .pass
@@ -490,7 +488,7 @@ FinishContinueFunction: ; 5e5d
res 7, [hl]
ld hl, wEnteredMapFromContinue
set 1, [hl]
- callba OverworldLoop
+ farcall OverworldLoop
ld a, [wSpawnAfterChampion]
cp SPAWN_RED
jr z, .AfterRed
@@ -673,7 +671,7 @@ Continue_DisplayGameTime: ; 5f84
OakSpeech: ; 0x5f99
- callba InitClock
+ farcall InitClock
call RotateFourPalettesLeft
call ClearTileMap
@@ -737,7 +735,7 @@ OakSpeech: ; 0x5f99
xor a
ld [CurPartySpecies], a
- callba DrawIntroPlayerPic
+ farcall DrawIntroPlayerPic
ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
@@ -784,20 +782,20 @@ OakText7: ; 0x606f
db "@"
NamePlayer: ; 0x6074
- callba MovePlayerPicRight
- callba ShowPlayerNamingChoices
+ farcall MovePlayerPicRight
+ farcall ShowPlayerNamingChoices
ld a, [wMenuCursorY]
dec a
jr z, .NewName
call StorePlayerName
- callba ApplyMonOrTrainerPals
- callba MovePlayerPicLeft
+ farcall ApplyMonOrTrainerPals
+ farcall MovePlayerPicLeft
ret
.NewName:
ld b, 1
ld de, PlayerName
- callba NamingScreen
+ farcall NamingScreen
call RotateThreePalettesRight
call ClearTileMap
@@ -807,7 +805,7 @@ NamePlayer: ; 0x6074
xor a
ld [CurPartySpecies], a
- callba DrawIntroPlayerPic
+ farcall DrawIntroPlayerPic
ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
@@ -859,9 +857,9 @@ ShrinkPlayer: ; 610f
ld [MusicFade], a
ld de, MUSIC_NONE
ld a, e
- ld [MusicFadeIDLo], a
+ ld [MusicFadeID], a
ld a, d
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
ld de, SFX_ESCAPE_ROPE
call PlaySFX
@@ -945,7 +943,7 @@ Intro_WipeInFrontpic: ; 6182
Intro_PrepTrainerPic: ; 619c
ld de, VTiles2
- callba GetTrainerPic
+ farcall GetTrainerPic
xor a
ld [hGraphicStartTile], a
hlcoord 6, 4
@@ -968,7 +966,7 @@ ShrinkFrame: ; 61b4
Intro_PlacePlayerSprite: ; 61cd
- callba GetPlayerIcon
+ farcall GetPlayerIcon
ld c, $c
ld hl, VTiles0
call Request2bpp
@@ -1014,9 +1012,9 @@ Intro_PlacePlayerSprite: ; 61cd
CrystalIntroSequence: ; 620b
- callab Copyright_GFPresents
+ callfar Copyright_GFPresents
jr c, StartTitleScreen
- callba CrystalIntro
+ farcall CrystalIntro
StartTitleScreen: ; 6219
ld a, [rSVBK]
@@ -1051,7 +1049,7 @@ StartTitleScreen: ; 6219
ld b, SCGB_DIPLOMA
call GetSGBLayout
call UpdateTimePals
- ld a, [wcf64]
+ ld a, [wIntroSceneFrameCounter]
cp $5
jr c, .ok
xor a
@@ -1077,7 +1075,7 @@ StartTitleScreen: ; 6219
.TitleScreen: ; 6274
- callba _TitleScreen
+ farcall _TitleScreen
ret
; 627b
@@ -1086,7 +1084,7 @@ RunTitleScreen: ; 627b
bit 7, a
jr nz, .done_title
call TitleScreenScene
- callba SuicuneFrameIterator
+ farcall SuicuneFrameIterator
call DelayFrame
and a
ret
@@ -1164,7 +1162,7 @@ TitleScreenEntrance: ; 62bc
dec b
jr nz, .loop
- callba AnimateTitleCrystal
+ farcall AnimateTitleCrystal
ret
.done
@@ -1191,7 +1189,7 @@ TitleScreenTimer: ; 62f6
inc [hl]
; Start a timer
- ld hl, wcf65
+ ld hl, wTitleScreenTimer
ld de, 73 * 60 + 36
ld [hl], e
inc hl
@@ -1202,7 +1200,7 @@ TitleScreenTimer: ; 62f6
TitleScreenMain: ; 6304
; Run the timer down.
- ld hl, wcf65
+ ld hl, wTitleScreenTimer
ld e, [hl]
inc hl
ld d, [hl]
@@ -1268,7 +1266,7 @@ TitleScreenMain: ; 6304
ld a, 1
.done
- ld [wcf64], a
+ ld [wIntroSceneFrameCounter], a
; Return to the intro sequence.
ld hl, wJumptableIndex
@@ -1282,18 +1280,18 @@ TitleScreenMain: ; 6304
; Fade out the title screen music
xor a
- ld [MusicFadeIDLo], a
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID], a
+ ld [MusicFadeID + 1], a
ld hl, MusicFade
ld [hl], 8 ; 1 second
- ld hl, wcf65
+ ld hl, wTitleScreenTimer
inc [hl]
ret
.clock_reset
ld a, 4
- ld [wcf64], a
+ ld [wIntroSceneFrameCounter], a
; Return to the intro sequence.
ld hl, wJumptableIndex
@@ -1305,7 +1303,7 @@ TitleScreenEnd: ; 6375
; Wait until the music is done fading.
- ld hl, wcf65
+ ld hl, wTitleScreenTimer
inc [hl]
ld a, [MusicFade]
@@ -1313,7 +1311,7 @@ TitleScreenEnd: ; 6375
ret nz
ld a, 2
- ld [wcf64], a
+ ld [wIntroSceneFrameCounter], a
; Back to the intro.
ld hl, wJumptableIndex
@@ -1322,18 +1320,18 @@ TitleScreenEnd: ; 6375
; 6389
DeleteSaveData: ; 6389
- callba _DeleteSaveData
+ farcall _DeleteSaveData
jp Init
; 6392
ResetClock: ; 6392
- callba _ResetClock
+ farcall _ResetClock
jp Init
; 639b
Function639b: ; unreferenced
- ; If bit 0 or 1 of [wcf65] is set, we don't need to be here.
- ld a, [wcf65]
+ ; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here.
+ ld a, [wTitleScreenTimer]
and $3
ret nz
ld bc, SpriteAnim10
@@ -1343,10 +1341,10 @@ Function639b: ; unreferenced
ld h, 0
add hl, hl
add hl, hl
- ld de, Data63ca
+ ld de, .Data63ca
add hl, de
- ; If bit 2 of [wcf65] is set, get the second dw; else, get the first dw
- ld a, [wcf65]
+ ; If bit 2 of [wTitleScreenTimer] is set, get the second dw; else, get the first dw
+ ld a, [wTitleScreenTimer]
and %00000100
srl a
srl a
@@ -1359,12 +1357,12 @@ Function639b: ; unreferenced
ret z
ld e, a
ld d, [hl]
- ld a, SPRITE_ANIM_INDEX_01
+ ld a, SPRITE_ANIM_INDEX_GS_TITLE_TRAIL
call _InitSpriteAnimStruct
ret
; 63ca
-Data63ca: ; 63ca
+.Data63ca: ; 63ca
; frame 0 y, x; frame 1 y, x
db 11 * 8 + 4, 10 * 8, 0 * 8, 0 * 8
db 11 * 8 + 4, 13 * 8, 11 * 8 + 4, 11 * 8
@@ -1403,7 +1401,7 @@ CopyrightString: ; 63fd
; 642e
GameInit:: ; 642e
- callba TryLoadSaveData
+ farcall TryLoadSaveData
call ClearWindowData
call ClearBGPalettes
call ClearTileMap
diff --git a/engine/item_effects.asm b/engine/item_effects.asm
new file mode 100644
index 000000000..4db1f3b7d
--- /dev/null
+++ b/engine/item_effects.asm
@@ -0,0 +1,3316 @@
+_DoItemEffect:: ; e722
+ ld a, [CurItem]
+ ld [wd265], a
+ call GetItemName
+ call CopyName1
+ ld a, 1
+ ld [wItemEffectSucceeded], a
+ ld a, [CurItem]
+ dec a
+ ld hl, ItemEffects
+ rst JumpTable
+ ret
+; e73c
+
+
+ItemEffects: ; e73c
+; entries correspond to item ids (see constants/item_constants.asm)
+ dw MasterBall
+ dw UltraBall
+ dw Brightpowder
+ dw GreatBall
+ dw PokeBall
+ dw TownMap
+ dw Bicycle
+ dw MoonStone
+ dw Antidote
+ dw BurnHeal
+ dw IceHeal
+ dw Awakening
+ dw ParlyzHeal
+ dw FullRestore
+ dw MaxPotion
+ dw HyperPotion
+ dw SuperPotion
+ dw Potion
+ dw EscapeRope
+ dw Repel
+ dw MaxElixer
+ dw FireStone
+ dw Thunderstone
+ dw WaterStone
+ dw Item19
+ dw HPUp
+ dw Protein
+ dw Iron
+ dw Carbos
+ dw LuckyPunch
+ dw Calcium
+ dw RareCandy
+ dw XAccuracy
+ dw LeafStone
+ dw MetalPowder
+ dw Nugget
+ dw PokeDoll
+ dw FullHeal
+ dw Revive
+ dw MaxRevive
+ dw GuardSpec
+ dw SuperRepel
+ dw MaxRepel
+ dw DireHit
+ dw Item2D
+ dw FreshWater
+ dw SodaPop
+ dw Lemonade
+ dw XAttack
+ dw Item32
+ dw XDefend
+ dw XSpeed
+ dw XSpecial
+ dw CoinCase
+ dw Itemfinder
+ dw PokeFlute
+ dw ExpShare
+ dw OldRod
+ dw GoodRod
+ dw SilverLeaf
+ dw SuperRod
+ dw PPUp
+ dw Ether
+ dw MaxEther
+ dw Elixer
+ dw RedScale
+ dw Secretpotion
+ dw SSTicket
+ dw MysteryEgg
+ dw ClearBell
+ dw SilverWing
+ dw MoomooMilk
+ dw QuickClaw
+ dw Psncureberry
+ dw GoldLeaf
+ dw SoftSand
+ dw SharpBeak
+ dw Przcureberry
+ dw BurntBerry
+ dw IceBerry
+ dw PoisonBarb
+ dw KingsRock
+ dw BitterBerry
+ dw MintBerry
+ dw RedApricorn
+ dw Tinymushroom
+ dw BigMushroom
+ dw Silverpowder
+ dw BluApricorn
+ dw Item5A
+ dw AmuletCoin
+ dw YlwApricorn
+ dw GrnApricorn
+ dw CleanseTag
+ dw MysticWater
+ dw Twistedspoon
+ dw WhtApricorn
+ dw Blackbelt
+ dw BlkApricorn
+ dw Item64
+ dw PnkApricorn
+ dw Blackglasses
+ dw Slowpoketail
+ dw PinkBow
+ dw Stick
+ dw SmokeBall
+ dw Nevermeltice
+ dw Magnet
+ dw Miracleberry
+ dw Pearl
+ dw BigPearl
+ dw Everstone
+ dw SpellTag
+ dw Ragecandybar
+ dw GsBall
+ dw BlueCard
+ dw MiracleSeed
+ dw ThickClub
+ dw FocusBand
+ dw Item78
+ dw Energypowder
+ dw EnergyRoot
+ dw HealPowder
+ dw RevivalHerb
+ dw HardStone
+ dw LuckyEgg
+ dw CardKey
+ dw MachinePart
+ dw EggTicket
+ dw LostItem
+ dw Stardust
+ dw StarPiece
+ dw BasementKey
+ dw Pass
+ dw Item87
+ dw Item88
+ dw Item89
+ dw Charcoal
+ dw BerryJuice
+ dw ScopeLens
+ dw Item8D
+ dw Item8E
+ dw MetalCoat
+ dw DragonFang
+ dw Item91
+ dw Leftovers
+ dw Item93
+ dw Item94
+ dw Item95
+ dw Mysteryberry
+ dw DragonScale
+ dw BerserkGene
+ dw Item99
+ dw Item9A
+ dw Item9B
+ dw SacredAsh
+ dw HeavyBall
+ dw FlowerMail
+ dw LevelBall
+ dw LureBall
+ dw FastBall
+ dw ItemA2
+ dw LightBall
+ dw FriendBall
+ dw MoonBall
+ dw LoveBall
+ dw NormalBox
+ dw GorgeousBox
+ dw SunStone
+ dw PolkadotBow
+ dw ItemAB
+ dw UpGrade
+ dw Berry
+ dw GoldBerry
+ dw Squirtbottle
+ dw ItemB0
+ dw ParkBall
+ dw RainbowWing
+ dw ItemB3
+; e8a2
+
+
+MasterBall:
+UltraBall:
+GreatBall:
+PokeBall:
+HeavyBall:
+LevelBall:
+LureBall:
+FastBall:
+FriendBall:
+MoonBall:
+LoveBall:
+ParkBall: ; e8a2
+ ld a, [wBattleMode]
+ dec a
+ jp nz, UseBallInTrainerBattle
+
+ ld a, [PartyCount]
+ cp PARTY_LENGTH
+ jr nz, .room_in_party
+
+ ld a, BANK(sBoxCount)
+ call GetSRAMBank
+ ld a, [sBoxCount]
+ cp MONS_PER_BOX
+ call CloseSRAM
+ jp z, Ball_BoxIsFullMessage
+
+.room_in_party
+ xor a
+ ld [wWildMon], a
+ ld a, [CurItem]
+ cp PARK_BALL
+ call nz, ReturnToBattle_UseBall
+
+ ld hl, Options
+ res NO_TEXT_SCROLL, [hl]
+ ld hl, UsedItemText
+ call PrintText
+
+ ld a, [EnemyMonCatchRate]
+ ld b, a
+ ld a, [BattleType]
+ cp BATTLETYPE_TUTORIAL
+ jp z, .catch_without_fail
+ ld a, [CurItem]
+ cp MASTER_BALL
+ jp z, .catch_without_fail
+ ld a, [CurItem]
+ ld c, a
+ ld hl, BallMultiplierFunctionTable
+
+.get_multiplier_loop
+ ld a, [hli]
+ cp $ff
+ jr z, .skip_or_return_from_ball_fn
+ cp c
+ jr z, .call_ball_function
+ inc hl
+ inc hl
+ jr .get_multiplier_loop
+
+.call_ball_function
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .skip_or_return_from_ball_fn
+ push de
+ jp hl
+
+.skip_or_return_from_ball_fn
+ ld a, [CurItem]
+ cp LEVEL_BALL
+ ld a, b
+ jp z, .skip_hp_calc
+
+ ld a, b
+ ld [hMultiplicand + 2], a
+
+ ld hl, EnemyMonHP
+ ld b, [hl]
+ inc hl
+ ld c, [hl]
+ inc hl
+ ld d, [hl]
+ inc hl
+ ld e, [hl]
+ sla c
+ rl b
+
+ ld h, d
+ ld l, e
+ add hl, de
+ add hl, de
+ ld d, h
+ ld e, l
+ ld a, d
+ and a
+ jr z, .okay_1
+
+ srl d
+ rr e
+ srl d
+ rr e
+ srl b
+ rr c
+ srl b
+ rr c
+
+ ld a, c
+ and a
+ jr nz, .okay_1
+ ld c, $1
+.okay_1
+ ld b, e
+
+ push bc
+ ld a, b
+ sub c
+ ld [hMultiplier], a
+ xor a
+ ld [hDividend + 0], a
+ ld [hMultiplicand + 0], a
+ ld [hMultiplicand + 1], a
+ call Multiply
+ pop bc
+
+ ld a, b
+ ld [hDivisor], a
+ ld b, $4
+ call Divide
+
+ ld a, [hQuotient + 2]
+ and a
+ jr nz, .statuscheck
+ ld a, 1
+.statuscheck
+; This routine is buggy. It was intended that SLP and FRZ provide a higher
+; catch rate than BRN/PSN/PAR, which in turn provide a higher catch rate than
+; no status effect at all. But instead, it makes BRN/PSN/PAR provide no
+; benefit.
+; Uncomment the line below to fix this.
+ ld b, a
+ ld a, [EnemyMonStatus]
+ and 1 << FRZ | SLP
+ ld c, 10
+ jr nz, .addstatus
+ ; ld a, [EnemyMonStatus]
+ and a
+ ld c, 5
+ jr nz, .addstatus
+ ld c, 0
+.addstatus
+ ld a, b
+ add c
+ jr nc, .max_1
+ ld a, $ff
+.max_1
+
+ ld d, a
+ push de
+
+ ; BUG: farcall overwrites a,
+ ; and GetItemHeldEffect takes b anyway.
+
+ ; This is probably the reason
+ ; the HELD_CATCH_CHANCE effect
+ ; is never used.
+
+ ; Uncomment the line below to fix.
+
+ ld a, [BattleMonItem]
+; ld b, a
+ farcall GetItemHeldEffect
+ ld a, b
+ cp HELD_CATCH_CHANCE
+
+ pop de
+ ld a, d
+
+ jr nz, .skip_hp_calc
+ add c
+ jr nc, .skip_hp_calc
+ ld a, $ff
+.skip_hp_calc
+
+ ld b, a
+ ld [Buffer1], a
+ call Random
+
+ cp b
+ ld a, 0
+ jr z, .catch_without_fail
+ jr nc, .fail_to_catch
+
+.catch_without_fail
+ ld a, [EnemyMonSpecies]
+
+.fail_to_catch
+ ld [wWildMon], a
+ ld c, 20
+ call DelayFrames
+
+ ld a, [CurItem]
+ cp POKE_BALL + 1 ; Assumes Master/Ultra/Great come before
+ jr c, .not_kurt_ball
+ ld a, POKE_BALL
+.not_kurt_ball
+ ld [wBattleAnimParam], a
+
+ ld de, ANIM_THROW_POKE_BALL
+ ld a, e
+ ld [FXAnimID], a
+ ld a, d
+ ld [FXAnimID + 1], a
+ xor a
+ ld [hBattleTurn], a
+ ld [Buffer2], a
+ ld [wNumHits], a
+ predef PlayBattleAnim
+
+ ld a, [wWildMon]
+ and a
+ jr nz, .caught
+ ld a, [Buffer2]
+ cp $1
+ ld hl, Text_NoShake
+ jp z, .shake_and_break_free
+ cp $2
+ ld hl, Text_OneShake
+ jp z, .shake_and_break_free
+ cp $3
+ ld hl, Text_TwoShakes
+ jp z, .shake_and_break_free
+ cp $4
+ ld hl, Text_ThreeShakes
+ jp z, .shake_and_break_free
+.caught
+
+ ld hl, EnemyMonStatus
+ ld a, [hli]
+ push af
+ inc hl
+ ld a, [hli]
+ push af
+ ld a, [hl]
+ push af
+ push hl
+ ld hl, EnemyMonItem
+ ld a, [hl]
+ push af
+ push hl
+ ld hl, EnemySubStatus5
+ ld a, [hl]
+ push af
+ set SUBSTATUS_TRANSFORMED, [hl]
+
+; This code is buggy. Any wild Pokémon that has Transformed will be
+; caught as a Ditto, even if it was something else like Mew.
+; To fix, do not set [TempEnemyMonSpecies] to DITTO.
+ bit SUBSTATUS_TRANSFORMED, a
+ jr nz, .ditto
+ jr .not_ditto
+
+.ditto
+ ld a, DITTO
+ ld [TempEnemyMonSpecies], a
+ jr .load_data
+
+.not_ditto
+ set SUBSTATUS_TRANSFORMED, [hl]
+ ld hl, wEnemyBackupDVs
+ ld a, [EnemyMonDVs]
+ ld [hli], a
+ ld a, [EnemyMonDVs + 1]
+ ld [hl], a
+
+.load_data
+ ld a, [TempEnemyMonSpecies]
+ ld [CurPartySpecies], a
+ ld a, [EnemyMonLevel]
+ ld [CurPartyLevel], a
+ farcall LoadEnemyMon
+
+ pop af
+ ld [EnemySubStatus5], a
+
+ pop hl
+ pop af
+ ld [hl], a
+ pop hl
+ pop af
+ ld [hld], a
+ pop af
+ ld [hld], a
+ dec hl
+ pop af
+ ld [hl], a
+
+ ld hl, EnemySubStatus5
+ bit SUBSTATUS_TRANSFORMED, [hl]
+ jr nz, .Transformed
+ ld hl, wWildMonMoves
+ ld de, EnemyMonMoves
+ ld bc, NUM_MOVES
+ call CopyBytes
+
+ ld hl, wWildMonPP
+ ld de, EnemyMonPP
+ ld bc, NUM_MOVES
+ call CopyBytes
+.Transformed:
+
+ ld a, [EnemyMonSpecies]
+ ld [wWildMon], a
+ ld [CurPartySpecies], a
+ ld [wd265], a
+ ld a, [BattleType]
+ cp BATTLETYPE_TUTORIAL
+ jp z, .FinishTutorial
+
+ farcall TrainerRankings_WildMonsCaught
+
+ ld hl, Text_GotchaMonWasCaught
+ call PrintText
+
+ call ClearSprites
+
+ ld a, [wd265]
+ dec a
+ call CheckCaughtMon
+
+ ld a, c
+ push af
+ ld a, [wd265]
+ dec a
+ call SetSeenAndCaughtMon
+ pop af
+ and a
+ jr nz, .skip_pokedex
+
+ call CheckReceivedDex
+ jr z, .skip_pokedex
+
+ ld hl, Text_AddedToPokedex
+ call PrintText
+
+ call ClearSprites
+
+ ld a, [EnemyMonSpecies]
+ ld [wd265], a
+ predef NewPokedexEntry
+
+.skip_pokedex
+ ld a, [BattleType]
+ cp BATTLETYPE_CONTEST
+ jp z, .catch_bug_contest_mon
+ cp BATTLETYPE_CELEBI
+ jr nz, .not_celebi
+ ld hl, wBattleResult
+ set 6, [hl]
+.not_celebi
+
+ ld a, [PartyCount]
+ cp PARTY_LENGTH
+ jr z, .SendToPC
+
+ xor a ; PARTYMON
+ ld [MonType], a
+ call ClearSprites
+
+ predef TryAddMonToParty
+
+ farcall SetCaughtData
+
+ ld a, [CurItem]
+ cp FRIEND_BALL
+ jr nz, .SkipPartyMonFriendBall
+
+ ld a, [PartyCount]
+ dec a
+ ld hl, PartyMon1Happiness
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+
+ ld a, FRIEND_BALL_HAPPINESS
+ ld [hl], a
+.SkipPartyMonFriendBall:
+
+ ld hl, Text_AskNicknameNewlyCaughtMon
+ call PrintText
+
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+ call GetPokemonName
+
+ call YesNoBox
+ jp c, .return_from_capture
+
+ ld a, [PartyCount]
+ dec a
+ ld [CurPartyMon], a
+ ld hl, PartyMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ call AddNTimes
+
+ ld d, h
+ ld e, l
+ push de
+ xor a ; PARTYMON
+ ld [MonType], a
+ ld b, 0
+ farcall NamingScreen
+
+ call RotateThreePalettesRight
+
+ call LoadStandardFont
+
+ pop hl
+ ld de, StringBuffer1
+ call InitName
+
+ jp .return_from_capture
+
+.SendToPC:
+ call ClearSprites
+
+ predef SentPkmnIntoBox
+
+ farcall SetBoxMonCaughtData
+
+ ld a, BANK(sBoxCount)
+ call GetSRAMBank
+
+ ld a, [sBoxCount]
+ cp MONS_PER_BOX
+ jr nz, .BoxNotFullYet
+ ld hl, wBattleResult
+ set 7, [hl]
+.BoxNotFullYet:
+ ld a, [CurItem]
+ cp FRIEND_BALL
+ jr nz, .SkipBoxMonFriendBall
+ ; The captured mon is now first in the box
+ ld a, FRIEND_BALL_HAPPINESS
+ ld [sBoxMon1Happiness], a
+.SkipBoxMonFriendBall:
+ call CloseSRAM
+
+ ld hl, Text_AskNicknameNewlyCaughtMon
+ call PrintText
+
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+ call GetPokemonName
+
+ call YesNoBox
+ jr c, .SkipBoxMonNickname
+
+ xor a
+ ld [CurPartyMon], a
+ ld a, BOXMON
+ ld [MonType], a
+ ld de, wMonOrItemNameBuffer
+ ld b, $0
+ farcall NamingScreen
+
+ ld a, BANK(sBoxMonNicknames)
+ call GetSRAMBank
+
+ ld hl, wMonOrItemNameBuffer
+ ld de, sBoxMonNicknames
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+
+ ld hl, sBoxMonNicknames
+ ld de, StringBuffer1
+ call InitName
+
+ call CloseSRAM
+
+.SkipBoxMonNickname:
+ ld a, BANK(sBoxMonNicknames)
+ call GetSRAMBank
+
+ ld hl, sBoxMonNicknames
+ ld de, wMonOrItemNameBuffer
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+
+ call CloseSRAM
+
+ ld hl, Text_SentToBillsPC
+ call PrintText
+
+ call RotateThreePalettesRight
+ call LoadStandardFont
+ jr .return_from_capture
+
+.catch_bug_contest_mon
+ farcall BugContest_SetCaughtContestMon
+ jr .return_from_capture
+
+.FinishTutorial:
+ ld hl, Text_GotchaMonWasCaught
+
+.shake_and_break_free
+ call PrintText
+ call ClearSprites
+
+.return_from_capture
+ ld a, [BattleType]
+ cp BATTLETYPE_TUTORIAL
+ ret z
+ cp BATTLETYPE_DEBUG
+ ret z
+ cp BATTLETYPE_CONTEST
+ jr z, .used_park_ball
+
+ ld a, [wWildMon]
+ and a
+ jr z, .toss
+
+ call ClearBGPalettes
+ call ClearTileMap
+
+.toss
+ ld hl, NumItems
+ inc a
+ ld [wItemQuantityChangeBuffer], a
+ jp TossItem
+
+.used_park_ball
+ ld hl, wParkBallsRemaining
+ dec [hl]
+ ret
+; ec0a
+
+
+BallMultiplierFunctionTable:
+; table of routines that increase or decrease the catch rate based on
+; which ball is used in a certain situation.
+ dbw ULTRA_BALL, UltraBallMultiplier
+ dbw GREAT_BALL, GreatBallMultiplier
+ dbw SAFARI_BALL, SafariBallMultiplier ; Safari Ball, leftover from RBY
+ dbw HEAVY_BALL, HeavyBallMultiplier
+ dbw LEVEL_BALL, LevelBallMultiplier
+ dbw LURE_BALL, LureBallMultiplier
+ dbw FAST_BALL, FastBallMultiplier
+ dbw MOON_BALL, MoonBallMultiplier
+ dbw LOVE_BALL, LoveBallMultiplier
+ dbw PARK_BALL, ParkBallMultiplier
+ db $ff
+
+UltraBallMultiplier:
+; multiply catch rate by 2
+ sla b
+ ret nc
+ ld b, $ff
+ ret
+
+SafariBallMultiplier:
+GreatBallMultiplier:
+ParkBallMultiplier:
+; multiply catch rate by 1.5
+ ld a, b
+ srl a
+ add b
+ ld b, a
+ ret nc
+ ld b, $ff
+ ret
+
+GetPokedexEntryBank:
+ push hl
+ push de
+ ld a, [EnemyMonSpecies]
+ rlca
+ rlca
+ and 3
+ ld hl, .PokedexEntryBanks
+ ld d, 0
+ ld e, a
+ add hl, de
+ ld a, [hl]
+ pop de
+ pop hl
+ ret
+
+.PokedexEntryBanks:
+
+GLOBAL PokedexEntries1
+GLOBAL PokedexEntries2
+GLOBAL PokedexEntries3
+GLOBAL PokedexEntries4
+
+ db BANK(PokedexEntries1)
+ db BANK(PokedexEntries2)
+ db BANK(PokedexEntries3)
+ db BANK(PokedexEntries4)
+
+HeavyBallMultiplier:
+; subtract 20 from catch rate if weight < 102.4 kg
+; else add 0 to catch rate if weight < 204.8 kg
+; else add 20 to catch rate if weight < 307.2 kg
+; else add 30 to catch rate if weight < 409.6 kg
+; else add 40 to catch rate (never happens)
+ ld a, [EnemyMonSpecies]
+ ld hl, PokedexDataPointerTable
+ dec a
+ ld e, a
+ ld d, 0
+ add hl, de
+ add hl, de
+ ld a, BANK(PokedexDataPointerTable)
+ call GetFarHalfword
+
+.SkipText:
+ call GetPokedexEntryBank
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .SkipText
+
+ call GetPokedexEntryBank
+ push bc
+ inc hl
+ inc hl
+ call GetFarHalfword
+
+ srl h
+ rr l
+ ld b, h
+ ld c, l
+
+ rept 4
+ srl b
+ rr c
+ endr
+ call .subbc
+
+ srl b
+ rr c
+ call .subbc
+
+ ld a, h
+ pop bc
+ jr .compare
+
+.subbc
+ ; subtract bc from hl
+ push bc
+ ld a, b
+ cpl
+ ld b, a
+ ld a, c
+ cpl
+ ld c, a
+ inc bc
+ add hl, bc
+ pop bc
+ ret
+
+.compare
+ ld c, a
+ cp 1024 >> 8 ; 102.4 kg
+ jr c, .lightmon
+
+ ld hl, .WeightsTable
+.lookup
+ ld a, c
+ cp [hl]
+ jr c, .heavymon
+ inc hl
+ inc hl
+ jr .lookup
+
+.heavymon
+ inc hl
+ ld a, b
+ add [hl]
+ ld b, a
+ ret nc
+ ld b, $ff
+ ret
+
+.lightmon
+ ld a, b
+ sub 20
+ ld b, a
+ ret nc
+ ld b, $1
+ ret
+
+.WeightsTable:
+; weight factor, boost
+ db 2048 >> 8, 0
+ db 3072 >> 8, 20
+ db 4096 >> 8, 30
+ db 65280 >> 8, 40
+
+LureBallMultiplier:
+; multiply catch rate by 3 if this is a fishing rod battle
+ ld a, [BattleType]
+ cp BATTLETYPE_FISH
+ ret nz
+
+ ld a, b
+ add a
+ jr c, .max
+
+ add b
+ jr nc, .done
+.max
+ ld a, $ff
+.done
+ ld b, a
+ ret
+
+MoonBallMultiplier:
+; This function is buggy.
+; Intent: multiply catch rate by 4 if mon evolves with moon stone
+; Reality: no boost
+
+GLOBAL EvosAttacks
+GLOBAL EvosAttacksPointers
+
+ push bc
+ ld a, [TempEnemyMonSpecies]
+ dec a
+ ld c, a
+ ld b, 0
+ ld hl, EvosAttacksPointers
+ add hl, bc
+ add hl, bc
+ ld a, BANK(EvosAttacksPointers)
+ call GetFarHalfword
+ pop bc
+
+ push bc
+ ld a, BANK(EvosAttacks)
+ call GetFarByte
+ cp EVOLVE_ITEM
+ pop bc
+ ret nz
+
+ inc hl
+ inc hl
+ inc hl
+
+; Moon Stone's constant from Pokémon Red is used.
+; No Pokémon evolve with Burn Heal,
+; so Moon Balls always have a catch rate of 1×.
+ push bc
+ ld a, BANK(EvosAttacks)
+ call GetFarByte
+ cp MOON_STONE_RED ; BURN_HEAL
+ pop bc
+ ret nz
+
+ sla b
+ jr c, .max
+ sla b
+ jr nc, .done
+.max
+ ld b, $ff
+.done
+ ret
+
+LoveBallMultiplier:
+; This function is buggy.
+; Intent: multiply catch rate by 8 if mons are of same species, different sex
+; Reality: multiply catch rate by 8 if mons are of same species, same sex
+
+ ; does species match?
+ ld a, [TempEnemyMonSpecies]
+ ld c, a
+ ld a, [TempBattleMonSpecies]
+ cp c
+ ret nz
+
+ ; check player mon species
+ push bc
+ ld a, [TempBattleMonSpecies]
+ ld [CurPartySpecies], a
+ xor a ; PARTYMON
+ ld [MonType], a
+ ld a, [CurBattleMon]
+ ld [CurPartyMon], a
+ farcall GetGender
+ jr c, .done1 ; no effect on genderless
+
+ ld d, 0 ; male
+ jr nz, .playermale
+ inc d ; female
+.playermale
+
+ ; check wild mon species
+ push de
+ ld a, [TempEnemyMonSpecies]
+ ld [CurPartySpecies], a
+ ld a, WILDMON
+ ld [MonType], a
+ farcall GetGender
+ jr c, .done2 ; no effect on genderless
+
+ ld d, 0 ; male
+ jr nz, .wildmale
+ inc d ; female
+.wildmale
+
+ ld a, d
+ pop de
+ cp d
+ pop bc
+ ret nz ; for the intended effect, this should be "ret z"
+
+ sla b
+ jr c, .max
+ sla b
+ jr c, .max
+ sla b
+ ret nc
+.max
+ ld b, $ff
+ ret
+
+.done2
+ pop de
+
+.done1
+ pop bc
+ ret
+
+FastBallMultiplier:
+; This function is buggy.
+; Intent: multiply catch rate by 4 if enemy mon is in one of the three
+; FleeMons tables.
+; Reality: multiply catch rate by 4 if enemy mon is one of the first three in
+; the first FleeMons table.
+ ld a, [TempEnemyMonSpecies]
+ ld c, a
+ ld hl, FleeMons
+ ld d, 3
+
+.loop
+ ld a, BANK(FleeMons)
+ call GetFarByte
+
+ inc hl
+ cp -1
+ jr z, .next
+ cp c
+ jr nz, .next ; for the intended effect, this should be "jr nz, .loop"
+ sla b
+ jr c, .max
+
+ sla b
+ ret nc
+
+.max
+ ld b, $ff
+ ret
+
+.next
+ dec d
+ jr nz, .loop
+ ret
+
+LevelBallMultiplier:
+; multiply catch rate by 8 if player mon level / 4 > enemy mon level
+; multiply catch rate by 4 if player mon level / 2 > enemy mon level
+; multiply catch rate by 2 if player mon level > enemy mon level
+ ld a, [BattleMonLevel]
+ ld c, a
+ ld a, [EnemyMonLevel]
+ cp c
+ ret nc ; if player is lower level, we're done here
+ sla b
+ jr c, .max
+
+ srl c
+ cp c
+ ret nc ; if player/2 is lower level, we're done here
+ sla b
+ jr c, .max
+
+ srl c
+ cp c
+ ret nc ; if player/4 is lower level, we're done here
+ sla b
+ ret nc
+
+.max
+ ld b, $ff
+ ret
+
+; These two texts were carried over from gen 1.
+; They are not used in gen 2, and are dummied out.
+
+Text_RBY_CatchMarowak: ; 0xedab
+ ; It dodged the thrown BALL! This #MON can't be caught!
+ text_jump UnknownText_0x1c5a5a
+ db "@"
+; 0xedb0
+
+Text_RBY_NoShake: ; 0xedb0
+ ; You missed the #MON!
+ text_jump UnknownText_0x1c5a90
+ db "@"
+; 0xedb5
+
+Text_NoShake: ; 0xedb5
+ ; Oh no! The #MON broke free!
+ text_jump UnknownText_0x1c5aa6
+ db "@"
+; 0xedba
+
+Text_OneShake: ; 0xedba
+ ; Aww! It appeared to be caught!
+ text_jump UnknownText_0x1c5ac3
+ db "@"
+; 0xedbf
+
+Text_TwoShakes: ; 0xedbf
+ ; Aargh! Almost had it!
+ text_jump UnknownText_0x1c5ae3
+ db "@"
+; 0xedc4
+
+Text_ThreeShakes: ; 0xedc4
+ ; Shoot! It was so close too!
+ text_jump UnknownText_0x1c5afa
+ db "@"
+; 0xedc9
+
+Text_GotchaMonWasCaught: ; 0xedc9
+ ; Gotcha! @ was caught!@ @
+ text_jump UnknownText_0x1c5b17
+ start_asm
+ call WaitSFX
+ push bc
+ ld de, MUSIC_NONE
+ call PlayMusic
+ call DelayFrame
+ ld de, MUSIC_CAPTURE
+ call PlayMusic
+ pop bc
+ ld hl, TextJump_Waitbutton
+ ret
+; ede6
+
+TextJump_Waitbutton: ; 0xede6
+ ; @
+ text_jump Text_Waitbutton_2
+ db "@"
+; 0xedeb
+
+Text_SentToBillsPC: ; 0xedeb
+ ; was sent to BILL's PC.
+ text_jump UnknownText_0x1c5b38
+ db "@"
+; 0xedf0
+
+Text_AddedToPokedex: ; 0xedf0
+ ; 's data was newly added to the #DEX.@ @
+ text_jump UnknownText_0x1c5b53
+ db "@"
+; 0xedf5
+
+Text_AskNicknameNewlyCaughtMon: ; 0xedf5
+ ; Give a nickname to @ ?
+ text_jump UnknownText_0x1c5b7f
+ db "@"
+; 0xedfa
+
+ReturnToBattle_UseBall: ; edfa (3:6dfa)
+ farcall _ReturnToBattle_UseBall
+ ret
+
+TownMap: ; ee01
+ farcall PokegearMap
+ ret
+; ee08
+
+
+Bicycle: ; ee08
+ farcall BikeFunction
+ ret
+; ee0f
+
+
+MoonStone:
+FireStone:
+Thunderstone:
+WaterStone:
+LeafStone:
+SunStone: ; ee0f
+ ld b, PARTYMENUACTION_EVO_STONE
+ call UseItem_SelectMon
+
+ jp c, .DecidedNotToUse
+
+ ld a, MON_ITEM
+ call GetPartyParamLocation
+
+ ld a, [hl]
+ cp EVERSTONE
+ jr z, .NoEffect
+
+ ld a, $1
+ ld [wForceEvolution], a
+ farcall EvolvePokemon
+
+ ld a, [wMonTriedToEvolve]
+ and a
+ jr z, .NoEffect
+
+ jp UseDisposableItem
+
+.NoEffect:
+ call WontHaveAnyEffectMessage
+
+.DecidedNotToUse:
+ xor a
+ ld [wItemEffectSucceeded], a
+ ret
+; ee3d
+
+
+HPUp:
+Protein:
+Iron:
+Carbos:
+Calcium: ; ee3d
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+
+ jp c, RareCandy_StatBooster_ExitMenu
+
+ call RareCandy_StatBooster_GetParameters
+
+ call GetStatExpRelativePointer
+
+ ld a, MON_STAT_EXP
+ call GetPartyParamLocation
+
+ add hl, bc
+ ld a, [hl]
+ cp 100
+ jr nc, NoEffectMessage
+
+ add 10
+ ld [hl], a
+ call UpdateStatsAfterItem
+
+ call GetStatExpRelativePointer
+
+ ld hl, StatStrings
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, StringBuffer2
+ ld bc, ITEM_NAME_LENGTH
+ call CopyBytes
+
+ call Play_SFX_FULL_HEAL
+
+ ld hl, Text_StatRose
+ call PrintText
+
+ ld c, HAPPINESS_USEDITEM
+ farcall ChangeHappiness
+
+ jp UseDisposableItem
+
+
+NoEffectMessage: ; ee83
+ ld hl, WontHaveAnyEffectText
+ call PrintText
+ jp ClearPalettes
+; ee8c
+
+
+UpdateStatsAfterItem: ; ee8c
+ ld a, MON_MAXHP
+ call GetPartyParamLocation
+ ld d, h
+ ld e, l
+ ld a, MON_STAT_EXP - 1
+ call GetPartyParamLocation
+ ld b, $1
+ predef_jump CalcPkmnStats
+; ee9f
+
+RareCandy_StatBooster_ExitMenu: ; ee9f
+ xor a
+ ld [wItemEffectSucceeded], a
+ jp ClearPalettes
+; eea6
+
+
+Text_StatRose: ; 0xeea6
+ ; 's @ rose.
+ text_jump UnknownText_0x1c5b9a
+ db "@"
+; 0xeeab
+
+
+StatStrings: ; eeab
+ dw .health
+ dw .attack
+ dw .defense
+ dw .speed
+ dw .special
+
+.health db "HEALTH@"
+.attack db "ATTACK@"
+.defense db "DEFENSE@"
+.speed db "SPEED@"
+.special db "SPECIAL@"
+; eed9
+
+
+GetStatExpRelativePointer: ; eed9
+ ld a, [CurItem]
+ ld hl, Table_eeeb
+.next
+ cp [hl]
+ inc hl
+ jr z, .got_it
+ inc hl
+ jr .next
+
+.got_it
+ ld a, [hl]
+ ld c, a
+ ld b, 0
+ ret
+; eeeb
+
+Table_eeeb: ; eeeb
+ db HP_UP, MON_HP_EXP - MON_STAT_EXP
+ db PROTEIN, MON_ATK_EXP - MON_STAT_EXP
+ db IRON, MON_DEF_EXP - MON_STAT_EXP
+ db CARBOS, MON_SPD_EXP - MON_STAT_EXP
+ db CALCIUM, MON_SPC_EXP - MON_STAT_EXP
+; eef5
+
+
+RareCandy_StatBooster_GetParameters: ; eef5
+ ld a, [CurPartySpecies]
+ ld [CurSpecies], a
+ ld [wd265], a
+ ld a, MON_LEVEL
+ call GetPartyParamLocation
+ ld a, [hl]
+ ld [CurPartyLevel], a
+ call GetBaseData
+ ld a, [CurPartyMon]
+ ld hl, PartyMonNicknames
+ call GetNick
+ ret
+; 0xef14
+
+
+RareCandy: ; ef14
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+
+ jp c, RareCandy_StatBooster_ExitMenu
+
+ call RareCandy_StatBooster_GetParameters
+
+ ld a, MON_LEVEL
+ call GetPartyParamLocation
+
+ ld a, [hl]
+ cp MAX_LEVEL
+ jp nc, NoEffectMessage
+
+ inc a
+ ld [hl], a
+ ld [CurPartyLevel], a
+ push de
+ ld d, a
+ farcall CalcExpAtLevel
+
+ pop de
+ ld a, MON_EXP
+ call GetPartyParamLocation
+
+ ld a, [hMultiplicand]
+ ld [hli], a
+ ld a, [hMultiplicand + 1]
+ ld [hli], a
+ ld a, [hMultiplicand + 2]
+ ld [hl], a
+
+ ld a, MON_MAXHP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld b, a
+ ld c, [hl]
+ push bc
+ call UpdateStatsAfterItem
+
+ ld a, MON_MAXHP + 1
+ call GetPartyParamLocation
+
+ pop bc
+ ld a, [hld]
+ sub c
+ ld c, a
+ ld a, [hl]
+ sbc b
+ ld b, a
+ dec hl
+ ld a, [hl]
+ add c
+ ld [hld], a
+ ld a, [hl]
+ adc b
+ ld [hl], a
+ farcall LevelUpHappinessMod
+
+ ld a, PARTYMENUTEXT_LEVEL_UP
+ call ItemActionText
+
+ xor a ; PARTYMON
+ ld [MonType], a
+ predef CopyPkmnToTempMon
+
+ hlcoord 9, 0
+ ld b, 10
+ ld c, 9
+ call TextBox
+
+ hlcoord 11, 1
+ ld bc, $0004
+ predef PrintTempMonStats
+
+ call WaitPressAorB_BlinkCursor
+
+ xor a ; PARTYMON
+ ld [MonType], a
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+ predef LearnLevelMoves
+
+ xor a
+ ld [wForceEvolution], a
+ farcall EvolvePokemon
+
+ jp UseDisposableItem
+; efad
+
+
+HealPowder: ; efad
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+
+ jp c, StatusHealer_ExitMenu
+
+ call UseStatusHealer
+
+ cp $0
+ jr nz, .asm_efc9
+ ld c, HAPPINESS_BITTERPOWDER
+ farcall ChangeHappiness
+
+ call LooksBitterMessage
+
+ ld a, $0
+
+.asm_efc9
+ jp StatusHealer_Jumptable
+; efcc
+
+
+Antidote:
+BurnHeal:
+IceHeal:
+Awakening:
+ParlyzHeal:
+FullHeal:
+Psncureberry:
+Przcureberry:
+BurntBerry:
+IceBerry:
+MintBerry:
+Miracleberry: ; efcc
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+ jp c, StatusHealer_ExitMenu
+
+FullyHealStatus: ; efd4
+ call UseStatusHealer
+ jp StatusHealer_Jumptable
+; efda
+
+
+UseStatusHealer: ; efda (3:6fda)
+ call IsMonFainted
+ ld a, $1
+ ret z
+ call GetItemHealingAction
+ ld a, MON_STATUS
+ call GetPartyParamLocation
+ ld a, [hl]
+ and c
+ jr nz, .good
+ call IsItemUsedOnConfusedMon
+ ld a, $1
+ ret nc
+ ld b, PARTYMENUTEXT_HEAL_CONFUSION
+.good
+ xor a
+ ld [hl], a
+ ld a, b
+ ld [PartyMenuActionText], a
+ call HealStatus
+ call Play_SFX_FULL_HEAL
+ call ItemActionTextWaitButton
+ call UseDisposableItem
+ ld a, $0
+ ret
+
+IsItemUsedOnConfusedMon: ; f009 (3:7009)
+ call IsItemUsedOnBattleMon
+ jr nc, .nope
+ ld a, [PlayerSubStatus3]
+ bit SUBSTATUS_CONFUSED, a
+ jr z, .nope
+ ld a, c
+ cp $ff
+ jr nz, .nope
+ scf
+ ret
+
+.nope
+ and a
+ ret
+
+BattlemonRestoreHealth: ; f01e (3:701e)
+ call IsItemUsedOnBattleMon
+ ret nc
+ ld a, MON_HP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld [BattleMonHP], a
+ ld a, [hld]
+ ld [BattleMonHP + 1], a
+ ret
+
+HealStatus: ; f030 (3:7030)
+ call IsItemUsedOnBattleMon
+ ret nc
+ xor a
+ ld [BattleMonStatus], a
+ ld hl, PlayerSubStatus5
+ res SUBSTATUS_TOXIC, [hl]
+ ld hl, PlayerSubStatus1
+ res SUBSTATUS_NIGHTMARE, [hl]
+ call GetItemHealingAction
+ ld a, c
+ cp %11111111
+ jr nz, .not_full_heal
+ ld hl, PlayerSubStatus3
+ res SUBSTATUS_CONFUSED, [hl]
+.not_full_heal
+ push bc
+ farcall CalcPlayerStats
+ pop bc
+ ret
+
+GetItemHealingAction: ; f058 (3:7058)
+ push hl
+ ld a, [CurItem]
+ ld hl, .healingactions
+ ld bc, 3
+.next
+ cp [hl]
+ jr z, .found_it
+ add hl, bc
+ jr .next
+
+.found_it
+ inc hl
+ ld b, [hl]
+ inc hl
+ ld a, [hl]
+ ld c, a
+ cp %11111111
+ pop hl
+ ret
+; f071 (3:7071)
+
+.healingactions ; f071
+; item, party menu action text, status
+ db ANTIDOTE, PARTYMENUTEXT_HEAL_PSN, 1 << PSN
+ db BURN_HEAL, PARTYMENUTEXT_HEAL_BRN, 1 << BRN
+ db ICE_HEAL, PARTYMENUTEXT_HEAL_FRZ, 1 << FRZ
+ db AWAKENING, PARTYMENUTEXT_HEAL_SLP, SLP
+ db PARLYZ_HEAL, PARTYMENUTEXT_HEAL_PAR, 1 << PAR
+ db FULL_HEAL, PARTYMENUTEXT_HEAL_ALL, %11111111
+ db FULL_RESTORE, PARTYMENUTEXT_HEAL_ALL, %11111111
+ db HEAL_POWDER, PARTYMENUTEXT_HEAL_ALL, %11111111
+ db PSNCUREBERRY, PARTYMENUTEXT_HEAL_PSN, 1 << PSN
+ db PRZCUREBERRY, PARTYMENUTEXT_HEAL_PAR, 1 << PAR
+ db BURNT_BERRY, PARTYMENUTEXT_HEAL_FRZ, 1 << FRZ
+ db ICE_BERRY, PARTYMENUTEXT_HEAL_BRN, 1 << BRN
+ db MINT_BERRY, PARTYMENUTEXT_HEAL_SLP, SLP
+ db MIRACLEBERRY, PARTYMENUTEXT_HEAL_ALL, %11111111
+ db -1, 0, 0
+; f09e
+
+StatusHealer_Jumptable: ; f09e (3:709e)
+ ld hl, .dw
+ rst JumpTable
+ ret
+
+.dw ; f0a3 (3:70a3)
+ dw StatusHealer_ClearPalettes
+ dw StatusHealer_NoEffect
+ dw StatusHealer_ExitMenu
+
+
+RevivalHerb: ; f0a9
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+ jp c, StatusHealer_ExitMenu
+
+ call RevivePokemon
+ cp 0
+ jr nz, .asm_f0c5
+
+ ld c, HAPPINESS_REVIVALHERB
+ farcall ChangeHappiness
+ call LooksBitterMessage
+ ld a, 0
+
+.asm_f0c5
+ jp StatusHealer_Jumptable
+; f0c8
+
+
+Revive:
+MaxRevive: ; f0c8
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+ jp c, StatusHealer_ExitMenu
+
+ call RevivePokemon
+ jp StatusHealer_Jumptable
+; f0d6
+
+
+RevivePokemon: ; f0d6
+ call IsMonFainted
+ ld a, 1
+ ret nz
+ ld a, [wBattleMode]
+ and a
+ jr z, .skip_to_revive
+
+ ld a, [CurPartyMon]
+ ld c, a
+ ld d, 0
+ ld hl, wBattleParticipantsIncludingFainted
+ ld b, CHECK_FLAG
+ predef FlagPredef
+ ld a, c
+ and a
+ jr z, .skip_to_revive
+
+ ld a, [CurPartyMon]
+ ld c, a
+ ld hl, wBattleParticipantsNotFainted
+ ld b, SET_FLAG
+ predef FlagPredef
+
+.skip_to_revive
+ xor a
+ ld [Danger], a
+ ld a, [CurItem]
+ cp REVIVE
+ jr z, .revive_half_hp
+
+ call ReviveFullHP
+ jr .finish_revive
+
+.revive_half_hp
+ call ReviveHalfHP
+
+.finish_revive
+ call HealHP_SFX_GFX
+ ld a, PARTYMENUTEXT_REVIVE
+ ld [PartyMenuActionText], a
+ call ItemActionTextWaitButton
+ call UseDisposableItem
+ ld a, 0
+ ret
+; f128
+
+
+FullRestore: ; f128
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+ jp c, StatusHealer_ExitMenu
+
+ call IsMonFainted
+ jp z, StatusHealer_NoEffect
+
+ call IsMonAtFullHealth
+ jr c, .NotAtFullHealth
+
+ jp FullyHealStatus
+
+.NotAtFullHealth:
+ call .FullRestore
+ jp StatusHealer_Jumptable
+; f144
+
+
+.FullRestore: ; f144
+ xor a
+ ld [Danger], a
+ call ReviveFullHP
+ ld a, MON_STATUS
+ call GetPartyParamLocation
+ xor a
+ ld [hli], a
+ ld [hl], a
+ call HealStatus
+ call BattlemonRestoreHealth
+ call HealHP_SFX_GFX
+ ld a, PARTYMENUTEXT_HEAL_HP
+ ld [PartyMenuActionText], a
+ call ItemActionTextWaitButton
+ call UseDisposableItem
+ ld a, 0
+ ret
+; f16a
+
+
+BitterBerry: ; f16a
+ ld hl, PlayerSubStatus3
+ bit SUBSTATUS_CONFUSED, [hl]
+ ld a, 1
+ jr z, .done
+
+ res SUBSTATUS_CONFUSED, [hl]
+ xor a
+ ld [hBattleTurn], a
+ call UseItemText
+
+ ld hl, ConfusedNoMoreText
+ call StdBattleTextBox
+
+ ld a, 0
+
+.done
+ jp StatusHealer_Jumptable
+; f186
+
+
+MaxPotion:
+HyperPotion:
+SuperPotion:
+Potion:
+FreshWater:
+SodaPop:
+Lemonade:
+MoomooMilk:
+Ragecandybar:
+BerryJuice:
+Berry:
+GoldBerry: ; f186
+ call ItemRestoreHP
+ jp StatusHealer_Jumptable
+; f18c
+
+
+Energypowder: ; f18c
+ ld c, HAPPINESS_BITTERPOWDER
+ jr EnergypowderEnergyRootCommon
+; f190
+
+EnergyRoot: ; f190
+ ld c, HAPPINESS_ENERGYROOT
+; f192
+
+EnergypowderEnergyRootCommon: ; f192
+ push bc
+ call ItemRestoreHP
+ pop bc
+ cp 0
+ jr nz, .skip_happiness
+
+ farcall ChangeHappiness
+ call LooksBitterMessage
+ ld a, 0
+
+.skip_happiness
+ jp StatusHealer_Jumptable
+; f1a9
+
+
+ItemRestoreHP: ; f1a9 (3:71a9)
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+ ld a, 2
+ ret c
+
+ call IsMonFainted
+ ld a, 1
+ ret z
+
+ call IsMonAtFullHealth
+ ld a, 1
+ ret nc
+
+ xor a
+ ld [Danger], a
+ call GetHealingItemAmount
+ call RestoreHealth
+ call BattlemonRestoreHealth
+ call HealHP_SFX_GFX
+ ld a, PARTYMENUTEXT_HEAL_HP
+ ld [PartyMenuActionText], a
+ call ItemActionTextWaitButton
+ call UseDisposableItem
+ ld a, 0
+ ret
+
+HealHP_SFX_GFX: ; f1db (3:71db)
+ push de
+ ld de, SFX_POTION
+ call WaitPlaySFX
+ pop de
+ ld a, [CurPartyMon]
+ hlcoord 11, 0
+ ld bc, SCREEN_WIDTH * 2
+ call AddNTimes
+ ld a, $2
+ ld [wWhichHPBar], a
+ predef_jump AnimateHPBar
+
+UseItem_SelectMon: ; f1f9 (3:71f9)
+ call .SelectMon
+ ret c
+
+ ld a, [CurPartySpecies]
+ cp EGG
+ jr nz, .not_egg
+
+ call CantUseOnEggMessage
+ scf
+ ret
+
+.not_egg
+ and a
+ ret
+
+.SelectMon: ; f20b (3:720b)
+ ld a, b
+ ld [PartyMenuActionText], a
+ push hl
+ push de
+ push bc
+ call ClearBGPalettes
+ call ChoosePkmnToUseItemOn
+ pop bc
+ pop de
+ pop hl
+ ret
+
+ChoosePkmnToUseItemOn: ; f21c (3:721c)
+ farcall LoadPartyMenuGFX
+ farcall InitPartyMenuWithCancel
+ farcall InitPartyMenuGFX
+ farcall WritePartyMenuTilemap
+ farcall PrintPartyMenuText
+ call WaitBGMap
+ call SetPalettes
+ call DelayFrame
+ farcall PartyMenuSelect
+ ret
+
+ItemActionText: ; f24a (3:724a)
+ ld [PartyMenuActionText], a
+ ld a, [CurPartySpecies]
+ push af
+ ld a, [CurPartyMon]
+ push af
+ push hl
+ push de
+ push bc
+ farcall WritePartyMenuTilemap
+ farcall PrintPartyMenuActionText
+ call WaitBGMap
+ call SetPalettes
+ call DelayFrame
+ pop bc
+ pop de
+ pop hl
+ pop af
+ ld [CurPartyMon], a
+ pop af
+ ld [CurPartySpecies], a
+ ret
+
+ItemActionTextWaitButton: ; f279 (3:7279)
+ xor a
+ ld [hBGMapMode], a
+ hlcoord 0, 0
+ ld bc, TileMapEnd - TileMap
+ ld a, " "
+ call ByteFill
+ ld a, [PartyMenuActionText]
+ call ItemActionText
+ ld a, $1
+ ld [hBGMapMode], a
+ ld c, 50
+ call DelayFrames
+ jp WaitPressAorB_BlinkCursor
+
+StatusHealer_NoEffect: ; f299 (3:7299)
+ call WontHaveAnyEffectMessage
+ jr StatusHealer_ClearPalettes
+
+StatusHealer_ExitMenu: ; f29e (3:729e)
+ xor a
+ ld [wItemEffectSucceeded], a
+StatusHealer_ClearPalettes: ; f2a2 (3:72a2)
+ call ClearPalettes
+ ret
+
+IsItemUsedOnBattleMon: ; f2a6 (3:72a6)
+ ld a, [wBattleMode]
+ and a
+ ret z
+ ld a, [CurPartyMon]
+ push hl
+ ld hl, CurBattleMon
+ cp [hl]
+ pop hl
+ jr nz, .nope
+ scf
+ ret
+
+.nope
+ xor a
+ ret
+
+ReviveHalfHP: ; f2ba (3:72ba)
+ call LoadHPFromBuffer1
+ srl d
+ rr e
+ jr ContinueRevive
+
+ReviveFullHP: ; f2c3 (3:72c3)
+ call LoadHPFromBuffer1
+ContinueRevive: ; f2c6 (3:72c6)
+ ld a, MON_HP
+ call GetPartyParamLocation
+ ld [hl], d
+ inc hl
+ ld [hl], e
+ jp LoadCurHPIntoBuffer5
+
+RestoreHealth: ; f2d1 (3:72d1)
+ ld a, MON_HP + 1
+ call GetPartyParamLocation
+ ld a, [hl]
+ add e
+ ld [hld], a
+ ld a, [hl]
+ adc d
+ ld [hl], a
+ jr c, .full_hp
+ call LoadCurHPIntoBuffer5
+ ld a, MON_HP + 1
+ call GetPartyParamLocation
+ ld d, h
+ ld e, l
+ ld a, MON_MAXHP + 1
+ call GetPartyParamLocation
+ ld a, [de]
+ sub [hl]
+ dec de
+ dec hl
+ ld a, [de]
+ sbc [hl]
+ jr c, .finish
+.full_hp
+ call ReviveFullHP
+.finish
+ ret
+
+RemoveHP: ; f2f9 (3:72f9)
+ ld a, MON_HP + 1
+ call GetPartyParamLocation
+ ld a, [hl]
+ sub e
+ ld [hld], a
+ ld a, [hl]
+ sbc d
+ ld [hl], a
+ jr nc, .okay
+ xor a
+ ld [hld], a
+ ld [hl], a
+.okay
+ call LoadCurHPIntoBuffer5
+ ret
+
+IsMonFainted: ; f30d (3:730d)
+ push de
+ call LoadMaxHPToBuffer1
+ call LoadCurHPToBuffer3
+ call LoadHPFromBuffer3
+ ld a, d
+ or e
+ pop de
+ ret
+
+IsMonAtFullHealth: ; f31b (3:731b)
+ call LoadHPFromBuffer3
+ ld h, d
+ ld l, e
+ call LoadHPFromBuffer1
+ ld a, l
+ sub e
+ ld a, h
+ sbc d
+ ret
+
+LoadCurHPIntoBuffer5: ; f328 (3:7328)
+ ld a, MON_HP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld [Buffer6], a
+ ld a, [hl]
+ ld [Buffer5], a
+ ret
+; f336 (3:7336)
+
+LoadHPIntoBuffer5: ; f336
+ ld a, d
+ ld [Buffer6], a
+ ld a, e
+ ld [Buffer5], a
+ ret
+; f33f
+
+LoadHPFromBuffer5: ; f33f
+ ld a, [Buffer6]
+ ld d, a
+ ld a, [Buffer5]
+ ld e, a
+ ret
+; f348
+
+LoadCurHPToBuffer3: ; f348 (3:7348)
+ ld a, MON_HP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld [Buffer4], a
+ ld a, [hl]
+ ld [Buffer3], a
+ ret
+
+LoadHPFromBuffer3: ; f356 (3:7356)
+ ld a, [Buffer4]
+ ld d, a
+ ld a, [Buffer3]
+ ld e, a
+ ret
+
+LoadMaxHPToBuffer1: ; f35f (3:735f)
+ push hl
+ ld a, MON_MAXHP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld [Buffer2], a
+ ld a, [hl]
+ ld [Buffer1], a
+ pop hl
+ ret
+
+LoadHPFromBuffer1: ; f36f (3:736f)
+ ld a, [Buffer2]
+ ld d, a
+ ld a, [Buffer1]
+ ld e, a
+ ret
+
+GetOneFifthMaxHP: ; f378 (3:7378)
+ push bc
+ ld a, MON_MAXHP
+ call GetPartyParamLocation
+ ld a, [hli]
+ ld [hDividend + 0], a
+ ld a, [hl]
+ ld [hDividend + 1], a
+ ld a, 5
+ ld [hDivisor], a
+ ld b, 2
+ call Divide
+ ld a, [hQuotient + 1]
+ ld d, a
+ ld a, [hQuotient + 2]
+ ld e, a
+ pop bc
+ ret
+
+GetHealingItemAmount: ; f395 (3:7395)
+ push hl
+ ld a, [CurItem]
+ ld hl, .Healing
+ ld d, a
+.next
+ ld a, [hli]
+ cp -1
+ jr z, .NotFound
+ cp d
+ jr z, .done
+ inc hl
+ inc hl
+ jr .next
+
+.NotFound:
+ scf
+.done
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ pop hl
+ ret
+; f3af (3:73af)
+
+.Healing: ; f3af
+ dbw FRESH_WATER, 50
+ dbw SODA_POP, 60
+ dbw LEMONADE, 80
+ dbw HYPER_POTION, 200
+ dbw SUPER_POTION, 50
+ dbw POTION, 20
+ dbw MAX_POTION, MAX_STAT_VALUE
+ dbw FULL_RESTORE, MAX_STAT_VALUE
+ dbw MOOMOO_MILK, 100
+ dbw BERRY, 10
+ dbw GOLD_BERRY, 30
+ dbw ENERGYPOWDER, 50
+ dbw ENERGY_ROOT, 200
+ dbw RAGECANDYBAR, 20
+ dbw BERRY_JUICE, 20
+ dbw -1, 0
+; f3df
+
+Softboiled_MilkDrinkFunction: ; f3df (3:73df)
+; Softboiled/Milk Drink in the field
+ ld a, [wPartyMenuCursor]
+ dec a
+ ld b, a
+ call .SelectMilkDrinkRecipient ; select pokemon
+ jr c, .skip
+ ld a, b
+ ld [CurPartyMon], a
+ call IsMonFainted
+ call GetOneFifthMaxHP
+ call RemoveHP
+ push bc
+ call HealHP_SFX_GFX
+ pop bc
+ call GetOneFifthMaxHP
+ ld a, c
+ ld [CurPartyMon], a
+ call IsMonFainted
+ call RestoreHealth
+ call HealHP_SFX_GFX
+ ld a, PARTYMENUTEXT_HEAL_HP
+ call ItemActionText
+ call JoyWaitAorB
+.skip
+ ld a, b
+ inc a
+ ld [wPartyMenuCursor], a
+ ret
+
+.SelectMilkDrinkRecipient: ; f419 (3:7419)
+.loop
+ push bc
+ ld a, PARTYMENUACTION_HEALING_ITEM
+ ld [PartyMenuActionText], a
+ call ChoosePkmnToUseItemOn
+ pop bc
+ jr c, .set_carry
+ ld a, [wPartyMenuCursor]
+ dec a
+ ld c, a
+ ld a, b
+ cp c
+ jr z, .cant_use ; chose the same mon as user
+ ld a, c
+ ld [CurPartyMon], a
+ call IsMonFainted
+ jr z, .cant_use
+ call IsMonAtFullHealth
+ jr nc, .cant_use
+ xor a
+ ret
+
+.set_carry
+ scf
+ ret
+
+.cant_use
+ push bc
+ ld hl, .Text_CantBeUsed
+ call MenuTextBoxBackup
+ pop bc
+ jr .loop
+; f44a (3:744a)
+
+.Text_CantBeUsed: ; 0xf44a
+ ; That can't be used on this #MON.
+ text_jump UnknownText_0x1c5bac
+ db "@"
+; 0xf44f
+
+
+EscapeRope: ; f44f
+ xor a
+ ld [wItemEffectSucceeded], a
+ farcall EscapeRopeFunction
+
+ ld a, [wItemEffectSucceeded]
+ cp 1
+ call z, UseDisposableItem
+ ret
+; f462
+
+
+SuperRepel: ; f462
+ ld b, 200
+ jr UseRepel
+; f466
+
+MaxRepel: ; f466
+ ld b, 250
+ jr UseRepel
+; f466
+
+Repel: ; f46a
+ ld b, 100
+; f46c
+
+UseRepel: ; f46c
+ ld a, [wRepelEffect]
+ and a
+ ld hl, TextJump_RepelUsedEarlierIsStillInEffect
+ jp nz, PrintText
+
+ ld a, b
+ ld [wRepelEffect], a
+ jp UseItemText
+
+
+TextJump_RepelUsedEarlierIsStillInEffect: ; 0xf47d
+ ; The REPEL used earlier is still in effect.
+ text_jump Text_RepelUsedEarlierIsStillInEffect
+ db "@"
+; 0xf482
+
+
+XAccuracy: ; f482
+ ld hl, PlayerSubStatus4
+ bit SUBSTATUS_X_ACCURACY, [hl]
+ jp nz, WontHaveAnyEffect_NotUsedMessage
+ set SUBSTATUS_X_ACCURACY, [hl]
+ jp UseItemText
+; f48f
+
+
+PokeDoll: ; f48f
+ ld a, [wBattleMode]
+ dec a
+ jr nz, .asm_f4a6
+ inc a
+ ld [wForcedSwitch], a
+ ld a, [wBattleResult]
+ and 3 << 6
+ or $2
+ ld [wBattleResult], a
+ jp UseItemText
+
+.asm_f4a6
+ xor a
+ ld [wItemEffectSucceeded], a
+ ret
+; f4ab
+
+
+GuardSpec: ; f4ab
+ ld hl, PlayerSubStatus4
+ bit SUBSTATUS_MIST, [hl]
+ jp nz, WontHaveAnyEffect_NotUsedMessage
+ set SUBSTATUS_MIST, [hl]
+ jp UseItemText
+; f4b8
+
+
+DireHit: ; f4b8
+ ld hl, PlayerSubStatus4
+ bit SUBSTATUS_FOCUS_ENERGY, [hl]
+ jp nz, WontHaveAnyEffect_NotUsedMessage
+ set SUBSTATUS_FOCUS_ENERGY, [hl]
+ jp UseItemText
+; f4c5
+
+
+XAttack:
+XDefend:
+XSpeed:
+XSpecial: ; f4c5
+ call UseItemText
+
+ ld a, [CurItem]
+ ld hl, .x_item_table
+
+.loop
+ cp [hl]
+ jr z, .got_it
+ inc hl
+ inc hl
+ jr .loop
+
+.got_it
+ inc hl
+ ld b, [hl]
+ xor a
+ ld [hBattleTurn], a
+ ld [AttackMissed], a
+ ld [EffectFailed], a
+ farcall CheckIfStatCanBeRaised
+ call WaitSFX
+
+ farcall BattleCommand_StatUpMessage
+ farcall BattleCommand_StatUpFailText
+
+ ld a, [CurBattleMon]
+ ld [CurPartyMon], a
+ ld c, HAPPINESS_USEDXITEM
+ farcall ChangeHappiness
+ ret
+; f504
+
+.x_item_table ; f504
+ db X_ATTACK, ATTACK
+ db X_DEFEND, DEFENSE
+ db X_SPEED, SPEED
+ db X_SPECIAL, SP_ATTACK
+; f50c
+
+
+PokeFlute: ; f50c
+ ld a, [wBattleMode]
+ and a
+ jr nz, .dummy
+.dummy
+
+ xor a
+ ld [wd002], a
+
+ ld b, $ff ^ SLP
+
+ ld hl, PartyMon1Status
+ call .CureSleep
+
+ ld a, [wBattleMode]
+ cp WILD_BATTLE
+ jr z, .skip_otrainer
+ ld hl, OTPartyMon1Status
+ call .CureSleep
+.skip_otrainer
+
+ ld hl, BattleMonStatus
+ ld a, [hl]
+ and b
+ ld [hl], a
+ ld hl, EnemyMonStatus
+ ld a, [hl]
+ and b
+ ld [hl], a
+
+ ld a, [wd002]
+ and a
+ ld hl, .CatchyTune
+ jp z, PrintText
+ ld hl, .PlayedTheFlute
+ call PrintText
+
+ ld a, [Danger]
+ and 1 << DANGER_ON_F
+ jr nz, .dummy2
+.dummy2
+ ld hl, .AllSleepingMonWokeUp
+ jp PrintText
+
+
+.CureSleep:
+ ld de, PARTYMON_STRUCT_LENGTH
+ ld c, PARTY_LENGTH
+
+.loop
+ ld a, [hl]
+ push af
+ and SLP
+ jr z, .not_asleep
+ ld a, 1
+ ld [wd002], a
+.not_asleep
+ pop af
+ and b
+ ld [hl], a
+ add hl, de
+ dec c
+ jr nz, .loop
+ ret
+; f56c
+
+
+.CatchyTune: ; 0xf56c
+ ; Played the # FLUTE. Now, that's a catchy tune!
+ text_jump UnknownText_0x1c5bf9
+ db "@"
+; 0xf571
+
+.AllSleepingMonWokeUp: ; 0xf571
+ ; All sleeping #MON woke up.
+ text_jump UnknownText_0x1c5c28
+ db "@"
+; 0xf576
+
+.PlayedTheFlute: ; 0xf576
+ ; played the # FLUTE.@ @
+ text_jump UnknownText_0x1c5c44
+ start_asm
+ ld a, [wBattleMode]
+ and a
+ jr nz, .battle
+
+ push de
+ ld de, SFX_POKEFLUTE
+ call WaitPlaySFX
+ call WaitSFX
+ pop de
+
+.battle
+ jp PokeFluteTerminatorCharacter
+; f58f
+
+
+BlueCard: ; f58f
+ ld hl, .bluecardtext
+ jp MenuTextBoxWaitButton
+
+.bluecardtext
+ text_jump UnknownText_0x1c5c5e
+ db "@"
+; f59a
+
+
+CoinCase: ; f59a
+ ld hl, .coincasetext
+ jp MenuTextBoxWaitButton
+
+.coincasetext
+ text_jump UnknownText_0x1c5c7b
+ db "@"
+; f5a5
+
+
+OldRod: ; f5a5
+ ld e, $0
+ jr UseRod
+; f5a9
+
+GoodRod: ; f5a9
+ ld e, $1
+ jr UseRod
+; f5ad
+
+SuperRod: ; f5ad
+ ld e, $2
+ jr UseRod
+; f5b1
+
+UseRod: ; f5b1
+ farcall FishFunction
+ ret
+; f5b8
+
+
+Itemfinder: ; f5b8
+ farcall ItemFinder
+ ret
+; f5bf
+
+
+MaxElixer:
+PPUp:
+Ether:
+MaxEther:
+Elixer:
+Mysteryberry: ; f5bf
+ ld a, [CurItem]
+ ld [wd002], a
+
+.loop
+ ; Party Screen opens to choose on which Pkmn to use the Item
+ ld b, PARTYMENUACTION_HEALING_ITEM
+ call UseItem_SelectMon
+ jp c, PPRestoreItem_Cancel
+
+.loop2
+ ld a, [wd002]
+ cp MAX_ELIXER
+ jp z, Elixer_RestorePPofAllMoves
+ cp ELIXER
+ jp z, Elixer_RestorePPofAllMoves
+
+ ld hl, TextJump_RaiseThePPOfWhichMove
+ ld a, [wd002]
+ cp PP_UP
+ jr z, .ppup
+ ld hl, TextJump_RestoreThePPOfWhichMove
+
+.ppup
+ call PrintText
+
+ ld a, [CurMoveNum]
+ push af
+ xor a
+ ld [CurMoveNum], a
+ ld a, $2
+ ld [wMoveSelectionMenuType], a
+ farcall MoveSelectionScreen
+ pop bc
+
+ ld a, b
+ ld [CurMoveNum], a
+ jr nz, .loop
+ ld hl, PartyMon1Moves
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call GetMthMoveOfNthPartymon
+
+ push hl
+ ld a, [hl]
+ ld [wd265], a
+ call GetMoveName
+ call CopyName1
+ pop hl
+
+ ld a, [wd002]
+ cp PP_UP
+ jp nz, Not_PP_Up
+
+ ld a, [hl]
+ cp SKETCH
+ jr z, .CantUsePPUpOnSketch
+
+ ld bc, $0015
+ add hl, bc
+ ld a, [hl]
+ cp 3 << 6 ; have 3 PP Ups already been used?
+ jr c, .do_ppup
+
+.CantUsePPUpOnSketch:
+.pp_is_maxed_out
+ ld hl, TextJump_PPIsMaxedOut
+ call PrintText
+ jr .loop2
+
+.do_ppup
+ ld a, [hl]
+ add 1 << 6 ; increase PP Up count by 1
+ ld [hl], a
+ ld a, $1
+ ld [wd265], a
+ call ApplyPPUp
+ call Play_SFX_FULL_HEAL
+
+ ld hl, TextJump_PPsIncreased
+ call PrintText
+
+FinishPPRestore: ; f64c
+ call ClearPalettes
+ jp UseDisposableItem
+; f652
+
+BattleRestorePP: ; f652
+ ld a, [wBattleMode]
+ and a
+ jr z, .not_in_battle
+ ld a, [CurPartyMon]
+ ld b, a
+ ld a, [CurBattleMon]
+ cp b
+ jr nz, .not_in_battle
+ ld a, [PlayerSubStatus5]
+ bit SUBSTATUS_TRANSFORMED, a
+ jr nz, .not_in_battle
+ call .UpdateBattleMonPP
+
+.not_in_battle
+ call Play_SFX_FULL_HEAL
+ ld hl, UnknownText_0xf739
+ call PrintText
+ jr FinishPPRestore
+
+.UpdateBattleMonPP:
+ ld a, [CurPartyMon]
+ ld hl, PartyMon1Moves
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld de, BattleMonMoves
+ ld b, NUM_MOVES
+.loop
+ ld a, [de]
+ and a
+ jr z, .done
+ cp [hl]
+ jr nz, .next
+ push hl
+ push de
+ push bc
+ rept NUM_MOVES + 2 ; BattleMonPP - BattleMonMoves
+ inc de
+ endr
+ ld bc, MON_PP - MON_MOVES
+ add hl, bc
+ ld a, [hl]
+ ld [de], a
+ pop bc
+ pop de
+ pop hl
+
+.next
+ inc hl
+ inc de
+ dec b
+ jr nz, .loop
+
+.done
+ ret
+; f6a7
+
+Not_PP_Up: ; f6a7
+ call RestorePP
+ jr nz, BattleRestorePP
+ jp PPRestoreItem_NoEffect
+; f6af
+
+Elixer_RestorePPofAllMoves: ; f6af
+ xor a
+ ld hl, wMenuCursorY
+ ld [hli], a
+ ld [hl], a
+ ld b, NUM_MOVES
+.moveLoop
+ push bc
+ ld hl, PartyMon1Moves
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call GetMthMoveOfNthPartymon
+ ld a, [hl]
+ and a
+ jr z, .next
+
+ call RestorePP
+ jr z, .next
+ ld hl, wMenuCursorX
+ inc [hl]
+
+.next
+ ld hl, wMenuCursorY
+ inc [hl]
+ pop bc
+ dec b
+ jr nz, .moveLoop
+ ld a, [wMenuCursorX]
+ and a
+ jp nz, BattleRestorePP
+
+PPRestoreItem_NoEffect: ; f6dd
+ call WontHaveAnyEffectMessage
+
+PPRestoreItem_Cancel: ; f6e0
+ call ClearPalettes
+ xor a
+ ld [wItemEffectSucceeded], a
+ ret
+; f6e8
+
+RestorePP: ; f6e8
+ xor a ; PARTYMON
+ ld [MonType], a
+ call GetMaxPPOfMove
+ ld hl, PartyMon1PP
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call GetMthMoveOfNthPartymon
+ ld a, [wd265]
+ ld b, a
+ ld a, [hl]
+ and (1 << 6) - 1
+ cp b
+ jr nc, .dont_restore
+
+ ld a, [wd002]
+ cp MAX_ELIXER
+ jr z, .restore_all
+ cp MAX_ETHER
+ jr z, .restore_all
+
+ ld c, 5
+ cp MYSTERYBERRY
+ jr z, .restore_some
+
+ ld c, 10
+
+.restore_some
+ ld a, [hl]
+ and (1 << 6) - 1
+ add c
+ cp b
+ jr nc, .restore_all
+ ld b, a
+
+.restore_all
+ ld a, [hl]
+ and 3 << 6
+ or b
+ ld [hl], a
+ ret
+
+.dont_restore
+ xor a
+ ret
+; f725
+
+TextJump_RaiseThePPOfWhichMove: ; 0xf725
+ ; Raise the PP of which move?
+ text_jump Text_RaiseThePPOfWhichMove
+ db "@"
+; 0xf72a
+
+TextJump_RestoreThePPOfWhichMove: ; 0xf72a
+ ; Restore the PP of which move?
+ text_jump Text_RestoreThePPOfWhichMove
+ db "@"
+; 0xf72f
+
+TextJump_PPIsMaxedOut: ; 0xf72f
+ ; 's PP is maxed out.
+ text_jump Text_PPIsMaxedOut
+ db "@"
+; 0xf734
+
+TextJump_PPsIncreased: ; 0xf734
+ ; 's PP increased.
+ text_jump Text_PPsIncreased
+ db "@"
+; 0xf739
+
+UnknownText_0xf739: ; 0xf739
+ ; PP was restored.
+ text_jump UnknownText_0x1c5cf1
+ db "@"
+; 0xf73e
+
+
+Squirtbottle: ; f73e
+ farcall _Squirtbottle
+ ret
+; f745
+
+
+CardKey: ; f745
+ farcall _CardKey
+ ret
+; f74c
+
+
+BasementKey: ; f74c
+ farcall _BasementKey
+ ret
+; f753
+
+
+SacredAsh: ; f753
+ farcall _SacredAsh
+ ld a, [wItemEffectSucceeded]
+ cp $1
+ ret nz
+ call UseDisposableItem
+ ret
+; f763
+
+
+NormalBox: ; f763
+ ld c, DECOFLAG_SILVER_TROPHY_DOLL
+ jr OpenBox
+; f767
+
+GorgeousBox: ; f767
+ ld c, DECOFLAG_GOLD_TROPHY_DOLL
+OpenBox: ; f769
+ farcall SetSpecificDecorationFlag
+
+ ld hl, .text
+ call PrintText
+
+ jp UseDisposableItem
+; f778
+
+.text ; 0xf778
+ ; There was a trophy inside!
+ text_jump UnknownText_0x1c5d03
+ db "@"
+; 0xf77d
+
+Brightpowder:
+Item19:
+LuckyPunch:
+MetalPowder:
+Nugget:
+Item2D:
+Item32:
+ExpShare:
+SilverLeaf:
+RedScale:
+Secretpotion:
+SSTicket:
+MysteryEgg:
+ClearBell:
+SilverWing:
+QuickClaw:
+GoldLeaf:
+SoftSand:
+SharpBeak:
+PoisonBarb:
+KingsRock:
+RedApricorn:
+Tinymushroom:
+BigMushroom:
+Silverpowder:
+BluApricorn:
+Item5A:
+AmuletCoin:
+YlwApricorn:
+GrnApricorn:
+CleanseTag:
+MysticWater:
+Twistedspoon:
+WhtApricorn:
+Blackbelt:
+BlkApricorn:
+Item64:
+PnkApricorn:
+Blackglasses:
+Slowpoketail:
+PinkBow:
+Stick:
+SmokeBall:
+Nevermeltice:
+Magnet:
+Pearl:
+BigPearl:
+Everstone:
+SpellTag:
+GsBall:
+MiracleSeed:
+ThickClub:
+FocusBand:
+Item78:
+HardStone:
+LuckyEgg:
+MachinePart:
+EggTicket:
+LostItem:
+Stardust:
+StarPiece:
+Pass:
+Item87:
+Item88:
+Item89:
+Charcoal:
+ScopeLens:
+Item8D:
+Item8E:
+MetalCoat:
+DragonFang:
+Item91:
+Leftovers:
+Item93:
+Item94:
+Item95:
+DragonScale:
+BerserkGene:
+Item99:
+Item9A:
+Item9B:
+FlowerMail:
+ItemA2:
+LightBall:
+PolkadotBow:
+ItemAB:
+UpGrade:
+ItemB0:
+RainbowWing:
+ItemB3:
+TeruSama: ; f77d
+ jp IsntTheTimeMessage
+; f780
+
+
+Play_SFX_FULL_HEAL: ; f780
+ push de
+ ld de, SFX_FULL_HEAL
+ call WaitPlaySFX
+ pop de
+ ret
+; f789
+
+UseItemText: ; f789
+ ld hl, UsedItemText
+ call PrintText
+ call Play_SFX_FULL_HEAL
+ call WaitPressAorB_BlinkCursor
+UseDisposableItem: ; f795
+ ld hl, NumItems
+ ld a, 1
+ ld [wItemQuantityChangeBuffer], a
+ jp TossItem
+; f7a0
+
+UseBallInTrainerBattle: ; f7a0
+ call ReturnToBattle_UseBall
+ ld de, ANIM_THROW_POKE_BALL
+ ld a, e
+ ld [FXAnimID], a
+ ld a, d
+ ld [FXAnimID + 1], a
+ xor a
+ ld [wBattleAnimParam], a
+ ld [hBattleTurn], a
+ ld [wNumHits], a
+ predef PlayBattleAnim
+ ld hl, BlockedTheBallText
+ call PrintText
+ ld hl, DontBeAThiefText
+ call PrintText
+ jr UseDisposableItem
+; f7ca
+
+WontHaveAnyEffect_NotUsedMessage: ; f7ca
+ ld hl, WontHaveAnyEffectText
+ call PrintText
+
+ ; Item wasn't used.
+ ld a, $2
+ ld [wItemEffectSucceeded], a
+ ret
+; f7d6
+
+LooksBitterMessage: ; f7d6
+ ld hl, LooksBitterText
+ jp PrintText
+; f7dc
+
+Ball_BoxIsFullMessage: ; f7dc
+ ld hl, Ball_BoxIsFullText
+ call PrintText
+
+ ; Item wasn't used.
+ ld a, $2
+ ld [wItemEffectSucceeded], a
+ ret
+; f7e8
+
+CantUseOnEggMessage: ; f7e8
+ ld hl, CantUseOnEggText
+ jr CantUseItemMessage
+
+IsntTheTimeMessage: ; f7ed
+ ld hl, IsntTheTimeText
+ jr CantUseItemMessage
+
+WontHaveAnyEffectMessage: ; f7f2
+ ld hl, WontHaveAnyEffectText
+ jr CantUseItemMessage
+
+BelongsToSomeoneElseMessage: ; f7f7
+ ld hl, BelongsToSomeoneElseText
+ jr CantUseItemMessage
+
+CyclingIsntAllowedMessage: ; f7fc
+ ld hl, CyclingIsntAllowedText
+ jr CantUseItemMessage
+
+CantGetOnYourBikeMessage: ; f801
+ ld hl, CantGetOnYourBikeText
+
+CantUseItemMessage: ; f804
+; Item couldn't be used.
+ xor a
+ ld [wItemEffectSucceeded], a
+ jp PrintText
+; f80b
+
+LooksBitterText: ; 0xf80b
+ ; It looks bitter…
+ text_jump UnknownText_0x1c5d3e
+ db "@"
+; 0xf810
+
+CantUseOnEggText: ; 0xf810
+ ; That can't be used on an EGG.
+ text_jump UnknownText_0x1c5d50
+ db "@"
+; 0xf815
+
+IsntTheTimeText: ; 0xf815
+ ; OAK: ! This isn't the time to use that!
+ text_jump UnknownText_0x1c5d6e
+ db "@"
+; 0xf81a
+
+BelongsToSomeoneElseText: ; 0xf81a
+ ; That belongs to someone else!
+ text_jump UnknownText_0x1c5d97
+ db "@"
+; 0xf81f
+
+WontHaveAnyEffectText: ; 0xf81f
+ ; It won't have any effect.
+ text_jump UnknownText_0x1c5db6
+ db "@"
+; 0xf824
+
+BlockedTheBallText: ; 0xf824
+ ; The trainer blocked the BALL!
+ text_jump UnknownText_0x1c5dd0
+ db "@"
+; 0xf829
+
+DontBeAThiefText: ; 0xf829
+ ; Don't be a thief!
+ text_jump UnknownText_0x1c5def
+ db "@"
+; 0xf82e
+
+CyclingIsntAllowedText: ; 0xf82e
+ ; Cycling isn't allowed here.
+ text_jump UnknownText_0x1c5e01
+ db "@"
+; 0xf833
+
+CantGetOnYourBikeText: ; 0xf833
+ ; Can't get on your @ now.
+ text_jump UnknownText_0x1c5e1d
+ db "@"
+; 0xf838
+
+Ball_BoxIsFullText: ; 0xf838
+ ; The #MON BOX is full. That can't be used now.
+ text_jump UnknownText_0x1c5e3a
+ db "@"
+; 0xf83d
+
+UsedItemText: ; 0xf83d
+ ; used the@ .
+ text_jump UnknownText_0x1c5e68
+ db "@"
+; 0xf842
+
+GotOnTheItemText: ; 0xf842
+ ; got on the@ .
+ text_jump UnknownText_0x1c5e7b
+ db "@"
+; 0xf847
+
+GotOffTheItemText: ; 0xf847
+ ; got off@ the @ .
+ text_jump UnknownText_0x1c5e90
+ db "@"
+; 0xf84c
+
+
+ApplyPPUp: ; f84c
+ ld a, MON_MOVES
+ call GetPartyParamLocation
+ push hl
+ ld de, Buffer1
+ predef FillPP
+ pop hl
+ ld bc, MON_PP - MON_MOVES
+ add hl, bc
+ ld de, Buffer1
+ ld b, 0
+.loop
+ inc b
+ ld a, b
+ cp NUM_MOVES + 1
+ ret z
+ ld a, [wd265]
+ dec a
+ jr nz, .use
+ ld a, [wMenuCursorY]
+ inc a
+ cp b
+ jr nz, .skip
+
+.use
+ ld a, [hl]
+ and 3 << 6
+ ld a, [de] ; wasted cycle
+ call nz, ComputeMaxPP
+
+.skip
+ inc hl
+ inc de
+ jr .loop
+; f881
+
+
+
+ComputeMaxPP: ; f881
+ push bc
+ ; Divide the base PP by 5.
+ ld a, [de]
+ ld [hDividend + 3], a
+ xor a
+ ld [hDividend], a
+ ld [hDividend + 1], a
+ ld [hDividend + 2], a
+ ld a, 5
+ ld [hDivisor], a
+ ld b, 4
+ call Divide
+ ; Get the number of PP, which are bits 6 and 7 of the PP value stored in RAM.
+ ld a, [hl]
+ ld b, a
+ swap a
+ and $f
+ srl a
+ srl a
+ ld c, a
+ ; If this value is 0, we are done
+ and a
+ jr z, .NoPPUp
+
+.loop
+ ; Normally, a move with 40 PP would have 64 PP with three PP Ups.
+ ; Since this would overflow into bit 6, we prevent that from happening
+ ; by decreasing the extra amount of PP each PP Up provides, resulting
+ ; in a maximum of 61.
+ ld a, [hQuotient + 2]
+ cp $8
+ jr c, .okay
+ ld a, $7
+
+.okay
+ add b
+ ld b, a
+ ld a, [wd265]
+ dec a
+ jr z, .NoPPUp
+ dec c
+ jr nz, .loop
+
+.NoPPUp:
+ ld [hl], b
+ pop bc
+ ret
+; f8b9
+
+RestoreAllPP: ; f8b9
+ ld a, MON_PP
+ call GetPartyParamLocation
+ push hl
+ ld a, MON_MOVES
+ call GetPartyParamLocation
+ pop de
+ xor a ; PARTYMON
+ ld [wMenuCursorY], a
+ ld [MonType], a
+ ld c, NUM_MOVES
+.loop
+ ld a, [hli]
+ and a
+ ret z
+ push hl
+ push de
+ push bc
+ call GetMaxPPOfMove
+ pop bc
+ pop de
+ ld a, [de]
+ and 3 << 6
+ ld b, a
+ ld a, [wd265]
+ add b
+ ld [de], a
+ inc de
+ ld hl, wMenuCursorY
+ inc [hl]
+ pop hl
+ dec c
+ jr nz, .loop
+ ret
+; f8ec
+
+
+GetMaxPPOfMove: ; f8ec
+ ld a, [StringBuffer1 + 0]
+ push af
+ ld a, [StringBuffer1 + 1]
+ push af
+
+ ld a, [MonType]
+ and a
+
+ ld hl, PartyMon1Moves
+ ld bc, PARTYMON_STRUCT_LENGTH
+ jr z, .got_partymon ; PARTYMON
+
+ ld hl, OTPartyMon1Moves
+ dec a
+ jr z, .got_partymon ; OTPARTYMON
+
+ ld hl, TempMonMoves
+ dec a
+ jr z, .got_nonpartymon ; BOXMON
+
+ ld hl, TempMonMoves ; Wasted cycles
+ dec a
+ jr z, .got_nonpartymon ; TEMPMON
+
+ ld hl, BattleMonMoves ; WILDMON
+
+.got_nonpartymon ; BOXMON, TEMPMON, WILDMON
+ call GetMthMoveOfCurrentMon
+ jr .gotdatmove
+
+.got_partymon ; PARTYMON, OTPARTYMON
+ call GetMthMoveOfNthPartymon
+
+.gotdatmove
+ ld a, [hl]
+ dec a
+
+ push hl
+ ld hl, Moves + MOVE_PP
+ ld bc, MOVE_LENGTH
+ call AddNTimes
+ ld a, BANK(Moves)
+ call GetFarByte
+ ld b, a
+ ld de, StringBuffer1
+ ld [de], a
+ pop hl
+
+ push bc
+ ld bc, MON_PP - MON_MOVES
+ ld a, [MonType]
+ cp WILDMON
+ jr nz, .notwild
+ ld bc, EnemyMonPP - EnemyMonMoves
+.notwild
+ add hl, bc
+ ld a, [hl]
+ and 3 << 6
+ pop bc
+
+ or b
+ ld hl, StringBuffer1 + 1
+ ld [hl], a
+ xor a
+ ld [wd265], a
+ ld a, b ; this gets lost anyway
+ call ComputeMaxPP
+ ld a, [hl]
+ and (1 << 6) - 1
+ ld [wd265], a
+
+ pop af
+ ld [StringBuffer1 + 1], a
+ pop af
+ ld [StringBuffer1 + 0], a
+ ret
+; f963
+
+GetMthMoveOfNthPartymon: ; f963
+ ld a, [CurPartyMon]
+ call AddNTimes
+
+GetMthMoveOfCurrentMon: ; f969
+ ld a, [wMenuCursorY]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ ret
+; f971
diff --git a/engine/items.asm b/engine/items.asm
index 81c080dda..b0bffb6d6 100755
--- a/engine/items.asm
+++ b/engine/items.asm
@@ -331,7 +331,7 @@ ReceiveKeyItem: ; d35a
ret
TossKeyItem: ; d374
- ld a, [wd107]
+ ld a, [CurItemQuantity]
ld e, a
ld d, 0
ld hl, NumKeyItems
@@ -554,7 +554,7 @@ GetItemAttr: ; d460
ld a, [CurItem]
dec a
ld c, a
- ld a, NUM_ITEMATTRS
+ ld a, ITEMATTR_STRUCT_LENGTH
call AddNTimes
ld a, BANK(ItemAttributes)
call GetFarByte
diff --git a/engine/landmarks.asm b/engine/landmarks.asm
index 465a70f3c..75605bbd9 100644
--- a/engine/landmarks.asm
+++ b/engine/landmarks.asm
@@ -47,213 +47,7 @@ GetLandmarkName:: ; 0x1ca8a5
; 0x1ca8c3
-Landmarks: ; 0x1ca8c3
-
-landmark: MACRO
- db \1, \2
- dw \3
-ENDM
-
- landmark 0, 0, SpecialMapName
- landmark 148, 116, NewBarkTownName
- landmark 136, 116, Route29Name
- landmark 108, 116, CherrygroveCityName
- landmark 108, 96, Route30Name
- landmark 104, 76, Route31Name
- landmark 92, 76, VioletCityName
- landmark 93, 74, SproutTowerName
- landmark 92, 108, Route32Name
- landmark 84, 92, RuinsOfAlphName
- landmark 92, 140, UnionCaveName
- landmark 90, 140, Route33Name
- landmark 76, 140, AzaleaTownName
- landmark 78, 138, SlowpokeWellName
- landmark 60, 136, IlexForestName
- landmark 60, 128, Route34Name
- landmark 60, 108, GoldenrodCityName
- landmark 58, 108, RadioTowerName
- landmark 60, 92, Route35Name
- landmark 60, 76, NationalParkName
- landmark 72, 76, Route36Name
- landmark 76, 68, Route37Name
- landmark 76, 60, EcruteakCityName
- landmark 78, 58, TinTowerName
- landmark 74, 58, BurnedTowerName
- landmark 60, 60, Route38Name
- landmark 44, 64, Route39Name
- landmark 44, 76, OlivineCityName
- landmark 46, 78, LighthouseName
- landmark 36, 72, BattleTowerName
- landmark 36, 80, Route40Name
- landmark 36, 108, WhirlIslandsName
- landmark 36, 116, Route41Name
- landmark 28, 116, CianwoodCityName
- landmark 100, 60, Route42Name
- landmark 92, 60, MtMortarName
- landmark 116, 60, MahoganyTownName
- landmark 116, 52, Route43Name
- landmark 116, 44, LakeOfRageName
- landmark 128, 60, Route44Name
- landmark 138, 54, IcePathName
- landmark 140, 60, BlackthornCityName
- landmark 140, 52, DragonsDenName
- landmark 140, 80, Route45Name
- landmark 120, 88, DarkCaveName
- landmark 132, 104, Route46Name
- landmark 156, 84, SilverCaveName
- landmark 60, 124, PalletTownName
- landmark 60, 108, Route1Name
- landmark 60, 92, ViridianCityName
- landmark 60, 80, Route2Name
- landmark 60, 68, PewterCityName
- landmark 72, 68, Route3Name
- landmark 84, 68, MtMoonName
- landmark 96, 68, Route4Name
- landmark 108, 68, CeruleanCityName
- landmark 108, 60, Route24Name
- landmark 116, 52, Route25Name
- landmark 108, 76, Route5Name
- landmark 116, 92, UndergroundName
- landmark 108, 92, Route6Name
- landmark 108, 100, VermilionCityName
- landmark 96, 76, DiglettsCaveName
- landmark 96, 84, Route7Name
- landmark 124, 84, Route8Name
- landmark 124, 68, Route9Name
- landmark 140, 68, RockTunnelName
- landmark 140, 72, Route10Name
- landmark 140, 76, PowerPlantName
- landmark 140, 84, LavenderTownName
- landmark 148, 84, LavRadioTowerName
- landmark 84, 84, CeladonCityName
- landmark 108, 84, SaffronCityName
- landmark 124, 100, Route11Name
- landmark 140, 96, Route12Name
- landmark 132, 116, Route13Name
- landmark 124, 128, Route14Name
- landmark 112, 132, Route15Name
- landmark 76, 84, Route16Name
- landmark 76, 108, Route17Name
- landmark 88, 132, Route18Name
- landmark 100, 132, FuchsiaCityName
- landmark 100, 144, Route19Name
- landmark 84, 148, Route20Name
- landmark 76, 148, SeafoamIslandsName
- landmark 60, 148, CinnabarIslandName
- landmark 60, 136, Route21Name
- landmark 44, 84, Route22Name
- landmark 36, 68, VictoryRoadName
- landmark 36, 60, Route23Name
- landmark 36, 52, IndigoPlateauName
- landmark 36, 108, Route26Name
- landmark 28, 116, Route27Name
- landmark 20, 116, TohjoFallsName
- landmark 28, 84, Route28Name
- landmark 148, 132, FastShipName
-
-
-NewBarkTownName: db "NEW BARK¯TOWN@"
-CherrygroveCityName: db "CHERRYGROVE¯CITY@"
-VioletCityName: db "VIOLET CITY@"
-AzaleaTownName: db "AZALEA TOWN@"
-GoldenrodCityName: db "GOLDENROD¯CITY@"
-EcruteakCityName: db "ECRUTEAK¯CITY@"
-OlivineCityName: db "OLIVINE¯CITY@"
-CianwoodCityName: db "CIANWOOD¯CITY@"
-MahoganyTownName: db "MAHOGANY¯TOWN@"
-BlackthornCityName: db "BLACKTHORN¯CITY@"
-LakeOfRageName: db "LAKE OF¯RAGE@"
-SilverCaveName: db "SILVER CAVE@"
-SproutTowerName: db "SPROUT¯TOWER@"
-RuinsOfAlphName: db "RUINS¯OF ALPH@"
-UnionCaveName: db "UNION CAVE@"
-SlowpokeWellName: db "SLOWPOKE¯WELL@"
-RadioTowerName: db "RADIO TOWER@"
-PowerPlantName: db "POWER PLANT@"
-NationalParkName: db "NATIONAL¯PARK@"
-TinTowerName: db "TIN TOWER@"
-LighthouseName: db "LIGHTHOUSE@"
-WhirlIslandsName: db "WHIRL¯ISLANDS@"
-MtMortarName: db "MT.MORTAR@"
-DragonsDenName: db "DRAGON'S¯DEN@"
-IcePathName: db "ICE PATH@"
-NotApplicableName: db "N/A@"
-PalletTownName: db "PALLET TOWN@"
-ViridianCityName: db "VIRIDIAN¯CITY@"
-PewterCityName: db "PEWTER CITY@"
-CeruleanCityName: db "CERULEAN¯CITY@"
-LavenderTownName: db "LAVENDER¯TOWN@"
-VermilionCityName: db "VERMILION¯CITY@"
-CeladonCityName: db "CELADON¯CITY@"
-SaffronCityName: db "SAFFRON¯CITY@"
-FuchsiaCityName: db "FUCHSIA¯CITY@"
-CinnabarIslandName: db "CINNABAR¯ISLAND@"
-IndigoPlateauName: db "INDIGO¯PLATEAU@"
-VictoryRoadName: db "VICTORY¯ROAD@"
-MtMoonName: db "MT.MOON@"
-RockTunnelName: db "ROCK TUNNEL@"
-LavRadioTowerName: db "LAV¯RADIO TOWER@"
-SilphCoName: db "SILPH CO.@"
-SafariZoneName: db "SAFARI ZONE@"
-SeafoamIslandsName: db "SEAFOAM¯ISLANDS@"
-PokemonMansionName: db "#MON¯MANSION@"
-CeruleanCaveName: db "CERULEAN¯CAVE@"
-Route1Name: db "ROUTE 1@"
-Route2Name: db "ROUTE 2@"
-Route3Name: db "ROUTE 3@"
-Route4Name: db "ROUTE 4@"
-Route5Name: db "ROUTE 5@"
-Route6Name: db "ROUTE 6@"
-Route7Name: db "ROUTE 7@"
-Route8Name: db "ROUTE 8@"
-Route9Name: db "ROUTE 9@"
-Route10Name: db "ROUTE 10@"
-Route11Name: db "ROUTE 11@"
-Route12Name: db "ROUTE 12@"
-Route13Name: db "ROUTE 13@"
-Route14Name: db "ROUTE 14@"
-Route15Name: db "ROUTE 15@"
-Route16Name: db "ROUTE 16@"
-Route17Name: db "ROUTE 17@"
-Route18Name: db "ROUTE 18@"
-Route19Name: db "ROUTE 19@"
-Route20Name: db "ROUTE 20@"
-Route21Name: db "ROUTE 21@"
-Route22Name: db "ROUTE 22@"
-Route23Name: db "ROUTE 23@"
-Route24Name: db "ROUTE 24@"
-Route25Name: db "ROUTE 25@"
-Route26Name: db "ROUTE 26@"
-Route27Name: db "ROUTE 27@"
-Route28Name: db "ROUTE 28@"
-Route29Name: db "ROUTE 29@"
-Route30Name: db "ROUTE 30@"
-Route31Name: db "ROUTE 31@"
-Route32Name: db "ROUTE 32@"
-Route33Name: db "ROUTE 33@"
-Route34Name: db "ROUTE 34@"
-Route35Name: db "ROUTE 35@"
-Route36Name: db "ROUTE 36@"
-Route37Name: db "ROUTE 37@"
-Route38Name: db "ROUTE 38@"
-Route39Name: db "ROUTE 39@"
-Route40Name: db "ROUTE 40@"
-Route41Name: db "ROUTE 41@"
-Route42Name: db "ROUTE 42@"
-Route43Name: db "ROUTE 43@"
-Route44Name: db "ROUTE 44@"
-Route45Name: db "ROUTE 45@"
-Route46Name: db "ROUTE 46@"
-DarkCaveName: db "DARK CAVE@"
-IlexForestName: db "ILEX¯FOREST@"
-BurnedTowerName: db "BURNED¯TOWER@"
-FastShipName: db "FAST SHIP@"
-ViridianForestName: db "VIRIDIAN¯FOREST@"
-DiglettsCaveName: db "DIGLETT'S¯CAVE@"
-TohjoFallsName: db "TOHJO FALLS@"
-UndergroundName: db "UNDERGROUND@"
-BattleTowerName: db "BATTLE¯TOWER@"
-SpecialMapName: db "SPECIAL@"
+INCLUDE "data/maps/landmarks.asm"
RegionCheck: ; 0x1caea1
diff --git a/engine/link.asm b/engine/link.asm
index f5bc24da9..a2aec3a10 100755
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -14,14 +14,14 @@ LinkCommunications: ; 28000
call UpdateSprites
call LoadStandardFont
call LoadFontsBattleExtra
- callba LinkComms_LoadPleaseWaitTextboxBorderGFX
+ farcall LinkComms_LoadPleaseWaitTextboxBorderGFX
call WaitBGMap2
hlcoord 3, 8
ld b, 2
ld c, 12
ld d, h
ld e, l
- callba LinkTextbox2
+ farcall LinkTextbox2
hlcoord 4, 10
ld de, String_PleaseWait
call PlaceString
@@ -150,7 +150,7 @@ TimeCapsule: ; 2805d
ld [wd265], a
push hl
push de
- callab ConvertMon_1to2
+ callfar ConvertMon_1to2
pop de
pop hl
ld a, [wd265]
@@ -362,19 +362,19 @@ Gen2ToGen2LinkComms: ; 28177
.fix_mail_loop
push bc
push de
- callba IsMailEuropean
+ farcall IsMailEuropean
ld a, c
or a
jr z, .next
sub $3
jr nc, .skip
- callba DeutenEnglischenPost
+ farcall DeutenEnglischenPost
jr .next
.skip
cp $2
jr nc, .next
- callba HandleSpanishItalianMail
+ farcall HandleSpanishItalianMail
.next
pop de
@@ -390,7 +390,7 @@ Gen2ToGen2LinkComms: ; 28177
ld [de], a
.skip_mail
- ld hl, wLinkData
+ ld hl, wLinkPlayerName
ld de, OTPlayerName
ld bc, NAME_LENGTH
call CopyBytes
@@ -419,7 +419,7 @@ Gen2ToGen2LinkComms: ; 28177
ld a, CAL
ld [OtherTrainerClass], a
call ClearScreen
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
ld hl, Options
ld a, [hl]
push af
@@ -463,7 +463,7 @@ Gen2ToGen2LinkComms: ; 28177
ld [wDisableTextAcceleration], a
pop af
ld [Options], a
- callba LoadPokemonData
+ farcall LoadPokemonData
jp Function28b22
.ready_to_trade
@@ -491,7 +491,7 @@ LinkTimeout: ; 283b2
push de
ld d, h
ld e, l
- callba LinkTextbox2
+ farcall LinkTextbox2
pop de
pop hl
bccoord 1, 14
@@ -658,7 +658,7 @@ Link_PrepPartyData_Gen1: ; 28499
ld [wd265], a
push hl
push de
- callab ConvertMon_2to1
+ callfar ConvertMon_2to1
pop de
pop hl
ld a, [wd265]
@@ -698,7 +698,7 @@ Link_PrepPartyData_Gen1: ; 28499
push bc
ld a, [hl]
ld [wd265], a
- callab ConvertMon_2to1
+ callfar ConvertMon_2to1
pop bc
pop de
ld a, [wd265]
@@ -737,10 +737,10 @@ Link_PrepPartyData_Gen1: ; 28499
.skip_steel
push bc
dec a
- ld hl, BaseData + 7 ; type
- ld bc, BaseData1 - BaseData0
+ ld hl, BaseData + BASE_TYPES
+ ld bc, BASE_DATA_SIZE
call AddNTimes
- ld bc, 2
+ ld bc, BASE_CATCH_RATE - BASE_TYPES
ld a, BANK(BaseData)
call FarCopyBytes
pop bc
@@ -882,20 +882,20 @@ Link_PrepPartyData_Gen2: ; 28595
push hl
push de
push hl
- callba IsMailEuropean
+ farcall IsMailEuropean
pop de
ld a, c
or a
jr z, .next
sub $3
jr nc, .italian_spanish
- callba HandleFrenchGermanMail
+ farcall HandleFrenchGermanMail
jr .next
.italian_spanish
cp $2
jr nc, .next
- callba HandleSpanishItalianMail
+ farcall HandleSpanishItalianMail
.next
pop de
@@ -993,7 +993,7 @@ Function2868a: ; 2868a
push bc
push de
ld [wd265], a
- callab ConvertMon_1to2
+ callfar ConvertMon_1to2
pop de
pop bc
ld a, [wd265]
@@ -1112,7 +1112,7 @@ TimeCapsule_ReplaceTeruSama: ; 28771
and a
ret z
push hl
- ld hl, .TimeCapsuleAlt
+ ld hl, TimeCapsule_CatchRateItems
.loop
ld a, [hli]
and a
@@ -1129,24 +1129,9 @@ TimeCapsule_ReplaceTeruSama: ; 28771
pop hl
ret
-.TimeCapsuleAlt: ; 28785
-; Pokémon traded from RBY do not have held items, so GSC usually interprets the
-; catch rate as an item. However, if the catch rate appears in this table, the
-; item associated with the table entry is used instead.
- db ITEM_19, LEFTOVERS
- db ITEM_2D, BITTER_BERRY
- db ITEM_32, GOLD_BERRY
- db ITEM_5A, BERRY
- db ITEM_64, BERRY
- db ITEM_78, BERRY
- db ITEM_87, BERRY
- db ITEM_BE, BERRY
- db ITEM_C3, BERRY
- db ITEM_DC, BERRY
- db HM_08, BERRY
- db -1, BERRY
- db 0
-; 2879e
+
+INCLUDE "data/time_capsule/catch_rate_items.asm"
+
Link_CopyOTData: ; 2879e
.loop
@@ -1210,7 +1195,7 @@ Link_FindFirstNonControlCharacter_AllowZero: ; 287d8
InitTradeMenuDisplay: ; 287e3
call ClearScreen
call LoadTradeScreenBorder
- callba InitTradeSpeciesList
+ farcall InitTradeSpeciesList
xor a
ld hl, wOtherPlayerLinkMode
ld [hli], a
@@ -1247,7 +1232,7 @@ LinkTrade_OTPartyMenu: ; 28803
ld [w2DMenuFlags2], a
LinkTradeOTPartymonMenuLoop: ; 28835
- callba LinkTradeMenu
+ farcall LinkTradeMenu
ld a, d
and a
jp z, LinkTradePartiesMenuMasterLoop
@@ -1255,9 +1240,9 @@ LinkTradeOTPartymonMenuLoop: ; 28835
jr z, .not_a_button
ld a, $1
ld [wInitListType], a
- callab InitList
+ callfar InitList
ld hl, OTPartyMon1Species
- callba LinkMonStatsScreen
+ farcall LinkMonStatsScreen
jp LinkTradePartiesMenuMasterLoop
.not_a_button
@@ -1289,7 +1274,7 @@ LinkTradeOTPartymonMenuLoop: ; 28835
; 2888b
LinkTrade_PlayerPartyMenu: ; 2888b
- callba InitMG_Mobile_LinkTradePalMap
+ farcall InitMG_Mobile_LinkTradePalMap
xor a
ld [MonType], a
ld a, A_BUTTON | D_UP | D_DOWN
@@ -1313,7 +1298,7 @@ LinkTrade_PlayerPartyMenu: ; 2888b
call WaitBGMap2
LinkTradePartymonMenuLoop: ; 288c5
- callba LinkTradeMenu
+ farcall LinkTradeMenu
ld a, d
and a
jr nz, .check_joypad
@@ -1381,7 +1366,7 @@ Function28926: ; 28926
hlcoord 2, 16
ld de, .String_Stats_Trade
call PlaceString
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
.joy_loop
ld a, " "
@@ -1448,8 +1433,8 @@ Function28926: ; 28926
ld [wMenuCursorY], a
ld a, $4
ld [wInitListType], a
- callab InitList
- callba LinkMonStatsScreen
+ callfar InitList
+ farcall LinkMonStatsScreen
call Call_LoadTempTileMapToTileMap
hlcoord 6, 1
lb bc, 6, 1
@@ -1468,7 +1453,7 @@ Function28926: ; 28926
dec a
ld [wd002], a
ld [wPlayerLinkAction], a
- callba Function16d6ce
+ farcall Function16d6ce
ld a, [wOtherPlayerLinkMode]
cp $f
jp z, InitTradeMenuDisplay
@@ -1476,9 +1461,9 @@ Function28926: ; 28926
call Function28b68
ld c, 100
call DelayFrames
- callba ValidateOTTrademon
+ farcall ValidateOTTrademon
jr c, .abnormal
- callba Functionfb5dd
+ farcall Functionfb5dd
jp nc, LinkTrade
xor a
ld [wcf57], a
@@ -1487,7 +1472,7 @@ Function28926: ; 28926
ld b, 4
ld c, 18
call Predef_LinkTextbox
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
ld hl, .Text_CantTradeLastMon
bccoord 1, 14
call PlaceHLTextAtBC
@@ -1509,7 +1494,7 @@ Function28926: ; 28926
ld b, 4
ld c, 18
call Predef_LinkTextbox
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
ld hl, .Text_Abnormal
bccoord 1, 14
call PlaceHLTextAtBC
@@ -1524,7 +1509,7 @@ Function28926: ; 28926
call PlaceString
ld a, $1
ld [wPlayerLinkAction], a
- callba Function16d6ce
+ farcall Function16d6ce
ld c, 100
call DelayFrames
jp InitTradeMenuDisplay
@@ -1590,7 +1575,7 @@ Function28ade: ; 28ade
ldcoord_a 9, 17
ld a, $f
ld [wPlayerLinkAction], a
- callba Function16d6ce
+ farcall Function16d6ce
ld a, [wOtherPlayerLinkMode]
cp $f
jr nz, .loop1
@@ -1665,7 +1650,7 @@ LinkTrade: ; 28b87
ld b, $4
ld c, $12
call Predef_LinkTextbox
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
ld a, [wd002]
ld hl, PartySpecies
ld c, a
@@ -1715,7 +1700,7 @@ LinkTrade: ; 28b87
ld a, 1
ld [wMenuCursorY], a
ld [wMenuCursorX], a
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
call ScrollingMenuJoypad
push af
call Call_ExitMenu
@@ -1737,13 +1722,13 @@ LinkTrade: ; 28b87
hlcoord 1, 14
ld de, String_TooBadTheTradeWasCanceled
call PlaceString
- callba Function16d6ce
+ farcall Function16d6ce
jp Function28ea3
.asm_28c54
ld a, $2
ld [wPlayerLinkAction], a
- callba Function16d6ce
+ farcall Function16d6ce
ld a, [wOtherPlayerLinkMode]
dec a
jr nz, .asm_28c7b
@@ -1832,7 +1817,7 @@ LinkTrade: ; 28b87
call GetPartyLocation
ld b, h
ld c, l
- callba GetCaughtGender
+ farcall GetCaughtGender
ld a, c
ld [wPlayerTrademonCaughtData], a
ld hl, OTPlayerName
@@ -1871,7 +1856,7 @@ LinkTrade: ; 28b87
call GetPartyLocation
ld b, h
ld c, l
- callba GetCaughtGender
+ farcall GetCaughtGender
ld a, c
ld [wOTTrademonCaughtData], a
ld a, [wd002]
@@ -1884,7 +1869,7 @@ LinkTrade: ; 28b87
ld [wd002], a
xor a
ld [wPokemonWithdrawDepositParameter], a
- callab RemoveMonFromPartyOrBox
+ callfar RemoveMonFromPartyOrBox
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
@@ -1933,11 +1918,11 @@ LinkTrade: ; 28b87
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
- callab EvolvePokemon
+ callfar EvolvePokemon
call ClearScreen
call LoadTradeScreenBorder
call SetTradeRoomBGPals
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
ld b, $1
pop af
ld c, a
@@ -1972,9 +1957,9 @@ LinkTrade: ; 28b87
jr nz, .loop
.save
- callba SaveAfterLinkTrade
- callba TrainerRankings_Trades
- callba BackupMobileEventIndex
+ farcall SaveAfterLinkTrade
+ farcall TrainerRankings_Trades
+ farcall BackupMobileEventIndex
ld c, 40
call DelayFrames
hlcoord 0, 12
@@ -1984,7 +1969,7 @@ LinkTrade: ; 28b87
hlcoord 1, 14
ld de, String28ebd
call PlaceString
- callba Link_WaitBGMap
+ farcall Link_WaitBGMap
ld c, 50
call DelayFrames
ld a, [wLinkMode]
@@ -2020,17 +2005,17 @@ String_TooBadTheTradeWasCanceled: ; 28ece
Predef_LinkTextbox: ; 28eef
ld d, h
ld e, l
- callba LinkTextbox
+ farcall LinkTextbox
ret
; 28ef8
LoadTradeScreenBorder: ; 28ef8
- callba _LoadTradeScreenBorder
+ farcall _LoadTradeScreenBorder
ret
; 28eff
SetTradeRoomBGPals: ; 28eff
- callba LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful
+ farcall LoadTradeRoomBGPals_ ; just a nested farcall; so wasteful
call SetPalettes
ret
; 28f09
@@ -2045,11 +2030,11 @@ Function28f09: ; 28f09
ld b, 6
ld c, 18
call Predef_LinkTextbox
- callba PlaceTradePartnerNamesAndParty
+ farcall PlaceTradePartnerNamesAndParty
ret
; 28f24
-INCLUDE "engine/trade/animation.asm"
+INCLUDE "engine/trade_animation.asm"
Special_CheckTimeCapsuleCompatibility: ; 29bfb
; Checks to see if your Party is compatible with the generation 1 games. Returns the following in ScriptVar:
@@ -2079,7 +2064,7 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb
push hl
push bc
ld d, [hl]
- callba ItemIsMail
+ farcall ItemIsMail
pop bc
pop hl
jr c, .mon_has_mail
@@ -2450,7 +2435,7 @@ Link_CheckCommunicationError: ; 29e0c
Special_TryQuickSave: ; 29e66
ld a, [wd265]
push af
- callba Link_SaveGame
+ farcall Link_SaveGame
ld a, $1
jr nc, .return_result
xor a
@@ -2494,7 +2479,7 @@ Special_TimeCapsule: ; 29eaf
ld a, LINK_TIMECAPSULE
ld [wLinkMode], a
call DisableSpriteUpdates
- callab LinkCommunications
+ callfar LinkCommunications
call EnableSpriteUpdates
xor a
ld [hVBlank], a
@@ -2505,7 +2490,7 @@ Special_TradeCenter: ; 29ec4
ld a, LINK_TRADECENTER
ld [wLinkMode], a
call DisableSpriteUpdates
- callab LinkCommunications
+ callfar LinkCommunications
call EnableSpriteUpdates
xor a
ld [hVBlank], a
@@ -2516,7 +2501,7 @@ Special_Colosseum: ; 29ed9
ld a, LINK_COLOSSEUM
ld [wLinkMode], a
call DisableSpriteUpdates
- callab LinkCommunications
+ callfar LinkCommunications
call EnableSpriteUpdates
xor a
ld [hVBlank], a
@@ -2592,7 +2577,18 @@ Special_CableClubCheckWhichChris: ; 29f47
ret
; 29f54
-GFX_29f54: ; 29f54
+UnusedGen1LinkCommsBorderGFX: ; 29f54
; unreferenced
-INCBIN "gfx/unknown/029f54.2bpp"
+INCBIN "gfx/trade/unused_gen_1_border_tiles.2bpp"
; 29fe4
+
+Function29fe4: ; unreferenced
+ ld a, BANK(sPartyMail)
+ call GetSRAMBank
+ ld d, $0
+ ld b, CHECK_FLAG
+ predef FlagPredef
+ call CloseSRAM
+ ld a, c
+ and a
+ ret
diff --git a/engine/link_2.asm b/engine/link_2.asm
new file mode 100644
index 000000000..72e5262b3
--- /dev/null
+++ b/engine/link_2.asm
@@ -0,0 +1,91 @@
+LinkMonStatsScreen: ; 4d319
+ ld a, [wMenuCursorY]
+ dec a
+ ld [CurPartyMon], a
+ call LowVolume
+ predef StatsScreenInit
+ ld a, [CurPartyMon]
+ inc a
+ ld [wMenuCursorY], a
+ call ClearScreen
+ call ClearBGPalettes
+ call MaxVolume
+ farcall LoadTradeScreenBorder
+ farcall Link_WaitBGMap
+ farcall InitTradeSpeciesList
+ farcall SetTradeRoomBGPals
+ call WaitBGMap2
+ ret
+
+Link_WaitBGMap: ; 4d354
+ call WaitBGMap
+ call WaitBGMap2
+ ret
+
+LinkTextbox2: ; 4d35b
+ ld h, d
+ ld l, e
+ push bc
+ push hl
+ call .PlaceBorder
+ pop hl
+ pop bc
+ ld de, AttrMap - TileMap
+ add hl, de
+ inc b
+ inc b
+ inc c
+ inc c
+ ld a, $7
+.row
+ push bc
+ push hl
+.col
+ ld [hli], a
+ dec c
+ jr nz, .col
+ pop hl
+ ld de, SCREEN_WIDTH
+ add hl, de
+ pop bc
+ dec b
+ jr nz, .row
+ ret
+
+.PlaceBorder: ; 4d37e
+ push hl
+ ld a, $76
+ ld [hli], a
+ inc a
+ call .PlaceRow
+ inc a
+ ld [hl], a
+ pop hl
+ ld de, SCREEN_WIDTH
+ add hl, de
+.loop
+ push hl
+ ld a, "┌"
+ ld [hli], a
+ ld a, " "
+ call .PlaceRow
+ ld [hl], "─"
+ pop hl
+ ld de, SCREEN_WIDTH
+ add hl, de
+ dec b
+ jr nz, .loop
+ ld a, "┐"
+ ld [hli], a
+ ld a, "│"
+ call .PlaceRow
+ ld [hl], "└"
+ ret
+
+.PlaceRow: ; 4d3ab
+ ld d, c
+.row_loop
+ ld [hli], a
+ dec d
+ jr nz, .row_loop
+ ret
diff --git a/engine/link_trade.asm b/engine/link_trade.asm
index 96401f188..bb2765b50 100755
--- a/engine/link_trade.asm
+++ b/engine/link_trade.asm
@@ -1,5 +1,5 @@
LinkCommsBorderGFX:
-INCBIN "gfx/unknown/16cfc1.2bpp"
+INCBIN "gfx/trade/border_tiles.2bpp"
; 16d421
__LoadTradeScreenBorder: ; 16d421
@@ -23,8 +23,8 @@ Function16d43b: ; 16d43b
call ClearBGPalettes
call ClearTileMap
call ClearSprites
- callba __LoadTradeScreenBorder ; useless to farcall
- callba Function16d42e ; useless to farcall
+ farcall __LoadTradeScreenBorder ; useless to farcall
+ farcall Function16d42e ; useless to farcall
ld b, SCGB_DIPLOMA
call GetSGBLayout
call SetPalettes
@@ -35,13 +35,13 @@ Function16d43b: ; 16d43b
; 16d465
Tilemap_16d465:
-INCBIN "gfx/unknown/16d465.tilemap"
+INCBIN "gfx/trade/border_mobile_fullscreen.tilemap"
Tilemap_16d5cd:
-INCBIN "gfx/unknown/16d5cd.tilemap"
+INCBIN "gfx/trade/border_cable_top.tilemap"
Tilemap_16d5f5:
-INCBIN "gfx/unknown/16d5f5.tilemap"
+INCBIN "gfx/trade/border_cable_bottom.tilemap"
_LinkTextbox: ; 16d61d
ld h, d
@@ -119,8 +119,8 @@ _LinkTextbox: ; 16d61d
InitTradeSpeciesList: ; 16d673
call _LoadTradeScreenBorder
call Function16d6ae
- callba InitMG_Mobile_LinkTradePalMap
- callba PlaceTradePartnerNamesAndParty
+ farcall InitMG_Mobile_LinkTradePalMap
+ farcall PlaceTradePartnerNamesAndParty
hlcoord 10, 17
ld de, .CANCEL
call PlaceString
@@ -146,7 +146,7 @@ LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a
; 16d6a7
LoadTradeRoomBGPals_: ; 16d6a7
- callba LoadTradeRoomBGPals
+ farcall LoadTradeRoomBGPals
ret
; 16d6ae
@@ -171,7 +171,7 @@ LinkTextbox: ; 16d6ca
Function16d6ce: ; 16d6ce
call LoadStandardMenuDataHeader
call Function16d6e1
- callba WaitLinkTransfer
+ farcall WaitLinkTransfer
call Call_ExitMenu
call WaitBGMap2
ret
@@ -233,7 +233,7 @@ LinkTradeMenu: ; 16d70c
call .UpdateBGMapAndOAM
call .loop2
jr nc, .done
- callba _2DMenuInterpretJoypad
+ farcall _2DMenuInterpretJoypad
jr c, .done
ld a, [w2DMenuFlags1]
bit 7, a
@@ -352,7 +352,7 @@ LinkTradeMenu: ; 16d70c
ld a, [w2DMenuFlags1]
bit 6, a
jr z, .skip_anims
- callba PlaySpriteAnimationsAndDelayFrame
+ farcall PlaySpriteAnimationsAndDelayFrame
.skip_anims
call JoyTextDelay
call .GetJoypad
diff --git a/engine/mail.asm b/engine/mail.asm
index 840e0a925..392405b20 100755
--- a/engine/mail.asm
+++ b/engine/mail.asm
@@ -2,7 +2,7 @@ SendMailToPC: ; 4456e
ld a, MON_ITEM
call GetPartyParamLocation
ld d, [hl]
- callba ItemIsMail
+ farcall ItemIsMail
jr nc, .full
call GetMailboxCount
cp MAILBOX_CAPACITY
@@ -80,7 +80,7 @@ ReadMailMessage: ; 445f4
call AddNTimes
ld d, h
ld e, l
- callba ReadAnyMail
+ farcall ReadAnyMail
ret
MoveMailFromPCToParty: ; 44607
@@ -127,7 +127,7 @@ GetMailboxCount: ; 44648
CheckPokeItem:: ; 44654
push bc
push de
- callba SelectMonFromParty
+ farcall SelectMonFromParty
ld a, $2
jr c, .pop_return
@@ -136,7 +136,7 @@ CheckPokeItem:: ; 44654
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld d, [hl]
- callba ItemIsMail
+ farcall ItemIsMail
ld a, $3
jr nc, .pop_return
@@ -172,12 +172,12 @@ CheckPokeItem:: ; 44654
jr nz, .loop
.done
- callba CheckCurPartyMonFainted
+ farcall CheckCurPartyMonFainted
ld a, $4
jr c, .close_sram_return
xor a
ld [wPokemonWithdrawDepositParameter], a
- callba RemoveMonFromPartyOrBox
+ farcall RemoveMonFromPartyOrBox
ld a, $1
.close_sram_return
@@ -296,7 +296,7 @@ IsAnyMonHoldingMail: ; 44781
ld d, [hl]
push hl
push de
- callba ItemIsMail
+ farcall ItemIsMail
pop de
pop hl
ret c
@@ -503,15 +503,15 @@ MailboxPC: ; 0x44806
ld [PartyMenuActionText], a
call ClearBGPalettes
.try_again
- callba LoadPartyMenuGFX
- callba InitPartyMenuWithCancel
- callba InitPartyMenuGFX
- callba WritePartyMenuTilemap
- callba PrintPartyMenuText
+ farcall LoadPartyMenuGFX
+ farcall InitPartyMenuWithCancel
+ farcall InitPartyMenuGFX
+ farcall WritePartyMenuTilemap
+ farcall PrintPartyMenuText
call WaitBGMap
call SetPalettes
call DelayFrame
- callba PartyMenuSelect
+ farcall PartyMenuSelect
jr c, .exit2
ld a, [CurPartySpecies]
cp EGG
diff --git a/engine/main_menu.asm b/engine/main_menu.asm
index c3b30d2d0..92a16f5b6 100755
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -271,7 +271,7 @@ MainMenu_PrintCurrentTimeAndDay: ; 49e09
decoord 4, 16
ld a, [hHours]
ld c, a
- callba PrintHour
+ farcall PrintHour
ld [hl], ":"
inc hl
ld de, hMinutes
@@ -341,21 +341,21 @@ Function49ed0: ; 49ed0
MainMenu_NewGame: ; 49ee0
- callba NewGame
+ farcall NewGame
ret
; 49ee7
MainMenu_Options: ; 49ee7
- callba OptionsMenu
+ farcall OptionsMenu
ret
; 49eee
MainMenu_Continue: ; 49eee
- callba Continue
+ farcall Continue
ret
; 49ef5
MainMenu_MysteryGift: ; 49ef5
- callba MysteryGift
+ farcall MysteryGift
ret
; 49efc
diff --git a/engine/map_object_action.asm b/engine/map_object_action.asm
index a7ab87200..ec5ad887e 100755
--- a/engine/map_object_action.asm
+++ b/engine/map_object_action.asm
@@ -1,36 +1,22 @@
- ld hl, OBJECT_ACTION
- add hl, bc
- ld a, [hl]
- ld l, a
- ld h, 0
- add hl, hl
- add hl, hl
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- call _hl_
- ret
-; 445f
-
-Pointers445f: ; 445f
- dw SetFacingStanding, SetFacingStanding ; 00
- dw SetFacingStandAction, SetFacingCurrent ; 01 standing?
- dw SetFacingStepAction, SetFacingCurrent ; 02 walking?
- dw SetFacingBumpAction, SetFacingCurrent ; 03 bumping?
- dw SetFacingCounterclockwiseSpin, SetFacingCurrent ; 04
- dw SetFacingCounterclockwiseSpin2, SetFacingStanding ; 05
- dw SetFacingFish, SetFacingFish ; 06
- dw SetFacingShadow, SetFacingStanding ; 07
- dw SetFacingEmote, SetFacingEmote ; 08
- dw SetFacingBigDollSym, SetFacingBigDollSym ; 09
- dw SetFacingBounce, SetFacingFreezeBounce ; 0a
- dw SetFacingWeirdTree, SetFacingCurrent ; 0b
- dw SetFacingBigDollAsym, SetFacingBigDollAsym ; 0c
- dw SetFacingBigDoll, SetFacingBigDoll ; 0d
- dw SetFacingBoulderDust, SetFacingStanding ; 0e
- dw SetFacingGrassShake, SetFacingStanding ; 0f
- dw SetFacingSkyfall, SetFacingCurrent ; 10
+ObjectActionPairPointers: ; 445f
+; entries correspond to OBJECT_ACTION_* constants
+ dw SetFacingStanding, SetFacingStanding
+ dw SetFacingStandAction, SetFacingCurrent
+ dw SetFacingStepAction, SetFacingCurrent
+ dw SetFacingBumpAction, SetFacingCurrent
+ dw SetFacingCounterclockwiseSpin, SetFacingCurrent
+ dw SetFacingCounterclockwiseSpin2, SetFacingStanding
+ dw SetFacingFish, SetFacingFish
+ dw SetFacingShadow, SetFacingStanding
+ dw SetFacingEmote, SetFacingEmote
+ dw SetFacingBigDollSym, SetFacingBigDollSym
+ dw SetFacingBounce, SetFacingFreezeBounce
+ dw SetFacingWeirdTree, SetFacingCurrent
+ dw SetFacingBigDollAsym, SetFacingBigDollAsym
+ dw SetFacingBigDoll, SetFacingBigDoll
+ dw SetFacingBoulderDust, SetFacingStanding
+ dw SetFacingGrassShake, SetFacingStanding
+ dw SetFacingSkyfall, SetFacingCurrent
; 44a3
SetFacingStanding: ; 44a3
diff --git a/engine/map_objects.asm b/engine/map_objects.asm
index d5fa84642..c37e6d2cf 100644
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -1,9 +1,8 @@
+INCLUDE "data/facings.asm"
-INCLUDE "engine/facings.asm"
-
-SpriteMovementData:: ; 4273
INCLUDE "data/map_objects.asm"
+
; 4357
DeleteMapObject:: ; 4357
push bc
@@ -155,8 +154,8 @@ Function437b: ; 437b
jr nz, SetFacingStanding
bit 5, [hl]
jr nz, asm_4448
- ld de, Pointers445f ; use first column
- jr asm_444d
+ ld de, ObjectActionPairPointers ; use first column
+ jr _HandleObjectAction
; 4440
Function4440: ; 4440
@@ -164,13 +163,28 @@ Function4440: ; 4440
add hl, bc
bit INVISIBLE, [hl]
jr nz, SetFacingStanding
-asm_4448 ; use second column
- ld de, Pointers445f + 2
- jr asm_444d
+asm_4448
+ ld de, ObjectActionPairPointers + 2 ; use second column
+ jr _HandleObjectAction
; 444d
-asm_444d
+_HandleObjectAction
; call [4 * ObjectStructs[ObjInd, OBJECT_ACTION] + de]
+ ld hl, OBJECT_ACTION
+ add hl, bc
+ ld a, [hl]
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call _hl_
+ ret
+; 445f
+
INCLUDE "engine/map_object_action.asm"
CopyNextCoordsTileToStandingCoordsTile: ; 4600
@@ -535,6 +549,7 @@ MapObjectMovementPattern: ; 47dd
ret
.Pointers: ; 47e9
+; entries correspond to SPRITEMOVEFN_* constants
dw .Null_00 ; 00
dw .RandomWalkY ; 01
dw .RandomWalkX ; 02
@@ -616,7 +631,7 @@ MapObjectMovementPattern: ; 47dd
call EndSpriteMovement
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_05
@@ -635,20 +650,20 @@ MapObjectMovementPattern: ; 47dd
jp HandleMovementData
.Movement0a:
- jp _GetMovementPerson
+ jp _GetMovementObject
.Movement0b:
- jp _GetMovementPerson
+ jp _GetMovementObject
.Movement0c:
- jp _GetMovementPerson
+ jp _GetMovementObject
.Movement0d:
ld hl, Function5000
jp HandleMovementData
.Movement0e:
- jp _GetMovementPerson
+ jp _GetMovementObject
.Follow:
ld hl, GetFollowerNextMovementByte
@@ -766,7 +781,7 @@ MapObjectMovementPattern: ; 47dd
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ret
.MovementBigStanding:
@@ -776,7 +791,7 @@ MapObjectMovementPattern: ; 47dd
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_BIG_SNORLAX
+ ld [hl], OBJECT_ACTION_BIG_SNORLAX
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_04
@@ -789,7 +804,7 @@ MapObjectMovementPattern: ; 47dd
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_BOUNCE
+ ld [hl], OBJECT_ACTION_BOUNCE
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_04
@@ -813,7 +828,7 @@ MapObjectMovementPattern: ; 47dd
.MovementSpinRepeat:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
@@ -864,7 +879,7 @@ MapObjectMovementPattern: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SHADOW
+ ld [hl], OBJECT_ACTION_SHADOW
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -901,7 +916,7 @@ MapObjectMovementPattern: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_EMOTE
+ ld [hl], OBJECT_ACTION_EMOTE
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 0
@@ -921,7 +936,7 @@ MapObjectMovementPattern: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_BOULDER_DUST
+ ld [hl], OBJECT_ACTION_BOULDER_DUST
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -965,7 +980,7 @@ MapObjectMovementPattern: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_GRASS_SHAKE
+ ld [hl], OBJECT_ACTION_GRASS_SHAKE
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -998,7 +1013,7 @@ MapObjectMovementPattern: ; 47dd
call EndSpriteMovement
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_00
+ ld [hl], OBJECT_ACTION_00
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
@@ -1038,7 +1053,7 @@ MapObjectMovementPattern: ; 47dd
call UpdateTallGrassFlags
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STEP
+ ld [hl], OBJECT_ACTION_STEP
ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer]
cp [hl]
@@ -1077,7 +1092,7 @@ SetRandomStepDuration: ; 4b2d
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_03
@@ -1085,7 +1100,7 @@ SetRandomStepDuration: ; 4b2d
; 4b45
StepTypesJumptable: ; 4b45
-; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm
+; entries correspond to STEP_TYPE_* constants
dw ObjectMovementReset ; 00
dw MapObjectMovementPattern ; unused
dw NPCStep ; 02 npc walk
@@ -1230,7 +1245,7 @@ TeleportFrom: ; 4c18
.DoSpin:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SPIN
+ ld [hl], OBJECT_ACTION_SPIN
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
@@ -1255,7 +1270,7 @@ TeleportFrom: ; 4c18
.DoSpinRise:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SPIN
+ ld [hl], OBJECT_ACTION_SPIN
ld hl, OBJECT_31
add hl, bc
inc [hl]
@@ -1295,7 +1310,7 @@ TeleportTo: ; 4c89
.InitWait:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_00
+ ld [hl], OBJECT_ACTION_00
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
@@ -1326,7 +1341,7 @@ TeleportTo: ; 4c89
.DoDescent:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SPIN
+ ld [hl], OBJECT_ACTION_SPIN
ld hl, OBJECT_31
add hl, bc
inc [hl]
@@ -1354,7 +1369,7 @@ TeleportTo: ; 4c89
.DoFinalSpin:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SPIN
+ ld [hl], OBJECT_ACTION_SPIN
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
@@ -1384,7 +1399,7 @@ Skyfall: ; 4d14
.Init:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_00
+ ld [hl], OBJECT_ACTION_00
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
@@ -1396,7 +1411,7 @@ Skyfall: ; 4d14
ret nz
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STEP
+ ld [hl], OBJECT_ACTION_STEP
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld [hl], 0
@@ -1481,9 +1496,9 @@ RockSmashStep: ; 4daf
add hl, bc
ld a, [hl]
and %00000001
- ld a, PERSON_ACTION_STAND
+ ld a, OBJECT_ACTION_STAND
jr z, .yes
- ld a, PERSON_ACTION_00
+ ld a, OBJECT_ACTION_00
.yes
ld hl, OBJECT_ACTION
add hl, bc
@@ -1496,9 +1511,9 @@ ReturnDigStep: ; 4dc8
add hl, bc
ld a, [hl]
and %00000001
- ld a, PERSON_ACTION_SPIN
+ ld a, OBJECT_ACTION_SPIN
jr z, .yes
- ld a, PERSON_ACTION_SPIN_FLICKER
+ ld a, OBJECT_ACTION_SPIN_FLICKER
.yes
ld hl, OBJECT_ACTION
add hl, bc
@@ -1684,7 +1699,7 @@ StepType0f: ; 4ecd
add hl, bc
ld a, [hl]
ld b, a
- callba CopyDECoordsToMapObject
+ farcall CopyDECoordsToMapObject
pop bc
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -1804,7 +1819,7 @@ SkyfallTop: ; 4f83
.Init:
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SKYFALL
+ ld [hl], OBJECT_ACTION_SKYFALL
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
@@ -1920,13 +1935,13 @@ Function5026: ; 5026
ret
; 5037
-_GetMovementPerson: ; 5037
- ld hl, GetMovementPerson
+_GetMovementObject: ; 5037
+ ld hl, GetMovementObject
jp HandleMovementData
; 503d
-GetMovementPerson: ; 503d
- ld a, [wMovementPerson]
+GetMovementObject: ; 503d
+ ld a, [wMovementObject]
ret
; 5041
@@ -2162,7 +2177,7 @@ InitTempObject: ; 55ac
ret nc
ld d, h
ld e, l
- callba CopyTempObjectToObjectStruct
+ farcall CopyTempObjectToObjectStruct
ret
; 55b9
@@ -2291,7 +2306,7 @@ Function565c: ; 565c
call Function56a3
jr c, SetFacing_Standing
call Function5688
- callba Function4440
+ farcall Function4440
xor a
ret
; 5673
@@ -2299,7 +2314,7 @@ Function565c: ; 565c
Function5673: ; 5673
call Function56a3
jr c, SetFacing_Standing
- callba Function4440 ; no need to farcall
+ farcall Function4440 ; no need to farcall
xor a
ret
; 5680
@@ -2325,7 +2340,7 @@ Function5688: ; 5688
ld hl, OBJECT_NEXT_TILE
add hl, bc
ld [hl], a
- callba UpdateTallGrassFlags ; no need to farcall
+ farcall UpdateTallGrassFlags ; no need to farcall
ret
; 56a3
@@ -2512,7 +2527,7 @@ RefreshPlayerSprite: ; 579d
ld [wPlayerTurningDirection], a
ld [PlayerObjectStepFrame], a
call .TryResetPlayerAction
- callba CheckWarpFacingDown
+ farcall CheckWarpFacingDown
call c, SpawnInFacingDown
call .SpawnInCustomFacing
ret
@@ -2525,7 +2540,7 @@ RefreshPlayerSprite: ; 579d
ret
.ok
- ld a, PERSON_ACTION_00
+ ld a, OBJECT_ACTION_00
ld [PlayerAction], a
ret
; 57ca
@@ -2581,7 +2596,7 @@ StartFollow:: ; 5803
ret c
ld a, c
call SetFollowerIfVisible
- callba QueueFollowerFirstStep
+ farcall QueueFollowerFirstStep
ret
; 5815
@@ -2627,7 +2642,7 @@ ResetFollower: ; 5847
cp -1
ret z
call GetObjectStruct
- callba Function58e3 ; no need to bankswitch
+ farcall Function58e3 ; no need to bankswitch
ld a, -1
ld [wObjectFollow_Follower], a
ret
diff --git a/engine/map_objects_2.asm b/engine/map_objects_2.asm
new file mode 100644
index 000000000..3c9a9773c
--- /dev/null
+++ b/engine/map_objects_2.asm
@@ -0,0 +1,70 @@
+LoadObjectMasks: ; 2454f
+ ld hl, wObjectMasks
+ xor a
+ ld bc, NUM_OBJECTS
+ call ByteFill
+ nop
+ ld bc, MapObjects
+ ld de, wObjectMasks
+ xor a
+.loop
+ push af
+ push bc
+ push de
+ call GetObjectTimeMask
+ jr c, .next
+ call CheckObjectFlag
+.next
+ pop de
+ ld [de], a
+ inc de
+ pop bc
+ ld hl, OBJECT_LENGTH
+ add hl, bc
+ ld b, h
+ ld c, l
+ pop af
+ inc a
+ cp NUM_OBJECTS
+ jr nz, .loop
+ ret
+
+CheckObjectFlag: ; 2457d (9:457d)
+ ld hl, MAPOBJECT_SPRITE
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .masked
+ ld hl, MAPOBJECT_EVENT_FLAG
+ add hl, bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+ cp -1
+ jr nz, .check
+ ld a, e
+ cp -1
+ jr z, .unmasked
+ jr .masked
+.check
+ ld b, CHECK_FLAG
+ call EventFlagAction
+ ld a, c
+ and a
+ jr nz, .masked
+.unmasked
+ xor a
+ ret
+
+.masked
+ ld a, -1
+ scf
+ ret
+
+GetObjectTimeMask: ; 245a7 (9:45a7)
+ call CheckObjectTime
+ ld a, -1
+ ret c
+ xor a
+ ret
diff --git a/engine/map_palettes.asm b/engine/map_palettes.asm
new file mode 100644
index 000000000..ffeef7bf6
--- /dev/null
+++ b/engine/map_palettes.asm
@@ -0,0 +1,86 @@
+SwapTextboxPalettes:: ; 4c000
+ hlcoord 0, 0
+ decoord 0, 0, AttrMap
+ ld b, SCREEN_HEIGHT
+.loop
+ push bc
+ ld c, SCREEN_WIDTH
+.innerloop
+ ld a, [hl]
+ push hl
+ srl a
+ jr c, .UpperNybble
+ ld hl, TilesetPalettes
+ add [hl]
+ ld l, a
+ ld a, [TilesetPalettes + 1]
+ adc $0
+ ld h, a
+ ld a, [hl]
+ and $f
+ jr .next
+
+.UpperNybble:
+ ld hl, TilesetPalettes
+ add [hl]
+ ld l, a
+ ld a, [TilesetPalettes + 1]
+ adc $0
+ ld h, a
+ ld a, [hl]
+ swap a
+ and $f
+
+.next
+ pop hl
+ ld [de], a
+ res 7, [hl]
+ inc hl
+ inc de
+ dec c
+ jr nz, .innerloop
+ pop bc
+ dec b
+ jr nz, .loop
+ ret
+
+ScrollBGMapPalettes:: ; 4c03f
+ ld hl, BGMapBuffer
+ ld de, BGMapPalBuffer
+.loop
+ ld a, [hl]
+ push hl
+ srl a
+ jr c, .UpperNybble
+
+; .LowerNybble
+ ld hl, TilesetPalettes
+ add [hl]
+ ld l, a
+ ld a, [TilesetPalettes + 1]
+ adc $0
+ ld h, a
+ ld a, [hl]
+ and $f
+ jr .next
+
+.UpperNybble:
+ ld hl, TilesetPalettes
+ add [hl]
+ ld l, a
+ ld a, [TilesetPalettes + 1]
+ adc $0
+ ld h, a
+ ld a, [hl]
+ swap a
+ and $f
+
+.next
+ pop hl
+ ld [de], a
+ res 7, [hl]
+ inc hl
+ inc de
+ dec c
+ jr nz, .loop
+ ret
diff --git a/engine/map_setup.asm b/engine/map_setup.asm
index dc013ffdd..01f3d05d7 100644
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -308,8 +308,8 @@ SuspendMapAnims: ; 154d3
LoadObjectsRunCallback_02: ; 154d7
ld a, MAPCALLBACK_OBJECTS
call RunMapCallback
- callba LoadObjectMasks
- callba InitializeVisibleSprites
+ farcall LoadObjectMasks
+ farcall InitializeVisibleSprites
ret
; 154ea (5:54ea)
@@ -356,16 +356,16 @@ CheckReplaceKrisSprite: ; 154f7
ld a, [PlayerState]
cp PLAYER_NORMAL
jr z, .nope
- cp PLAYER_SLIP
+ cp PLAYER_SKATE
jr z, .nope
cp PLAYER_SURF
jr z, .surfing
cp PLAYER_SURF_PIKA
jr z, .surfing
- call GetMapPermission
+ call GetMapEnvironment
cp INDOOR
jr z, .checkbiking
- cp PERM_5
+ cp ENVIRONMENT_5
jr z, .checkbiking
cp DUNGEON
jr z, .checkbiking
@@ -409,14 +409,14 @@ FadeOldMapMusic: ; 15567
; 1556d
RetainOldPalettes: ; 1556d
- callba _UpdateTimePals
+ farcall _UpdateTimePals
ret
RotatePalettesRightMapAndMusic: ; 15574
ld e, 0
- ld a, [MusicFadeIDLo]
+ ld a, [MusicFadeID]
ld d, 0
- ld a, [MusicFadeIDHi]
+ ld a, [MusicFadeID + 1]
ld a, $4
ld [MusicFade], a
call RotateThreePalettesRight
diff --git a/engine/map_triggers.asm b/engine/map_triggers.asm
deleted file mode 100644
index 2b190fa3e..000000000
--- a/engine/map_triggers.asm
+++ /dev/null
@@ -1,91 +0,0 @@
-MapTriggers:: ; 4d01e
-; Map triggers
-
-trigger_def: MACRO
-; db group, map
-; dw address
- map \1
- dw \2
-ENDM
-
- trigger_def POKECENTER_2F, wPokecenter2FTrigger
- trigger_def TRADE_CENTER, wTradeCenterTrigger
- trigger_def COLOSSEUM, wColosseumTrigger
- trigger_def TIME_CAPSULE, wTimeCapsuleTrigger
- trigger_def POWER_PLANT, wPowerPlantTrigger
- trigger_def CERULEAN_GYM, wCeruleanGymTrigger
- trigger_def ROUTE_25, wRoute25Trigger
- trigger_def TRAINER_HOUSE_B1F, wTrainerHouseB1FTrigger
- trigger_def VICTORY_ROAD_GATE, wVictoryRoadGateTrigger
- trigger_def SAFFRON_TRAIN_STATION, wSaffronTrainStationTrigger
- trigger_def ROUTE_16_GATE, wRoute16GateTrigger
- trigger_def ROUTE_17_18_GATE, wRoute1718GateTrigger
- trigger_def INDIGO_PLATEAU_POKECENTER_1F, wIndigoPlateauPokecenter1FTrigger
- trigger_def WILLS_ROOM, wWillsRoomTrigger
- trigger_def KOGAS_ROOM, wKogasRoomTrigger
- trigger_def BRUNOS_ROOM, wBrunosRoomTrigger
- trigger_def KARENS_ROOM, wKarensRoomTrigger
- trigger_def LANCES_ROOM, wLancesRoomTrigger
- trigger_def HALL_OF_FAME, wHallOfFameTrigger
- trigger_def ROUTE_27, wRoute27Trigger
- trigger_def NEW_BARK_TOWN, wNewBarkTownTrigger
- trigger_def ELMS_LAB, wElmsLabTrigger
- trigger_def KRISS_HOUSE_1F, wKrissHouse1FTrigger
- trigger_def ROUTE_29, wRoute29Trigger
- trigger_def CHERRYGROVE_CITY, wCherrygroveCityTrigger
- trigger_def MR_POKEMONS_HOUSE, wMrPokemonsHouseTrigger
- trigger_def ROUTE_32, wRoute32Trigger
- trigger_def ROUTE_35_NATIONAL_PARK_GATE, wRoute35NationalParkGateTrigger
- trigger_def ROUTE_36, wRoute36Trigger
- trigger_def ROUTE_36_NATIONAL_PARK_GATE, wRoute36NationalParkGateTrigger
- trigger_def AZALEA_TOWN, wAzaleaTownTrigger
- trigger_def GOLDENROD_GYM, wGoldenrodGymTrigger
- trigger_def GOLDENROD_MAGNET_TRAIN_STATION, wGoldenrodMagnetTrainStationTrigger
- trigger_def GOLDENROD_POKECENTER_1F, wGoldenrodPokecenter1FTrigger
- trigger_def OLIVINE_CITY, wOlivineCityTrigger
- trigger_def ROUTE_34, wRoute34Trigger
- trigger_def ROUTE_34_ILEX_FOREST_GATE, wRoute34IlexForestGateTrigger
- trigger_def ECRUTEAK_HOUSE, wEcruteakHouseTrigger
- trigger_def WISE_TRIOS_ROOM, wWiseTriosRoomTrigger
- trigger_def ECRUTEAK_POKECENTER_1F, wEcruteakPokecenter1FTrigger
- trigger_def ECRUTEAK_GYM, wEcruteakGymTrigger
- trigger_def MAHOGANY_TOWN, wMahoganyTownTrigger
- trigger_def ROUTE_42, wRoute42Trigger
- trigger_def CIANWOOD_CITY, wCianwoodCityTrigger
- trigger_def BATTLE_TOWER_1F, wBattleTower1FTrigger
- trigger_def BATTLE_TOWER_BATTLE_ROOM, wBattleTowerBattleRoomTrigger
- trigger_def BATTLE_TOWER_ELEVATOR, wBattleTowerElevatorTrigger
- trigger_def BATTLE_TOWER_HALLWAY, wBattleTowerHallwayTrigger
- trigger_def BATTLE_TOWER_OUTSIDE, wBattleTowerOutsideTrigger
- trigger_def ROUTE_43_GATE, wRoute43GateTrigger
- trigger_def MOUNT_MOON, wMountMoonTrigger
- trigger_def SPROUT_TOWER_3F, wSproutTower3FTrigger
- trigger_def TIN_TOWER_1F, wTinTower1FTrigger
- trigger_def BURNED_TOWER_1F, wBurnedTower1FTrigger
- trigger_def BURNED_TOWER_B1F, wBurnedTowerB1FTrigger
- trigger_def RADIO_TOWER_5F, wRadioTower5FTrigger
- trigger_def RUINS_OF_ALPH_OUTSIDE, wRuinsOfAlphOutsideTrigger
- trigger_def RUINS_OF_ALPH_RESEARCH_CENTER, wRuinsOfAlphResearchCenterTrigger
- trigger_def RUINS_OF_ALPH_HO_OH_CHAMBER, wRuinsOfAlphHoOhChamberTrigger
- trigger_def RUINS_OF_ALPH_KABUTO_CHAMBER, wRuinsOfAlphKabutoChamberTrigger
- trigger_def RUINS_OF_ALPH_OMANYTE_CHAMBER, wRuinsOfAlphOmanyteChamberTrigger
- trigger_def RUINS_OF_ALPH_AERODACTYL_CHAMBER, wRuinsOfAlphAerodactylChamberTrigger
- trigger_def RUINS_OF_ALPH_INNER_CHAMBER, wRuinsOfAlphInnerChamberTrigger
- trigger_def MAHOGANY_MART_1F, wMahoganyMart1FTrigger
- trigger_def TEAM_ROCKET_BASE_B1F, wTeamRocketBaseB1FTrigger
- trigger_def TEAM_ROCKET_BASE_B2F, wTeamRocketBaseB2FTrigger
- trigger_def TEAM_ROCKET_BASE_B3F, wTeamRocketBaseB3FTrigger
- trigger_def UNDERGROUND_PATH_SWITCH_ROOM_ENTRANCES, wUndergroundPathSwitchRoomEntrancesTrigger
- trigger_def SILVER_CAVE_ROOM_3, wSilverCaveRoom3Trigger
- trigger_def VICTORY_ROAD, wVictoryRoadTrigger
- trigger_def DRAGONS_DEN_B1F, wDragonsDenB1FTrigger
- trigger_def DRAGON_SHRINE, wDragonShrineTrigger
- trigger_def OLIVINE_PORT, wOlivinePortTrigger
- trigger_def VERMILION_PORT, wVermilionPortTrigger
- trigger_def FAST_SHIP_1F, wFastShip1FTrigger
- trigger_def FAST_SHIP_B1F, wFastShipB1FTrigger
- trigger_def MOUNT_MOON_SQUARE, wMountMoonSquareTrigger
- trigger_def MOBILE_TRADE_ROOM_MOBILE, wMobileTradeRoomMobileTrigger
- trigger_def MOBILE_BATTLE_ROOM, wMobileBattleRoomTrigger
- db -1
-; 4d15b
diff --git a/engine/mart.asm b/engine/mart.asm
index 7002902cc..55c184737 100755
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -99,23 +99,7 @@ RooftopSale: ; 15ac4
ret
; 15aee
-RooftopSaleData1: ; 15aee
- db 5
- dbw POKE_BALL, 150
- dbw GREAT_BALL, 500
- dbw SUPER_POTION, 500
- dbw FULL_HEAL, 500
- dbw REVIVE, 1200
- db -1
-RooftopSaleData2: ; 15aff
- db 5
- dbw HYPER_POTION, 1000
- dbw FULL_RESTORE, 2000
- dbw FULL_HEAL, 500
- dbw ULTRA_BALL, 1000
- dbw PROTEIN, 7800
- db -1
-; 15b10
+INCLUDE "data/items/rooftop_sale.asm"
LoadMartPointer: ; 15b10
ld a, b
@@ -268,7 +252,7 @@ GetMartItemPrice: ; 15be5
; Return the price of item a in BCD at hl and in tiles at StringBuffer1.
push hl
ld [CurItem], a
- callba GetItemPrice
+ farcall GetItemPrice
pop hl
GetMartPrice: ; 15bf0
@@ -355,24 +339,16 @@ ReadMart: ; 15c25
ret
; 15c51
-BargainShopData: ; 15c51
- db 5
- dbw NUGGET, 4500
- dbw PEARL, 650
- dbw BIG_PEARL, 3500
- dbw STARDUST, 900
- dbw STAR_PIECE, 4600
- db -1
-; 15c62
+INCLUDE "data/items/bargain_shop.asm"
BuyMenu: ; 15c62
call FadeToMenu
- callba BlankScreen
+ farcall BlankScreen
xor a
- ld [wd045 + 1], a
+ ld [wMenuScrollPositionBackup], a
ld a, 1
- ld [wd045], a
+ ld [wMenuCursorBufferBackup], a
.loop
call BuyMenuLoop ; menu loop
jr nc, .loop
@@ -467,19 +443,19 @@ GetMartDialogGroup: ; 15ca3
BuyMenuLoop: ; 15cef
- callba PlaceMoneyTopRight
+ farcall PlaceMoneyTopRight
call UpdateSprites
ld hl, MenuDataHeader_Buy
call CopyMenuDataHeader
- ld a, [wd045]
+ ld a, [wMenuCursorBufferBackup]
ld [wMenuCursorBuffer], a
- ld a, [wd045 + 1]
+ ld a, [wMenuScrollPositionBackup]
ld [wMenuScrollPosition], a
call ScrollingMenu
ld a, [wMenuScrollPosition]
- ld [wd045 + 1], a
+ ld [wMenuScrollPositionBackup], a
ld a, [wMenuCursorY]
- ld [wd045], a
+ ld [wMenuCursorBufferBackup], a
call SpeechTextBox
ld a, [wMenuJoypad]
cp B_BUTTON
@@ -543,7 +519,7 @@ StandardMartAskPurchaseQuantity:
ld [wItemQuantityBuffer], a
ld a, MARTTEXT_HOW_MANY
call LoadBuyMenuText
- callba SelectQuantityToBuy
+ farcall SelectQuantityToBuy
call ExitMenu
ret
; 15d97
@@ -603,7 +579,7 @@ RooftopSaleAskPurchaseQuantity:
call .GetSalePrice
ld a, 99
ld [wItemQuantityBuffer], a
- callba RooftopSale_SelectQuantityToBuy
+ farcall RooftopSale_SelectQuantityToBuy
call ExitMenu
ret
; 15df9
@@ -806,9 +782,9 @@ Text_Pharmacist_ComeAgain: ; 0x15eae
SellMenu: ; 15eb3
call DisableSpriteUpdates
- callba DepositSellInitPackBuffers
+ farcall DepositSellInitPackBuffers
.loop
- callba DepositSellPack
+ farcall DepositSellPack
ld a, [wcf66]
and a
jp z, .quit
@@ -836,7 +812,7 @@ SellMenu: ; 15eb3
.TryToSellItem: ; 15ee0
- callba CheckItemMenu
+ farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .dw
rst JumpTable
@@ -859,7 +835,7 @@ SellMenu: ; 15eb3
.try_sell ; 15efd
- callba _CheckTossableItem
+ farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
jr z, .okay_to_sell
@@ -871,8 +847,8 @@ SellMenu: ; 15eb3
.okay_to_sell
ld hl, Text_Mart_SellHowMany
call PrintText
- callba PlaceMoneyAtTopLeftOfTextbox
- callba SelectQuantityToSell
+ farcall PlaceMoneyAtTopLeftOfTextbox
+ farcall SelectQuantityToSell
call ExitMenu
jr c, .declined
hlcoord 1, 14
@@ -895,7 +871,7 @@ SellMenu: ; 15eb3
ld hl, Text_Mart_SoldForAmount
call PrintTextBoxText
call PlayTransactionSound
- callba PlaceMoneyBottomLeft
+ farcall PlaceMoneyBottomLeft
call JoyWaitAorB
.declined
diff --git a/engine/menu.asm b/engine/menu.asm
index e84d8d597..6fbed2848 100755
--- a/engine/menu.asm
+++ b/engine/menu.asm
@@ -16,7 +16,7 @@ _InterpretBattleMenu:: ; 24022
rst FarCall
call Draw2DMenu
- callba MobileTextBorder
+ farcall MobileTextBorder
call UpdateSprites
call ApplyTilemap
call Get2DMenuSelection
@@ -29,7 +29,7 @@ _InterpretMobileMenu:: ; 2403c
rst FarCall
call Draw2DMenu
- callba MobileTextBorder
+ farcall MobileTextBorder
call UpdateSprites
call ApplyTilemap
call Init2DMenuCursorPosition
@@ -37,7 +37,7 @@ _InterpretMobileMenu:: ; 2403c
set 7, [hl]
.loop
call DelayFrame
- callba Function10032e
+ farcall Function10032e
ld a, [wcd2b]
and a
jr nz, .quit
@@ -322,7 +322,7 @@ Function241d5: ; 241d5
call AdvanceMobileInactivityTimerAndCheckExpired ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
ret c
- callba Function100337
+ farcall Function100337
ret c
ld a, [w2DMenuFlags1]
bit 7, a
@@ -382,7 +382,7 @@ Menu_WasButtonPressed: ; 24259
ld a, [w2DMenuFlags1]
bit 6, a
jr z, .skip_to_joypad
- callab PlaySpriteAnimationsAndDelayFrame
+ callfar PlaySpriteAnimationsAndDelayFrame
.skip_to_joypad
call JoyTextDelay
diff --git a/engine/menu_2.asm b/engine/menu_2.asm
new file mode 100644
index 000000000..d88b75152
--- /dev/null
+++ b/engine/menu_2.asm
@@ -0,0 +1,263 @@
+PlaceMenuItemName: ; 0x24ab4
+ push de
+ ld a, [MenuSelection]
+ ld [wNamedObjectIndexBuffer], a
+ call GetItemName
+ pop hl
+ call PlaceString
+ ret
+
+PlaceMenuItemQuantity: ; 0x24ac3
+ push de
+ ld a, [MenuSelection]
+ ld [CurItem], a
+ farcall _CheckTossableItem
+ ld a, [wItemAttributeParamBuffer]
+ pop hl
+ and a
+ jr nz, .done
+ ld de, $15
+ add hl, de
+ ld [hl], "×"
+ inc hl
+ ld de, MenuSelectionQuantity
+ lb bc, 1, 2
+ call PrintNum
+
+.done
+ ret
+
+PlaceMoneyTopRight: ; 24ae8
+ ld hl, MenuDataHeader_0x24b15
+ call CopyMenuDataHeader
+ jr PlaceMoneyDataHeader
+
+PlaceMoneyBottomLeft: ; 24af0
+ ld hl, MenuDataHeader_0x24b1d
+ call CopyMenuDataHeader
+ jr PlaceMoneyDataHeader
+
+PlaceMoneyAtTopLeftOfTextbox: ; 24af8
+ ld hl, MenuDataHeader_0x24b15
+ lb de, 0, 11
+ call OffsetMenuDataHeader
+
+PlaceMoneyDataHeader: ; 24b01
+ call MenuBox
+ call MenuBoxCoord2Tile
+ ld de, SCREEN_WIDTH + 1
+ add hl, de
+ ld de, Money
+ lb bc, PRINTNUM_MONEY | 3, 6
+ call PrintNum
+ ret
+
+MenuDataHeader_0x24b15: ; 0x24b15
+ db $40 ; flags
+ db 00, 11 ; start coords
+ db 02, 19 ; end coords
+ dw NULL
+ db 1 ; default option
+
+MenuDataHeader_0x24b1d: ; 0x24b1d
+ db $40 ; flags
+ db 11, 00 ; start coords
+ db 13, 08 ; end coords
+ dw NULL
+ db 1 ; default option
+
+Special_DisplayCoinCaseBalance: ; 24b25
+ ; Place a text box of size 1x7 at 11, 0.
+ hlcoord 11, 0
+ ld b, 1
+ ld c, 7
+ call TextBox
+ hlcoord 12, 0
+ ld de, CoinString
+ call PlaceString
+ hlcoord 17, 1
+ ld de, ShowMoney_TerminatorString
+ call PlaceString
+ ld de, Coins
+ lb bc, 2, 4
+ hlcoord 13, 1
+ call PrintNum
+ ret
+
+Special_DisplayMoneyAndCoinBalance: ; 24b4e
+ hlcoord 5, 0
+ ld b, 3
+ ld c, 13
+ call TextBox
+ hlcoord 6, 1
+ ld de, MoneyString
+ call PlaceString
+ hlcoord 12, 1
+ ld de, Money
+ lb bc, PRINTNUM_MONEY | 3, 6
+ call PrintNum
+ hlcoord 6, 3
+ ld de, CoinString
+ call PlaceString
+ hlcoord 15, 3
+ ld de, Coins
+ lb bc, 2, 4
+ call PrintNum
+ ret
+
+MoneyString: ; 24b83
+ db "MONEY@"
+CoinString: ; 24b89
+ db "COIN@"
+ShowMoney_TerminatorString: ; 24b8e
+ db "@"
+
+Function24b8f: ; 24b8f
+; unreferenced, related to safari?
+ ld hl, Options
+ ld a, [hl]
+ push af
+ set NO_TEXT_SCROLL, [hl]
+ hlcoord 0, 0
+ ld b, 3
+ ld c, 7
+ call TextBox
+ hlcoord 1, 1
+ ld de, wSafariTimeRemaining
+ lb bc, 2, 3
+ call PrintNum
+ hlcoord 4, 1
+ ld de, .slash_500
+ call PlaceString
+ hlcoord 1, 3
+ ld de, .booru_ko
+ call PlaceString
+ hlcoord 5, 3
+ ld de, wSafariBallsRemaining
+ lb bc, 1, 2
+ call PrintNum
+ pop af
+ ld [Options], a
+ ret
+
+.slash_500 ; 24bcf
+ db "/500@"
+.booru_ko ; 24bd4
+ db "ボール こ@"
+
+StartMenu_DrawBugContestStatusBox: ; 24bdc
+ hlcoord 0, 0
+ ld b, 5
+ ld c, 17
+ call TextBox
+ ret
+
+StartMenu_PrintBugContestStatus: ; 24be7
+ ld hl, Options
+ ld a, [hl]
+ push af
+ set NO_TEXT_SCROLL, [hl]
+ call StartMenu_DrawBugContestStatusBox
+ hlcoord 1, 5
+ ld de, .Balls_EN
+ call PlaceString
+ hlcoord 8, 5
+ ld de, wParkBallsRemaining
+ lb bc, PRINTNUM_RIGHTALIGN | 1, 2
+ call PrintNum
+ hlcoord 1, 1
+ ld de, .CAUGHT
+ call PlaceString
+ ld a, [wContestMon]
+ and a
+ ld de, .None
+ jr z, .no_contest_mon
+ ld [wd265], a
+ call GetPokemonName
+
+.no_contest_mon
+ hlcoord 8, 1
+ call PlaceString
+ ld a, [wContestMon]
+ and a
+ jr z, .skip_level
+ hlcoord 1, 3
+ ld de, .LEVEL
+ call PlaceString
+ ld a, [wContestMonLevel]
+ ld h, b
+ ld l, c
+ inc hl
+ ld c, 3
+ call Print8BitNumRightAlign
+
+.skip_level
+ pop af
+ ld [Options], a
+ ret
+
+.Balls_JP: ; 24c43
+ db "ボール こ@"
+.CAUGHT: ; 24c4b
+ db "CAUGHT@"
+.Balls_EN: ; 24c52
+ db "BALLS:@"
+.None: ; 24c59
+ db "None@"
+.LEVEL: ; 24c5e
+ db "LEVEL@"
+
+FindApricornsInBag: ; 24c64
+; Checks the bag for Apricorns.
+ ld hl, Buffer1
+ xor a
+ ld [hli], a
+ dec a
+ ld bc, 10
+ call ByteFill
+
+ ld hl, .ApricornBalls
+.loop
+ ld a, [hl]
+ cp -1
+ jr z, .done
+ push hl
+ ld [CurItem], a
+ ld hl, NumItems
+ call CheckItem
+ pop hl
+ jr nc, .nope
+ ld a, [hl]
+ call .addtobuffer
+.nope
+ inc hl
+ inc hl
+ jr .loop
+
+.done
+ ld a, [Buffer1]
+ and a
+ ret nz
+ scf
+ ret
+
+.addtobuffer ; 24c94
+ push hl
+ ld hl, Buffer1
+ inc [hl]
+ ld e, [hl]
+ ld d, 0
+ add hl, de
+ ld [hl], a
+ pop hl
+ ret
+
+.ApricornBalls: ; 24ca0
+ db RED_APRICORN, LEVEL_BALL
+ db BLU_APRICORN, LURE_BALL
+ db YLW_APRICORN, MOON_BALL
+ db GRN_APRICORN, FRIEND_BALL
+ db WHT_APRICORN, FAST_BALL
+ db BLK_APRICORN, HEAVY_BALL
+ db PNK_APRICORN, LOVE_BALL
+ db -1
diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm
index d66ea6fac..965d9f0ef 100755
--- a/engine/mon_icons.asm
+++ b/engine/mon_icons.asm
@@ -66,7 +66,7 @@ LoadMenuMonIcon: ; 8e83f
push hl
push bc
ld d, a
- callab ItemIsMail
+ callfar ItemIsMail
pop bc
pop hl
jr c, .not_mail
@@ -140,15 +140,15 @@ PartyMenu_InitAnimatedMonIcon: ; 8e8d5 (23:68d5)
push hl
push bc
ld d, a
- callab ItemIsMail
+ callfar ItemIsMail
pop bc
pop hl
jr c, .mail
- ld a, SPRITE_ANIM_FRAMESET_03
+ ld a, SPRITE_ANIM_FRAMESET_PARTY_MON_WITH_ITEM
jr .okay
.mail
- ld a, SPRITE_ANIM_FRAMESET_02
+ ld a, SPRITE_ANIM_FRAMESET_PARTY_MON_WITH_MAIL
.okay
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
@@ -178,7 +178,7 @@ InitPartyMenuIcon: ; 8e908 (23:6908)
; x coord
ld e, $10
; type is partymon icon
- ld a, SPRITE_ANIM_INDEX_00
+ ld a, SPRITE_ANIM_INDEX_PARTY_MON
call InitSpriteAnimStruct
pop af
ld hl, SPRITEANIMSTRUCT_TILE_ID
@@ -204,7 +204,7 @@ SetPartyMonIconAnimSpeed: ; 8e936 (23:6936)
ret
.getspeed ; 8e94c (23:694c)
- callba PlacePartymonHPBar
+ farcall PlacePartymonHPBar
call GetHPPal
ld e, d
ld d, 0
@@ -215,7 +215,9 @@ SetPartyMonIconAnimSpeed: ; 8e936 (23:6936)
; 8e95e (23:695e)
.speeds ; 8e95e
- db $00, $40, $80
+ db $00 ; HP_GREEN
+ db $40 ; HP_YELLOW
+ db $80 ; HP_RED
; 8e961
NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961)
@@ -225,7 +227,7 @@ NamingScreen_InitAnimatedMonIcon: ; 8e961 (23:6961)
xor a
call GetIconGFX
depixel 4, 4, 4, 0
- ld a, SPRITE_ANIM_INDEX_00
+ ld a, SPRITE_ANIM_INDEX_PARTY_MON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
@@ -238,9 +240,9 @@ MoveList_InitAnimatedMonIcon: ; 8e97d (23:697d)
ld [CurIcon], a
xor a
call GetIconGFX
- ld d, 3 * 8 + 2
+ ld d, 3 * 8 + 2 ; depixel 3, 4, 2, 4
ld e, 4 * 8 + 4
- ld a, SPRITE_ANIM_INDEX_00
+ ld a, SPRITE_ANIM_INDEX_PARTY_MON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
@@ -295,7 +297,7 @@ GetMemIconGFX: ; 8e9db (23:69db)
ld a, [wCurIconTile]
GetIconGFX: ; 8e9de
call GetIcon_a
- ld de, $80 ; 8 tiles
+ ld de, 8 tiles
add hl, de
ld de, HeldItemIcons
lb bc, BANK(HeldItemIcons), 2
@@ -376,7 +378,7 @@ FreezeMonIcons: ; 8ea4a
jr .ok
.loadwithtwo
- ld a, SPRITE_ANIM_SEQ_02
+ ld a, SPRITE_ANIM_SEQ_PARTY_MON_SWITCH
.ok
push hl
@@ -407,7 +409,7 @@ UnfreezeMonIcons: ; 8ea71
ld b, h
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
- ld [hl], SPRITE_ANIM_SEQ_01
+ ld [hl], SPRITE_ANIM_SEQ_PARTY_MON
pop hl
.next
ld bc, $10
@@ -428,11 +430,11 @@ HoldSwitchmonIcon: ; 8ea8c
jr z, .next
cp d
jr z, .is_switchmon
- ld a, SPRITE_ANIM_SEQ_03
+ ld a, SPRITE_ANIM_SEQ_PARTY_MON_SELECTED
jr .join_back
.is_switchmon
- ld a, SPRITE_ANIM_SEQ_02
+ ld a, SPRITE_ANIM_SEQ_PARTY_MON_SWITCH
.join_back
push hl
ld c, l
@@ -448,4 +450,24 @@ HoldSwitchmonIcon: ; 8ea8c
jr nz, .loop
ret
-INCLUDE "menu/mon_icons.asm"
+ReadMonMenuIcon: ; 8eab3
+ cp EGG
+ jr z, .egg
+ dec a
+ ld hl, MonMenuIcons
+ ld e, a
+ ld d, 0
+ add hl, de
+ ld a, [hl]
+ ret
+.egg
+ ld a, ICON_EGG
+ ret
+; 8eac4
+
+
+INCLUDE "data/pokemon/menu_icons.asm"
+
+INCLUDE "gfx/icon_pointers.asm"
+
+INCLUDE "gfx/icons.asm"
diff --git a/engine/mon_menu.asm b/engine/mon_menu.asm
index a6dcf0eb7..dc6cd5cc8 100755
--- a/engine/mon_menu.asm
+++ b/engine/mon_menu.asm
@@ -9,8 +9,7 @@ MonMenuOptionStrings: ; 24caf
; 24cd9
MonMenuOptions: ; 24cd9
-
-; Moves
+; moves
db MONMENU_FIELD_MOVE, MONMENU_CUT, CUT
db MONMENU_FIELD_MOVE, MONMENU_FLY, FLY
db MONMENU_FIELD_MOVE, MONMENU_SURF, SURF
@@ -25,8 +24,7 @@ MonMenuOptions: ; 24cd9
db MONMENU_FIELD_MOVE, MONMENU_ROCKSMASH, ROCK_SMASH
db MONMENU_FIELD_MOVE, MONMENU_MILKDRINK, MILK_DRINK
db MONMENU_FIELD_MOVE, MONMENU_SWEETSCENT, SWEET_SCENT
-
-; Options
+; options
db MONMENU_MENUOPTION, MONMENU_STATS, 1 ; STATS
db MONMENU_MENUOPTION, MONMENU_SWITCH, 2 ; SWITCH
db MONMENU_MENUOPTION, MONMENU_ITEM, 3 ; ITEM
@@ -34,7 +32,6 @@ MonMenuOptions: ; 24cd9
db MONMENU_MENUOPTION, MONMENU_MOVE, 5 ; MOVE
db MONMENU_MENUOPTION, MONMENU_MAIL, 6 ; MAIL
db MONMENU_MENUOPTION, MONMENU_ERROR, 7 ; ERROR!
-
db -1
; 24d19
@@ -42,7 +39,7 @@ MonSubmenu: ; 24d19
xor a
ld [hBGMapMode], a
call GetMonSubmenuItems
- callba FreezeMonIcons
+ farcall FreezeMonIcons
ld hl, .MenuDataHeader
call LoadMenuDataHeader
call .GetTopCoord
@@ -205,7 +202,7 @@ GetMonSubmenuItems: ; 24dd4
ld a, MON_ITEM
call GetPartyParamLocation
ld d, [hl]
- callba ItemIsMail
+ farcall ItemIsMail
pop hl
ld a, MONMENU_MAIL
jr c, .ok
@@ -216,7 +213,7 @@ GetMonSubmenuItems: ; 24dd4
.skip2
ld a, [Buffer1]
- cp NUM_MON_SUBMENU_ITEMS
+ cp NUM_MONMENU_ITEMS
jr z, .ok2
ld a, MONMENU_CANCEL
call AddMonMenuItem
@@ -261,7 +258,7 @@ ResetMonSubmenu: ; 24e68
xor a
ld [Buffer1], a
ld hl, Buffer2
- ld bc, NUM_MON_SUBMENU_ITEMS + 1
+ ld bc, NUM_MONMENU_ITEMS + 1
call ByteFill
ret
; 24e76
diff --git a/engine/mon_stats.asm b/engine/mon_stats.asm
new file mode 100644
index 000000000..a3039eefd
--- /dev/null
+++ b/engine/mon_stats.asm
@@ -0,0 +1,486 @@
+DrawPlayerHP: ; 50b0a
+ ld a, $1
+ jr DrawHP
+
+DrawEnemyHP: ; 50b0e
+ ld a, $2
+
+DrawHP: ; 50b10
+ ld [wWhichHPBar], a
+ push hl
+ push bc
+ ; box mons have full HP
+ ld a, [MonType]
+ cp BOXMON
+ jr z, .at_least_1_hp
+
+ ld a, [TempMonHP]
+ ld b, a
+ ld a, [TempMonHP + 1]
+ ld c, a
+
+; Any HP?
+ or b
+ jr nz, .at_least_1_hp
+
+ xor a
+ ld c, a
+ ld e, a
+ ld a, 6
+ ld d, a
+ jp .fainted
+
+.at_least_1_hp
+ ld a, [TempMonMaxHP]
+ ld d, a
+ ld a, [TempMonMaxHP + 1]
+ ld e, a
+ ld a, [MonType]
+ cp BOXMON
+ jr nz, .not_boxmon
+
+ ld b, d
+ ld c, e
+
+.not_boxmon
+ predef ComputeHPBarPixels
+ ld a, 6
+ ld d, a
+ ld c, a
+
+.fainted
+ ld a, c
+ pop bc
+ ld c, a
+ pop hl
+ push de
+ push hl
+ push hl
+ call DrawBattleHPBar
+ pop hl
+
+; Print HP
+ bccoord 1, 1, 0
+ add hl, bc
+ ld de, TempMonHP
+ ld a, [MonType]
+ cp BOXMON
+ jr nz, .not_boxmon_2
+ ld de, TempMonMaxHP
+.not_boxmon_2
+ lb bc, 2, 3
+ call PrintNum
+
+ ld a, "/"
+ ld [hli], a
+
+; Print max HP
+ ld de, TempMonMaxHP
+ lb bc, 2, 3
+ call PrintNum
+ pop hl
+ pop de
+ ret
+
+PrintTempMonStats: ; 50b7b
+; Print TempMon's stats at hl, with spacing bc.
+ push bc
+ push hl
+ ld de, .StatNames
+ call PlaceString
+ pop hl
+ pop bc
+ add hl, bc
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ ld de, TempMonAttack
+ lb bc, 2, 3
+ call .PrintStat
+ ld de, TempMonDefense
+ call .PrintStat
+ ld de, TempMonSpclAtk
+ call .PrintStat
+ ld de, TempMonSpclDef
+ call .PrintStat
+ ld de, TempMonSpeed
+ jp PrintNum
+
+.PrintStat: ; 50bab
+ push hl
+ call PrintNum
+ pop hl
+ ld de, SCREEN_WIDTH * 2
+ add hl, de
+ ret
+
+.StatNames: ; 50bb5
+ db "ATTACK"
+ next "DEFENSE"
+ next "SPCL.ATK"
+ next "SPCL.DEF"
+ next "SPEED"
+ next "@"
+
+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.
+
+; return values:
+; a = 1: f = nc|nz; male
+; a = 0: f = nc|z; female
+; f = c: genderless
+
+; 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
+ ld hl, PartyMon1DVs
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld a, [MonType]
+ and a
+ jr z, .PartyMon
+
+; 1: OTPartyMon
+ ld hl, OTPartyMon1DVs
+ dec a
+ jr z, .PartyMon
+
+; 2: sBoxMon
+ ld hl, sBoxMon1DVs
+ ld bc, BOXMON_STRUCT_LENGTH
+ dec a
+ jr z, .sBoxMon
+
+; 3: Unknown
+ ld hl, TempMonDVs
+ dec a
+ jr z, .DVs
+
+; else: WildMon
+ ld hl, EnemyMonDVs
+ jr .DVs
+
+; Get our place in the party/box.
+
+.PartyMon:
+.sBoxMon
+ ld a, [CurPartyMon]
+ call AddNTimes
+
+.DVs:
+
+; sBoxMon data is read directly from SRAM.
+ ld a, [MonType]
+ cp BOXMON
+ ld a, 1
+ call z, GetSRAMBank
+
+; Attack DV
+ ld a, [hli]
+ and $f0
+ ld b, a
+; Speed DV
+ ld a, [hl]
+ and $f0
+ swap a
+
+; Put our DVs together.
+ or b
+ ld b, a
+
+; Close SRAM if we were dealing with a sBoxMon.
+ ld a, [MonType]
+ cp BOXMON
+ call z, CloseSRAM
+
+; We need the gender ratio to do anything with this.
+ push bc
+ ld a, [CurPartySpecies]
+ dec a
+ ld hl, BaseData + BASE_GENDER
+ ld bc, BASE_DATA_SIZE
+ call AddNTimes
+ pop bc
+
+ ld a, BANK(BaseData)
+ call GetFarByte
+
+; The higher the ratio, the more likely the monster is to be female.
+
+ cp GENDERLESS
+ jr z, .Genderless
+
+ and a ; GENDER_F0?
+ jr z, .Male
+
+ cp GENDER_F100
+ jr z, .Female
+
+; Values below the ratio are male, and vice versa.
+ cp b
+ jr c, .Male
+
+.Female:
+ xor a
+ ret
+
+.Male:
+ ld a, 1
+ and a
+ ret
+
+.Genderless:
+ scf
+ ret
+
+ListMovePP: ; 50c50
+ ld a, [wNumMoves]
+ inc a
+ ld c, a
+ ld a, NUM_MOVES
+ sub c
+ ld b, a
+ push hl
+ ld a, [Buffer1]
+ ld e, a
+ ld d, $0
+ ld a, $3e ; P
+ call .load_loop
+ ld a, b
+ and a
+ jr z, .skip
+ ld c, a
+ ld a, "-"
+ call .load_loop
+
+.skip
+ pop hl
+ inc hl
+ inc hl
+ inc hl
+ ld d, h
+ ld e, l
+ ld hl, TempMonMoves
+ ld b, 0
+.loop
+ ld a, [hli]
+ and a
+ jr z, .done
+ push bc
+ push hl
+ push de
+ ld hl, wMenuCursorY
+ ld a, [hl]
+ push af
+ ld [hl], b
+ push hl
+ callfar GetMaxPPOfMove
+ pop hl
+ pop af
+ ld [hl], a
+ pop de
+ pop hl
+ push hl
+ ld bc, TempMonPP - (TempMonMoves + 1)
+ add hl, bc
+ ld a, [hl]
+ and $3f
+ ld [StringBuffer1 + 4], a
+ ld h, d
+ ld l, e
+ push hl
+ ld de, StringBuffer1 + 4
+ lb bc, 1, 2
+ call PrintNum
+ ld a, "/"
+ ld [hli], a
+ ld de, wd265
+ lb bc, 1, 2
+ call PrintNum
+ pop hl
+ ld a, [Buffer1]
+ ld e, a
+ ld d, 0
+ add hl, de
+ ld d, h
+ ld e, l
+ pop hl
+ pop bc
+ inc b
+ ld a, b
+ cp NUM_MOVES
+ jr nz, .loop
+
+.done
+ ret
+
+.load_loop ; 50cc9
+ ld [hli], a
+ ld [hld], a
+ add hl, de
+ dec c
+ jr nz, .load_loop
+ ret
+
+Function50cd0: ; 50cd0
+; XXX
+.loop
+ ld [hl], $32
+ inc hl
+ ld [hl], $3e
+ dec hl
+ add hl, de
+ dec c
+ jr nz, .loop
+ ret
+
+Predef22: ; unreferenced predef
+ push hl
+ push hl
+ ld hl, PartyMonNicknames
+ ld a, [CurPartyMon]
+ call GetNick
+ pop hl
+ call PlaceString
+ call CopyPkmnToTempMon
+ pop hl
+ ld a, [CurPartySpecies]
+ cp EGG
+ jr z, .egg
+ push hl
+ ld bc, -12
+ add hl, bc
+ ld b, $0
+ call DrawEnemyHP
+ pop hl
+ ld bc, 5
+ add hl, bc
+ push de
+ call PrintLevel
+ pop de
+
+.egg
+ ret
+
+PlaceStatusString: ; 50d0a
+ push de
+ inc de
+ inc de
+ ld a, [de]
+ ld b, a
+ inc de
+ ld a, [de]
+ or b
+ pop de
+ jr nz, PlaceNonFaintStatus
+ push de
+ ld de, FntString
+ call CopyStatusString
+ pop de
+ ld a, $1
+ and a
+ ret
+
+FntString: ; 50d22
+ db "FNT@"
+
+CopyStatusString: ; 50d25
+ ld a, [de]
+ inc de
+ ld [hli], a
+ ld a, [de]
+ inc de
+ ld [hli], a
+ ld a, [de]
+ ld [hl], a
+ ret
+
+PlaceNonFaintStatus: ; 50d2e
+ push de
+ ld a, [de]
+ ld de, PsnString
+ bit PSN, a
+ jr nz, .place
+ ld de, BrnString
+ bit BRN, a
+ jr nz, .place
+ ld de, FrzString
+ bit FRZ, a
+ jr nz, .place
+ ld de, ParString
+ bit PAR, a
+ jr nz, .place
+ ld de, SlpString
+ and SLP
+ jr z, .no_status
+
+.place
+ call CopyStatusString
+ ld a, $1
+ and a
+
+.no_status
+ pop de
+ ret
+
+SlpString: db "SLP@"
+PsnString: db "PSN@"
+BrnString: db "BRN@"
+FrzString: db "FRZ@"
+ParString: db "PAR@"
+
+ListMoves: ; 50d6f
+; List moves at hl, spaced every [Buffer1] tiles.
+ ld de, wListMoves_MoveIndicesBuffer
+ ld b, $0
+.moves_loop
+ ld a, [de]
+ inc de
+ and a
+ jr z, .no_more_moves
+ push de
+ push hl
+ push hl
+ ld [CurSpecies], a
+ ld a, MOVE_NAME
+ ld [wNamedObjectTypeBuffer], a
+ call GetName
+ ld de, StringBuffer1
+ pop hl
+ push bc
+ call PlaceString
+ pop bc
+ ld a, b
+ ld [wNumMoves], a
+ inc b
+ pop hl
+ push bc
+ ld a, [Buffer1]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ pop bc
+ pop de
+ ld a, b
+ cp NUM_MOVES
+ jr z, .done
+ jr .moves_loop
+
+.no_more_moves
+ ld a, b
+.nonmove_loop
+ push af
+ ld [hl], "-"
+ ld a, [Buffer1]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ pop af
+ inc a
+ cp NUM_MOVES
+ jr nz, .nonmove_loop
+
+.done
+ ret
diff --git a/engine/money.asm b/engine/money.asm
index 874821814..60de97568 100755
--- a/engine/money.asm
+++ b/engine/money.asm
@@ -24,7 +24,7 @@ GiveMoney:: ; 15fd7
; 15ff7
MaxMoney: ; 15ff7
- dt 999999
+ dt MAX_MONEY
; 15ffa
@@ -192,7 +192,7 @@ GiveCoins:: ; 1606f
; 1608d
.maxcoins ; 1608d
- bigdw 9999
+ bigdw MAX_COINS
; 1608f
diff --git a/engine/more_phone_scripts.asm b/engine/more_phone_scripts.asm
deleted file mode 100644
index d44f5b475..000000000
--- a/engine/more_phone_scripts.asm
+++ /dev/null
@@ -1,1660 +0,0 @@
-UnknownScript_0xa0000:
- special RandomPhoneMon
- farscall PhoneScript_Random2
- if_equal 0, UnknownScript_0xa0013
- farscall PhoneScript_Generic_Male
- farjump UnknownScript_0xa003e
-
-UnknownScript_0xa0013:
- farjump UnknownScript_0xa002e
-
-UnknownScript_0xa0017:
- special RandomPhoneMon
- farscall PhoneScript_Random2
- if_equal 0, UnknownScript_0xa002a
- farscall PhoneScript_Generic_Female
- farjump UnknownScript_0xa0055
-
-UnknownScript_0xa002a:
- farjump UnknownScript_0xa0036
-
-UnknownScript_0xa002e:
- farscall UnknownScript_0xa007c
- farjump UnknownScript_0xa003e
-
-UnknownScript_0xa0036:
- farscall UnknownScript_0xa0128
- farjump UnknownScript_0xa0055
-
-UnknownScript_0xa003e:
- special RandomPhoneWildMon
- farscall PhoneScript_Random2
- if_equal 0, UnknownScript_0xa0051
- farscall UnknownScript_0xa017a
- farjump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0051:
- farjump UnknownScript_0xa006c
-
-UnknownScript_0xa0055:
- special RandomPhoneWildMon
- farscall PhoneScript_Random2
- if_equal 0, UnknownScript_0xa0068
- farscall UnknownScript_0xa0226
- farjump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0068:
- farjump UnknownScript_0xa0074
-
-UnknownScript_0xa006c:
- farscall UnknownScript_0xa0278
- farjump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0074:
- farscall UnknownScript_0xa0324
- farjump PhoneScript_HangupText_Female
-
-UnknownScript_0xa007c:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1740c0
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x174a24
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x174f2f
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x175530
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1757d4
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x175bc4
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x176a2f
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x176e5d
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x649dc
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x64cbd
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x65271
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x65ab2
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x65de4
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x660be
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x66980
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x66afc
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x66f9f
- buttonsound
- end
-
-UnknownScript_0xa0128:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x174688
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x174c7f
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1752f5
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x175fda
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1771fd
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x64f74
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x665ad
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x6717a
- buttonsound
- end
-
-UnknownScript_0xa017a:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x174106
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x174a80
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x174f90
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x175591
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x175869
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x175c24
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x176aef
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x176e9c
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x64a13
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x64cf3
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x65318
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x65b29
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x65e42
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x6613c
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x669b2
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x66b3e
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x66fc0
- buttonsound
- end
-
-UnknownScript_0xa0226:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1746c3
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x174cf6
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x17536b
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x17602d
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x177237
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x64fb2
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x66605
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x671a4
- buttonsound
- end
-
-UnknownScript_0xa0278:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x174165
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x174b2d
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x174ffd
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x175611
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1758e4
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x175c9f
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x176b45
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x176eee
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x64a71
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x64d4f
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x65399
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x65bc8
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x65eac
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x6618c
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x669ed
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x66b8f
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x67001
- buttonsound
- end
-
-UnknownScript_0xa0324:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x174734
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x174d86
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1753c5
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x176095
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x177297
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x6501c
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x66688
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x671eb
- buttonsound
- end
-
-UnknownScript_0xa0376:
- farscall PhoneScript_RematchText_Male
- farjump PhoneScript_HangupText_Male
-
-UnknownScript_0xa037e:
- farscall PhoneScript_RematchText_Female
- farjump PhoneScript_HangupText_Female
-
-PhoneScript_RematchText_Male:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1741e1
- buttonsound
- end
-
-.Huey:
- farwritetext UnknownText_0x1748ea
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x174bc5
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x17507d
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x175693
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x175976
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x175d40
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x176bee
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x176f60
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x64ada
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x64da4
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x65419
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x65f17
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x66214
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x66a3a
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x66bf3
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x67096
- buttonsound
- end
-
-PhoneScript_RematchText_Female:
- checkcode VAR_CALLERID
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beth:
- farwritetext UnknownText_0x174e4e
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x17543a
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x17610a
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1772e2
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x65091
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x66730
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x6722e
- buttonsound
- end
-
-UnknownScript_0xa047a:
- farwritetext UnknownText_0x1761a7
- end
-
-UnknownScript_0xa047f:
- farwritetext UnknownText_0x66796
- end
-
-PhoneScript_HangupText_Male:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_JUGGLER_IRWIN, .Irwin
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_BLACKBELT_KENJI, .Kenji
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x174251
- end
-
-.Huey:
- farwritetext UnknownText_0x174962
- end
-
-.Gaven:
- farwritetext UnknownText_0x174c0e
- end
-
-.Jose:
- farwritetext UnknownText_0x175106
- end
-
-.Joey:
- farwritetext UnknownText_0x17570a
- end
-
-.Wade:
- farwritetext UnknownText_0x1759e7
- end
-
-.Ralph:
- farwritetext UnknownText_0x175db7
- end
-
-.Anthony:
- farwritetext UnknownText_0x176c47
- end
-
-.Todd:
- farwritetext UnknownText_0x176fdb
- end
-
-.Irwin:
- farwritetext UnknownText_0x64000
- end
-
-.Arnie:
- farwritetext UnknownText_0x64b48
- end
-
-.Alan:
- farwritetext UnknownText_0x64e1f
- end
-
-.Chad:
- farwritetext UnknownText_0x65471
- end
-
-.Derek:
- farwritetext UnknownText_0x65c4e
- end
-
-.Tully:
- farwritetext UnknownText_0x65f6e
- end
-
-.Brent:
- farwritetext UnknownText_0x662a9
- end
-
-.Vance:
- farwritetext UnknownText_0x66a93
- end
-
-.Wilton:
- farwritetext UnknownText_0x66c58
- end
-
-.Kenji:
- farwritetext UnknownText_0x66dab
- end
-
-.Parry:
- farwritetext UnknownText_0x670eb
- end
-
-PhoneScript_HangupText_Female:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1747ac
- end
-
-.Beth:
- farwritetext UnknownText_0x174eb7
- end
-
-.Reena:
- farwritetext UnknownText_0x175488
- end
-
-.Liz:
- farwritetext UnknownText_0x17620a
- end
-
-.Gina:
- farwritetext UnknownText_0x177361
- end
-
-.Dana:
- farwritetext UnknownText_0x650e2
- end
-
-.Tiffany:
- farwritetext UnknownText_0x667f7
- end
-
-.Erin:
- farwritetext UnknownText_0x67281
- end
-
-UnknownScript_0xa0584:
- scall UnknownScript_0xa05a0
- iffalse UnknownScript_0xa058e
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xa058e:
- farjump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0592:
- scall UnknownScript_0xa05a0
- iffalse UnknownScript_0xa059c
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xa059c:
- farjump PhoneScript_HangupText_Female
-
-UnknownScript_0xa05a0:
- special RandomPhoneRareWildMon
- end
-
-UnknownScript_0xa05a4:
- checkcode VAR_CALLERID
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_POKEFANM_DEREK, .Derek
-
-.Wade:
- farwritetext UnknownText_0x1759f7
- buttonsound
- jump PhoneScript_HangupText_Male
-
-.Derek:
- farwritetext UnknownText_0x65c66
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa05be:
- farwritetext UnknownText_0x64032
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa05c6:
- farwritetext UnknownText_0x177378
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa05ce:
- farwritetext UnknownText_0x64b5f
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa05d6:
- farwritetext UnknownText_0x175dd9
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa05de:
- farwritetext UnknownText_0x176c61
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa05e6:
- checkcode VAR_CALLERID
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_FISHER_WILTON, .Wilton
-
-.Jose:
- farwritetext UnknownText_0x175116
- end
-
-.Wade:
- farwritetext UnknownText_0x175a60
- end
-
-.Alan:
- farwritetext UnknownText_0x64e2f
- end
-
-.Derek:
- farwritetext UnknownText_0x65cf9
- end
-
-.Tully:
- farwritetext UnknownText_0x65f88
- end
-
-.Wilton:
- farwritetext UnknownText_0x66c6b
- end
-
-UnknownScript_0xa061e:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
-
-.Beverly:
- farwritetext UnknownText_0x1747cc
- end
-
-.Gina:
- farwritetext UnknownText_0x1773e7
- end
-
-.Dana:
- farwritetext UnknownText_0x650ec
- end
-
-.Tiffany:
- farwritetext UnknownText_0x66801
- end
-
-UnknownScript_0xa0644:
- farwritetext UnknownText_0x176feb
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa064c:
- farwritetext UnknownText_0x66dc5
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0654:
- random 11
- if_equal 0, UnknownScript_0xa0682
- if_equal 1, UnknownScript_0xa068a
- if_equal 2, UnknownScript_0xa0692
- if_equal 3, UnknownScript_0xa069a
- if_equal 4, UnknownScript_0xa06a2
- if_equal 5, UnknownScript_0xa06aa
- if_equal 6, UnknownScript_0xa06b2
- if_equal 7, UnknownScript_0xa06ba
- if_equal 8, UnknownScript_0xa06c2
- if_equal 9, UnknownScript_0xa06ca
- if_equal 10, UnknownScript_0xa06d2
-
-UnknownScript_0xa0682:
- farwritetext UnknownText_0x174261
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa068a:
- farwritetext UnknownText_0x17429d
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0692:
- farwritetext UnknownText_0x1742ee
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa069a:
- farwritetext UnknownText_0x174340
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06a2:
- farwritetext UnknownText_0x174391
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06aa:
- farwritetext UnknownText_0x1743e3
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06b2:
- farwritetext UnknownText_0x174433
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06ba:
- farwritetext UnknownText_0x174485
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06c2:
- farwritetext UnknownText_0x1744d6
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06ca:
- farwritetext UnknownText_0x174522
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06d2:
- farwritetext UnknownText_0x174571
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa06da:
- random 10
- if_equal 0, UnknownScript_0xa0704
- if_equal 1, UnknownScript_0xa070c
- if_equal 2, UnknownScript_0xa0714
- if_equal 3, UnknownScript_0xa071c
- if_equal 4, UnknownScript_0xa0724
- if_equal 5, UnknownScript_0xa072c
- if_equal 6, UnknownScript_0xa0734
- if_equal 7, UnknownScript_0xa073c
- if_equal 8, UnknownScript_0xa0744
- if_equal 9, UnknownScript_0xa074c
-
-UnknownScript_0xa0704:
- farwritetext UnknownText_0x176223
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa070c:
- farwritetext UnknownText_0x1762c3
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0714:
- farwritetext UnknownText_0x17638a
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa071c:
- farwritetext UnknownText_0x176424
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0724:
- farwritetext UnknownText_0x1764eb
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa072c:
- farwritetext UnknownText_0x176599
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0734:
- farwritetext UnknownText_0x1766ac
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa073c:
- farwritetext UnknownText_0x17674f
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0744:
- farwritetext UnknownText_0x176816
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa074c:
- farwritetext UnknownText_0x17686d
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0754:
- random 10
- if_equal 0, UnknownScript_0xa077e
- if_equal 1, UnknownScript_0xa0786
- if_equal 2, UnknownScript_0xa078e
- if_equal 3, UnknownScript_0xa0796
- if_equal 4, UnknownScript_0xa079e
- if_equal 5, UnknownScript_0xa07a6
- if_equal 6, UnknownScript_0xa07ae
- if_equal 7, UnknownScript_0xa07b6
- if_equal 8, UnknownScript_0xa07be
- if_equal 9, UnknownScript_0xa07c6
-
-UnknownScript_0xa077e:
- farwritetext UnknownText_0x65481
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0786:
- farwritetext UnknownText_0x654ea
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa078e:
- farwritetext UnknownText_0x65555
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0796:
- farwritetext UnknownText_0x655c7
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa079e:
- farwritetext UnknownText_0x65628
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa07a6:
- farwritetext UnknownText_0x6569b
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa07ae:
- farwritetext UnknownText_0x6574a
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa07b6:
- farwritetext UnknownText_0x65810
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa07be:
- farwritetext UnknownText_0x658c6
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa07c6:
- farwritetext UnknownText_0x65969
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa07ce:
- random 10
- if_equal 0, UnknownScript_0xa07f8
- if_equal 1, UnknownScript_0xa0800
- if_equal 2, UnknownScript_0xa0808
- if_equal 3, UnknownScript_0xa0810
- if_equal 4, UnknownScript_0xa0818
- if_equal 5, UnknownScript_0xa0820
- if_equal 6, UnknownScript_0xa0828
- if_equal 7, UnknownScript_0xa0830
- if_equal 8, UnknownScript_0xa0838
- if_equal 9, UnknownScript_0xa0840
-
-UnknownScript_0xa07f8:
- farwritetext UnknownText_0x662bc
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0800:
- farwritetext UnknownText_0x662fc
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0808:
- farwritetext UnknownText_0x66335
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0810:
- farwritetext UnknownText_0x66366
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0818:
- farwritetext UnknownText_0x663a1
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0820:
- farwritetext UnknownText_0x663e6
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0828:
- farwritetext UnknownText_0x66421
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0830:
- farwritetext UnknownText_0x6645f
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0838:
- farwritetext UnknownText_0x6649b
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0840:
- farwritetext UnknownText_0x664dd
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0848:
- checkevent EVENT_OPENED_MT_SILVER
- iftrue UnknownScript_0xa08e0
- checkevent EVENT_FOUGHT_SNORLAX
- iftrue UnknownScript_0xa08d8
- checkevent EVENT_GOT_PASS_FROM_COPYCAT
- iftrue UnknownScript_0xa08d0
- checkflag ENGINE_MARSHBADGE
- iftrue UnknownScript_0xa08f0
- checkflag ENGINE_FLYPOINT_VERMILION
- iftrue UnknownScript_0xa08c8
- checkevent EVENT_BEAT_ELITE_FOUR
- iftrue UnknownScript_0xa08c0
- checkflag ENGINE_RISINGBADGE
- iftrue UnknownScript_0xa08b8
- checkevent EVENT_CLEARED_RADIO_TOWER
- iftrue UnknownScript_0xa08b0
- checkevent EVENT_CLEARED_ROCKET_HIDEOUT
- iftrue UnknownScript_0xa08a8
- checkevent EVENT_JASMINE_RETURNED_TO_GYM
- iftrue UnknownScript_0xa08a0
- checkflag ENGINE_FOGBADGE
- iftrue UnknownScript_0xa08e8
- checkflag ENGINE_PLAINBADGE
- iftrue UnknownScript_0xa0898
- farwritetext UnknownText_0x646a3
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0898:
- farwritetext UnknownText_0x64099
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08a0:
- farwritetext UnknownText_0x640e6
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08a8:
- farwritetext UnknownText_0x6416d
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08b0:
- farwritetext UnknownText_0x641e8
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08b8:
- farwritetext UnknownText_0x64247
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08c0:
- farwritetext UnknownText_0x642bb
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08c8:
- farwritetext UnknownText_0x643d4
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08d0:
- farwritetext UnknownText_0x64448
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08d8:
- farwritetext UnknownText_0x6455b
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08e0:
- farwritetext UnknownText_0x645ff
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08e8:
- farwritetext UnknownText_0x646df
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08f0:
- farwritetext UnknownText_0x647d8
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa08f8:
- farwritetext UnknownText_0x1745c2
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0900:
- farwritetext UnknownText_0x17485b
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0908:
- farwritetext UnknownText_0x17496b
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0910:
- farwritetext UnknownText_0x174c29
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0918:
- farwritetext UnknownText_0x174ec5
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0920:
- farwritetext UnknownText_0x17519b
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0928:
- farwritetext UnknownText_0x17549b
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0930:
- farwritetext UnknownText_0x17571d
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0938:
- farwritetext UnknownText_0x175abe
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0940:
- farwritetext UnknownText_0x175eaf
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0948:
- farwritetext UnknownText_0x1768b0
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0950:
- farwritetext UnknownText_0x176d32
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0958:
- farwritetext UnknownText_0x1770fb
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0960:
- farwritetext UnknownText_0x177465
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0968:
- farwritetext UnknownText_0x64bc6
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0970:
- farwritetext UnknownText_0x64e90
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0978:
- farwritetext UnknownText_0x65161
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0980:
- farwritetext UnknownText_0x65a23
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0988:
- farwritetext UnknownText_0x65d5c
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0990:
- farwritetext UnknownText_0x65ff2
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0998:
- farwritetext UnknownText_0x6651e
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa09a0:
- farwritetext UnknownText_0x66882
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa09a8:
- farwritetext UnknownText_0x66aa5
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa09b0:
- farwritetext UnknownText_0x66ca7
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa09b8:
- farwritetext UnknownText_0x67106
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa09c0:
- farwritetext UnknownText_0x67294
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa09c8:
- random 3
- if_equal 0, UnknownScript_0xa09d6
- if_equal 1, UnknownScript_0xa09de
- if_equal 2, UnknownScript_0xa09e6
-
-UnknownScript_0xa09d6:
- farwritetext UnknownText_0x64846
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa09de:
- farwritetext UnknownText_0x64881
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa09e6:
- farwritetext UnknownText_0x648dc
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa09ee:
- checkcode VAR_KENJI_BREAK
- if_equal 2, UnknownScript_0xa0a00
- if_equal 1, UnknownScript_0xa0a08
- farwritetext UnknownText_0x66e17
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0a00:
- farwritetext UnknownText_0x66e67
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0a08:
- checkmorn
- iftrue UnknownScript_0xa0a1d
- checknite
- iftrue UnknownScript_0xa0a25
- setevent EVENT_KENJI_ON_BREAK
- farwritetext UnknownText_0x66f11
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0a1d:
- farwritetext UnknownText_0x66ed3
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0a25:
- farwritetext UnknownText_0x66f52
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0a2d:
- farwritetext UnknownText_0x174638
- end
-
-UnknownScript_0xa0a32:
- farwritetext UnknownText_0x1749c7
- end
-
-UnknownScript_0xa0a37:
- farwritetext UnknownText_0x174c49
- end
-
-UnknownScript_0xa0a3c:
- farwritetext UnknownText_0x174ee2
- end
-
-UnknownScript_0xa0a41:
- farwritetext UnknownText_0x17520a
- end
-
-UnknownScript_0xa0a46:
- farwritetext UnknownText_0x1754e5
- end
-
-UnknownScript_0xa0a4b:
- farwritetext UnknownText_0x175786
- end
-
-UnknownScript_0xa0a50:
- farwritetext UnknownText_0x175b1e
- end
-
-UnknownScript_0xa0a55:
- farwritetext UnknownText_0x175f11
- end
-
-UnknownScript_0xa0a5a:
- farwritetext UnknownText_0x1769da
- end
-
-UnknownScript_0xa0a5f:
- farwritetext UnknownText_0x176d85
- end
-
-UnknownScript_0xa0a64:
- farwritetext UnknownText_0x177138
- end
-
-UnknownScript_0xa0a69:
- farwritetext UnknownText_0x1774c1
- end
-
-UnknownScript_0xa0a6e:
- farwritetext UnknownText_0x64c13
- end
-
-UnknownScript_0xa0a73:
- farwritetext UnknownText_0x64ed4
- end
-
-UnknownScript_0xa0a78:
- farwritetext UnknownText_0x651bf
- end
-
-UnknownScript_0xa0a7d:
- farwritetext UnknownText_0x65a63
- end
-
-UnknownScript_0xa0a82:
- farwritetext UnknownText_0x66043
- end
-
-UnknownScript_0xa0a87:
- farwritetext UnknownText_0x66579
- end
-
-UnknownScript_0xa0a8c:
- farwritetext UnknownText_0x668a3
- end
-
-UnknownScript_0xa0a91:
- farwritetext UnknownText_0x66ad1
- end
-
-UnknownScript_0xa0a96:
- farwritetext UnknownText_0x66cf7
- end
-
-UnknownScript_0xa0a9b:
- farwritetext UnknownText_0x6712a
- end
-
-UnknownScript_0xa0aa0:
- farwritetext UnknownText_0x672d5
- end
-
-UnknownScript_0xa0aa5:
- farwritetext UnknownText_0x174895
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0aad:
- farwritetext UnknownText_0x17529c
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0ab5:
- farwritetext UnknownText_0x175b6d
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0abd:
- farwritetext UnknownText_0x17750e
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0ac5:
- farwritetext UnknownText_0x64f1a
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0acd:
- farwritetext UnknownText_0x6520f
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0ad5:
- farwritetext UnknownText_0x65da6
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0add:
- farwritetext UnknownText_0x66087
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0ae5:
- farwritetext UnknownText_0x6691d
- buttonsound
- jump PhoneScript_HangupText_Female
-
-UnknownScript_0xa0aed:
- farwritetext UnknownText_0x66d45
- buttonsound
- jump PhoneScript_HangupText_Male
-
-UnknownScript_0xa0af5:
- farwritetext UnknownText_0x175f70
- end
-
-UnknownScript_0xa0afa:
- farwritetext UnknownText_0x176dd1
- end
-
-UnknownScript_0xa0aff:
- farwritetext UnknownText_0x64c5a
- end
-
-UnknownScript_0xa0b04:
- farwritetext UnknownText_0x17717c
- end
-
-BikeShopPhoneScript:
- farwritetext UnknownText_0x174000
- clearflag ENGINE_BIKE_SHOP_CALL_ENABLED
- specialphonecall SPECIALCALL_NONE
- end
diff --git a/engine/move_mon.asm b/engine/move_mon.asm
index e07237d68..4ee283e3e 100755
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -136,7 +136,7 @@ endr
push de
ld a, [CurPartyLevel]
ld d, a
- callab CalcExpAtLevel
+ callfar CalcExpAtLevel
pop de
ld a, [hProduct + 1]
ld [de], a
@@ -160,7 +160,7 @@ endr
and $f
jr z, .generateDVs
push hl
- callba GetTrainerDVs
+ farcall GetTrainerDVs
pop hl
jr .initializetrainermonstats
@@ -312,7 +312,7 @@ endr
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
predef GetUnownLetter
- callab UpdateUnownDex
+ callfar UpdateUnownDex
.done
scf ; When this function returns, the carry flag indicates success vs failure.
@@ -423,7 +423,7 @@ AddTempmonToParty: ; da96
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
predef GetUnownLetter
- callab UpdateUnownDex
+ callfar UpdateUnownDex
ld a, [wFirstUnownSeen]
and a
jr nz, .done
@@ -446,9 +446,9 @@ SentGetPkmnIntoFromBox: ; db3f
ld a, [wPokemonWithdrawDepositParameter]
and a
jr z, .check_IfPartyIsFull
- cp DAYCARE_WITHDRAW
+ cp DAY_CARE_WITHDRAW
jr z, .check_IfPartyIsFull
- cp DAYCARE_DEPOSIT
+ cp DAY_CARE_DEPOSIT
ld hl, wBreedMon1Species
jr z, .breedmon
@@ -473,7 +473,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld b, 0
add hl, bc
ld a, [wPokemonWithdrawDepositParameter]
- cp DAYCARE_WITHDRAW
+ cp DAY_CARE_WITHDRAW
ld a, [wBreedMon1Species]
jr z, .okay1
ld a, [CurPartySpecies]
@@ -504,7 +504,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld hl, sBoxMon1Species
ld bc, BOXMON_STRUCT_LENGTH
jr z, .okay3
- cp DAYCARE_WITHDRAW
+ cp DAY_CARE_WITHDRAW
ld hl, wBreedMon1Species
jr z, .okay4
ld hl, PartyMon1Species
@@ -518,7 +518,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld bc, BOXMON_STRUCT_LENGTH
call CopyBytes
ld a, [wPokemonWithdrawDepositParameter]
- cp DAYCARE_DEPOSIT
+ cp DAY_CARE_DEPOSIT
ld de, wBreedMon1OT
jr z, .okay5
dec a
@@ -540,7 +540,7 @@ SentGetPkmnIntoFromBox: ; db3f
and a
jr z, .okay7
ld hl, wBreedMon1OT
- cp DAYCARE_WITHDRAW
+ cp DAY_CARE_WITHDRAW
jr z, .okay8
ld hl, PartyMonOT
@@ -552,7 +552,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld bc, NAME_LENGTH
call CopyBytes
ld a, [wPokemonWithdrawDepositParameter]
- cp DAYCARE_DEPOSIT
+ cp DAY_CARE_DEPOSIT
ld de, wBreedMon1Nick
jr z, .okay9
dec a
@@ -574,7 +574,7 @@ SentGetPkmnIntoFromBox: ; db3f
and a
jr z, .okay11
ld hl, wBreedMon1Nick
- cp DAYCARE_WITHDRAW
+ cp DAY_CARE_WITHDRAW
jr z, .okay12
ld hl, PartyMonNicknames
@@ -590,7 +590,7 @@ SentGetPkmnIntoFromBox: ; db3f
ld a, [wPokemonWithdrawDepositParameter]
cp PC_DEPOSIT
jr z, .took_out_of_box
- cp DAYCARE_DEPOSIT
+ cp DAY_CARE_DEPOSIT
jp z, .CloseSRAM_And_ClearCarryFlag
push hl
@@ -598,7 +598,7 @@ SentGetPkmnIntoFromBox: ; db3f
add $2
ld [MonType], a
predef CopyPkmnToTempMon
- callab CalcLevel
+ callfar CalcLevel
ld a, d
ld [CurPartyLevel], a
pop hl
@@ -708,7 +708,7 @@ RestorePPofDepositedPokemon: ; dcb6
push bc
push hl
push de
- callba GetMaxPPOfMove
+ farcall GetMaxPPOfMove
pop de
pop hl
ld a, [wd265]
@@ -732,7 +732,7 @@ RestorePPofDepositedPokemon: ; dcb6
ret
; dd21
-RetrievePokemonFromDaycareMan: ; dd21
+RetrievePokemonFromDayCareMan: ; dd21
ld a, [wBreedMon1Species]
ld [CurPartySpecies], a
ld de, SFX_TRANSACTION
@@ -748,7 +748,7 @@ RetrievePokemonFromDaycareMan: ; dd21
jp Functiondd64
; dd42
-RetrievePokemonFromDaycareLady: ; dd42
+RetrievePokemonFromDayCareLady: ; dd42
ld a, [wBreedMon2Species]
ld [CurPartySpecies], a
ld de, SFX_TRANSACTION
@@ -844,10 +844,10 @@ Functiondd64: ; dd64
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
- callba HealPartyMon
+ farcall HealPartyMon
ld a, [CurPartyLevel]
ld d, a
- callab CalcExpAtLevel
+ callfar CalcExpAtLevel
pop bc
ld hl, $8
add hl, bc
@@ -872,7 +872,7 @@ Functionde1a: ; de1a
ret
; de2a
-DepositMonWithDaycareMan: ; de2a
+DepositMonWithDayCareMan: ; de2a
ld de, wBreedMon1Nick
call DepositBreedmon
xor a
@@ -880,7 +880,7 @@ DepositMonWithDaycareMan: ; de2a
jp RemoveMonFromPartyOrBox
; de37
-DepositMonWithDaycareLady: ; de37
+DepositMonWithDayCareLady: ; de37
ld de, wBreedMon2Nick
call DepositBreedmon
xor a
@@ -961,7 +961,7 @@ SentPkmnIntoBox: ; de6e
push de
ld a, [CurPartyLevel]
ld d, a
- callab CalcExpAtLevel
+ callfar CalcExpAtLevel
pop de
ld a, [hProduct + 1]
ld [de], a
@@ -1011,7 +1011,7 @@ SentPkmnIntoBox: ; de6e
jr nz, .not_unown
ld hl, sBoxMon1DVs
predef GetUnownLetter
- callab UpdateUnownDex
+ callfar UpdateUnownDex
.not_unown
ld hl, sBoxMon1Moves
@@ -1089,8 +1089,8 @@ ShiftBoxMon: ; df47
GiveEgg:: ; df8c
ld a, [CurPartySpecies]
push af
- callab GetPreEvolution
- callab GetPreEvolution
+ callfar GetPreEvolution
+ callfar GetPreEvolution
ld a, [CurPartySpecies]
dec a
@@ -1433,7 +1433,7 @@ CalcPkmnStatC: ; e17b
ld a, [hld]
ld e, a
ld d, [hl]
- callba GetSquareRoot
+ farcall GetSquareRoot
pop de
.no_stat_exp
@@ -1543,7 +1543,7 @@ CalcPkmnStatC: ; e17b
call Divide
ld a, c
cp STAT_HP
- ld a, 5
+ ld a, STAT_MIN_NORMAL
jr nz, .not_hp
ld a, [CurPartyLevel]
ld b, a
@@ -1556,7 +1556,7 @@ CalcPkmnStatC: ; e17b
ld [hMultiplicand + 1], a
.no_overflow_3
- ld a, 10
+ ld a, STAT_MIN_HP
.not_hp
ld b, a
@@ -1579,9 +1579,9 @@ CalcPkmnStatC: ; e17b
jr c, .stat_value_okay
.max_stat
- ld a, 999 / $100
+ ld a, MAX_STAT_VALUE / $100
ld [hMultiplicand + 1], a
- ld a, 999 % $100
+ ld a, MAX_STAT_VALUE % $100
ld [hMultiplicand + 2], a
.stat_value_okay
@@ -1625,7 +1625,7 @@ GivePoke:: ; e277
.failed
ld a, [CurPartySpecies]
ld [TempEnemyMonSpecies], a
- callab LoadEnemyMon
+ callfar LoadEnemyMon
call SentPkmnIntoBox
jp nc, .FailedToGiveMon
ld a, BOXMON
@@ -1706,7 +1706,7 @@ GivePoke:: ; e277
ld [hli], a
ld [hl], 01001 % $100
pop bc
- callba SetGiftPartyMonCaughtData
+ farcall SetGiftPartyMonCaughtData
jr .skip_nickname
.send_to_box
@@ -1730,7 +1730,7 @@ GivePoke:: ; e277
call Random
ld [hl], a
call CloseSRAM
- callba SetGiftBoxMonCaughtData
+ farcall SetGiftBoxMonCaughtData
jr .skip_nickname
.wildmon
@@ -1741,13 +1741,13 @@ GivePoke:: ; e277
ld a, b
and a
jr z, .party
- callba SetBoxMonCaughtData
+ farcall SetBoxMonCaughtData
jr .set_caught_data
.party
- callba SetCaughtData
+ farcall SetCaughtData
.set_caught_data
- callba GiveANickname_YesNo
+ farcall GiveANickname_YesNo
pop de
jr c, .skip_nickname
call InitNickname
@@ -1791,7 +1791,7 @@ InitNickname: ; e3de
pop de
push de
ld b, $0
- callba NamingScreen
+ farcall NamingScreen
pop hl
ld de, StringBuffer1
call InitName
diff --git a/engine/move_mon_wo_mail.asm b/engine/move_mon_wo_mail.asm
index d3b4e78a5..c96823d28 100755
--- a/engine/move_mon_wo_mail.asm
+++ b/engine/move_mon_wo_mail.asm
@@ -34,7 +34,7 @@ InsertPokemonIntoBox: ; 51322
call CopyBytes
ld a, [CurPartyMon]
ld b, a
- callba RestorePPofDepositedPokemon
+ farcall RestorePPofDepositedPokemon
jp CloseSRAM
InsertPokemonIntoParty: ; 5138b
diff --git a/engine/movement.asm b/engine/movement.asm
index 7b58e4023..66c501909 100644
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -1,4 +1,5 @@
MovementPointers: ; 5075
+; entries correspond to macros/movement.asm enumeration
dw Movement_turn_head_down ; 00
dw Movement_turn_head_up ; 01
dw Movement_turn_head_left ; 02
@@ -59,8 +60,8 @@ MovementPointers: ; 5075
dw Movement_set_sliding ; 39
dw Movement_remove_fixed_facing ; 3a
dw Movement_fix_facing ; 3b
- dw Movement_show_person ; 3c
- dw Movement_hide_person ; 3d
+ dw Movement_show_object ; 3c
+ dw Movement_hide_object ; 3d
dw Movement_step_sleep_1 ; 3e
dw Movement_step_sleep_2 ; 3f
dw Movement_step_sleep_3 ; 40
@@ -72,7 +73,7 @@ MovementPointers: ; 5075
dw Movement_step_sleep ; 46
dw Movement_step_end ; 47
dw Movement_48 ; 48
- dw Movement_remove_person ; 49
+ dw Movement_remove_object ; 49
dw Movement_step_loop ; 4a
dw Movement_4b ; 4b
dw Movement_teleport_from ; 4c
@@ -129,7 +130,7 @@ Movement_step_dig: ; 5145
ld [hl], a
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SPIN
+ ld [hl], OBJECT_ACTION_SPIN
call JumpMovementPointer
ld hl, OBJECT_STEP_DURATION
add hl, bc
@@ -166,7 +167,7 @@ Movement_return_dig: ; 516a
Movement_fish_got_bite: ; 5189
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_FISHING
+ ld [hl], OBJECT_ACTION_FISHING
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_GOT_BITE
@@ -180,7 +181,7 @@ Movement_rock_smash: ; 5196
ld [hl], a
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_ROCK_SMASH
@@ -190,7 +191,7 @@ Movement_rock_smash: ; 5196
Movement_fish_cast_rod: ; 51ab
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_FISHING
+ ld [hl], OBJECT_ACTION_FISHING
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_SLEEP
@@ -247,7 +248,7 @@ Movement_48: ; 51db
ret
; 51fd
-Movement_remove_person: ; 51fd
+Movement_remove_object: ; 51fd
call DeleteMapObject
ld hl, wObjectFollow_Leader
ld a, [hMapObjectIndexBuffer]
@@ -264,7 +265,7 @@ Movement_remove_person: ; 51fd
Movement_4b: ; 5210
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_STEP_TYPE
add hl, bc
@@ -325,7 +326,7 @@ Movement_step_sleep_common: ; 5247
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -345,7 +346,7 @@ Movement_step_bump: ; 525f
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_BUMP
+ ld [hl], OBJECT_ACTION_BUMP
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -365,7 +366,7 @@ Movement_tree_shake: ; 5279
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_WEIRD_TREE
+ ld [hl], OBJECT_ACTION_WEIRD_TREE
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -401,14 +402,14 @@ Movement_fix_facing: ; 52ae
jp ContinueReadingMovement
; 52b7
-Movement_show_person: ; 52b7
+Movement_show_object: ; 52b7
ld hl, OBJECT_FLAGS1
add hl, bc
res INVISIBLE, [hl]
jp ContinueReadingMovement
; 52c0
-Movement_hide_person: ; 52c0
+Movement_hide_object: ; 52c0
ld hl, OBJECT_FLAGS1
add hl, bc
set INVISIBLE, [hl]
@@ -457,7 +458,7 @@ TurnHead: ; 52ee
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -732,7 +733,7 @@ TurnStep: ; 5400
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STEP
+ ld [hl], OBJECT_ACTION_STEP
ld hl, OBJECT_STEP_TYPE
add hl, bc
@@ -745,7 +746,7 @@ NormalStep: ; 5412
call UpdateTallGrassFlags
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STEP
+ ld [hl], OBJECT_ACTION_STEP
ld hl, OBJECT_NEXT_TILE
add hl, bc
@@ -783,7 +784,7 @@ TurningStep: ; 5446
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_SPIN
+ ld [hl], OBJECT_ACTION_SPIN
ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer]
@@ -809,7 +810,7 @@ SlideStep: ; 5468
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STAND
+ ld [hl], OBJECT_ACTION_STAND
ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer]
@@ -841,7 +842,7 @@ JumpStep: ; 548a
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], PERSON_ACTION_STEP
+ ld [hl], OBJECT_ACTION_STEP
call SpawnShadow
diff --git a/engine/mysterygift.asm b/engine/mystery_gift.asm
index f2d29b08a..a8bad8935 100755
--- a/engine/mysterygift.asm
+++ b/engine/mystery_gift.asm
@@ -7,7 +7,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
ld de, .String_PressAToLink_BToCancel
call PlaceString
call WaitBGMap
- callba PrepMysteryGiftDataToSend
+ farcall PrepMysteryGiftDataToSend
call MysteryGift_ClearTrainerData
ld a, $2
ld [wca01], a
@@ -62,21 +62,21 @@ DoMysteryGift: ; 1048ba (41:48ba)
cp 4
jr z, .skip_append_save
call .SaveMysteryGiftTrainerName
- callba RestoreMobileEventIndex
- callba TrainerRankings_MysteryGift
- callba BackupMobileEventIndex
+ farcall RestoreMobileEventIndex
+ farcall TrainerRankings_MysteryGift
+ farcall BackupMobileEventIndex
.skip_append_save
ld a, [wMysteryGiftPartnerSentDeco]
and a
jr z, .item
ld a, [wMysteryGiftPartnerWhichDeco]
ld c, a
- callba MysteryGiftGetDecoration
+ farcall MysteryGiftGetDecoration
push bc
call MysteryGift_CheckAndSetDecorationAlreadyReceived
pop bc
jr nz, .item
- callab GetDecorationName_c
+ callfar GetDecorationName_c
ld h, d
ld l, e
ld de, StringBuffer1
@@ -89,7 +89,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
call GetMysteryGiftBank
ld a, [wMysteryGiftPartnerWhichItem]
ld c, a
- callba MysteryGiftGetItemHeldEffect
+ farcall MysteryGiftGetItemHeldEffect
ld a, c
ld [sBackupMysteryGiftItem], a
ld [wNamedObjectIndexBuffer], a
@@ -237,7 +237,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
Function104a95: ; 104a95 (41:4a95)
di
- callba ClearChannels
+ farcall ClearChannels
call Function104d5e
.loop2
@@ -421,7 +421,7 @@ Function104bd0: ; 104bd0 (41:4bd0)
ld a, [wMysteryGiftTrainerData]
cp $3
jr nc, .quit
- callba StagePartyDataForMysteryGift
+ farcall StagePartyDataForMysteryGift
call MysteryGift_ClearTrainerData
ld a, $26
ld [wca02], a
@@ -453,7 +453,7 @@ Function104bd0: ; 104bd0 (41:4bd0)
Function104c2d: ; 104c2d (41:4c2d)
di
- callba ClearChannels
+ farcall ClearChannels
call Function104d5e
.asm_104c37
call Function104d96
@@ -815,7 +815,7 @@ Function104e93: ; 104e93 (41:4e93)
ld c, rRP % $100
ld d, $3d
call Function104dd1
- ld hl, hPrintNum2 ; $ffb4 (aliases: hMultiplicand)
+ ld hl, hPrintNum2
ld a, $5a
ld [hli], a
ld [hl], b
@@ -830,7 +830,7 @@ Function104e93: ; 104e93 (41:4e93)
ld a, [hPrintNum6]
ld [hPrintNum3], a
push hl
- ld hl, hPrintNum2 ; $ffb4 (aliases: hMultiplicand)
+ ld hl, hPrintNum2
ld b, $2
call Function104ed6
ld hl, hMGStatusFlags
@@ -934,7 +934,7 @@ Function104f57: ; 104f57 (41:4f57)
ld [hPrintNum6], a
push bc
push hl
- ld hl, hPrintNum2 ; $ffb4 (aliases: hMultiplicand)
+ ld hl, hPrintNum2
ld b, $2
call Function104faf
ld a, [hPrintNum3]
@@ -954,11 +954,11 @@ Function104f57: ; 104f57 (41:4f57)
ld e, a
push hl
push de
- ld hl, hPrintNum2 ; $ffb4 (aliases: hMultiplicand)
+ ld hl, hPrintNum2
ld b, $2
call Function104faf
pop de
- ld hl, hPrintNum2 ; $ffb4 (aliases: hMultiplicand)
+ ld hl, hPrintNum2
ld a, [hli]
xor d
ld b, a
@@ -1148,7 +1148,7 @@ MysteryGift_CopyReceivedDecosToPC: ; 105091 (41:5091)
pop bc
jr z, .skip
push bc
- callab SetSpecificDecorationFlag
+ callfar SetSpecificDecorationFlag
pop bc
.skip
inc c
@@ -1411,7 +1411,7 @@ InitMysteryGiftLayout: ; 105153 (41:5153)
ret
MysteryGiftGFX: ; 105258
-INCBIN "gfx/misc/mystery_gift.2bpp"
+INCBIN "gfx/mystery_gift/mystery_gift.2bpp"
MysteryGiftGFXEnd:
Function105688: ; 105688 (41:5688)
@@ -1447,7 +1447,7 @@ Function105688: ; 105688 (41:5688)
ld hl, Text_ReceivedCard
call PrintText
ld de, wMysteryGiftTrainerData
- callba Function8ac70
+ farcall Function8ac70
ld a, c
ld [wd265], a
ld hl, Text_CardNotRegistered
@@ -1663,7 +1663,7 @@ Function1057d7: ; 1057d7 (41:57d7)
call EnableLCD
call WaitBGMap
ld b, $2
- callba GetMysteryGift_MobileAdapterLayout
+ farcall GetMysteryGift_MobileAdapterLayout
jp SetPalettes
.Load6Row: ; 1058c6 (41:58c6)
@@ -1732,4 +1732,4 @@ Function1057d7: ; 1057d7 (41:57d7)
; japanese mystery gift gfx
MysteryGiftJP_GFX: ; 105930
-INCBIN "gfx/misc/mystery_gift_jp.2bpp"
+INCBIN "gfx/mystery_gift/mystery_gift_jp.2bpp"
diff --git a/engine/mysterygift2.asm b/engine/mystery_gift_2.asm
index 4048ea533..dc0baf39c 100755
--- a/engine/mysterygift2.asm
+++ b/engine/mystery_gift_2.asm
@@ -9,7 +9,7 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642)
ld a, [hli]
ld [de], a
ld b, a
- inc de
+ inc de ; wc802
ld a, [hl]
ld [de], a
ld c, a
@@ -123,7 +123,7 @@ PrepMysteryGiftDataToSend: ; 2c642 (b:4642)
MysteryGiftGetItemHeldEffect: ; 2c708 (b:4708)
ld a, c
- cp $25 ; 37
+ cp MysteryGiftItemsEnd - MysteryGiftItems
jr nc, MysteryGiftFallbackItem
ld hl, MysteryGiftItems
ld b, 0
@@ -133,7 +133,7 @@ MysteryGiftGetItemHeldEffect: ; 2c708 (b:4708)
MysteryGiftGetDecoration: ; 2c715 (b:4715)
ld a, c
- cp $25 ; 37
+ cp MysteryGiftDecosEnd - MysteryGiftDecos
jr nc, MysteryGiftFallbackItem
ld hl, MysteryGiftDecos
ld b, 0
@@ -146,82 +146,7 @@ MysteryGiftFallbackItem: ; 2c722 (b:4722)
ret
; 2c725 (b:4725)
-MysteryGiftItems: ; 2c725
- db BERRY
- db PRZCUREBERRY
- db MINT_BERRY
- db ICE_BERRY
- db BURNT_BERRY
- db PSNCUREBERRY
- db GUARD_SPEC
- db X_DEFEND
- db X_ATTACK
- db BITTER_BERRY
- db DIRE_HIT
- db X_SPECIAL
- db X_ACCURACY
- db EON_MAIL
- db MORPH_MAIL
- db MUSIC_MAIL
- db MIRACLEBERRY
- db GOLD_BERRY
- db REVIVE
- db GREAT_BALL
- db SUPER_REPEL
- db MAX_REPEL
- db ELIXER
- db ETHER
- db WATER_STONE
- db FIRE_STONE
- db LEAF_STONE
- db THUNDERSTONE
- db MAX_ETHER
- db MAX_ELIXER
- db MAX_REVIVE
- db SCOPE_LENS
- db HP_UP
- db PP_UP
- db RARE_CANDY
- db BLUESKY_MAIL
- db MIRAGE_MAIL
-; 2c74a
-MysteryGiftDecos: ; 2c74a
- db DECOFLAG_PIKACHU_DOLL
- db DECOFLAG_BULBASAUR_DOLL
- db DECOFLAG_CHARMANDER_DOLL
- db DECOFLAG_SQUIRTLE_DOLL
- db DECOFLAG_POLIWAG_DOLL
- db DECOFLAG_DIGLETT_DOLL
- db DECOFLAG_STARMIE_DOLL
- db DECOFLAG_MAGIKARP_DOLL
- db DECOFLAG_ODDISH_DOLL
- db DECOFLAG_GENGAR_DOLL
- db DECOFLAG_CLEFAIRY_POSTER
- db DECOFLAG_JIGGLYPUFF_POSTER
- db DECOFLAG_SNES
- db DECOFLAG_SHELLDER_DOLL
- db DECOFLAG_VOLTORB_DOLL
- db DECOFLAG_WEEDLE_DOLL
- db DECOFLAG_MAGNAPLANT
- db DECOFLAG_TROPICPLANT
- db DECOFLAG_FAMICOM
- db DECOFLAG_N64
- db DECOFLAG_SURF_PIKACHU_DOLL
- db DECOFLAG_JIGGLYPUFF_DOLL
- db DECOFLAG_PINK_BED
- db DECOFLAG_POLKADOT_BED
- db DECOFLAG_RED_CARPET
- db DECOFLAG_BLUE_CARPET
- db DECOFLAG_YELLOW_CARPET
- db DECOFLAG_GREEN_CARPET
- db DECOFLAG_JUMBOPLANT
- db DECOFLAG_VIRTUAL_BOY
- db DECOFLAG_MACHOP_DOLL
- db DECOFLAG_PIKACHU_POSTER
- db DECOFLAG_TENTACOOL_DOLL
- db DECOFLAG_BIG_ONIX_DOLL
- db DECOFLAG_PIKACHU_BED
- db DECOFLAG_GRIMER_DOLL
- db DECOFLAG_UNOWN_DOLL
-; 2c76f
+INCLUDE "data/mystery_gift/items.asm"
+
+INCLUDE "data/mystery_gift/decos.asm"
diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm
index 4a7ca301a..484bbe753 100755
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -103,7 +103,7 @@ NamingScreen: ; 116c1
inc de
hlcoord 5, 4
call PlaceString
- callba GetGender
+ farcall GetGender
jr c, .genderless
ld a, "♂"
jr nz, .place_gender
@@ -124,7 +124,7 @@ NamingScreen: ; 116c1
; 1178d
.Player: ; 1178d (4:578d)
- callba GetPlayerIcon
+ farcall GetPlayerIcon
call .LoadSprite
hlcoord 5, 2
ld de, .PlayerNameString
@@ -352,14 +352,14 @@ NamingScreenJoypadLoop: ; 11915
bit 7, a
jr nz, .quit
call .RunJumptable
- callba PlaySpriteAnimationsAndDelayFrame
+ farcall PlaySpriteAnimationsAndDelayFrame
call .UpdateStringEntry
call DelayFrame
and a
ret
.quit
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
call ClearSprites
xor a
ld [hSCX], a
@@ -419,7 +419,7 @@ NamingScreenJoypadLoop: ; 11915
jr nz, .got_cursor_position
ld d, 8 * 8
.got_cursor_position
- ld a, SPRITE_ANIM_INDEX_02
+ ld a, SPRITE_ANIM_INDEX_NAMING_SCREEN_CURSOR
call _InitSpriteAnimStruct
ld a, c
ld [wNamingScreenCursorObjectPointer], a
@@ -900,7 +900,7 @@ NamingScreen_GetLastCharacter: ; 11c11 (4:5c11)
LoadNamingScreenGFX: ; 11c51
call ClearSprites
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
call LoadStandardFont
call LoadFontsExtra
@@ -946,55 +946,26 @@ LoadNamingScreenGFX: ; 11c51
; 11cb7
NamingScreenGFX_Border: ; 11cb7
-INCBIN "gfx/unknown/011cb7.2bpp"
+INCBIN "gfx/namingscreen/border.2bpp"
; 11cc7
NamingScreenGFX_Cursor: ; 11cc7
-INCBIN "gfx/unknown/011cc7.2bpp"
+INCBIN "gfx/namingscreen/cursor.2bpp"
; 11ce7
-NameInputLower:
- db "a b c d e f g h i"
- db "j k l m n o p q r"
- db "s t u v w x y z "
- db "× ( ) : ; [ ] <PK> <MN>"
- db "UPPER DEL END "
-
-BoxNameInputLower:
- db "a b c d e f g h i"
- db "j k l m n o p q r"
- db "s t u v w x y z "
- db "é 'd 'l 'm 'r 's 't 'v 0"
- db "1 2 3 4 5 6 7 8 9"
- db "UPPER DEL END "
-
-NameInputUpper:
- db "A B C D E F G H I"
- db "J K L M N O P Q R"
- db "S T U V W X Y Z "
- db "- ? ! / . , "
- db "lower DEL END "
-
-BoxNameInputUpper:
- db "A B C D E F G H I"
- db "J K L M N O P Q R"
- db "S T U V W X Y Z "
- db "× ( ) : ; [ ] <PK> <MN>"
- db "- ? ! ♂ ♀ / . , &"
- db "lower DEL END "
-
+INCLUDE "data/name_input_chars.asm"
; 11e5d
-GFX_11e5d: ; ????
-INCBIN "gfx/unknown/011e5d.1bpp"
+NamingScreenGFX_End: ; unused
+INCBIN "gfx/namingscreen/end.1bpp"
; 11e6d
NamingScreenGFX_MiddleLine:
-INCBIN "gfx/unknown/011e65.1bpp"
+INCBIN "gfx/namingscreen/middle_line.1bpp"
; 11e6d
NamingScreenGFX_UnderLine: ; 11e6d
-INCBIN "gfx/unknown/011e6d.1bpp"
+INCBIN "gfx/namingscreen/underline.1bpp"
; 11e75
_ComposeMailMessage: ; 11e75 (mail?)
@@ -1039,7 +1010,7 @@ _ComposeMailMessage: ; 11e75 (mail?)
; init mail icon
depixel 3, 2
- ld a, SPRITE_ANIM_INDEX_00
+ ld a, SPRITE_ANIM_INDEX_PARTY_MON
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
@@ -1125,14 +1096,14 @@ INCBIN "gfx/icon/mail2.2bpp"
bit 7, a
jr nz, .exit_mail
call .DoJumptable
- callba PlaySpriteAnimationsAndDelayFrame
+ farcall PlaySpriteAnimationsAndDelayFrame
call .Update
call DelayFrame
and a
ret
.exit_mail
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
call ClearSprites
xor a
ld [hSCX], a
@@ -1174,7 +1145,7 @@ INCBIN "gfx/icon/mail2.2bpp"
.init_blinking_cursor ; 1201b (4:601b)
depixel 9, 2
- ld a, SPRITE_ANIM_INDEX_09
+ ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR
call _InitSpriteAnimStruct
ld a, c
ld [wNamingScreenCursorObjectPointer], a
@@ -1499,22 +1470,6 @@ MailComposition_TryAddLastCharacter: ; 121ac (4:61ac)
; 121dd
-MailEntry_Uppercase: ; 122dd
- db "A B C D E F G H I J"
- db "K L M N O P Q R S T"
- db "U V W X Y Z , ? !"
- db "1 2 3 4 5 6 7 8 9 0"
- db "<PK> <MN> <PO> <KE> é ♂ ♀ ¥ … ×"
- db "lower DEL END "
-
-; 1224f
-
-MailEntry_Lowercase: ; 1224f
- db "a b c d e f g h i j"
- db "k l m n o p q r s t"
- db "u v w x y z . - /"
- db "'d 'l 'm 'r 's 't 'v & ( )"
- db "<``> <''> [ ] ' : ; "
- db "UPPER DEL END "
+INCLUDE "data/mail_input_chars.asm"
; 122c1
diff --git a/engine/npc_movement.asm b/engine/npc_movement.asm
index bc36e3ee9..a2508e0f6 100755
--- a/engine/npc_movement.asm
+++ b/engine/npc_movement.asm
@@ -7,7 +7,8 @@ Function6ec1: ; 6ec1
ld hl, OBJECT_FLAGS1
add hl, bc
- bit 4, [hl] ; lost
+ bit 4, [hl] ; lost, uncomment next line to fix
+; jr nz, .resume
push hl
push bc
call Function6f2c
@@ -34,7 +35,7 @@ Function6ec1: ; 6ec1
push hl
push bc
- call WillPersonBumpIntoSomeoneElse
+ call WillObjectBumpIntoSomeoneElse
pop bc
pop hl
ret c
@@ -43,12 +44,12 @@ Function6ec1: ; 6ec1
bit 5, [hl]
jr nz, .bit_5
push hl
- call HasPersonReachedMovementLimit
+ call HasObjectReachedMovementLimit
pop hl
ret c
push hl
- call IsPersonMovingOffEdgeOfScreen
+ call IsObjectMovingOffEdgeOfScreen
pop hl
ret c
@@ -118,7 +119,7 @@ Function6f3e: ; 6f3e
; 6f5b
.data_6f5b
- db 1 << DOWN, 1 << UP, 1 << RIGHT, 1 << LEFT
+ db DOWN_MASK, UP_MASK, RIGHT_MASK, LEFT_MASK
; 6f5f
Function6f5f: ; 6f5f
@@ -143,7 +144,7 @@ Function6f5f: ; 6f5f
; 6f7b
.data_6f7b
- db 1 << UP, 1 << DOWN, 1 << LEFT, 1 << RIGHT
+ db UP_MASK, DOWN_MASK, LEFT_MASK, RIGHT_MASK
; 6f7f
Function6f7f: ; 6f7f
@@ -268,7 +269,7 @@ CheckFacingObject:: ; 6fd9
; 7009
-WillPersonBumpIntoSomeoneElse: ; 7009
+WillObjectBumpIntoSomeoneElse: ; 7009
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld d, [hl]
@@ -390,7 +391,7 @@ IsNPCAtCoord: ; 7041
ret
; 70a4
-HasPersonReachedMovementLimit: ; 70a4
+HasObjectReachedMovementLimit: ; 70a4
ld hl, OBJECT_RADIUS
add hl, bc
ld a, [hl]
@@ -450,7 +451,7 @@ HasPersonReachedMovementLimit: ; 70a4
ret
; 70ed
-IsPersonMovingOffEdgeOfScreen: ; 70ed
+IsObjectMovingOffEdgeOfScreen: ; 70ed
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [XCoord]
diff --git a/engine/npctrade.asm b/engine/npctrade.asm
index 01631d051..1455dce62 100755
--- a/engine/npctrade.asm
+++ b/engine/npctrade.asm
@@ -1,26 +1,10 @@
-
-; Trade struct
-TRADE_DIALOG EQU 0
-TRADE_GIVEMON EQU 1
-TRADE_GETMON EQU 2
-TRADE_NICK EQU 3
-TRADE_DVS EQU 14
-TRADE_ITEM EQU 16
-TRADE_OT_ID EQU 17
-TRADE_OT_NAME EQU 19
-TRADE_GENDER EQU 30
-TRADE_PADDING EQU 31
-
; Trade dialogs
-TRADE_INTRO EQU 0
-TRADE_CANCEL EQU 1
-TRADE_WRONG EQU 2
-TRADE_COMPLETE EQU 3
-TRADE_AFTER EQU 4
-
-TRADE_EITHER_GENDER EQU 0
-TRADE_MALE_ONLY EQU 1
-TRADE_FEMALE_ONLY EQU 2
+ const_def
+ const TRADE_INTRO
+ const TRADE_CANCEL
+ const TRADE_WRONG
+ const TRADE_COMPLETE
+ const TRADE_AFTER
NPCTrade:: ; fcba8
ld a, e
@@ -40,7 +24,7 @@ NPCTrade:: ; fcba8
; Select givemon from party
ld b, PARTYMENUACTION_GIVE_MON
- callba SelectTradeOrDaycareMon
+ farcall SelectTradeOrDayCareMon
ld a, TRADE_CANCEL
jr c, .done
@@ -104,12 +88,12 @@ CheckTradeGender: ; fcc23
cp 1
jr z, .check_male
- callba GetGender
+ farcall GetGender
jr nz, .not_matching
jr .matching
.check_male
- callba GetGender
+ farcall GetGender
jr z, .not_matching
.matching
@@ -187,7 +171,7 @@ DoNPCTrade: ; fcc63
call Trade_GetAttributeOfCurrentPartymon
ld b, h
ld c, l
- callba GetCaughtGender
+ farcall GetCaughtGender
ld a, c
ld [wPlayerTrademonCaughtData], a
@@ -211,7 +195,7 @@ DoNPCTrade: ; fcc63
xor a
ld [MonType], a
ld [wPokemonWithdrawDepositParameter], a
- callab RemoveMonFromPartyOrBox
+ callfar RemoveMonFromPartyOrBox
predef TryAddMonToParty
ld e, TRADE_DIALOG
@@ -222,7 +206,7 @@ DoNPCTrade: ; fcc63
jr c, .incomplete
ld b, SET_FLAG
.incomplete
- callba SetGiftPartyMonCaughtData
+ farcall SetGiftPartyMonCaughtData
ld e, TRADE_NICK
call GetTradeAttribute
@@ -291,7 +275,7 @@ DoNPCTrade: ; fcc63
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
- callba ComputeNPCTrademonStats
+ farcall ComputeNPCTrademonStats
pop af
ld [CurPartyMon], a
pop hl
@@ -427,25 +411,7 @@ GetTradeMonNames: ; fce1b
; fce58
-NPCTrades: ; fce58
-npctrade: MACRO
- db \1, \2, \3, \4 ; dialog set, requested mon, offered mon, nickname
- db \5, \6 ; dvs
- shift
- db \6 ; item
- dw \7 ; OT ID
- db \8, \9, 0 ; OT name, gender requested
-ENDM
-
-
- npctrade 0, ABRA, MACHOP, "MUSCLE@@@@@", $37, $66, GOLD_BERRY, 37460, "MIKE@@@@@@@", TRADE_EITHER_GENDER
- npctrade 0, BELLSPROUT, ONIX, "ROCKY@@@@@@", $96, $66, BITTER_BERRY, 48926, "KYLE@@@@@@@", TRADE_EITHER_GENDER
- npctrade 1, KRABBY, VOLTORB, "VOLTY@@@@@@", $98, $88, PRZCUREBERRY, 29189, "TIM@@@@@@@@", TRADE_EITHER_GENDER
- npctrade 3, DRAGONAIR, DODRIO, "DORIS@@@@@@", $77, $66, SMOKE_BALL, 00283, "EMY@@@@@@@@", TRADE_FEMALE_ONLY
- npctrade 2, HAUNTER, XATU, "PAUL@@@@@@@", $96, $86, MYSTERYBERRY, 15616, "CHRIS@@@@@@", TRADE_EITHER_GENDER
- npctrade 3, CHANSEY, AERODACTYL, "AEROY@@@@@@", $96, $66, GOLD_BERRY, 26491, "KIM@@@@@@@@", TRADE_EITHER_GENDER
- npctrade 0, DUGTRIO, MAGNETON, "MAGGIE@@@@@", $96, $66, METAL_COAT, 50082, "FOREST@@@@@", TRADE_EITHER_GENDER
-; fcf38
+INCLUDE "data/npc_trades.asm"
PrintTradeText: ; fcf38
diff --git a/engine/odd_eggs.asm b/engine/odd_eggs.asm
new file mode 100644
index 000000000..5d67358f0
--- /dev/null
+++ b/engine/odd_eggs.asm
@@ -0,0 +1,96 @@
+GiveOddEgg: ; 1fb4b6
+ ; Figure out which egg to give.
+
+ ; Compare a random word to
+ ; probabilities out of 0xffff.
+ call Random
+ ld hl, OddEggProbabilities
+ ld c, 0
+ ld b, c
+.loop
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+
+ ; Break on $ffff.
+ ld a, d
+ cp $ffff / $100
+ jr nz, .not_done
+ ld a, e
+ cp $ffff % $100
+ jr z, .done
+.not_done
+
+ ; Break when [hRandom] <= de.
+ ld a, [hRandom + 1]
+ cp d
+ jr c, .done
+ jr z, .ok
+ jr .next
+.ok
+ ld a, [hRandom + 0]
+ cp e
+ jr c, .done
+ jr z, .done
+.next
+ inc bc
+ jr .loop
+.done
+
+ ld hl, OddEggs
+ ld a, OddEgg2 - OddEgg1
+ call AddNTimes
+
+ ld de, OddEggSpecies
+ ld bc, PARTYMON_STRUCT_LENGTH + 2 * PKMN_NAME_LENGTH
+ call CopyBytes
+
+ ld a, EGG_TICKET
+ ld [CurItem], a
+ ld a, 1
+ ld [wItemQuantityChangeBuffer], a
+ ld a, -1
+ ld [CurItemQuantity], a
+ ld hl, NumItems
+ call TossItem
+
+ ; load species in wcd2a
+ ld a, EGG
+ ld [wMobileMonSpeciesBuffer], a
+
+ ; load pointer to (wMobileMonSpeciesBuffer - 1) in wMobileMonSpeciesPointerBuffer
+ ld a, (wMobileMonSpeciesBuffer - 1) % $100
+ ld [wMobileMonSpeciesPointerBuffer], a
+ ld a, (wMobileMonSpeciesBuffer - 1) / $100
+ ld [wMobileMonSpeciesPointerBuffer + 1], a
+ ; load pointer to OddEggSpecies in wMobileMonStructurePointerBuffer
+ ld a, OddEggSpecies % $100
+ ld [wMobileMonStructurePointerBuffer], a
+ ld a, OddEggSpecies / $100
+ ld [wMobileMonStructurePointerBuffer + 1], a
+
+ ; load Odd Egg Name in wTempOddEggNickname
+ ld hl, .Odd
+ ld de, wTempOddEggNickname
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+
+ ; load pointer to wTempOddEggNickname in wMobileMonOTNamePointerBuffer
+ ld a, wTempOddEggNickname % $100
+ ld [wMobileMonOTNamePointerBuffer], a
+ ld a, wTempOddEggNickname / $100
+ ld [wMobileMonOTNamePointerBuffer + 1], a
+ ; load pointer to wOddEggName in wMobileMonNicknamePointerBuffer
+ ld a, wOddEggName % $100
+ ld [wMobileMonNicknamePointerBuffer], a
+ ld a, wOddEggName / $100
+ ld [wMobileMonNicknamePointerBuffer + 1], a
+ farcall AddMobileMonToParty
+ ret
+; 1fb546
+
+.Odd:
+ db "ODD@@@@@@@@@"
+
+INCLUDE "data/odd_eggs.asm"
diff --git a/engine/options_menu.asm b/engine/options_menu.asm
index ec41288ff..4ab215282 100755
--- a/engine/options_menu.asm
+++ b/engine/options_menu.asm
@@ -105,6 +105,11 @@ GetOptionPointer: ; e42d6
; e42f5
+ const_def
+ const OPT_TEXT_SPEED_FAST ; 0
+ const OPT_TEXT_SPEED_MED ; 1
+ const OPT_TEXT_SPEED_SLOW ; 2
+
Options_TextSpeed: ; e42f5
call GetTextSpeed
ld a, [hJoyPressed]
@@ -113,9 +118,9 @@ Options_TextSpeed: ; e42f5
bit D_RIGHT_F, a
jr z, .NonePressed
ld a, c ; right pressed
- cp SLOW_TEXT
+ cp OPT_TEXT_SPEED_SLOW
jr c, .Increase
- ld c, FAST_TEXT +- 1
+ ld c, OPT_TEXT_SPEED_FAST +- 1
.Increase:
inc c
@@ -126,7 +131,7 @@ Options_TextSpeed: ; e42f5
ld a, c
and a
jr nz, .Decrease
- ld c, SLOW_TEXT + 1
+ ld c, OPT_TEXT_SPEED_SLOW + 1
.Decrease:
dec c
@@ -154,38 +159,39 @@ Options_TextSpeed: ; e42f5
; e4331
.Strings:
+; entries correspond to OPT_TEXT_SPEED_* constants
dw .Fast
dw .Mid
dw .Slow
-.Fast:
- db "FAST@"
-.Mid:
- db "MID @"
-.Slow:
- db "SLOW@"
+.Fast: db "FAST@"
+.Mid: db "MID @"
+.Slow: db "SLOW@"
; e4346
GetTextSpeed: ; e4346
- ld a, [Options] ; This converts the number of frames, to 0, 1, 2 representing speed
- and 7
- cp 5 ; 5 frames of delay is slow
+; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c,
+; with previous/next TEXT_DELAY_* values in d/e
+ ld a, [Options]
+ and $7
+ cp TEXT_DELAY_SLOW
jr z, .slow
- cp 1 ; 1 frame of delay is fast
+ cp TEXT_DELAY_FAST
jr z, .fast
- ld c, MED_TEXT ; set it to mid if not one of the above
- lb de, 1, 5
+ ; none of the above
+ ld c, OPT_TEXT_SPEED_MED
+ lb de, TEXT_DELAY_FAST, TEXT_DELAY_SLOW
ret
.slow
- ld c, SLOW_TEXT
- lb de, 3, 1
+ ld c, OPT_TEXT_SPEED_SLOW
+ lb de, TEXT_DELAY_MED, TEXT_DELAY_FAST
ret
.fast
- ld c, FAST_TEXT
- lb de, 5, 3
+ ld c, OPT_TEXT_SPEED_FAST
+ lb de, TEXT_DELAY_SLOW, TEXT_DELAY_MED
ret
; e4365
@@ -227,10 +233,8 @@ Options_BattleScene: ; e4365
ret
; e4398
-.On:
- db "ON @"
-.Off:
- db "OFF@"
+.On: db "ON @"
+.Off: db "OFF@"
; e43a0
@@ -270,10 +274,8 @@ Options_BattleStyle: ; e43a0
ret
; e43d1
-.Shift:
- db "SHIFT@"
-.Set:
- db "SET @"
+.Shift: db "SHIFT@"
+.Set: db "SET @"
; e43dd
@@ -320,13 +322,18 @@ Options_Sound: ; e43dd
ret
; e4416
-.Mono:
- db "MONO @"
-.Stereo:
- db "STEREO@"
+.Mono: db "MONO @"
+.Stereo: db "STEREO@"
; e4424
+ const_def
+ const OPT_PRINT_LIGHTEST ; 0
+ const OPT_PRINT_LIGHTER ; 1
+ const OPT_PRINT_NORMAL ; 2
+ const OPT_PRINT_DARKER ; 3
+ const OPT_PRINT_DARKEST ; 4
+
Options_Print: ; e4424
call GetPrinterSetting
ld a, [hJoyPressed]
@@ -335,9 +342,9 @@ Options_Print: ; e4424
bit D_RIGHT_F, a
jr z, .NonePressed
ld a, c
- cp 4
+ cp OPT_PRINT_DARKEST
jr c, .Increase
- ld c, -1
+ ld c, OPT_PRINT_LIGHTEST - 1
.Increase:
inc c
@@ -348,7 +355,7 @@ Options_Print: ; e4424
ld a, c
and a
jr nz, .Decrease
- ld c, 5
+ ld c, OPT_PRINT_DARKEST + 1
.Decrease:
dec c
@@ -373,57 +380,56 @@ Options_Print: ; e4424
; e445a
.Strings:
+; entries correspond to OPT_PRINT_* constants
dw .Lightest
dw .Lighter
dw .Normal
dw .Darker
dw .Darkest
-.Lightest:
- db "LIGHTEST@"
-.Lighter:
- db "LIGHTER @"
-.Normal:
- db "NORMAL @"
-.Darker:
- db "DARKER @"
-.Darkest:
- db "DARKEST @"
+.Lightest: db "LIGHTEST@"
+.Lighter: db "LIGHTER @"
+.Normal: db "NORMAL @"
+.Darker: db "DARKER @"
+.Darkest: db "DARKEST @"
; e4491
GetPrinterSetting: ; e4491
- ld a, [GBPrinter] ; converts from the stored printer setting to 0,1,2,3,4
+; converts GBPRINTER_* value in a to OPT_PRINT_* value in c,
+; with previous/next GBPRINTER_* values in d/e
+ ld a, [GBPrinter]
and a
jr z, .IsLightest
- cp PRINT_LIGHTER
+ cp GBPRINTER_LIGHTER
jr z, .IsLight
- cp PRINT_DARKER
+ cp GBPRINTER_DARKER
jr z, .IsDark
- cp PRINT_DARKEST
+ cp GBPRINTER_DARKEST
jr z, .IsDarkest
- ld c, 2 ; normal if none of the above
- lb de, PRINT_LIGHTER, PRINT_DARKER ; the 2 values next to this setting
+ ; none of the above
+ ld c, OPT_PRINT_NORMAL
+ lb de, GBPRINTER_LIGHTER, GBPRINTER_DARKER
ret
.IsLightest:
- ld c, 0
- lb de, PRINT_DARKEST, PRINT_LIGHTER ; the 2 values next to this setting
+ ld c, OPT_PRINT_LIGHTEST
+ lb de, GBPRINTER_DARKEST, GBPRINTER_LIGHTER
ret
.IsLight:
- ld c, 1
- lb de, PRINT_LIGHTEST, PRINT_NORMAL ; the 2 values next to this setting
+ ld c, OPT_PRINT_LIGHTER
+ lb de, GBPRINTER_LIGHTEST, GBPRINTER_NORMAL
ret
.IsDark:
- ld c, 3
- lb de, PRINT_NORMAL, PRINT_DARKEST ; the 2 values next to this setting
+ ld c, OPT_PRINT_DARKER
+ lb de, GBPRINTER_NORMAL, GBPRINTER_DARKEST
ret
.IsDarkest:
- ld c, 4
- lb de, PRINT_DARKER, PRINT_LIGHTEST ; the 2 values next to this setting
+ ld c, OPT_PRINT_DARKEST
+ lb de, GBPRINTER_DARKER, GBPRINTER_LIGHTEST
ret
; e44c1
@@ -463,10 +469,8 @@ Options_MenuAccount: ; e44c1
ret
; e44f2
-.Off:
- db "OFF@"
-.On:
- db "ON @"
+.Off: db "OFF@"
+.On: db "ON @"
; e44fa
diff --git a/engine/overworld.asm b/engine/overworld.asm
index 4d22e55b6..a505ecd66 100755
--- a/engine/overworld.asm
+++ b/engine/overworld.asm
@@ -112,7 +112,7 @@ GetPlayerSprite: ; 14183
AddMapSprites: ; 141c9
- call GetMapPermission
+ call GetMapEnvironment
call CheckOutdoorMap
jr z, .outdoor
call AddIndoorSprites
@@ -178,14 +178,14 @@ MapCallbackSprites_LoadUsedSpritesGFX: ; 14209
ret nz
ld c, EMOTE_SHADOW
- callba LoadEmote
- call GetMapPermission
+ farcall LoadEmote
+ call GetMapEnvironment
call CheckOutdoorMap
- ld c, EMOTE_0B
+ ld c, EMOTE_GRASS_RUSTLE
jr z, .outdoor
ld c, EMOTE_BOULDER_DUST
.outdoor
- callba LoadEmote
+ farcall LoadEmote
ret
; 14236
@@ -232,9 +232,9 @@ GetMonSprite: ; 14259
cp SPRITE_POKEMON
jr c, .Normal
- cp SPRITE_DAYCARE_MON_1
+ cp SPRITE_DAY_CARE_MON_1
jr z, .wBreedMon1
- cp SPRITE_DAYCARE_MON_2
+ cp SPRITE_DAY_CARE_MON_2
jr z, .wBreedMon2
cp SPRITE_VARS
jr nc, .Variable
@@ -265,7 +265,7 @@ GetMonSprite: ; 14259
and a
jr z, .NoBreedmon
- callba LoadOverworldMonIcon
+ farcall LoadOverworldMonIcon
ld l, 1
ld h, 0
@@ -389,8 +389,8 @@ AddSpriteGFX: ; 142e5
LoadSpriteGFX: ; 14306
-; Bug: b is not preserved, so
-; it's useless as a next count.
+; Bug: b is not preserved, so it's useless as a next count.
+; Uncomment the lines below to fix.
ld hl, UsedSprites
ld b, SPRITE_GFX_LIST_CAPACITY
@@ -409,7 +409,9 @@ LoadSpriteGFX: ; 14306
ret
.LoadSprite:
+ ; push bc
call GetSprite
+ ; pop bc
ld a, l
ret
; 1431e
@@ -716,768 +718,11 @@ LoadEmote:: ; 1442f
ret
; 1444d
-emote_header: MACRO
- dw \1
- db \2 tiles, BANK(\1)
- dw VTiles1 tile \3
-ENDM
-
-EmotesPointers: ; 144d
-; dw source address
-; db length, bank
-; dw dest address
-
- emote_header ShockEmote, 4, $78
- emote_header QuestionEmote, 4, $78
- emote_header HappyEmote, 4, $78
- emote_header SadEmote, 4, $78
- emote_header HeartEmote, 4, $78
- emote_header BoltEmote, 4, $78
- emote_header SleepEmote, 4, $78
- emote_header FishEmote, 4, $78
- emote_header JumpShadowGFX, 1, $7c
- emote_header FishingRodGFX2, 2, $7c
- emote_header BoulderDustGFX, 2, $7e
- emote_header FishingRodGFX4, 1, $7e
-; 14495
-
-
-SpriteMons: ; 14495
- db UNOWN
- db GEODUDE
- db GROWLITHE
- db WEEDLE
- db SHELLDER
- db ODDISH
- db GENGAR
- db ZUBAT
- db MAGIKARP
- db SQUIRTLE
- db TOGEPI
- db BUTTERFREE
- db DIGLETT
- db POLIWAG
- db PIKACHU
- db CLEFAIRY
- db CHARMANDER
- db JYNX
- db STARMIE
- db BULBASAUR
- db JIGGLYPUFF
- db GRIMER
- db EKANS
- db PARAS
- db TENTACOOL
- db TAUROS
- db MACHOP
- db VOLTORB
- db LAPRAS
- db RHYDON
- db MOLTRES
- db SNORLAX
- db GYARADOS
- db LUGIA
- db HO_OH
-; 144b8
-
-
-OutdoorSprites: ; 144b8
-; Valid sprite IDs for each map group.
-
- dw Group1Sprites
- dw Group2Sprites
- dw Group3Sprites
- dw Group4Sprites
- dw Group5Sprites
- dw Group6Sprites
- dw Group7Sprites
- dw Group8Sprites
- dw Group9Sprites
- dw Group10Sprites
- dw Group11Sprites
- dw Group12Sprites
- dw Group13Sprites
- dw Group14Sprites
- dw Group15Sprites
- dw Group16Sprites
- dw Group17Sprites
- dw Group18Sprites
- dw Group19Sprites
- dw Group20Sprites
- dw Group21Sprites
- dw Group22Sprites
- dw Group23Sprites
- dw Group24Sprites
- dw Group25Sprites
- dw Group26Sprites
-; 144ec
-
-
-Group13Sprites: ; 144ec
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_TEACHER
- db SPRITE_FISHER
- db SPRITE_YOUNGSTER
- db SPRITE_BLUE
- db SPRITE_GRAMPS
- db SPRITE_BUG_CATCHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_SWIMMER_GIRL
- db SPRITE_SWIMMER_GUY
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 14503
-
-Group23Sprites: ; 14503
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_TEACHER
- db SPRITE_FISHER
- db SPRITE_YOUNGSTER
- db SPRITE_BLUE
- db SPRITE_GRAMPS
- db SPRITE_BUG_CATCHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_SWIMMER_GIRL
- db SPRITE_SWIMMER_GUY
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 1451a
-
-Group14Sprites: ; 1451a
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_TEACHER
- db SPRITE_FISHER
- db SPRITE_YOUNGSTER
- db SPRITE_BLUE
- db SPRITE_GRAMPS
- db SPRITE_BUG_CATCHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_SWIMMER_GIRL
- db SPRITE_SWIMMER_GUY
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 14531
-
-Group6Sprites: ; 14531
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_TEACHER
- db SPRITE_FISHER
- db SPRITE_YOUNGSTER
- db SPRITE_BLUE
- db SPRITE_GRAMPS
- db SPRITE_BUG_CATCHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_SWIMMER_GIRL
- db SPRITE_SWIMMER_GUY
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 14548
-
-Group7Sprites: ; 14548
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_COOLTRAINER_M
- db SPRITE_SUPER_NERD
- db SPRITE_COOLTRAINER_F
- db SPRITE_FISHER
- db SPRITE_YOUNGSTER
- db SPRITE_LASS
- db SPRITE_POKEFAN_M
- db SPRITE_ROCKET
- db SPRITE_MISTY
- db SPRITE_POKE_BALL
- db SPRITE_SLOWPOKE
-; 1455f
-
-Group25Sprites: ; 1455f
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_COOLTRAINER_M
- db SPRITE_SUPER_NERD
- db SPRITE_COOLTRAINER_F
- db SPRITE_FISHER
- db SPRITE_YOUNGSTER
- db SPRITE_LASS
- db SPRITE_POKEFAN_M
- db SPRITE_ROCKET
- db SPRITE_MISTY
- db SPRITE_POKE_BALL
- db SPRITE_SLOWPOKE
-; 14576
-
-Group21Sprites: ; 14576
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_FISHER
- db SPRITE_POLIWAG
- db SPRITE_TEACHER
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_LASS
- db SPRITE_BIKER
- db SPRITE_SILVER
- db SPRITE_BLUE
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 1458d
-
-Group18Sprites: ; 1458d
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_POKEFAN_M
- db SPRITE_MACHOP
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_FISHER
- db SPRITE_TEACHER
- db SPRITE_SUPER_NERD
- db SPRITE_BIG_SNORLAX
- db SPRITE_BIKER
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 145a4
-
-Group12Sprites: ; 145a4
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_POKEFAN_M
- db SPRITE_MACHOP
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_FISHER
- db SPRITE_TEACHER
- db SPRITE_SUPER_NERD
- db SPRITE_BIG_SNORLAX
- db SPRITE_BIKER
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 145bb
-
-Group17Sprites: ; 145bb
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_POKEFAN_M
- db SPRITE_MACHOP
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_FISHER
- db SPRITE_TEACHER
- db SPRITE_SUPER_NERD
- db SPRITE_BIG_SNORLAX
- db SPRITE_BIKER
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 145d2
-
-Group16Sprites: ; 145d2
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_POKEFAN_M
- db SPRITE_BUENA
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_FISHER
- db SPRITE_TEACHER
- db SPRITE_SUPER_NERD
- db SPRITE_MACHOP
- db SPRITE_BIKER
- db SPRITE_POKE_BALL
- db SPRITE_BOULDER
-; 145e9
-
-Group24Sprites: ; 145e9
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_SILVER
- db SPRITE_TEACHER
- db SPRITE_FISHER
- db SPRITE_COOLTRAINER_M
- db SPRITE_YOUNGSTER
- db SPRITE_MONSTER
- db SPRITE_GRAMPS
- db SPRITE_BUG_CATCHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 14600
-
-Group26Sprites: ; 14600
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_SILVER
- db SPRITE_TEACHER
- db SPRITE_FISHER
- db SPRITE_COOLTRAINER_M
- db SPRITE_YOUNGSTER
- db SPRITE_MONSTER
- db SPRITE_GRAMPS
- db SPRITE_BUG_CATCHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 14617
-
-Group19Sprites: ; 14617
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_SILVER
- db SPRITE_TEACHER
- db SPRITE_FISHER
- db SPRITE_COOLTRAINER_M
- db SPRITE_YOUNGSTER
- db SPRITE_MONSTER
- db SPRITE_GRAMPS
- db SPRITE_BUG_CATCHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 1462e
-
-Group10Sprites: ; 1462e
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_FISHER
- db SPRITE_LASS
- db SPRITE_OFFICER
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_COOLTRAINER_M
- db SPRITE_BUG_CATCHER
- db SPRITE_SUPER_NERD
- db SPRITE_WEIRD_TREE
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 14645
-
-Group4Sprites: ; 14645
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_FISHER
- db SPRITE_LASS
- db SPRITE_OFFICER
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_COOLTRAINER_M
- db SPRITE_BUG_CATCHER
- db SPRITE_SUPER_NERD
- db SPRITE_WEIRD_TREE
- db SPRITE_POKE_BALL
- db SPRITE_FRUIT_TREE
-; 1465c
-
-Group8Sprites: ; 1465c
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_KURT_OUTSIDE
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_OFFICER
- db SPRITE_POKEFAN_M
- db SPRITE_BLACK_BELT
- db SPRITE_TEACHER
- db SPRITE_AZALEA_ROCKET
- db SPRITE_LASS
- db SPRITE_SILVER
- db SPRITE_FRUIT_TREE
- db SPRITE_SLOWPOKE
-; 14673
-
-Group11Sprites: ; 14673
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_POKE_BALL
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_OFFICER
- db SPRITE_POKEFAN_M
- db SPRITE_DAYCARE_MON_1
- db SPRITE_COOLTRAINER_F
- db SPRITE_ROCKET
- db SPRITE_LASS
- db SPRITE_DAYCARE_MON_2
- db SPRITE_FRUIT_TREE
- db SPRITE_SLOWPOKE
-; 1468a
-
-Group22Sprites: ; 1468a
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_STANDING_YOUNGSTER
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_OLIVINE_RIVAL
- db SPRITE_POKEFAN_M
- db SPRITE_LASS
- db SPRITE_BUENA
- db SPRITE_SWIMMER_GIRL
- db SPRITE_SAILOR
- db SPRITE_POKEFAN_F
- db SPRITE_SUPER_NERD
- db SPRITE_TAUROS
- db SPRITE_FRUIT_TREE
- db SPRITE_ROCK
-; 146a1
-
-Group1Sprites: ; 146a1
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_STANDING_YOUNGSTER
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_OLIVINE_RIVAL
- db SPRITE_POKEFAN_M
- db SPRITE_LASS
- db SPRITE_BUENA
- db SPRITE_SWIMMER_GIRL
- db SPRITE_SAILOR
- db SPRITE_POKEFAN_F
- db SPRITE_SUPER_NERD
- db SPRITE_TAUROS
- db SPRITE_FRUIT_TREE
- db SPRITE_ROCK
-; 146b8
-
-Group9Sprites: ; 146b8
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_LANCE
- db SPRITE_GRAMPS
- db SPRITE_SUPER_NERD
- db SPRITE_COOLTRAINER_F
- db SPRITE_FISHER
- db SPRITE_COOLTRAINER_M
- db SPRITE_LASS
- db SPRITE_YOUNGSTER
- db SPRITE_GYARADOS
- db SPRITE_FRUIT_TREE
- db SPRITE_POKE_BALL
-; 146cf
-
-Group2Sprites: ; 146cf
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_LASS
- db SPRITE_SUPER_NERD
- db SPRITE_COOLTRAINER_M
- db SPRITE_POKEFAN_M
- db SPRITE_BLACK_BELT
- db SPRITE_COOLTRAINER_F
- db SPRITE_FISHER
- db SPRITE_FRUIT_TREE
- db SPRITE_POKE_BALL
-; 146e6
-
-Group5Sprites: ; 146e6
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_GRAMPS
- db SPRITE_YOUNGSTER
- db SPRITE_LASS
- db SPRITE_SUPER_NERD
- db SPRITE_COOLTRAINER_M
- db SPRITE_POKEFAN_M
- db SPRITE_BLACK_BELT
- db SPRITE_COOLTRAINER_F
- db SPRITE_FISHER
- db SPRITE_FRUIT_TREE
- db SPRITE_POKE_BALL
-; 146fd
-
-Group3Sprites: ; 146fd
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_GAMEBOY_KID
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_LASS
- db SPRITE_POKEFAN_F
- db SPRITE_TEACHER
- db SPRITE_YOUNGSTER
- db SPRITE_GROWLITHE
- db SPRITE_POKEFAN_M
- db SPRITE_ROCKER
- db SPRITE_FISHER
- db SPRITE_SCIENTIST
- db SPRITE_POKE_BALL
- db SPRITE_BOULDER
-; 14714
-
-Group15Sprites: ; 14714
- db SPRITE_SUICUNE
- db SPRITE_SILVER_TROPHY
- db SPRITE_FAMICOM
- db SPRITE_POKEDEX
- db SPRITE_WILL
- db SPRITE_KAREN
- db SPRITE_NURSE
- db SPRITE_OLD_LINK_RECEPTIONIST
- db SPRITE_BIG_LAPRAS
- db SPRITE_BIG_ONIX
- db SPRITE_SUDOWOODO
- db SPRITE_BIG_SNORLAX
- db SPRITE_SAILOR
- db SPRITE_FISHING_GURU
- db SPRITE_GENTLEMAN
- db SPRITE_SUPER_NERD
- db SPRITE_HO_OH
- db SPRITE_TEACHER
- db SPRITE_COOLTRAINER_F
- db SPRITE_YOUNGSTER
- db SPRITE_FAIRY
- db SPRITE_POKE_BALL
- db SPRITE_ROCK
-; 1472b
-
-Group20Sprites: ; 1472b
- db SPRITE_OAK
- db SPRITE_FISHER
- db SPRITE_TEACHER
- db SPRITE_TWIN
- db SPRITE_POKEFAN_M
- db SPRITE_GRAMPS
- db SPRITE_FAIRY
- db SPRITE_SILVER
- db SPRITE_FISHING_GURU
- db SPRITE_POKE_BALL
- db SPRITE_POKEDEX
-; 14736
-
-
-SpriteHeaders: ; 14736
-INCLUDE "gfx/overworld/sprite_headers.asm"
-; 1499a
+
+INCLUDE "data/emote_headers.asm"
+
+INCLUDE "data/sprite_mons.asm"
+
+INCLUDE "data/maps/outdoor_sprites.asm"
+
+INCLUDE "gfx/sprite_headers.asm"
diff --git a/engine/pack.asm b/engine/pack.asm
index dad9a799d..2b0d04aba 100644
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -118,12 +118,12 @@ Pack: ; 10000
ret
.TMHMPocketMenu: ; 100e8 (4:40e8)
- callba TMHMPocket
+ farcall TMHMPocket
ld b, $5
ld c, $1
call Pack_InterpretJoypad
ret c
- callba _CheckTossableItem
+ farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .use_quit
@@ -192,15 +192,15 @@ Pack: ; 10000
; 10159
.UseItem: ; 10159
- callba AskTeachTMHM
+ farcall AskTeachTMHM
ret c
- callba ChooseMonToLearnTMHM
+ farcall ChooseMonToLearnTMHM
jr c, .declined
ld hl, Options
ld a, [hl]
push af
res NO_TEXT_SCROLL, [hl]
- callba TeachTMHM
+ farcall TeachTMHM
pop af
ld [Options], a
.declined
@@ -240,29 +240,29 @@ Pack: ; 10000
ret
.ItemBallsKey_LoadSubmenu: ; 101c5 (4:41c5)
- callba _CheckTossableItem
+ farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .tossable
- callba CheckSelectableItem
+ farcall CheckSelectableItem
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .selectable
- callba CheckItemMenu
+ farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .usable
jr .unusable
.selectable
- callba CheckItemMenu
+ farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .selectable_usable
jr .selectable_unusable
.tossable
- callba CheckSelectableItem
+ farcall CheckSelectableItem
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .tossable_selectable
@@ -455,7 +455,7 @@ Jumptable_GiveTossQuit: ; 1030b
; 10311
UseItem: ; 10311
- callba CheckItemMenu
+ farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .dw
rst JumpTable
@@ -512,7 +512,7 @@ UseItem: ; 10311
TossMenu: ; 10364
ld hl, Text_ThrowAwayHowMany
call Pack_PrintTextNoScroll
- callba SelectQuantityToToss
+ farcall SelectQuantityToToss
push af
call ExitMenu
pop af
@@ -566,7 +566,7 @@ ResetPocketCursorPositions: ; 1039d
; 103c2
RegisterItem: ; 103c2
- callba CheckSelectableItem
+ farcall CheckSelectableItem
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .cant_register
@@ -606,16 +606,16 @@ GiveItem: ; 103fd
ld a, PARTYMENUACTION_GIVE_ITEM
ld [PartyMenuActionText], a
call ClearBGPalettes
- callba LoadPartyMenuGFX
- callba InitPartyMenuWithCancel
- callba InitPartyMenuGFX
+ farcall LoadPartyMenuGFX
+ farcall InitPartyMenuWithCancel
+ farcall InitPartyMenuGFX
.loop
- callba WritePartyMenuTilemap
- callba PrintPartyMenuText
+ farcall WritePartyMenuTilemap
+ farcall PrintPartyMenuText
call WaitBGMap
call SetPalettes
call DelayFrame
- callba PartyMenuSelect
+ farcall PartyMenuSelect
jr c, .finish
ld a, [CurPartySpecies]
cp EGG
@@ -786,7 +786,7 @@ BattlePack: ; 10493
ret
.TMHMPocketMenu: ; 10581 (4:4581)
- callba TMHMPocket
+ farcall TMHMPocket
ld b, $5
ld c, $1
call Pack_InterpretJoypad
@@ -824,7 +824,7 @@ BattlePack: ; 10493
ret
ItemSubmenu: ; 105d3 (4:45d3)
- callba CheckItemContext
+ farcall CheckItemContext
ld a, [wItemAttributeParamBuffer]
TMHMSubmenu: ; 105dc (4:45dc)
and a
@@ -890,7 +890,7 @@ TMHMSubmenu: ; 105dc (4:45dc)
; 10629
.Use: ; 10629
- callba CheckItemContext
+ farcall CheckItemContext
ld a, [wItemAttributeParamBuffer]
ld hl, .ItemFunctionJumptable
rst JumpTable
@@ -1043,7 +1043,7 @@ DepositSellPack: ; 106be
ld a, 3
call InitPocket
call WaitBGMap_DrawPackGFX
- callba TMHMPocket
+ farcall TMHMPocket
ld a, [CurItem]
ld [CurItem], a
ret
@@ -1130,7 +1130,7 @@ TutorialPack: ; 107bb
ld a, [InputType]
or a
jr z, .loop
- callba _DudeAutoInput_RightA
+ farcall _DudeAutoInput_RightA
.loop
call .RunJumptable
call DepositSellTutorial_InterpretJoypad
@@ -1207,7 +1207,7 @@ TutorialPack: ; 107bb
ld a, 3
call InitPocket
call WaitBGMap_DrawPackGFX
- callba TMHMPocket
+ farcall TMHMPocket
ld a, [CurItem]
ld [CurItem], a
ret
@@ -1310,15 +1310,15 @@ DrawPackGFX: ; 1089d
ret
.female
- callba DrawKrisPackGFX
+ farcall DrawKrisPackGFX
ret
; 108cc
PackGFXPointers: ; 108cc
- dw PackGFX + $f0 * 1
- dw PackGFX + $f0 * 3
- dw PackGFX + $f0 * 0
- dw PackGFX + $f0 * 2
+ dw PackGFX + (15 tiles) * 1
+ dw PackGFX + (15 tiles) * 3
+ dw PackGFX + (15 tiles) * 0
+ dw PackGFX + (15 tiles) * 2
; 108d4
Pack_InterpretJoypad: ; 108d4 (4:48d4)
@@ -1377,7 +1377,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4)
ret
.select
- callba SwitchItemsInBag
+ farcall SwitchItemsInBag
ld hl, Text_MoveItemWhere
call Pack_PrintTextNoScroll
scf
@@ -1394,7 +1394,7 @@ Pack_InterpretJoypad: ; 108d4 (4:48d4)
ret
.place_insert
- callba SwitchItemsInBag
+ farcall SwitchItemsInBag
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
@@ -1716,6 +1716,6 @@ TextJump_YouCantUseItInABattle: ; 0x10b11
; 0x10b16
PackMenuGFX:
-INCBIN "gfx/misc/pack_menu.2bpp"
+INCBIN "gfx/pack/pack_menu.2bpp"
PackGFX:
-INCBIN "gfx/misc/pack.2bpp"
+INCBIN "gfx/pack/pack.2bpp"
diff --git a/engine/party_menu.asm b/engine/party_menu.asm
index 266451c37..e89fdab19 100644
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -13,7 +13,7 @@ SelectMonFromParty: ; 50000
; 5001d
-SelectTradeOrDaycareMon: ; 5001d
+SelectTradeOrDayCareMon: ; 5001d
ld a, b
ld [PartyMenuActionText], a
call DisableSpriteUpdates
@@ -40,8 +40,8 @@ InitPartyMenuLayout: ; 5003f
LoadPartyMenuGFX: ; 5004f
call LoadFontsBattleExtra
- callab InitPartyMenuPalettes ; engine/color.asm
- callab ClearSpriteAnims2
+ callfar InitPartyMenuPalettes ; engine/color.asm
+ callfar ClearSpriteAnims2
ret
; 5005f
@@ -662,7 +662,7 @@ InitPartyMenuGFX: ; 503e0
pop bc
dec c
jr nz, .loop
- callab PlaySpriteAnimations
+ callfar PlaySpriteAnimations
ret
; 50405
diff --git a/engine/buena_phone_scripts.asm b/engine/phone/buenas_password.asm
index 858ce5540..858ce5540 100644
--- a/engine/buena_phone_scripts.asm
+++ b/engine/phone/buenas_password.asm
diff --git a/engine/phone/generic_calls.asm b/engine/phone/generic_calls.asm
new file mode 100644
index 000000000..e1b53a950
--- /dev/null
+++ b/engine/phone/generic_calls.asm
@@ -0,0 +1,1266 @@
+PhoneScript_Random2:
+ random 2
+ end
+
+PhoneScript_Random3:
+ random 3
+ end
+
+PhoneScript_Random4:
+ random 4
+ end
+
+PhoneScript_Random5:
+ random 5
+ end
+
+PhoneScript_Random11:
+ random 11
+ end
+
+PhoneScript_AnswerPhone_Male:
+ checkday
+ iftrue PhoneScript_AnswerPhone_Male_Day
+ checknite
+ iftrue PhoneScript_AnswerPhone_Male_Nite
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_JUGGLER_IRWIN, .Irwin
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_BLACKBELT_KENJI, .Kenji
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1b4dc5
+ buttonsound
+ end
+
+.Huey:
+ farwritetext UnknownText_0x1b5073
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x1b5270
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x1b55ae
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x1b589a
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1b5a3b
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x1b5c10
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x1b5f7a
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x1b60f5
+ buttonsound
+ end
+
+.Irwin:
+ farwritetext UnknownText_0x1b638c
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x1b6454
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x1b659d
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x1b67e2
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x1b69a8
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x1b6b39
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x1b6c96
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x1b7019
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x1b71d5
+ buttonsound
+ end
+
+.Kenji:
+ farwritetext UnknownText_0x1b730b
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x1b73c7
+ buttonsound
+ end
+
+PhoneScript_AnswerPhone_Male_Day:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_JUGGLER_IRWIN, .Irwin
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_BLACKBELT_KENJI, .Kenji
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1b4ded
+ buttonsound
+ end
+
+.Huey:
+ farwritetext UnknownText_0x1b509b
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x1b52a5
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x1b55da
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x1b58c2
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1b5a74
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x1b5c63
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x1b5f9e
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x1b611b
+ buttonsound
+ end
+
+.Irwin:
+ farwritetext UnknownText_0x1b63a8
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x1b647e
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x1b65c7
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x1b680e
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x1b69d2
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x1b6b65
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x1b6cc6
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x1b7057
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x1b71fc
+ buttonsound
+ end
+
+.Kenji:
+ farwritetext UnknownText_0x1b7331
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x1b73ef
+ buttonsound
+ end
+
+PhoneScript_AnswerPhone_Male_Nite:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_JUGGLER_IRWIN, .Irwin
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_BLACKBELT_KENJI, .Kenji
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1b4e16
+ buttonsound
+ end
+
+.Huey:
+ farwritetext UnknownText_0x1b50c2
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x1b52cc
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x1b55fc
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x1b58ea
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1b5a9f
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x1b5cb6
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x1b5fc9
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x1b6149
+ buttonsound
+ end
+
+.Irwin:
+ farwritetext UnknownText_0x1b63c4
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x1b64a8
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x1b65e3
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x1b6836
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x1b69f8
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x1b6b92
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x1b6cf6
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x1b7092
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x1b722a
+ buttonsound
+ end
+
+.Kenji:
+ farwritetext UnknownText_0x1b7357
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x1b7417
+ buttonsound
+ end
+
+PhoneScript_AnswerPhone_Female:
+ checkday
+ iftrue PhoneScript_AnswerPhone_Female_Day
+ checknite
+ iftrue PhoneScript_AnswerPhone_Female_Nite
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1b4f21
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x1b53f7
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1b5702
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x1b5d9f
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1b626a
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x1b66c8
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x1b6e7c
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x1b751a
+ buttonsound
+ end
+
+PhoneScript_AnswerPhone_Female_Day:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1b4f4d
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x1b5424
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1b572e
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x1b5dcc
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1b6296
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x1b66ec
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x1b6ea6
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x1b7548
+ buttonsound
+ end
+
+PhoneScript_AnswerPhone_Female_Nite:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1b4f75
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x1b5446
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1b575a
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x1b5df8
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1b62c5
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x1b6713
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x1b6ec9
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x1b756f
+ buttonsound
+ end
+
+PhoneScript_GreetPhone_Male:
+ checkday
+ iftrue PhoneScript_GreetPhone_Male_Day
+ checknite
+ iftrue PhoneScript_GreetPhone_Male_Nite
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_JUGGLER_IRWIN, .Irwin
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_BLACKBELT_KENJI, .Kenji
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1b4e3e
+ buttonsound
+ end
+
+.Huey:
+ farwritetext UnknownText_0x1b50e9
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x1b5301
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x1b5628
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x1b5912
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1b5ad8
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x1b5d09
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x1b5ff6
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x1b616e
+ buttonsound
+ end
+
+.Irwin:
+ farwritetext UnknownText_0x1b63e3
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x1b64d2
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x1b660d
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x1b6862
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x1b6a22
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x1b6bb9
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x1b6d26
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x1b70e7
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x1b725c
+ buttonsound
+ end
+
+.Kenji:
+ farwritetext UnknownText_0x1b737f
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x1b743f
+ buttonsound
+ end
+
+PhoneScript_GreetPhone_Male_Day:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_JUGGLER_IRWIN, .Irwin
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_BLACKBELT_KENJI, .Kenji
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1b4e72
+ buttonsound
+ end
+
+.Huey:
+ farwritetext UnknownText_0x1b511a
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x1b5335
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x1b564c
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x1b5948
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1b5b0b
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x1b5d21
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x1b6017
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x1b618f
+ buttonsound
+ end
+
+.Irwin:
+ farwritetext UnknownText_0x1b6407
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x1b6506
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x1b6624
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x1b6890
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x1b6a56
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x1b6bef
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x1b6d57
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x1b7112
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x1b7283
+ buttonsound
+ end
+
+.Kenji:
+ farwritetext UnknownText_0x1b7397
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x1b746f
+ buttonsound
+ end
+
+PhoneScript_GreetPhone_Male_Nite:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_JUGGLER_IRWIN, .Irwin
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_BLACKBELT_KENJI, .Kenji
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1b4e9e
+ buttonsound
+ end
+
+.Huey:
+ farwritetext UnknownText_0x1b5154
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x1b535f
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x1b5670
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x1b597c
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1b5b37
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x1b5d39
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x1b6041
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x1b61bd
+ buttonsound
+ end
+
+.Irwin:
+ farwritetext UnknownText_0x1b642c
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x1b6539
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x1b663b
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x1b68ba
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x1b6a8b
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x1b6c23
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x1b6d88
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x1b7132
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x1b72a5
+ buttonsound
+ end
+
+.Kenji:
+ farwritetext UnknownText_0x1b73af
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x1b749b
+ buttonsound
+ end
+
+PhoneScript_GreetPhone_Female:
+ checkday
+ iftrue PhoneScript_GreetPhone_Female_Day
+ checknite
+ iftrue PhoneScript_GreetPhone_Female_Nite
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1b4fa1
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x1b5472
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1b5786
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x1b5e25
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1b62f1
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x1b6738
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x1b6ef3
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x1b758f
+ buttonsound
+ end
+
+PhoneScript_GreetPhone_Female_Day:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1b4fda
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x1b54a6
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1b57b7
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x1b5e59
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1b630e
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x1b6757
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x1b6f1c
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x1b75ac
+ buttonsound
+ end
+
+PhoneScript_GreetPhone_Female_Nite:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1b5004
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x1b54d4
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1b57e8
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x1b5e8e
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1b6331
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x1b6776
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x1b6f37
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x1b75c9
+ buttonsound
+ end
+
+PhoneScript_Generic_Male:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1b4ecd
+ buttonsound
+ end
+
+.Unknown:
+ farwritetext UnknownText_0x1b518b
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x1b5393
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x1b5694
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x1b59b2
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1b5b68
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x1b5d51
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x1b606f
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x1b61f2
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x1b656c
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x1b6652
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x1b68e8
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x1b6ac2
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x1b6c56
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x1b6db9
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x1b7161
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x1b72d0
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x1b74c8
+ buttonsound
+ end
+
+PhoneScript_Generic_Female:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1b502b
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x1b5510
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1b5819
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x1b5ebe
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1b6352
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x1b6795
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x1b6f60
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x1b75e5
+ buttonsound
+ end
+
+PhoneScript_MonFlavorText:
+ special RandomPhoneMon
+ farscall PhoneScript_Random2
+ if_equal $0, .TooEnergetic
+ farwritetext UnknownText_0x1b518b
+ buttonsound
+ farjump PhoneScript_HangupText_Male
+
+.TooEnergetic:
+ farjump .unnecessary
+
+.unnecessary
+ farwritetext UnknownText_0x1b522b
+ buttonsound
+ farjump PhoneScript_HangupText_Male
+; be643
+
+
+GrandmaString: db "Grandma@"
+GrandpaString: db "Grandpa@"
+MomString: db "Mom@"
+DadString: db "Dad@"
+SisterString: db "Sister@"
+BrotherString: db "Brother@"
+
diff --git a/engine/phone.asm b/engine/phone/phone.asm
index f5f39218d..53bb519b3 100644
--- a/engine/phone.asm
+++ b/engine/phone/phone.asm
@@ -154,7 +154,7 @@ CheckPhoneCall:: ; 90074 (24:4074)
ret
.timecheck ; 900a6 (24:40a6)
- callba CheckReceiveCallTimer
+ farcall CheckReceiveCallTimer
ret
CheckPhoneContactTimeOfDay: ; 900ad (24:40ad)
@@ -163,9 +163,9 @@ CheckPhoneContactTimeOfDay: ; 900ad (24:40ad)
push de
push af
- callba CheckTime
+ farcall CheckTime
pop af
- and (1 << MORN) + (1 << DAY) + (1 << NITE)
+ and MORN | DAY | NITE
and c
pop de
@@ -201,9 +201,9 @@ ChooseRandomCaller: ; 900bf (24:40bf)
ret
GetAvailableCallers: ; 900de (24:40de)
- callba CheckTime
+ farcall CheckTime
ld a, c
- ld [EngineBuffer1], a ; wd03e (aliases: MenuItemsList, CurFruitTree, CurInput)
+ ld [EngineBuffer1], a
ld hl, EngineBuffer3
ld bc, 11
xor a
@@ -219,7 +219,7 @@ GetAvailableCallers: ; 900de (24:40de)
ld hl, PhoneContacts + PHONE_CONTACT_SCRIPT2_TIME
ld bc, PHONE_TABLE_WIDTH
call AddNTimes
- ld a, [EngineBuffer1] ; wd03e (aliases: MenuItemsList, CurFruitTree, CurInput)
+ ld a, [EngineBuffer1]
and [hl]
jr z, .not_good_for_call
ld bc, PHONE_CONTACT_MAP_GROUP - PHONE_CONTACT_SCRIPT2_TIME
@@ -308,7 +308,7 @@ CheckSpecialPhoneCall:: ; 90136 (24:4136)
ret
SpecialCallOnlyWhenOutside: ; 90188
- ld a, [wPermission]
+ ld a, [wEnvironment]
cp TOWN
jr z, .outside
cp ROUTE
@@ -381,11 +381,11 @@ Function90199: ; 90199 (24:4199)
.DoPhoneCall:
ld a, b
- ld [wd002], a
+ ld [PhoneScriptBank], a
ld a, l
- ld [wd003], a
+ ld [PhoneCaller], a
ld a, h
- ld [wd004], a
+ ld [PhoneCaller + 1], a
ld b, BANK(UnknownScript_0x90205)
ld de, UnknownScript_0x90205
call ExecuteCallbackScript
@@ -471,7 +471,7 @@ UnknownScript_0x90261: ; 0x90261
RingTwice_StartCall: ; 9026f
call .Ring
call .Ring
- callba TrainerRankings_PhoneCalls
+ farcall TrainerRankings_PhoneCalls
ret
; 9027c
@@ -495,12 +495,12 @@ PhoneCall:: ; 9029a
ld a, b
ld [PhoneScriptBank], a
ld a, e
- ld [PhoneCallerLo], a
+ ld [PhoneCaller], a
ld a, d
- ld [PhoneCallerHi], a
+ ld [PhoneCaller + 1], a
call Phone_FirstOfTwoRings
call Phone_FirstOfTwoRings
- callba TrainerRankings_PhoneCalls
+ farcall TrainerRankings_PhoneCalls
ret
; 902b3
@@ -518,14 +518,14 @@ Phone_FirstOfTwoRings: ; 902b3
Phone_CallerTextboxWithName2: ; 902c9
call Phone_CallerTextbox
hlcoord 1, 2
- ld [hl], $62
+ ld [hl], "<PHONE>"
inc hl
inc hl
ld a, [PhoneScriptBank]
ld b, a
- ld a, [PhoneCallerLo]
+ ld a, [PhoneCaller]
ld e, a
- ld a, [PhoneCallerHi]
+ ld a, [PhoneCaller + 1]
ld d, a
call FarPlaceString
ret
@@ -599,7 +599,7 @@ Phone_StartRinging: ; 9033f
call PlaySFX
call Phone_CallerTextbox
call UpdateSprites
- callba PhoneRing_LoadEDTile
+ farcall PhoneRing_CopyTilemapAtOnce
ret
; 90355
@@ -609,7 +609,7 @@ HangUp_Wait20Frames: ; 90355
Phone_Wait20Frames
ld c, 20
call DelayFrames
- callba PhoneRing_LoadEDTile
+ farcall PhoneRing_CopyTilemapAtOnce
ret
; 90363
@@ -618,7 +618,7 @@ Function90363: ; 90363 (24:4363)
push bc
call Phone_CallerTextbox
hlcoord 1, 1
- ld [hl], $62
+ ld [hl], "<PHONE>"
inc hl
inc hl
ld d, h
@@ -725,7 +725,7 @@ NonTrainerCallerNames: ; 903d6
Phone_GetTrainerName: ; 90423 (24:4423)
push hl
push bc
- callba GetTrainerName
+ farcall GetTrainerName
pop bc
pop hl
ret
@@ -733,7 +733,7 @@ Phone_GetTrainerName: ; 90423 (24:4423)
Phone_GetTrainerClassName: ; 9042e (24:442e)
push hl
push bc
- callba GetTrainerClassName
+ farcall GetTrainerClassName
pop bc
pop hl
ret
@@ -754,95 +754,17 @@ GetCallerLocation: ; 90439
push bc
call GetWorldMapLocation
ld e, a
- callba GetLandmarkName
+ farcall GetLandmarkName
pop bc
pop de
ret
; 9045f
-PhoneContacts: ; 9045f
-phone: MACRO
- db \1, \2 ; trainer
- map \3 ; map
- db \4
- dba \5 ; script 1
- db \6
- dba \7 ; script 2
-ENDM
-
- phone TRAINER_NONE, PHONE_00, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
- phone TRAINER_NONE, PHONECONTACT_MOM, KRISS_HOUSE_1F, 7, MomPhoneScript, 0, UnusedPhoneScript
- phone TRAINER_NONE, PHONECONTACT_BIKESHOP, OAKS_LAB, 0, UnusedPhoneScript, 0, UnusedPhoneScript
- phone TRAINER_NONE, PHONECONTACT_BILL, N_A, 7, BillPhoneScript1, 0, BillPhoneScript2
- phone TRAINER_NONE, PHONECONTACT_ELM, ELMS_LAB, 7, ElmPhoneScript1, 0, ElmPhoneScript2
- phone SCHOOLBOY, JACK1, NATIONAL_PARK, 7, JackPhoneScript1, 7, JackPhoneScript2
- phone POKEFANF, BEVERLY1, NATIONAL_PARK, 7, BeverlyPhoneScript1, 7, BeverlyPhoneScript2
- phone SAILOR, HUEY1, OLIVINE_LIGHTHOUSE_2F, 7, HueyPhoneScript1, 7, HueyPhoneScript2
- phone TRAINER_NONE, PHONE_00, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
- phone TRAINER_NONE, PHONE_00, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
- phone TRAINER_NONE, PHONE_00, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
- phone COOLTRAINERM, GAVEN3, ROUTE_26, 7, GavenPhoneScript1, 7, GavenPhoneScript2
- phone COOLTRAINERF, BETH1, ROUTE_26, 7, BethPhoneScript1, 7, BethPhoneScript2
- phone BIRD_KEEPER, JOSE2, ROUTE_27, 7, JosePhoneScript1, 7, JosePhoneScript2
- phone COOLTRAINERF, REENA1, ROUTE_27, 7, ReenaPhoneScript1, 7, ReenaPhoneScript2
- phone YOUNGSTER, JOEY1, ROUTE_30, 7, JoeyPhoneScript1, 7, JoeyPhoneScript2
- phone BUG_CATCHER, WADE1, ROUTE_31, 7, WadePhoneScript1, 7, WadePhoneScript2
- phone FISHER, RALPH1, ROUTE_32, 7, RalphPhoneScript1, 7, RalphPhoneScript2
- phone PICNICKER, LIZ1, ROUTE_32, 7, LizPhoneScript1, 7, LizPhoneScript2
- phone HIKER, ANTHONY2, ROUTE_33, 7, AnthonyPhoneScript1, 7, AnthonyPhoneScript2
- phone CAMPER, TODD1, ROUTE_34, 7, ToddPhoneScript1, 7, ToddPhoneScript2
- phone PICNICKER, GINA1, ROUTE_34, 7, GinaPhoneScript1, 7, GinaPhoneScript2
- phone JUGGLER, IRWIN1, ROUTE_35, 7, IrwinPhoneScript1, 7, IrwinPhoneScript2
- phone BUG_CATCHER, ARNIE1, ROUTE_35, 7, ArniePhoneScript1, 7, ArniePhoneScript2
- phone SCHOOLBOY, ALAN1, ROUTE_36, 7, AlanPhoneScript1, 7, AlanPhoneScript2
- phone TRAINER_NONE, PHONE_00, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
- phone LASS, DANA1, ROUTE_38, 7, DanaPhoneScript1, 7, DanaPhoneScript2
- phone SCHOOLBOY, CHAD1, ROUTE_38, 7, ChadPhoneScript1, 7, ChadPhoneScript2
- phone POKEFANM, DEREK1, ROUTE_39, 7, DerekPhoneScript1, 7, DerekPhoneScript2
- phone FISHER, TULLY1, ROUTE_42, 7, TullyPhoneScript1, 7, TullyPhoneScript2
- phone POKEMANIAC, BRENT1, ROUTE_43, 7, BrentPhoneScript1, 7, BrentPhoneScript2
- phone PICNICKER, TIFFANY3, ROUTE_43, 7, TiffanyPhoneScript1, 7, TiffanyPhoneScript2
- phone BIRD_KEEPER, VANCE1, ROUTE_44, 7, VancePhoneScript1, 7, VancePhoneScript2
- phone FISHER, WILTON1, ROUTE_44, 7, WiltonPhoneScript1, 7, WiltonPhoneScript2
- phone BLACKBELT_T, KENJI3, ROUTE_45, 7, KenjiPhoneScript1, 7, KenjiPhoneScript2
- phone HIKER, PARRY1, ROUTE_45, 7, ParryPhoneScript1, 7, ParryPhoneScript2
- phone PICNICKER, ERIN1, ROUTE_46, 7, ErinPhoneScript1, 7, ErinPhoneScript2
- phone TRAINER_NONE, PHONECONTACT_BUENA, GOLDENROD_DEPT_STORE_ROOF, 7, BuenaPhoneScript1, 7, BuenaPhoneScript2
-; 90627
-
-SpecialPhoneCallList: ; 90627
- dw SpecialCallOnlyWhenOutside
- db PHONE_ELM
- dba ElmPhoneScript2
-
- dw SpecialCallOnlyWhenOutside
- db PHONE_ELM
- dba ElmPhoneScript2
-
- dw SpecialCallOnlyWhenOutside
- db PHONE_ELM
- dba ElmPhoneScript2
-
- dw SpecialCallOnlyWhenOutside
- db PHONE_ELM
- dba ElmPhoneScript2
-
- dw SpecialCallWhereverYouAre
- db PHONE_ELM
- dba ElmPhoneScript2
-
- dw SpecialCallWhereverYouAre
- db PHONE_OAK ; ????????
- dba BikeShopPhoneScript ; bike shop
-
- dw SpecialCallWhereverYouAre
- db PHONE_MOM
- dba MomPhoneLectureScript
-
- dw SpecialCallOnlyWhenOutside
- db PHONE_ELM
- dba ElmPhoneScript2
-; 90657
+
+INCLUDE "data/phone_contacts.asm"
+
+INCLUDE "data/phone_special.asm"
+
UnknownScript_0x90657: ; 0x90657
writetext UnknownText_0x9065b
diff --git a/engine/phone/phone_callers.asm b/engine/phone/phone_callers.asm
new file mode 100644
index 000000000..c90448d33
--- /dev/null
+++ b/engine/phone/phone_callers.asm
@@ -0,0 +1,961 @@
+Phone_GenericCall_Male:
+ special RandomPhoneMon
+ farscall PhoneScript_Random2
+ if_equal 0, .Bragging
+ farscall PhoneScript_Generic_Male
+ farjump Phone_FoundAMon_Male
+
+.Bragging:
+ farjump Phone_BraggingCall_Male
+
+Phone_GenericCall_Female:
+ special RandomPhoneMon
+ farscall PhoneScript_Random2
+ if_equal 0, .Bragging
+ farscall PhoneScript_Generic_Female
+ farjump Phone_FoundAMon_Female
+
+.Bragging:
+ farjump Phone_BraggingCall_Female
+
+Phone_BraggingCall_Male:
+ farscall Phone_WhosBragging_Male
+ farjump Phone_FoundAMon_Male
+
+Phone_BraggingCall_Female:
+ farscall Phone_WhosBragging_Female
+ farjump Phone_FoundAMon_Female
+
+Phone_FoundAMon_Male:
+ special RandomPhoneWildMon
+ farscall PhoneScript_Random2
+ if_equal 0, .GotAway
+ farscall Phone_WhoDefeatedMon_Male
+ farjump PhoneScript_HangupText_Male
+
+.GotAway:
+ farjump Phone_GotAwayCall_Male
+
+Phone_FoundAMon_Female:
+ special RandomPhoneWildMon
+ farscall PhoneScript_Random2
+ if_equal 0, .GotAway
+ farscall Phone_WhoDefeatedMon_Female
+ farjump PhoneScript_HangupText_Female
+
+.GotAway:
+ farjump Phone_GotAwayCall_Female
+
+Phone_GotAwayCall_Male:
+ farscall Phone_WhoLostAMon_Male
+ farjump PhoneScript_HangupText_Male
+
+Phone_GotAwayCall_Female:
+ farscall Phone_WhoLostAMon_Female
+ farjump PhoneScript_HangupText_Female
+
+Phone_WhosBragging_Male:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext JackIntelligenceText
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext GavenGreaterText
+ buttonsound
+ end
+
+.Jose:
+ farwritetext JoseAromaText
+ buttonsound
+ end
+
+.Joey:
+ farwritetext JoeySharperText
+ buttonsound
+ end
+
+.Wade:
+ farwritetext WadeAreYouGrowingText
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext RalphNeglectingKidsText
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext AnthonyAteBerriesText
+ buttonsound
+ end
+
+.Todd:
+ farwritetext ToddLooksCuteLikeMeText
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext ArnieLovesTheCuteText
+ buttonsound
+ end
+
+.Alan:
+ farwritetext AlanGettingStrongerText
+ buttonsound
+ end
+
+.Chad:
+ farwritetext ChadObservingWildText
+ buttonsound
+ end
+
+.Derek:
+ farwritetext DerekCheekPincherText
+ buttonsound
+ end
+
+.Tully:
+ farwritetext TullyGrownText
+ buttonsound
+ end
+
+.Brent:
+ farwritetext BrentRareTradeText
+ buttonsound
+ end
+
+.Vance:
+ farwritetext VanceLiftoffText
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext WiltonGrownText
+ buttonsound
+ end
+
+.Parry:
+ farwritetext ParryNoMatchText
+ buttonsound
+ end
+
+Phone_WhosBragging_Female:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x174688
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x174c7f
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1752f5
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x175fda
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1771fd
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x64f74
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x665ad
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x6717a
+ buttonsound
+ end
+
+Phone_WhoDefeatedMon_Male:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext JackDefeatedMonText
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x174a80
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x174f90
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x175591
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x175869
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x175c24
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x176aef
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x176e9c
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x64a13
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x64cf3
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x65318
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x65b29
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x65e42
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x6613c
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x669b2
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x66b3e
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x66fc0
+ buttonsound
+ end
+
+Phone_WhoDefeatedMon_Female:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1746c3
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x174cf6
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x17536b
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x17602d
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x177237
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x64fb2
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x66605
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x671a4
+ buttonsound
+ end
+
+Phone_WhoLostAMon_Male:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x174165
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x174b2d
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x174ffd
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x175611
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1758e4
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x175c9f
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x176b45
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x176eee
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x64a71
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x64d4f
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x65399
+ buttonsound
+ end
+
+.Derek:
+ farwritetext UnknownText_0x65bc8
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x65eac
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x6618c
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x669ed
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x66b8f
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x67001
+ buttonsound
+ end
+
+Phone_WhoLostAMon_Female:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x174734
+ buttonsound
+ end
+
+.Beth:
+ farwritetext UnknownText_0x174d86
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x1753c5
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x176095
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x177297
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x6501c
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x66688
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x671eb
+ buttonsound
+ end
+
+PhoneScript_WantsToBattle_Male:
+ farscall PhoneScript_RematchText_Male
+ farjump PhoneScript_HangupText_Male
+
+PhoneScript_WantsToBattle_Female:
+ farscall PhoneScript_RematchText_Female
+ farjump PhoneScript_HangupText_Female
+
+PhoneScript_RematchText_Male:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x1741e1
+ buttonsound
+ end
+
+.Huey:
+ farwritetext UnknownText_0x1748ea
+ buttonsound
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x174bc5
+ buttonsound
+ end
+
+.Jose:
+ farwritetext UnknownText_0x17507d
+ buttonsound
+ end
+
+.Joey:
+ farwritetext UnknownText_0x175693
+ buttonsound
+ end
+
+.Wade:
+ farwritetext UnknownText_0x175976
+ buttonsound
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x175d40
+ buttonsound
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x176bee
+ buttonsound
+ end
+
+.Todd:
+ farwritetext UnknownText_0x176f60
+ buttonsound
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x64ada
+ buttonsound
+ end
+
+.Alan:
+ farwritetext UnknownText_0x64da4
+ buttonsound
+ end
+
+.Chad:
+ farwritetext UnknownText_0x65419
+ buttonsound
+ end
+
+.Tully:
+ farwritetext UnknownText_0x65f17
+ buttonsound
+ end
+
+.Brent:
+ farwritetext UnknownText_0x66214
+ buttonsound
+ end
+
+.Vance:
+ farwritetext UnknownText_0x66a3a
+ buttonsound
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x66bf3
+ buttonsound
+ end
+
+.Parry:
+ farwritetext UnknownText_0x67096
+ buttonsound
+ end
+
+PhoneScript_RematchText_Female:
+ checkcode VAR_CALLERID
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beth:
+ farwritetext UnknownText_0x174e4e
+ buttonsound
+ end
+
+.Reena:
+ farwritetext UnknownText_0x17543a
+ buttonsound
+ end
+
+.Liz:
+ farwritetext UnknownText_0x17610a
+ buttonsound
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1772e2
+ buttonsound
+ end
+
+.Dana:
+ farwritetext UnknownText_0x65091
+ buttonsound
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x66730
+ buttonsound
+ end
+
+.Erin:
+ farwritetext UnknownText_0x6722e
+ buttonsound
+ end
+
+LizWrongNumberScript:
+ farwritetext LizHiTaniaText
+ end
+
+TiffanyItsAwful:
+ farwritetext TiffanyItsAwfulText
+ end
+
+PhoneScript_HangupText_Male:
+ checkcode VAR_CALLERID
+ if_equal PHONE_SCHOOLBOY_JACK, .Jack
+ if_equal PHONE_SAILOR_HUEY, .Huey
+ if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_YOUNGSTER_JOEY, .Joey
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_FISHER_RALPH, .Ralph
+ if_equal PHONE_HIKER_ANTHONY, .Anthony
+ if_equal PHONE_CAMPER_TODD, .Todd
+ if_equal PHONE_JUGGLER_IRWIN, .Irwin
+ if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_SCHOOLBOY_CHAD, .Chad
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_POKEMANIAC_BRENT, .Brent
+ if_equal PHONE_BIRDKEEPER_VANCE, .Vance
+ if_equal PHONE_FISHER_WILTON, .Wilton
+ if_equal PHONE_BLACKBELT_KENJI, .Kenji
+ if_equal PHONE_HIKER_PARRY, .Parry
+
+.Jack:
+ farwritetext UnknownText_0x174251
+ end
+
+.Huey:
+ farwritetext UnknownText_0x174962
+ end
+
+.Gaven:
+ farwritetext UnknownText_0x174c0e
+ end
+
+.Jose:
+ farwritetext UnknownText_0x175106
+ end
+
+.Joey:
+ farwritetext UnknownText_0x17570a
+ end
+
+.Wade:
+ farwritetext UnknownText_0x1759e7
+ end
+
+.Ralph:
+ farwritetext UnknownText_0x175db7
+ end
+
+.Anthony:
+ farwritetext UnknownText_0x176c47
+ end
+
+.Todd:
+ farwritetext UnknownText_0x176fdb
+ end
+
+.Irwin:
+ farwritetext UnknownText_0x64000
+ end
+
+.Arnie:
+ farwritetext UnknownText_0x64b48
+ end
+
+.Alan:
+ farwritetext UnknownText_0x64e1f
+ end
+
+.Chad:
+ farwritetext UnknownText_0x65471
+ end
+
+.Derek:
+ farwritetext UnknownText_0x65c4e
+ end
+
+.Tully:
+ farwritetext UnknownText_0x65f6e
+ end
+
+.Brent:
+ farwritetext UnknownText_0x662a9
+ end
+
+.Vance:
+ farwritetext UnknownText_0x66a93
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x66c58
+ end
+
+.Kenji:
+ farwritetext UnknownText_0x66dab
+ end
+
+.Parry:
+ farwritetext UnknownText_0x670eb
+ end
+
+PhoneScript_HangupText_Female:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_COOLTRAINERF_BETH, .Beth
+ if_equal PHONE_COOLTRAINERF_REENA, .Reena
+ if_equal PHONE_PICNICKER_LIZ, .Liz
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+ if_equal PHONE_PICNICKER_ERIN, .Erin
+
+.Beverly:
+ farwritetext UnknownText_0x1747ac
+ end
+
+.Beth:
+ farwritetext UnknownText_0x174eb7
+ end
+
+.Reena:
+ farwritetext UnknownText_0x175488
+ end
+
+.Liz:
+ farwritetext UnknownText_0x17620a
+ end
+
+.Gina:
+ farwritetext UnknownText_0x177361
+ end
+
+.Dana:
+ farwritetext UnknownText_0x650e2
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x667f7
+ end
+
+.Erin:
+ farwritetext UnknownText_0x67281
+ end
+
+Phone_CheckIfUnseenRare_Male:
+ scall PhoneScriptRareWildMon
+ iffalse .HangUp
+ farjump Phone_GenericCall_Male
+
+.HangUp:
+ farjump PhoneScript_HangupText_Male
+
+Phone_CheckIfUnseenRare_Female:
+ scall PhoneScriptRareWildMon
+ iffalse .HangUp
+ farjump Phone_GenericCall_Female
+
+.HangUp:
+ farjump PhoneScript_HangupText_Female
+
+PhoneScriptRareWildMon:
+ special RandomUnseenWildMon
+ end
+
+PhoneScript_BugCatchingContest:
+ checkcode VAR_CALLERID
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+
+.Wade:
+ farwritetext WadeBugCatchingContestText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Derek:
+ farwritetext DerekBugCatchingContestText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinRocketRumor:
+ farwritetext UnknownText_0x64032
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa05c6:
+ farwritetext UnknownText_0x177378
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa05ce:
+ farwritetext UnknownText_0x64b5f
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa05d6:
+ farwritetext UnknownText_0x175dd9
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa05de:
+ farwritetext UnknownText_0x176c61
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+PhoneScript_FoundItem_Male:
+ checkcode VAR_CALLERID
+ if_equal PHONE_BIRDKEEPER_JOSE, .Jose
+ if_equal PHONE_BUG_CATCHER_WADE, .Wade
+ if_equal PHONE_SCHOOLBOY_ALAN, .Alan
+ if_equal PHONE_POKEFANM_DEREK, .Derek
+ if_equal PHONE_FISHER_TULLY, .Tully
+ if_equal PHONE_FISHER_WILTON, .Wilton
+
+.Jose:
+ farwritetext JoseFoundSomethingText
+ end
+
+.Wade:
+ farwritetext WadeFoundBerryText
+ end
+
+.Alan:
+ farwritetext UnknownText_0x64e2f
+ end
+
+.Derek:
+ farwritetext UnknownText_0x65cf9
+ end
+
+.Tully:
+ farwritetext UnknownText_0x65f88
+ end
+
+.Wilton:
+ farwritetext UnknownText_0x66c6b
+ end
+
+PhoneScript_FoundItem_Female:
+ checkcode VAR_CALLERID
+ if_equal PHONE_POKEFAN_BEVERLY, .Beverly
+ if_equal PHONE_PICNICKER_GINA, .Gina
+ if_equal PHONE_LASS_DANA, .Dana
+ if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
+
+.Beverly:
+ farwritetext BeverlyFoundNuggetText
+ end
+
+.Gina:
+ farwritetext UnknownText_0x1773e7
+ end
+
+.Dana:
+ farwritetext UnknownText_0x650ec
+ end
+
+.Tiffany:
+ farwritetext UnknownText_0x66801
+ end
+
+UnknownScript_0xa0644:
+ farwritetext UnknownText_0x176feb
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+KenjiCallingPhoneScript:
+ farwritetext UnknownText_0x66dc5
+ buttonsound
+ jump PhoneScript_HangupText_Male
diff --git a/engine/phone/phone_gossip.asm b/engine/phone/phone_gossip.asm
new file mode 100644
index 000000000..8f45c8807
--- /dev/null
+++ b/engine/phone/phone_gossip.asm
@@ -0,0 +1,698 @@
+JackTriviaScript:
+ random 11
+ if_equal 0, .Thunder
+ if_equal 1, .Rollout
+ if_equal 2, .Solarbeam
+ if_equal 3, .Stomp
+ if_equal 4, .Gust
+ if_equal 5, .Twister
+ if_equal 6, .Earthquake
+ if_equal 7, .Magnitude
+ if_equal 8, .Sandstorm
+ if_equal 9, .SunnyDay
+ if_equal 10, .RainDance
+
+.Thunder:
+ farwritetext JackThunderTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Rollout:
+ farwritetext JackRolloutTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Solarbeam:
+ farwritetext JackSolarbeamTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Stomp:
+ farwritetext JackStompTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Gust:
+ farwritetext JackGustTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Twister:
+ farwritetext JackTwisterTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Earthquake:
+ farwritetext JackEarthquakeTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Magnitude:
+ farwritetext JackMagnitudeTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Sandstorm:
+ farwritetext JackSandstormTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.SunnyDay:
+ farwritetext JackSunnyDayTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.RainDance:
+ farwritetext JackRainDanceTriviaText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa06da:
+ random 10
+ if_equal 0, .RuinsOfAlph
+ if_equal 1, .Falkner
+ if_equal 2, .Earl
+ if_equal 3, .SurfPikachu
+ if_equal 4, .MooMooMilk
+ if_equal 5, .Salon
+ if_equal 6, .Whitney
+ if_equal 7, .BugCatchingContest
+ if_equal 8, .BeautifulMon
+ if_equal 9, .Forgot
+
+.RuinsOfAlph:
+ farwritetext UnknownText_0x176223
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.Falkner:
+ farwritetext UnknownText_0x1762c3
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.Earl:
+ farwritetext UnknownText_0x17638a
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.SurfPikachu:
+ farwritetext UnknownText_0x176424
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.MooMooMilk:
+ farwritetext UnknownText_0x1764eb
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.Salon:
+ farwritetext UnknownText_0x176599
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.Whitney:
+ farwritetext UnknownText_0x1766ac
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.BugCatchingContest:
+ farwritetext UnknownText_0x17674f
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.BeautifulMon:
+ farwritetext UnknownText_0x176816
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+.Forgot:
+ farwritetext UnknownText_0x17686d
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+ChadOakGossipScript:
+ random 10
+ if_equal 0, .Blue
+ if_equal 1, .Daisy
+ if_equal 2, .ProfElm
+ if_equal 3, .Dream
+ if_equal 4, .Kurt
+ if_equal 5, .League
+ if_equal 6, .RadioShow
+ if_equal 7, .Battling
+ if_equal 8, .DaisyTea
+ if_equal 9, .Traveled
+
+.Blue:
+ farwritetext ChadBlueGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Daisy:
+ farwritetext ChadDaisyGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.ProfElm:
+ farwritetext ChadProfElmGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Dream:
+ farwritetext ChadDreamGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Kurt:
+ farwritetext ChadKurtGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.League:
+ farwritetext ChadLeagueGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.RadioShow:
+ farwritetext ChadRadioShowGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Battling:
+ farwritetext ChadBattlingGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.DaisyTea:
+ farwritetext ChadDaisyTeaGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Traveled:
+ farwritetext ChadTravelGossipText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+BrentBillTriviaScript:
+ random 10
+ if_equal 0, .Father
+ if_equal 1, .Grandpa
+ if_equal 2, .Goldenrod
+ if_equal 3, .Route25
+ if_equal 4, .Abra
+ if_equal 5, .Sister
+ if_equal 6, .Milk
+ if_equal 7, .Battling
+ if_equal 8, .FlowerShop
+ if_equal 9, .KimonoGirl
+
+.Father:
+ farwritetext UnknownText_0x662bc
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Grandpa:
+ farwritetext UnknownText_0x662fc
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Goldenrod:
+ farwritetext UnknownText_0x66335
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Route25:
+ farwritetext UnknownText_0x66366
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Abra:
+ farwritetext UnknownText_0x663a1
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Sister:
+ farwritetext UnknownText_0x663e6
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Milk:
+ farwritetext UnknownText_0x66421
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Battling:
+ farwritetext UnknownText_0x6645f
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.FlowerShop:
+ farwritetext UnknownText_0x6649b
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.KimonoGirl:
+ farwritetext UnknownText_0x664dd
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinRumorScript:
+ checkevent EVENT_OPENED_MT_SILVER
+ iftrue IrwinMtSilver
+ checkevent EVENT_FOUGHT_SNORLAX
+ iftrue IrwinSnorlax
+ checkevent EVENT_GOT_PASS_FROM_COPYCAT
+ iftrue IrwinTrainPass
+ checkflag ENGINE_MARSHBADGE
+ iftrue IrwinMarshBadge
+ checkflag ENGINE_FLYPOINT_VERMILION
+ iftrue IrwinVermilionCity
+ checkevent EVENT_BEAT_ELITE_FOUR
+ iftrue IrwinEliteFour
+ checkflag ENGINE_RISINGBADGE
+ iftrue IrwinRisingBadge
+ checkevent EVENT_CLEARED_RADIO_TOWER
+ iftrue IrwinRadioTower
+ checkevent EVENT_CLEARED_ROCKET_HIDEOUT
+ iftrue IrwinRocketHideout
+ checkevent EVENT_JASMINE_RETURNED_TO_GYM
+ iftrue IrwinJasmineReturned
+ checkflag ENGINE_FOGBADGE
+ iftrue IrwinFogBadge
+ checkflag ENGINE_PLAINBADGE
+ iftrue IrwinPlainBadge
+ farwritetext IrwinCalledRightAwayText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinPlainBadge:
+ farwritetext UnknownText_0x64099
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinJasmineReturned:
+ farwritetext UnknownText_0x640e6
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinRocketHideout:
+ farwritetext UnknownText_0x6416d
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinRadioTower:
+ farwritetext UnknownText_0x641e8
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinRisingBadge:
+ farwritetext UnknownText_0x64247
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinEliteFour:
+ farwritetext UnknownText_0x642bb
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinVermilionCity:
+ farwritetext UnknownText_0x643d4
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinTrainPass:
+ farwritetext UnknownText_0x64448
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinSnorlax:
+ farwritetext UnknownText_0x6455b
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinMtSilver:
+ farwritetext UnknownText_0x645ff
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinFogBadge:
+ farwritetext UnknownText_0x646df
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+IrwinMarshBadge:
+ farwritetext UnknownText_0x647d8
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+JackPhoneTips:
+ farwritetext UnknownText_0x1745c2
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0900:
+ farwritetext UnknownText_0x17485b
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0908:
+ farwritetext UnknownText_0x17496b
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0910:
+ farwritetext UnknownText_0x174c29
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0918:
+ farwritetext UnknownText_0x174ec5
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0920:
+ farwritetext UnknownText_0x17519b
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0928:
+ farwritetext UnknownText_0x17549b
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0930:
+ farwritetext UnknownText_0x17571d
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0938:
+ farwritetext UnknownText_0x175abe
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0940:
+ farwritetext UnknownText_0x175eaf
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0948:
+ farwritetext UnknownText_0x1768b0
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0950:
+ farwritetext UnknownText_0x176d32
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0958:
+ farwritetext UnknownText_0x1770fb
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0960:
+ farwritetext UnknownText_0x177465
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0968:
+ farwritetext UnknownText_0x64bc6
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0970:
+ farwritetext UnknownText_0x64e90
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0978:
+ farwritetext UnknownText_0x65161
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0980:
+ farwritetext UnknownText_0x65a23
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0988:
+ farwritetext UnknownText_0x65d5c
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0990:
+ farwritetext UnknownText_0x65ff2
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0998:
+ farwritetext UnknownText_0x6651e
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa09a0:
+ farwritetext UnknownText_0x66882
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+VanceLookingForward:
+ farwritetext VanceLookingForwardText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+WiltonHaventFoundAnything:
+ farwritetext WiltonHaventFoundAnythingText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+ParryBattleWithMe:
+ farwritetext ParryBattleWithMeText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+ErinWorkingHardScript:
+ farwritetext ErinWorkingHardText
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa09c8:
+ random 3
+ if_equal 0, UnknownScript_0xa09d6
+ if_equal 1, UnknownScript_0xa09de
+ if_equal 2, UnknownScript_0xa09e6
+
+UnknownScript_0xa09d6:
+ farwritetext UnknownText_0x64846
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa09de:
+ farwritetext UnknownText_0x64881
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa09e6:
+ farwritetext UnknownText_0x648dc
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+KenjiAnswerPhoneScript:
+ checkcode VAR_KENJI_BREAK
+ if_equal 2, .Training
+ if_equal 1, .OnBreak
+ farwritetext UnknownText_0x66e17
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Training:
+ farwritetext UnknownText_0x66e67
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.OnBreak:
+ checkmorn
+ iftrue .Morning
+ checknite
+ iftrue .Night
+ setevent EVENT_KENJI_ON_BREAK
+ farwritetext KenjiBreakText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Morning:
+ farwritetext UnknownText_0x66ed3
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+.Night:
+ farwritetext UnknownText_0x66f52
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+JackWantsBattleScript:
+ farwritetext UnknownText_0x174638
+ end
+
+HueyWantsBattleScript:
+ farwritetext UnknownText_0x1749c7
+ end
+
+UnknownScript_0xa0a37:
+ farwritetext UnknownText_0x174c49
+ end
+
+BethBattleReminderScript:
+ farwritetext BethForgetDealText
+ end
+
+UnknownScript_0xa0a41:
+ farwritetext UnknownText_0x17520a
+ end
+
+UnknownScript_0xa0a46:
+ farwritetext UnknownText_0x1754e5
+ end
+
+UnknownScript_0xa0a4b:
+ farwritetext UnknownText_0x175786
+ end
+
+UnknownScript_0xa0a50:
+ farwritetext UnknownText_0x175b1e
+ end
+
+UnknownScript_0xa0a55:
+ farwritetext UnknownText_0x175f11
+ end
+
+UnknownScript_0xa0a5a:
+ farwritetext UnknownText_0x1769da
+ end
+
+UnknownScript_0xa0a5f:
+ farwritetext UnknownText_0x176d85
+ end
+
+UnknownScript_0xa0a64:
+ farwritetext UnknownText_0x177138
+ end
+
+UnknownScript_0xa0a69:
+ farwritetext UnknownText_0x1774c1
+ end
+
+UnknownScript_0xa0a6e:
+ farwritetext UnknownText_0x64c13
+ end
+
+UnknownScript_0xa0a73:
+ farwritetext UnknownText_0x64ed4
+ end
+
+UnknownScript_0xa0a78:
+ farwritetext UnknownText_0x651bf
+ end
+
+UnknownScript_0xa0a7d:
+ farwritetext UnknownText_0x65a63
+ end
+
+UnknownScript_0xa0a82:
+ farwritetext UnknownText_0x66043
+ end
+
+UnknownScript_0xa0a87:
+ farwritetext UnknownText_0x66579
+ end
+
+UnknownScript_0xa0a8c:
+ farwritetext UnknownText_0x668a3
+ end
+
+VanceHurryHurry:
+ farwritetext VanceHurryHurryText
+ end
+
+WiltonNotBiting:
+ farwritetext WiltonNotBitingText
+ end
+
+ParryHaventYouGottenTo:
+ farwritetext ParryHaventYouGottenToText
+ end
+
+ErinComeBattleScript:
+ farwritetext ErinComeBattleText
+ end
+
+UnknownScript_0xa0aa5:
+ farwritetext UnknownText_0x174895
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0aad:
+ farwritetext UnknownText_0x17529c
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0ab5:
+ farwritetext UnknownText_0x175b6d
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0abd:
+ farwritetext UnknownText_0x17750e
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0ac5:
+ farwritetext UnknownText_0x64f1a
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0acd:
+ farwritetext UnknownText_0x6520f
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+UnknownScript_0xa0ad5:
+ farwritetext UnknownText_0x65da6
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0add:
+ farwritetext UnknownText_0x66087
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0ae5:
+ farwritetext UnknownText_0x6691d
+ buttonsound
+ jump PhoneScript_HangupText_Female
+
+WiltonWantThis:
+ farwritetext WiltonWantThisText
+ buttonsound
+ jump PhoneScript_HangupText_Male
+
+UnknownScript_0xa0af5:
+ farwritetext UnknownText_0x175f70
+ end
+
+UnknownScript_0xa0afa:
+ farwritetext UnknownText_0x176dd1
+ end
+
+UnknownScript_0xa0aff:
+ farwritetext UnknownText_0x64c5a
+ end
+
+UnknownScript_0xa0b04:
+ farwritetext UnknownText_0x17717c
+ end
+
+BikeShopPhoneScript:
+ farwritetext UnknownText_0x174000
+ clearflag ENGINE_BIKE_SHOP_CALL_ENABLED
+ specialphonecall SPECIALCALL_NONE
+ end
diff --git a/engine/phone/phone_scripts.asm b/engine/phone/phone_scripts.asm
new file mode 100644
index 000000000..62eb4ac87
--- /dev/null
+++ b/engine/phone/phone_scripts.asm
@@ -0,0 +1,1886 @@
+UnusedPhoneScript: ; 0xbcea5
+ farwritetext UnusedPhoneText
+ end
+
+; Mom
+
+MomPhoneScript: ; 0xbceaa
+ checkevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST
+ iftrue .bcec5
+ checkevent EVENT_DUDE_TALKED_TO_YOU
+ iftrue MomPhoneLectureScript
+ checkevent EVENT_GAVE_MYSTERY_EGG_TO_ELM
+ iftrue MomPhoneNoGymQuestScript
+ checkevent EVENT_GOT_A_POKEMON_FROM_ELM
+ iftrue MomPhoneNoPokedexScript
+ jump MomPhoneNoPokemonScript
+
+.bcec5 ; 0xbcec5
+ checkevent EVENT_IN_YOUR_ROOM
+ iftrue MomPhoneHangUpScript
+ farwritetext MomPhoneGreetingText
+ buttonsound
+ mapnametotext $0
+ checkcode VAR_ROOFPALETTE
+ if_equal $1, MomPhonePalette1
+ if_equal $2, MomPhonePalette2
+ jump MomPhoneOther
+
+MomPhoneLandmark: ; 0xbcedf
+ farwritetext MomPhoneLandmarkText
+ buttonsound
+ jump MomSavingMoney
+
+MomPhonePalette1: ; 0xbcee7
+ checkcode VAR_MAPGROUP
+ if_equal GROUP_NEW_BARK_TOWN, .newbark
+ if_equal GROUP_CHERRYGROVE_CITY, .cherrygrove
+ if_equal GROUP_VIOLET_CITY, .violet
+ if_equal GROUP_AZALEA_TOWN, .azalea
+ if_equal GROUP_GOLDENROD_CITY, .goldenrod
+ farwritetext MomPhoneGenericAreaText
+ buttonsound
+ jump MomSavingMoney
+
+.newbark ; 0xbcf05
+ farwritetext MomPhoneNewBarkText
+ buttonsound
+ jump MomSavingMoney
+
+.cherrygrove ; 0xbcf0d
+ farwritetext MomPhoneCherrygroveText
+ buttonsound
+ jump MomSavingMoney
+
+.violet ; 0xbcf15
+ landmarktotext SPROUT_TOWER, 1
+ jump MomPhoneLandmark
+.azalea ; 0xbcf1b
+ landmarktotext SLOWPOKE_WELL, 1
+ jump MomPhoneLandmark
+.goldenrod ; 0xbcf21
+ landmarktotext RADIO_TOWER, 1
+ jump MomPhoneLandmark
+
+MomPhonePalette2: ; 0xbcf27
+ farwritetext MomOtherAreaText
+ buttonsound
+ jump MomSavingMoney
+
+MomPhoneOther: ; 0xbcf2f
+ farwritetext MomDeterminedText
+ buttonsound
+ jump MomSavingMoney
+
+MomSavingMoney: ; 0xbcf37
+ checkflag ENGINE_MOM_SAVING_MONEY
+ iffalse MomIsNotSaving
+ checkmoney $1, 0
+ if_equal $0, MomSavingHasMoney
+ jump MomSavingButBroke
+
+MomIsNotSaving: ; 0xbcf49
+ checkmoney $1, 0
+ if_equal $0, MomHasMoney
+ jump MomHasNoMoney
+
+MomSavingHasMoney: ; 0xbcf55
+ readmoney $1, $0
+ farwritetext MomCheckBalanceText
+ yesorno
+ iftrue MomPhoneSaveMoneyScript
+ jump MomPhoneWontSaveMoneyScript
+
+MomSavingButBroke: ; 0xbcf63
+ farwritetext MomImportantToSaveText
+ yesorno
+ iftrue MomPhoneSaveMoneyScript
+ jump MomPhoneWontSaveMoneyScript
+
+MomHasNoMoney: ; 0xbcf6e
+ farwritetext MomYoureNotSavingText
+ yesorno
+ iftrue MomPhoneSaveMoneyScript
+ jump MomPhoneWontSaveMoneyScript
+
+MomHasMoney: ; 0xbcf79
+ readmoney $1, $0
+ farwritetext MomYouveSavedText
+ yesorno
+ iftrue MomPhoneSaveMoneyScript
+ jump MomPhoneWontSaveMoneyScript
+
+MomPhoneSaveMoneyScript: ; 0xbcf87
+ setflag ENGINE_MOM_SAVING_MONEY
+ farwritetext MomOKIllSaveText
+ buttonsound
+ jump MomPhoneHangUpScript
+
+MomPhoneWontSaveMoneyScript: ; 0xbcf92
+ clearflag ENGINE_MOM_SAVING_MONEY
+ farwritetext MomPhoneWontSaveMoneyText
+ buttonsound
+ jump MomPhoneHangUpScript
+
+MomPhoneHangUpScript: ; 0xbcf9d
+ farwritetext MomPhoneHangUpText
+ end
+
+MomPhoneNoPokemonScript: ; 0xbcfa2
+ farwritetext MomPhoneNoPokemonText
+ end
+
+MomPhoneNoPokedexScript: ; 0xbcfa7
+ farwritetext MomPhoneNoPokedexText
+ end
+
+MomPhoneNoGymQuestScript: ; 0xbcfac
+ farwritetext MomPhoneNoGymQuestText
+ end
+
+MomPhoneLectureScript: ; 0xbcfb1
+ setevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST
+ setflag ENGINE_DST
+ specialphonecall SPECIALCALL_NONE
+ farwritetext MomPhoneLectureText
+ yesorno
+ iftrue MomPhoneSaveMoneyScript
+ jump MomPhoneWontSaveMoneyScript
+
+; Bill
+
+BillPhoneScript1: ; 0xbcfc5
+ checkday
+ iftrue .daygreet
+ checknite
+ iftrue .nitegreet
+ farwritetext BillPhoneMornGreetingText
+ buttonsound
+ jump .main
+
+.daygreet ; 0xbcfd7
+ farwritetext BillPhoneDayGreetingText
+ buttonsound
+ jump .main
+
+.nitegreet ; 0xbcfdf
+ farwritetext BillPhoneNiteGreetingText
+ buttonsound
+ jump .main
+
+.main ; 0xbcfe7
+ farwritetext BillPhoneGeneriText
+ buttonsound
+ checkcode VAR_BOXSPACE
+ RAM2MEM $0
+ if_equal $0, .full
+ if_less_than $6, .nearlyfull
+ farwritetext BillPhoneNotFullText
+ end
+
+.nearlyfull ; 0xbcffd
+ farwritetext BillPhoneNearlyFullText
+ end
+
+.full ; 0xbd002
+ farwritetext BillPhoneFullText
+ end
+
+BillPhoneScript2: ; 0xbd007
+ farwritetext BillPhoneNewlyFullText
+ waitbutton
+ end
+
+; Elm
+
+ElmPhoneScript1: ; 0xbd00d
+ checkcode VAR_SPECIALPHONECALL
+ if_equal $1, .pokerus
+ checkevent EVENT_SHOWED_TOGEPI_TO_ELM
+ iftrue .discovery
+ checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE
+ iffalse .next
+ checkevent EVENT_TOGEPI_HATCHED
+ iftrue .egghatched
+.next
+ checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE
+ iftrue .eggunhatched
+ checkevent EVENT_ELMS_AIDE_IN_LAB
+ iftrue .assistant
+ checkevent EVENT_GAVE_MYSTERY_EGG_TO_ELM
+ iftrue .checkingegg
+ checkevent EVENT_ELM_CALLED_ABOUT_STOLEN_POKEMON
+ iftrue .stolen
+ checkevent EVENT_GOT_MYSTERY_EGG_FROM_MR_POKEMON
+ iftrue .sawmrpokemon
+ farwritetext ElmPhoneStartText
+ end
+
+.sawmrpokemon ; 0xbd048
+ farwritetext ElmPhoneSawMrPokemonText
+ end
+
+.stolen ; 0xbd04d
+ farwritetext ElmPhonePokemonStolenText
+ end
+
+.checkingegg ; 0xbd052
+ farwritetext ElmPhoneCheckingEggText
+ end
+
+.assistant ; 0xbd057
+ farwritetext ElmPhoneAssistantText
+ end
+
+.eggunhatched ; 0xbd05c
+ farwritetext ElmPhoneEggUnhatchedText
+ end
+
+.egghatched ; 0xbd061
+ farwritetext ElmPhoneEggHatchedText
+ setevent EVENT_TOLD_ELM_ABOUT_TOGEPI_OVER_THE_PHONE
+ end
+
+.discovery ; 0xbd069
+ random $2
+ if_equal $0, .nextdiscovery
+ farwritetext ElmPhoneDiscovery1Text
+ end
+
+.nextdiscovery ; 0xbd074
+ farwritetext ElmPhoneDiscovery2Text
+ end
+
+.pokerus ; 0xbd079
+ farwritetext ElmPhonePokerusText
+ specialphonecall SPECIALCALL_NONE
+ end
+
+ElmPhoneScript2: ; 0xbd081
+ checkcode VAR_SPECIALPHONECALL
+ if_equal $2, .disaster
+ if_equal $3, .assistant
+ if_equal $4, .rocket
+ if_equal $5, .gift
+ if_equal $8, .gift
+ farwritetext ElmPhonePokerusText
+ specialphonecall SPECIALCALL_NONE
+ end
+
+.disaster ; 0xbd09f
+ farwritetext ElmPhoneDisasterText
+ specialphonecall SPECIALCALL_NONE
+ setevent EVENT_ELM_CALLED_ABOUT_STOLEN_POKEMON
+ end
+
+.assistant ; 0xbd0aa
+ farwritetext ElmPhoneEggAssistantText
+ specialphonecall SPECIALCALL_NONE
+ clearevent EVENT_ELMS_AIDE_IN_VIOLET_POKEMON_CENTER
+ setevent EVENT_ELMS_AIDE_IN_LAB
+ end
+
+.rocket ; 0xbd0b8
+ farwritetext ElmPhoneRocketText
+ specialphonecall SPECIALCALL_NONE
+ end
+
+.gift ; 0xbd0c0
+ farwritetext ElmPhoneGiftText
+ specialphonecall SPECIALCALL_NONE
+ end
+
+.unused ; 0xbd0c8
+ farwritetext ElmPhoneUnusedText
+ specialphonecall SPECIALCALL_NONE
+ end
+; bd0d0
+
+; Jack
+
+JackPhoneScript1:
+ trainertotext SCHOOLBOY, JACK1, $0
+ checkflag ENGINE_JACK
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_JACK_MONDAY_MORNING
+ iftrue .NotMonday
+ checkcode VAR_WEEKDAY
+ if_not_equal MONDAY, .NotMonday
+ checkmorn
+ iftrue JackMondayMorning
+
+.NotMonday:
+ farjump JackPhoneTips
+
+.WantsBattle:
+ landmarktotext NATIONAL_PARK, $2
+ farjump JackWantsBattleScript
+
+JackPhoneScript2:
+ trainertotext SCHOOLBOY, JACK1, $0
+ farscall PhoneScript_GreetPhone_Male
+ farscall PhoneScript_Random2
+ if_equal $0, JackBattleTrivia
+ checkflag ENGINE_JACK
+ iftrue .WaitingForBattle
+ checkflag ENGINE_JACK_MONDAY_MORNING
+ iftrue .WaitingForBattle
+ farscall PhoneScript_Random2
+ if_equal $0, JackWantsToBattle
+
+.WaitingForBattle:
+ farscall PhoneScript_Random3
+ if_equal $0, JackFindsRare
+ farjump Phone_GenericCall_Male
+
+JackMondayMorning:
+ setflag ENGINE_JACK_MONDAY_MORNING
+
+JackWantsToBattle:
+ landmarktotext NATIONAL_PARK, $2
+ setflag ENGINE_JACK
+ farjump PhoneScript_WantsToBattle_Male
+
+JackFindsRare:
+ farjump Phone_CheckIfUnseenRare_Male
+
+JackBattleTrivia:
+ farjump JackTriviaScript
+
+; Beverly
+
+BeverlyPhoneScript1:
+ trainertotext POKEFANF, BEVERLY1, $0
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_BEVERLY_HAS_NUGGET
+ iftrue .HasNugget
+ farjump UnknownScript_0xa0900
+
+.HasNugget:
+ landmarktotext NATIONAL_PARK, $2
+ farjump UnknownScript_0xa0aa5
+
+BeverlyPhoneScript2:
+ trainertotext POKEFANF, BEVERLY1, $0
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_BEVERLY_HAS_NUGGET
+ iftrue .HasNugget
+ farscall PhoneScript_Random4
+ if_equal $0, .FoundNugget
+
+.HasNugget:
+ farjump Phone_GenericCall_Female
+
+.FoundNugget:
+ setflag ENGINE_BEVERLY_HAS_NUGGET
+ landmarktotext NATIONAL_PARK, $2
+ farjump PhoneScript_FoundItem_Female
+
+; Huey
+
+HueyPhoneScript1:
+ trainertotext SAILOR, HUEY1, $0
+ checkflag ENGINE_HUEY
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_HUEY_WEDNESDAY_NIGHT
+ iftrue .NotWednesday
+ checkcode VAR_WEEKDAY
+ if_not_equal WEDNESDAY, .NotWednesday
+ checknite
+ iftrue HueyWednesdayNight
+
+.NotWednesday:
+ special RandomPhoneMon
+ farjump UnknownScript_0xa0908
+
+.WantsBattle:
+ landmarktotext LIGHTHOUSE, $2
+ farjump HueyWantsBattleScript
+
+HueyPhoneScript2:
+ trainertotext SAILOR, HUEY1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_HUEY
+ iftrue .Flavor
+ checkflag ENGINE_HUEY_WEDNESDAY_NIGHT
+ iftrue .Flavor
+ farscall PhoneScript_Random3
+ if_equal $0, HueyWantsBattle
+ if_equal $1, HueyWantsBattle
+
+.Flavor:
+ farjump PhoneScript_MonFlavorText
+
+HueyWednesdayNight:
+ setflag ENGINE_HUEY_WEDNESDAY_NIGHT
+
+HueyWantsBattle:
+ landmarktotext LIGHTHOUSE, $2
+ setflag ENGINE_HUEY
+ farjump PhoneScript_WantsToBattle_Male
+
+; Gaven
+
+GavenPhoneScript1:
+ trainertotext COOLTRAINERM, GAVEN3, $0
+ checkflag ENGINE_GAVEN
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_GAVEN_THURSDAY_MORNING
+ iftrue .NotThursday
+ checkcode VAR_WEEKDAY
+ if_not_equal THURSDAY, .NotThursday
+ checkmorn
+ iftrue GavenThursdayMorning
+
+.NotThursday:
+ farjump UnknownScript_0xa0910
+
+.WantsBattle:
+ landmarktotext ROUTE_26, $2
+ farjump UnknownScript_0xa0a37
+
+GavenPhoneScript2:
+ trainertotext COOLTRAINERM, GAVEN3, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_GAVEN
+ iftrue .WaitingForBattle
+ checkflag ENGINE_GAVEN_THURSDAY_MORNING
+ iftrue .WaitingForBattle
+ farscall PhoneScript_Random2
+ if_equal $0, GavenWantsRematch
+
+.WaitingForBattle:
+ farscall PhoneScript_Random3
+ if_equal $0, GavenFoundRare
+ farjump Phone_GenericCall_Male
+
+GavenThursdayMorning:
+ setflag ENGINE_GAVEN_THURSDAY_MORNING
+
+GavenWantsRematch:
+ landmarktotext ROUTE_26, $2
+ setflag ENGINE_GAVEN
+ farjump PhoneScript_WantsToBattle_Male
+
+GavenFoundRare:
+ farjump Phone_CheckIfUnseenRare_Male
+
+; Beth
+
+BethPhoneScript1:
+ trainertotext COOLTRAINERF, BETH1, $0
+ checkflag ENGINE_BETH
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_BETH_FRIDAY_AFTERNOON
+ iftrue .NotFriday
+ checkcode VAR_WEEKDAY
+ if_not_equal FRIDAY, .NotFriday
+ checkday
+ iftrue BethFridayAfternoon
+
+.NotFriday:
+ farjump UnknownScript_0xa0918
+
+.WantsBattle:
+ landmarktotext ROUTE_26, $2
+ farjump BethBattleReminderScript
+
+BethPhoneScript2:
+ trainertotext COOLTRAINERF, BETH1, $0
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_BETH
+ iftrue .Generic
+ checkflag ENGINE_BETH_FRIDAY_AFTERNOON
+ iftrue .Generic
+ farscall PhoneScript_Random2
+ if_equal $0, BethWantsBattle
+
+.Generic:
+ farjump Phone_GenericCall_Female
+
+BethFridayAfternoon:
+ setflag ENGINE_BETH_FRIDAY_AFTERNOON
+
+BethWantsBattle:
+ landmarktotext ROUTE_26, $2
+ setflag ENGINE_BETH
+ farjump PhoneScript_WantsToBattle_Female
+
+; Jose
+
+JosePhoneScript1:
+ trainertotext BIRD_KEEPER, JOSE2, $0
+ checkflag ENGINE_JOSE
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_JOSE_SATURDAY_NIGHT
+ iftrue .NotSaturday
+ checkflag ENGINE_JOSE_HAS_STAR_PIECE
+ iftrue .HasItem
+ checkcode VAR_WEEKDAY
+ if_not_equal SATURDAY, .NotSaturday
+ checknite
+ iftrue JoseSaturdayNight
+
+.NotSaturday:
+ farjump UnknownScript_0xa0920
+
+.WantsBattle:
+ landmarktotext ROUTE_27, $2
+ farjump UnknownScript_0xa0a41
+
+.HasItem:
+ landmarktotext ROUTE_27, $2
+ farjump UnknownScript_0xa0a41
+
+JosePhoneScript2:
+ trainertotext BIRD_KEEPER, JOSE2, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_JOSE
+ iftrue .Generic
+ checkflag ENGINE_JOSE_SATURDAY_NIGHT
+ iftrue .Generic
+ checkflag ENGINE_JOSE_HAS_STAR_PIECE
+ iftrue .Generic
+ farscall PhoneScript_Random3
+ if_equal $0, JoseWantsBattle
+ farscall PhoneScript_Random3
+ if_equal $0, JoseHasStarPiece
+
+.Generic:
+ farscall PhoneScript_Random3
+ if_equal $0, JoseFoundRare
+ farjump Phone_GenericCall_Male
+
+JoseSaturdayNight:
+ setflag ENGINE_JOSE_SATURDAY_NIGHT
+
+JoseWantsBattle:
+ landmarktotext ROUTE_27, $2
+ setflag ENGINE_JOSE
+ farjump PhoneScript_WantsToBattle_Male
+
+JoseFoundRare:
+ farjump Phone_CheckIfUnseenRare_Male
+
+JoseHasStarPiece:
+ setflag ENGINE_JOSE_HAS_STAR_PIECE
+ landmarktotext ROUTE_27, $2
+ farjump PhoneScript_FoundItem_Male
+
+; Reena
+
+ReenaPhoneScript1:
+ trainertotext COOLTRAINERF, REENA1, $0
+ checkflag ENGINE_REENA
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_REENA_SUNDAY_MORNING
+ iftrue .NotSunday
+ checkcode VAR_WEEKDAY
+ if_not_equal SUNDAY, .NotSunday
+ checkmorn
+ iftrue ReenaSundayMorning
+
+.NotSunday:
+ farjump UnknownScript_0xa0928
+
+.WantsBattle:
+ landmarktotext ROUTE_27, $2
+ farjump UnknownScript_0xa0a46
+
+ReenaPhoneScript2:
+ trainertotext COOLTRAINERF, REENA1, $0
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_REENA
+ iftrue .Generic
+ checkflag ENGINE_REENA_SUNDAY_MORNING
+ iftrue .Generic
+ farscall PhoneScript_Random2
+ if_equal $0, ReenaWantsBattle
+
+.Generic:
+ farjump Phone_GenericCall_Female
+
+ReenaSundayMorning:
+ setflag ENGINE_REENA_SUNDAY_MORNING
+
+ReenaWantsBattle:
+ landmarktotext ROUTE_27, $2
+ setflag ENGINE_REENA
+ farjump PhoneScript_WantsToBattle_Female
+
+; Joey
+
+JoeyPhoneScript1:
+ trainertotext YOUNGSTER, JOEY1, $0
+ checkflag ENGINE_JOEY
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_JOEY_MONDAY_AFTERNOON
+ iftrue .NotMonday
+ checkcode VAR_WEEKDAY
+ if_not_equal MONDAY, .NotMonday
+ checkday
+ iftrue JoeyMondayAfternoon
+
+.NotMonday:
+ special RandomPhoneMon
+ farjump UnknownScript_0xa0930
+
+.WantsBattle:
+ landmarktotext ROUTE_30, $2
+ farjump UnknownScript_0xa0a4b
+
+JoeyPhoneScript2:
+ trainertotext YOUNGSTER, JOEY1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_JOEY
+ iftrue .Generic
+ checkflag ENGINE_JOEY_MONDAY_AFTERNOON
+ iftrue .Generic
+ farscall PhoneScript_Random3
+ if_equal $0, JoeyWantsBattle
+ if_equal $1, JoeyWantsBattle
+
+.Generic:
+ farjump Phone_GenericCall_Male
+
+JoeyMondayAfternoon:
+ setflag ENGINE_JOEY_MONDAY_AFTERNOON
+
+JoeyWantsBattle:
+ landmarktotext ROUTE_30, $2
+ setflag ENGINE_JOEY
+ farjump PhoneScript_WantsToBattle_Male
+
+; Wade
+
+WadePhoneScript1:
+ trainertotext BUG_CATCHER, WADE1, $0
+ checkflag ENGINE_WADE
+ iftrue WadeWantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_WADE_TUESDAY_NIGHT
+ iftrue .NotTuesday
+ checkflag ENGINE_WADE_HAS_ITEM
+ iftrue WadeHasItem
+ checkcode VAR_WEEKDAY
+ if_not_equal TUESDAY, .NotTuesday
+ checknite
+ iftrue WadeTuesdayNight
+
+.NotTuesday:
+ farscall PhoneScript_Random2
+ if_equal $0, .NoContest
+ checkflag ENGINE_DAILY_BUG_CONTEST
+ iftrue .NoContest
+ checkcode VAR_WEEKDAY
+ if_equal TUESDAY, WadeContestToday
+ if_equal THURSDAY, WadeContestToday
+ if_equal SATURDAY, WadeContestToday
+
+.NoContest:
+ farjump UnknownScript_0xa0938
+
+WadeContestToday:
+ farjump PhoneScript_BugCatchingContest
+
+WadeWantsBattle:
+ landmarktotext ROUTE_31, $2
+ farjump UnknownScript_0xa0a50
+
+WadeHasItem:
+ landmarktotext ROUTE_31, $2
+ farjump UnknownScript_0xa0ab5
+
+WadePhoneScript2:
+ trainertotext BUG_CATCHER, WADE1, $0
+ farscall PhoneScript_GreetPhone_Male
+ farscall PhoneScript_Random2
+ if_equal $0, .NoContest
+ checkflag ENGINE_DAILY_BUG_CONTEST
+ iftrue .NoContest
+ checkcode VAR_WEEKDAY
+ if_equal TUESDAY, Wade_ContestToday
+ if_equal THURSDAY, Wade_ContestToday
+ if_equal SATURDAY, Wade_ContestToday
+
+.NoContest:
+ checkflag ENGINE_WADE
+ iftrue .next
+ checkflag ENGINE_WADE_TUESDAY_NIGHT
+ iftrue .next
+ checkflag ENGINE_WADE_HAS_ITEM
+ iftrue .next
+ farscall PhoneScript_Random2
+ if_equal $0, WadeHasItem2
+ checkflag ENGINE_FLYPOINT_GOLDENROD
+ iffalse .next
+ farscall PhoneScript_Random2
+ if_equal $0, WadeWantsBattle2
+
+.next:
+ farscall PhoneScript_Random3
+ if_equal $0, WadeFoundRare
+ farjump Phone_GenericCall_Male
+
+Wade_ContestToday:
+ farjump PhoneScript_BugCatchingContest
+
+WadeTuesdayNight:
+ setflag ENGINE_WADE_TUESDAY_NIGHT
+
+WadeWantsBattle2:
+ landmarktotext ROUTE_31, $2
+ setflag ENGINE_WADE
+ farjump PhoneScript_WantsToBattle_Male
+
+WadeFoundRare:
+ farjump Phone_CheckIfUnseenRare_Male
+
+WadeHasItem2:
+ setflag ENGINE_WADE_HAS_ITEM
+ landmarktotext ROUTE_31, $2
+ clearevent EVENT_WADE_HAS_BERRY
+ clearevent EVENT_WADE_HAS_PSNCUREBERRY
+ clearevent EVENT_WADE_HAS_PRZCUREBERRY
+ clearevent EVENT_WADE_HAS_BITTER_BERRY
+ random $4
+ if_equal $0, .Berry
+ if_equal $1, .PsnCureBerry
+ if_equal $2, .PrzCureBerry
+ if_equal $3, .Bitterberry
+
+.Berry:
+ setevent EVENT_WADE_HAS_BERRY
+ jump .FoundBerry
+
+.PsnCureBerry:
+ setevent EVENT_WADE_HAS_PSNCUREBERRY
+ jump .FoundBerry
+
+.PrzCureBerry:
+ setevent EVENT_WADE_HAS_PRZCUREBERRY
+ jump .FoundBerry
+
+.Bitterberry:
+ setevent EVENT_WADE_HAS_BITTER_BERRY
+
+.FoundBerry:
+ farjump PhoneScript_FoundItem_Male
+
+; Ralph
+
+RalphPhoneScript1:
+ trainertotext FISHER, RALPH1, $0
+ checkflag ENGINE_RALPH
+ iftrue Ralph_Rematch
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_RALPH_WEDNESDAY_MORNING
+ iftrue Ralph_CheckSwarm
+ checkcode VAR_WEEKDAY
+ if_not_equal WEDNESDAY, Ralph_CheckSwarm
+ checkmorn
+ iftrue Ralph_WednesdayMorning
+Ralph_CheckSwarm:
+ checkflag ENGINE_SPECIAL_WILDDATA
+ iftrue Ralph_ReportSwarm
+ farjump UnknownScript_0xa0940
+
+Ralph_Rematch:
+ landmarktotext ROUTE_32, $2
+ farjump UnknownScript_0xa0a55
+
+Ralph_ReportSwarm:
+ landmarktotext ROUTE_32, $2
+ farjump UnknownScript_0xa0af5
+
+RalphPhoneScript2:
+ trainertotext FISHER, RALPH1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_FLYPOINT_GOLDENROD
+ iffalse Ralph_CheckSwarm2
+ checkflag ENGINE_RALPH
+ iftrue Ralph_CheckSwarm2
+ checkflag ENGINE_RALPH_WEDNESDAY_MORNING
+ iftrue Ralph_CheckSwarm2
+ farscall PhoneScript_Random2
+ if_equal $0, Ralph_FightMe
+Ralph_CheckSwarm2:
+ farscall PhoneScript_Random5
+ if_equal $0, Ralph_SetUpSwarm
+ farjump Phone_GenericCall_Male
+
+Ralph_WednesdayMorning:
+ setflag ENGINE_RALPH_WEDNESDAY_MORNING
+Ralph_FightMe:
+ landmarktotext ROUTE_32, $2
+ setflag ENGINE_RALPH
+ farjump PhoneScript_WantsToBattle_Male
+
+Ralph_SetUpSwarm:
+ checkflag ENGINE_SPECIAL_WILDDATA
+ iftrue .Generic
+ setflag ENGINE_SPECIAL_WILDDATA
+ pokenamemem QWILFISH, $1
+ landmarktotext ROUTE_32, $2
+ writebyte FISHSWARM_QWILFISH
+ special Special_ActivateFishingSwarm
+ farjump UnknownScript_0xa05d6
+
+.Generic:
+ farjump Phone_GenericCall_Male
+
+; Liz
+
+LizPhoneScript1:
+ trainertotext PICNICKER, LIZ1, $0
+ checkflag ENGINE_LIZ
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_LIZ_THURSDAY_AFTERNOON
+ iftrue .NotThursday
+ checkcode VAR_WEEKDAY
+ if_not_equal THURSDAY, .NotThursday
+ checkday
+ iftrue LizThursdayAfternoon
+
+.NotThursday:
+ special RandomPhoneMon
+ farjump UnknownScript_0xa0948
+
+.WantsBattle:
+ landmarktotext ROUTE_32, $2
+ farjump UnknownScript_0xa0a5a
+
+LizPhoneScript2:
+ trainertotext PICNICKER, LIZ1, $0
+ farscall PhoneScript_Random4
+ if_equal $0, LizWrongNumber
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_LIZ
+ iftrue .next
+ checkflag ENGINE_LIZ_THURSDAY_AFTERNOON
+ iftrue .next
+
+.next:
+ farscall PhoneScript_Random2
+ if_equal $0, LizGossip
+ checkflag ENGINE_FLYPOINT_GOLDENROD
+ iffalse .Generic
+ farscall PhoneScript_Random2
+ if_equal $0, LizWantsBattle
+
+.Generic:
+ farjump Phone_GenericCall_Female
+
+LizThursdayAfternoon:
+ setflag ENGINE_LIZ_THURSDAY_AFTERNOON
+
+LizWantsBattle:
+ landmarktotext ROUTE_32, $2
+ setflag ENGINE_LIZ
+ farjump PhoneScript_WantsToBattle_Female
+
+LizWrongNumber:
+ farjump LizWrongNumberScript
+
+LizGossip:
+ random $9
+ if_equal $0, .CoolTrainerM
+ if_equal $1, .Beauty
+ if_equal $2, .Grunt
+ if_equal $3, .Teacher
+ if_equal $4, .SwimmerF
+ if_equal $5, .KimonoGirl
+ if_equal $6, .Skier
+ if_equal $7, .Medium
+ if_equal $8, .PokefanM
+
+.CoolTrainerM:
+ trainerclassname COOLTRAINERM, $1
+ jump LizGossipScript
+
+.Beauty:
+ trainerclassname BEAUTY, $1
+ jump LizGossipScript
+
+.Grunt:
+ trainerclassname GRUNTM, $1
+ jump LizGossipScript
+
+.Teacher:
+ trainerclassname TEACHER, $1
+ jump LizGossipScript
+
+.SwimmerF:
+ trainerclassname SWIMMERF, $1
+ jump LizGossipScript
+
+.KimonoGirl:
+ trainerclassname KIMONO_GIRL, $1
+ jump LizGossipScript
+
+.Skier:
+ trainerclassname SKIER, $1
+ jump LizGossipScript
+
+.Medium:
+ trainerclassname MEDIUM, $1
+ jump LizGossipScript
+
+.PokefanM:
+ trainerclassname POKEFANM, $1
+ jump LizGossipScript
+
+LizGossipScript:
+ farjump UnknownScript_0xa06da
+
+; Anthony
+
+AnthonyPhoneScript1:
+ trainertotext HIKER, ANTHONY2, $0
+ checkflag ENGINE_ANTHONY
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_ANTHONY_FRIDAY_NIGHT
+ iftrue .NotFriday
+ checkcode VAR_WEEKDAY
+ if_not_equal FRIDAY, .NotFriday
+ checknite
+ iftrue AnthonyFridayNight
+
+.NotFriday:
+ checkflag ENGINE_DUNSPARCE_SWARM
+ iftrue .AlreadySwarming
+ farjump UnknownScript_0xa0950
+
+.WantsBattle:
+ landmarktotext ROUTE_33, $2
+ farjump UnknownScript_0xa0a5f
+
+.AlreadySwarming:
+ landmarktotext ROUTE_33, $2
+ farjump UnknownScript_0xa0afa
+
+AnthonyPhoneScript2:
+ trainertotext HIKER, ANTHONY2, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_FLYPOINT_GOLDENROD
+ iffalse .TriesSwarm
+ checkflag ENGINE_ANTHONY
+ iftrue .TriesSwarm
+ checkflag ENGINE_ANTHONY_FRIDAY_NIGHT
+ iftrue .TriesSwarm
+ farscall PhoneScript_Random2
+ if_equal $0, AnthonyWantsBattle
+
+.TriesSwarm:
+ farscall PhoneScript_Random5
+ if_equal $0, AnthonyTriesDunsparceSwarm
+ farjump Phone_GenericCall_Male
+
+AnthonyFridayNight:
+ setflag ENGINE_ANTHONY_FRIDAY_NIGHT
+
+AnthonyWantsBattle:
+ landmarktotext ROUTE_33, $2
+ setflag ENGINE_ANTHONY
+ farjump PhoneScript_WantsToBattle_Male
+
+AnthonyTriesDunsparceSwarm:
+ checkflag ENGINE_DUNSPARCE_SWARM
+ iftrue .Generic
+ setflag ENGINE_DUNSPARCE_SWARM
+ pokenamemem DUNSPARCE, $1
+ swarm SWARM_DUNSPARCE, DARK_CAVE_VIOLET_ENTRANCE
+ landmarktotext DARK_CAVE, $2
+ farjump UnknownScript_0xa05de
+
+.Generic:
+ farjump Phone_GenericCall_Male
+
+; Todd
+
+ToddPhoneScript1:
+ trainertotext CAMPER, TODD1, $0
+ checkflag ENGINE_TODD
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_TODD_SATURDAY_MORNING
+ iftrue .NotSaturday
+ checkcode VAR_WEEKDAY
+ if_not_equal SATURDAY, .NotSaturday
+ checkmorn
+ iftrue ToddSaturdayMorning
+
+.NotSaturday:
+ checkflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
+ iftrue .SaleOn
+ farjump UnknownScript_0xa0958
+
+.WantsBattle:
+ landmarktotext ROUTE_34, $2
+ farjump UnknownScript_0xa0a64
+
+.SaleOn:
+ farjump UnknownScript_0xa0b04
+
+ToddPhoneScript2:
+ trainertotext CAMPER, TODD1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_TODD
+ iftrue .TryForSale
+ checkflag ENGINE_TODD_SATURDAY_MORNING
+ iftrue .TryForSale
+ checkflag ENGINE_FLYPOINT_GOLDENROD
+ iffalse ToddNoGoldenrod
+ farscall PhoneScript_Random2
+ if_equal $0, ToddWantsBattle
+
+.TryForSale:
+ farscall PhoneScript_Random2
+ if_equal $0, ToddDeptStoreSale
+
+ToddNoGoldenrod:
+ farscall PhoneScript_Random3
+ if_equal $0, ToddFoundRare
+ farjump Phone_GenericCall_Male
+
+ToddSaturdayMorning:
+ setflag ENGINE_TODD_SATURDAY_MORNING
+
+ToddWantsBattle:
+ landmarktotext ROUTE_34, $2
+ setflag ENGINE_TODD
+ farjump PhoneScript_WantsToBattle_Male
+
+ToddFoundRare:
+ farjump Phone_CheckIfUnseenRare_Male
+
+ToddDeptStoreSale:
+ setflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
+ farjump UnknownScript_0xa0644
+
+; Gina
+
+GinaPhoneScript1:
+ trainertotext PICNICKER, GINA1, $0
+ checkflag ENGINE_GINA
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_GINA_SUNDAY_AFTERNOON
+ iftrue .NotSunday
+ checkflag ENGINE_GINA_HAS_LEAF_STONE
+ iftrue .HasLeafStone
+ checkcode VAR_WEEKDAY
+ if_not_equal SUNDAY, .NotSunday
+ checkday
+ iftrue GinaSundayDay
+
+.NotSunday:
+ checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
+ iftrue .Rockets
+ farjump UnknownScript_0xa0960
+
+.Rockets:
+ farjump UnknownScript_0xa05c6
+
+.WantsBattle:
+ landmarktotext ROUTE_34, $2
+ farjump UnknownScript_0xa0a69
+
+.HasLeafStone:
+ landmarktotext ROUTE_34, $2
+ farjump UnknownScript_0xa0abd
+
+GinaPhoneScript2:
+ trainertotext PICNICKER, GINA1, $0
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
+ iftrue GinaRockets
+ checkflag ENGINE_GINA
+ iftrue .Generic
+ checkflag ENGINE_GINA_SUNDAY_AFTERNOON
+ iftrue .Generic
+ checkflag ENGINE_GINA_HAS_LEAF_STONE
+ iftrue .Generic
+ checkevent EVENT_GINA_GAVE_LEAF_STONE
+ iftrue .GaveLeafStone
+ farscall PhoneScript_Random2
+ if_equal $0, GinaHasLeafStone
+
+.GaveLeafStone:
+ farscall PhoneScript_Random11
+ if_equal $0, GinaHasLeafStone
+ checkflag ENGINE_FLYPOINT_GOLDENROD
+ iffalse .Generic
+ farscall PhoneScript_Random3
+ if_equal $0, GinaWantsBattle
+
+.Generic:
+ farjump Phone_GenericCall_Female
+
+GinaSundayDay:
+ setflag ENGINE_GINA_SUNDAY_AFTERNOON
+
+GinaWantsBattle:
+ landmarktotext ROUTE_34, $2
+ setflag ENGINE_GINA
+ farjump PhoneScript_WantsToBattle_Female
+
+GinaRockets:
+ farjump UnknownScript_0xa05c6
+
+GinaHasLeafStone:
+ setflag ENGINE_GINA_HAS_LEAF_STONE
+ landmarktotext ROUTE_34, $2
+ farjump PhoneScript_FoundItem_Female
+
+; Irwin
+
+IrwinPhoneScript1:
+ trainertotext JUGGLER, IRWIN1, $0
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
+ iftrue .Rockets
+ farjump UnknownScript_0xa09c8
+
+.Rockets:
+ farjump IrwinRocketRumor
+
+IrwinPhoneScript2:
+ trainertotext JUGGLER, IRWIN1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
+ iftrue .Rockets
+ farjump IrwinRumorScript
+
+.Rockets:
+ farjump IrwinRocketRumor
+
+; Arnie
+
+ArniePhoneScript1:
+ trainertotext BUG_CATCHER, ARNIE1, $0
+ checkflag ENGINE_ARNIE
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_ARNIE_TUESDAY_MORNING
+ iftrue .NotTuesday
+ checkcode VAR_WEEKDAY
+ if_not_equal TUESDAY, .NotTuesday
+ checkmorn
+ iftrue ArnieTuesdayMorning
+
+.NotTuesday:
+ checkflag ENGINE_YANMA_SWARM
+ iftrue .AlreadySwarming
+ farjump UnknownScript_0xa0968
+
+.WantsBattle:
+ landmarktotext ROUTE_35, $2
+ farjump UnknownScript_0xa0a6e
+
+.AlreadySwarming:
+ landmarktotext ROUTE_35, $2
+ farjump UnknownScript_0xa0aff
+
+ArniePhoneScript2:
+ trainertotext BUG_CATCHER, ARNIE1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_ARNIE
+ iftrue .Swarm
+ checkflag ENGINE_ARNIE_TUESDAY_MORNING
+ iftrue .Swarm
+ farscall PhoneScript_Random2
+ if_equal $0, ArnieWantsBattle
+
+.Swarm:
+ farscall PhoneScript_Random5
+ if_equal $0, ArnieYanmaSwarm
+ farscall PhoneScript_Random3
+ if_equal $0, ArnieFoundRare
+ farjump Phone_GenericCall_Male
+
+ArnieTuesdayMorning:
+ setflag ENGINE_ARNIE_TUESDAY_MORNING
+
+ArnieWantsBattle:
+ landmarktotext ROUTE_35, $2
+ setflag ENGINE_ARNIE
+ farjump PhoneScript_WantsToBattle_Male
+
+ArnieYanmaSwarm: ; start swarm
+ checkflag ENGINE_YANMA_SWARM
+ iftrue ArnieYanmaAlreadySwarming
+ setflag ENGINE_YANMA_SWARM
+ pokenamemem YANMA, $1
+ swarm SWARM_YANMA, ROUTE_35
+ landmarktotext ROUTE_35, $2
+ farjump UnknownScript_0xa05ce
+
+ArnieFoundRare:
+ farjump Phone_CheckIfUnseenRare_Male
+
+ArnieYanmaAlreadySwarming:
+ farjump Phone_GenericCall_Male
+
+; Alan
+
+AlanPhoneScript1:
+ trainertotext SCHOOLBOY, ALAN1, $0
+ checkflag ENGINE_ALAN
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_ALAN_WEDNESDAY_AFTERNOON
+ iftrue .NotWednesday
+ checkflag ENGINE_ALAN_HAS_FIRE_STONE
+ iftrue .FireStone
+ checkcode VAR_WEEKDAY
+ if_not_equal WEDNESDAY, .NotWednesday
+ checkday
+ iftrue AlanWednesdayDay
+
+.NotWednesday:
+ farjump UnknownScript_0xa0970
+
+.WantsBattle:
+ landmarktotext ROUTE_36, $2
+ farjump UnknownScript_0xa0a73
+
+.FireStone:
+ landmarktotext ROUTE_36, $2
+ farjump UnknownScript_0xa0ac5
+
+AlanPhoneScript2:
+ trainertotext SCHOOLBOY, ALAN1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_ALAN
+ iftrue AlanGenericCall
+ checkflag ENGINE_ALAN_WEDNESDAY_AFTERNOON
+ iftrue AlanGenericCall
+ checkflag ENGINE_ALAN_HAS_FIRE_STONE
+ iftrue AlanGenericCall
+ farscall PhoneScript_Random3
+ if_equal $0, AlanWantsBattle
+ checkevent EVENT_ALAN_GAVE_FIRE_STONE
+ iftrue .FireStone
+ farscall PhoneScript_Random2
+ if_equal $0, AlanHasFireStone
+
+.FireStone:
+ farscall PhoneScript_Random11
+ if_equal $0, AlanHasFireStone
+
+AlanGenericCall:
+ farjump Phone_GenericCall_Male
+
+AlanWednesdayDay:
+ setflag ENGINE_ALAN_WEDNESDAY_AFTERNOON
+
+AlanWantsBattle:
+ landmarktotext ROUTE_36, $2
+ setflag ENGINE_ALAN
+ farjump PhoneScript_WantsToBattle_Male
+
+AlanHasFireStone:
+ setflag ENGINE_ALAN_HAS_FIRE_STONE
+ landmarktotext ROUTE_36, $2
+ farjump PhoneScript_FoundItem_Male
+
+; Dana
+
+DanaPhoneScript1:
+ trainertotext LASS, DANA1, $0
+ checkflag ENGINE_DANA
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_DANA_THURSDAY_NIGHT
+ iftrue .NotThursday
+ checkflag ENGINE_DANA_HAS_THUNDERSTONE
+ iftrue .HasThunderstone
+ checkcode VAR_WEEKDAY
+ if_not_equal THURSDAY, .NotThursday
+ checknite
+ iftrue DanaThursdayNight
+
+.NotThursday:
+ farjump UnknownScript_0xa0978
+
+.WantsBattle:
+ landmarktotext ROUTE_38, $2
+ farjump UnknownScript_0xa0a78
+
+.HasThunderstone:
+ landmarktotext ROUTE_38, $2
+ farjump UnknownScript_0xa0acd
+
+DanaPhoneScript2:
+ trainertotext LASS, DANA1, $0
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_DANA
+ iftrue .Generic
+ checkflag ENGINE_DANA_THURSDAY_NIGHT
+ iftrue .Generic
+ checkflag ENGINE_DANA_HAS_THUNDERSTONE
+ iftrue .Generic
+ farscall PhoneScript_Random3
+ if_equal $0, DanaWantsBattle
+ checkevent EVENT_DANA_GAVE_THUNDERSTONE
+ iftrue .Thunderstone
+ farscall PhoneScript_Random2
+ if_equal $0, DanaHasThunderstone
+
+.Thunderstone:
+ farscall PhoneScript_Random11
+ if_equal $0, DanaHasThunderstone
+
+.Generic:
+ farscall PhoneScript_Random3
+ if_equal $0, DanaFoundRare
+ farjump Phone_GenericCall_Female
+
+DanaThursdayNight:
+ setflag ENGINE_DANA_THURSDAY_NIGHT
+
+DanaWantsBattle:
+ landmarktotext ROUTE_38, $2
+ setflag ENGINE_DANA
+ farjump PhoneScript_WantsToBattle_Female
+
+DanaFoundRare:
+ farjump Phone_CheckIfUnseenRare_Female
+
+DanaHasThunderstone:
+ setflag ENGINE_DANA_HAS_THUNDERSTONE
+ landmarktotext ROUTE_38, $2
+ farjump PhoneScript_FoundItem_Female
+
+; Chad
+
+ChadPhoneScript1:
+ trainertotext SCHOOLBOY, CHAD1, $0
+ checkflag ENGINE_CHAD
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_CHAD_FRIDAY_MORNING
+ iftrue .NotFriday
+ checkcode VAR_WEEKDAY
+ if_not_equal FRIDAY, .NotFriday
+ checkmorn
+ iftrue ChadFridayMorning
+
+.NotFriday:
+ farjump UnknownScript_0xa0980
+
+.WantsBattle:
+ landmarktotext ROUTE_38, $2
+ farjump UnknownScript_0xa0a7d
+
+ChadPhoneScript2:
+ trainertotext SCHOOLBOY, CHAD1, $0
+ farscall PhoneScript_GreetPhone_Male
+ farscall PhoneScript_Random2
+ if_equal $0, ChadOakGossip
+ checkflag ENGINE_CHAD
+ iftrue .Generic
+ checkflag ENGINE_CHAD_FRIDAY_MORNING
+ iftrue .Generic
+ farscall PhoneScript_Random2
+ if_equal $0, ChadWantsBattle
+
+.Generic:
+ farscall PhoneScript_Random3
+ if_equal $0, ChadFoundRare
+ farjump Phone_GenericCall_Male
+
+ChadFridayMorning:
+ setflag ENGINE_CHAD_FRIDAY_MORNING
+
+ChadWantsBattle:
+ landmarktotext ROUTE_38, $2
+ setflag ENGINE_CHAD
+ farjump PhoneScript_WantsToBattle_Male
+
+ChadFoundRare:
+ farjump Phone_CheckIfUnseenRare_Male
+
+ChadOakGossip:
+ farjump ChadOakGossipScript
+
+DerekPhoneScript1:
+ trainertotext POKEFANM, DEREK1, $0
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_DEREK_HAS_NUGGET
+ iftrue .Nugget
+ farscall PhoneScript_Random2
+ if_equal $0, .NoContest
+ checkflag ENGINE_DAILY_BUG_CONTEST
+ iftrue .NoContest
+ checkcode VAR_WEEKDAY
+ if_equal TUESDAY, .ContestToday
+ if_equal THURSDAY, .ContestToday
+ if_equal SATURDAY, .ContestToday
+
+.NoContest:
+ farjump UnknownScript_0xa0988
+
+.ContestToday:
+ farjump PhoneScript_BugCatchingContest
+
+.Nugget:
+ landmarktotext ROUTE_39, $2
+ farjump UnknownScript_0xa0ad5
+
+DerekPhoneScript2:
+ trainertotext POKEFANM, DEREK1, $0
+ farscall PhoneScript_GreetPhone_Male
+ farscall PhoneScript_Random2
+ if_equal $0, .NoContest
+ checkflag ENGINE_DAILY_BUG_CONTEST
+ iftrue .NoContest
+ checkcode VAR_WEEKDAY
+ if_equal TUESDAY, .ContestToday
+ if_equal THURSDAY, .ContestToday
+ if_equal SATURDAY, .ContestToday
+
+.NoContest:
+ farscall PhoneScript_Random4
+ if_equal $0, .Nugget
+ farjump Phone_GenericCall_Male
+
+.ContestToday:
+ farjump PhoneScript_BugCatchingContest
+
+.Nugget:
+ setflag ENGINE_DEREK_HAS_NUGGET
+ landmarktotext ROUTE_39, $2
+ farjump PhoneScript_FoundItem_Male
+
+TullyPhoneScript1:
+ trainertotext FISHER, TULLY1, $0
+ checkflag ENGINE_TULLY
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_TULLY_SUNDAY_NIGHT
+ iftrue .NotSunday
+ checkflag ENGINE_TULLY_HAS_WATER_STONE
+ iftrue TullyHasWaterStone
+ checkcode VAR_WEEKDAY
+ if_not_equal SUNDAY, .NotSunday
+ checknite
+ iftrue TullySundayNight
+
+.NotSunday:
+ farjump UnknownScript_0xa0990
+
+.WantsBattle:
+ landmarktotext ROUTE_42, $2
+ farjump UnknownScript_0xa0a82
+
+TullyHasWaterStone:
+ landmarktotext ROUTE_42, $2
+ farjump UnknownScript_0xa0add
+
+TullyPhoneScript2:
+ trainertotext FISHER, TULLY1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_TULLY
+ iftrue .Generic
+ checkflag ENGINE_TULLY_SUNDAY_NIGHT
+ iftrue .Generic
+ checkflag ENGINE_TULLY_HAS_WATER_STONE
+ iftrue .Generic
+ farscall PhoneScript_Random3
+ if_equal $0, TullyWantsBattle
+ checkevent EVENT_TULLY_GAVE_WATER_STONE
+ iftrue .WaterStone
+ farscall PhoneScript_Random2
+ if_equal $0, TullyFoundWaterStone
+
+.WaterStone:
+ farscall PhoneScript_Random11
+ if_equal $0, TullyFoundWaterStone
+
+.Generic:
+ farjump Phone_GenericCall_Male
+
+TullySundayNight:
+ setflag ENGINE_TULLY_SUNDAY_NIGHT
+
+TullyWantsBattle:
+ landmarktotext ROUTE_42, $2
+ setflag ENGINE_TULLY
+ farjump PhoneScript_WantsToBattle_Male
+
+TullyFoundWaterStone:
+ setflag ENGINE_TULLY_HAS_WATER_STONE
+ landmarktotext ROUTE_42, $2
+ farjump PhoneScript_FoundItem_Male
+
+BrentPhoneScript1:
+ trainertotext POKEMANIAC, BRENT1, $0
+ checkflag ENGINE_BRENT
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_BRENT_MONDAY_MORNING
+ iftrue .NotMonday
+ checkcode VAR_WEEKDAY
+ if_not_equal MONDAY, .NotMonday
+ checkmorn
+ iftrue BrentMondayMorning
+
+.NotMonday:
+ farjump UnknownScript_0xa0998
+
+.WantsBattle:
+ landmarktotext ROUTE_43, $2
+ farjump UnknownScript_0xa0a87
+
+BrentPhoneScript2:
+ trainertotext POKEMANIAC, BRENT1, $0
+ farscall PhoneScript_GreetPhone_Male
+ farscall PhoneScript_Random2
+ if_equal $0, BrentBillTrivia
+ checkflag ENGINE_BRENT
+ iftrue .Generic
+ checkflag ENGINE_BRENT_MONDAY_MORNING
+ iftrue .Generic
+ farscall PhoneScript_Random2
+ if_equal $0, BrentWantsBattle
+
+.Generic:
+ farjump Phone_GenericCall_Male
+
+BrentMondayMorning:
+ setflag ENGINE_BRENT_MONDAY_MORNING
+
+BrentWantsBattle:
+ landmarktotext ROUTE_43, $2
+ setflag ENGINE_BRENT
+ farjump PhoneScript_WantsToBattle_Male
+
+BrentBillTrivia:
+ farjump BrentBillTriviaScript
+
+TiffanyPhoneScript1:
+ trainertotext PICNICKER, TIFFANY3, $0
+ checkflag ENGINE_TIFFANY
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_TIFFANY_TUESDAY_AFTERNOON
+ iftrue .NotTuesday
+ checkflag ENGINE_TIFFANY_HAS_PINK_BOW
+ iftrue .HasItem
+ checkcode VAR_WEEKDAY
+ if_not_equal TUESDAY, .NotTuesday
+ checkday
+ iftrue TiffanyTuesdayAfternoon
+
+.NotTuesday:
+ farjump UnknownScript_0xa09a0
+
+.WantsBattle:
+ landmarktotext ROUTE_43, $2
+ farjump UnknownScript_0xa0a8c
+
+.HasItem:
+ landmarktotext ROUTE_43, $2
+ farjump UnknownScript_0xa0ae5
+
+TiffanyPhoneScript2:
+ trainertotext PICNICKER, TIFFANY3, $0
+ farscall PhoneScript_Random4
+ if_equal $0, TiffanysFamilyMembers
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_TIFFANY
+ iftrue TiffanyGenericCall
+ checkflag ENGINE_TIFFANY_TUESDAY_AFTERNOON
+ iftrue TiffanyGenericCall
+ checkflag ENGINE_TIFFANY_HAS_PINK_BOW
+ iftrue TiffanyGenericCall
+ farscall PhoneScript_Random3
+ if_equal $0, TiffanyWantsBattle
+ checkevent EVENT_TIFFANY_GAVE_PINK_BOW
+ iftrue .PinkBow
+ farscall PhoneScript_Random2
+ if_equal $0, TiffanyHasPinkBow
+
+.PinkBow:
+ farscall PhoneScript_Random11
+ if_equal $0, TiffanyHasPinkBow
+
+TiffanyGenericCall:
+ farjump Phone_GenericCall_Female
+
+TiffanyTuesdayAfternoon:
+ setflag ENGINE_TIFFANY_TUESDAY_AFTERNOON
+
+TiffanyWantsBattle:
+ landmarktotext ROUTE_43, $2
+ setflag ENGINE_TIFFANY
+ farjump PhoneScript_WantsToBattle_Female
+
+TiffanysFamilyMembers:
+ random $6
+ if_equal $0, .Grandma
+ if_equal $1, .Grandpa
+ if_equal $2, .Mom
+ if_equal $3, .Dad
+ if_equal $4, .Sister
+ if_equal $5, .Brother
+
+.Grandma:
+ stringtotext GrandmaString, $1
+ jump TiffanysPoorClefairy
+
+.Grandpa:
+ stringtotext GrandpaString, $1
+ jump TiffanysPoorClefairy
+
+.Mom:
+ stringtotext MomString, $1
+ jump TiffanysPoorClefairy
+
+.Dad:
+ stringtotext DadString, $1
+ jump TiffanysPoorClefairy
+
+.Sister:
+ stringtotext SisterString, $1
+ jump TiffanysPoorClefairy
+
+.Brother:
+ stringtotext BrotherString, $1
+ jump TiffanysPoorClefairy
+
+TiffanysPoorClefairy:
+ farjump TiffanyItsAwful
+
+TiffanyHasPinkBow:
+ setflag ENGINE_TIFFANY_HAS_PINK_BOW
+ landmarktotext ROUTE_43, $2
+ farjump PhoneScript_FoundItem_Female
+
+; Vance
+
+VancePhoneScript1:
+ trainertotext BIRD_KEEPER, VANCE1, $0
+ checkflag ENGINE_VANCE
+ iftrue VanceWantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_VANCE_WEDNESDAY_NIGHT
+ iftrue .NotWednesday
+ checkcode VAR_WEEKDAY
+ if_not_equal WEDNESDAY, .NotWednesday
+ checknite
+ iftrue VanceWednesdayNight
+
+.NotWednesday:
+ farjump VanceLookingForward
+
+VanceWantsBattle:
+ landmarktotext ROUTE_44, $2
+ farjump VanceHurryHurry
+
+VancePhoneScript2:
+ trainertotext BIRD_KEEPER, VANCE1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_VANCE
+ iftrue .WantsBattle
+ checkflag ENGINE_VANCE_WEDNESDAY_NIGHT
+ iftrue .WantsBattle
+ farscall PhoneScript_Random3
+ if_equal $0, VanceWantsRematch
+ if_equal $1, VanceWantsRematch
+
+.WantsBattle:
+ farjump Phone_GenericCall_Male
+
+VanceWednesdayNight:
+ setflag ENGINE_VANCE_WEDNESDAY_NIGHT
+
+VanceWantsRematch:
+ landmarktotext ROUTE_44, $2
+ setflag ENGINE_VANCE
+ farjump PhoneScript_WantsToBattle_Male
+
+WiltonPhoneScript1:
+ trainertotext FISHER, WILTON1, $0
+ checkflag ENGINE_WILTON
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_WILTON_THURSDAY_MORNING
+ iftrue .NotThursday
+ checkflag ENGINE_WILTON_HAS_ITEM
+ iftrue .HasItem
+ checkcode VAR_WEEKDAY
+ if_not_equal THURSDAY, .NotThursday
+ checkmorn
+ iftrue WiltonThursdayMorning
+
+.NotThursday:
+ farjump WiltonHaventFoundAnything
+
+.WantsBattle:
+ landmarktotext ROUTE_44, $2
+ farjump WiltonNotBiting
+
+.HasItem:
+ landmarktotext ROUTE_44, $2
+ farjump WiltonWantThis
+
+WiltonPhoneScript2:
+ trainertotext FISHER, WILTON1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_WILTON
+ iftrue .GenericCall
+ checkflag ENGINE_WILTON_THURSDAY_MORNING
+ iftrue .GenericCall
+ checkflag ENGINE_WILTON_HAS_ITEM
+ iftrue .GenericCall
+ farscall PhoneScript_Random2
+ if_equal $0, WiltonWantsBattle
+ farscall PhoneScript_Random2
+ if_equal $0, WiltonHasItem
+
+.GenericCall:
+ farjump Phone_GenericCall_Male
+
+WiltonThursdayMorning:
+ setflag ENGINE_WILTON_THURSDAY_MORNING
+
+WiltonWantsBattle:
+ landmarktotext ROUTE_44, $2
+ setflag ENGINE_WILTON
+ farjump PhoneScript_WantsToBattle_Male
+
+WiltonHasItem:
+ setflag ENGINE_WILTON_HAS_ITEM
+ landmarktotext ROUTE_44, $2
+ clearevent EVENT_WILTON_HAS_ULTRA_BALL
+ clearevent EVENT_WILTON_HAS_GREAT_BALL
+ clearevent EVENT_WILTON_HAS_POKE_BALL
+ random $5
+ if_equal $0, .UltraBall
+ random $3
+ if_equal $0, .GreatBall
+ jump .PokeBall
+
+.UltraBall:
+ setevent EVENT_WILTON_HAS_ULTRA_BALL
+ jump .FoundItem
+
+.GreatBall:
+ setevent EVENT_WILTON_HAS_GREAT_BALL
+ jump .FoundItem
+
+.PokeBall:
+ setevent EVENT_WILTON_HAS_POKE_BALL
+
+.FoundItem:
+ farjump PhoneScript_FoundItem_Male
+
+; Kenji
+
+KenjiPhoneScript1:
+ trainertotext BLACKBELT_T, KENJI3, $0
+ farscall PhoneScript_AnswerPhone_Male
+ farjump KenjiAnswerPhoneScript
+
+KenjiPhoneScript2:
+ trainertotext BLACKBELT_T, KENJI3, $0
+ farscall PhoneScript_GreetPhone_Male
+ farjump KenjiCallingPhoneScript
+
+; Parry
+
+ParryPhoneScript1:
+ trainertotext HIKER, PARRY1, $0
+ checkflag ENGINE_PARRY
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Male
+ checkflag ENGINE_PARRY_FRIDAY_AFTERNOON
+ iftrue .WantsRematch
+ checkcode VAR_WEEKDAY
+ if_not_equal FRIDAY, .WantsRematch
+ checkday
+ iftrue ParryFridayDay
+
+.WantsRematch:
+ farjump ParryBattleWithMe
+
+.WantsBattle:
+ landmarktotext ROUTE_45, $2
+ farjump ParryHaventYouGottenTo
+
+ParryPhoneScript2:
+ trainertotext HIKER, PARRY1, $0
+ farscall PhoneScript_GreetPhone_Male
+ checkflag ENGINE_PARRY
+ iftrue .GenericCall
+ checkflag ENGINE_PARRY_FRIDAY_AFTERNOON
+ iftrue .GenericCall
+ farscall PhoneScript_Random2
+ if_equal $0, ParryWantsBattle
+ if_equal $1, ParryWantsBattle
+
+.GenericCall:
+ farjump Phone_GenericCall_Male
+
+ParryFridayDay:
+ setflag ENGINE_PARRY_FRIDAY_AFTERNOON
+
+ParryWantsBattle:
+ landmarktotext ROUTE_45, $2
+ setflag ENGINE_PARRY
+ farjump PhoneScript_WantsToBattle_Male
+
+; Erin
+
+ErinPhoneScript1:
+ trainertotext PICNICKER, ERIN1, $0
+ checkflag ENGINE_ERIN
+ iftrue .WantsBattle
+ farscall PhoneScript_AnswerPhone_Female
+ checkflag ENGINE_ERIN_SATURDAY_NIGHT
+ iftrue .NotSaturday
+ checkcode VAR_WEEKDAY
+ if_not_equal SATURDAY, .NotSaturday
+ checknite
+ iftrue ErinSaturdayNight
+
+.NotSaturday:
+ farjump ErinWorkingHardScript
+
+.WantsBattle:
+ landmarktotext ROUTE_46, $2
+ farjump ErinComeBattleScript
+
+ErinPhoneScript2:
+ trainertotext PICNICKER, ERIN1, $0
+ farscall PhoneScript_GreetPhone_Female
+ checkflag ENGINE_ERIN
+ iftrue .GenericCall
+ checkflag ENGINE_ERIN_SATURDAY_NIGHT
+ iftrue .GenericCall
+ farscall PhoneScript_Random3
+ if_equal $0, ErinWantsBattle
+ if_equal $1, ErinWantsBattle
+
+.GenericCall:
+ farjump Phone_GenericCall_Female
+
+ErinSaturdayNight:
+ setflag ENGINE_ERIN_SATURDAY_NIGHT
+
+ErinWantsBattle:
+ landmarktotext ROUTE_46, $2
+ setflag ENGINE_ERIN
+ farjump PhoneScript_WantsToBattle_Female
diff --git a/engine/phone_scripts.asm b/engine/phone_scripts.asm
deleted file mode 100644
index 8beee58c6..000000000
--- a/engine/phone_scripts.asm
+++ /dev/null
@@ -1,3153 +0,0 @@
-UnusedPhoneScript: ; 0xbcea5
- farwritetext UnusedPhoneText
- end
-
-; Mom
-
-MomPhoneScript: ; 0xbceaa
- checkevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST
- iftrue .bcec5
- checkevent EVENT_DUDE_TALKED_TO_YOU
- iftrue MomPhoneLectureScript
- checkevent EVENT_GAVE_MYSTERY_EGG_TO_ELM
- iftrue MomPhoneNoGymQuestScript
- checkevent EVENT_GOT_A_POKEMON_FROM_ELM
- iftrue MomPhoneNoPokedexScript
- jump MomPhoneNoPokemonScript
-
-.bcec5 ; 0xbcec5
- checkevent EVENT_IN_YOUR_ROOM
- iftrue MomPhoneHangUpScript
- farwritetext MomPhoneGreetingText
- buttonsound
- mapnametotext $0
- checkcode VAR_ROOFPALETTE
- if_equal $1, MomPhonePalette1
- if_equal $2, MomPhonePalette2
- jump UnknownScript_0xbcf2f
-
-MomPhoneLandmark: ; 0xbcedf
- farwritetext MomPhoneLandmarkText
- buttonsound
- jump UnknownScript_0xbcf37
-
-MomPhonePalette1: ; 0xbcee7
- checkcode VAR_MAPGROUP
- if_equal GROUP_NEW_BARK_TOWN, .newbark
- if_equal GROUP_CHERRYGROVE_CITY, .cherrygrove
- if_equal GROUP_VIOLET_CITY, .violet
- if_equal GROUP_AZALEA_TOWN, .azalea
- if_equal GROUP_GOLDENROD_CITY, .goldenrod
- farwritetext MomPhoneGenericAreaText
- buttonsound
- jump UnknownScript_0xbcf37
-
-.newbark ; 0xbcf05
- farwritetext MomPhoneNewBarkText
- buttonsound
- jump UnknownScript_0xbcf37
-
-.cherrygrove ; 0xbcf0d
- farwritetext MomPhoneCherrygroveText
- buttonsound
- jump UnknownScript_0xbcf37
-
-.violet ; 0xbcf15
- landmarktotext SPROUT_TOWER, 1
- jump MomPhoneLandmark
-.azalea ; 0xbcf1b
- landmarktotext SLOWPOKE_WELL, 1
- jump MomPhoneLandmark
-.goldenrod ; 0xbcf21
- landmarktotext RADIO_TOWER, 1
- jump MomPhoneLandmark
-
-MomPhonePalette2: ; 0xbcf27
- farwritetext MomOtherAreaText
- buttonsound
- jump UnknownScript_0xbcf37
-
-UnknownScript_0xbcf2f: ; 0xbcf2f
- farwritetext MomDeterminedText
- buttonsound
- jump UnknownScript_0xbcf37
-
-UnknownScript_0xbcf37: ; 0xbcf37
- checkflag ENGINE_MOM_SAVING_MONEY
- iffalse CheckIfMomHasMoney
- checkmoney $1, 0
- if_equal $0, UnknownScript_0xbcf55
- jump UnknownScript_0xbcf63
-
-CheckIfMomHasMoney: ; 0xbcf49
- checkmoney $1, 0
- if_equal $0, MomHasMoney
- jump MomHasNoMoney
-
-UnknownScript_0xbcf55: ; 0xbcf55
- readmoney $1, $0
- farwritetext MomCheckBalanceText
- yesorno
- iftrue MomPhoneSaveMoneyScript
- jump MomPhoneWontSaveMoneyScript
-
-UnknownScript_0xbcf63: ; 0xbcf63
- farwritetext UnknownText_0x1b41ea
- yesorno
- iftrue MomPhoneSaveMoneyScript
- jump MomPhoneWontSaveMoneyScript
-
-MomHasNoMoney: ; 0xbcf6e
- farwritetext UnknownText_0x1b420d
- yesorno
- iftrue MomPhoneSaveMoneyScript
- jump MomPhoneWontSaveMoneyScript
-
-MomHasMoney: ; 0xbcf79
- readmoney $1, $0
- farwritetext UnknownText_0x1b4249
- yesorno
- iftrue MomPhoneSaveMoneyScript
- jump MomPhoneWontSaveMoneyScript
-
-MomPhoneSaveMoneyScript: ; 0xbcf87
- setflag ENGINE_MOM_SAVING_MONEY
- farwritetext UnknownText_0x1b4289
- buttonsound
- jump MomPhoneHangUpScript
-
-MomPhoneWontSaveMoneyScript: ; 0xbcf92
- clearflag ENGINE_MOM_SAVING_MONEY
- farwritetext MomPhoneWontSaveMoneyText
- buttonsound
- jump MomPhoneHangUpScript
-
-MomPhoneHangUpScript: ; 0xbcf9d
- farwritetext MomPhoneHangUpText
- end
-
-MomPhoneNoPokemonScript: ; 0xbcfa2
- farwritetext MomPhoneNoPokemonText
- end
-
-MomPhoneNoPokedexScript: ; 0xbcfa7
- farwritetext MomPhoneNoPokedexText
- end
-
-MomPhoneNoGymQuestScript: ; 0xbcfac
- farwritetext MomPhoneNoGymQuestText
- end
-
-MomPhoneLectureScript: ; 0xbcfb1
- setevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST
- setflag ENGINE_DST
- specialphonecall SPECIALCALL_NONE
- farwritetext MomPhoneLectureText
- yesorno
- iftrue MomPhoneSaveMoneyScript
- jump MomPhoneWontSaveMoneyScript
-
-; Bill
-
-BillPhoneScript1: ; 0xbcfc5
- checkday
- iftrue .daygreet
- checknite
- iftrue .nitegreet
- farwritetext BillPhoneMornGreetingText
- buttonsound
- jump .main
-
-.daygreet ; 0xbcfd7
- farwritetext BillPhoneDayGreetingText
- buttonsound
- jump .main
-
-.nitegreet ; 0xbcfdf
- farwritetext BillPhoneNiteGreetingText
- buttonsound
- jump .main
-
-.main ; 0xbcfe7
- farwritetext BillPhoneGeneriText
- buttonsound
- checkcode VAR_BOXSPACE
- RAM2MEM $0
- if_equal $0, .full
- if_less_than $6, .nearlyfull
- farwritetext BillPhoneNotFullText
- end
-
-.nearlyfull ; 0xbcffd
- farwritetext BillPhoneNearlyFullText
- end
-
-.full ; 0xbd002
- farwritetext BillPhoneFullText
- end
-
-BillPhoneScript2: ; 0xbd007
- farwritetext BillPhoneNewlyFullText
- waitbutton
- end
-
-; Elm
-
-ElmPhoneScript1: ; 0xbd00d
- checkcode VAR_SPECIALPHONECALL
- if_equal $1, .pokerus
- checkevent EVENT_SHOWED_TOGEPI_TO_ELM
- iftrue .discovery
- checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE
- iffalse .next
- checkevent EVENT_TOGEPI_HATCHED
- iftrue .egghatched
-.next
- checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE
- iftrue .eggunhatched
- checkevent EVENT_ELMS_AIDE_IN_LAB
- iftrue .assistant
- checkevent EVENT_GAVE_MYSTERY_EGG_TO_ELM
- iftrue .checkingegg
- checkevent EVENT_ELM_CALLED_ABOUT_STOLEN_POKEMON
- iftrue .stolen
- checkevent EVENT_GOT_MYSTERY_EGG_FROM_MR_POKEMON
- iftrue .sawmrpokemon
- farwritetext ElmPhoneStartText
- end
-
-.sawmrpokemon ; 0xbd048
- farwritetext ElmPhoneSawMrPokemonText
- end
-
-.stolen ; 0xbd04d
- farwritetext ElmPhonePokemonStolenText
- end
-
-.checkingegg ; 0xbd052
- farwritetext ElmPhoneCheckingEggText
- end
-
-.assistant ; 0xbd057
- farwritetext ElmPhoneAssistantText
- end
-
-.eggunhatched ; 0xbd05c
- farwritetext ElmPhoneEggUnhatchedText
- end
-
-.egghatched ; 0xbd061
- farwritetext ElmPhoneEggHatchedText
- setevent EVENT_TOLD_ELM_ABOUT_TOGEPI_OVER_THE_PHONE
- end
-
-.discovery ; 0xbd069
- random $2
- if_equal $0, .nextdiscovery
- farwritetext ElmPhoneDiscovery1Text
- end
-
-.nextdiscovery ; 0xbd074
- farwritetext ElmPhoneDiscovery2Text
- end
-
-.pokerus ; 0xbd079
- farwritetext ElmPhonePokerusText
- specialphonecall SPECIALCALL_NONE
- end
-
-ElmPhoneScript2: ; 0xbd081
- checkcode VAR_SPECIALPHONECALL
- if_equal $2, .disaster
- if_equal $3, .assistant
- if_equal $4, .rocket
- if_equal $5, .gift
- if_equal $8, .gift
- farwritetext ElmPhonePokerusText
- specialphonecall SPECIALCALL_NONE
- end
-
-.disaster ; 0xbd09f
- farwritetext ElmPhoneDisasterText
- specialphonecall SPECIALCALL_NONE
- setevent EVENT_ELM_CALLED_ABOUT_STOLEN_POKEMON
- end
-
-.assistant ; 0xbd0aa
- farwritetext ElmPhoneEggAssistantText
- specialphonecall SPECIALCALL_NONE
- clearevent EVENT_ELMS_AIDE_IN_VIOLET_POKEMON_CENTER
- setevent EVENT_ELMS_AIDE_IN_LAB
- end
-
-.rocket ; 0xbd0b8
- farwritetext ElmPhoneRocketText
- specialphonecall SPECIALCALL_NONE
- end
-
-.gift ; 0xbd0c0
- farwritetext ElmPhoneGiftText
- specialphonecall SPECIALCALL_NONE
- end
-
-.unused ; 0xbd0c8
- farwritetext ElmPhoneUnusedText
- specialphonecall SPECIALCALL_NONE
- end
-; bd0d0
-
-; Jack
-
-JackPhoneScript1:
- trainertotext SCHOOLBOY, JACK1, $0
- checkflag ENGINE_JACK
- iftrue UnknownScript_0xbd0f3
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_JACK_MONDAY_MORNING
- iftrue UnknownScript_0xbd0ef
- checkcode VAR_WEEKDAY
- if_not_equal MONDAY, UnknownScript_0xbd0ef
- checkmorn
- iftrue UnknownScript_0xbd12a
-
-UnknownScript_0xbd0ef:
- farjump UnknownScript_0xa08f8
-
-UnknownScript_0xbd0f3:
- landmarktotext NATIONAL_PARK, $2
- farjump UnknownScript_0xa0a2d
-
-JackPhoneScript2:
- trainertotext SCHOOLBOY, JACK1, $0
- farscall PhoneScript_GreetPhone_Male
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd13b
- checkflag ENGINE_JACK
- iftrue UnknownScript_0xbd11e
- checkflag ENGINE_JACK_MONDAY_MORNING
- iftrue UnknownScript_0xbd11e
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd12d
-
-UnknownScript_0xbd11e:
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd137
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd12a:
- setflag ENGINE_JACK_MONDAY_MORNING
-
-UnknownScript_0xbd12d:
- landmarktotext NATIONAL_PARK, $2
- setflag ENGINE_JACK
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd137:
- farjump UnknownScript_0xa0584
-
-UnknownScript_0xbd13b:
- farjump UnknownScript_0xa0654
-
-; Beverly
-
-BeverlyPhoneScript1:
- trainertotext POKEFANF, BEVERLY1, $0
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_BEVERLY_HAS_NUGGET
- iftrue UnknownScript_0xbd151
- farjump UnknownScript_0xa0900
-
-UnknownScript_0xbd151:
- landmarktotext NATIONAL_PARK, $2
- farjump UnknownScript_0xa0aa5
-
-BeverlyPhoneScript2:
- trainertotext POKEFANF, BEVERLY1, $0
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_BEVERLY_HAS_NUGGET
- iftrue UnknownScript_0xbd16e
- farscall PhoneScript_Random4
- if_equal $0, UnknownScript_0xbd172
-
-UnknownScript_0xbd16e:
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbd172:
- setflag ENGINE_BEVERLY_HAS_NUGGET
- landmarktotext NATIONAL_PARK, $2
- farjump UnknownScript_0xa061e
-
-; Huey
-
-HueyPhoneScript1:
- trainertotext SAILOR, HUEY1, $0
- checkflag ENGINE_HUEY
- iftrue UnknownScript_0xbd1a2
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_HUEY_WEDNESDAY_NIGHT
- iftrue UnknownScript_0xbd19b
- checkcode VAR_WEEKDAY
- if_not_equal WEDNESDAY, UnknownScript_0xbd19b
- checknite
- iftrue UnknownScript_0xbd1cd
-
-UnknownScript_0xbd19b:
- special RandomPhoneMon
- farjump UnknownScript_0xa0908
-
-UnknownScript_0xbd1a2:
- landmarktotext LIGHTHOUSE, $2
- farjump UnknownScript_0xa0a32
-
-HueyPhoneScript2:
- trainertotext SAILOR, HUEY1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_HUEY
- iftrue UnknownScript_0xbd1c9
- checkflag ENGINE_HUEY_WEDNESDAY_NIGHT
- iftrue UnknownScript_0xbd1c9
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd1d0
- if_equal $1, UnknownScript_0xbd1d0
-
-UnknownScript_0xbd1c9:
- farjump PhoneScript_MonFlavorText
-
-UnknownScript_0xbd1cd:
- setflag ENGINE_HUEY_WEDNESDAY_NIGHT
-
-UnknownScript_0xbd1d0:
- landmarktotext LIGHTHOUSE, $2
- setflag ENGINE_HUEY
- farjump UnknownScript_0xa0376
-
-; Gaven
-
-GavenPhoneScript1:
- trainertotext COOLTRAINERM, GAVEN3, $0
- checkflag ENGINE_GAVEN
- iftrue UnknownScript_0xbd1fd
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_GAVEN_THURSDAY_MORNING
- iftrue UnknownScript_0xbd1f9
- checkcode VAR_WEEKDAY
- if_not_equal THURSDAY, UnknownScript_0xbd1f9
- checkmorn
- iftrue UnknownScript_0xbd22c
-
-UnknownScript_0xbd1f9:
- farjump UnknownScript_0xa0910
-
-UnknownScript_0xbd1fd:
- landmarktotext ROUTE_26, $2
- farjump UnknownScript_0xa0a37
-
-GavenPhoneScript2:
- trainertotext COOLTRAINERM, GAVEN3, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_GAVEN
- iftrue UnknownScript_0xbd220
- checkflag ENGINE_GAVEN_THURSDAY_MORNING
- iftrue UnknownScript_0xbd220
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd22f
-
-UnknownScript_0xbd220:
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd239
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd22c:
- setflag ENGINE_GAVEN_THURSDAY_MORNING
-
-UnknownScript_0xbd22f:
- landmarktotext ROUTE_26, $2
- setflag ENGINE_GAVEN
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd239:
- farjump UnknownScript_0xa0584
-
-; Beth
-
-BethPhoneScript1:
- trainertotext COOLTRAINERF, BETH1, $0
- checkflag ENGINE_BETH
- iftrue UnknownScript_0xbd260
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_BETH_FRIDAY_AFTERNOON
- iftrue UnknownScript_0xbd25c
- checkcode VAR_WEEKDAY
- if_not_equal FRIDAY, UnknownScript_0xbd25c
- checkday
- iftrue UnknownScript_0xbd287
-
-UnknownScript_0xbd25c:
- farjump UnknownScript_0xa0918
-
-UnknownScript_0xbd260:
- landmarktotext ROUTE_26, $2
- farjump UnknownScript_0xa0a3c
-
-BethPhoneScript2:
- trainertotext COOLTRAINERF, BETH1, $0
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_BETH
- iftrue UnknownScript_0xbd283
- checkflag ENGINE_BETH_FRIDAY_AFTERNOON
- iftrue UnknownScript_0xbd283
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd28a
-
-UnknownScript_0xbd283:
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbd287:
- setflag ENGINE_BETH_FRIDAY_AFTERNOON
-
-UnknownScript_0xbd28a:
- landmarktotext ROUTE_26, $2
- setflag ENGINE_BETH
- farjump UnknownScript_0xa037e
-
-; Jose
-
-JosePhoneScript1:
- trainertotext BIRD_KEEPER, JOSE2, $0
- checkflag ENGINE_JOSE
- iftrue UnknownScript_0xbd2bd
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_JOSE_SATURDAY_NIGHT
- iftrue UnknownScript_0xbd2b9
- checkflag ENGINE_JOSE_HAS_STAR_PIECE
- iftrue UnknownScript_0xbd2c4
- checkcode VAR_WEEKDAY
- if_not_equal SATURDAY, UnknownScript_0xbd2b9
- checknite
- iftrue UnknownScript_0xbd301
-
-UnknownScript_0xbd2b9:
- farjump UnknownScript_0xa0920
-
-UnknownScript_0xbd2bd:
- landmarktotext ROUTE_27, $2
- farjump UnknownScript_0xa0a41
-
-UnknownScript_0xbd2c4:
- landmarktotext ROUTE_27, $2
- farjump UnknownScript_0xa0a41
-
-JosePhoneScript2:
- trainertotext BIRD_KEEPER, JOSE2, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_JOSE
- iftrue UnknownScript_0xbd2f5
- checkflag ENGINE_JOSE_SATURDAY_NIGHT
- iftrue UnknownScript_0xbd2f5
- checkflag ENGINE_JOSE_HAS_STAR_PIECE
- iftrue UnknownScript_0xbd2f5
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd304
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd312
-
-UnknownScript_0xbd2f5:
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd30e
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd301:
- setflag ENGINE_JOSE_SATURDAY_NIGHT
-
-UnknownScript_0xbd304:
- landmarktotext ROUTE_27, $2
- setflag ENGINE_JOSE
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd30e:
- farjump UnknownScript_0xa0584
-
-UnknownScript_0xbd312:
- setflag ENGINE_JOSE_HAS_STAR_PIECE
- landmarktotext ROUTE_27, $2
- farjump UnknownScript_0xa05e6
-
-; Reena
-
-ReenaPhoneScript1:
- trainertotext COOLTRAINERF, REENA1, $0
- checkflag ENGINE_REENA
- iftrue UnknownScript_0xbd33f
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_REENA_SUNDAY_MORNING
- iftrue UnknownScript_0xbd33b
- checkcode VAR_WEEKDAY
- if_not_equal SUNDAY, UnknownScript_0xbd33b
- checkmorn
- iftrue UnknownScript_0xbd366
-
-UnknownScript_0xbd33b:
- farjump UnknownScript_0xa0928
-
-UnknownScript_0xbd33f:
- landmarktotext ROUTE_27, $2
- farjump UnknownScript_0xa0a46
-
-ReenaPhoneScript2:
- trainertotext COOLTRAINERF, REENA1, $0
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_REENA
- iftrue UnknownScript_0xbd362
- checkflag ENGINE_REENA_SUNDAY_MORNING
- iftrue UnknownScript_0xbd362
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd369
-
-UnknownScript_0xbd362:
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbd366:
- setflag ENGINE_REENA_SUNDAY_MORNING
-
-UnknownScript_0xbd369:
- landmarktotext ROUTE_27, $2
- setflag ENGINE_REENA
- farjump UnknownScript_0xa037e
-
-; Joey
-
-JoeyPhoneScript1:
- trainertotext YOUNGSTER, JOEY1, $0
- checkflag ENGINE_JOEY
- iftrue UnknownScript_0xbd399
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_JOEY_MONDAY_AFTERNOON
- iftrue UnknownScript_0xbd392
- checkcode VAR_WEEKDAY
- if_not_equal MONDAY, UnknownScript_0xbd392
- checkday
- iftrue UnknownScript_0xbd3c4
-
-UnknownScript_0xbd392:
- special RandomPhoneMon
- farjump UnknownScript_0xa0930
-
-UnknownScript_0xbd399:
- landmarktotext ROUTE_30, $2
- farjump UnknownScript_0xa0a4b
-
-JoeyPhoneScript2:
- trainertotext YOUNGSTER, JOEY1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_JOEY
- iftrue UnknownScript_0xbd3c0
- checkflag ENGINE_JOEY_MONDAY_AFTERNOON
- iftrue UnknownScript_0xbd3c0
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd3c7
- if_equal $1, UnknownScript_0xbd3c7
-
-UnknownScript_0xbd3c0:
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd3c4:
- setflag ENGINE_JOEY_MONDAY_AFTERNOON
-
-UnknownScript_0xbd3c7:
- landmarktotext ROUTE_30, $2
- setflag ENGINE_JOEY
- farjump UnknownScript_0xa0376
-
-; Wade
-
-WadePhoneScript1:
- trainertotext BUG_CATCHER, WADE1, $0
- checkflag ENGINE_WADE
- iftrue UnknownScript_0xbd41a
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_WADE_TUESDAY_NIGHT
- iftrue UnknownScript_0xbd3f6
- checkflag ENGINE_WADE_HAS_ITEM
- iftrue UnknownScript_0xbd421
- checkcode VAR_WEEKDAY
- if_not_equal TUESDAY, UnknownScript_0xbd3f6
- checknite
- iftrue UnknownScript_0xbd484
-
-UnknownScript_0xbd3f6:
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd412
- checkflag ENGINE_DAILY_BUG_CONTEST
- iftrue UnknownScript_0xbd412
- checkcode VAR_WEEKDAY
- if_equal TUESDAY, UnknownScript_0xbd416
- if_equal THURSDAY, UnknownScript_0xbd416
- if_equal SATURDAY, UnknownScript_0xbd416
-
-UnknownScript_0xbd412:
- farjump UnknownScript_0xa0938
-
-UnknownScript_0xbd416:
- farjump UnknownScript_0xa05a4
-
-UnknownScript_0xbd41a:
- landmarktotext ROUTE_31, $2
- farjump UnknownScript_0xa0a50
-
-UnknownScript_0xbd421:
- landmarktotext ROUTE_31, $2
- farjump UnknownScript_0xa0ab5
-
-WadePhoneScript2:
- trainertotext BUG_CATCHER, WADE1, $0
- farscall PhoneScript_GreetPhone_Male
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd44c
- checkflag ENGINE_DAILY_BUG_CONTEST
- iftrue UnknownScript_0xbd44c
- checkcode VAR_WEEKDAY
- if_equal TUESDAY, UnknownScript_0xbd480
- if_equal THURSDAY, UnknownScript_0xbd480
- if_equal SATURDAY, UnknownScript_0xbd480
-
-UnknownScript_0xbd44c:
- checkflag ENGINE_WADE
- iftrue UnknownScript_0xbd474
- checkflag ENGINE_WADE_TUESDAY_NIGHT
- iftrue UnknownScript_0xbd474
- checkflag ENGINE_WADE_HAS_ITEM
- iftrue UnknownScript_0xbd474
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd495
- checkflag ENGINE_FLYPOINT_GOLDENROD
- iffalse UnknownScript_0xbd474
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd487
-
-UnknownScript_0xbd474:
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd491
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd480:
- farjump UnknownScript_0xa05a4
-
-UnknownScript_0xbd484:
- setflag ENGINE_WADE_TUESDAY_NIGHT
-
-UnknownScript_0xbd487:
- landmarktotext ROUTE_31, $2
- setflag ENGINE_WADE
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd491:
- farjump UnknownScript_0xa0584
-
-UnknownScript_0xbd495:
- setflag ENGINE_WADE_HAS_ITEM
- landmarktotext ROUTE_31, $2
- clearevent EVENT_WADE_HAS_BERRY
- clearevent EVENT_WADE_HAS_PSNCUREBERRY
- clearevent EVENT_WADE_HAS_PRZCUREBERRY
- clearevent EVENT_WADE_HAS_BITTER_BERRY
- random $4
- if_equal $0, UnknownScript_0xbd4b9
- if_equal $1, UnknownScript_0xbd4bf
- if_equal $2, UnknownScript_0xbd4c5
- if_equal $3, UnknownScript_0xbd4cb
-
-UnknownScript_0xbd4b9:
- setevent EVENT_WADE_HAS_BERRY
- jump UnknownScript_0xbd4ce
-
-UnknownScript_0xbd4bf:
- setevent EVENT_WADE_HAS_PSNCUREBERRY
- jump UnknownScript_0xbd4ce
-
-UnknownScript_0xbd4c5:
- setevent EVENT_WADE_HAS_PRZCUREBERRY
- jump UnknownScript_0xbd4ce
-
-UnknownScript_0xbd4cb:
- setevent EVENT_WADE_HAS_BITTER_BERRY
-
-UnknownScript_0xbd4ce:
- farjump UnknownScript_0xa05e6
-
-; Ralph
-
-RalphPhoneScript1:
- trainertotext FISHER, RALPH1, $0
- checkflag ENGINE_RALPH
- iftrue Ralph_Rematch
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_RALPH_WEDNESDAY_MORNING
- iftrue Ralph_CheckSwarm
- checkcode VAR_WEEKDAY
- if_not_equal WEDNESDAY, Ralph_CheckSwarm
- checkmorn
- iftrue Ralph_WednesdayMorning
-Ralph_CheckSwarm:
- checkflag ENGINE_SPECIAL_WILDDATA
- iftrue Ralph_ReportSwarm
- farjump UnknownScript_0xa0940
-
-Ralph_Rematch:
- landmarktotext ROUTE_32, $2
- farjump UnknownScript_0xa0a55
-
-Ralph_ReportSwarm:
- landmarktotext ROUTE_32, $2
- farjump UnknownScript_0xa0af5
-
-RalphPhoneScript2:
- trainertotext FISHER, RALPH1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_FLYPOINT_GOLDENROD
- iffalse Ralph_CheckSwarm2
- checkflag ENGINE_RALPH
- iftrue Ralph_CheckSwarm2
- checkflag ENGINE_RALPH_WEDNESDAY_MORNING
- iftrue Ralph_CheckSwarm2
- farscall PhoneScript_Random2
- if_equal $0, Ralph_FightMe
-Ralph_CheckSwarm2:
- farscall PhoneScript_Random5
- if_equal $0, Ralph_SetUpSwarm
- farjump UnknownScript_0xa0000
-
-Ralph_WednesdayMorning:
- setflag ENGINE_RALPH_WEDNESDAY_MORNING
-Ralph_FightMe:
- landmarktotext ROUTE_32, $2
- setflag ENGINE_RALPH
- farjump UnknownScript_0xa0376
-
-Ralph_SetUpSwarm:
- checkflag ENGINE_SPECIAL_WILDDATA
- iftrue UnknownScript_0xbd55c
- setflag ENGINE_SPECIAL_WILDDATA
- pokenamemem QWILFISH, $1
- landmarktotext ROUTE_32, $2
- writebyte FISHSWARM_QWILFISH
- special Special_ActivateFishingSwarm
- farjump UnknownScript_0xa05d6
-
-UnknownScript_0xbd55c:
- farjump UnknownScript_0xa0000
-
-; Liz
-
-LizPhoneScript1:
- trainertotext PICNICKER, LIZ1, $0
- checkflag ENGINE_LIZ
- iftrue UnknownScript_0xbd586
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_LIZ_THURSDAY_AFTERNOON
- iftrue UnknownScript_0xbd57f
- checkcode VAR_WEEKDAY
- if_not_equal THURSDAY, UnknownScript_0xbd57f
- checkday
- iftrue UnknownScript_0xbd5c3
-
-UnknownScript_0xbd57f:
- special RandomPhoneMon
- farjump UnknownScript_0xa0948
-
-UnknownScript_0xbd586:
- landmarktotext ROUTE_32, $2
- farjump UnknownScript_0xa0a5a
-
-LizPhoneScript2:
- trainertotext PICNICKER, LIZ1, $0
- farscall PhoneScript_Random4
- if_equal $0, UnknownScript_0xbd5d0
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_LIZ
- iftrue UnknownScript_0xbd5a9
- checkflag ENGINE_LIZ_THURSDAY_AFTERNOON
- iftrue UnknownScript_0xbd5a9
-
-UnknownScript_0xbd5a9:
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd5d4
- checkflag ENGINE_FLYPOINT_GOLDENROD
- iffalse UnknownScript_0xbd5bf
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd5c6
-
-UnknownScript_0xbd5bf:
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbd5c3:
- setflag ENGINE_LIZ_THURSDAY_AFTERNOON
-
-UnknownScript_0xbd5c6:
- landmarktotext ROUTE_32, $2
- setflag ENGINE_LIZ
- farjump UnknownScript_0xa037e
-
-UnknownScript_0xbd5d0:
- farjump UnknownScript_0xa047a
-
-UnknownScript_0xbd5d4:
- random $9
- if_equal $0, UnknownScript_0xbd5fa
- if_equal $1, UnknownScript_0xbd600
- if_equal $2, UnknownScript_0xbd606
- if_equal $3, UnknownScript_0xbd60c
- if_equal $4, UnknownScript_0xbd612
- if_equal $5, UnknownScript_0xbd618
- if_equal $6, UnknownScript_0xbd61e
- if_equal $7, UnknownScript_0xbd624
- if_equal $8, UnknownScript_0xbd62a
-
-UnknownScript_0xbd5fa:
- trainerclassname COOLTRAINERM, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd600:
- trainerclassname BEAUTY, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd606:
- trainerclassname GRUNTM, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd60c:
- trainerclassname TEACHER, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd612:
- trainerclassname SWIMMERF, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd618:
- trainerclassname KIMONO_GIRL, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd61e:
- trainerclassname SKIER, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd624:
- trainerclassname MEDIUM, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd62a:
- trainerclassname POKEFANM, $1
- jump UnknownScript_0xbd630
-
-UnknownScript_0xbd630:
- farjump UnknownScript_0xa06da
-
-; Anthony
-
-AnthonyPhoneScript1:
- trainertotext HIKER, ANTHONY2, $0
- checkflag ENGINE_ANTHONY
- iftrue UnknownScript_0xbd65d
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_ANTHONY_FRIDAY_NIGHT
- iftrue UnknownScript_0xbd653
- checkcode VAR_WEEKDAY
- if_not_equal FRIDAY, UnknownScript_0xbd653
- checknite
- iftrue UnknownScript_0xbd699
-
-UnknownScript_0xbd653:
- checkflag ENGINE_DUNSPARCE_SWARM
- iftrue UnknownScript_0xbd664
- farjump UnknownScript_0xa0950
-
-UnknownScript_0xbd65d:
- landmarktotext ROUTE_33, $2
- farjump UnknownScript_0xa0a5f
-
-UnknownScript_0xbd664:
- landmarktotext ROUTE_33, $2
- farjump UnknownScript_0xa0afa
-
-AnthonyPhoneScript2:
- trainertotext HIKER, ANTHONY2, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_FLYPOINT_GOLDENROD
- iffalse UnknownScript_0xbd68d
- checkflag ENGINE_ANTHONY
- iftrue UnknownScript_0xbd68d
- checkflag ENGINE_ANTHONY_FRIDAY_NIGHT
- iftrue UnknownScript_0xbd68d
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd69c
-
-UnknownScript_0xbd68d:
- farscall PhoneScript_Random5
- if_equal $0, UnknownScript_0xbd6a6
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd699:
- setflag ENGINE_ANTHONY_FRIDAY_NIGHT
-
-UnknownScript_0xbd69c:
- landmarktotext ROUTE_33, $2
- setflag ENGINE_ANTHONY
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd6a6:
- checkflag ENGINE_DUNSPARCE_SWARM
- iftrue UnknownScript_0xbd6bd
- setflag ENGINE_DUNSPARCE_SWARM
- pokenamemem DUNSPARCE, $1
- swarm SWARM_DUNSPARCE, DARK_CAVE_VIOLET_ENTRANCE
- landmarktotext DARK_CAVE, $2
- farjump UnknownScript_0xa05de
-
-UnknownScript_0xbd6bd:
- farjump UnknownScript_0xa0000
-
-; Todd
-
-ToddPhoneScript1:
- trainertotext CAMPER, TODD1, $0
- checkflag ENGINE_TODD
- iftrue UnknownScript_0xbd6ea
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_TODD_SATURDAY_MORNING
- iftrue UnknownScript_0xbd6e0
- checkcode VAR_WEEKDAY
- if_not_equal SATURDAY, UnknownScript_0xbd6e0
- checkmorn
- iftrue UnknownScript_0xbd72b
-
-UnknownScript_0xbd6e0:
- checkflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
- iftrue UnknownScript_0xbd6f1
- farjump UnknownScript_0xa0958
-
-UnknownScript_0xbd6ea:
- landmarktotext ROUTE_34, $2
- farjump UnknownScript_0xa0a64
-
-UnknownScript_0xbd6f1:
- farjump UnknownScript_0xa0b04
-
-ToddPhoneScript2:
- trainertotext CAMPER, TODD1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_TODD
- iftrue UnknownScript_0xbd717
- checkflag ENGINE_TODD_SATURDAY_MORNING
- iftrue UnknownScript_0xbd717
- checkflag ENGINE_FLYPOINT_GOLDENROD
- iffalse UnknownScript_0xbd71f
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd72e
-
-UnknownScript_0xbd717:
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd73c
-
-UnknownScript_0xbd71f:
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd738
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd72b:
- setflag ENGINE_TODD_SATURDAY_MORNING
-
-UnknownScript_0xbd72e:
- landmarktotext ROUTE_34, $2
- setflag ENGINE_TODD
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd738:
- farjump UnknownScript_0xa0584
-
-UnknownScript_0xbd73c:
- setflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
- farjump UnknownScript_0xa0644
-
-; Gina
-
-GinaPhoneScript1:
- trainertotext PICNICKER, GINA1, $0
- checkflag ENGINE_GINA
- iftrue UnknownScript_0xbd776
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_GINA_SUNDAY_AFTERNOON
- iftrue UnknownScript_0xbd768
- checkflag ENGINE_GINA_HAS_LEAF_STONE
- iftrue UnknownScript_0xbd77d
- checkcode VAR_WEEKDAY
- if_not_equal SUNDAY, UnknownScript_0xbd768
- checkday
- iftrue UnknownScript_0xbd7cc
-
-UnknownScript_0xbd768:
- checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
- iftrue UnknownScript_0xbd772
- farjump UnknownScript_0xa0960
-
-UnknownScript_0xbd772:
- farjump UnknownScript_0xa05c6
-
-UnknownScript_0xbd776:
- landmarktotext ROUTE_34, $2
- farjump UnknownScript_0xa0a69
-
-UnknownScript_0xbd77d:
- landmarktotext ROUTE_34, $2
- farjump UnknownScript_0xa0abd
-
-GinaPhoneScript2:
- trainertotext PICNICKER, GINA1, $0
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
- iftrue UnknownScript_0xbd7d9
- checkflag ENGINE_GINA
- iftrue UnknownScript_0xbd7c8
- checkflag ENGINE_GINA_SUNDAY_AFTERNOON
- iftrue UnknownScript_0xbd7c8
- checkflag ENGINE_GINA_HAS_LEAF_STONE
- iftrue UnknownScript_0xbd7c8
- checkevent EVENT_GINA_GAVE_LEAF_STONE
- iftrue UnknownScript_0xbd7b2
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd7dd
-
-UnknownScript_0xbd7b2:
- farscall PhoneScript_Random11
- if_equal $0, UnknownScript_0xbd7dd
- checkflag ENGINE_FLYPOINT_GOLDENROD
- iffalse UnknownScript_0xbd7c8
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd7cf
-
-UnknownScript_0xbd7c8:
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbd7cc:
- setflag ENGINE_GINA_SUNDAY_AFTERNOON
-
-UnknownScript_0xbd7cf:
- landmarktotext ROUTE_34, $2
- setflag ENGINE_GINA
- farjump UnknownScript_0xa037e
-
-UnknownScript_0xbd7d9:
- farjump UnknownScript_0xa05c6
-
-UnknownScript_0xbd7dd:
- setflag ENGINE_GINA_HAS_LEAF_STONE
- landmarktotext ROUTE_34, $2
- farjump UnknownScript_0xa061e
-
-; Irwin
-
-IrwinPhoneScript1:
- trainertotext JUGGLER, IRWIN1, $0
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
- iftrue UnknownScript_0xbd7f9
- farjump UnknownScript_0xa09c8
-
-UnknownScript_0xbd7f9:
- farjump UnknownScript_0xa05be
-
-IrwinPhoneScript2:
- trainertotext JUGGLER, IRWIN1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_ROCKETS_IN_RADIO_TOWER
- iftrue UnknownScript_0xbd80f
- farjump UnknownScript_0xa0848
-
-UnknownScript_0xbd80f:
- farjump UnknownScript_0xa05be
-
-; Arnie
-
-ArniePhoneScript1:
- trainertotext BUG_CATCHER, ARNIE1, $0
- checkflag ENGINE_ARNIE
- iftrue UnknownScript_0xbd83c
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_ARNIE_TUESDAY_MORNING
- iftrue UnknownScript_0xbd832
- checkcode VAR_WEEKDAY
- if_not_equal TUESDAY, UnknownScript_0xbd832
- checkmorn
- iftrue UnknownScript_0xbd87a
-
-UnknownScript_0xbd832:
- checkflag ENGINE_YANMA_SWARM
- iftrue UnknownScript_0xbd843
- farjump UnknownScript_0xa0968
-
-UnknownScript_0xbd83c:
- landmarktotext ROUTE_35, $2
- farjump UnknownScript_0xa0a6e
-
-UnknownScript_0xbd843:
- landmarktotext ROUTE_35, $2
- farjump UnknownScript_0xa0aff
-
-ArniePhoneScript2:
- trainertotext BUG_CATCHER, ARNIE1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_ARNIE
- iftrue UnknownScript_0xbd866
- checkflag ENGINE_ARNIE_TUESDAY_MORNING
- iftrue UnknownScript_0xbd866
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd87d
-
-UnknownScript_0xbd866:
- farscall PhoneScript_Random5
- if_equal $0, UnknownScript_0xbd887
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd89e
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd87a:
- setflag ENGINE_ARNIE_TUESDAY_MORNING
-
-UnknownScript_0xbd87d:
- landmarktotext ROUTE_35, $2
- setflag ENGINE_ARNIE
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd887: ; start swarm
- checkflag ENGINE_YANMA_SWARM
- iftrue UnknownScript_0xbd8a2
- setflag ENGINE_YANMA_SWARM
- pokenamemem YANMA, $1
- swarm SWARM_YANMA, ROUTE_35
- landmarktotext ROUTE_35, $2
- farjump UnknownScript_0xa05ce
-
-UnknownScript_0xbd89e:
- farjump UnknownScript_0xa0584
-
-UnknownScript_0xbd8a2:
- farjump UnknownScript_0xa0000
-
-; Alan
-
-AlanPhoneScript1:
- trainertotext SCHOOLBOY, ALAN1, $0
- checkflag ENGINE_ALAN
- iftrue UnknownScript_0xbd8cf
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_ALAN_WEDNESDAY_AFTERNOON
- iftrue UnknownScript_0xbd8cb
- checkflag ENGINE_ALAN_HAS_FIRE_STONE
- iftrue UnknownScript_0xbd8d6
- checkcode VAR_WEEKDAY
- if_not_equal WEDNESDAY, UnknownScript_0xbd8cb
- checkday
- iftrue UnknownScript_0xbd919
-
-UnknownScript_0xbd8cb:
- farjump UnknownScript_0xa0970
-
-UnknownScript_0xbd8cf:
- landmarktotext ROUTE_36, $2
- farjump UnknownScript_0xa0a73
-
-UnknownScript_0xbd8d6:
- landmarktotext ROUTE_36, $2
- farjump UnknownScript_0xa0ac5
-
-AlanPhoneScript2:
- trainertotext SCHOOLBOY, ALAN1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_ALAN
- iftrue UnknownScript_0xbd915
- checkflag ENGINE_ALAN_WEDNESDAY_AFTERNOON
- iftrue UnknownScript_0xbd915
- checkflag ENGINE_ALAN_HAS_FIRE_STONE
- iftrue UnknownScript_0xbd915
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd91c
- checkevent EVENT_ALAN_GAVE_FIRE_STONE
- iftrue UnknownScript_0xbd90d
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd926
-
-UnknownScript_0xbd90d:
- farscall PhoneScript_Random11
- if_equal $0, UnknownScript_0xbd926
-
-UnknownScript_0xbd915:
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbd919:
- setflag ENGINE_ALAN_WEDNESDAY_AFTERNOON
-
-UnknownScript_0xbd91c:
- landmarktotext ROUTE_36, $2
- setflag ENGINE_ALAN
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbd926:
- setflag ENGINE_ALAN_HAS_FIRE_STONE
- landmarktotext ROUTE_36, $2
- farjump UnknownScript_0xa05e6
-
-; Dana
-
-DanaPhoneScript1:
- trainertotext LASS, DANA1, $0
- checkflag ENGINE_DANA
- iftrue UnknownScript_0xbd959
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_DANA_THURSDAY_NIGHT
- iftrue UnknownScript_0xbd955
- checkflag ENGINE_DANA_HAS_THUNDERSTONE
- iftrue UnknownScript_0xbd960
- checkcode VAR_WEEKDAY
- if_not_equal THURSDAY, UnknownScript_0xbd955
- checknite
- iftrue UnknownScript_0xbd9ab
-
-UnknownScript_0xbd955:
- farjump UnknownScript_0xa0978
-
-UnknownScript_0xbd959:
- landmarktotext ROUTE_38, $2
- farjump UnknownScript_0xa0a78
-
-UnknownScript_0xbd960:
- landmarktotext ROUTE_38, $2
- farjump UnknownScript_0xa0acd
-
-DanaPhoneScript2:
- trainertotext LASS, DANA1, $0
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_DANA
- iftrue UnknownScript_0xbd99f
- checkflag ENGINE_DANA_THURSDAY_NIGHT
- iftrue UnknownScript_0xbd99f
- checkflag ENGINE_DANA_HAS_THUNDERSTONE
- iftrue UnknownScript_0xbd99f
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd9ae
- checkevent EVENT_DANA_GAVE_THUNDERSTONE
- iftrue UnknownScript_0xbd997
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbd9bc
-
-UnknownScript_0xbd997:
- farscall PhoneScript_Random11
- if_equal $0, UnknownScript_0xbd9bc
-
-UnknownScript_0xbd99f:
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbd9b8
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbd9ab:
- setflag ENGINE_DANA_THURSDAY_NIGHT
-
-UnknownScript_0xbd9ae:
- landmarktotext ROUTE_38, $2
- setflag ENGINE_DANA
- farjump UnknownScript_0xa037e
-
-UnknownScript_0xbd9b8:
- farjump UnknownScript_0xa0592
-
-UnknownScript_0xbd9bc:
- setflag ENGINE_DANA_HAS_THUNDERSTONE
- landmarktotext ROUTE_38, $2
- farjump UnknownScript_0xa061e
-
-; Chad
-
-ChadPhoneScript1:
- trainertotext SCHOOLBOY, CHAD1, $0
- checkflag ENGINE_CHAD
- iftrue UnknownScript_0xbd9e9
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_CHAD_FRIDAY_MORNING
- iftrue UnknownScript_0xbd9e5
- checkcode VAR_WEEKDAY
- if_not_equal FRIDAY, UnknownScript_0xbd9e5
- checkmorn
- iftrue UnknownScript_0xbda20
-
-UnknownScript_0xbd9e5:
- farjump UnknownScript_0xa0980
-
-UnknownScript_0xbd9e9:
- landmarktotext ROUTE_38, $2
- farjump UnknownScript_0xa0a7d
-
-ChadPhoneScript2:
- trainertotext SCHOOLBOY, CHAD1, $0
- farscall PhoneScript_GreetPhone_Male
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbda31
- checkflag ENGINE_CHAD
- iftrue UnknownScript_0xbda14
- checkflag ENGINE_CHAD_FRIDAY_MORNING
- iftrue UnknownScript_0xbda14
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbda23
-
-UnknownScript_0xbda14:
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbda2d
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbda20:
- setflag ENGINE_CHAD_FRIDAY_MORNING
-
-UnknownScript_0xbda23:
- landmarktotext ROUTE_38, $2
- setflag ENGINE_CHAD
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbda2d:
- farjump UnknownScript_0xa0584
-
-UnknownScript_0xbda31:
- farjump UnknownScript_0xa0754
-
-DerekPhoneScript1:
- trainertotext POKEFANM, DEREK1, $0
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_DEREK_HAS_NUGGET
- iftrue UnknownScript_0xbda67
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbda5f
- checkflag ENGINE_DAILY_BUG_CONTEST
- iftrue UnknownScript_0xbda5f
- checkcode VAR_WEEKDAY
- if_equal TUESDAY, UnknownScript_0xbda63
- if_equal THURSDAY, UnknownScript_0xbda63
- if_equal SATURDAY, UnknownScript_0xbda63
-
-UnknownScript_0xbda5f:
- farjump UnknownScript_0xa0988
-
-UnknownScript_0xbda63:
- farjump UnknownScript_0xa05a4
-
-UnknownScript_0xbda67:
- landmarktotext ROUTE_39, $2
- farjump UnknownScript_0xa0ad5
-
-DerekPhoneScript2:
- trainertotext POKEFANM, DEREK1, $0
- farscall PhoneScript_GreetPhone_Male
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbda92
- checkflag ENGINE_DAILY_BUG_CONTEST
- iftrue UnknownScript_0xbda92
- checkcode VAR_WEEKDAY
- if_equal TUESDAY, UnknownScript_0xbda9e
- if_equal THURSDAY, UnknownScript_0xbda9e
- if_equal SATURDAY, UnknownScript_0xbda9e
-
-UnknownScript_0xbda92:
- farscall PhoneScript_Random4
- if_equal $0, UnknownScript_0xbdaa2
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbda9e:
- farjump UnknownScript_0xa05a4
-
-UnknownScript_0xbdaa2:
- setflag ENGINE_DEREK_HAS_NUGGET
- landmarktotext ROUTE_39, $2
- farjump UnknownScript_0xa05e6
-
-TullyPhoneScript1:
- trainertotext FISHER, TULLY1, $0
- checkflag ENGINE_TULLY
- iftrue UnknownScript_0xbdad5
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_TULLY_SUNDAY_NIGHT
- iftrue UnknownScript_0xbdad1
- checkflag ENGINE_TULLY_HAS_WATER_STONE
- iftrue UnknownScript_0xbdadc
- checkcode VAR_WEEKDAY
- if_not_equal SUNDAY, UnknownScript_0xbdad1
- checknite
- iftrue UnknownScript_0xbdb1f
-
-UnknownScript_0xbdad1:
- farjump UnknownScript_0xa0990
-
-UnknownScript_0xbdad5:
- landmarktotext ROUTE_42, $2
- farjump UnknownScript_0xa0a82
-
-UnknownScript_0xbdadc:
- landmarktotext ROUTE_42, $2
- farjump UnknownScript_0xa0add
-
-TullyPhoneScript2:
- trainertotext FISHER, TULLY1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_TULLY
- iftrue UnknownScript_0xbdb1b
- checkflag ENGINE_TULLY_SUNDAY_NIGHT
- iftrue UnknownScript_0xbdb1b
- checkflag ENGINE_TULLY_HAS_WATER_STONE
- iftrue UnknownScript_0xbdb1b
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbdb22
- checkevent EVENT_TULLY_GAVE_WATER_STONE
- iftrue UnknownScript_0xbdb13
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbdb2c
-
-UnknownScript_0xbdb13:
- farscall PhoneScript_Random11
- if_equal $0, UnknownScript_0xbdb2c
-
-UnknownScript_0xbdb1b:
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbdb1f:
- setflag ENGINE_TULLY_SUNDAY_NIGHT
-
-UnknownScript_0xbdb22:
- landmarktotext ROUTE_42, $2
- setflag ENGINE_TULLY
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbdb2c:
- setflag ENGINE_TULLY_HAS_WATER_STONE
- landmarktotext ROUTE_42, $2
- farjump UnknownScript_0xa05e6
-
-BrentPhoneScript1:
- trainertotext POKEMANIAC, BRENT1, $0
- checkflag ENGINE_BRENT
- iftrue UnknownScript_0xbdb59
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_BRENT_MONDAY_MORNING
- iftrue UnknownScript_0xbdb55
- checkcode VAR_WEEKDAY
- if_not_equal MONDAY, UnknownScript_0xbdb55
- checkmorn
- iftrue UnknownScript_0xbdb88
-
-UnknownScript_0xbdb55:
- farjump UnknownScript_0xa0998
-
-UnknownScript_0xbdb59:
- landmarktotext ROUTE_43, $2
- farjump UnknownScript_0xa0a87
-
-BrentPhoneScript2:
- trainertotext POKEMANIAC, BRENT1, $0
- farscall PhoneScript_GreetPhone_Male
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbdb95
- checkflag ENGINE_BRENT
- iftrue UnknownScript_0xbdb84
- checkflag ENGINE_BRENT_MONDAY_MORNING
- iftrue UnknownScript_0xbdb84
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbdb8b
-
-UnknownScript_0xbdb84:
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbdb88:
- setflag ENGINE_BRENT_MONDAY_MORNING
-
-UnknownScript_0xbdb8b:
- landmarktotext ROUTE_43, $2
- setflag ENGINE_BRENT
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbdb95:
- farjump UnknownScript_0xa07ce
-
-TiffanyPhoneScript1:
- trainertotext PICNICKER, TIFFANY3, $0
- checkflag ENGINE_TIFFANY
- iftrue UnknownScript_0xbdbc2
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_TIFFANY_TUESDAY_AFTERNOON
- iftrue UnknownScript_0xbdbbe
- checkflag ENGINE_TIFFANY_HAS_PINK_BOW
- iftrue UnknownScript_0xbdbc9
- checkcode VAR_WEEKDAY
- if_not_equal TUESDAY, UnknownScript_0xbdbbe
- checkday
- iftrue UnknownScript_0xbdc14
-
-UnknownScript_0xbdbbe:
- farjump UnknownScript_0xa09a0
-
-UnknownScript_0xbdbc2:
- landmarktotext ROUTE_43, $2
- farjump UnknownScript_0xa0a8c
-
-UnknownScript_0xbdbc9:
- landmarktotext ROUTE_43, $2
- farjump UnknownScript_0xa0ae5
-
-TiffanyPhoneScript2:
- trainertotext PICNICKER, TIFFANY3, $0
- farscall PhoneScript_Random4
- if_equal $0, UnknownScript_0xbdc21
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_TIFFANY
- iftrue UnknownScript_0xbdc10
- checkflag ENGINE_TIFFANY_TUESDAY_AFTERNOON
- iftrue UnknownScript_0xbdc10
- checkflag ENGINE_TIFFANY_HAS_PINK_BOW
- iftrue UnknownScript_0xbdc10
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbdc17
- checkevent EVENT_TIFFANY_GAVE_PINK_BOW
- iftrue UnknownScript_0xbdc08
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbdc69
-
-UnknownScript_0xbdc08:
- farscall PhoneScript_Random11
- if_equal $0, UnknownScript_0xbdc69
-
-UnknownScript_0xbdc10:
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbdc14:
- setflag ENGINE_TIFFANY_TUESDAY_AFTERNOON
-
-UnknownScript_0xbdc17:
- landmarktotext ROUTE_43, $2
- setflag ENGINE_TIFFANY
- farjump UnknownScript_0xa037e
-
-UnknownScript_0xbdc21:
- random $6
- if_equal $0, UnknownScript_0xbdc3b
- if_equal $1, UnknownScript_0xbdc42
- if_equal $2, UnknownScript_0xbdc49
- if_equal $3, UnknownScript_0xbdc50
- if_equal $4, UnknownScript_0xbdc57
- if_equal $5, UnknownScript_0xbdc5e
-
-UnknownScript_0xbdc3b:
- stringtotext String_be643, $1
- jump UnknownScript_0xbdc65
-
-UnknownScript_0xbdc42:
- stringtotext String_be64b, $1
- jump UnknownScript_0xbdc65
-
-UnknownScript_0xbdc49:
- stringtotext String_be653, $1
- jump UnknownScript_0xbdc65
-
-UnknownScript_0xbdc50:
- stringtotext String_be657, $1
- jump UnknownScript_0xbdc65
-
-UnknownScript_0xbdc57:
- stringtotext String_be65b, $1
- jump UnknownScript_0xbdc65
-
-UnknownScript_0xbdc5e:
- stringtotext String_be662, $1
- jump UnknownScript_0xbdc65
-
-UnknownScript_0xbdc65:
- farjump UnknownScript_0xa047f
-
-UnknownScript_0xbdc69:
- setflag ENGINE_TIFFANY_HAS_PINK_BOW
- landmarktotext ROUTE_43, $2
- farjump UnknownScript_0xa061e
-
-; Vance
-
-VancePhoneScript1:
- trainertotext BIRD_KEEPER, VANCE1, $0
- checkflag ENGINE_VANCE
- iftrue UnknownScript_0xbdc96
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_VANCE_WEDNESDAY_NIGHT
- iftrue UnknownScript_0xbdc92
- checkcode VAR_WEEKDAY
- if_not_equal WEDNESDAY, UnknownScript_0xbdc92
- checknite
- iftrue UnknownScript_0xbdcc1
-
-UnknownScript_0xbdc92:
- farjump UnknownScript_0xa09a8
-
-UnknownScript_0xbdc96:
- landmarktotext ROUTE_44, $2
- farjump UnknownScript_0xa0a91
-
-VancePhoneScript2:
- trainertotext BIRD_KEEPER, VANCE1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_VANCE
- iftrue UnknownScript_0xbdcbd
- checkflag ENGINE_VANCE_WEDNESDAY_NIGHT
- iftrue UnknownScript_0xbdcbd
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbdcc4
- if_equal $1, UnknownScript_0xbdcc4
-
-UnknownScript_0xbdcbd:
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbdcc1:
- setflag ENGINE_VANCE_WEDNESDAY_NIGHT
-
-UnknownScript_0xbdcc4:
- landmarktotext ROUTE_44, $2
- setflag ENGINE_VANCE
- farjump UnknownScript_0xa0376
-
-WiltonPhoneScript1:
- trainertotext FISHER, WILTON1, $0
- checkflag ENGINE_WILTON
- iftrue UnknownScript_0xbdcf7
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_WILTON_THRUSDAY_MORNING
- iftrue UnknownScript_0xbdcf3
- checkflag ENGINE_WILTON_HAS_ITEM
- iftrue UnknownScript_0xbdcfe
- checkcode VAR_WEEKDAY
- if_not_equal THURSDAY, UnknownScript_0xbdcf3
- checkmorn
- iftrue UnknownScript_0xbdd33
-
-UnknownScript_0xbdcf3:
- farjump UnknownScript_0xa09b0
-
-UnknownScript_0xbdcf7:
- landmarktotext ROUTE_44, $2
- farjump UnknownScript_0xa0a96
-
-UnknownScript_0xbdcfe:
- landmarktotext ROUTE_44, $2
- farjump UnknownScript_0xa0aed
-
-WiltonPhoneScript2:
- trainertotext FISHER, WILTON1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_WILTON
- iftrue UnknownScript_0xbdd2f
- checkflag ENGINE_WILTON_THRUSDAY_MORNING
- iftrue UnknownScript_0xbdd2f
- checkflag ENGINE_WILTON_HAS_ITEM
- iftrue UnknownScript_0xbdd2f
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbdd36
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbdd40
-
-UnknownScript_0xbdd2f:
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbdd33:
- setflag ENGINE_WILTON_THRUSDAY_MORNING
-
-UnknownScript_0xbdd36:
- landmarktotext ROUTE_44, $2
- setflag ENGINE_WILTON
- farjump UnknownScript_0xa0376
-
-UnknownScript_0xbdd40:
- setflag ENGINE_WILTON_HAS_ITEM
- landmarktotext ROUTE_44, $2
- clearevent EVENT_WILTON_HAS_ULTRA_BALL
- clearevent EVENT_WILTON_HAS_GREAT_BALL
- clearevent EVENT_WILTON_HAS_POKE_BALL
- random $5
- if_equal $0, UnknownScript_0xbdd5e
- random $3
- if_equal $0, UnknownScript_0xbdd64
- jump UnknownScript_0xbdd6a
-
-UnknownScript_0xbdd5e:
- setevent EVENT_WILTON_HAS_ULTRA_BALL
- jump UnknownScript_0xbdd6d
-
-UnknownScript_0xbdd64:
- setevent EVENT_WILTON_HAS_GREAT_BALL
- jump UnknownScript_0xbdd6d
-
-UnknownScript_0xbdd6a:
- setevent EVENT_WILTON_HAS_POKE_BALL
-
-UnknownScript_0xbdd6d:
- farjump UnknownScript_0xa05e6
-
-; Kenji
-
-KenjiPhoneScript1:
- trainertotext BLACKBELT_T, KENJI3, $0
- farscall PhoneScript_AnswerPhone_Male
- farjump UnknownScript_0xa09ee
-
-KenjiPhoneScript2:
- trainertotext BLACKBELT_T, KENJI3, $0
- farscall PhoneScript_GreetPhone_Male
- farjump UnknownScript_0xa064c
-
-; Parry
-
-ParryPhoneScript1:
- trainertotext HIKER, PARRY1, $0
- checkflag ENGINE_PARRY
- iftrue UnknownScript_0xbddac
- farscall PhoneScript_AnswerPhone_Male
- checkflag ENGINE_PARRY_FRIDAY_AFTERNOON
- iftrue UnknownScript_0xbdda8
- checkcode VAR_WEEKDAY
- if_not_equal FRIDAY, UnknownScript_0xbdda8
- checkday
- iftrue UnknownScript_0xbddd7
-
-UnknownScript_0xbdda8:
- farjump UnknownScript_0xa09b8
-
-UnknownScript_0xbddac:
- landmarktotext ROUTE_45, $2
- farjump UnknownScript_0xa0a9b
-
-ParryPhoneScript2:
- trainertotext HIKER, PARRY1, $0
- farscall PhoneScript_GreetPhone_Male
- checkflag ENGINE_PARRY
- iftrue UnknownScript_0xbddd3
- checkflag ENGINE_PARRY_FRIDAY_AFTERNOON
- iftrue UnknownScript_0xbddd3
- farscall PhoneScript_Random2
- if_equal $0, UnknownScript_0xbddda
- if_equal $1, UnknownScript_0xbddda
-
-UnknownScript_0xbddd3:
- farjump UnknownScript_0xa0000
-
-UnknownScript_0xbddd7:
- setflag ENGINE_PARRY_FRIDAY_AFTERNOON
-
-UnknownScript_0xbddda:
- landmarktotext ROUTE_45, $2
- setflag ENGINE_PARRY
- farjump UnknownScript_0xa0376
-
-; Erin
-
-ErinPhoneScript1:
- trainertotext PICNICKER, ERIN1, $0
- checkflag ENGINE_ERIN
- iftrue UnknownScript_0xbde07
- farscall PhoneScript_AnswerPhone_Female
- checkflag ENGINE_ERIN_SATURDAY_NIGHT
- iftrue UnknownScript_0xbde03
- checkcode VAR_WEEKDAY
- if_not_equal SATURDAY, UnknownScript_0xbde03
- checknite
- iftrue UnknownScript_0xbde32
-
-UnknownScript_0xbde03:
- farjump UnknownScript_0xa09c0
-
-UnknownScript_0xbde07:
- landmarktotext ROUTE_46, $2
- farjump UnknownScript_0xa0aa0
-
-ErinPhoneScript2:
- trainertotext PICNICKER, ERIN1, $0
- farscall PhoneScript_GreetPhone_Female
- checkflag ENGINE_ERIN
- iftrue UnknownScript_0xbde2e
- checkflag ENGINE_ERIN_SATURDAY_NIGHT
- iftrue UnknownScript_0xbde2e
- farscall PhoneScript_Random3
- if_equal $0, UnknownScript_0xbde35
- if_equal $1, UnknownScript_0xbde35
-
-UnknownScript_0xbde2e:
- farjump UnknownScript_0xa0017
-
-UnknownScript_0xbde32:
- setflag ENGINE_ERIN_SATURDAY_NIGHT
-
-UnknownScript_0xbde35:
- landmarktotext ROUTE_46, $2
- setflag ENGINE_ERIN
- farjump UnknownScript_0xa037e
-
-PhoneScript_Random2:
- random 2
- end
-
-PhoneScript_Random3:
- random 3
- end
-
-PhoneScript_Random4:
- random 4
- end
-
-PhoneScript_Random5:
- random 5
- end
-
-PhoneScript_Random11:
- random 11
- end
-
-PhoneScript_AnswerPhone_Male:
- checkday
- iftrue PhoneScript_AnswerPhone_Male_Day
- checknite
- iftrue PhoneScript_AnswerPhone_Male_Nite
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_JUGGLER_IRWIN, .Irwin
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_BLACKBELT_KENJI, .Kenji
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1b4dc5
- buttonsound
- end
-
-.Huey:
- farwritetext UnknownText_0x1b5073
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x1b5270
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x1b55ae
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x1b589a
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1b5a3b
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x1b5c10
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x1b5f7a
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x1b60f5
- buttonsound
- end
-
-.Irwin:
- farwritetext UnknownText_0x1b638c
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x1b6454
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x1b659d
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x1b67e2
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x1b69a8
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x1b6b39
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x1b6c96
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x1b7019
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x1b71d5
- buttonsound
- end
-
-.Kenji:
- farwritetext UnknownText_0x1b730b
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x1b73c7
- buttonsound
- end
-
-PhoneScript_AnswerPhone_Male_Day:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_JUGGLER_IRWIN, .Irwin
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_BLACKBELT_KENJI, .Kenji
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1b4ded
- buttonsound
- end
-
-.Huey:
- farwritetext UnknownText_0x1b509b
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x1b52a5
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x1b55da
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x1b58c2
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1b5a74
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x1b5c63
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x1b5f9e
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x1b611b
- buttonsound
- end
-
-.Irwin:
- farwritetext UnknownText_0x1b63a8
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x1b647e
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x1b65c7
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x1b680e
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x1b69d2
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x1b6b65
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x1b6cc6
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x1b7057
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x1b71fc
- buttonsound
- end
-
-.Kenji:
- farwritetext UnknownText_0x1b7331
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x1b73ef
- buttonsound
- end
-
-PhoneScript_AnswerPhone_Male_Nite:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_JUGGLER_IRWIN, .Irwin
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_BLACKBELT_KENJI, .Kenji
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1b4e16
- buttonsound
- end
-
-.Huey:
- farwritetext UnknownText_0x1b50c2
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x1b52cc
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x1b55fc
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x1b58ea
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1b5a9f
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x1b5cb6
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x1b5fc9
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x1b6149
- buttonsound
- end
-
-.Irwin:
- farwritetext UnknownText_0x1b63c4
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x1b64a8
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x1b65e3
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x1b6836
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x1b69f8
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x1b6b92
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x1b6cf6
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x1b7092
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x1b722a
- buttonsound
- end
-
-.Kenji:
- farwritetext UnknownText_0x1b7357
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x1b7417
- buttonsound
- end
-
-PhoneScript_AnswerPhone_Female:
- checkday
- iftrue PhoneScript_AnswerPhone_Female_Day
- checknite
- iftrue PhoneScript_AnswerPhone_Female_Nite
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1b4f21
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x1b53f7
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1b5702
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x1b5d9f
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1b626a
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x1b66c8
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x1b6e7c
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x1b751a
- buttonsound
- end
-
-PhoneScript_AnswerPhone_Female_Day:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1b4f4d
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x1b5424
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1b572e
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x1b5dcc
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1b6296
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x1b66ec
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x1b6ea6
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x1b7548
- buttonsound
- end
-
-PhoneScript_AnswerPhone_Female_Nite:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1b4f75
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x1b5446
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1b575a
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x1b5df8
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1b62c5
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x1b6713
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x1b6ec9
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x1b756f
- buttonsound
- end
-
-PhoneScript_GreetPhone_Male:
- checkday
- iftrue PhoneScript_GreetPhone_Male_Day
- checknite
- iftrue PhoneScript_GreetPhone_Male_Nite
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_JUGGLER_IRWIN, .Irwin
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_BLACKBELT_KENJI, .Kenji
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1b4e3e
- buttonsound
- end
-
-.Huey:
- farwritetext UnknownText_0x1b50e9
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x1b5301
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x1b5628
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x1b5912
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1b5ad8
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x1b5d09
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x1b5ff6
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x1b616e
- buttonsound
- end
-
-.Irwin:
- farwritetext UnknownText_0x1b63e3
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x1b64d2
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x1b660d
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x1b6862
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x1b6a22
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x1b6bb9
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x1b6d26
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x1b70e7
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x1b725c
- buttonsound
- end
-
-.Kenji:
- farwritetext UnknownText_0x1b737f
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x1b743f
- buttonsound
- end
-
-PhoneScript_GreetPhone_Male_Day:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_JUGGLER_IRWIN, .Irwin
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_BLACKBELT_KENJI, .Kenji
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1b4e72
- buttonsound
- end
-
-.Huey:
- farwritetext UnknownText_0x1b511a
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x1b5335
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x1b564c
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x1b5948
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1b5b0b
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x1b5d21
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x1b6017
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x1b618f
- buttonsound
- end
-
-.Irwin:
- farwritetext UnknownText_0x1b6407
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x1b6506
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x1b6624
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x1b6890
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x1b6a56
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x1b6bef
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x1b6d57
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x1b7112
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x1b7283
- buttonsound
- end
-
-.Kenji:
- farwritetext UnknownText_0x1b7397
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x1b746f
- buttonsound
- end
-
-PhoneScript_GreetPhone_Male_Nite:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_SAILOR_HUEY, .Huey
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_JUGGLER_IRWIN, .Irwin
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_BLACKBELT_KENJI, .Kenji
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1b4e9e
- buttonsound
- end
-
-.Huey:
- farwritetext UnknownText_0x1b5154
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x1b535f
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x1b5670
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x1b597c
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1b5b37
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x1b5d39
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x1b6041
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x1b61bd
- buttonsound
- end
-
-.Irwin:
- farwritetext UnknownText_0x1b642c
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x1b6539
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x1b663b
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x1b68ba
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x1b6a8b
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x1b6c23
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x1b6d88
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x1b7132
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x1b72a5
- buttonsound
- end
-
-.Kenji:
- farwritetext UnknownText_0x1b73af
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x1b749b
- buttonsound
- end
-
-PhoneScript_GreetPhone_Female:
- checkday
- iftrue PhoneScript_GreetPhone_Female_Day
- checknite
- iftrue PhoneScript_GreetPhone_Female_Nite
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1b4fa1
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x1b5472
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1b5786
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x1b5e25
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1b62f1
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x1b6738
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x1b6ef3
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x1b758f
- buttonsound
- end
-
-PhoneScript_GreetPhone_Female_Day:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1b4fda
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x1b54a6
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1b57b7
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x1b5e59
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1b630e
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x1b6757
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x1b6f1c
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x1b75ac
- buttonsound
- end
-
-PhoneScript_GreetPhone_Female_Nite:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1b5004
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x1b54d4
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1b57e8
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x1b5e8e
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1b6331
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x1b6776
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x1b6f37
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x1b75c9
- buttonsound
- end
-
-PhoneScript_Generic_Male:
- checkcode VAR_CALLERID
- if_equal PHONE_SCHOOLBOY_JACK, .Jack
- if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven
- if_equal PHONE_BIRDKEEPER_JOSE, .Jose
- if_equal PHONE_YOUNGSTER_JOEY, .Joey
- if_equal PHONE_BUG_CATCHER_WADE, .Wade
- if_equal PHONE_FISHER_RALPH, .Ralph
- if_equal PHONE_HIKER_ANTHONY, .Anthony
- if_equal PHONE_CAMPER_TODD, .Todd
- if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie
- if_equal PHONE_SCHOOLBOY_ALAN, .Alan
- if_equal PHONE_SCHOOLBOY_CHAD, .Chad
- if_equal PHONE_POKEFANM_DEREK, .Derek
- if_equal PHONE_FISHER_TULLY, .Tully
- if_equal PHONE_POKEMANIAC_BRENT, .Brent
- if_equal PHONE_BIRDKEEPER_VANCE, .Vance
- if_equal PHONE_FISHER_WILTON, .Wilton
- if_equal PHONE_HIKER_PARRY, .Parry
-
-.Jack:
- farwritetext UnknownText_0x1b4ecd
- buttonsound
- end
-
-.Unknown:
- farwritetext UnknownText_0x1b518b
- buttonsound
- end
-
-.Gaven:
- farwritetext UnknownText_0x1b5393
- buttonsound
- end
-
-.Jose:
- farwritetext UnknownText_0x1b5694
- buttonsound
- end
-
-.Joey:
- farwritetext UnknownText_0x1b59b2
- buttonsound
- end
-
-.Wade:
- farwritetext UnknownText_0x1b5b68
- buttonsound
- end
-
-.Ralph:
- farwritetext UnknownText_0x1b5d51
- buttonsound
- end
-
-.Anthony:
- farwritetext UnknownText_0x1b606f
- buttonsound
- end
-
-.Todd:
- farwritetext UnknownText_0x1b61f2
- buttonsound
- end
-
-.Arnie:
- farwritetext UnknownText_0x1b656c
- buttonsound
- end
-
-.Alan:
- farwritetext UnknownText_0x1b6652
- buttonsound
- end
-
-.Chad:
- farwritetext UnknownText_0x1b68e8
- buttonsound
- end
-
-.Derek:
- farwritetext UnknownText_0x1b6ac2
- buttonsound
- end
-
-.Tully:
- farwritetext UnknownText_0x1b6c56
- buttonsound
- end
-
-.Brent:
- farwritetext UnknownText_0x1b6db9
- buttonsound
- end
-
-.Vance:
- farwritetext UnknownText_0x1b7161
- buttonsound
- end
-
-.Wilton:
- farwritetext UnknownText_0x1b72d0
- buttonsound
- end
-
-.Parry:
- farwritetext UnknownText_0x1b74c8
- buttonsound
- end
-
-PhoneScript_Generic_Female:
- checkcode VAR_CALLERID
- if_equal PHONE_POKEFAN_BEVERLY, .Beverly
- if_equal PHONE_COOLTRAINERF_BETH, .Beth
- if_equal PHONE_COOLTRAINERF_REENA, .Reena
- if_equal PHONE_PICNICKER_LIZ, .Liz
- if_equal PHONE_PICNICKER_GINA, .Gina
- if_equal PHONE_LASS_DANA, .Dana
- if_equal PHONE_PICNICKER_TIFFANY, .Tiffany
- if_equal PHONE_PICNICKER_ERIN, .Erin
-
-.Beverly:
- farwritetext UnknownText_0x1b502b
- buttonsound
- end
-
-.Beth:
- farwritetext UnknownText_0x1b5510
- buttonsound
- end
-
-.Reena:
- farwritetext UnknownText_0x1b5819
- buttonsound
- end
-
-.Liz:
- farwritetext UnknownText_0x1b5ebe
- buttonsound
- end
-
-.Gina:
- farwritetext UnknownText_0x1b6352
- buttonsound
- end
-
-.Dana:
- farwritetext UnknownText_0x1b6795
- buttonsound
- end
-
-.Tiffany:
- farwritetext UnknownText_0x1b6f60
- buttonsound
- end
-
-.Erin:
- farwritetext UnknownText_0x1b75e5
- buttonsound
- end
-
-PhoneScript_MonFlavorText:
- special RandomPhoneMon
- farscall PhoneScript_Random2
- if_equal $0, .TooEnergetic
- farwritetext UnknownText_0x1b518b
- buttonsound
- farjump PhoneScript_HangupText_Male
-
-.TooEnergetic:
- farjump .unnecessary
-
-.unnecessary
- farwritetext UnknownText_0x1b522b
- buttonsound
- farjump PhoneScript_HangupText_Male
-; be643
-
-
-String_be643: db "Grandma@"
-String_be64b: db "Grandpa@"
-String_be653: db "Mom@"
-String_be657: db "Dad@"
-String_be65b: db "Sister@"
-String_be662: db "Brother@"
-
diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm
new file mode 100644
index 000000000..1af444d73
--- /dev/null
+++ b/engine/player_gfx.asm
@@ -0,0 +1,263 @@
+Function88248: ; 88248
+; XXX
+ ld c, CAL
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .okay
+ ld c, KAREN
+
+.okay
+ ld a, c
+ ld [TrainerClass], a
+ ret
+
+MovePlayerPicRight: ; 88258
+ hlcoord 6, 4
+ ld de, 1
+ jr MovePlayerPic
+
+MovePlayerPicLeft: ; 88260
+ hlcoord 13, 4
+ ld de, -1
+ ; fallthrough
+
+MovePlayerPic: ; 88266
+; Move player pic at hl by de * 7 tiles.
+ ld c, $8
+.loop
+ push bc
+ push hl
+ push de
+ xor a
+ ld [hBGMapMode], a
+ lb bc, 7, 7
+ predef PlaceGraphic
+ xor a
+ ld [hBGMapThird], a
+ call WaitBGMap
+ call DelayFrame
+ pop de
+ pop hl
+ add hl, de
+ pop bc
+ dec c
+ ret z
+ push hl
+ push bc
+ ld a, l
+ sub e
+ ld l, a
+ ld a, h
+ sbc d
+ ld h, a
+ lb bc, 7, 7
+ call ClearBox
+ pop bc
+ pop hl
+ jr .loop
+
+ShowPlayerNamingChoices: ; 88297
+ ld hl, ChrisNameMenuHeader
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .GotGender
+ ld hl, KrisNameMenuHeader
+.GotGender:
+ call LoadMenuDataHeader
+ call VerticalMenu
+ ld a, [wMenuCursorY]
+ dec a
+ call CopyNameFromMenu
+ call CloseWindow
+ ret
+
+ChrisNameMenuHeader: ; 882b5
+ db $40 ; flags
+ db 00, 00 ; start coords
+ db 11, 10 ; end coords
+ dw .MaleNames
+ db 1 ; ????
+ db 0 ; default option
+
+.MaleNames: ; 882be
+ db $91 ; flags
+ db 5 ; items
+ db "NEW NAME@"
+MalePlayerNameArray: ; 882c9
+ db "CHRIS@"
+ db "MAT@"
+ db "ALLAN@"
+ db "JON@"
+ db 2 ; displacement
+ db " NAME @" ; title
+
+KrisNameMenuHeader: ; 882e5
+ db $40 ; flags
+ db 00, 00 ; start coords
+ db 11, 10 ; end coords
+ dw .FemaleNames
+ db 1 ; ????
+ db 0 ; default option
+
+.FemaleNames: ; 882ee
+ db $91 ; flags
+ db 5 ; items
+ db "NEW NAME@"
+FemalePlayerNameArray: ; 882f9
+ db "KRIS@"
+ db "AMANDA@"
+ db "JUANA@"
+ db "JODI@"
+ db 2 ; displacement
+ db " NAME @" ; title
+
+GetPlayerNameArray: ; 88318 This Function is never called
+ ld hl, PlayerName
+ ld de, MalePlayerNameArray
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .done
+ ld de, FemalePlayerNameArray
+
+.done
+ call InitName
+ ret
+
+GetPlayerIcon: ; 8832c
+; Get the player icon corresponding to gender
+
+; Male
+ ld de, ChrisSpriteGFX
+ ld b, BANK(ChrisSpriteGFX)
+
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .done
+
+; Female
+ ld de, KrisSpriteGFX
+ ld b, BANK(KrisSpriteGFX)
+
+.done
+ ret
+
+GetCardPic: ; 8833e
+ ld hl, ChrisCardPic
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .GotClass
+ ld hl, KrisCardPic
+.GotClass:
+ ld de, VTiles2 tile $00
+ ld bc, $23 tiles
+ ld a, BANK(ChrisCardPic) ; BANK(KrisCardPic)
+ call FarCopyBytes
+ ld hl, CardGFX
+ ld de, VTiles2 tile $23
+ ld bc, 6 tiles
+ ld a, BANK(CardGFX)
+ call FarCopyBytes
+ ret
+
+ChrisCardPic: ; 88365
+INCBIN "gfx/trainer_card/chris_card.2bpp"
+
+KrisCardPic: ; 88595
+INCBIN "gfx/trainer_card/kris_card.2bpp"
+
+CardGFX: ; 887c5
+INCBIN "gfx/trainer_card/trainer_card.2bpp"
+
+GetPlayerBackpic: ; 88825
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, GetChrisBackpic
+ call GetKrisBackpic
+ ret
+
+GetChrisBackpic: ; 88830
+ ld hl, ChrisBackpic
+ ld b, BANK(ChrisBackpic)
+ ld de, VTiles2 tile $31
+ ld c, 7 * 7
+ predef DecompressPredef
+ ret
+
+HOF_LoadTrainerFrontpic: ; 88840
+ call WaitBGMap
+ xor a
+ ld [hBGMapMode], a
+ ld e, 0
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .GotClass
+ ld e, 1
+
+.GotClass:
+ ld a, e
+ ld [TrainerClass], a
+ ld de, ChrisPic
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .GotPic
+ ld de, KrisPic
+
+.GotPic:
+ ld hl, VTiles2
+ ld b, BANK(ChrisPic) ; BANK(KrisPic)
+ ld c, 7 * 7
+ call Get2bpp
+ call WaitBGMap
+ ld a, $1
+ ld [hBGMapMode], a
+ ret
+
+DrawIntroPlayerPic: ; 88874
+; Draw the player pic at (6,4).
+
+; Get class
+ ld e, CHRIS
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .GotClass
+ ld e, KRIS
+.GotClass:
+ ld a, e
+ ld [TrainerClass], a
+
+; Load pic
+ ld de, ChrisPic
+ ld a, [PlayerGender]
+ bit 0, a
+ jr z, .GotPic
+ ld de, KrisPic
+.GotPic:
+ ld hl, VTiles2
+ ld b, BANK(ChrisPic) ; BANK(KrisPic)
+ ld c, 7 * 7 ; dimensions
+ call Get2bpp
+
+; Draw
+ xor a
+ ld [hGraphicStartTile], a
+ hlcoord 6, 4
+ lb bc, 7, 7
+ predef PlaceGraphic
+ ret
+
+ChrisPic: ; 888a9
+INCBIN "gfx/player/chris.2bpp"
+
+KrisPic: ; 88bb9
+INCBIN "gfx/player/kris.2bpp"
+
+GetKrisBackpic: ; 88ec9
+; Kris's backpic is uncompressed.
+ ld de, KrisBackpic
+ ld hl, VTiles2 tile $31
+ lb bc, BANK(KrisBackpic), 7 * 7 ; dimensions
+ call Get2bpp
+ ret
+
+KrisBackpic: ; 88ed6
+INCBIN "gfx/player/kris_back.2bpp"
diff --git a/engine/player_movement.asm b/engine/player_movement.asm
index 89593da5d..db0c07801 100755
--- a/engine/player_movement.asm
+++ b/engine/player_movement.asm
@@ -42,7 +42,7 @@ DoPlayerMovement:: ; 80000
jr z, .Surf
cp PLAYER_BIKE
jr z, .Normal
- cp PLAYER_SLIP
+ cp PLAYER_SKATE
jr z, .Ice
.Normal:
@@ -128,13 +128,13 @@ DoPlayerMovement:: ; 80000
.not_whirlpool
and $f0
- cp $30 ; moving water
+ cp HI_NYBBLE_CURRENT
jr z, .water
- cp $40 ; moving land 1
+ cp HI_NYBBLE_WALK
jr z, .land1
- cp $50 ; moving land 2
+ cp HI_NYBBLE_WALK_ALT
jr z, .land2
- cp $70 ; warps
+ cp HI_NYBBLE_WARPS
jr z, .warps
jr .no_walk
@@ -150,10 +150,10 @@ DoPlayerMovement:: ; 80000
jr .continue_walk
.water_table
- db RIGHT
- db LEFT
- db UP
- db DOWN
+ db RIGHT ; COLL_WATERFALL_RIGHT
+ db LEFT ; COLL_WATERFALL_LEFT
+ db UP ; COLL_WATERFALL_UP
+ db DOWN ; COLL_WATERFALL
.land1
ld a, c
@@ -169,14 +169,14 @@ DoPlayerMovement:: ; 80000
jr .continue_walk
.land1_table
- db STANDING
- db RIGHT
- db LEFT
- db UP
- db DOWN
- db STANDING
- db STANDING
- db STANDING
+ db STANDING ; COLL_BRAKE
+ db RIGHT ; COLL_WALK_RIGHT
+ db LEFT ; COLL_WALK_LEFT
+ db UP ; COLL_WALK_UP
+ db DOWN ; COLL_WALK_DOWN
+ db STANDING ; COLL_BRAKE_45
+ db STANDING ; COLL_BRAKE_46
+ db STANDING ; COLL_BRAKE_47
.land2
ld a, c
@@ -192,24 +192,24 @@ DoPlayerMovement:: ; 80000
jr .continue_walk
.land2_table
- db RIGHT
- db LEFT
- db UP
- db DOWN
- db STANDING
- db STANDING
- db STANDING
- db STANDING
+ db RIGHT ; COLL_WALK_RIGHT_ALT
+ db LEFT ; COLL_WALK_LEFT_ALT
+ db UP ; COLL_WALK_UP_ALT
+ db DOWN ; COLL_WALK_DOWN_ALT
+ db STANDING ; COLL_BRAKE_ALT
+ db STANDING ; COLL_BRAKE_55
+ db STANDING ; COLL_BRAKE_56
+ db STANDING ; COLL_BRAKE_57
.warps
ld a, c
- cp $71 ; door
+ cp COLL_DOOR
jr z, .down
- cp $79
+ cp COLL_DOOR_79
jr z, .down
- cp $7a ; stairs
+ cp COLL_STAIRCASE
jr z, .down
- cp $7b ; cave
+ cp COLL_CAVE
jr nz, .no_walk
.down
@@ -365,7 +365,7 @@ DoPlayerMovement:: ; 80000
ld a, [PlayerStandingTile]
ld e, a
and $f0
- cp $a0 ; ledge
+ cp HI_NYBBLE_LEDGES
jr nz, .DontJump
ld a, e
@@ -391,14 +391,14 @@ DoPlayerMovement:: ; 80000
ret
.data_8021e
- db FACE_RIGHT
- db FACE_LEFT
- db FACE_UP
- db FACE_DOWN
- db FACE_RIGHT | FACE_DOWN
- db FACE_DOWN | FACE_LEFT
- db FACE_UP | FACE_RIGHT
- db FACE_UP | FACE_LEFT
+ db FACE_RIGHT ; COLL_HOP_RIGHT
+ db FACE_LEFT ; COLL_HOP_LEFT
+ db FACE_UP ; COLL_HOP_UP
+ db FACE_DOWN ; COLL_HOP_DOWN
+ db FACE_RIGHT | FACE_DOWN ; COLL_HOP_DOWN_RIGHT
+ db FACE_DOWN | FACE_LEFT ; COLL_HOP_DOWN_LEFT
+ db FACE_UP | FACE_RIGHT ; COLL_HOP_UP_RIGHT
+ db FACE_UP | FACE_LEFT ; COLL_HOP_UP_LEFT
; 80226
.CheckWarp: ; 80226
@@ -409,6 +409,8 @@ DoPlayerMovement:: ; 80000
; making bumps silent.
ld a, [WalkingDirection]
+ ; cp STANDING
+ ; jr z, .not_warp
ld e, a
ld d, 0
ld hl, .EdgeWarps
@@ -420,6 +422,7 @@ DoPlayerMovement:: ; 80000
ld a, 1
ld [wd041], a
ld a, [WalkingDirection]
+ ; This is in the wrong place.
cp STANDING
jr z, .not_warp
@@ -443,7 +446,10 @@ DoPlayerMovement:: ; 80000
ret
.EdgeWarps:
- db $70, $78, $76, $7e
+ db COLL_WARP_CARPET_DOWN
+ db COLL_WARP_CARPET_UP
+ db COLL_WARP_CARPET_LEFT
+ db COLL_WARP_CARPET_RIGHT
; 8025f
.DoStep:
@@ -647,7 +653,7 @@ DoPlayerMovement:: ; 80000
ld e, a
; Find an object struct with coordinates equal to d,e
ld bc, ObjectStructs ; redundant
- callba IsNPCAtCoord
+ farcall IsNPCAtCoord
jr nc, .is_npc
call .CheckStrengthBoulder
jr c, .no_bump
@@ -747,11 +753,10 @@ DoPlayerMovement:: ; 80000
; 803ca
.BikeCheck: ; 803ca
-
ld a, [PlayerState]
cp PLAYER_BIKE
ret z
- cp PLAYER_SLIP
+ cp PLAYER_SKATE
ret
; 803d3
@@ -759,7 +764,7 @@ DoPlayerMovement:: ; 80000
; Return 0 if tile a is land. Otherwise, return carry.
call GetTileCollision
- and a ; land
+ and a ; LANDTILE?
ret z
scf
ret
@@ -774,7 +779,7 @@ DoPlayerMovement:: ; 80000
jr z, .Water
; Can walk back onto land from water.
- and a
+ and a ; LANDTILE?
jr z, .Land
jr .Neither
@@ -821,7 +826,7 @@ CheckStandingOnIce:: ; 80404
call CheckIceTile
jr nc, .yep
ld a, [PlayerState]
- cp PLAYER_SLIP
+ cp PLAYER_SKATE
jr nz, .not_ice
.yep
diff --git a/engine/player_object.asm b/engine/player_object.asm
index 6b38a6328..fe19d15b5 100755
--- a/engine/player_object.asm
+++ b/engine/player_object.asm
@@ -29,14 +29,14 @@ SpawnPlayer: ; 8029
call GetMapObject
ld hl, MAPOBJECT_COLOR
add hl, bc
- ln e, (1 << 3) | PAL_OW_RED, PERSONTYPE_SCRIPT
+ ln e, PAL_NPC_RED, OBJECTTYPE_SCRIPT
ld a, [wPlayerSpriteSetupFlags]
bit 2, a
jr nz, .ok
ld a, [PlayerGender]
bit 0, a
jr z, .ok
- ln e, (1 << 3) | PAL_OW_BLUE, PERSONTYPE_SCRIPT
+ ln e, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT
.ok
ld [hl], e
@@ -55,7 +55,7 @@ PlayerObjectTemplate: ; 8071
; A dummy map object used to initialize the player object.
; Shorter than the actual amount copied by two bytes.
; Said bytes seem to be unused.
- person_event SPRITE_CHRIS, -4, -4, SPRITEMOVEDATA_PLAYER, 15, 15, -1, -1, 0, PERSONTYPE_SCRIPT, 0, 0, -1
+ object_event SPRITE_CHRIS, -4, -4, SPRITEMOVEDATA_PLAYER, 15, 15, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, 0, -1
CopyDECoordsToMapObject:: ; 807e
push de
@@ -82,7 +82,7 @@ PlayerSpawn_ConvertCoords: ; 808f
call CopyDECoordsToMapObject
ret
-WritePersonXY:: ; 80a1
+WriteObjectXY:: ; 80a1
ld a, b
call CheckObjectVisibility
ret c
@@ -193,7 +193,7 @@ CopyMapObjectToObjectStruct: ; 8116
and $f0
jr z, .skip_color_override
swap a
- and $7 ; OAM_PALETTE
+ and PALETTE_MASK
ld [wTempObjectCopyPalette], a
.skip_color_override
@@ -616,7 +616,7 @@ FollowNotExact:: ; 839e
call CheckObjectVisibility
ret c
-; Person 2 is now in bc, person 1 is now in de
+; object 2 is now in bc, object 1 is now in de
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
diff --git a/engine/player_step.asm b/engine/player_step.asm
index 83158c1b7..bdd6d9907 100755
--- a/engine/player_step.asm
+++ b/engine/player_step.asm
@@ -77,7 +77,7 @@ HandlePlayerStep: ; d4e5 (3:54e5)
ret
.mobile ; d509 (3:5509)
- callba TrainerRankings_StepCount
+ farcall TrainerRankings_StepCount
ret
.fail2 ; d510 (3:5510)
diff --git a/engine/pokecenter_pc.asm b/engine/pokecenter_pc.asm
index f6b970ede..7045dc1c8 100755
--- a/engine/pokecenter_pc.asm
+++ b/engine/pokecenter_pc.asm
@@ -2,9 +2,9 @@ PokemonCenterPC: ; 1559a
call PC_CheckPartyForPokemon
ret c
call PC_PlayBootSound
- ld hl, PokeCenterPCText_BootedUpPC
+ ld hl, PokecenterPCText_BootedUpPC
call PC_DisplayText
- ld hl, PokeCenterPCText_AccessWhosePC
+ ld hl, PokecenterPCText_AccessWhosePC
call PC_DisplayTextWaitMenu
ld hl, .TopMenu
call LoadMenuDataHeader
@@ -103,16 +103,16 @@ PC_CheckPartyForPokemon: ; 15650
BillsPC: ; 15668
call PC_PlayChoosePCSound
- ld hl, PokeCenterPCText_AccessedBillsPC
+ ld hl, PokecenterPCText_AccessedBillsPC
call PC_DisplayText
- callba _BillsPC
+ farcall _BillsPC
and a
ret
; 15679 (5:5679)
PlayersPC: ; 15679
call PC_PlayChoosePCSound
- ld hl, PokeCenterPCText_AccessedOwnPC
+ ld hl, PokecenterPCText_AccessedOwnPC
call PC_DisplayText
ld b, $0
call _PlayersPC
@@ -122,9 +122,9 @@ PlayersPC: ; 15679
OaksPC: ; 15689
call PC_PlayChoosePCSound
- ld hl, PokeCenterPCText_AccessedOaksPC
+ ld hl, PokecenterPCText_AccessedOaksPC
call PC_DisplayText
- callba ProfOaksPC
+ farcall ProfOaksPC
and a
ret
; 1569a
@@ -132,14 +132,14 @@ OaksPC: ; 15689
HallOfFamePC: ; 1569a
call PC_PlayChoosePCSound
call FadeToMenu
- callba _HallOfFamePC
+ farcall _HallOfFamePC
call CloseSubmenu
and a
ret
; 156ab
TurnOffPC: ; 156ab
- ld hl, PokeCenterPCText_LinkClosed
+ ld hl, PokecenterPCText_LinkClosed
call PrintText
scf
ret
@@ -308,7 +308,7 @@ UnknownText_0x157cc: ; 0x157cc
KrisWithdrawItemMenu: ; 0x157d1
call LoadStandardMenuDataHeader
- callba ClearPCItemScreen
+ farcall ClearPCItemScreen
.loop
call PCItemsJoypad
jr c, .quit
@@ -322,7 +322,7 @@ KrisWithdrawItemMenu: ; 0x157d1
.Submenu:
; check if the item has a quantity
- callba _CheckTossableItem
+ farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
jr z, .askquantity
@@ -335,7 +335,7 @@ KrisWithdrawItemMenu: ; 0x157d1
.askquantity
ld hl, .HowManyText
call MenuTextBox
- callba SelectQuantityToToss
+ farcall SelectQuantityToToss
call ExitMenu
call ExitMenu
jr c, .done
@@ -384,12 +384,12 @@ KrisWithdrawItemMenu: ; 0x157d1
KrisTossItemMenu: ; 0x1585f
call LoadStandardMenuDataHeader
- callba ClearPCItemScreen
+ farcall ClearPCItemScreen
.loop
call PCItemsJoypad
jr c, .quit
ld de, PCItems
- callba TossItemFromPC
+ farcall TossItemFromPC
jr .loop
.quit
@@ -399,7 +399,7 @@ KrisTossItemMenu: ; 0x1585f
; 0x1587d
KrisDecorationMenu: ; 0x1587d
- callba _KrisDecorationMenu
+ farcall _KrisDecorationMenu
ld a, c
and a
ret z
@@ -418,14 +418,14 @@ KrisDepositItemMenu: ; 0x1588b
jr c, .nope
call DisableSpriteUpdates
call LoadStandardMenuDataHeader
- callba DepositSellInitPackBuffers
+ farcall DepositSellInitPackBuffers
.loop
- callba DepositSellPack
+ farcall DepositSellPack
ld a, [wcf66]
and a
jr z, .close
call .TryDepositItem
- callba CheckRegisteredItem
+ farcall CheckRegisteredItem
jr .loop
.close
@@ -436,7 +436,7 @@ KrisDepositItemMenu: ; 0x1588b
ret
.CheckItemsInBag:
- callba HasNoItems
+ farcall HasNoItems
ret nc
ld hl, .NoItemsInBag
call MenuTextBoxBackup
@@ -453,7 +453,7 @@ KrisDepositItemMenu: ; 0x1588b
push af
ld a, $0
ld [wSpriteUpdatesEnabled], a
- callba CheckItemMenu
+ farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .dw
rst JumpTable
@@ -486,7 +486,7 @@ KrisDepositItemMenu: ; 0x1588b
ret
.DepositItem_:
- callba _CheckTossableItem
+ farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
jr z, .AskQuantity
@@ -497,7 +497,7 @@ KrisDepositItemMenu: ; 0x1588b
.AskQuantity:
ld hl, .HowManyText
call MenuTextBox
- callba SelectQuantityToToss
+ farcall SelectQuantityToToss
push af
call ExitMenu
call ExitMenu
@@ -545,7 +545,7 @@ KrisDepositItemMenu: ; 0x1588b
db "@"
KrisMailBoxMenu: ; 0x1597d
- callba _KrisMailBoxMenu
+ farcall _KrisMailBoxMenu
xor a
ret
; 0x15985
@@ -605,12 +605,12 @@ PCItemsJoypad: ; 0x15985
.a_select_2
call PC_PlaySwapItemsSound
.select_1
- callba SwitchItemsInBag
+ farcall SwitchItemsInBag
.next
jp .loop
.a_1
- callba ScrollingMenu_ClearLeftColumn
+ farcall ScrollingMenu_ClearLeftColumn
call PlaceHollowCursor
and a
ret
@@ -641,37 +641,37 @@ PC_DisplayText: ; 15a20
ret
; 15a27
-PokeCenterPCText_BootedUpPC: ; 0x15a27
+PokecenterPCText_BootedUpPC: ; 0x15a27
; turned on the PC.
text_jump UnknownText_0x1c144d
db "@"
; 0x15a2c
-PokeCenterPCText_AccessWhosePC: ; 0x15a2c
+PokecenterPCText_AccessWhosePC: ; 0x15a2c
; Access whose PC?
text_jump UnknownText_0x1c1462
db "@"
; 0x15a31
-PokeCenterPCText_AccessedBillsPC: ; 0x15a31
+PokecenterPCText_AccessedBillsPC: ; 0x15a31
; BILL's PC accessed. #MON Storage System opened.
text_jump UnknownText_0x1c1474
db "@"
; 0x15a36
-PokeCenterPCText_AccessedOwnPC: ; 0x15a36
+PokecenterPCText_AccessedOwnPC: ; 0x15a36
; Accessed own PC. Item Storage System opened.
text_jump UnknownText_0x1c14a4
db "@"
; 0x15a3b
-PokeCenterPCText_AccessedOaksPC: ; 0x15a3b
+PokecenterPCText_AccessedOaksPC: ; 0x15a3b
; PROF.OAK's PC accessed. #DEX Rating System opened.
text_jump UnknownText_0x1c14d2
db "@"
; 0x15a40
-PokeCenterPCText_LinkClosed: ; 0x15a40
+PokecenterPCText_LinkClosed: ; 0x15a40
; … Link closed…
text_jump UnknownText_0x1c1505
db "@"
diff --git a/engine/pokedex.asm b/engine/pokedex.asm
index 569bdbb0b..12b5b2cd6 100644
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -98,7 +98,7 @@ InitPokedex: ; 40063
call Pokedex_OrderMonsByMode
call Pokedex_InitCursorPosition
call Pokedex_GetLandmark
- callba DrawDexEntryScreenRightEdge
+ farcall DrawDexEntryScreenRightEdge
call Pokedex_ResetBGMapMode
ret
@@ -117,7 +117,7 @@ Pokedex_CheckUnlockedUnownMode: ; 400a2
ret
Pokedex_InitCursorPosition: ; 400b4
- ld hl, wPokedexDataStart
+ ld hl, wPokedexOrder
ld a, [wLastDexEntry]
and a
jr z, .done
@@ -220,7 +220,7 @@ Pokedex_InitMainScreen: ; 4013c (10:413c)
hlcoord 0, 0, AttrMap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
call ByteFill
- callba DrawPokedexListWindow
+ farcall DrawPokedexListWindow
hlcoord 0, 17
ld de, String_START_SEARCH
call Pokedex_PlaceString
@@ -250,7 +250,7 @@ Pokedex_InitMainScreen: ; 4013c (10:413c)
ld a, SCGB_POKEDEX
call Pokedex_GetSGBLayout
call Pokedex_UpdateCursorOAM
- callba DrawPokedexListWindow
+ farcall DrawPokedexListWindow
hlcoord 0, 17
ld de, String_START_SEARCH
call Pokedex_PlaceString
@@ -333,7 +333,7 @@ Pokedex_InitDexEntryScreen: ; 40217 (10:4217)
call Pokedex_InitArrowCursor
call Pokedex_GetSelectedMon
ld [wLastDexEntry], a
- callba DisplayDexEntry
+ farcall DisplayDexEntry
call Pokedex_DrawFootprint
call WaitBGMap
ld a, $a7
@@ -387,7 +387,7 @@ Pokedex_Page: ; 40292
ld [wPokedexStatus], a
call Pokedex_GetSelectedMon
ld [wLastDexEntry], a
- callba DisplayDexEntry
+ farcall DisplayDexEntry
call WaitBGMap
ret
@@ -403,7 +403,7 @@ Pokedex_ReinitDexEntryScreen: ; 402aa (10:42aa)
call Pokedex_LoadCurrentFootprint
call Pokedex_GetSelectedMon
ld [wLastDexEntry], a
- callba DisplayDexEntry
+ farcall DisplayDexEntry
call Pokedex_DrawFootprint
call Pokedex_LoadSelectedMonTiles
call WaitBGMap
@@ -481,7 +481,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2
push af
ld a, [wJumptableIndex]
push af
- callba PrintDexEntry
+ farcall PrintDexEntry
pop af
ld [wJumptableIndex], a
pop af
@@ -502,7 +502,7 @@ DexEntryScreen_MenuActionJumptable: ; 402f2
Pokedex_RedisplayDexEntry: ; 4038d
call Pokedex_DrawDexEntryScreenBG
call Pokedex_GetSelectedMon
- callba DisplayDexEntry
+ farcall DisplayDexEntry
call Pokedex_DrawFootprint
ret
@@ -512,7 +512,7 @@ Pokedex_InitOptionScreen: ; 4039d (10:439d)
call ClearSprites
call Pokedex_DrawOptionScreenBG
call Pokedex_InitArrowCursor
- ld a, [wCurrentDexMode]
+ ld a, [wCurrentDexMode] ; Index of the topmost visible item in a scrolling menu ???
ld [wDexArrowCursorPosIndex], a
call Pokedex_DisplayModeDescription
call WaitBGMap
@@ -622,7 +622,7 @@ Pokedex_InitSearchScreen: ; 40443 (10:4443)
call Pokedex_PlaceSearchScreenTypeStrings
xor a
ld [wDexSearchSlowpokeFrame], a
- callba DoDexSearchSlowpokeFrame
+ farcall DoDexSearchSlowpokeFrame
call WaitBGMap
ld a, SCGB_POKEDEX_SEARCH_OPTION
call Pokedex_GetSGBLayout
@@ -675,7 +675,7 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471)
.MenuAction_BeginSearch: ; 404b7
call Pokedex_SearchForMons
- callba AnimateDexSearchSlowpoke
+ farcall AnimateDexSearchSlowpoke
ld a, [wDexSearchResultCount]
and a
jr nz, .show_search_results
@@ -722,7 +722,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a)
call ByteFill
call Pokedex_SetBGMapMode4
call Pokedex_ResetBGMapMode
- callba DrawPokedexSearchResultsWindow
+ farcall DrawPokedexSearchResultsWindow
call Pokedex_PlaceSearchResultsTypeStrings
ld a, 4
ld [wDexListingHeight], a
@@ -738,7 +738,7 @@ Pokedex_InitSearchResultsScreen: ; 4050a (10:450a)
ld [hWY], a
call WaitBGMap
call Pokedex_ResetBGMapMode
- callba DrawPokedexSearchResultsWindow
+ farcall DrawPokedexSearchResultsWindow
call Pokedex_PlaceSearchResultsTypeStrings
call Pokedex_UpdateSearchResultsCursorOAM
ld a, $ff
@@ -801,7 +801,7 @@ Pokedex_InitUnownMode: ; 405bd (10:45bd)
ld [wDexCurrentUnownIndex], a
call Pokedex_LoadUnownFrontpicTiles
call Pokedex_UnownModePlaceCursor
- callba PrintUnownWord
+ farcall PrintUnownWord
call WaitBGMap
ld a, SCGB_POKEDEX_UNOWN_MODE
call Pokedex_GetSGBLayout
@@ -823,7 +823,7 @@ Pokedex_UpdateUnownMode: ; 405df (10:45df)
call DelayFrame
call Pokedex_CheckSGB
jr nz, .decompress
- callba LoadSGBPokedexGFX2
+ farcall LoadSGBPokedexGFX2
jr .done
.decompress
@@ -873,7 +873,7 @@ Pokedex_UnownModeHandleDPadInput: ; 40610 (10:4610)
call Pokedex_UnownModeEraseCursor
call Pokedex_LoadUnownFrontpicTiles
call Pokedex_UnownModePlaceCursor
- callba PrintUnownWord
+ farcall PrintUnownWord
ld a, $1
ld [hBGMapMode], a
call DelayFrame
@@ -1479,11 +1479,11 @@ Pokedex_PrintListing: ; 40b0f (10:4b0f)
ld a, " "
call Pokedex_FillBox
-; Load de with wPokedexDataStart + [wDexListingScrollOffset]
+; Load de with wPokedexOrder + [wDexListingScrollOffset]
ld a, [wDexListingScrollOffset]
ld e, a
ld d, $0
- ld hl, wPokedexDataStart
+ ld hl, wPokedexOrder
add hl, de
ld e, l
ld d, h
@@ -1583,7 +1583,7 @@ Pokedex_GetSelectedMon: ; 40bb1
add [hl]
ld e, a
ld d, $0
- ld hl, wPokedexDataStart
+ ld hl, wPokedexOrder
add hl, de
ld a, [hl]
ld [wd265], a
@@ -1614,8 +1614,8 @@ Pokedex_CheckSeen: ; 40bd0
Pokedex_OrderMonsByMode: ; 40bdc
- ld hl, wPokedexDataStart
- ld bc, wPokedexMetadata - wPokedexDataStart
+ ld hl, wPokedexOrder
+ ld bc, wPokedexOrderEnd - wPokedexOrder
xor a
call ByteFill
ld a, [wCurrentDexMode]
@@ -1632,7 +1632,7 @@ Pokedex_OrderMonsByMode: ; 40bdc
.NewMode: ; 40bf6 (10:4bf6)
ld de, NewPokedexOrder
- ld hl, wPokedexDataStart
+ ld hl, wPokedexOrder
ld c, NUM_POKEMON
.loopnew
ld a, [de]
@@ -1644,7 +1644,7 @@ Pokedex_OrderMonsByMode: ; 40bdc
ret
.OldMode: ; 40c08 (10:4c08)
- ld hl, wPokedexDataStart
+ ld hl, wPokedexOrder
ld a, $1
ld c, NUM_POKEMON
.loopold
@@ -1656,7 +1656,7 @@ Pokedex_OrderMonsByMode: ; 40bdc
ret
.FindLastSeen: ; 40c18 (10:4c18)
- ld hl, wPokedexDataStart + NUM_POKEMON - 1
+ ld hl, wPokedexOrder + NUM_POKEMON - 1
ld d, NUM_POKEMON
ld e, d
.loopfindend
@@ -1675,7 +1675,7 @@ Pokedex_OrderMonsByMode: ; 40bdc
Pokedex_ABCMode: ; 40c30
xor a
ld [wDexListingEnd], a
- ld hl, wPokedexDataStart
+ ld hl, wPokedexOrder
ld de, AlphabeticalPokedexOrder
ld c, NUM_POKEMON
.loop1abc
@@ -1708,11 +1708,11 @@ Pokedex_ABCMode: ; 40c30
.doneabc
ret
-AlphabeticalPokedexOrder: ; 0x40c65
-INCLUDE "data/pokedex/order_alpha.asm"
-NewPokedexOrder: ; 0x40d60
-INCLUDE "data/pokedex/order_new.asm"
+INCLUDE "data/pokemon/dex_order_alpha.asm"
+
+INCLUDE "data/pokemon/dex_order_new.asm"
+
Pokedex_DisplayModeDescription: ; 40e5b
xor a
@@ -1915,8 +1915,8 @@ Pokedex_SearchForMons: ; 41086
add hl, de
ld a, [hl]
ld [wDexConvertedMonType], a
- ld hl, wPokedexDataStart
- ld de, wPokedexDataStart
+ ld hl, wPokedexOrder
+ ld de, wPokedexOrder
ld c, NUM_POKEMON
xor a
ld [wDexSearchResultCount], a
@@ -2403,13 +2403,13 @@ Pokedex_LoadSelectedMonTiles: ; 4143b
ld [CurPartySpecies], a
call GetBaseData
ld de, VTiles2
- predef GetFrontpic
+ predef GetMonFrontpic
ret
.QuestionMark:
ld a, BANK(sScratch)
call GetSRAMBank
- callba LoadQuestionMarkPic
+ farcall LoadQuestionMarkPic
ld hl, VTiles2
ld de, sScratch
ld c, 7 * 7
@@ -2477,7 +2477,7 @@ Pokedex_LoadGFX: ; 414b7
call Pokedex_InvertTiles
call Pokedex_CheckSGB
jr nz, .LoadPokedexLZ
- callba LoadSGBPokedexGFX
+ farcall LoadSGBPokedexGFX
jr .LoadPokedexSlowpokeLZ
.LoadPokedexLZ:
@@ -2556,7 +2556,7 @@ Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58)
ld [CurPartySpecies], a
call GetBaseData
ld de, VTiles2 tile $00
- predef GetFrontpic
+ predef GetMonFrontpic
pop af
ld [UnownLetter], a
ret
@@ -2564,7 +2564,7 @@ Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58)
_NewPokedexEntry: ; 41a7f
xor a
ld [hBGMapMode], a
- callba DrawDexEntryScreenRightEdge
+ farcall DrawDexEntryScreenRightEdge
call Pokedex_ResetBGMapMode
call DisableLCD
call LoadStandardFont
@@ -2581,12 +2581,12 @@ _NewPokedexEntry: ; 41a7f
ld bc, 19
ld a, " "
call ByteFill
- callba DisplayDexEntry
+ farcall DisplayDexEntry
call EnableLCD
call WaitBGMap
call GetBaseData
ld de, VTiles2
- predef GetFrontpic
+ predef GetMonFrontpic
ld a, SCGB_POKEDEX
call Pokedex_GetSGBLayout
ld a, [CurPartySpecies]
diff --git a/engine/pokedex_2.asm b/engine/pokedex_2.asm
new file mode 100644
index 000000000..83b366017
--- /dev/null
+++ b/engine/pokedex_2.asm
@@ -0,0 +1,286 @@
+AnimateDexSearchSlowpoke: ; 441cf
+ ld hl, .FrameIDs
+ ld b, 25
+.loop
+ ld a, [hli]
+
+ ; Wrap around
+ cp $fe
+ jr nz, .ok
+ ld hl, .FrameIDs
+ ld a, [hli]
+.ok
+
+ ld [wDexSearchSlowpokeFrame], a
+ ld a, [hli]
+ ld c, a
+ push bc
+ push hl
+ call DoDexSearchSlowpokeFrame
+ pop hl
+ pop bc
+ call DelayFrames
+ dec b
+ jr nz, .loop
+ xor a
+ ld [wDexSearchSlowpokeFrame], a
+ call DoDexSearchSlowpokeFrame
+ ld c, 32
+ call DelayFrames
+ ret
+
+.FrameIDs: ; 441fc
+ ; frame ID, duration
+ db 0, 7
+ db 1, 7
+ db 2, 7
+ db 3, 7
+ db 4, 7
+ db -2
+
+DoDexSearchSlowpokeFrame: ; 44207
+ ld a, [wDexSearchSlowpokeFrame]
+ ld hl, .SpriteData
+ ld de, Sprites
+.loop
+ ld a, [hli]
+ cp -1
+ ret z
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [wDexSearchSlowpokeFrame]
+ ld b, a
+ add a
+ add b
+ add [hl]
+ inc hl
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ jr .loop
+
+.SpriteData: ; 44228
+ dsprite 11, 0, 9, 0, $00, $00
+ dsprite 11, 0, 10, 0, $01, $00
+ dsprite 11, 0, 11, 0, $02, $00
+ dsprite 12, 0, 9, 0, $10, $00
+ dsprite 12, 0, 10, 0, $11, $00
+ dsprite 12, 0, 11, 0, $12, $00
+ dsprite 13, 0, 9, 0, $20, $00
+ dsprite 13, 0, 10, 0, $21, $00
+ dsprite 13, 0, 11, 0, $22, $00
+ db -1
+
+DisplayDexEntry: ; 4424d
+ call GetPokemonName
+ hlcoord 9, 3
+ call PlaceString ; mon species
+ ld a, [wd265]
+ ld b, a
+ call GetDexEntryPointer
+ ld a, b
+ push af
+ hlcoord 9, 5
+ call FarString ; dex species
+ ld h, b
+ ld l, c
+ push de
+; Print dex number
+ hlcoord 2, 8
+ ld a, $5c ; No
+ ld [hli], a
+ ld a, $5d ; .
+ ld [hli], a
+ ld de, wd265
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 3
+ call PrintNum
+; Check to see if we caught it. Get out of here if we haven't.
+ ld a, [wd265]
+ dec a
+ call CheckCaughtMon
+ pop hl
+ pop bc
+ ret z
+; Get the height of the Pokemon.
+ ld a, [CurPartySpecies]
+ ld [CurSpecies], a
+ inc hl
+ ld a, b
+ push af
+ push hl
+ call GetFarHalfword
+ ld d, l
+ ld e, h
+ pop hl
+ inc hl
+ inc hl
+ ld a, d
+ or e
+ jr z, .skip_height
+ push hl
+ push de
+ ld hl, sp+$0
+ ld d, h
+ ld e, l
+ hlcoord 12, 7
+ lb bc, 2, PRINTNUM_MONEY | 4
+ call PrintNum
+ hlcoord 14, 7
+ ld [hl], $5e ; ft symbol
+ pop af
+ pop hl
+
+.skip_height
+ pop af
+ push af
+ inc hl
+ push hl
+ dec hl
+ call GetFarHalfword
+ ld d, l
+ ld e, h
+ ld a, e
+ or d
+ jr z, .skip_weight
+ push de
+ ld hl, sp+$0
+ ld d, h
+ ld e, l
+ hlcoord 11, 9
+ lb bc, 2, PRINTNUM_RIGHTALIGN | 5
+ call PrintNum
+ pop de
+
+.skip_weight
+; Page 1
+ lb bc, 5, SCREEN_WIDTH - 2
+ hlcoord 2, 11
+ call ClearBox
+ hlcoord 1, 10
+ ld bc, SCREEN_WIDTH - 1
+ ld a, $61 ; horizontal divider
+ call ByteFill
+ ; page number
+ hlcoord 1, 9
+ ld [hl], $55
+ inc hl
+ ld [hl], $55
+ hlcoord 1, 10
+ ld [hl], $56 ; P.
+ inc hl
+ ld [hl], $57 ; 1
+ pop de
+ inc de
+ pop af
+ hlcoord 2, 11
+ push af
+ call FarString
+ pop bc
+ ld a, [wPokedexStatus]
+ or a
+ ret z
+
+; Page 2
+ push bc
+ push de
+ lb bc, 5, SCREEN_WIDTH - 2
+ hlcoord 2, 11
+ call ClearBox
+ hlcoord 1, 10
+ ld bc, SCREEN_WIDTH - 1
+ ld a, $61
+ call ByteFill
+ ; page number
+ hlcoord 1, 9
+ ld [hl], $55
+ inc hl
+ ld [hl], $55
+ hlcoord 1, 10
+ ld [hl], $56 ; P.
+ inc hl
+ ld [hl], $58 ; 2
+ pop de
+ inc de
+ pop af
+ hlcoord 2, 11
+ call FarString
+ ret
+
+String_44331: ; 44331
+ db "#@"
+
+GetDexEntryPointer: ; 44333
+; return dex entry pointer b:de
+ push hl
+ ld hl, PokedexDataPointerTable
+ ld a, b
+ dec a
+ ld d, 0
+ ld e, a
+ add hl, de
+ add hl, de
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ push de
+ rlca
+ rlca
+ and $3
+ ld hl, .PokedexEntryBanks
+ ld d, 0
+ ld e, a
+ add hl, de
+ ld b, [hl]
+ pop de
+ pop hl
+ ret
+
+.PokedexEntryBanks: ; 44351
+
+GLOBAL PokedexEntries1
+GLOBAL PokedexEntries2
+GLOBAL PokedexEntries3
+GLOBAL PokedexEntries4
+
+ db BANK(PokedexEntries1)
+ db BANK(PokedexEntries2)
+ db BANK(PokedexEntries3)
+ db BANK(PokedexEntries4)
+
+GetDexEntryPagePointer: ; 44355
+ call GetDexEntryPointer ; b:de
+ push hl
+ ld h, d
+ ld l, e
+; skip species name
+.loop1
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop1
+; skip height and weight
+rept 4
+ inc hl
+endr
+; if c != 1: skip entry
+ dec c
+ jr z, .done
+; skip entry
+.loop2
+ ld a, b
+ call GetFarByte
+ inc hl
+ cp "@"
+ jr nz, .loop2
+
+.done
+ ld d, h
+ ld e, l
+ pop hl
+ ret
diff --git a/engine/pokedex_3.asm b/engine/pokedex_3.asm
new file mode 100644
index 000000000..3414252c1
--- /dev/null
+++ b/engine/pokedex_3.asm
@@ -0,0 +1,162 @@
+LoadSGBPokedexGFX: ; 1ddf1c
+ ld hl, SGBPokedexGFX_LZ
+ ld de, VTiles2 tile $31
+ call Decompress
+ ret
+
+LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26)
+ ld hl, SGBPokedexGFX_LZ
+ ld de, VTiles2 tile $31
+ lb bc, BANK(SGBPokedexGFX_LZ), $3a
+ call DecompressRequest2bpp
+ ret
+
+SGBPokedexGFX_LZ: ; 1ddf33
+INCBIN "gfx/pokedex/sgb.2bpp.lz"
+
+LoadQuestionMarkPic: ; 1de0d7
+ ld hl, .QuestionMarkLZ
+ ld de, sScratch
+ call Decompress
+ ret
+
+.QuestionMarkLZ: ; 1de0e1
+INCBIN "gfx/pics/questionmark/front.2bpp.lz"
+
+DrawPokedexListWindow: ; 1de171 (77:6171)
+ ld a, $32
+ hlcoord 0, 17
+ ld bc, 12
+ call ByteFill
+ hlcoord 0, 1
+ lb bc, 15, 11
+ call ClearBox
+ ld a, $34
+ hlcoord 0, 0
+ ld bc, 11
+ call ByteFill
+ ld a, $39
+ hlcoord 0, 16
+ ld bc, 11
+ call ByteFill
+ hlcoord 5, 0
+ ld [hl], $3f
+ hlcoord 5, 16
+ ld [hl], $40
+ ld a, [wCurrentDexMode]
+ cp DEXMODE_OLD
+ jr z, .OldMode
+; scroll bar
+ hlcoord 11, 0
+ ld [hl], $50
+ ld a, $51
+ hlcoord 11, 1
+ ld b, SCREEN_HEIGHT - 3
+ call Bank77_FillColumn
+ ld [hl], $52
+ jr .Done
+
+.OldMode:
+; no scroll bar
+ hlcoord 11, 0
+ ld [hl], $66
+ ld a, $67
+ hlcoord 11, 1
+ ld b, SCREEN_HEIGHT - 3
+ call Bank77_FillColumn
+ ld [hl], $68
+.Done:
+ ret
+
+DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1)
+ ld a, $34
+ hlcoord 0, 0
+ ld bc, 11
+ call ByteFill
+ ld a, $39
+ hlcoord 0, 10
+ ld bc, 11
+ call ByteFill
+ hlcoord 5, 0
+ ld [hl], $3f
+ hlcoord 5, 10
+ ld [hl], $40
+ hlcoord 11, 0
+ ld [hl], $66
+ ld a, $67
+ hlcoord 11, 1
+ ld b, SCREEN_HEIGHT / 2
+ call Bank77_FillColumn
+ ld [hl], $68
+ ld a, $34
+ hlcoord 0, 11
+ ld bc, 11
+ call ByteFill
+ ld a, $39
+ hlcoord 0, 17
+ ld bc, 11
+ call ByteFill
+ hlcoord 11, 11
+ ld [hl], $66
+ ld a, $67
+ hlcoord 11, 12
+ ld b, 5
+ call Bank77_FillColumn
+ ld [hl], $68
+ hlcoord 0, 12
+ lb bc, 5, 11
+ call ClearBox
+ ld de, .esults_D
+ hlcoord 0, 12
+ call PlaceString
+ ret
+
+.esults_D ; 1de23c
+; (SEARCH R)
+ db "ESULTS"
+ next ""
+; (### FOUN)
+ next "D!@"
+
+DrawDexEntryScreenRightEdge: ; 1de247
+ ld a, [hBGMapAddress]
+ ld l, a
+ ld a, [hBGMapAddress + 1]
+ ld h, a
+ push hl
+ inc hl
+ ld a, l
+ ld [hBGMapAddress], a
+ ld a, h
+ ld [hBGMapAddress + 1], a
+ hlcoord 19, 0
+ ld [hl], $66
+ hlcoord 19, 1
+ ld a, $67
+ ld b, 15
+ call Bank77_FillColumn
+ ld [hl], $68
+ hlcoord 19, 17
+ ld [hl], $3c
+ xor a
+ ld b, SCREEN_HEIGHT
+ hlcoord 19, 0, AttrMap
+ call Bank77_FillColumn
+ call WaitBGMap2
+ pop hl
+ ld a, l
+ ld [hBGMapAddress], a
+ ld a, h
+ ld [hBGMapAddress + 1], a
+ ret
+
+Bank77_FillColumn: ; 1de27f
+ push de
+ ld de, SCREEN_WIDTH
+.loop
+ ld [hl], a
+ add hl, de
+ dec b
+ jr nz, .loop
+ pop de
+ ret
diff --git a/engine/pokegear.asm b/engine/pokegear.asm
index 8e5697f75..2529e3b0e 100755
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -20,7 +20,7 @@ PokeGear: ; 90b8d (24:4b8d)
bit 7, a
jr nz, .done
call PokegearJumptable
- callba PlaySpriteAnimations
+ farcall PlaySpriteAnimations
call DelayFrame
jr .loop
@@ -55,7 +55,7 @@ PokeGear: ; 90b8d (24:4b8d)
ld a, $7
ld [hWX], a
call Pokegear_LoadGFX
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call InitPokegearModeIndicatorArrow
ld a, 8
call SkipMusic
@@ -106,7 +106,7 @@ Pokegear_LoadGFX: ; 90c4e
call GetWorldMapLocation
cp FAST_SHIP
jr z, .ssaqua
- callba GetPlayerIcon
+ farcall GetPlayerIcon
push de
ld h, d
ld l, e
@@ -136,12 +136,12 @@ Pokegear_LoadGFX: ; 90c4e
; 90cb2
FastShipGFX: ; 90cb2
-INCBIN "gfx/misc/fast_ship.2bpp"
+INCBIN "gfx/pokegear/fast_ship.2bpp"
; 90d32
InitPokegearModeIndicatorArrow: ; 90d32 (24:4d32)
depixel 4, 2, 4, 0
- ld a, SPRITE_ANIM_INDEX_0D
+ ld a, SPRITE_ANIM_INDEX_POKEGEAR_ARROW
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
@@ -239,7 +239,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8)
.return_from_jumptable
call Pokegear_FinishTilemap
- callba TownMapPals
+ farcall TownMapPals
ld a, [wcf65]
and a
jr nz, .kanto_0
@@ -319,7 +319,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8)
.kanto
ld e, 1
.ok
- callba PokegearMap
+ farcall PokegearMap
ld a, $7
ld bc, $12
hlcoord 1, 2
@@ -513,7 +513,7 @@ Pokegear_UpdateClock: ; 90f86 (24:4f86)
ld a, [hMinutes]
ld c, a
decoord 6, 8
- callba PrintHoursMins
+ farcall PrintHoursMins
ld hl, .DayText
bccoord 6, 6
call PlaceHLTextAtBC
@@ -670,7 +670,7 @@ PokegearMap_InitPlayerIcon: ; 9106a
pop af
ld e, a
push bc
- callba GetLandmarkCoords
+ farcall GetLandmarkCoords
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -685,7 +685,7 @@ PokegearMap_InitPlayerIcon: ; 9106a
PokegearMap_InitCursor: ; 91098
push af
depixel 0, 0
- ld a, SPRITE_ANIM_INDEX_0D
+ ld a, SPRITE_ANIM_INDEX_POKEGEAR_ARROW
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
@@ -709,9 +709,9 @@ PokegearMap_UpdateLandmarkName: ; 910b4
pop af
ld e, a
push de
- callba GetLandmarkName
+ farcall GetLandmarkName
pop de
- callba TownMap_ConvertLineBreakCharacters
+ farcall TownMap_ConvertLineBreakCharacters
hlcoord 8, 0
ld [hl], $34
ret
@@ -721,7 +721,7 @@ PokegearMap_UpdateLandmarkName: ; 910b4
PokegearMap_UpdateCursorPosition: ; 910d4
push bc
ld e, a
- callba GetLandmarkCoords
+ farcall GetLandmarkCoords
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -751,7 +751,7 @@ TownMap_GetKantoLandmarkLimits: ; 910e8
PokegearRadio_Init: ; 910f9 (24:50f9)
call InitPokegearTilemap
depixel 4, 10, 4, 4
- ld a, SPRITE_ANIM_INDEX_14
+ ld a, SPRITE_ANIM_INDEX_RADIO_TUNING_KNOB
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
@@ -929,7 +929,7 @@ PokegearPhone_MakePhoneCall: ; 911eb (24:51eb)
ret
.no_service
- callba Phone_NoSignal
+ farcall Phone_NoSignal
ld hl, .OutOfServiceArea
call PrintText
ld a, $8
@@ -958,7 +958,7 @@ PokegearPhone_FinishPhoneCall: ; 91256 (24:5256)
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON
ret z
- callba HangUp
+ farcall HangUp
ld a, $8
ld [wJumptableIndex], a
ld hl, PokegearText_WhomToCall
@@ -1121,7 +1121,7 @@ PokegearPhoneContactSubmenu: ; 91342 (24:5342)
ld d, 0
add hl, de
ld c, [hl]
- callba CheckCanDeletePhoneNumber
+ farcall CheckCanDeletePhoneNumber
ld a, c
and a
jr z, .cant_delete
@@ -1407,7 +1407,7 @@ PokegearText_DeleteStoredNumber: ; 0x914d8
; 0x914dd
PokegearSpritesGFX: ; 914dd
-INCBIN "gfx/misc/pokegear_sprites.2bpp.lz"
+INCBIN "gfx/pokegear/pokegear_sprites.2bpp.lz"
; 9150d
RadioTilemapRLE: ; 9150d
@@ -1619,8 +1619,8 @@ RadioChannels:
LoadStation_OaksPokemonTalk: ; 91753 (24:5753)
xor a ; OAKS_POKEMON_TALK
- ld [wd002], a
- ld [wd005], a
+ ld [wCurrentRadioLine], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1629,9 +1629,9 @@ LoadStation_OaksPokemonTalk: ; 91753 (24:5753)
LoadStation_PokedexShow: ; 91766 (24:5766)
ld a, POKEDEX_SHOW
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1640,9 +1640,9 @@ LoadStation_PokedexShow: ; 91766 (24:5766)
LoadStation_PokemonMusic: ; 9177b (24:577b)
ld a, POKEMON_MUSIC
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1651,9 +1651,9 @@ LoadStation_PokemonMusic: ; 9177b (24:577b)
LoadStation_LuckyChannel: ; 91790 (24:5790)
ld a, LUCKY_CHANNEL
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1662,9 +1662,9 @@ LoadStation_LuckyChannel: ; 91790 (24:5790)
LoadStation_BuenasPassword: ; 917a5 (24:57a5)
ld a, BUENAS_PASSWORD
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1682,20 +1682,20 @@ NotBuenasPasswordName: db "@"
LoadStation_UnownRadio: ; 917d5 (24:57d5)
ld a, UNOWN_RADIO
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
- ld de, UnknownStationName
+ ld de, UnownStationName
ret
LoadStation_PlacesAndPeople: ; 917ea (24:57ea)
ld a, PLACES_AND_PEOPLE
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1704,9 +1704,9 @@ LoadStation_PlacesAndPeople: ; 917ea (24:57ea)
LoadStation_LetsAllSing: ; 917ff (24:57ff)
ld a, LETS_ALL_SING
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1717,9 +1717,9 @@ LoadStation_LetsAllSing: ; 917ff (24:57ff)
LoadStation_RocketRadio: ; 91814
ld a, ROCKET_RADIO
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1730,9 +1730,9 @@ LoadStation_RocketRadio: ; 91814
LoadStation_PokeFluteRadio: ; 91829 (24:5829)
ld a, POKE_FLUTE_RADIO
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
@@ -1741,13 +1741,13 @@ LoadStation_PokeFluteRadio: ; 91829 (24:5829)
LoadStation_EvolutionRadio: ; 9183e (24:583e)
ld a, EVOLUTION_RADIO
- ld [wd002], a
+ ld [wCurrentRadioLine], a
xor a
- ld [wd005], a
+ ld [wNumRadioLinesPrinted], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Radio_BackUpFarCallParams
- ld de, UnknownStationName
+ ld de, UnownStationName
ret
; 91853 (24:5853)
@@ -1821,7 +1821,7 @@ OaksPkmnTalkName: db "OAK's <PK><MN> Talk@"
PokedexShowName: db "#DEX Show@"
PokemonMusicName: db "#MON Music@"
LuckyChannelName: db "Lucky Channel@"
-UnknownStationName: db "?????@"
+UnownStationName: db "?????@"
PlacesAndPeopleName: db "Places & People@"
LetsAllSingName: db "Let's All Sing!@"
@@ -1849,26 +1849,26 @@ _TownMap: ; 9191c
call ClearSprites
call DisableLCD
call Pokegear_LoadGFX
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
ld a, 8
call SkipMusic
ld a, $e3
ld [rLCDC], a
call TownMap_GetCurrentLandmark
- ld [wd002], a
- ld [wd003], a
+ ld [wTownMapPlayerIconLandmark], a
+ ld [wTownMapCursorLandmark], a
xor a
ld [hBGMapMode], a
call .InitTilemap
call WaitBGMap2
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
call PokegearMap_InitPlayerIcon
- ld a, [wd003]
+ ld a, [wTownMapCursorLandmark]
call PokegearMap_InitCursor
ld a, c
- ld [wd004], a
+ ld [wTownMapCursorObjectPointer], a
ld a, b
- ld [wd005], a
+ ld [wTownMapCursorObjectPointer + 1], a
ld b, SCGB_POKEGEAR_PALS
call GetSGBLayout
call SetPalettes
@@ -1880,7 +1880,7 @@ _TownMap: ; 9191c
call DelayFrame
.dmg
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
cp KANTO_LANDMARK
jr nc, .kanto
ld d, KANTO_LANDMARK - 1
@@ -1919,13 +1919,13 @@ _TownMap: ; 9191c
jr nz, .pressed_down
.loop2
push de
- callba PlaySpriteAnimations
+ farcall PlaySpriteAnimations
pop de
call DelayFrame
jr .loop
.pressed_up
- ld hl, wd003
+ ld hl, wTownMapCursorLandmark
ld a, [hl]
cp d
jr c, .okay
@@ -1938,7 +1938,7 @@ _TownMap: ; 9191c
jr .next
.pressed_down
- ld hl, wd003
+ ld hl, wTownMapCursorLandmark
ld a, [hl]
cp e
jr nz, .okay2
@@ -1951,20 +1951,20 @@ _TownMap: ; 9191c
.next
push de
- ld a, [wd003]
+ ld a, [wTownMapCursorLandmark]
call PokegearMap_UpdateLandmarkName
- ld a, [wd004]
+ ld a, [wTownMapCursorObjectPointer]
ld c, a
- ld a, [wd005]
+ ld a, [wTownMapCursorObjectPointer + 1]
ld b, a
- ld a, [wd003]
+ ld a, [wTownMapCursorLandmark]
call PokegearMap_UpdateCursorPosition
pop de
jr .loop2
; 91a04
.InitTilemap: ; 91a04
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
cp KANTO_LANDMARK
jr nc, .kanto2
ld e, $0
@@ -1973,7 +1973,7 @@ _TownMap: ; 9191c
.kanto2
ld e, $1
.okay_tilemap
- callba PokegearMap
+ farcall PokegearMap
ld a, $7
ld bc, 6
hlcoord 1, 0
@@ -1992,9 +1992,9 @@ _TownMap: ; 9191c
call ByteFill
hlcoord 19, 2
ld [hl], $17
- ld a, [wd003]
+ ld a, [wTownMapCursorLandmark]
call PokegearMap_UpdateLandmarkName
- callba TownMapPals
+ farcall TownMapPals
ret
; 91a53
@@ -2116,7 +2116,7 @@ _FlyMap: ; 91af3
ld [hl], $1
xor a
ld [hBGMapMode], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call LoadTownMapGFX
ld de, FlyMapLabelBorderGFX
ld hl, VTiles2 tile $30
@@ -2138,7 +2138,7 @@ _FlyMap: ; 91af3
jr nz, .pressedA
call FlyMapScroll
call GetMapCursorCoordinates
- callba PlaySpriteAnimations
+ farcall PlaySpriteAnimations
call DelayFrame
jr .loop
@@ -2147,7 +2147,7 @@ _FlyMap: ; 91af3
jr .exit
.pressedA
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
ld l, a
ld h, 0
add hl, hl
@@ -2155,7 +2155,7 @@ _FlyMap: ; 91af3
add hl, de
ld a, [hl]
.exit
- ld [wd002], a
+ ld [wTownMapPlayerIconLandmark], a
pop af
ld [hInMenu], a
call ClearBGPalettes
@@ -2165,7 +2165,7 @@ _FlyMap: ; 91af3
ld [hBGMapAddress], a
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
ld e, a
ret
@@ -2186,7 +2186,7 @@ FlyMapScroll: ; 91b73
ret
.ScrollNext:
- ld hl, wd002
+ ld hl, wTownMapPlayerIconLandmark
ld a, [hl]
cp d
jr nz, .NotAtEndYet
@@ -2200,7 +2200,7 @@ FlyMapScroll: ; 91b73
jr .Finally
.ScrollPrev:
- ld hl, wd002
+ ld hl, wTownMapPlayerIconLandmark
ld a, [hl]
cp e
jr nz, .NotAtStartYet
@@ -2269,14 +2269,14 @@ TownMapBubble: ; 91bb5
.Name:
; We need the map location of the default flypoint
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
ld l, a
ld h, 0
add hl, hl ; two bytes per flypoint
ld de, Flypoints
add hl, de
ld e, [hl]
- callba GetLandmarkName
+ farcall GetLandmarkName
hlcoord 2, 1
ld de, StringBuffer1
call PlaceString
@@ -2285,17 +2285,17 @@ TownMapBubble: ; 91bb5
; 91c17
GetMapCursorCoordinates: ; 91c17
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
ld l, a
ld h, $0
add hl, hl
ld de, Flypoints
add hl, de
ld e, [hl]
- callba GetLandmarkCoords
- ld a, [wd003]
+ farcall GetLandmarkCoords
+ ld a, [wTownMapCursorCoordinates]
ld c, a
- ld a, [wd004]
+ ld a, [wTownMapCursorCoordinates + 1]
ld b, a
ld hl, $4
add hl, bc
@@ -2338,44 +2338,7 @@ HasVisitedSpawn: ; 91c50
; 91c5e
-Flypoints: ; 91c5e
-; landmark, spawn point
- const_def
-flypoint: MACRO
- const FLY_\1
- db \2, SPAWN_\1
-ENDM
-; Johto
- flypoint NEW_BARK, NEW_BARK_TOWN
- flypoint CHERRYGROVE, CHERRYGROVE_CITY
- flypoint VIOLET, VIOLET_CITY
- flypoint AZALEA, AZALEA_TOWN
- flypoint GOLDENROD, GOLDENROD_CITY
- flypoint ECRUTEAK, ECRUTEAK_CITY
- flypoint OLIVINE, OLIVINE_CITY
- flypoint CIANWOOD, CIANWOOD_CITY
- flypoint MAHOGANY, MAHOGANY_TOWN
- flypoint LAKE, LAKE_OF_RAGE
- flypoint BLACKTHORN, BLACKTHORN_CITY
- flypoint MT_SILVER, SILVER_CAVE
-; Kanto
-
-KANTO_FLYPOINT EQU const_value
- flypoint PALLET, PALLET_TOWN
- flypoint VIRIDIAN, VIRIDIAN_CITY
- flypoint PEWTER, PEWTER_CITY
- flypoint CERULEAN, CERULEAN_CITY
- flypoint VERMILION, VERMILION_CITY
- flypoint ROCK_TUNNEL, ROCK_TUNNEL
- flypoint LAVENDER, LAVENDER_TOWN
- flypoint CELADON, CELADON_CITY
- flypoint SAFFRON, SAFFRON_CITY
- flypoint FUCHSIA, FUCHSIA_CITY
- flypoint CINNABAR, CINNABAR_ISLAND
- flypoint INDIGO, INDIGO_PLATEAU
- db -1
-
-; 91c8f
+INCLUDE "data/flypoints.asm"
ret_91c8f: ; 91c8f
ret
@@ -2389,8 +2352,7 @@ FlyMap: ; 91c90
ld c, a
call GetWorldMapLocation
; If we're not in a valid location, i.e. Pokecenter floor 2F,
-
-; the backup map information is used
+; the backup map information is used.
cp SPECIAL_MAP
jr nz, .CheckRegion
ld a, [BackupMapGroup]
@@ -2399,7 +2361,7 @@ FlyMap: ; 91c90
ld c, a
call GetWorldMapLocation
.CheckRegion:
-; The first 46 locations are part of Johto. The rest are in Kanto
+; The first 46 locations are part of Johto. The rest are in Kanto.
cp KANTO_LANDMARK
jr nc, .KantoFlyMap
.JohtoFlyMap:
@@ -2407,10 +2369,10 @@ FlyMap: ; 91c90
push af
; Start from New Bark Town
ld a, FLY_NEW_BARK
- ld [wd002], a
+ ld [wTownMapPlayerIconLandmark], a
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
-; ..and end at Silver Cave
+; ..and end at Silver Cave.
ld a, FLY_MT_SILVER
ld [EndFlypoint], a
; Fill out the map
@@ -2422,17 +2384,13 @@ FlyMap: ; 91c90
.KantoFlyMap:
; The event that there are no flypoints enabled in a map is not
-
; accounted for. As a result, if you attempt to select a flypoint
; when there are none enabled, the game will crash. Additionally,
-
; the flypoint selection has a default starting point that
-; can be flown to even if none are enabled
-
+; can be flown to even if none are enabled.
; To prevent both of these things from happening when the player
; enters Kanto, fly access is restricted until Indigo Plateau is
-
-; visited and its flypoint enabled
+; visited and its flypoint enabled.
push af
ld c, SPAWN_INDIGO
call HasVisitedSpawn
@@ -2447,9 +2405,8 @@ FlyMap: ; 91c90
ld a, FLY_INDIGO
ld [EndFlypoint], a
; Because Indigo Plateau is the first flypoint the player
-
-; visits, it's made the default flypoint
- ld [wd002], a
+; visits, it's made the default flypoint.
+ ld [wTownMapPlayerIconLandmark], a
; Fill out the map
call FillKantoMap
call .MapHud
@@ -2462,7 +2419,7 @@ FlyMap: ; 91c90
; Start from New Bark Town
ld a, FLY_NEW_BARK
- ld [wd002], a
+ ld [wTownMapPlayerIconLandmark], a
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
; ..and end at Silver Cave
@@ -2477,21 +2434,21 @@ FlyMap: ; 91c90
call TownMapBGUpdate
call TownMapMon
ld a, c
- ld [wd003], a
+ ld [wTownMapCursorCoordinates], a
ld a, b
- ld [wd004], a
+ ld [wTownMapCursorCoordinates + 1], a
ret
; 91d11
_Area: ; 91d11
; e: Current landmark
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
push af
- ld a, [wd003]
+ ld a, [wTownMapCursorLandmark]
push af
ld a, e
- ld [wd002], a
+ ld [wTownMapPlayerIconLandmark], a
call ClearSprites
xor a
ld [hBGMapMode], a
@@ -2545,9 +2502,9 @@ _Area: ; 91d11
.a_b
call ClearSprites
pop af
- ld [wd003], a
+ ld [wTownMapCursorLandmark], a
pop af
- ld [wd002], a
+ ld [wTownMapPlayerIconLandmark], a
ret
; 91d9b
@@ -2636,9 +2593,9 @@ _Area: ; 91d11
; 91e1e
.GetAndPlaceNest: ; 91e1e
- ld [wd003], a
+ ld [wTownMapCursorLandmark], a
ld e, a
- callba FindNest ; load nest landmarks into TileMap[0,0]
+ farcall FindNest ; load nest landmarks into TileMap[0,0]
decoord 0, 0
ld hl, Sprites
.nestloop
@@ -2648,7 +2605,7 @@ _Area: ; 91d11
push de
ld e, a
push hl
- callba GetLandmarkCoords
+ farcall GetLandmarkCoords
pop hl
; load into OAM
ld a, d
@@ -2678,9 +2635,9 @@ _Area: ; 91d11
.HideNestsShowPlayer: ; 91e5a
call .CheckPlayerLocation
ret c
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
ld e, a
- callba GetLandmarkCoords
+ farcall GetLandmarkCoords
ld c, e
ld b, d
ld de, .PlayerOAM
@@ -2731,22 +2688,21 @@ _Area: ; 91d11
.CheckPlayerLocation: ; 91ea9
; Don't show the player's sprite if you're
-
; not in the same region as what's currently
; on the screen.
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
cp FAST_SHIP
jr z, .johto
cp KANTO_LANDMARK
jr c, .johto
.kanto
- ld a, [wd003]
+ ld a, [wTownMapCursorLandmark]
and a
jr z, .clear
jr .ok
.johto
- ld a, [wd003]
+ ld a, [wTownMapCursorLandmark]
and a
jr nz, .clear
.ok
@@ -2764,10 +2720,10 @@ _Area: ; 91d11
; 91ed0
.GetPlayerOrFastShipIcon: ; 91ed0
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
cp FAST_SHIP
jr z, .FastShip
- callba GetPlayerIcon
+ farcall GetPlayerIcon
ret
.FastShip:
@@ -2879,19 +2835,7 @@ TownMapPals: ; 91f13
ret
.PalMap:
-townmappals: MACRO
-rept _NARG / 2
- dn \2, \1
- shift
- shift
-endr
-endm
- townmappals 1, 1, 1, 2, 2, 2, 0, 0, 1, 1, 3, 1, 4, 5, 4, 5
- townmappals 1, 1, 1, 2, 2, 2, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0
- townmappals 1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- townmappals 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0
- townmappals 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0
- townmappals 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0
+INCLUDE "data/palettes/town_map.asm"
; 91f7b
TownMapMon: ; 91f7b
@@ -2907,10 +2851,10 @@ TownMapMon: ; 91f7b
ld [wd265], a
; Get FlyMon icon
ld e, 8 ; starting tile in VRAM
- callba GetSpeciesIcon
+ farcall GetSpeciesIcon
; Animation/palette
depixel 0, 0
- ld a, SPRITE_ANIM_INDEX_00
+ ld a, SPRITE_ANIM_INDEX_PARTY_MON
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
@@ -2925,7 +2869,7 @@ TownMapMon: ; 91f7b
TownMapPlayerIcon: ; 91fa6
; Draw the player icon at town map location in a
push af
- callba GetPlayerIcon
+ farcall GetPlayerIcon
; Standing icon
ld hl, VTiles0 tile $10
ld c, 4 ; # tiles
@@ -2955,7 +2899,7 @@ TownMapPlayerIcon: ; 91fa6
pop af
ld e, a
push bc
- callba GetLandmarkCoords
+ farcall GetLandmarkCoords
pop bc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -2977,11 +2921,11 @@ LoadTownMapGFX: ; 91ff2
; 91fff
JohtoMap: ; 91fff
-INCBIN "gfx/misc/johto.bin"
+INCBIN "gfx/pokegear/johto.bin"
; 92168
KantoMap: ; 92168
-INCBIN "gfx/misc/kanto.bin"
+INCBIN "gfx/pokegear/kanto.bin"
; 922d1
PokedexNestIconGFX: ; 922d1
@@ -2991,7 +2935,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
; XXX
xor a
- ld [wd002], a
+ ld [wTownMapPlayerIconLandmark], a
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -3001,7 +2945,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
ld [hl], $1
xor a
ld [hBGMapMode], a
- callba ClearSpriteAnims
+ farcall ClearSpriteAnims
call LoadTownMapGFX
ld de, FlyMapLabelBorderGFX
ld hl, VTiles2 tile $30
@@ -3019,9 +2963,9 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
call TownMapBGUpdate
call TownMapMon
ld a, c
- ld [wd003], a
+ ld [wTownMapCursorCoordinates], a
ld a, b
- ld [wd004], a
+ ld [wTownMapCursorCoordinates + 1], a
ld b, SCGB_POKEGEAR_PALS
call GetSGBLayout
call SetPalettes
@@ -3036,7 +2980,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
jr nz, .pressedA
call .HandleDPad
call GetMapCursorCoordinates
- callba PlaySpriteAnimations
+ farcall PlaySpriteAnimations
call DelayFrame
jr .loop
@@ -3045,7 +2989,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
jr .finished_a_b
.pressedA
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
ld l, a
ld h, 0
add hl, hl
@@ -3053,7 +2997,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
add hl, de
ld a, [hl]
.finished_a_b
- ld [wd002], a
+ ld [wTownMapPlayerIconLandmark], a
pop af
ld [hInMenu], a
call ClearBGPalettes
@@ -3063,7 +3007,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
ld [hBGMapAddress], a
ld a, VBGMap0 / $100
ld [hBGMapAddress + 1], a
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
ld e, a
ret
@@ -3080,7 +3024,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
ret
.down_right
- ld hl, wd002
+ ld hl, wTownMapPlayerIconLandmark
ld a, [hl]
cp FLY_INDIGO
jr c, .okay_dr
@@ -3090,7 +3034,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
jr .continue
.up_left
- ld hl, wd002
+ ld hl, wTownMapPlayerIconLandmark
ld a, [hl]
and a
jr nz, .okay_ul
@@ -3098,7 +3042,7 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp"
.okay_ul
dec [hl]
.continue
- ld a, [wd002]
+ ld a, [wTownMapPlayerIconLandmark]
cp KANTO_FLYPOINT
jr c, .johto
call FillKantoMap
diff --git a/engine/pokepic.asm b/engine/pokepic.asm
index 2530ae4c9..ea5b3c300 100755
--- a/engine/pokepic.asm
+++ b/engine/pokepic.asm
@@ -12,7 +12,7 @@ Pokepic:: ; 244e3
ld [CurSpecies], a
call GetBaseData
ld de, VTiles1
- predef GetFrontpic
+ predef GetMonFrontpic
ld a, [wMenuBorderTopCoord]
inc a
ld b, a
diff --git a/engine/pokerus/apply_pokerus_tick.asm b/engine/pokerus/apply_pokerus_tick.asm
new file mode 100644
index 000000000..3c97fdc5e
--- /dev/null
+++ b/engine/pokerus/apply_pokerus_tick.asm
@@ -0,0 +1,26 @@
+ApplyPokerusTick: ; 13988
+; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured.
+ ld hl, PartyMon1PokerusStatus ; PartyMon1 + MON_PKRS
+ ld a, [PartyCount]
+ and a
+ ret z ; make sure it's not wasting time on an empty party
+ ld c, a
+.loop
+ ld a, [hl]
+ and $f ; lower nybble is the number of days remaining
+ jr z, .next ; if already 0, skip
+ sub b ; subtract the number of days
+ jr nc, .ok ; max(result, 0)
+ xor a
+.ok
+ ld d, a ; back up this value because we need to preserve the strain (upper nybble)
+ ld a, [hl]
+ and $f0
+ add d
+ ld [hl], a ; this prevents a cured pokemon from recontracting pokerus
+.next
+ ld de, PARTYMON_STRUCT_LENGTH
+ add hl, de
+ dec c
+ jr nz, .loop
+ ret
diff --git a/engine/pokerus/check_pokerus.asm b/engine/pokerus/check_pokerus.asm
new file mode 100644
index 000000000..285024754
--- /dev/null
+++ b/engine/pokerus/check_pokerus.asm
@@ -0,0 +1,25 @@
+CheckPokerus: ; 4d860
+; Return carry if a monster in your party has Pokerus
+
+; Get number of monsters to iterate over
+ ld a, [PartyCount]
+ and a
+ jr z, .NoPokerus
+ ld b, a
+; Check each monster in the party for Pokerus
+ ld hl, PartyMon1PokerusStatus
+ ld de, PARTYMON_STRUCT_LENGTH
+.Check:
+ ld a, [hl]
+ and $0f ; only the bottom nybble is used
+ jr nz, .HasPokerus
+; Next PartyMon
+ add hl, de
+ dec b
+ jr nz, .Check
+.NoPokerus:
+ and a
+ ret
+.HasPokerus:
+ scf
+ ret
diff --git a/engine/pokerus/pokerus.asm b/engine/pokerus/pokerus.asm
new file mode 100644
index 000000000..3e5e094e4
--- /dev/null
+++ b/engine/pokerus/pokerus.asm
@@ -0,0 +1,160 @@
+GivePokerusAndConvertBerries: ; 2ed44
+ call ConvertBerriesToBerryJuice
+ ld hl, PartyMon1PokerusStatus
+ ld a, [PartyCount]
+ ld b, a
+ ld de, PARTYMON_STRUCT_LENGTH
+; Check to see if any of your Pokemon already has Pokerus.
+; If so, sample its spread through your party.
+; This means that you cannot get Pokerus de novo while
+; a party member has an active infection.
+.loopMons
+ ld a, [hl]
+ and $f
+ jr nz, .TrySpreadPokerus
+ add hl, de
+ dec b
+ jr nz, .loopMons
+
+; If we haven't been to Goldenrod City at least once,
+; prevent the contraction of Pokerus.
+ ld hl, StatusFlags2
+ bit 6, [hl]
+ ret z
+ call Random
+ ld a, [hRandomAdd]
+ and a
+ ret nz
+ ld a, [hRandomSub]
+ cp $3
+ ret nc ; 3/65536 chance (00 00, 00 01 or 00 02)
+ ld a, [PartyCount]
+ ld b, a
+.randomMonSelectLoop
+ call Random
+ and $7
+ cp b
+ jr nc, .randomMonSelectLoop
+ ld hl, PartyMon1PokerusStatus
+ call GetPartyLocation ; get pokerus byte of random mon
+ ld a, [hl]
+ and $f0
+ ret nz ; if it already has pokerus, do nothing
+.randomPokerusLoop ; Simultaneously sample the strain and duration
+ call Random
+ and a
+ jr z, .randomPokerusLoop
+ ld b, a
+ and $f0
+ jr z, .load_pkrs
+ ld a, b
+ and $7
+ inc a
+.load_pkrs
+ ld b, a ; this should come before the label
+ swap b
+ and $3
+ inc a
+ add b
+ ld [hl], a
+ ret
+
+.TrySpreadPokerus:
+ call Random
+ cp 1 + 33 percent
+ ret nc ; 1/3 chance
+
+ ld a, [PartyCount]
+ cp 1
+ ret z ; only one mon, nothing to do
+
+ ld c, [hl]
+ ld a, b
+ cp 2
+ jr c, .checkPreviousMonsLoop ; no more mons after this one, go backwards
+
+ call Random
+ cp 1 + 50 percent
+ jr c, .checkPreviousMonsLoop ; 1/2 chance, go backwards
+.checkFollowingMonsLoop
+ add hl, de
+ ld a, [hl]
+ and a
+ jr z, .infectMon
+ ld c, a
+ and $3
+ ret z ; if mon has cured pokerus, stop searching
+ dec b ; go on to next mon
+ ld a, b
+ cp 1
+ jr nz, .checkFollowingMonsLoop ; no more mons left
+ ret
+
+.checkPreviousMonsLoop
+ ld a, [PartyCount]
+ cp b
+ ret z ; no more mons
+ ld a, l
+ sub e
+ ld l, a
+ ld a, h
+ sbc d
+ ld h, a
+ ld a, [hl]
+ and a
+ jr z, .infectMon
+ ld c, a
+ and $3
+ ret z ; if mon has cured pokerus, stop searching
+ inc b ; go on to next mon
+ jr .checkPreviousMonsLoop
+
+.infectMon
+ ld a, c
+ and $f0
+ ld b, a
+ ld a, c
+ swap a
+ and $3
+ inc a
+ add b
+ ld [hl], a
+ ret
+
+; any berry held by a Shuckle may be converted to berry juice
+ConvertBerriesToBerryJuice: ; 2ede6
+ ld hl, StatusFlags2
+ bit 6, [hl]
+ ret z
+ call Random
+ cp $10
+ ret nc ; 1/16 chance
+ ld hl, PartyMons
+ ld a, [PartyCount]
+.partyMonLoop
+ push af
+ push hl
+ ld a, [hl]
+ cp SHUCKLE
+ jr nz, .loopMon
+ ld bc, MON_ITEM
+ add hl, bc
+ ld a, [hl]
+ cp BERRY
+ jr z, .convertToJuice
+
+.loopMon
+ pop hl
+ ld bc, PARTYMON_STRUCT_LENGTH
+ add hl, bc
+ pop af
+ dec a
+ jr nz, .partyMonLoop
+ ret
+
+.convertToJuice
+ ld a, BERRY_JUICE
+ ld [hl], a
+ pop hl
+ pop af
+ ret
diff --git a/engine/predef.asm b/engine/predef.asm
index 73bc937a3..837f7b96b 100644
--- a/engine/predef.asm
+++ b/engine/predef.asm
@@ -54,8 +54,8 @@ PredefPointers:: ; 856b
add_predef UpdateEnemyHUD
add_predef StartBattle
add_predef FillInExpBar
- add_predef GetMonBackpic ; $18
- add_predef GetMonFrontpic
+ add_predef GetBattleMonBackpic ; $18
+ add_predef GetEnemyMonFrontpic
add_predef LearnLevelMoves
add_predef FillMoves
add_predef EvolveAfterBattle
@@ -90,9 +90,9 @@ PredefPointers:: ; 856b
add_predef Predef39
add_predef Predef3A
add_predef PartyMonItemName
- add_predef GetFrontpic
- add_predef GetBackpic
- add_predef FrontpicPredef
+ add_predef GetMonFrontpic
+ add_predef GetMonBackpic
+ add_predef GetAnimatedFrontpicPredef
add_predef GetTrainerPic
add_predef DecompressPredef ; $40
add_predef CheckTypeMatchup
diff --git a/engine/print_party.asm b/engine/print_party.asm
new file mode 100755
index 000000000..69bda8d52
--- /dev/null
+++ b/engine/print_party.asm
@@ -0,0 +1,362 @@
+PrintPage1: ; 1dc1b0
+ hlcoord 0, 0
+ decoord 0, 0, wPrinterTileMapBuffer
+ ld bc, 17 * SCREEN_WIDTH
+ call CopyBytes
+ hlcoord 17, 1, wPrinterTileMapBuffer
+ ld a, $62
+ ld [hli], a
+ inc a
+ ld [hl], a
+ hlcoord 17, 2, wPrinterTileMapBuffer
+ ld a, $64
+ ld [hli], a
+ inc a
+ ld [hl], a
+ hlcoord 1, 9, wPrinterTileMapBuffer
+ ld a, " "
+ ld [hli], a
+ ld [hl], a
+ hlcoord 1, 10, wPrinterTileMapBuffer
+ ld a, $61
+ ld [hli], a
+ ld [hl], a
+ hlcoord 2, 11, wPrinterTileMapBuffer
+ lb bc, 5, 18
+ call ClearBox
+ ld a, [wd265]
+ dec a
+ call CheckCaughtMon
+ push af
+ ld a, [wd265]
+ ld b, a
+ ld c, 1 ; get page 1
+ farcall GetDexEntryPagePointer
+ pop af
+ ld a, b
+ hlcoord 1, 11, wPrinterTileMapBuffer
+ call nz, FarString
+ hlcoord 19, 0, wPrinterTileMapBuffer
+ ld [hl], $35
+ ld de, SCREEN_WIDTH
+ add hl, de
+ ld b, $f
+.column_loop
+ ld [hl], $37
+ add hl, de
+ dec b
+ jr nz, .column_loop
+ ld [hl], $3a
+ ret
+; 1dc213
+
+PrintPage2: ; 1dc213
+ hlcoord 0, 0, wPrinterTileMapBuffer
+ ld bc, 8 * SCREEN_WIDTH
+ ld a, " "
+ call ByteFill
+ hlcoord 0, 0, wPrinterTileMapBuffer
+ ld a, $36
+ ld b, 6
+ call .FillColumn
+ hlcoord 19, 0, wPrinterTileMapBuffer
+ ld a, $37
+ ld b, 6
+ call .FillColumn
+ hlcoord 0, 6, wPrinterTileMapBuffer
+ ld [hl], $38
+ inc hl
+ ld a, $39
+ ld bc, SCREEN_HEIGHT
+ call ByteFill
+ ld [hl], $3a
+ hlcoord 0, 7, wPrinterTileMapBuffer
+ ld bc, SCREEN_WIDTH
+ ld a, $32
+ call ByteFill
+ ld a, [wd265]
+ dec a
+ call CheckCaughtMon
+ push af
+ ld a, [wd265]
+ ld b, a
+ ld c, 2 ; get page 2
+ farcall GetDexEntryPagePointer
+ pop af
+ hlcoord 1, 1, wPrinterTileMapBuffer
+ ld a, b
+ call nz, FarString
+ ret
+; 1dc26a
+
+.FillColumn: ; 1dc26a
+ push de
+ ld de, SCREEN_WIDTH
+.column_loop
+ ld [hl], a
+ add hl, de
+ dec b
+ jr nz, .column_loop
+ pop de
+ ret
+; 1dc275
+
+GBPrinterStrings:
+GBPrinterString_Null: db "@"
+GBPrinterString_CheckingLink: next " CHECKING LINK...@"
+GBPrinterString_Transmitting: next " TRANSMITTING...@"
+GBPrinterString_Printing: next " PRINTING...@"
+GBPrinterString_PrinterError1:
+ db " Printer Error 1"
+ next ""
+ next "Check the Game Boy"
+ next "Printer Manual."
+ db "@"
+GBPrinterString_PrinterError2:
+ db " Printer Error 2"
+ next ""
+ next "Check the Game Boy"
+ next "Printer Manual."
+ db "@"
+GBPrinterString_PrinterError3:
+ db " Printer Error 3"
+ next ""
+ next "Check the Game Boy"
+ next "Printer Manual."
+ db "@"
+GBPrinterString_PrinterError4:
+ db " Printer Error 4"
+ next ""
+ next "Check the Game Boy"
+ next "Printer Manual."
+ db "@"
+; 1dc381
+
+PrintPartyMonPage1: ; 1dc381
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ xor a
+ ld [hBGMapMode], a
+ call LoadFontsBattleExtra
+
+ ld de, GBPrinterHPIcon
+ ld hl, VTiles2 tile $71
+ lb bc, BANK(GBPrinterHPIcon), 1
+ call Request1bpp
+
+ ld de, GBPrinterLvIcon
+ ld hl, VTiles2 tile $6e
+ lb bc, BANK(GBPrinterLvIcon), 1
+ call Request1bpp
+
+ ld de, ShinyIconGFX
+ ld hl, VTiles2 tile $3f
+ lb bc, BANK(ShinyIconGFX), 1
+ call Get2bpp
+
+ xor a
+ ld [MonType], a
+ farcall CopyPkmnToTempMon
+ hlcoord 0, 7
+ ld b, 9
+ ld c, 18
+ call TextBox
+ hlcoord 8, 2
+ ld a, [TempMonLevel]
+ call PrintLevel_Force3Digits
+ hlcoord 12, 2
+ ld [hl], "◀" ; Filled left triangle
+ inc hl
+ ld de, TempMonMaxHP
+ lb bc, 2, 3
+ call PrintNum
+ ld a, [CurPartySpecies]
+ ld [wd265], a
+ ld [CurSpecies], a
+ ld hl, PartyMonNicknames
+ call Function1dc50e
+ hlcoord 8, 4
+ call PlaceString
+ hlcoord 9, 6
+ ld [hl], "/"
+ call GetPokemonName
+ hlcoord 10, 6
+ call PlaceString
+ hlcoord 8, 0
+ ld [hl], "№"
+ inc hl
+ ld [hl], "."
+ inc hl
+ ld de, wd265
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 3
+ call PrintNum
+ hlcoord 1, 9
+ ld de, String1dc550
+ call PlaceString
+ ld hl, PartyMonOT
+ call Function1dc50e
+ hlcoord 4, 9
+ call PlaceString
+ hlcoord 1, 11
+ ld de, String1dc559
+ call PlaceString
+ hlcoord 4, 11
+ ld de, TempMonID
+ lb bc, PRINTNUM_LEADINGZEROS | 2, 5
+ call PrintNum
+ hlcoord 1, 14
+ ld de, String1dc554
+ call PlaceString
+ hlcoord 7, 14
+ ld a, [TempMonMoves + 0]
+ call Function1dc51a
+ call Function1dc52c
+ ld hl, TempMonDVs
+ predef GetUnownLetter
+ ld hl, wBoxAlignment
+ xor a
+ ld [hl], a
+ ld a, [CurPartySpecies]
+ cp UNOWN
+ jr z, .asm_1dc469
+ inc [hl]
+
+.asm_1dc469
+ hlcoord 0, 0
+ call _PrepMonFrontpic
+ call WaitBGMap
+ ld b, SCGB_STATS_SCREEN_HP_PALS
+ call GetSGBLayout
+ call SetPalettes
+ ret
+; 1dc47b
+
+PrintPartyMonPage2: ; 1dc47b
+ call ClearBGPalettes
+ call ClearTileMap
+ call ClearSprites
+ xor a
+ ld [hBGMapMode], a
+ call LoadFontsBattleExtra
+ xor a
+ ld [MonType], a
+ farcall CopyPkmnToTempMon
+ hlcoord 0, 0
+ ld b, 15
+ ld c, 18
+ call TextBox
+ ld bc, SCREEN_WIDTH
+ decoord 0, 0
+ hlcoord 0, 1
+ call CopyBytes
+ hlcoord 7, 0
+ ld a, [TempMonMoves + 1]
+ call Function1dc51a
+ hlcoord 7, 2
+ ld a, [TempMonMoves + 2]
+ call Function1dc51a
+ hlcoord 7, 4
+ ld a, [TempMonMoves + 3]
+ call Function1dc51a
+ hlcoord 7, 7
+ ld de, String1dc55d
+ call PlaceString
+ hlcoord 16, 7
+ ld de, TempMonAttack
+ call .PrintTempMonStats
+ hlcoord 16, 9
+ ld de, TempMonDefense
+ call .PrintTempMonStats
+ hlcoord 16, 11
+ ld de, TempMonSpclAtk
+ call .PrintTempMonStats
+ hlcoord 16, 13
+ ld de, TempMonSpclDef
+ call .PrintTempMonStats
+ hlcoord 16, 15
+ ld de, TempMonSpeed
+ call .PrintTempMonStats
+ call WaitBGMap
+ ld b, SCGB_STATS_SCREEN_HP_PALS
+ call GetSGBLayout
+ call SetPalettes
+ ret
+; 1dc507
+
+.PrintTempMonStats: ; 1dc507
+ lb bc, 2, 3
+ call PrintNum
+ ret
+; 1dc50e
+
+Function1dc50e: ; 1dc50e
+ ld bc, NAME_LENGTH
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld e, l
+ ld d, h
+ ret
+; 1dc51a
+
+Function1dc51a: ; 1dc51a
+ and a
+ jr z, .no_move
+
+ ld [wd265], a
+ call GetMoveName
+ jr .got_string
+
+.no_move
+ ld de, String1dc584
+
+.got_string
+ call PlaceString
+ ret
+; 1dc52c
+
+Function1dc52c: ; 1dc52c
+ farcall GetGender
+ ld a, " "
+ jr c, .got_gender
+ ld a, "♂"
+ jr nz, .got_gender
+ ld a, "♀"
+
+.got_gender
+ hlcoord 17, 2
+ ld [hl], a
+ ld bc, TempMonDVs
+ farcall CheckShininess
+ ret nc
+ hlcoord 18, 2
+ ld [hl], "<SHINY>"
+ ret
+; 1dc550
+
+String1dc550: ; 1dc550
+ db "OT/@"
+
+String1dc554: ; 1dc554
+ db "MOVE@"
+
+String1dc559: ; 1dc559
+ db "<ID>№.@"
+
+String1dc55d: ; 1dc55d
+ db "ATTACK"
+ next "DEFENSE"
+ next "SPCL.ATK"
+ next "SPCL.DEF"
+ next "SPEED"
+ db "@"
+
+String1dc584: ; 1dc584
+ db "------------@"
+; 1dc591
+
+GBPrinterHPIcon: ; 1dc591
+INCBIN "gfx/printer/hp.1bpp"
+
+GBPrinterLvIcon: ; 1dc599
+INCBIN "gfx/printer/lv.1bpp"
diff --git a/engine/printer.asm b/engine/printer.asm
index 7dd2d4f4a..b72f99375 100755
--- a/engine/printer.asm
+++ b/engine/printer.asm
@@ -1,4 +1,4 @@
-INCLUDE "engine/printer/serial.asm"
+INCLUDE "engine/printer_serial.asm"
SendScreenToPrinter: ; 843f0
.loop
@@ -68,7 +68,7 @@ PrintDexEntry: ; 8442c
call Printer_StartTransmission
ld a, $10
ld [wcbfa], a
- callba PrintPage1
+ farcall PrintPage1
call ClearTileMap
ld a, %11100100
call DmgToCgbBGPals
@@ -94,7 +94,7 @@ PrintDexEntry: ; 8442c
call Printer_StartTransmission
ld a, $3
ld [wcbfa], a
- callba PrintPage2
+ farcall PrintPage2
call Printer_ResetJoypadRegisters
ld a, 4
ld [wPrinterQueueLength], a
@@ -235,7 +235,7 @@ PrintUnownStamp: ; 84560
xor a
ld [hBGMapMode], a
call LoadTileMapToTempTileMap
- callba PlaceUnownPrinterFrontpic
+ farcall PlaceUnownPrinterFrontpic
ld a, $0 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
call Call_LoadTempTileMapToTileMap
@@ -341,7 +341,7 @@ PrintPartymon: ; 8461a
xor a
ld [hBGMapMode], a
- callba PrintPartyMonPage1
+ farcall PrintPartyMonPage1
ld a, $10 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
@@ -362,7 +362,7 @@ PrintPartymon: ; 8461a
xor a
ld [hBGMapMode], a
- callba PrintPartyMonPage2
+ farcall PrintPartyMonPage2
ld a, $3 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
@@ -391,7 +391,7 @@ _PrintDiploma: ; 84688
ld a, [wPrinterQueueLength]
push af
- callba PlaceDiplomaOnScreen
+ farcall PlaceDiplomaOnScreen
xor a
ld [hPrinter], a
@@ -425,7 +425,7 @@ _PrintDiploma: ; 84688
xor a
ld [hBGMapMode], a
- callba PrintDiplomaPage2
+ farcall PrintDiplomaPage2
ld a, $3 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
@@ -861,7 +861,7 @@ Printer_GetMonGender: ; 8498a (21:498a)
ld [CurPartyMon], a
ld a, TEMPMON
ld [MonType], a
- callba GetGender
+ farcall GetGender
ld a, " "
jr c, .got_gender
ld a, "♂"
diff --git a/engine/printer/serial.asm b/engine/printer_serial.asm
index 37ed2990b..6909a38b2 100755
--- a/engine/printer/serial.asm
+++ b/engine/printer_serial.asm
@@ -292,13 +292,13 @@ Printer_WaitHandshake: ; 841c3 (21:41c3)
Printer_CopyPacket: ; 841e2 (21:41e2)
ld a, [hli]
- ld [wca82], a
+ ld [wPrinterData], a
ld a, [hli]
- ld [wca83], a
+ ld [wPrinterData + 1], a
ld a, [hli]
- ld [wca84], a
+ ld [wPrinterData + 2], a
ld a, [hli]
- ld [wca85], a
+ ld [wPrinterData + 3], a
ld a, [hli]
ld [wPrinterChecksum], a
ld a, [hl]
@@ -307,7 +307,7 @@ Printer_CopyPacket: ; 841e2 (21:41e2)
Printer_ResetData: ; 841fb (21:41fb)
xor a
- ld hl, wca82
+ ld hl, wPrinterData
ld [hli], a
ld [hli], a
ld [hli], a
@@ -326,7 +326,7 @@ Printer_ResetData: ; 841fb (21:41fb)
Printer_ComputeChecksum: ; 84219 (21:4219)
ld hl, 0
ld bc, 4
- ld de, wca82
+ ld de, wPrinterData
call .ComputeChecksum
ld a, [wPrinterSendByteCounter]
ld c, a
@@ -476,10 +476,10 @@ _PrinterReceive:: ; 842db
dw Printer_DoNothing ; 00
dw Printer_Send0x33 ; 01
- dw Printer_Sendwca82 ; 02
- dw Printer_Sendwca83 ; 03
- dw Printer_Sendwca84 ; 04
- dw Printer_Sendwca85 ; 05
+ dw Printer_SendPrinterData1 ; 02
+ dw Printer_SendPrinterData2 ; 03
+ dw Printer_SendPrinterData3 ; 04
+ dw Printer_SendPrinterData4 ; 05
dw Printer_SendNextByte ; 06
dw Printer_SendwPrinterChecksumLo ; 07
dw Printer_SendwPrinterChecksumHi ; 08
@@ -524,26 +524,26 @@ Printer_Send0x33: ; 84330 (21:4330)
call Printer_NextInstruction
ret
-Printer_Sendwca82: ; 84339 (21:4339)
- ld a, [wca82]
+Printer_SendPrinterData1: ; 84339 (21:4339)
+ ld a, [wPrinterData]
call Printer_SerialSend
call Printer_NextInstruction
ret
-Printer_Sendwca83: ; 84343 (21:4343)
- ld a, [wca83]
+Printer_SendPrinterData2: ; 84343 (21:4343)
+ ld a, [wPrinterData + 1]
call Printer_SerialSend
call Printer_NextInstruction
ret
-Printer_Sendwca84: ; 8434d (21:434d)
- ld a, [wca84]
+Printer_SendPrinterData3: ; 8434d (21:434d)
+ ld a, [wPrinterData + 2]
call Printer_SerialSend
call Printer_NextInstruction
ret
-Printer_Sendwca85: ; 84357 (21:4357)
- ld a, [wca85]
+Printer_SendPrinterData4: ; 84357 (21:4357)
+ ld a, [wPrinterData + 3]
call Printer_SerialSend
call Printer_NextInstruction
ret
diff --git a/engine/printnum.asm b/engine/printnum.asm
index 4ef7721c8..7b814a042 100755
--- a/engine/printnum.asm
+++ b/engine/printnum.asm
@@ -275,7 +275,7 @@ _PrintNum:: ; c4c7
dec e
ret nz
inc hl
- ld [hl], "·"
+ ld [hl], "<DOT>"
ret
.PrintLeadingZero: ; c644
diff --git a/engine/prof_oaks_pc.asm b/engine/prof_oaks_pc.asm
index 05ff2b691..69949940b 100755
--- a/engine/prof_oaks_pc.asm
+++ b/engine/prof_oaks_pc.asm
@@ -1,4 +1,3 @@
-
ProfOaksPC: ; 0x265d3
ld hl, OakPCText1
call MenuTextBox
@@ -100,31 +99,26 @@ endr
ret
OakRatings: ; 0x2667f
-oakrating: MACRO
- db \1
- dw \2, \3
-endm
-
; if you caught at most this many, play this sound, load this text
- oakrating 9, SFX_DEX_FANFARE_LESS_THAN_20, OakRating01
- oakrating 19, SFX_DEX_FANFARE_LESS_THAN_20, OakRating02
- oakrating 34, SFX_DEX_FANFARE_20_49, OakRating03
- oakrating 49, SFX_DEX_FANFARE_20_49, OakRating04
- oakrating 64, SFX_DEX_FANFARE_50_79, OakRating05
- oakrating 79, SFX_DEX_FANFARE_50_79, OakRating06
- oakrating 94, SFX_DEX_FANFARE_80_109, OakRating07
- oakrating 109, SFX_DEX_FANFARE_80_109, OakRating08
- oakrating 124, SFX_CAUGHT_MON, OakRating09
- oakrating 139, SFX_CAUGHT_MON, OakRating10
- oakrating 154, SFX_DEX_FANFARE_140_169, OakRating11
- oakrating 169, SFX_DEX_FANFARE_140_169, OakRating12
- oakrating 184, SFX_DEX_FANFARE_170_199, OakRating13
- oakrating 199, SFX_DEX_FANFARE_170_199, OakRating14
- oakrating 214, SFX_DEX_FANFARE_200_229, OakRating15
- oakrating 229, SFX_DEX_FANFARE_200_229, OakRating16
- oakrating 239, SFX_DEX_FANFARE_230_PLUS, OakRating17
- oakrating 248, SFX_DEX_FANFARE_230_PLUS, OakRating18
- oakrating 255, SFX_DEX_FANFARE_230_PLUS, OakRating19
+ dbww 9, SFX_DEX_FANFARE_LESS_THAN_20, OakRating01
+ dbww 19, SFX_DEX_FANFARE_LESS_THAN_20, OakRating02
+ dbww 34, SFX_DEX_FANFARE_20_49, OakRating03
+ dbww 49, SFX_DEX_FANFARE_20_49, OakRating04
+ dbww 64, SFX_DEX_FANFARE_50_79, OakRating05
+ dbww 79, SFX_DEX_FANFARE_50_79, OakRating06
+ dbww 94, SFX_DEX_FANFARE_80_109, OakRating07
+ dbww 109, SFX_DEX_FANFARE_80_109, OakRating08
+ dbww 124, SFX_CAUGHT_MON, OakRating09
+ dbww 139, SFX_CAUGHT_MON, OakRating10
+ dbww 154, SFX_DEX_FANFARE_140_169, OakRating11
+ dbww 169, SFX_DEX_FANFARE_140_169, OakRating12
+ dbww 184, SFX_DEX_FANFARE_170_199, OakRating13
+ dbww 199, SFX_DEX_FANFARE_170_199, OakRating14
+ dbww 214, SFX_DEX_FANFARE_200_229, OakRating15
+ dbww 229, SFX_DEX_FANFARE_200_229, OakRating16
+ dbww 239, SFX_DEX_FANFARE_230_PLUS, OakRating17
+ dbww 248, SFX_DEX_FANFARE_230_PLUS, OakRating18
+ dbww 255, SFX_DEX_FANFARE_230_PLUS, OakRating19
OakPCText1: ; 0x266de
text_jump _OakPCText1
diff --git a/engine/radio.asm b/engine/radio.asm
index 99408af48..b5c1e075f 100644
--- a/engine/radio.asm
+++ b/engine/radio.asm
@@ -234,7 +234,7 @@ OaksPkmnTalk4:
jr z, .done
.next
dec hl
- ld de, WILDMON_GRASS_STRUCTURE_LENGTH
+ ld de, GRASS_WILDDATA_LENGTH
add hl, de
jr .loop
@@ -249,12 +249,12 @@ endr
cp 3
jr z, .loop2
- ld bc, 2 * NUM_WILDMONS_PER_AREA_TIME_OF_DAY
+ ld bc, 2 * NUM_GRASSMON
call AddNTimes
.loop3
; Choose one of the middle three Pokemon.
call Random
- and NUM_WILDMONS_PER_AREA_TIME_OF_DAY
+ and NUM_GRASSMON
cp 2
jr c, .loop3
cp 5
@@ -278,7 +278,7 @@ endr
pop bc
call GetWorldMapLocation
ld e, a
- callba GetLandmarkName
+ farcall GetLandmarkName
ld hl, OPT_OakText1
call CopyRadioTextToRAM
ld a, OAKS_POKEMON_TALK_5
@@ -592,7 +592,7 @@ OaksPkmnTalk9:
db "@"
OaksPkmnTalk10:
- callba RadioMusicRestartPokemonChannel
+ farcall RadioMusicRestartPokemonChannel
ld hl, OPT_RestartText
call PrintText
call WaitBGMap
@@ -653,7 +653,7 @@ OaksPkmnTalk14:
dec [hl]
ret nz
ld de, $1d
- callab RadioMusicRestartDE
+ callfar RadioMusicRestartDE
ld hl, .terminator
call PrintText
ld a, OAKS_POKEMON_TALK_4
@@ -923,7 +923,7 @@ StartPokemonMusicChannel:
jr z, .SunTueThurSun
ld de, MUSIC_POKEMON_LULLABY
.SunTueThurSun:
- callab RadioMusicRestartDE
+ callfar RadioMusicRestartDE
ret
BenIntroText1:
@@ -978,9 +978,9 @@ BenFernText3B:
LuckyNumberShow1:
call StartRadioStation
- callab Special_CheckLuckyNumberShowFlag
+ callfar Special_CheckLuckyNumberShowFlag
jr nc, .dontreset
- callab Special_ResetLuckyNumberShowFlag
+ callfar Special_ResetLuckyNumberShowFlag
.dontreset
ld hl, LC_Text1
ld a, LUCKY_NUMBER_SHOW_2
@@ -1193,12 +1193,12 @@ PeoplePlaces4: ; People
pop bc
jr c, PeoplePlaces4
push bc
- callab GetTrainerClassName
+ callfar GetTrainerClassName
ld de, StringBuffer1
call CopyName1
pop bc
ld b, 1
- callab GetTrainerName
+ callfar GetTrainerName
ld hl, PnP_Text4
ld a, PLACES_AND_PEOPLE_5
jp NextRadioLine
@@ -1348,7 +1348,7 @@ PeoplePlaces6: ; Places
ld c, [hl]
call GetWorldMapLocation
ld e, a
- callba GetLandmarkName
+ farcall GetLandmarkName
ld hl, PnP_Text5
ld a, PLACES_AND_PEOPLE_7
jp NextRadioLine
@@ -1578,7 +1578,6 @@ BuenasPassword4:
.greater_than_11
call Random
maskbits NUM_PASSWORD_CATEGORIES
- and x
cp NUM_PASSWORD_CATEGORIES
jr nc, .greater_than_11
; Store it in the high nybble of e.
@@ -1809,8 +1808,8 @@ BuenasPassword19:
BuenasPassword20:
ld a, [hBGMapMode]
push af
- callba NoRadioMusic
- callba NoRadioName
+ farcall NoRadioMusic
+ farcall NoRadioName
pop af
ld [hBGMapMode], a
ld hl, WeeklyFlags
@@ -1837,7 +1836,7 @@ BuenasPassword21:
BuenasPasswordCheckTime:
call UpdateTime
ld a, [hHours]
- cp 18 ; 6 PM
+ cp NITE_HOUR
ret
BuenasPasswordChannelName:
@@ -1956,7 +1955,7 @@ StartRadioStation:
ld e, [hl]
inc hl
ld d, [hl]
- callab RadioMusicRestartDE
+ callfar RadioMusicRestartDE
ret
RadioChannelSongs:
diff --git a/engine/read_trainer_attributes.asm b/engine/read_trainer_attributes.asm
new file mode 100644
index 000000000..dfb8d3682
--- /dev/null
+++ b/engine/read_trainer_attributes.asm
@@ -0,0 +1,64 @@
+GetTrainerClassName: ; 3952d
+ ld hl, RivalName
+ ld a, c
+ cp RIVAL1
+ jr z, .rival
+
+ ld [CurSpecies], a
+ ld a, TRAINER_NAME
+ ld [wNamedObjectTypeBuffer], a
+ call GetName
+ ld de, StringBuffer1
+ ret
+
+.rival
+ ld de, StringBuffer1
+ push de
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ pop de
+ ret
+
+GetOTName: ; 39550
+ ld hl, OTPlayerName
+ ld a, [wLinkMode]
+ and a
+ jr nz, .ok
+
+ ld hl, RivalName
+ ld a, c
+ cp RIVAL1
+ jr z, .ok
+
+ ld [CurSpecies], a
+ ld a, TRAINER_NAME
+ ld [wNamedObjectTypeBuffer], a
+ call GetName
+ ld hl, StringBuffer1
+
+.ok
+ ld bc, TRAINER_CLASS_NAME_LENGTH
+ ld de, OTClassName
+ push de
+ call CopyBytes
+ pop de
+ ret
+
+GetTrainerAttributes: ; 3957b
+ ld a, [TrainerClass]
+ ld c, a
+ call GetOTName
+ ld a, [TrainerClass]
+ dec a
+ ld hl, TrainerClassAttributes + TRNATTR_ITEM1
+ ld bc, NUM_TRAINER_ATTRIBUTES
+ call AddNTimes
+ ld de, wEnemyTrainerItem1
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ ld a, [hl]
+ ld [wEnemyTrainerBaseReward], a
+ ret
diff --git a/engine/read_trainer_party.asm b/engine/read_trainer_party.asm
new file mode 100755
index 000000000..9b7727a84
--- /dev/null
+++ b/engine/read_trainer_party.asm
@@ -0,0 +1,398 @@
+
+ReadTrainerParty: ; 39771
+ ld a, [InBattleTowerBattle]
+ bit 0, a
+ ret nz
+
+ ld a, [wLinkMode]
+ and a
+ ret nz
+
+ ld hl, OTPartyCount
+ xor a
+ ld [hli], a
+ dec a
+ ld [hl], a
+
+ ld hl, OTPartyMons
+ ld bc, OTPartyMonsEnd - OTPartyMons
+ xor a
+ call ByteFill
+
+ ld a, [OtherTrainerClass]
+ cp CAL
+ jr nz, .not_cal2
+ ld a, [OtherTrainerID]
+ cp CAL2
+ jr z, .cal2
+ ld a, [OtherTrainerClass]
+.not_cal2
+
+ dec a
+ ld c, a
+ ld b, 0
+ ld hl, TrainerGroups
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+
+ ld a, [OtherTrainerID]
+ ld b, a
+.skip_trainer
+ dec b
+ jr z, .got_trainer
+.loop
+ ld a, [hli]
+ cp $ff
+ jr nz, .loop
+ jr .skip_trainer
+.got_trainer
+
+.skip_name
+ ld a, [hli]
+ cp "@"
+ jr nz, .skip_name
+
+ ld a, [hli]
+ ld c, a
+ ld b, 0
+ ld d, h
+ ld e, l
+ ld hl, TrainerTypes
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld bc, .done
+ push bc
+ jp hl
+
+.done
+ jp ComputeTrainerReward
+
+.cal2
+ ld a, BANK(sMysteryGiftTrainer)
+ call GetSRAMBank
+ ld de, sMysteryGiftTrainer
+ call TrainerType2
+ call CloseSRAM
+ jr .done
+; 397e3
+
+TrainerTypes: ; 397e3
+ dw TrainerType1 ; level, species
+ dw TrainerType2 ; level, species, moves
+ dw TrainerType3 ; level, species, item
+ dw TrainerType4 ; level, species, item, moves
+; 397eb
+
+TrainerType1: ; 397eb
+; normal (level, species)
+ ld h, d
+ ld l, e
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z
+
+ ld [CurPartyLevel], a
+ ld a, [hli]
+ ld [CurPartySpecies], a
+ ld a, OTPARTYMON
+ ld [MonType], a
+ push hl
+ predef TryAddMonToParty
+ pop hl
+ jr .loop
+; 39806
+
+TrainerType2: ; 39806
+; moves
+ ld h, d
+ ld l, e
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z
+
+ ld [CurPartyLevel], a
+ ld a, [hli]
+ ld [CurPartySpecies], a
+ ld a, OTPARTYMON
+ ld [MonType], a
+
+ push hl
+ predef TryAddMonToParty
+ ld a, [OTPartyCount]
+ dec a
+ ld hl, OTPartyMon1Moves
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld d, h
+ ld e, l
+ pop hl
+
+ ld b, NUM_MOVES
+.copy_moves
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .copy_moves
+
+ push hl
+
+ ld a, [OTPartyCount]
+ dec a
+ ld hl, OTPartyMon1Species
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld d, h
+ ld e, l
+ ld hl, MON_PP
+ add hl, de
+ push hl
+ ld hl, MON_MOVES
+ add hl, de
+ pop de
+
+ ld b, NUM_MOVES
+.copy_pp
+ ld a, [hli]
+ and a
+ jr z, .copied_pp
+
+ push hl
+ push bc
+ dec a
+ ld hl, Moves + MOVE_PP
+ ld bc, MOVE_LENGTH
+ call AddNTimes
+ ld a, BANK(Moves)
+ call GetFarByte
+ pop bc
+ pop hl
+
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .copy_pp
+.copied_pp
+
+ pop hl
+ jr .loop
+; 39871
+
+TrainerType3: ; 39871
+; item
+ ld h, d
+ ld l, e
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z
+
+ ld [CurPartyLevel], a
+ ld a, [hli]
+ ld [CurPartySpecies], a
+ ld a, OTPARTYMON
+ ld [MonType], a
+ push hl
+ predef TryAddMonToParty
+ ld a, [OTPartyCount]
+ dec a
+ ld hl, OTPartyMon1Item
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld d, h
+ ld e, l
+ pop hl
+ ld a, [hli]
+ ld [de], a
+ jr .loop
+; 3989d (e:589d)
+
+TrainerType4: ; 3989d
+; item + moves
+ ld h, d
+ ld l, e
+.loop
+ ld a, [hli]
+ cp $ff
+ ret z
+
+ ld [CurPartyLevel], a
+ ld a, [hli]
+ ld [CurPartySpecies], a
+
+ ld a, OTPARTYMON
+ ld [MonType], a
+
+ push hl
+ predef TryAddMonToParty
+ ld a, [OTPartyCount]
+ dec a
+ ld hl, OTPartyMon1Item
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld d, h
+ ld e, l
+ pop hl
+
+ ld a, [hli]
+ ld [de], a
+
+ push hl
+ ld a, [OTPartyCount]
+ dec a
+ ld hl, OTPartyMon1Moves
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld d, h
+ ld e, l
+ pop hl
+
+ ld b, NUM_MOVES
+.copy_moves
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .copy_moves
+
+ push hl
+
+ ld a, [OTPartyCount]
+ dec a
+ ld hl, OTPartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ ld d, h
+ ld e, l
+ ld hl, MON_PP
+ add hl, de
+
+ push hl
+ ld hl, MON_MOVES
+ add hl, de
+ pop de
+
+ ld b, NUM_MOVES
+.copy_pp
+ ld a, [hli]
+ and a
+ jr z, .copied_pp
+
+ push hl
+ push bc
+ dec a
+ ld hl, Moves + MOVE_PP
+ ld bc, MOVE_LENGTH
+ call AddNTimes
+ ld a, BANK(Moves)
+ call GetFarByte
+ pop bc
+ pop hl
+
+ ld [de], a
+ inc de
+ dec b
+ jr nz, .copy_pp
+.copied_pp
+
+ pop hl
+ jr .loop
+; 3991b
+
+ComputeTrainerReward: ; 3991b (e:591b)
+ ld hl, hProduct
+ xor a
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
+ ld a, [wEnemyTrainerBaseReward]
+ ld [hli], a
+ ld a, [CurPartyLevel]
+ ld [hl], a
+ call Multiply
+ ld hl, wBattleReward
+ xor a
+ ld [hli], a
+ ld a, [hProduct + 2]
+ ld [hli], a
+ ld a, [hProduct + 3]
+ ld [hl], a
+ ret
+
+
+Battle_GetTrainerName:: ; 39939
+ ld a, [InBattleTowerBattle]
+ bit 0, a
+ ld hl, OTPlayerName
+ jp nz, CopyTrainerName
+
+ ld a, [OtherTrainerID]
+ ld b, a
+ ld a, [OtherTrainerClass]
+ ld c, a
+
+GetTrainerName:: ; 3994c
+ ld a, c
+ cp CAL
+ jr nz, .not_cal2
+
+ ld a, BANK(sMysteryGiftTrainerHouseFlag)
+ call GetSRAMBank
+ ld a, [sMysteryGiftTrainerHouseFlag]
+ and a
+ call CloseSRAM
+ jr z, .not_cal2
+
+ ld a, BANK(sMysteryGiftPartnerName)
+ call GetSRAMBank
+ ld hl, sMysteryGiftPartnerName
+ call CopyTrainerName
+ jp CloseSRAM
+
+.not_cal2
+ dec c
+ push bc
+ ld b, 0
+ ld hl, TrainerGroups
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ pop bc
+
+.loop
+ dec b
+ jr z, CopyTrainerName
+
+.skip
+ ld a, [hli]
+ cp $ff
+ jr nz, .skip
+ jr .loop
+
+CopyTrainerName: ; 39984
+ ld de, StringBuffer1
+ push de
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ pop de
+ ret
+; 39990
+
+Function39990: ; 39990
+; This function is useless.
+ ld de, StringBuffer1
+ push de
+ ld bc, NAME_LENGTH
+ pop de
+ ret
+; 39999
diff --git a/engine/routines/battlestart_copytilemapatonce.asm b/engine/routines/battlestart_copytilemapatonce.asm
new file mode 100644
index 000000000..2952e833b
--- /dev/null
+++ b/engine/routines/battlestart_copytilemapatonce.asm
@@ -0,0 +1,3 @@
+BattleStart_CopyTilemapAtOnce: ; 8cf4f
+ call CGBOnly_CopyTilemapAtOnce
+ ret
diff --git a/engine/routines/checkbattlescene.asm b/engine/routines/checkbattlescene.asm
new file mode 100644
index 000000000..b63f00907
--- /dev/null
+++ b/engine/routines/checkbattlescene.asm
@@ -0,0 +1,47 @@
+CheckBattleScene: ; 4ea44
+; Return carry if battle scene is turned off.
+
+ ld a, 0
+ ld hl, wLinkMode
+ call GetFarWRAMByte
+ cp LINK_MOBILE
+ jr z, .mobile
+
+ ld a, [Options]
+ bit BATTLE_SCENE, a
+ jr nz, .off
+
+ and a
+ ret
+
+.mobile
+ ld a, [wcd2f]
+ and a
+ jr nz, .from_wram
+
+ ld a, $4
+ call GetSRAMBank
+ ld a, [$a60c]
+ ld c, a
+ call CloseSRAM
+
+ ld a, c
+ bit 0, c
+ jr z, .off
+
+ and a
+ ret
+
+.from_wram
+ ld a, $5
+ ld hl, w5_dc00
+ call GetFarWRAMByte
+ bit 0, a
+ jr z, .off
+
+ and a
+ ret
+
+.off
+ scf
+ ret
diff --git a/engine/routines/checknickerrors.asm b/engine/routines/checknickerrors.asm
new file mode 100644
index 000000000..1cedca420
--- /dev/null
+++ b/engine/routines/checknickerrors.asm
@@ -0,0 +1,74 @@
+CheckNickErrors:: ; 669f
+; error-check monster nick before use
+; must be a peace offering to gamesharkers
+
+; input: de = nick location
+
+ push bc
+ push de
+ ld b, PKMN_NAME_LENGTH
+
+.checkchar
+; end of nick?
+ ld a, [de]
+ cp "@" ; terminator
+ jr z, .end
+
+; check if this char is a text command
+ ld hl, .textcommands
+ dec hl
+.loop
+; next entry
+ inc hl
+; reached end of commands table?
+ ld a, [hl]
+ cp -1
+ jr z, .done
+
+; is the current char between this value (inclusive)...
+ ld a, [de]
+ cp [hl]
+ inc hl
+ jr c, .loop
+; ...and this one?
+ cp [hl]
+ jr nc, .loop
+
+; replace it with a "?"
+ ld a, "?"
+ ld [de], a
+ jr .loop
+
+.done
+; next char
+ inc de
+; reached end of nick without finding a terminator?
+ dec b
+ jr nz, .checkchar
+
+; change nick to "?@"
+ pop de
+ push de
+ ld a, "?"
+ ld [de], a
+ inc de
+ ld a, "@"
+ ld [de], a
+.end
+; if the nick has any errors at this point it's out of our hands
+ pop de
+ pop bc
+ ret
+
+.textcommands ; 66cf
+; table defining which characters are actually text commands
+; format:
+ ; ≥ <
+ db "<START>", TX_BOX + 1
+ db "<PLAY_G>", $18 + 1
+ db $1d, "%" + 1
+ db $35, "<GREEN>" + 1
+ db "<ENEMY>", "<ENEMY>" + 1
+ db "<MOM>", "<TM>" + 1
+ db "<ROCKET>", "┘" + 1
+ db -1 ; end
diff --git a/engine/routines/checksave.asm b/engine/routines/checksave.asm
new file mode 100644
index 000000000..2280f0e53
--- /dev/null
+++ b/engine/routines/checksave.asm
@@ -0,0 +1,20 @@
+CheckSave:: ; 4cffe
+ ld a, BANK(sCheckValue1) ; BANK(sCheckValue2)
+ call GetSRAMBank
+ ld a, [sCheckValue1]
+ ld b, a
+ ld a, [sCheckValue2]
+ ld c, a
+ call CloseSRAM
+ ld a, b
+ cp SAVE_CHECK_VALUE_1
+ jr nz, .ok
+ ld a, c
+ cp SAVE_CHECK_VALUE_2
+ jr nz, .ok
+ ld c, $1
+ ret
+
+.ok
+ ld c, $0
+ ret
diff --git a/engine/routines/checktime.asm b/engine/routines/checktime.asm
new file mode 100644
index 000000000..ada151dbf
--- /dev/null
+++ b/engine/routines/checktime.asm
@@ -0,0 +1,19 @@
+CheckTime:: ; c000
+ ld a, [TimeOfDay]
+ ld hl, .TimeOfDayTable
+ ld de, 2
+ call IsInArray
+ inc hl
+ ld c, [hl]
+ ret c
+
+ xor a
+ ld c, a
+ ret
+
+.TimeOfDayTable: ; c012
+ db MORN_F, MORN
+ db DAY_F, DAY
+ db NITE_F, NITE
+ db NITE_F, NITE
+ db -1
diff --git a/engine/routines/consumehelditem.asm b/engine/routines/consumehelditem.asm
new file mode 100644
index 000000000..a6f7766fb
--- /dev/null
+++ b/engine/routines/consumehelditem.asm
@@ -0,0 +1,80 @@
+ConsumeHeldItem: ; 27192
+ push hl
+ push de
+ push bc
+ ld a, [hBattleTurn]
+ and a
+ ld hl, OTPartyMon1Item
+ ld de, EnemyMonItem
+ ld a, [CurOTMon]
+ jr z, .theirturn
+ ld hl, PartyMon1Item
+ ld de, BattleMonItem
+ ld a, [CurBattleMon]
+
+.theirturn
+ push hl
+ push af
+ ld a, [de]
+ ld b, a
+ farcall GetItemHeldEffect
+ ld hl, .ConsumableEffects
+.loop
+ ld a, [hli]
+ cp b
+ jr z, .ok
+ inc a
+ jr nz, .loop
+ pop af
+ pop hl
+ pop bc
+ pop de
+ pop hl
+ ret
+
+.ok
+ xor a
+ ld [de], a
+ pop af
+ pop hl
+ call GetPartyLocation
+ ld a, [hBattleTurn]
+ and a
+ jr nz, .ourturn
+ ld a, [wBattleMode]
+ dec a
+ jr z, .done
+
+.ourturn
+ ld [hl], $0
+
+.done
+ pop bc
+ pop de
+ pop hl
+ ret
+
+.ConsumableEffects: ; 271de
+; Consumable items?
+ db HELD_BERRY
+ db HELD_2
+ db HELD_5
+ db HELD_HEAL_POISON
+ db HELD_HEAL_FREEZE
+ db HELD_HEAL_BURN
+ db HELD_HEAL_SLEEP
+ db HELD_HEAL_PARALYZE
+ db HELD_HEAL_STATUS
+ db HELD_30
+ db HELD_ATTACK_UP
+ db HELD_DEFENSE_UP
+ db HELD_SPEED_UP
+ db HELD_SP_ATTACK_UP
+ db HELD_SP_DEFENSE_UP
+ db HELD_ACCURACY_UP
+ db HELD_EVASION_UP
+ db HELD_38
+ db HELD_71
+ db HELD_ESCAPE
+ db HELD_CRITICAL_UP
+ db -1
diff --git a/engine/routines/correcterrorsinplayerparty.asm b/engine/routines/correcterrorsinplayerparty.asm
new file mode 100644
index 000000000..2fa98a545
--- /dev/null
+++ b/engine/routines/correcterrorsinplayerparty.asm
@@ -0,0 +1,229 @@
+CorrectErrorsInPlayerParty: ; unreferenced
+ ld hl, PartyCount
+ ld a, [hl]
+ and a
+ ret z
+
+ cp PARTY_LENGTH + 1
+ jr c, .party_length_okay
+ ld a, PARTY_LENGTH
+ ld [hl], a
+.party_length_okay
+ inc hl
+
+ ld b, a
+ ld c, 0
+.loop1
+ ld a, [hl]
+ and a
+ jr z, .invalid_species
+ cp NUM_POKEMON + 1
+ jr z, .invalid_species
+ cp EGG + 1
+ jr c, .next_species
+
+.invalid_species
+ ld [hl], SMEARGLE
+ push hl
+ push bc
+ ld a, c
+ ld hl, PartyMon1Species
+ call GetPartyLocation
+ ld [hl], SMEARGLE
+ pop bc
+ pop hl
+
+.next_species
+ inc hl
+ inc c
+ dec b
+ jr nz, .loop1
+ ld [hl], $ff
+
+ ld hl, PartyMon1
+ ld a, [PartyCount]
+ ld d, a
+ ld e, 0
+.loop2
+ push de
+ push hl
+ ld b, h
+ ld c, l
+ ld a, [hl]
+ and a
+ jr z, .invalid_species_2
+ cp NUM_POKEMON + 1
+ jr c, .check_level
+
+.invalid_species_2
+ ld [hl], SMEARGLE
+ push de
+ ld d, 0
+ ld hl, PartySpecies
+ add hl, de
+ pop de
+ ld a, SMEARGLE
+ ld [hl], a
+
+.check_level
+ ld [CurSpecies], a
+ call GetBaseData
+ ld hl, MON_LEVEL
+ add hl, bc
+ ld a, [hl]
+ cp MIN_LEVEL
+ ld a, MIN_LEVEL
+ jr c, .invalid_level
+ ld a, [hl]
+ cp MAX_LEVEL
+ jr c, .load_level
+ ld a, MAX_LEVEL
+.invalid_level
+ ld [hl], a
+.load_level
+ ld [CurPartyLevel], a
+
+ ld hl, MON_MAXHP
+ add hl, bc
+ ld d, h
+ ld e, l
+ ld hl, MON_STAT_EXP - 1
+ add hl, bc
+ ld b, $1
+ predef CalcPkmnStats
+ pop hl
+ ld bc, PARTYMON_STRUCT_LENGTH
+ add hl, bc
+ pop de
+ inc e
+ dec d
+ jr nz, .loop2
+
+ ld de, PartyMonNicknames
+ ld a, [PartyCount]
+ ld b, a
+ ld c, 0
+.loop3
+ push bc
+ call .GetLengthOfStringWith6CharCap
+ push de
+ farcall CheckStringForErrors
+ pop hl
+ pop bc
+ jr nc, .valid_nickname
+
+ push bc
+ push hl
+ ld hl, PartySpecies
+ push bc
+ ld b, 0
+ add hl, bc
+ pop bc
+ ld a, [hl]
+ cp EGG
+ ld hl, .TAMAGO
+ jr z, .got_nickname
+ ld [wd265], a
+ call GetPokemonName
+ ld hl, StringBuffer1
+.got_nickname
+ pop de
+ ld bc, PKMN_NAME_LENGTH
+ call CopyBytes
+ pop bc
+
+.valid_nickname
+ inc c
+ dec b
+ jr nz, .loop3
+
+ ld de, PartyMonOT
+ ld a, [PartyCount]
+ ld b, a
+ ld c, 0
+.loop4
+ push bc
+ call .GetLengthOfStringWith6CharCap
+ push de
+ farcall CheckStringForErrors
+ pop hl
+ jr nc, .valid_ot_name
+ ld d, h
+ ld e, l
+ ld hl, PlayerName
+ ld bc, NAME_LENGTH
+ call CopyBytes
+.valid_ot_name
+ pop bc
+ inc c
+ dec b
+ jr nz, .loop4
+
+ ld hl, PartyMon1Moves
+ ld a, [PartyCount]
+ ld b, a
+.loop5
+ push hl
+ ld c, NUM_MOVES
+ ld a, [hl]
+ and a
+ jr z, .invalid_move
+ cp NUM_ATTACKS + 1
+ jr c, .moves_loop
+.invalid_move
+ ld [hl], POUND
+
+.moves_loop
+ ld a, [hl]
+ and a
+ jr z, .fill_invalid_moves
+ cp NUM_ATTACKS + 1
+ jr c, .next_move
+
+.fill_invalid_moves
+ xor a
+ ld [hli], a
+ dec c
+ jr nz, .fill_invalid_moves
+ jr .next_pokemon
+
+.next_move
+ inc hl
+ dec c
+ jr nz, .moves_loop
+
+.next_pokemon
+ pop hl
+ push bc
+ ld bc, PARTYMON_STRUCT_LENGTH
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .loop5
+ ret
+; 13b6b
+
+.TAMAGO: ; 13b6b
+ db "タマゴ@@@"
+; 13b71
+
+.GetLengthOfStringWith6CharCap: ; 13b71
+ push de
+ ld c, 1
+ ld b, NAME_LENGTH_JAPANESE
+.search_loop
+ ld a, [de]
+ cp "@"
+ jr z, .done
+ inc de
+ inc c
+ dec b
+ jr nz, .search_loop
+ dec c
+ dec de
+ ld a, "@"
+ ld [de], a
+.done
+ pop de
+ ret
+; 13b87
diff --git a/engine/routines/drawkrispackgfx.asm b/engine/routines/drawkrispackgfx.asm
new file mode 100644
index 000000000..f71e43db8
--- /dev/null
+++ b/engine/routines/drawkrispackgfx.asm
@@ -0,0 +1,20 @@
+DrawKrisPackGFX: ; 48e81
+ ld hl, PackFGFXPointers
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld e, a
+ ld d, [hl]
+ ld hl, VTiles2 tile $50
+ lb bc, BANK(PackFGFX), 15
+ call Request2bpp
+ ret
+
+PackFGFXPointers: ; 48e93
+ dw PackFGFX + (15 tiles) * 1
+ dw PackFGFX + (15 tiles) * 3
+ dw PackFGFX + (15 tiles) * 0
+ dw PackFGFX + (15 tiles) * 2
+
+PackFGFX: ; 48e9b
+INCBIN "gfx/pack/pack_f.2bpp"
diff --git a/engine/routines/emptyallsrambanks.asm b/engine/routines/emptyallsrambanks.asm
new file mode 100644
index 000000000..aa4b28e0d
--- /dev/null
+++ b/engine/routines/emptyallsrambanks.asm
@@ -0,0 +1,19 @@
+EmptyAllSRAMBanks: ; 4cf1f
+ ld a, $0
+ call .EmptyBank
+ ld a, $1
+ call .EmptyBank
+ ld a, $2
+ call .EmptyBank
+ ld a, $3
+ call .EmptyBank
+ ret
+
+.EmptyBank: ; 4cf34
+ call GetSRAMBank
+ ld hl, SRAM_Begin
+ ld bc, SRAM_End - SRAM_Begin
+ xor a
+ call ByteFill
+ call CloseSRAM
+ ret
diff --git a/engine/routines/flagpredef.asm b/engine/routines/flagpredef.asm
new file mode 100644
index 000000000..bd4f37882
--- /dev/null
+++ b/engine/routines/flagpredef.asm
@@ -0,0 +1,70 @@
+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.
+
+; For longer flag arrays, see FlagAction.
+
+ push hl
+ push bc
+
+; Divide by 8 to get the byte we want.
+ push bc
+ srl c
+ srl c
+ srl c
+ ld b, 0
+ add hl, bc
+ pop bc
+
+; Which bit we want from the byte
+ ld a, c
+ and 7
+ ld c, a
+
+; Shift left until we can mask the bit
+ ld a, 1
+ jr z, .shifted
+.shift
+ add a
+ dec c
+ jr nz, .shift
+.shifted
+ ld c, a
+
+; What are we doing to this flag?
+ dec b
+ jr z, .set ; 1
+ dec b
+ jr z, .check ; 2
+
+.reset
+ ld a, c
+ cpl
+ and [hl]
+ ld [hl], a
+ jr .done
+
+.set
+ ld a, [hl]
+ or c
+ ld [hl], a
+ jr .done
+
+.check
+ ld a, d
+ cp 0
+ jr nz, .farcheck
+
+ ld a, [hl]
+ and c
+ jr .done
+
+.farcheck
+ call GetFarByte
+ and c
+
+.done
+ pop bc
+ pop hl
+ ld c, a
+ ret
diff --git a/engine/routines/getbreedmonlevelgrowth.asm b/engine/routines/getbreedmonlevelgrowth.asm
new file mode 100644
index 000000000..b029043d6
--- /dev/null
+++ b/engine/routines/getbreedmonlevelgrowth.asm
@@ -0,0 +1,27 @@
+GetBreedMon1LevelGrowth: ; e698
+ ld hl, wBreedMon1Stats
+ ld de, TempMon
+ ld bc, BOXMON_STRUCT_LENGTH
+ call CopyBytes
+ callfar CalcLevel
+ ld a, [wBreedMon1Level]
+ ld b, a
+ ld a, d
+ ld e, a
+ sub b
+ ld d, a
+ ret
+
+GetBreedMon2LevelGrowth: ; e6b3
+ ld hl, wBreedMon2Stats
+ ld de, TempMon
+ ld bc, BOXMON_STRUCT_LENGTH
+ call CopyBytes
+ callfar CalcLevel
+ ld a, [wBreedMon2Level]
+ ld b, a
+ ld a, d
+ ld e, a
+ sub b
+ ld d, a
+ ret
diff --git a/engine/routines/getpokeballwobble.asm b/engine/routines/getpokeballwobble.asm
new file mode 100755
index 000000000..7fb4d3e38
--- /dev/null
+++ b/engine/routines/getpokeballwobble.asm
@@ -0,0 +1,88 @@
+GetPokeBallWobble: ; f971 (3:7971)
+; Returns whether a Poke Ball will wobble in the catch animation.
+; Whether a Pokemon is caught is determined beforehand.
+
+ push de
+
+ ld a, [rSVBK]
+ ld d, a
+ push de
+
+ ld a, 1 ; BANK(Buffer2)
+ ld [rSVBK], a
+
+ ld a, [Buffer2]
+ inc a
+ ld [Buffer2], a
+
+; Wobble up to 3 times.
+ cp 3 + 1
+ jr z, .finished
+
+ ld a, [wWildMon]
+ and a
+ ld c, 0 ; next
+ jr nz, .done
+
+ ld hl, .WobbleProbabilities
+ ld a, [Buffer1]
+ ld b, a
+.loop
+ ld a, [hli]
+ cp b
+ jr nc, .checkwobble
+ inc hl
+ jr .loop
+
+.checkwobble
+ ld b, [hl]
+ call Random
+ cp b
+ ld c, 0 ; next
+ jr c, .done
+ ld c, 2 ; escaped
+ jr .done
+
+.finished
+ ld a, [wWildMon]
+ and a
+ ld c, 1 ; caught
+ jr nz, .done
+ ld c, 2 ; escaped
+
+.done
+ pop de
+ ld e, a
+ ld a, d
+ ld [rSVBK], a
+ ld a, e
+ pop de
+ ret
+
+.WobbleProbabilities: ; f9ba
+; catch rate, chance of wobbling / 255
+; nLeft/255 = (nRight/255) ** 4
+ db 1, 63
+ db 2, 75
+ db 3, 84
+ db 4, 90
+ db 5, 95
+ db 7, 103
+ db 10, 113
+ db 15, 126
+ db 20, 134
+ db 30, 149
+ db 40, 160
+ db 50, 169
+ db 60, 177
+ db 80, 191
+ db 100, 201
+ db 120, 211
+ db 140, 220
+ db 160, 227
+ db 180, 234
+ db 200, 240
+ db 220, 246
+ db 240, 251
+ db 254, 253
+ db 255, 255
diff --git a/engine/routines/getsquareroot.asm b/engine/routines/getsquareroot.asm
new file mode 100644
index 000000000..009d9f4fe
--- /dev/null
+++ b/engine/routines/getsquareroot.asm
@@ -0,0 +1,30 @@
+GetSquareRoot: ; 13b87
+; Return the square root of de in b.
+
+; Rather than calculating the result, we take the index of the
+; first value in a table of squares that isn't lower than de.
+
+ ld hl, .Squares
+ ld b, 0
+.loop
+; Make sure we don't go past the end of the table.
+ inc b
+ ld a, b
+ cp $ff
+ ret z
+
+; Iterate over the table until b**2 >= de.
+ ld a, [hli]
+ sub e
+ ld a, [hli]
+ sbc d
+
+ jr c, .loop
+ ret
+
+.Squares: ; 13b98
+root set 1
+ rept $ff
+ dw root*root
+root set root+1
+ endr
diff --git a/engine/routines/initlist.asm b/engine/routines/initlist.asm
new file mode 100644
index 000000000..e2b7235ab
--- /dev/null
+++ b/engine/routines/initlist.asm
@@ -0,0 +1,54 @@
+InitList: ; 50db9
+ ld a, [wInitListType]
+
+ cp INIT_ENEMYOT_LIST
+ jr nz, .check_party_ot_name
+ ld hl, OTPartyCount
+ ld de, OTPartyMonOT
+ ld a, ENEMY_OT_NAME
+ jr .done
+
+.check_party_ot_name
+ cp INIT_PLAYEROT_LIST
+ jr nz, .check_mon_name
+ ld hl, PartyCount
+ ld de, PartyMonOT
+ ld a, PARTY_OT_NAME
+ jr .done
+
+.check_mon_name
+ cp INIT_MON_LIST
+ jr nz, .check_item_name
+ ld hl, CurMart
+ ld de, PokemonNames
+ ld a, PKMN_NAME
+ jr .done
+
+.check_item_name
+ cp INIT_BAG_ITEM_LIST
+ jr nz, .check_ob_item_name
+ ld hl, NumItems
+ ld de, ItemNames
+ ld a, ITEM_NAME
+ jr .done
+
+.check_ob_item_name
+ ld hl, CurMart
+ ld de, ItemNames
+ ld a, ITEM_NAME
+.done
+ ld [wNamedObjectTypeBuffer], a
+ ld a, l
+ ld [wListPointer], a
+ ld a, h
+ ld [wListPointer + 1], a
+ ld a, e
+ ld [wUnusedD102], a
+ ld a, d
+ ld [wUnusedD102 + 1], a
+ ld bc, ItemAttributes
+ ld a, c
+ ld [wItemAttributesPtr], a
+ ld a, b
+ ld [wItemAttributesPtr + 1], a
+ ret
diff --git a/engine/routines/knowsmove.asm b/engine/routines/knowsmove.asm
new file mode 100644
index 000000000..4ec3da347
--- /dev/null
+++ b/engine/routines/knowsmove.asm
@@ -0,0 +1,25 @@
+KnowsMove: ; f9ea
+ ld a, MON_MOVES
+ call GetPartyParamLocation
+ ld a, [wPutativeTMHMMove]
+ ld b, a
+ ld c, NUM_MOVES
+.loop
+ ld a, [hli]
+ cp b
+ jr z, .knows_move
+ dec c
+ jr nz, .loop
+ and a
+ ret
+
+.knows_move
+ ld hl, .Text_knows
+ call PrintText
+ scf
+ ret
+
+.Text_knows: ; 0xfa06
+ ; knows @ .
+ text_jump UnknownText_0x1c5ea8
+ db "@"
diff --git a/engine/routines/kurt_selectquantity_interpretjoypad.asm b/engine/routines/kurt_selectquantity_interpretjoypad.asm
new file mode 100644
index 000000000..12a43e325
--- /dev/null
+++ b/engine/routines/kurt_selectquantity_interpretjoypad.asm
@@ -0,0 +1,4 @@
+Kurt_SelectQuantity_InterpretJoypad: ; 27a28
+ call BuySellToss_InterpretJoypad
+ ld b, a
+ ret
diff --git a/engine/routines/leveluphappinessmod.asm b/engine/routines/leveluphappinessmod.asm
new file mode 100644
index 000000000..c253e8872
--- /dev/null
+++ b/engine/routines/leveluphappinessmod.asm
@@ -0,0 +1,20 @@
+LevelUpHappinessMod: ; 2709e
+ ld a, [CurPartyMon]
+ ld hl, PartyMon1CaughtLocation
+ call GetPartyLocation
+ ld a, [hl]
+ and $7f
+ ld d, a
+ ld a, [MapGroup]
+ ld b, a
+ ld a, [MapNumber]
+ ld c, a
+ call GetWorldMapLocation
+ cp d
+ ld c, HAPPINESS_GAINLEVEL
+ jr nz, .ok
+ ld c, HAPPINESS_GAINLEVELATHOME
+
+.ok
+ callfar ChangeHappiness
+ ret
diff --git a/engine/routines/loadmappart.asm b/engine/routines/loadmappart.asm
new file mode 100644
index 000000000..2184ebf7e
--- /dev/null
+++ b/engine/routines/loadmappart.asm
@@ -0,0 +1,36 @@
+_LoadMapPart:: ; 4d15b
+ ld hl, wMisc
+ ld a, [wMetatileStandingY]
+ and a
+ jr z, .top_row
+ ld bc, WMISC_WIDTH * 2
+ add hl, bc
+
+.top_row
+ ld a, [wMetatileStandingX]
+ and a
+ jr z, .left_column
+ inc hl
+ inc hl
+
+.left_column
+ decoord 0, 0
+ ld b, SCREEN_HEIGHT
+.loop
+ ld c, SCREEN_WIDTH
+.loop2
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .loop2
+ ld a, l
+ add 4
+ ld l, a
+ jr nc, .carry
+ inc h
+
+.carry
+ dec b
+ jr nz, .loop
+ ret
diff --git a/engine/routines/loadpushoam.asm b/engine/routines/loadpushoam.asm
new file mode 100644
index 000000000..6fcccbcae
--- /dev/null
+++ b/engine/routines/loadpushoam.asm
@@ -0,0 +1,21 @@
+LoadPushOAM:: ; 4031
+ ld c, hPushOAM - $ff00
+ ld b, .PushOAMEnd - .PushOAM
+ ld hl, .PushOAM
+.loop
+ ld a, [hli]
+ ld [$ff00+c], a
+ inc c
+ dec b
+ jr nz, .loop
+ ret
+
+.PushOAM: ; 403f
+ ld a, Sprites / $100
+ ld [rDMA], a
+ ld a, (SpritesEnd - Sprites) / 4 ; 40
+.pushoam_loop
+ dec a
+ jr nz, .pushoam_loop
+ ret
+.PushOAMEnd
diff --git a/engine/routines/newpokedexentry.asm b/engine/routines/newpokedexentry.asm
new file mode 100644
index 000000000..acf9fca7b
--- /dev/null
+++ b/engine/routines/newpokedexentry.asm
@@ -0,0 +1,52 @@
+NewPokedexEntry: ; fb877
+ ld a, [hMapAnims]
+ push af
+ xor a
+ ld [hMapAnims], a
+ call LowVolume
+ call ClearBGPalettes
+ call ClearTileMap
+ call UpdateSprites
+ call ClearSprites
+ ld a, [wPokedexStatus]
+ push af
+ ld a, [hSCX]
+ add $5
+ ld [hSCX], a
+ xor a
+ ld [wPokedexStatus], a
+ farcall _NewPokedexEntry
+ call WaitPressAorB_BlinkCursor
+ ld a, $1
+ ld [wPokedexStatus], a
+ farcall DisplayDexEntry
+ call WaitPressAorB_BlinkCursor
+ pop af
+ ld [wPokedexStatus], a
+ call MaxVolume
+ call RotateThreePalettesRight
+ ld a, [hSCX]
+ add -5 ; 251 ; NUM_POKEMON
+ ld [hSCX], a
+ call .ReturnFromDexRegistration
+ pop af
+ ld [hMapAnims], a
+ ret
+; fb8c8
+
+.ReturnFromDexRegistration: ; fb8c8
+ call ClearTileMap
+ call LoadFontsExtra
+ call LoadStandardFont
+ farcall Pokedex_PlaceFrontpicTopLeftCorner
+ call WaitBGMap2
+ farcall GetEnemyMonDVs
+ ld a, [hli]
+ ld [TempMonDVs], a
+ ld a, [hl]
+ ld [TempMonDVs + 1], a
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+ call GetSGBLayout
+ call SetPalettes
+ ret
+; fb8f1
diff --git a/engine/routines/phonering_copytilemapatonce.asm b/engine/routines/phonering_copytilemapatonce.asm
new file mode 100644
index 000000000..2ffa688a9
--- /dev/null
+++ b/engine/routines/phonering_copytilemapatonce.asm
@@ -0,0 +1,80 @@
+PhoneRing_CopyTilemapAtOnce: ; 4d188
+ ld a, [hCGB]
+ and a
+ jp z, WaitBGMap
+ ld a, [wSpriteUpdatesEnabled]
+ cp $0
+ jp z, WaitBGMap
+
+; What follows is a modified version of CopyTilemapAtOnce.
+ ld a, [hBGMapMode]
+ push af
+ xor a
+ ld [hBGMapMode], a
+ ld a, [hMapAnims]
+ push af
+ xor a
+ ld [hMapAnims], a
+.wait
+ ld a, [rLY]
+ cp $8f
+ jr c, .wait
+
+ di
+ ld a, BANK(VBGMap2)
+ ld [rVBK], a
+ hlcoord 0, 0, AttrMap
+ call .CopyTilemapAtOnce
+ ld a, BANK(VBGMap0)
+ ld [rVBK], a
+ hlcoord 0, 0
+ call .CopyTilemapAtOnce
+.wait2
+ ld a, [rLY]
+ cp $8f
+ jr c, .wait2
+ ei
+
+ pop af
+ ld [hMapAnims], a
+ pop af
+ ld [hBGMapMode], a
+ ret
+
+.CopyTilemapAtOnce: ; 4d1cb
+ ld [hSPBuffer], sp
+ ld sp, hl
+ ld a, [hBGMapAddress + 1]
+ ld h, a
+ ld l, 0
+ ld a, SCREEN_HEIGHT
+ ld [hTilesPerCycle], a
+ ld b, 1 << 1 ; not in v/hblank
+ ld c, rSTAT % $100
+
+.loop
+rept SCREEN_WIDTH / 2
+ pop de
+.loop\@
+ ld a, [$ff00+c]
+ and b
+ jr nz, .loop\@
+ ld [hl], e
+ inc l
+ ld [hl], d
+ inc l
+endr
+
+ ld de, BG_MAP_WIDTH - SCREEN_WIDTH
+ add hl, de
+ ld a, [hTilesPerCycle]
+ dec a
+ ld [hTilesPerCycle], a
+ jr nz, .loop
+
+ ld a, [hSPBuffer]
+ ld l, a
+ ld a, [hSPBuffer + 1]
+ ld h, a
+ ld sp, hl
+ ret
diff --git a/engine/routines/placegraphic.asm b/engine/routines/placegraphic.asm
new file mode 100644
index 000000000..d72364776
--- /dev/null
+++ b/engine/routines/placegraphic.asm
@@ -0,0 +1,56 @@
+PlaceGraphic: ; 2ef6e
+; Fill wBoxAlignment-aligned box width b height c
+; with iterating tile starting from hGraphicStartTile at hl.
+; Predef $13
+
+ ld de, SCREEN_WIDTH
+
+ ld a, [wBoxAlignment]
+ and a
+ jr nz, .right
+
+ ld a, [hGraphicStartTile]
+.x1
+ push bc
+ push hl
+
+.y1
+ ld [hl], a
+ add hl, de
+ inc a
+ dec c
+ jr nz, .y1
+
+ pop hl
+ inc hl
+ pop bc
+ dec b
+ jr nz, .x1
+ ret
+
+.right
+; Right-aligned.
+ push bc
+ ld b, 0
+ dec c
+ add hl, bc
+ pop bc
+
+ ld a, [hGraphicStartTile]
+.x2
+ push bc
+ push hl
+
+.y2
+ ld [hl], a
+ add hl, de
+ inc a
+ dec c
+ jr nz, .y2
+
+ pop hl
+ dec hl
+ pop bc
+ dec b
+ jr nz, .x2
+ ret
diff --git a/engine/routines/placewaitingtext.asm b/engine/routines/placewaitingtext.asm
new file mode 100644
index 000000000..37fc2a056
--- /dev/null
+++ b/engine/routines/placewaitingtext.asm
@@ -0,0 +1,24 @@
+PlaceWaitingText:: ; 4000
+ hlcoord 3, 10
+ ld b, 1
+ ld c, 11
+
+ ld a, [wBattleMode]
+ and a
+ jr z, .notinbattle
+
+ call TextBox
+ jr .proceed
+
+.notinbattle
+ predef Predef_LinkTextbox
+
+.proceed
+ hlcoord 4, 11
+ ld de, .Waiting
+ call PlaceString
+ ld c, 50
+ jp DelayFrames
+
+.Waiting: ; 4025
+ db "Waiting...!@"
diff --git a/engine/routines/playslowcry.asm b/engine/routines/playslowcry.asm
new file mode 100644
index 000000000..3cc347a55
--- /dev/null
+++ b/engine/routines/playslowcry.asm
@@ -0,0 +1,31 @@
+PlaySlowCry: ; fb841
+ ld a, [ScriptVar]
+ call LoadCryHeader
+ jr c, .done
+
+ ld hl, CryPitch
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld bc, -$140
+ add hl, bc
+ ld a, l
+ ld [CryPitch], a
+ ld a, h
+ ld [CryPitch + 1], a
+ ld hl, CryLength
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld bc, $60
+ add hl, bc
+ ld a, l
+ ld [CryLength], a
+ ld a, h
+ ld [CryLength + 1], a
+ farcall _PlayCryHeader
+ call WaitSFX
+
+.done
+ ret
+; fb877
diff --git a/engine/routines/printhoursmins.asm b/engine/routines/printhoursmins.asm
new file mode 100644
index 000000000..50117188c
--- /dev/null
+++ b/engine/routines/printhoursmins.asm
@@ -0,0 +1,64 @@
+Function1dd6a9: ; 1dd6a9
+; XXX
+ ld a, b
+ ld b, c
+ ld c, a
+ push bc
+ push de
+ ld hl, sp+$2
+ ld d, h
+ ld e, l
+ pop hl
+ lb bc, PRINTNUM_LEADINGZEROS | 2, 5
+ call PrintNum
+ pop bc
+ ret
+
+PrintHoursMins: ; 1dd6bb (77:56bb)
+; Hours in b, minutes in c
+ ld a, b
+ cp 12
+ push af
+ jr c, .AM
+ jr z, .PM
+ sub 12
+ jr .PM
+.AM:
+ or a
+ jr nz, .PM
+ ld a, 12
+.PM:
+ ld b, a
+; Crazy stuff happening with the stack
+ push bc
+ ld hl, sp+$1
+ push de
+ push hl
+ pop de
+ pop hl
+ ld [hl], " "
+ lb bc, 1, 2
+ call PrintNum
+ ld [hl], ":"
+ inc hl
+ ld d, h
+ ld e, l
+ ld hl, sp+$0
+ push de
+ push hl
+ pop de
+ pop hl
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+ call PrintNum
+ pop bc
+ ld de, String_AM
+ pop af
+ jr c, .place_am_pm
+ ld de, String_PM
+.place_am_pm
+ inc hl
+ call PlaceString
+ ret
+
+String_AM: db "AM@" ; 1dd6fc
+String_PM: db "PM@" ; 1dd6ff
diff --git a/engine/routines/returntobattle_useball.asm b/engine/routines/returntobattle_useball.asm
new file mode 100644
index 000000000..e6e33f900
--- /dev/null
+++ b/engine/routines/returntobattle_useball.asm
@@ -0,0 +1,19 @@
+_ReturnToBattle_UseBall: ; 2715c
+ call ClearBGPalettes
+ call ClearTileMap
+ ld a, [BattleType]
+ cp BATTLETYPE_TUTORIAL
+ jr z, .gettutorialbackpic
+ farcall GetBattleMonBackpic
+ jr .continue
+
+.gettutorialbackpic
+ farcall GetTrainerBackpic
+.continue
+ farcall GetEnemyMonFrontpic
+ farcall _LoadBattleFontsHPBar
+ call GetMemSGBLayout
+ call CloseWindow
+ call LoadStandardMenuDataHeader
+ call WaitBGMap
+ jp SetPalettes
diff --git a/engine/routines/savemenu_copytilemapatonce.asm b/engine/routines/savemenu_copytilemapatonce.asm
new file mode 100644
index 000000000..de7cbaa8f
--- /dev/null
+++ b/engine/routines/savemenu_copytilemapatonce.asm
@@ -0,0 +1,77 @@
+SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45)
+ ld a, [hCGB]
+ and a
+ jp z, WaitBGMap
+
+; The following is a modified version of CopyTilemapAtOnce.
+ ld a, [hBGMapMode]
+ push af
+ xor a
+ ld [hBGMapMode], a
+ ld a, [hMapAnims]
+ push af
+ xor a
+ ld [hMapAnims], a
+.WaitLY:
+ ld a, [rLY]
+ cp $60
+ jr c, .WaitLY
+
+ di
+ ld a, BANK(VBGMap2)
+ ld [rVBK], a
+ hlcoord 0, 0, AttrMap
+ call .CopyTilemapAtOnce
+ ld a, BANK(VBGMap0)
+ ld [rVBK], a
+ hlcoord 0, 0
+ call .CopyTilemapAtOnce
+.WaitLY2:
+ ld a, [rLY]
+ cp $60
+ jr c, .WaitLY2
+ ei
+
+ pop af
+ ld [hMapAnims], a
+ pop af
+ ld [hBGMapMode], a
+ ret
+
+.CopyTilemapAtOnce: ; 4cf80 (13:4f80)
+ ld [hSPBuffer], sp ; $ffd9
+ ld sp, hl
+ ld a, [hBGMapAddress + 1]
+ ld h, a
+ ld l, 0
+ ld a, SCREEN_HEIGHT
+ ld [hTilesPerCycle], a
+ ld b, 1 << 1
+ ld c, rSTAT % $100
+
+.loop
+rept SCREEN_WIDTH / 2
+ pop de
+.loop\@
+ ld a, [$ff00+c]
+ and b
+ jr nz, .loop\@
+ ld [hl], e
+ inc l
+ ld [hl], d
+ inc l
+endr
+
+ ld de, BG_MAP_WIDTH - SCREEN_WIDTH
+ add hl, de
+ ld a, [hTilesPerCycle]
+ dec a
+ ld [hTilesPerCycle], a
+ jr nz, .loop
+
+ ld a, [hSPBuffer]
+ ld l, a
+ ld a, [hSPBuffer + 1]
+ ld h, a
+ ld sp, hl
+ ret
diff --git a/engine/sine.asm b/engine/routines/sine.asm
index 89a905d2e..89a905d2e 100755
--- a/engine/sine.asm
+++ b/engine/routines/sine.asm
diff --git a/engine/routines/switchpartymons.asm b/engine/routines/switchpartymons.asm
new file mode 100644
index 000000000..cde9c82b2
--- /dev/null
+++ b/engine/routines/switchpartymons.asm
@@ -0,0 +1,145 @@
+_SwitchPartyMons:
+ ld a, [wd0e3]
+ dec a
+ ld [Buffer3], a
+ ld b, a
+ ld a, [wMenuCursorY]
+ dec a
+ ld [Buffer2], a
+ cp b
+ jr z, .skip
+ call .SwapMonAndMail
+ ld a, [Buffer3]
+ call .ClearSprite
+ ld a, [Buffer2]
+ call .ClearSprite
+.skip
+ ret
+
+.ClearSprite: ; 50f34 (14:4f34)
+ push af
+ hlcoord 0, 1
+ ld bc, 2 * SCREEN_WIDTH
+ call AddNTimes
+ ld bc, 2 * SCREEN_WIDTH
+ ld a, " "
+ call ByteFill
+ pop af
+ ld hl, Sprites
+ ld bc, $10
+ call AddNTimes
+ ld de, $4
+ ld c, $4
+.gfx_loop
+ ld [hl], $a0
+ add hl, de
+ dec c
+ jr nz, .gfx_loop
+ ld de, SFX_SWITCH_POKEMON
+ call WaitPlaySFX
+ ret
+
+.SwapMonAndMail: ; 50f62 (14:4f62)
+ push hl
+ push de
+ push bc
+ ld bc, PartySpecies
+ ld a, [Buffer2]
+ ld l, a
+ ld h, $0
+ add hl, bc
+ ld d, h
+ ld e, l
+ ld a, [Buffer3]
+ ld l, a
+ ld h, $0
+ add hl, bc
+ ld a, [hl]
+ push af
+ ld a, [de]
+ ld [hl], a
+ pop af
+ ld [de], a
+ ld a, [Buffer2]
+ ld hl, PartyMon1Species
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ push hl
+ ld de, wd002
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call CopyBytes
+ ld a, [Buffer3]
+ ld hl, PartyMon1
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call AddNTimes
+ pop de
+ push hl
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call CopyBytes
+ pop de
+ ld hl, wd002
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call CopyBytes
+ ld a, [Buffer2]
+ ld hl, PartyMonOT
+ call SkipNames
+ push hl
+ call .CopyNameTowd002
+ ld a, [Buffer3]
+ ld hl, PartyMonOT
+ call SkipNames
+ pop de
+ push hl
+ call .CopyName
+ pop de
+ ld hl, wd002
+ call .CopyName
+ ld hl, PartyMonNicknames
+ ld a, [Buffer2]
+ call SkipNames
+ push hl
+ call .CopyNameTowd002
+ ld hl, PartyMonNicknames
+ ld a, [Buffer3]
+ call SkipNames
+ pop de
+ push hl
+ call .CopyName
+ pop de
+ ld hl, wd002
+ call .CopyName
+ ld hl, sPartyMail
+ ld a, [Buffer2]
+ ld bc, MAIL_STRUCT_LENGTH
+ call AddNTimes
+ push hl
+ ld de, wd002
+ ld bc, MAIL_STRUCT_LENGTH
+ ld a, BANK(sPartyMail)
+ call GetSRAMBank
+ call CopyBytes
+ ld hl, sPartyMail
+ ld a, [Buffer3]
+ ld bc, MAIL_STRUCT_LENGTH
+ call AddNTimes
+ pop de
+ push hl
+ ld bc, MAIL_STRUCT_LENGTH
+ call CopyBytes
+ pop de
+ ld hl, wd002
+ ld bc, MAIL_STRUCT_LENGTH
+ call CopyBytes
+ call CloseSRAM
+ pop bc
+ pop de
+ pop hl
+ ret
+
+.CopyNameTowd002: ; 51036 (14:5036)
+ ld de, wd002
+
+.CopyName: ; 51039 (14:5039)
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ ret
diff --git a/engine/routines/townmap_convertlinebreakcharacters.asm b/engine/routines/townmap_convertlinebreakcharacters.asm
new file mode 100644
index 000000000..f08b436c9
--- /dev/null
+++ b/engine/routines/townmap_convertlinebreakcharacters.asm
@@ -0,0 +1,21 @@
+TownMap_ConvertLineBreakCharacters: ; 1de2c5
+ ld hl, StringBuffer1
+.loop
+ ld a, [hl]
+ cp "@"
+ jr z, .end
+ cp "%"
+ jr z, .line_break
+ cp "¯"
+ jr z, .line_break
+ inc hl
+ jr .loop
+
+.line_break
+ ld [hl], "<LNBRK>"
+
+.end
+ ld de, StringBuffer1
+ hlcoord 9, 0
+ call PlaceString
+ ret
diff --git a/engine/routines/trademonfrontpic.asm b/engine/routines/trademonfrontpic.asm
new file mode 100644
index 000000000..3a38688d7
--- /dev/null
+++ b/engine/routines/trademonfrontpic.asm
@@ -0,0 +1,38 @@
+GetTrademonFrontpic: ; 4d7fd
+ ld a, [wOTTrademonSpecies]
+ ld hl, wOTTrademonDVs
+ ld de, VTiles2
+ push de
+ push af
+ predef GetUnownLetter
+ pop af
+ ld [CurPartySpecies], a
+ ld [CurSpecies], a
+ call GetBaseData
+ pop de
+ predef GetAnimatedFrontpicPredef
+ ret
+
+AnimateTrademonFrontpic: ; 4d81e
+ ld a, [wOTTrademonSpecies]
+ call IsAPokemon
+ ret c
+ farcall ShowOTTrademonStats
+ ld a, [wOTTrademonSpecies]
+ ld [CurPartySpecies], a
+ ld a, [wOTTrademonDVs]
+ ld [TempMonDVs], a
+ ld a, [wOTTrademonDVs + 1]
+ ld [TempMonDVs + 1], a
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
+ call GetSGBLayout
+ ld a, %11100100 ; 3,2,1,0
+ call DmgToCgbBGPals
+ farcall TradeAnim_ShowGetmonFrontpic
+ ld a, [wOTTrademonSpecies]
+ ld [CurPartySpecies], a
+ hlcoord 7, 2
+ ld d, $0
+ ld e, ANIM_MON_TRADE
+ predef AnimateFrontpic
+ ret
diff --git a/engine/routines/updatebattlehuds.asm b/engine/routines/updatebattlehuds.asm
new file mode 100644
index 000000000..ec7f662e8
--- /dev/null
+++ b/engine/routines/updatebattlehuds.asm
@@ -0,0 +1,9 @@
+_UpdateBattleHUDs:
+ farcall DrawPlayerHUD
+ ld hl, PlayerHPPal
+ call SetHPPal
+ farcall DrawEnemyHUD
+ ld hl, EnemyHPPal
+ call SetHPPal
+ farcall FinishBattleAnim
+ ret
diff --git a/engine/routines/updateitemdescription.asm b/engine/routines/updateitemdescription.asm
new file mode 100644
index 000000000..b684dd4d8
--- /dev/null
+++ b/engine/routines/updateitemdescription.asm
@@ -0,0 +1,13 @@
+UpdateItemDescription: ; 0x244c3
+ ld a, [MenuSelection]
+ ld [CurSpecies], a
+ hlcoord 0, 12
+ ld b, 4
+ ld c, SCREEN_WIDTH - 2
+ call TextBox
+ ld a, [MenuSelection]
+ cp -1
+ ret z
+ decoord 1, 14
+ farcall PrintItemDescription
+ ret
diff --git a/engine/rtc.asm b/engine/rtc.asm
index 3018b5301..dc49a9630 100755
--- a/engine/rtc.asm
+++ b/engine/rtc.asm
@@ -50,19 +50,19 @@ GetTimeOfDay:: ; 14032
TimesOfDay: ; 14044
; hours for the time of day
-; 04-09 morn | 10-17 day | 18-03 nite
- db 04, NITE
- db 10, MORN
- db 18, DAY
- db 24, NITE
- db -1, MORN
+; 0400-0959 morn | 1000-1759 day | 1800-0359 nite
+ db MORN_HOUR, NITE_F
+ db DAY_HOUR, MORN_F
+ db NITE_HOUR, DAY_F
+ db MAX_HOUR, NITE_F
+ db -1, MORN_F
; 1404e
-Unknown_1404e: ; Unreferenced
- db 20, 2
- db 40, 0
- db 60, 1
- db -1, 0
+Unknown_1404e: ; unreferenced
+ db 20, NITE_F
+ db 40, MORN_F
+ db 60, DAY_F
+ db -1, MORN_F
; 14056
StageRTCTimeForSave: ; 14056
@@ -143,8 +143,8 @@ Function140ae: ; 140ae
jr c, .dont_update
.time_overflow
- callba ClearDailyTimers
- callba Function170923
+ farcall ClearDailyTimers
+ farcall Function170923
; mobile
ld a, $5
call GetSRAMBank
diff --git a/engine/save.asm b/engine/save.asm
index de2d3bc65..69bbaee82 100644
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -1,9 +1,9 @@
SaveMenu: ; 14a1a
call LoadStandardMenuDataHeader
- callba DisplaySaveInfoOnSave
+ farcall DisplaySaveInfoOnSave
call SpeechTextBox
call UpdateSprites
- callba SaveMenu_LoadEDTile
+ farcall SaveMenu_CopyTilemapAtOnce
ld hl, Text_WouldYouLikeToSaveTheGame
call SaveTheGame_yesorno
jr nz, .refused
@@ -19,20 +19,20 @@ SaveMenu: ; 14a1a
.refused
call ExitMenu
call ret_d90
- callba SaveMenu_LoadEDTile
+ farcall SaveMenu_CopyTilemapAtOnce
scf
ret
SaveAfterLinkTrade: ; 14a58
call PauseGameLogic
- callba StageRTCTimeForSave
- callba BackupMysteryGift
+ farcall StageRTCTimeForSave
+ farcall BackupMysteryGift
call SavePokemonData
call SaveChecksum
call SaveBackupPokemonData
call SaveBackupChecksum
- callba BackupPartyMonMail
- callba SaveRTC
+ farcall BackupPartyMonMail
+ farcall SaveRTC
call ResumeGameLogic
ret
; 14a83
@@ -95,8 +95,8 @@ MovePkmnWOMail_InsertMon_SaveGame: ; 14ad5
ld [wCurBox], a
ld a, $1
ld [wSaveFileExists], a
- callba StageRTCTimeForSave
- callba BackupMysteryGift
+ farcall StageRTCTimeForSave
+ farcall BackupMysteryGift
call ValidateSave
call SaveOptions
call SavePlayerData
@@ -107,9 +107,9 @@ MovePkmnWOMail_InsertMon_SaveGame: ; 14ad5
call SaveBackupPlayerData
call SaveBackupPokemonData
call SaveBackupChecksum
- callba BackupPartyMonMail
- callba BackupMobileEventIndex
- callba SaveRTC
+ farcall BackupPartyMonMail
+ farcall BackupMobileEventIndex
+ farcall SaveRTC
call LoadBox
call ResumeGameLogic
ld de, SFX_SAVE
@@ -271,8 +271,8 @@ SavedTheGame: ; 14be6
SaveGameData_: ; 14c10
ld a, 1
ld [wSaveFileExists], a
- callba StageRTCTimeForSave
- callba BackupMysteryGift
+ farcall StageRTCTimeForSave
+ farcall BackupMysteryGift
call ValidateSave
call SaveOptions
call SavePlayerData
@@ -285,9 +285,9 @@ SaveGameData_: ; 14c10
call SaveBackupPokemonData
call SaveBackupChecksum
call UpdateStackTop
- callba BackupPartyMonMail
- callba BackupMobileEventIndex
- callba SaveRTC
+ farcall BackupPartyMonMail
+ farcall BackupMobileEventIndex
+ farcall SaveRTC
ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank
ld a, [sBattleTowerChallengeState]
@@ -500,12 +500,12 @@ HallOfFame_InitSaveIfNeeded: ; 14da0
; 14da9
ValidateSave: ; 14da9
- ld a, BANK(s1_a008)
+ ld a, BANK(sCheckValue1) ; BANK(sCheckValue2)
call GetSRAMBank
- ld a, 99
- ld [s1_a008], a
- ld a, " "
- ld [s1_ad0f], a
+ ld a, SAVE_CHECK_VALUE_1
+ ld [sCheckValue1], a
+ ld a, SAVE_CHECK_VALUE_2
+ ld [sCheckValue2], a
jp CloseSRAM
; 14dbb
@@ -568,12 +568,12 @@ SaveChecksum: ; 14e13
; 14e2d
ValidateBackupSave: ; 14e2d
- ld a, BANK(s0_b208)
+ ld a, BANK(sBackupCheckValue1) ; BANK(sBackupCheckValue2)
call GetSRAMBank
- ld a, 99
- ld [s0_b208], a
- ld a, " "
- ld [s0_bf0f], a
+ ld a, SAVE_CHECK_VALUE_1
+ ld [sBackupCheckValue1], a
+ ld a, SAVE_CHECK_VALUE_2
+ ld [sBackupCheckValue2], a
call CloseSRAM
ret
; 14e40
@@ -636,9 +636,9 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
call LoadPlayerData
call LoadPokemonData
call LoadBox
- callba RestorePartyMonMail
- callba RestoreMobileEventIndex
- callba RestoreMysteryGift
+ farcall RestorePartyMonMail
+ farcall RestoreMobileEventIndex
+ farcall RestoreMysteryGift
call ValidateBackupSave
call SaveBackupOptions
call SaveBackupPlayerData
@@ -653,9 +653,9 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
call LoadBackupPlayerData
call LoadBackupPokemonData
call LoadBox
- callba RestorePartyMonMail
- callba RestoreMobileEventIndex
- callba RestoreMysteryGift
+ farcall RestorePartyMonMail
+ farcall RestoreMobileEventIndex
+ farcall RestoreMysteryGift
call ValidateSave
call SaveOptions
call SavePlayerData
@@ -726,25 +726,18 @@ TryLoadSaveData: ; 14f1c
ret
; 14f7c
-DefaultOptions: ; 14f7c
- db $03 ; mid text speed
- db $00 ; wSaveFileExists
- db $00 ; frame 0
- db $01 ; TextBoxFlags
- db $40 ; gb printer: normal brightness
- db $01 ; menu account on
- db $00 ; ??
- db $00 ; ??
-; 14f84
+
+INCLUDE "data/default_options.asm"
+
CheckPrimarySaveFile: ; 14f84
- ld a, BANK(s1_a008)
+ ld a, BANK(sCheckValue1) ; BANK(sCheckValue2)
call GetSRAMBank
- ld a, [s1_a008]
- cp 99
+ ld a, [sCheckValue1]
+ cp SAVE_CHECK_VALUE_1
jr nz, .nope
- ld a, [s1_ad0f]
- cp " "
+ ld a, [sCheckValue2]
+ cp SAVE_CHECK_VALUE_2
jr nz, .nope
ld hl, sOptions
ld de, Options
@@ -760,13 +753,13 @@ CheckPrimarySaveFile: ; 14f84
; 14faf
CheckBackupSaveFile: ; 14faf
- ld a, BANK(s0_b208)
+ ld a, BANK(sBackupCheckValue1) ; BANK(sBackupCheckValue2)
call GetSRAMBank
- ld a, [s0_b208]
- cp 99
+ ld a, [sBackupCheckValue1]
+ cp SAVE_CHECK_VALUE_1
jr nz, .nope
- ld a, [s0_bf0f]
- cp " "
+ ld a, [sBackupCheckValue2]
+ cp SAVE_CHECK_VALUE_2
jr nz, .nope
ld hl, sBackupOptions
ld de, Options
diff --git a/engine/scripting.asm b/engine/scripting.asm
index 42976ad65..9818bbac3 100644
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -35,7 +35,7 @@ WaitScript:
dec [hl]
ret nz
- callba Function58b9
+ farcall Function58b9
ld a, SCRIPT_READ
ld [ScriptMode], a
@@ -49,7 +49,7 @@ WaitScriptMovement:
bit 7, [hl]
ret nz
- callba Function58b9
+ farcall Function58b9
ld a, SCRIPT_READ
ld [ScriptMode], a
@@ -64,6 +64,7 @@ RunScriptCommand:
ScriptCommandTable:
+; entries correspond to macros/event.asm enumeration
dw Script_scall ; 00
dw Script_farscall ; 01
dw Script_ptcall ; 02
@@ -81,10 +82,10 @@ ScriptCommandTable:
dw Script_callasm ; 0e
dw Script_special ; 0f
dw Script_ptcallasm ; 10
- dw Script_checkmaptriggers ; 11
- dw Script_domaptrigger ; 12
- dw Script_checktriggers ; 13
- dw Script_dotrigger ; 14
+ dw Script_checkmapscene ; 11
+ dw Script_setmapscene ; 12
+ dw Script_checkscene ; 13
+ dw Script_setscene ; 14
dw Script_writebyte ; 15
dw Script_addvar ; 16
dw Script_random ; 17
@@ -174,14 +175,14 @@ ENDC
dw Script_applymovement ; 69
dw Script_applymovement2 ; 6a
dw Script_faceplayer ; 6b
- dw Script_faceperson ; 6c
+ dw Script_faceobject ; 6c
dw Script_variablesprite ; 6d
dw Script_disappear ; 6e
dw Script_appear ; 6f
dw Script_follow ; 70
dw Script_stopfollow ; 71
- dw Script_moveperson ; 72
- dw Script_writepersonxy ; 73
+ dw Script_moveobject ; 72
+ dw Script_writeobjectxy ; 73
dw Script_loademote ; 74
dw Script_showemote ; 75
dw Script_spriteface ; 76
@@ -276,7 +277,7 @@ Script_special:
ld e, a
call GetScriptByte
ld d, a
- callba Special
+ farcall Special
ret
Script_ptcallasm:
@@ -474,13 +475,13 @@ Script_pokepic:
ld a, [ScriptVar]
.ok
ld [CurPartySpecies], a
- callba Pokepic
+ farcall Pokepic
ret
Script_closepokepic:
; script command 0x57
- callba ClosePokepic
+ farcall ClosePokepic
ret
Script_verticalmenu:
@@ -518,7 +519,7 @@ Script_battletowertext:
call SetUpTextBox
call GetScriptByte
ld c, a
- callba BattleTowerText
+ farcall BattleTowerText
ret
Script_verbosegiveitem:
@@ -614,7 +615,7 @@ Script_pocketisfull:
Script_specialsound:
; script command 0x88
- callba CheckItemPocket
+ farcall CheckItemPocket
ld a, [wItemAttributeParamBuffer]
cp TM_HM
ld de, SFX_GET_TM
@@ -627,7 +628,7 @@ Script_specialsound:
GetPocketName:
- callba CheckItemPocket
+ farcall CheckItemPocket
ld a, [wItemAttributeParamBuffer]
dec a
ld hl, .Pockets
@@ -688,7 +689,7 @@ Script_pokemart:
ld d, a
ld a, [ScriptBank]
ld b, a
- callba OpenMartDialog
+ farcall OpenMartDialog
ret
Script_elevator:
@@ -704,7 +705,7 @@ Script_elevator:
ld d, a
ld a, [ScriptBank]
ld b, a
- callba Elevator
+ farcall Elevator
ret c
ld a, TRUE
ld [ScriptVar], a
@@ -717,7 +718,7 @@ Script_trade:
call GetScriptByte
ld e, a
- callba NPCTrade
+ farcall NPCTrade
ret
Script_phonecall:
@@ -731,13 +732,13 @@ Script_phonecall:
ld d, a
ld a, [ScriptBank]
ld b, a
- callba PhoneCall
+ farcall PhoneCall
ret
Script_hangup:
; script command 0x99
- callba HangUp
+ farcall HangUp
ret
Script_askforphonenumber:
@@ -749,7 +750,7 @@ Script_askforphonenumber:
jr c, .refused
call GetScriptByte
ld c, a
- callba AddPhoneNumber
+ farcall AddPhoneNumber
jr c, .phonefull
xor a
jr .done
@@ -770,7 +771,7 @@ Script_describedecoration:
call GetScriptByte
ld b, a
- callba DescribeDecoration
+ farcall DescribeDecoration
ld h, d
ld l, e
jp ScriptJump
@@ -799,7 +800,7 @@ Script_swarm:
ld d, a
call GetScriptByte
ld e, a
- callba StoreSwarmMapIndices
+ farcall StoreSwarmMapIndices
ret
Script_trainertext:
@@ -896,7 +897,7 @@ Script_encountermusic:
ld a, [OtherTrainerClass]
ld e, a
- callba PlayTrainerEncounterMusic
+ farcall PlayTrainerEncounterMusic
ret
Script_playmapmusic:
@@ -958,7 +959,7 @@ Script_waitsfx:
Script_warpsound:
; script command 0x87
- callba GetWarpSFX
+ farcall GetWarpSFX
call PlaySFX
ret
@@ -978,8 +979,8 @@ Script_cry:
call PlayCry
ret
-GetScriptPerson:
- and a
+GetScriptObject:
+ and a ; PLAYER?
ret z
cp LAST_TALKED
ret z
@@ -989,27 +990,27 @@ GetScriptPerson:
Script_setlasttalked:
; script command 0x68
; parameters:
-; person (SingleByteParam)
+; object id (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
ld [hLastTalked], a
ret
Script_applymovement:
; script command 0x69
; parameters:
-; person (SingleByteParam)
+; object id (SingleByteParam)
; data (MovementPointerLabelParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
ld c, a
ApplyMovement:
push bc
ld a, c
- callba SetFlagsForMovement_1
+ farcall SetFlagsForMovement_1
pop bc
push bc
@@ -1031,7 +1032,7 @@ ApplyMovement:
ret
SetFlagsForMovement_2:
- callba _SetFlagsForMovement_2
+ farcall _SetFlagsForMovement_2
ret
Script_applymovement2:
@@ -1053,38 +1054,38 @@ Script_faceplayer:
ld d, $0
ld a, [hLastTalked]
ld e, a
- callba GetRelativeFacing
+ farcall GetRelativeFacing
ld a, d
add a
add a
ld e, a
ld a, [hLastTalked]
ld d, a
- call ApplyPersonFacing
+ call ApplyObjectFacing
ret
-Script_faceperson:
+Script_faceobject:
; script command 0x6c
; parameters:
-; person1 (SingleByteParam)
-; person2 (SingleByteParam)
+; object1 (SingleByteParam)
+; object2 (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
cp LAST_TALKED
jr c, .ok
ld a, [hLastTalked]
.ok
ld e, a
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
cp LAST_TALKED
jr nz, .ok2
ld a, [hLastTalked]
.ok2
ld d, a
push de
- callba GetRelativeFacing
+ farcall GetRelativeFacing
pop bc
ret c
ld a, d
@@ -1092,17 +1093,17 @@ Script_faceperson:
add a
ld e, a
ld d, c
- call ApplyPersonFacing
+ call ApplyObjectFacing
ret
Script_spriteface:
; script command 0x76
; parameters:
-; person (SingleByteParam)
+; object id (SingleByteParam)
; facing (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
cp LAST_TALKED
jr nz, .ok
ld a, [hLastTalked]
@@ -1112,10 +1113,10 @@ Script_spriteface:
add a
add a
ld e, a
- call ApplyPersonFacing
+ call ApplyObjectFacing
ret
-ApplyPersonFacing:
+ApplyObjectFacing:
ld a, d
push de
call CheckObjectVisibility
@@ -1178,10 +1179,10 @@ Script_variablesprite:
Script_appear:
; script command 0x6f
; parameters:
-; person (SingleByteParam)
+; object id (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
call _CopyObjectStruct
ld a, [hMapObjectIndexBuffer]
ld b, 0 ; clear
@@ -1191,10 +1192,10 @@ Script_appear:
Script_disappear:
; script command 0x6e
; parameters:
-; person (SingleByteParam)
+; object id (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
cp LAST_TALKED
jr nz, .ok
ld a, [hLastTalked]
@@ -1203,7 +1204,7 @@ Script_disappear:
ld a, [hMapObjectIndexBuffer]
ld b, 1 ; set
call ApplyEventActionAppearDisappear
- callba _UpdateSprites
+ farcall _UpdateSprites
ret
ApplyEventActionAppearDisappear:
@@ -1229,33 +1230,33 @@ ApplyEventActionAppearDisappear:
Script_follow:
; script command 0x70
; parameters:
-; person2 (SingleByteParam)
-; person1 (SingleByteParam)
+; object2 (SingleByteParam)
+; object1 (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
ld b, a
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
ld c, a
- callba StartFollow
+ farcall StartFollow
ret
Script_stopfollow:
; script command 0x71
- callba StopFollow
+ farcall StopFollow
ret
-Script_moveperson:
+Script_moveobject:
; script command 0x72
; parameters:
-; person (SingleByteParam)
+; object id (SingleByteParam)
; x (SingleByteParam)
; y (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
ld b, a
call GetScriptByte
add 4
@@ -1263,37 +1264,37 @@ Script_moveperson:
call GetScriptByte
add 4
ld e, a
- callba CopyDECoordsToMapObject
+ farcall CopyDECoordsToMapObject
ret
-Script_writepersonxy:
+Script_writeobjectxy:
; script command 0x73
; parameters:
-; person (SingleByteParam)
+; object id (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
cp LAST_TALKED
jr nz, .ok
ld a, [hLastTalked]
.ok
ld b, a
- callba WritePersonXY
+ farcall WriteObjectXY
ret
Script_follownotexact:
; script command 0x77
; parameters:
-; person2 (SingleByteParam)
-; person1 (SingleByteParam)
+; object2 (SingleByteParam)
+; object1 (SingleByteParam)
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
ld b, a
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
ld c, a
- callba FollowNotExact
+ farcall FollowNotExact
ret
Script_loademote:
@@ -1307,20 +1308,20 @@ Script_loademote:
ld a, [ScriptVar]
.not_var_emote
ld c, a
- callba LoadEmote
+ farcall LoadEmote
ret
Script_showemote:
; script command 0x75
; parameters:
; bubble (SingleByteParam)
-; person (SingleByteParam)
+; object id (SingleByteParam)
; time (DecimalParam)
call GetScriptByte
ld [ScriptVar], a
call GetScriptByte
- call GetScriptPerson
+ call GetScriptObject
cp LAST_TALKED
jr z, .ok
ld [hLastTalked], a
@@ -1355,19 +1356,19 @@ Script_earthquake:
; param (DecimalParam)
ld hl, EarthquakeMovement
- ld de, wd002
+ ld de, wEarthquakeMovementDataBuffer
ld bc, EarthquakeMovementEnd - EarthquakeMovement
call CopyBytes
call GetScriptByte
- ld [wd003], a
- and (1 << 6) - 1
- ld [wd005], a
+ ld [wEarthquakeMovementDataBuffer + 1], a
+ and %00111111
+ ld [wEarthquakeMovementDataBuffer + 3], a
ld b, BANK(.script)
ld de, .script
jp ScriptCall
.script
- applymovement PLAYER, wd002
+ applymovement PLAYER, wEarthquakeMovementDataBuffer
end
EarthquakeMovement:
@@ -1450,7 +1451,7 @@ Script_catchtutorial:
call GetScriptByte
ld [BattleType], a
call BufferScreen
- callba CatchTutorial
+ farcall CatchTutorial
jp Script_reloadmap
Script_reloadmapafterbattle:
@@ -1470,7 +1471,7 @@ Script_reloadmapafterbattle:
.notblackedout
bit 0, d
jr z, .was_wild
- callba MomTriesToBuySomething
+ farcall MomTriesToBuySomething
jr .done
.was_wild
@@ -1479,7 +1480,7 @@ Script_reloadmapafterbattle:
jr z, .done
ld b, BANK(Script_SpecialBillCall)
ld de, Script_SpecialBillCall
- callba LoadScriptBDE
+ farcall LoadScriptBDE
.done
jp Script_reloadmap
@@ -1750,20 +1751,20 @@ Script_priorityjump:
set 3, [hl]
ret
-Script_checktriggers:
+Script_checkscene:
; script command 0x13
- call CheckTriggers
- jr z, .no_triggers
+ call CheckScenes
+ jr z, .no_scene
ld [ScriptVar], a
ret
-.no_triggers
+.no_scene
ld a, $ff
ld [ScriptVar], a
ret
-Script_checkmaptriggers:
+Script_checkmapscene:
; script command 0x11
; parameters:
; map_group (SingleByteParam)
@@ -1773,49 +1774,49 @@ Script_checkmaptriggers:
ld b, a
call GetScriptByte
ld c, a
- call GetMapTrigger
+ call GetMapSceneID
ld a, d
or e
- jr z, .no_triggers
+ jr z, .no_scene
ld a, [de]
ld [ScriptVar], a
ret
-.no_triggers
+.no_scene
ld a, $ff
ld [ScriptVar], a
ret
-Script_dotrigger:
+Script_setscene:
; script command 0x14
; parameters:
-; trigger_id (SingleByteParam)
+; scene_id (SingleByteParam)
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
- jr DoTrigger
+ jr DoScene
-Script_domaptrigger:
+Script_setmapscene:
; script command 0x12
; parameters:
; map_group (MapGroupParam)
; map_id (MapIdParam)
-; trigger_id (SingleByteParam)
+; scene_id (SingleByteParam)
call GetScriptByte
ld b, a
call GetScriptByte
ld c, a
-DoTrigger:
- call GetMapTrigger
+DoScene:
+ call GetMapSceneID
ld a, d
or e
- jr z, .no_trigger
+ jr z, .no_scene
call GetScriptByte
ld [de], a
-.no_trigger
+.no_scene
ret
Script_copybytetovar:
@@ -1968,7 +1969,7 @@ Script_writecode:
GetVarAction:
ld c, a
- callba _GetVarAction
+ farcall _GetVarAction
ret
Script_checkver:
@@ -2039,7 +2040,7 @@ Script_mapnametotext:
ConvertLandmarkToText:
ld e, a
- callba GetLandmarkName
+ farcall GetLandmarkName
ld de, StringBuffer1
jp ConvertMemToText
@@ -2063,7 +2064,7 @@ Script_trainertotext:
ld c, a
call GetScriptByte
ld b, a
- callba GetTrainerName
+ farcall GetTrainerName
jr ConvertMemToText
Script_name:
@@ -2170,12 +2171,12 @@ Script_givepokeitem:
ld b, a
push bc
inc hl
- ld bc, MAIL_MAX_LENGTH
+ ld bc, MAIL_MSG_LENGTH
ld de, wd002
ld a, [ScriptBank]
call FarCopyBytes
pop bc
- callba GivePokeItem
+ farcall GivePokeItem
ret
Script_checkpokeitem:
@@ -2189,7 +2190,7 @@ Script_checkpokeitem:
ld d, a
ld a, [ScriptBank]
ld b, a
- callba CheckPokeItem
+ farcall CheckPokeItem
ret
Script_giveitem:
@@ -2262,7 +2263,7 @@ Script_givemoney:
call GetMoneyAccount
call LoadMoneyAmountToMem
- callba GiveMoney
+ farcall GiveMoney
ret
Script_takemoney:
@@ -2273,7 +2274,7 @@ Script_takemoney:
call GetMoneyAccount
call LoadMoneyAmountToMem
- callba TakeMoney
+ farcall TakeMoney
ret
Script_checkmoney:
@@ -2284,7 +2285,7 @@ Script_checkmoney:
call GetMoneyAccount
call LoadMoneyAmountToMem
- callba CompareMoney
+ farcall CompareMoney
CompareMoneyAction:
jr c, .two
@@ -2328,7 +2329,7 @@ Script_givecoins:
; coins (CoinByteParam)
call LoadCoinAmountToMem
- callba GiveCoins
+ farcall GiveCoins
ret
Script_takecoins:
@@ -2337,7 +2338,7 @@ Script_takecoins:
; coins (CoinByteParam)
call LoadCoinAmountToMem
- callba TakeCoins
+ farcall TakeCoins
ret
Script_checkcoins:
@@ -2346,7 +2347,7 @@ Script_checkcoins:
; coins (CoinByteParam)
call LoadCoinAmountToMem
- callba CheckCoins
+ farcall CheckCoins
jr CompareMoneyAction
LoadCoinAmountToMem:
@@ -2364,7 +2365,7 @@ Script_checktime:
xor a
ld [ScriptVar], a
- callba CheckTime
+ farcall CheckTime
call GetScriptByte
and c
ret z
@@ -2397,7 +2398,7 @@ Script_addcellnum:
ld [ScriptVar], a
call GetScriptByte
ld c, a
- callba AddPhoneNumber
+ farcall AddPhoneNumber
ret nc
ld a, TRUE
ld [ScriptVar], a
@@ -2412,7 +2413,7 @@ Script_delcellnum:
ld [ScriptVar], a
call GetScriptByte
ld c, a
- callba DelCellNum
+ farcall DelCellNum
ret nc
ld a, TRUE
ld [ScriptVar], a
@@ -2428,7 +2429,7 @@ Script_checkcellnum:
ld [ScriptVar], a
call GetScriptByte
ld c, a
- callba CheckCellNum
+ farcall CheckCellNum
ret nc
ld a, TRUE
ld [ScriptVar], a
@@ -2486,7 +2487,7 @@ Script_givepoke:
call GetScriptByte
call GetScriptByte
.ok
- callba GivePoke
+ farcall GivePoke
ld a, b
ld [ScriptVar], a
ret
@@ -2505,7 +2506,7 @@ Script_giveegg:
ld [CurPartySpecies], a
call GetScriptByte
ld [CurPartyLevel], a
- callba GiveEgg
+ farcall GiveEgg
ret nc
ld a, 2
ld [ScriptVar], a
@@ -2602,7 +2603,7 @@ Script_checkflag:
ret
_EngineFlagAction:
- callba EngineFlagAction
+ farcall EngineFlagAction
ret
Script_wildoff:
@@ -2668,7 +2669,7 @@ Script_warp:
call GetScriptByte
ld [YCoord], a
ld a, -1
- ld [wd001], a
+ ld [DefaultSpawnpoint], a
ld a, MAPSETUP_WARP
ld [hMapEntryMethod], a
ld a, 1
@@ -2681,7 +2682,7 @@ Script_warp:
call GetScriptByte
call GetScriptByte
ld a, -1
- ld [wd001], a
+ ld [DefaultSpawnpoint], a
ld a, MAPSETUP_BADWARP
ld [hMapEntryMethod], a
ld a, 1
@@ -2734,7 +2735,7 @@ Script_writecmdqueue:
ld d, a
ld a, [ScriptBank]
ld b, a
- callba WriteCmdQueue ; no need to farcall
+ farcall WriteCmdQueue ; no need to farcall
ret
Script_delcmdqueue:
@@ -2746,7 +2747,7 @@ Script_delcmdqueue:
ld [ScriptVar], a
call GetScriptByte
ld b, a
- callba DelCmdQueue ; no need to farcall
+ farcall DelCmdQueue ; no need to farcall
ret c
ld a, 1
ld [ScriptVar], a
@@ -2793,7 +2794,7 @@ Script_reloadmappart::
ld [hBGMapMode], a
call OverworldTextModeSwitch
call GetMovementPermissions
- callba ReloadMapPart
+ farcall ReloadMapPart
call UpdateSprites
ret
@@ -2802,11 +2803,11 @@ Script_warpcheck:
call WarpCheck
ret nc
- callba EnableEvents
+ farcall EnableEvents
ret
Script_enableevents: ; unreferenced
- callba EnableEvents
+ farcall EnableEvents
ret
Script_newloadmap:
@@ -2955,9 +2956,9 @@ ExitScriptSubroutine:
ld e, [hl]
ld d, $0
ld hl, wScriptStack
- add hl,de
- add hl,de
- add hl,de
+ add hl, de
+ add hl, de
+ add hl, de
ld a, [hli]
ld b, a
and " "
@@ -2992,9 +2993,9 @@ Script_halloffame:
ld hl, GameTimerPause
res 0, [hl]
- callba TrainerRankings_HallOfFame
- callba TrainerRankings_HallOfFame2
- callba HallOfFame
+ farcall TrainerRankings_HallOfFame
+ farcall TrainerRankings_HallOfFame2
+ farcall HallOfFame
ld hl, GameTimerPause
set 0, [hl]
jr ReturnFromCredits
@@ -3002,7 +3003,7 @@ Script_halloffame:
Script_credits:
; script command 0xa2
- callba RedCredits
+ farcall RedCredits
ReturnFromCredits:
call Script_end_all
ld a, $3
@@ -3030,7 +3031,7 @@ Script_wait:
Script_check_save:
; script command 0xa9
- callba CheckSave
+ farcall CheckSave
ld a, c
ld [ScriptVar], a
ret
diff --git a/engine/search.asm b/engine/search.asm
index 9543ecfbb..76be0e159 100755
--- a/engine/search.asm
+++ b/engine/search.asm
@@ -219,7 +219,7 @@ CheckOwnMon: ; 0x4a7ba
ld hl, PlayerName
- rept 4
+rept NAME_LENGTH_JAPANESE +- 2 ; should be PLAYER_NAME_LENGTH +- 2
ld a, [de]
cp [hl]
jr nz, .notfound
@@ -227,7 +227,7 @@ CheckOwnMon: ; 0x4a7ba
jr z, .found ; reached end of string
inc hl
inc de
- endr
+endr
ld a, [de]
cp [hl]
diff --git a/engine/selectmenu.asm b/engine/select_menu.asm
index 838438a4c..e92c3ee50 100755
--- a/engine/selectmenu.asm
+++ b/engine/select_menu.asm
@@ -94,7 +94,7 @@ CheckRegisteredItem: ; 13345
dec a
cp [hl]
jr nc, .NotEnoughItems
- ld [wd107], a
+ ld [CurItemQuantity], a
and a
ret
@@ -120,7 +120,7 @@ CheckRegisteredItem: ; 13345
UseRegisteredItem: ; 133c3
- callba CheckItemMenu
+ farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .SwitchTo
rst JumpTable
diff --git a/engine/sgb_layouts.asm b/engine/sgb_layouts.asm
new file mode 100644
index 000000000..36dbde84c
--- /dev/null
+++ b/engine/sgb_layouts.asm
@@ -0,0 +1,636 @@
+Predef_LoadSGBLayout: ; 864c
+; LoadSGBLayout
+ call CheckCGB
+ jp nz, Predef_LoadSGBLayoutCGB
+
+ ld a, b
+ cp SCGB_RAM
+ jr nz, .not_ram
+ ld a, [SGBPredef]
+.not_ram
+ cp SCGB_PARTY_MENU_HP_PALS
+ jp z, SGB_ApplyPartyMenuHPPals
+ ld l, a
+ ld h, 0
+ add hl, hl
+ ld de, .Jumptable
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .Finish
+ push de
+ jp hl
+; 866f
+
+.Jumptable: ; 866f
+ dw .SGB_BattleGrayscale
+ dw .SGB_BattleColors
+ dw .SGB_PokegearPals
+ dw .SGB_StatsScreenHPPals
+ dw .SGB_Pokedex
+ dw .SGB_SlotMachine
+ dw .SGB06
+ dw .SGB07
+ dw .SGB_Diploma
+ dw .SGB_MapPals
+ dw .SGB_PartyMenu
+ dw .SGB_Evolution
+ dw .SGB0c
+ dw .SGB0d
+ dw .SGB_MoveList
+ dw .SGB0f
+ dw .SGB_PokedexSearchOption
+ dw .SGB11
+ dw .SGB12
+ dw .SGB13
+ dw .SGB_PackPals
+ dw .SGB_TrainerCard
+ dw .SGB_PokedexUnownMode
+ dw .SGB_BillsPC
+ dw .SGB_UnownPuzzle
+ dw .SGB19
+ dw .SGB_PlayerOrMonFrontpicPals
+ dw .SGB_TradeTube
+ dw .SGB_TrainerOrMonFrontpicPals
+ dw .SGB_MysteryGift
+ dw .SGB1e
+; 86ad
+
+.SGB_BattleGrayscale: ; 86ad
+ ld hl, PalPacket_9c66
+ ld de, BlkPacket_9aa6
+ ret
+; 86b4
+
+.SGB_BattleColors: ; 86b4
+ ld hl, BlkPacket_9aa6
+ call PushSGBPals_
+
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+
+ ld a, [PlayerHPPal]
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+ ld de, HPBarPals
+ add hl, de
+
+ ld a, [hli]
+ ld [wSGBPals + 3], a
+ ld a, [hli]
+ ld [wSGBPals + 4], a
+ ld a, [hli]
+ ld [wSGBPals + 5], a
+ ld a, [hl]
+ ld [wSGBPals + 6], a
+
+ ld a, [EnemyHPPal]
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+
+ ld de, HPBarPals
+ add hl, de
+ ld a, [hli]
+ ld [wSGBPals + 9], a
+ ld a, [hli]
+ ld [wSGBPals + 10], a
+ ld a, [hli]
+ ld [wSGBPals + 11], a
+ ld a, [hl]
+ ld [wSGBPals + 12], a
+
+ ld hl, PalPacket_9cf6
+ ld de, wSGBPals + $10
+ ld bc, $10
+ call CopyBytes
+
+ call GetBattlemonBackpicPalettePointer
+
+ ld a, [hli]
+ ld [wSGBPals + $13], a
+ ld a, [hli]
+ ld [wSGBPals + $14], a
+ ld a, [hli]
+ ld [wSGBPals + $15], a
+ ld a, [hl]
+ ld [wSGBPals + $16], a
+ call GetEnemyFrontpicPalettePointer
+ ld a, [hli]
+ ld [wSGBPals + $19], a
+ ld a, [hli]
+ ld [wSGBPals + $1a], a
+ ld a, [hli]
+ ld [wSGBPals + $1b], a
+ ld a, [hl]
+ ld [wSGBPals + $1c], a
+
+ ld hl, wSGBPals
+ ld de, wSGBPals + $10
+ ld a, SCGB_BATTLE_COLORS
+ ld [SGBPredef], a
+ ret
+; 873c
+
+.SGB_MoveList: ; 873c
+ ld hl, PalPacket_9bd6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+
+ ld hl, wSGBPals + 1
+ ld [hl], $10
+ inc hl
+ inc hl
+
+ ld a, [PlayerHPPal]
+ add $2f
+ ld [hl], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_9ad6
+ ret
+; 875c
+
+.SGB_PokegearPals: ; 875c
+ ld hl, PalPacket_9c76
+ ld de, BlkPacket_9a86
+ ret
+; 8763
+
+.SGB_StatsScreenHPPals: ; 8763
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld a, [wCurHPPal]
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+ ld de, HPBarPals
+ add hl, de
+ ld a, [hli]
+ ld [wSGBPals + 3], a
+ ld a, [hli]
+ ld [wSGBPals + 4], a
+ ld a, [hli]
+ ld [wSGBPals + 5], a
+ ld a, [hl]
+ ld [wSGBPals + 6], a
+ ld a, [CurPartySpecies]
+ ld bc, TempMonDVs
+ call GetPlayerOrMonPalettePointer
+ ld a, [hli]
+ ld [wSGBPals + 9], a
+ ld a, [hli]
+ ld [wSGBPals + 10], a
+ ld a, [hli]
+ ld [wSGBPals + 11], a
+ ld a, [hl]
+ ld [wSGBPals + 12], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_9ac6
+ ret
+; 87ab
+
+.SGB_PartyMenu: ; 87ab
+ ld hl, PalPacket_9c56
+ ld de, wSGBPals + 1
+ ret
+; 87b2
+
+.SGB_Pokedex: ; 87b2
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld hl, wSGBPals + 3
+ ld [hl], $9f
+ inc hl
+ ld [hl], $2a
+ inc hl
+ ld [hl], $5a
+ inc hl
+ ld [hl], $19
+ ld a, [CurPartySpecies]
+ call GetMonPalettePointer_
+ ld a, [hli]
+ ld [wSGBPals + 9], a
+ ld a, [hli]
+ ld [wSGBPals + 10], a
+ ld a, [hli]
+ ld [wSGBPals + 11], a
+ ld a, [hl]
+ ld [wSGBPals + 12], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_9ae6
+ ret
+; 87e9
+
+.SGB_BillsPC: ; 87e9
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld hl, wSGBPals + 3
+ ld [hl], $9f
+ inc hl
+ ld [hl], $2a
+ inc hl
+ ld [hl], $5a
+ inc hl
+ ld [hl], $19
+ ld a, [CurPartySpecies]
+ ld bc, TempMonDVs
+ call GetPlayerOrMonPalettePointer
+ ld a, [hli]
+ ld [wSGBPals + 9], a
+ ld a, [hli]
+ ld [wSGBPals + 10], a
+ ld a, [hli]
+ ld [wSGBPals + 11], a
+ ld a, [hl]
+ ld [wSGBPals + 12], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_9ae6
+ ret
+; 8823
+
+.SGB_PokedexUnownMode: ; 8823
+ call .SGB_Pokedex
+ ld de, BlkPacket_9af6
+ ret
+; 882a
+
+.SGB_PokedexSearchOption: ; 882a
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld hl, wSGBPals + 3
+ ld [hl], $9f
+ inc hl
+ ld [hl], $2a
+ inc hl
+ ld [hl], $5a
+ inc hl
+ ld [hl], $19
+ ld hl, wSGBPals
+ ld de, BlkPacket_9a86
+ ret
+; 884b
+
+.SGB_PackPals: ; 884b
+ ld hl, PalPacket_9c36
+ ld de, BlkPacket_9a86
+ ret
+; 8852
+
+.SGB_SlotMachine: ; 8852
+ ld hl, PalPacket_9c96
+ ld de, BlkPacket_9b06
+ ret
+; 8859
+
+.SGB06: ; 8859
+ ld hl, PalPacket_9ca6
+ ld de, BlkPacket_9b76
+ ret
+; 8860
+
+.SGB_Diploma:
+.SGB_MysteryGift: ; 8860
+ ld hl, PalPacket_9cb6
+ ld de, BlkPacket_9a86
+ ret
+; 8867
+
+.SGB07: ; 8867
+ ld b, 0
+ ld hl, .BlkPacketTable_SGB07
+rept 4
+ add hl, bc
+endr
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ inc hl
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ret
+; 8878
+
+.BlkPacketTable_SGB07: ; 8878
+ dw BlkPacket_9a86, PalPacket_9be6
+ dw BlkPacket_9a96, PalPacket_9c06
+ dw BlkPacket_9a86, PalPacket_9c16
+; 8884
+
+.SGB0c: ; 8884
+ ld hl, PalPacket_9b96
+ ld de, BlkPacket_9b56
+ ld a, SCGB_DIPLOMA
+ ld [SGBPredef], a
+ ret
+; 8890
+
+.SGB13: ; 8890
+ ld hl, PalPacket_9ba6
+ ld de, BlkPacket_9b86
+ ret
+; 8897
+
+.SGB0f: ; 8897
+ ld hl, PalPacket_9c46
+ ld de, BlkPacket_9a86
+ ret
+; 889e
+
+.SGB11: ; 889e
+ ld hl, BlkPacket_9a86
+ ld de, PlayerLightScreenCount
+ ld bc, $10
+ call CopyBytes
+ ld hl, PalPacket_9bb6
+ ld de, BlkPacket_9a86
+ ret
+; 88b1
+
+.SGB_MapPals: ; 88b1
+ ld hl, PalPacket_9bd6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ call .GetMapPalsIndex
+ ld hl, wSGBPals + 1
+ ld [hld], a
+ ld de, BlkPacket_9a86
+ ld a, SCGB_MAPPALS
+ ld [SGBPredef], a
+ ret
+; 88cd
+
+.SGB_Evolution: ; 88cd
+ push bc
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ pop bc
+ ld a, c
+ and a
+ jr z, .partymon
+ ; Egg
+ ld hl, wSGBPals + 3
+ ; RGB 7, 7, 7
+ ld [hl], $e7
+ inc hl
+ ld [hl], $1c
+ inc hl
+ ; RGB 2, 3, 3
+ ld [hl], $62
+ inc hl
+ ld [hl], $c
+ jr .done
+
+.partymon
+ ld hl, PartyMon1DVs
+ ld bc, PARTYMON_STRUCT_LENGTH
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld c, l
+ ld b, h
+ ld a, [PlayerHPPal]
+ call GetPlayerOrMonPalettePointer
+ ld a, [hli]
+ ld [wSGBPals + 3], a
+ ld a, [hli]
+ ld [wSGBPals + 4], a
+ ld a, [hli]
+ ld [wSGBPals + 5], a
+ ld a, [hl]
+ ld [wSGBPals + 6], a
+
+.done
+ ld hl, wSGBPals
+ ld de, BlkPacket_9a86
+ ret
+; 891a
+
+.SGB0d:
+.SGB_TrainerCard: ; 891a
+ ld hl, PalPacket_9cb6
+ ld de, BlkPacket_9a86
+ ret
+; 8921
+
+.SGB_UnownPuzzle: ; 8921
+ ld hl, PalPacket_9bc6
+ ld de, BlkPacket_9a86
+ ret
+; 8928
+
+.SGB12: ; 8928
+ ld hl, PalPacket_9bd6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld hl, BlkPacket_9a86
+ ld de, wSGBPals + $10
+ ld bc, $10
+ call CopyBytes
+ call .GetMapPalsIndex
+ ld hl, wSGBPals + 1
+ ld [hl], a
+ ld hl, wSGBPals + 3
+ ld [hl], $2e
+ ld hl, wSGBPals + $13
+ ld a, 5
+ ld [hli], a
+ ld a, [wMenuBorderLeftCoord]
+ ld [hli], a
+ ld a, [wMenuBorderTopCoord]
+ ld [hli], a
+ ld a, [wMenuBorderRightCoord]
+ ld [hli], a
+ ld a, [wMenuBorderBottomCoord]
+ ld [hl], a
+ ld hl, wSGBPals
+ ld de, wSGBPals + $10
+ ret
+; 8969
+
+.SGB1e: ; 8969
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld a, [CurPartySpecies]
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ ld de, PokemonPalettes
+ add hl, de
+ ld a, [wcf65]
+ and 3
+ sla a
+ sla a
+ ld c, a
+ ld b, 0
+ add hl, bc
+ ld a, [hli]
+ ld [wSGBPals + 3], a
+ ld a, [hli]
+ ld [wSGBPals + 4], a
+ ld a, [hli]
+ ld [wSGBPals + 5], a
+ ld a, [hl]
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_9a86
+ ret
+; 89a6
+
+.SGB19: ; 89a6
+ ld hl, PalPacket_9cd6
+ ld de, BlkPacket_9a86
+ ret
+; 89ad
+
+.SGB_PlayerOrMonFrontpicPals: ; 89ad
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld a, [CurPartySpecies]
+ ld bc, TempMonDVs
+ call GetPlayerOrMonPalettePointer
+ ld a, [hli]
+ ld [wSGBPals + 3], a
+ ld a, [hli]
+ ld [wSGBPals + 4], a
+ ld a, [hli]
+ ld [wSGBPals + 5], a
+ ld a, [hl]
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_9a86
+ ret
+; 89d9
+
+.SGB_TradeTube: ; 89d9
+ ld hl, PalPacket_9cc6
+ ld de, BlkPacket_9a86
+ ret
+; 89e0
+
+.SGB_TrainerOrMonFrontpicPals: ; 89e0
+ ld hl, PalPacket_9ce6
+ ld de, wSGBPals
+ ld bc, $10
+ call CopyBytes
+ ld a, [CurPartySpecies]
+ ld bc, TempMonDVs
+ call GetFrontpicPalettePointer
+ ld a, [hli]
+ ld [wSGBPals + 3], a
+ ld a, [hli]
+ ld [wSGBPals + 4], a
+ ld a, [hli]
+ ld [wSGBPals + 5], a
+ ld a, [hl]
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_9a86
+ ret
+; 8a0c
+
+.GetMapPalsIndex: ; 8a0c
+ ld a, [TimeOfDayPal]
+ cp NITE_F
+ jr c, .morn_day
+ ld a, $19
+ ret
+
+.morn_day
+ ld a, [wEnvironment]
+ cp ROUTE
+ jr z, .route
+ cp CAVE
+ jr z, .cave
+ cp DUNGEON
+ jr z, .cave
+ cp ENVIRONMENT_5
+ jr z, .perm5
+ cp GATE
+ jr z, .gate
+ ld a, [MapGroup]
+ ld e, a
+ ld d, 0
+ ld hl, .SGBRoofPalInds
+ add hl, de
+ ld a, [hl]
+ ret
+
+.route
+ ld a, $00
+ ret
+
+.cave
+ ld a, $18
+ ret
+
+.perm5
+ ld a, $06
+ ret
+
+.gate
+ ld a, $03
+ ret
+; 8a45
+
+.SGBRoofPalInds: ; 8a45
+ db $00 ; Unused
+ db $12 ; Olivine
+ db $14 ; Mahogany
+ db $18 ; Various Dungeons
+ db $11 ; Ecruteak
+ db $15 ; Blackthorn
+ db $09 ; Cinnabar
+ db $04 ; Cerulean
+ db $0f ; Azalea
+ db $16 ; Lake Of Rage
+ db $0e ; Violet
+ db $10 ; Goldenrod
+ db $06 ; Vermilion
+ db $01 ; Palette
+ db $03 ; Pewter
+ db $06 ; Fast Ship
+ db $0b ; Indigo Plateau
+ db $08 ; Fuchsia
+ db $05 ; Lavender
+ db $17 ; Silver Cave Outside
+ db $08 ; Pokemon Center 2F
+ db $07 ; Celadon
+ db $13 ; Cianwood
+ db $02 ; Viridian
+ db $0c ; New Bark
+ db $0a ; Saffron
+ db $0d ; Cherrygrove
+; 8a60
+
+.Finish: ; 8a60
+ push de
+ call PushSGBPals_
+ pop hl
+ jp PushSGBPals_
+; 8a68
diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm
index 93be28d9a..db5a2735f 100755
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -20,7 +20,7 @@ _SlotMachine:
call PlaySFX
call WaitSFX
call ClearBGPalettes
- callba TrainerRankings_EndSlotsWinStreak
+ farcall TrainerRankings_EndSlotsWinStreak
ld hl, Options
res NO_TEXT_SCROLL, [hl]
ld hl, rLCDC ; $ff40
@@ -41,7 +41,7 @@ _SlotMachine:
call ByteFill
ld b, SCGB_SLOT_MACHINE
call GetSGBLayout
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
ld hl, wSlots
ld bc, wSlotsDataEnd - wSlots
xor a
@@ -116,7 +116,7 @@ SlotsLoop: ; 927af (24:67af)
call Slots_SpinReels
xor a
ld [wCurrSpriteOAMAddr], a
- callab DoNextFrameForFirst16Sprites
+ callfar DoNextFrameForFirst16Sprites
call .PrintCoinsAndPayout
call .DummyFunc
call DelayFrame
@@ -471,10 +471,10 @@ Slots_LoadReelState: ; 929f6 (24:69f6)
Slot_CheckCoinCaseFull: ; 92a04 (24:6a04)
ld a, d
- cp 9999 / $100
+ cp MAX_COINS / $100
jr c, .not_full
ld a, e
- cp 9999 % $100
+ cp MAX_COINS % $100
jr c, .not_full
scf
ret
@@ -766,14 +766,15 @@ UpdateReelPositionAndOAM: ; 92b53 (24:6b53)
; 92bbe (24:6bbe)
+; unreferenced
Function92bbe: ; 92bbe
push hl
srl a
srl a
- add Unknown_92bce % $100
+ add .Unknown_92bce % $100
ld l, a
ld a, 0
- adc Unknown_92bce / $100
+ adc .Unknown_92bce / $100
ld h, a
ld a, [hl]
pop hl
@@ -781,7 +782,7 @@ Function92bbe: ; 92bbe
; 92bce
-Unknown_92bce: ; 92bce
+.Unknown_92bce: ; 92bce
db 0, 1, 2, 3, 4, 5
; 92bd4
@@ -1067,7 +1068,7 @@ ReelAction_InitGolem: ; 92d20
push bc
push af
depixel 12, 13
- ld a, SPRITE_ANIM_INDEX_SLOT_GOLEM
+ ld a, SPRITE_ANIM_INDEX_SLOTS_GOLEM
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_0E
add hl, bc
@@ -1812,7 +1813,7 @@ SlotGetPayout: ; 93124 (24:7124)
ld a, [hl]
ld [wPayout], a
ld d, a
- callba TrainerRankings_AddToSlotsPayouts
+ farcall TrainerRankings_AddToSlotsPayouts
ret
.PayoutTable:
@@ -1836,7 +1837,7 @@ SlotPayoutText: ; 93158 (24:7158)
jr nz, .MatchedSomething
ld hl, .Text_Darn
call PrintText
- callba TrainerRankings_EndSlotsWinStreak
+ farcall TrainerRankings_EndSlotsWinStreak
ret
.MatchedSomething:
@@ -1860,7 +1861,7 @@ SlotPayoutText: ; 93158 (24:7158)
.return
ld hl, .Text_PrintPayout
call PrintText
- callba TrainerRankings_AddToSlotsWinStreak
+ farcall TrainerRankings_AddToSlotsWinStreak
ret
; 93195 (24:7195)
@@ -2001,7 +2002,7 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d)
dec [hl]
ld e, a
ld d, 14 * 8
- callba BattleAnim_Sine_e
+ farcall BattleAnim_Sine_e
ld a, e
ld hl, SPRITEANIMSTRUCT_YOFFSET
add hl, bc
@@ -2211,17 +2212,17 @@ Reel3Tilemap: ; 9334b
; 9335d
SlotsTilemap: ; 9335d
-INCBIN "gfx/slots.tilemap"
+INCBIN "gfx/slots/slots.tilemap"
; 9344d
Slots1LZ: ; 9344d
-INCBIN "gfx/slots_1.2bpp.lz"
+INCBIN "gfx/slots/slots_1.2bpp.lz"
; 935cd
Slots2LZ: ; 935cd
-INCBIN "gfx/slots_2.2bpp.lz"
+INCBIN "gfx/slots/slots_2.2bpp.lz"
; 9382d
Slots3LZ: ; 9382d
-INCBIN "gfx/slots_3.2bpp.lz"
+INCBIN "gfx/slots/slots_3.2bpp.lz"
; 93a3d
diff --git a/engine/spawn_points.asm b/engine/spawn_points.asm
index e8f1177f2..daebb6159 100644
--- a/engine/spawn_points.asm
+++ b/engine/spawn_points.asm
@@ -1,58 +1,17 @@
-
-SpawnPoints: ; 0x152ab
-
-spawn: MACRO
-; map, y, x
- map \1
- db \2, \3
-ENDM
-
- spawn KRISS_HOUSE_2F, 3, 3
- spawn VIRIDIAN_POKECENTER_1F, 5, 3
-
- spawn PALLET_TOWN, 5, 6
- spawn VIRIDIAN_CITY, 23, 26
- spawn PEWTER_CITY, 13, 26
- spawn CERULEAN_CITY, 19, 22
- spawn ROUTE_10_NORTH, 11, 2
- spawn VERMILION_CITY, 9, 6
- spawn LAVENDER_TOWN, 5, 6
- spawn SAFFRON_CITY, 9, 30
- spawn CELADON_CITY, 29, 10
- spawn FUCHSIA_CITY, 19, 28
- spawn CINNABAR_ISLAND, 11, 12
- spawn ROUTE_23, 9, 6
-
- spawn NEW_BARK_TOWN, 13, 6
- spawn CHERRYGROVE_CITY, 29, 4
- spawn VIOLET_CITY, 31, 26
- spawn ROUTE_32, 11, 74
- spawn AZALEA_TOWN, 15, 10
- spawn CIANWOOD_CITY, 23, 44
- spawn GOLDENROD_CITY, 15, 28
- spawn OLIVINE_CITY, 13, 22
- spawn ECRUTEAK_CITY, 23, 28
- spawn MAHOGANY_TOWN, 15, 14
- spawn LAKE_OF_RAGE, 21, 29
- spawn BLACKTHORN_CITY, 21, 30
- spawn SILVER_CAVE_OUTSIDE, 23, 20
- spawn FAST_SHIP_CABINS_SW_SSW_NW, 6, 2
- spawn N_A, -1, -1
-
+INCLUDE "data/maps/spawn_points.asm"
LoadSpawnPoint: ; 1531f
- ; loads the spawn point in wd001
+ ; loads the spawn point in DefaultSpawnpoint
push hl
push de
- ld a, [wd001]
+ ld a, [DefaultSpawnpoint]
cp SPAWN_N_A
jr z, .spawn_n_a
ld l, a
ld h, 0
-rept 2 ; multiply hl by 4
- add hl,hl
-endr
+ add hl, hl
+ add hl, hl
ld de, SpawnPoints
add hl, de
ld a, [hli]
diff --git a/engine/specials.asm b/engine/specials.asm
index 2548cf076..95f7cdf03 100644
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -2,9 +2,9 @@
Special:: ; c01b
; Run script special de.
ld hl, SpecialsPointers
- add hl,de
- add hl,de
- add hl,de
+ add hl, de
+ add hl, de
+ add hl, de
ld b, [hl]
inc hl
ld a, [hli]
@@ -111,7 +111,7 @@ SpecialsPointers:: ; c029
add_special Special_DisplayLinkRecord
add_special GetFirstPokemonHappiness
add_special CheckFirstMonIsEgg
- add_special RandomPhoneRareWildMon
+ add_special RandomUnseenWildMon
add_special RandomPhoneWildMon
add_special RandomPhoneMon
add_special MapCallbackSprites_LoadUsedSpritesGFX
@@ -200,7 +200,7 @@ SpecialNone: ; c224
Special_SetPlayerPalette: ; c225
ld a, [ScriptVar]
ld d, a
- callba SetPlayerPalette
+ farcall SetPlayerPalette
ret
; c230
@@ -215,7 +215,7 @@ Special_GameCornerPrizeMonCheckDex: ; c230
call FadeToMenu
ld a, [ScriptVar]
ld [wd265], a
- callba NewPokedexEntry
+ farcall NewPokedexEntry
call ExitAllMenus
ret
; c252
@@ -230,28 +230,28 @@ SpecialSeenMon: ; c252
Special_FindGreaterThanThatLevel: ; c25a
ld a, [ScriptVar]
ld b, a
- callba _FindGreaterThanThatLevel
+ farcall _FindGreaterThanThatLevel
jr z, FoundNone
jr FoundOne
Special_FindAtLeastThatHappy: ; c268
ld a, [ScriptVar]
ld b, a
- callba _FindAtLeastThatHappy
+ farcall _FindAtLeastThatHappy
jr z, FoundNone
jr FoundOne
Special_FindThatSpecies: ; c276
ld a, [ScriptVar]
ld b, a
- callba _FindThatSpecies
+ farcall _FindThatSpecies
jr z, FoundNone
jr FoundOne
Special_FindThatSpeciesYourTrainerID: ; c284
ld a, [ScriptVar]
ld b, a
- callba _FindThatSpeciesYourTrainerID
+ farcall _FindThatSpeciesYourTrainerID
jr z, FoundNone
jr FoundOne
@@ -269,7 +269,7 @@ FoundNone: ; c298
SpecialNameRival: ; 0xc29d
ld b, $2 ; rival
ld de, RivalName
- callba _NamingScreen
+ farcall _NamingScreen
; default to "SILVER"
ld hl, RivalName
ld de, DefaultRivalName
@@ -281,27 +281,27 @@ DefaultRivalName: ; 0xc2b2
db "SILVER@"
SpecialNameRater: ; c2b9
- callba NameRater
+ farcall NameRater
ret
; c2c0
Special_TownMap: ; c2c0
call FadeToMenu
- callba _TownMap
+ farcall _TownMap
call ExitAllMenus
ret
; c2cd
Special_UnownPrinter: ; c2cd
call FadeToMenu
- callba UnownPrinter
+ farcall UnownPrinter
call ExitAllMenus
ret
; c2da
Special_DisplayLinkRecord: ; c2da
call FadeToMenu
- callba DisplayLinkRecord
+ farcall DisplayLinkRecord
call ExitAllMenus
ret
; c2e7
@@ -309,7 +309,7 @@ Special_DisplayLinkRecord: ; c2da
Special_KrissHousePC: ; c2e7
xor a
ld [ScriptVar], a
- callba _KrissHousePC
+ farcall _KrissHousePC
ld a, c
ld [ScriptVar], a
ret
@@ -365,7 +365,7 @@ Special_GetMysteryGiftItem: ; c309
; 0xc34a
BugContestJudging: ; c34a
- callba _BugContestJudging
+ farcall _BugContestJudging
ld a, b
ld [ScriptVar], a
ret
@@ -374,13 +374,13 @@ BugContestJudging: ; c34a
MapRadio: ; c355
ld a, [ScriptVar]
ld e, a
- callba PlayRadio
+ farcall PlayRadio
ret
; c360
Special_UnownPuzzle: ; c360
call FadeToMenu
- callba UnownPuzzle
+ farcall UnownPuzzle
ld a, [wSolvedUnownPuzzle]
ld [ScriptVar], a
call ExitAllMenus
@@ -485,7 +485,7 @@ ScriptReturnCarry: ; c3e2
; c3ef
Special_CheckUnusedTwoDayTimer: ; c3ef
- callba CheckUnusedTwoDayTimer
+ farcall CheckUnusedTwoDayTimer
ld a, [wUnusedTwoDayTimer]
ld [ScriptVar], a
ret
@@ -520,20 +520,20 @@ StoreSwarmMapIndices:: ; c403
SpecialCheckPokerus: ; c419
; Check if a monster in your party has Pokerus
- callba CheckPokerus
+ farcall CheckPokerus
jp ScriptReturnCarry
; c422
Special_ResetLuckyNumberShowFlag: ; c422
- callba RestartLuckyNumberCountdown
+ farcall RestartLuckyNumberCountdown
ld hl, wLuckyNumberShowFlag
res 0, [hl]
- callba LoadOrRegenerateLuckyIDNumber
+ farcall LoadOrRegenerateLuckyIDNumber
ret
; c434
Special_CheckLuckyNumberShowFlag: ; c434
- callba CheckLuckyNumberShowFlag
+ farcall CheckLuckyNumberShowFlag
jp ScriptReturnCarry
; c43d
@@ -618,9 +618,9 @@ SpecialGameboyCheck: ; c478
Special_FadeOutMusic: ; c48f
ld a, MUSIC_NONE % $100
- ld [MusicFadeIDLo], a
+ ld [MusicFadeID], a
ld a, MUSIC_NONE / $100
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
ld a, $2
ld [MusicFade], a
ret
@@ -628,14 +628,14 @@ Special_FadeOutMusic: ; c48f
Diploma: ; c49f
call FadeToMenu
- callba _Diploma
+ farcall _Diploma
call ExitAllMenus
ret
; c4ac
PrintDiploma: ; c4ac
call FadeToMenu
- callba _PrintDiploma
+ farcall _PrintDiploma
call ExitAllMenus
ret
; c4b9
diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm
index ed7fe20ad..1b3fb9a0d 100755
--- a/engine/sprite_anims.asm
+++ b/engine/sprite_anims.asm
@@ -13,54 +13,54 @@ DoAnimFrame: ; 8d24b
; 8d25b
.Jumptable: ; 8d25b (23:525b)
-
- dw .Null ; null
- dw .one ; bouncing mon icon
- dw .two ; bouncing mon icon, selected
- dw .three ; bouncing mon icon, menu open
- dw .four
- dw .namingscreencursor
- dw .GameFreakLogo ; Game Freak logo
- dw .seven
- dw .eight
- dw .SlotsGolem ; Something to do with slots
- dw .SlotsChansey ; Something to do with slots
- dw .SlotsChanseyEgg ; Something to do with slots
- dw .mailcompositioncursor ; blinking cursor
- dw .thirteen
- dw .fourteen
- dw .fifteen
- dw .sixteen
- dw .seventeen
- dw .eighteen
- dw .EggShell ; finish egg hatching animation
- dw .RadioTuningKnob ; radio tuning knob
- dw .twentyone ; cut grass leaves
- dw .FlyFrom ; flying sprite
- dw .FlyLeaf ; flying leaves
- dw .FlyTo ; fly to
- dw .twentyfive
- dw .twentysix
- dw .twentyseven
- dw .twentyeight
- dw .twentynine ; intro suicune
- dw .thirty ; intro pichu wooper
- dw .thirtyone ; celebi
- dw .thirtytwo ; intro unown
- dw .thirtythree ; intro unown F with suicune leaping up
- dw .thirtyfour ; intro suicune facing away from us
+; entries correspond to SPRITE_ANIM_SEQ_* constants
+ dw .Null
+ dw .PartyMon
+ dw .PartyMonSwitch
+ dw .PartyMonSelected
+ dw .GSTitleTrail
+ dw .NamingScreenCursor
+ dw .GameFreakLogo
+ dw .GSIntroStar
+ dw .GSIntroSparkle
+ dw .SlotsGolem
+ dw .SlotsChansey
+ dw .SlotsChanseyEgg
+ dw .MailCursor
+ dw .ForUnusedCursor
+ dw .DummyGameCursor
+ dw .PokegearArrow
+ dw .TradePokeBall
+ dw .TradeTubeBulge
+ dw .TrademonInTube
+ dw .RevealNewMon
+ dw .RadioTuningKnob
+ dw .CutLeaves
+ dw .FlyFrom
+ dw .FlyLeaf
+ dw .FlyTo
+ dw .sprite_anim_seq_19
+ dw .sprite_anim_seq_1A
+ dw .sprite_anim_seq_1B
+ dw .sprite_anim_seq_1C
+ dw .IntroSuicune
+ dw .IntroPichuWooper
+ dw .Celebi
+ dw .IntroUnown
+ dw .IntroUnownF
+ dw .IntroSuicuneAway
.Null: ; 8d2a1 (23:52a1)
ret
-.one ; 8d2a2 (23:52a2)
+.PartyMon ; 8d2a2 (23:52a2)
ld a, [wMenuCursorY]
ld hl, SPRITEANIMSTRUCT_INDEX
add hl, bc
cp [hl]
- jr z, .two
+ jr z, .PartyMonSwitch
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
@@ -71,7 +71,7 @@ DoAnimFrame: ; 8d24b
ld [hl], $0
ret
-.two ; 8d2b9 (23:52b9)
+.PartyMonSwitch ; 8d2b9 (23:52b9)
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hl], 8 * 3
@@ -113,7 +113,7 @@ DoAnimFrame: ; 8d24b
ld [hl], a
ret
-.three ; 8d2ea (23:52ea)
+.PartyMonSelected ; 8d2ea (23:52ea)
ld a, [wMenuCursorY]
ld hl, SPRITEANIMSTRUCT_INDEX
@@ -132,7 +132,7 @@ DoAnimFrame: ; 8d24b
ld [hl], 8 * 3
ret
-.four ; 8d302 (23:5302)
+.GSTitleTrail ; 8d302 (23:5302)
call .AnonymousJumptable
jp hl
; 8d306 (23:5306)
@@ -203,7 +203,7 @@ DoAnimFrame: ; 8d24b
ret
; 8d35a
-.twentyfive ; 8d35a (23:535a)
+.sprite_anim_seq_19 ; 8d35a (23:535a)
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -217,19 +217,19 @@ DoAnimFrame: ; 8d24b
ld [hl], a
ret
-.namingscreencursor ; 8d36c (23:536c)
- callab NamingScreen_AnimateCursor
+.NamingScreenCursor ; 8d36c (23:536c)
+ callfar NamingScreen_AnimateCursor
ret
-.mailcompositioncursor ; 8d373 (23:5373)
- callab ComposeMail_AnimateCursor
+.MailCursor ; 8d373 (23:5373)
+ callfar ComposeMail_AnimateCursor
ret
.GameFreakLogo: ; 8d37a (23:537a)
- callab GameFreakLogoJumper
+ callfar GameFreakLogoJumper
ret
-.seven ; 8d381 (23:5381)
+.GSIntroStar ; 8d381 (23:5381)
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -279,7 +279,7 @@ DoAnimFrame: ; 8d24b
call DeinitializeSprite
ret
-.eight ; 8d3c3 (23:53c3)
+.GSIntroSparkle ; 8d3c3 (23:53c3)
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hli]
@@ -357,11 +357,11 @@ DoAnimFrame: ; 8d24b
ret
.SlotsGolem: ; 8d422 (23:5422)
- callab SlotMachine_AnimateGolem
+ callfar SlotMachine_AnimateGolem
ret
.SlotsChansey: ; 8d429 (23:5429)
- callab Slots_AnimateChansey
+ callfar Slots_AnimateChansey
ld hl, wcf64
ld a, [hl]
cp $2
@@ -404,33 +404,33 @@ DoAnimFrame: ; 8d24b
ld [hl], a
ret
-.thirteen ; 8d46e (23:546e)
- callab ret_e00ed
+.ForUnusedCursor ; 8d46e (23:546e)
+ callfar ret_e00ed
ret
-.fifteen ; 8d475 (23:5475)
- callab AnimatePokegearModeIndicatorArrow
+.PokegearArrow ; 8d475 (23:5475)
+ callfar AnimatePokegearModeIndicatorArrow
ret
-.fourteen ; 8d47c (23:547c)
- callab DummyGame_InterpretJoypad_AnimateCursor
+.DummyGameCursor ; 8d47c (23:547c)
+ callfar DummyGame_InterpretJoypad_AnimateCursor
ret
-.sixteen ; 8d483 (23:5483)
+.TradePokeBall ; 8d483 (23:5483)
call .AnonymousJumptable
jp hl
; 8d487 (23:5487)
; Anonymous dw (see .AnonymousJumptable)
- dw .sixteen_zero
- dw .sixteen_one
- dw .sixteen_two
- dw .sixteen_three
- dw .sixteen_four
- dw .sixteen_five
+ dw .TradePokeBall_zero
+ dw .TradePokeBall_one
+ dw .TradePokeBall_two
+ dw .TradePokeBall_three
+ dw .TradePokeBall_four
+ dw .TradePokeBall_five
; 8d493
-.sixteen_zero ; 8d493
+.TradePokeBall_zero ; 8d493
ld a, SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL_0
call _ReinitSpriteAnimFrame
@@ -444,7 +444,7 @@ DoAnimFrame: ; 8d24b
ret
; 8d4a5
-.sixteen_two ; 8d4a5
+.TradePokeBall_two ; 8d4a5
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -460,7 +460,7 @@ DoAnimFrame: ; 8d24b
add hl, bc
ld [hl], $40
-.sixteen_three ; 8d4b8
+.TradePokeBall_three ; 8d4b8
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -478,10 +478,10 @@ DoAnimFrame: ; 8d24b
.asm_8d4cd
ld de, SFX_GOT_SAFARI_BALLS
call PlaySFX
- jr .sixteen_five
+ jr .TradePokeBall_five
; 8d4d5
-.sixteen_one ; 8d4d5
+.TradePokeBall_one ; 8d4d5
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], $4
@@ -496,7 +496,7 @@ DoAnimFrame: ; 8d24b
ret
; 8d4e8
-.sixteen_four ; 8d4e8
+.TradePokeBall_four ; 8d4e8
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld a, [hl]
@@ -542,12 +542,12 @@ DoAnimFrame: ; 8d24b
call .IncrementJumptableIndex
ret
-.sixteen_five ; 8d526
+.TradePokeBall_five ; 8d526
call DeinitializeSprite
ret
; 8d52a
-.seventeen ; 8d52a (23:552a)
+.TradeTubeBulge ; 8d52a (23:552a)
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
@@ -565,11 +565,11 @@ DoAnimFrame: ; 8d24b
call DeinitializeSprite
ret
-.eighteen ; 8d543 (23:5543)
- callab TradeAnim_AnimateTrademonInTube
+.TrademonInTube ; 8d543 (23:5543)
+ callfar TradeAnim_AnimateTrademonInTube
ret
-.EggShell: ; 8d54a (23:554a)
+.RevealNewMon: ; 8d54a (23:554a)
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -607,10 +607,10 @@ DoAnimFrame: ; 8d24b
ret
.RadioTuningKnob: ; 8d578 (23:5578)
- callab AnimateTuningKnob
+ callfar AnimateTuningKnob
ret
-.twentyone ; 8d57f (23:557f)
+.CutLeaves ; 8d57f (23:557f)
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld e, [hl]
@@ -749,15 +749,15 @@ DoAnimFrame: ; 8d24b
ld [hl], a
ret
-.twentyseven ; 8d630 (23:5630)
- callba Function108bc7
+.sprite_anim_seq_1B ; 8d630 (23:5630)
+ farcall Function108bc7
ret
-.twentyeight ; 8d637 (23:5637)
- callba Function108be0
+.sprite_anim_seq_1C ; 8d637 (23:5637)
+ farcall Function108be0
ret
-.twentynine ; 8d63e (23:563e)
+.IntroSuicune ; 8d63e (23:563e)
ld a, [wcf65]
and a
jr nz, .asm_8d645
@@ -784,7 +784,7 @@ DoAnimFrame: ; 8d24b
call _ReinitSpriteAnimFrame
ret
-.thirty ; 8d666 (23:5666)
+.IntroPichuWooper ; 8d666 (23:5666)
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
@@ -803,7 +803,7 @@ DoAnimFrame: ; 8d24b
.asm_8d67f
ret
-.thirtytwo ; 8d680 (23:5680)
+.IntroUnown ; 8d680 (23:5680)
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld d, [hl]
@@ -830,7 +830,7 @@ DoAnimFrame: ; 8d24b
ld [hl], a
ret
-.thirtythree ; 8d6a2 (23:56a2)
+.IntroUnownF ; 8d6a2 (23:56a2)
ld a, [wcf64]
cp $40
ret nz
@@ -838,7 +838,7 @@ DoAnimFrame: ; 8d24b
call _ReinitSpriteAnimFrame
ret
-.thirtyfour ; 8d6ae (23:56ae)
+.IntroSuicuneAway ; 8d6ae (23:56ae)
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, [hl]
@@ -846,12 +846,12 @@ DoAnimFrame: ; 8d24b
ld [hl], a
ret
-.twentysix ; 8d6b7 (23:56b7)
- callba AnimateEZChatCursor
+.sprite_anim_seq_1A ; 8d6b7 (23:56b7)
+ farcall AnimateEZChatCursor
ret
-.thirtyone ; 8d6be (23:56be)
- callba UpdateCelebiPosition
+.Celebi ; 8d6be (23:56be)
+ farcall UpdateCelebiPosition
ret
.AnonymousJumptable: ; 8d6c5 (23:56c5)
diff --git a/engine/sprites.asm b/engine/sprites.asm
index b358275eb..afccc114a 100755
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -550,60 +550,30 @@ BrokenGetStdGraphics: ; 8d1ac
ret
; 8d1c4
-SpriteAnimSeqData: ; 8d1c4
- ; frameset sequence, tile
- db SPRITE_ANIM_FRAMESET_PARTY_MON, SPRITE_ANIM_SEQ_01, $00 ; 00
- db SPRITE_ANIM_FRAMESET_07, SPRITE_ANIM_SEQ_04, $00 ; 01
- db SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR, SPRITE_ANIM_SEQ_05, $05 ; 02
- db SPRITE_ANIM_FRAMESET_GAMEFREAK_LOGO, SPRITE_ANIM_SEQ_GAMEFREAK_LOGO, $00 ; 03
- db SPRITE_ANIM_FRAMESET_0B, SPRITE_ANIM_SEQ_07, $06 ; 04 gs intro star
- db SPRITE_ANIM_FRAMESET_0C, SPRITE_ANIM_SEQ_08, $06 ; 05 gs intro sparkle
- db SPRITE_ANIM_FRAMESET_SLOTS_GOLEM, SPRITE_ANIM_SEQ_SLOT_GOLEM, $07 ; 06 slots golem
- db SPRITE_ANIM_FRAMESET_SLOTS_CHANSEY, SPRITE_ANIM_SEQ_SLOTS_CHANSEY, $07 ; 07 slots chansey
- db SPRITE_ANIM_FRAMESET_SLOTS_EGG, SPRITE_ANIM_SEQ_SLOTS_EGG, $07 ; 08 slots egg
- db SPRITE_ANIM_FRAMESET_TEXT_ENTRY_CURSOR, SPRITE_ANIM_SEQ_0C, $05 ; 09
- db SPRITE_ANIM_FRAMESET_WALK_CYCLE, SPRITE_ANIM_SEQ_NULL, $00 ; 0a walk cycle
- db SPRITE_ANIM_FRAMESET_STILL_CURSOR, SPRITE_ANIM_SEQ_0D, $08 ; 0b
- db SPRITE_ANIM_FRAMESET_STILL_CURSOR, SPRITE_ANIM_SEQ_0E, $08 ; 0c
- db SPRITE_ANIM_FRAMESET_STILL_CURSOR, SPRITE_ANIM_SEQ_0F, $08 ; 0d
- db SPRITE_ANIM_FRAMESET_TRADE_POKE_BALL, SPRITE_ANIM_SEQ_10, $00 ; 0e
- db SPRITE_ANIM_FRAMESET_TRADE_POOF, SPRITE_ANIM_SEQ_NULL, $00 ; 0f
- db SPRITE_ANIM_FRAMESET_TRADE_TUBE_BULGE, SPRITE_ANIM_SEQ_11, $00 ; 10
- db SPRITE_ANIM_FRAMESET_TRADEMON_ICON, SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE, $00 ; 11
- db SPRITE_ANIM_FRAMESET_TRADEMON_BUBBLE, SPRITE_ANIM_SEQ_TRADEMON_IN_TUBE, $00 ; 12
- db SPRITE_ANIM_FRAMESET_EVOLUTION_BALL_OF_LIGHT, SPRITE_ANIM_SEQ_13, $00 ; 13
- db SPRITE_ANIM_FRAMESET_RADIO_TUNING_KNOB, SPRITE_ANIM_SEQ_14, $00 ; 14 radio tuning knob
- db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_RED, SPRITE_ANIM_SEQ_NULL, $00 ; 15 chris on magnet train
- db SPRITE_ANIM_FRAMESET_LEAF, SPRITE_ANIM_SEQ_15, $00 ; 16 leaves when cutting down a tree
- db SPRITE_ANIM_FRAMESET_CUT_TREE, SPRITE_ANIM_SEQ_NULL, $00 ; 17
- db SPRITE_ANIM_FRAMESET_LEAF, SPRITE_ANIM_SEQ_FLY_LEAF, $00 ; 18 flying leaves
- db SPRITE_ANIM_FRAMESET_EGG_CRACK, SPRITE_ANIM_SEQ_NULL, $00 ; 19
- db SPRITE_ANIM_FRAMESET_24, SPRITE_ANIM_SEQ_19, $00 ; 1a
- db SPRITE_ANIM_FRAMESET_HEADBUTT, SPRITE_ANIM_SEQ_NULL, $00 ; 1b headbutt
- db SPRITE_ANIM_FRAMESET_EGG_HATCH, SPRITE_ANIM_SEQ_13, $00 ; 1c
- db SPRITE_ANIM_FRAMESET_26, SPRITE_ANIM_SEQ_1A, $00 ; 1d
- db SPRITE_ANIM_FRAMESET_BLUE_WALK, SPRITE_ANIM_SEQ_NULL, $00 ; 1e kris on map
- db SPRITE_ANIM_FRAMESET_MAGNET_TRAIN_BLUE, SPRITE_ANIM_SEQ_NULL, $00 ; 1f kris on magnet train
- db SPRITE_ANIM_FRAMESET_2F, SPRITE_ANIM_SEQ_NULL, $00 ; 20
- db SPRITE_ANIM_FRAMESET_30, SPRITE_ANIM_SEQ_NULL, $00 ; 21
- db SPRITE_ANIM_FRAMESET_31, SPRITE_ANIM_SEQ_NULL, $00 ; 22
- db SPRITE_ANIM_FRAMESET_32, SPRITE_ANIM_SEQ_1B, $00 ; 23
- db SPRITE_ANIM_FRAMESET_33, SPRITE_ANIM_SEQ_1C, $00 ; 24
- db SPRITE_ANIM_FRAMESET_34, SPRITE_ANIM_SEQ_NULL, $00 ; 25
- db SPRITE_ANIM_FRAMESET_INTRO_SUICUNE, SPRITE_ANIM_SEQ_1D, $00 ; 26
- db SPRITE_ANIM_FRAMESET_INTRO_PICHU, SPRITE_ANIM_SEQ_1E, $00 ; 27
- db SPRITE_ANIM_FRAMESET_INTRO_WOOPER, SPRITE_ANIM_SEQ_1E, $00 ; 28
- db SPRITE_ANIM_FRAMESET_INTRO_UNOWN_1, SPRITE_ANIM_SEQ_20, $00 ; 29 intro unown
- db SPRITE_ANIM_FRAMESET_INTRO_UNOWN_F, SPRITE_ANIM_SEQ_21, $00 ; 2a
- db SPRITE_ANIM_FRAMESET_INTRO_SUICUNE_AWAY, SPRITE_ANIM_SEQ_22, $00 ; 2b
- db SPRITE_ANIM_FRAMESET_CELEBI_LEFT, SPRITE_ANIM_SEQ_NULL, $00 ; 2c
-; 8d24b
-
-INCLUDE "engine/sprite_anims.asm" ; DoAnimFrame
-
-INCLUDE "data/sprite_engine.asm"
-; SpriteAnimFrameData
-; SpriteAnimOAMData
+
+INCLUDE "data/sprite_anim_seqs.asm"
+
+INCLUDE "engine/sprite_anims.asm"
+
+INCLUDE "data/sprite_anim_frames.asm"
+
+INCLUDE "data/sprite_anim_oam.asm"
+
+
+BrokenStdGFXPointers: ; Broken 2bpp pointers
+ dbbw $80, $01, .deleted ; 128-tile 2bpp at 1:672a (inside Multiply)
+ dbbw $80, $01, .deleted
+ dbbw $80, $01, .deleted
+ dbbw $80, $01, .deleted
+ dbbw $10, $37, .deleted ; 16-tile 2bpp at 37:672a (within TilesetTrainStationGFX)
+ dbbw $10, $11, .deleted ; 16-tile 2bpp at 11:672a (empty data)
+ dbbw $10, $39, .deleted ; 16-tile 2bpp at 39:672a (empty data)
+ dbbw $10, $24, .deleted ; 16-tile 2bpp at 24:672a (inside Function926f7)
+ dbbw $10, $21, .deleted ; 16-tile 2bpp at 21:672a (inside Function8671c)
+
+.deleted
+; 8e72a (23:672a)
+
Sprites_Cosine: ; 8e72a
add $10
diff --git a/engine/start_battle.asm b/engine/start_battle.asm
new file mode 100644
index 000000000..d23fe1f15
--- /dev/null
+++ b/engine/start_battle.asm
@@ -0,0 +1,197 @@
+ShowLinkBattleParticipants: ; 2ee18
+; If we're not in a communications room,
+; we don't need to be here.
+ ld a, [wLinkMode]
+ and a
+ ret z
+
+ farcall _ShowLinkBattleParticipants
+ ld c, 150
+ call DelayFrames
+ call ClearTileMap
+ call ClearSprites
+ ret
+
+FindFirstAliveMonAndStartBattle: ; 2ee2f
+ xor a
+ ld [hMapAnims], a
+ call DelayFrame
+ ld b, 6
+ ld hl, PartyMon1HP
+ ld de, PARTYMON_STRUCT_LENGTH - 1
+
+.loop
+ ld a, [hli]
+ or [hl]
+ jr nz, .okay
+ add hl, de
+ dec b
+ jr nz, .loop
+
+.okay
+ ld de, MON_LEVEL - MON_HP
+ add hl, de
+ ld a, [hl]
+ ld [BattleMonLevel], a
+ predef Predef_StartBattle
+ farcall _LoadBattleFontsHPBar
+ ld a, 1
+ ld [hBGMapMode], a
+ call ClearSprites
+ call ClearTileMap
+ xor a
+ ld [hBGMapMode], a
+ ld [hWY], a
+ ld [rWY], a
+ ld [hMapAnims], a
+ ret
+
+PlayBattleMusic: ; 2ee6c
+ push hl
+ push de
+ push bc
+
+ xor a
+ ld [MusicFade], a
+ ld de, MUSIC_NONE
+ call PlayMusic
+ call DelayFrame
+ call MaxVolume
+
+ ld a, [BattleType]
+ cp BATTLETYPE_SUICUNE
+ ld de, MUSIC_SUICUNE_BATTLE
+ jp z, .done
+ cp BATTLETYPE_ROAMING
+ jp z, .done
+
+ ; Are we fighting a trainer?
+ ld a, [OtherTrainerClass]
+ and a
+ jr nz, .trainermusic
+
+ farcall RegionCheck
+ ld a, e
+ and a
+ jr nz, .kantowild
+
+ ld de, MUSIC_JOHTO_WILD_BATTLE
+ ld a, [TimeOfDay]
+ cp NITE_F
+ jr nz, .done
+ ld de, MUSIC_JOHTO_WILD_BATTLE_NIGHT
+ jr .done
+
+.kantowild
+ ld de, MUSIC_KANTO_WILD_BATTLE
+ jr .done
+
+.trainermusic
+ ld de, MUSIC_CHAMPION_BATTLE
+ cp CHAMPION
+ jr z, .done
+ cp RED
+ jr z, .done
+
+ ; really, they should have included admins and scientists here too...
+ ld de, MUSIC_ROCKET_BATTLE
+ cp GRUNTM
+ jr z, .done
+ cp GRUNTF
+ jr z, .done
+
+ ld de, MUSIC_KANTO_GYM_LEADER_BATTLE
+ farcall IsKantoGymLeader
+ jr c, .done
+
+ ld de, MUSIC_JOHTO_GYM_LEADER_BATTLE
+ farcall IsJohtoGymLeader
+ jr c, .done
+
+ ld de, MUSIC_RIVAL_BATTLE
+ ld a, [OtherTrainerClass]
+ cp RIVAL1
+ jr z, .done
+ cp RIVAL2
+ jr nz, .othertrainer
+
+ ld a, [OtherTrainerID]
+ cp RIVAL2_2_CHIKORITA ; Rival in Indigo Plateau
+ jr c, .done
+ ld de, MUSIC_CHAMPION_BATTLE
+ jr .done
+
+.othertrainer
+ ld a, [wLinkMode]
+ and a
+ jr nz, .johtotrainer
+
+ farcall RegionCheck
+ ld a, e
+ and a
+ jr nz, .kantotrainer
+
+.johtotrainer
+ ld de, MUSIC_JOHTO_TRAINER_BATTLE
+ jr .done
+
+.kantotrainer
+ ld de, MUSIC_KANTO_TRAINER_BATTLE
+
+.done
+ call PlayMusic
+
+ pop bc
+ pop de
+ pop hl
+ ret
+
+ClearBattleRAM: ; 2ef18
+ xor a
+ ld [wPlayerAction], a
+ ld [wBattleResult], a
+
+ ld hl, wPartyMenuCursor
+ ld [hli], a
+ ld [hli], a
+ ld [hli], a
+ ld [hl], a
+
+ ld [wMenuScrollPosition], a
+ ld [CriticalHit], a
+ ld [BattleMonSpecies], a
+ ld [wBattleParticipantsNotFainted], a
+ ld [CurBattleMon], a
+ ld [wForcedSwitch], a
+ ld [TimeOfDayPal], a
+ ld [PlayerTurnsTaken], a
+ ld [EnemyTurnsTaken], a
+ ld [EvolvableFlags], a
+
+ ld hl, PlayerHPPal
+ ld [hli], a
+ ld [hl], a
+
+ ld hl, BattleMonDVs
+ ld [hli], a
+ ld [hl], a
+
+ ld hl, EnemyMonDVs
+ ld [hli], a
+ ld [hl], a
+
+; Clear the entire BattleMons area
+ ld hl, wBattle
+ ld bc, wBattleEnd - wBattle
+ xor a
+ call ByteFill
+
+ callfar ResetEnemyStatLevels
+
+ call ClearWindowData
+
+ ld hl, hBGMapAddress
+ xor a
+ ld [hli], a
+ ld [hl], VBGMap0 / $100
+ ret
diff --git a/engine/startmenu.asm b/engine/start_menu.asm
index 32999cacb..d8fbad82d 100755
--- a/engine/startmenu.asm
+++ b/engine/start_menu.asm
@@ -5,7 +5,7 @@ StartMenu:: ; 125cd
ld de, SFX_MENU
call PlaySFX
- callba ReanchorBGMap_NoOAMUpdate
+ farcall ReanchorBGMap_NoOAMUpdate
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
@@ -16,14 +16,14 @@ StartMenu:: ; 125cd
call LoadMenuDataHeader
call .SetUpMenuItems
- ld a, [wd0d2]
+ ld a, [wBattleMenuCursorBuffer]
ld [wMenuCursorBuffer], a
call .DrawMenuAccount_
call DrawVariableLengthMenuBox
call .DrawBugContestStatusBox
call SafeUpdateSprites
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
- callba LoadFonts_NoOAMUpdate
+ farcall LoadFonts_NoOAMUpdate
call .DrawBugContestStatus
call UpdateTimePals
jr .Select
@@ -32,7 +32,7 @@ StartMenu:: ; 125cd
call UpdateSprites
call UpdateTimePals
call .SetUpMenuItems
- ld a, [wd0d2]
+ ld a, [wBattleMenuCursorBuffer]
ld [wMenuCursorBuffer], a
.Select:
@@ -40,7 +40,7 @@ StartMenu:: ; 125cd
jr c, .Exit
call .DrawMenuAccount
ld a, [wMenuCursorBuffer]
- ld [wd0d2], a
+ ld [wBattleMenuCursorBuffer], a
call PlayClickSFX
call PlaceHollowCursor
call .OpenMenu
@@ -393,7 +393,7 @@ endr
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
ret z
- callba StartMenu_DrawBugContestStatusBox
+ farcall StartMenu_DrawBugContestStatusBox
ret
; 128de
@@ -403,7 +403,7 @@ endr
jr nz, .contest
ret
.contest
- callba StartMenu_PrintBugContestStatus
+ farcall StartMenu_PrintBugContestStatus
ret
; 128ed
@@ -442,7 +442,7 @@ StartMenu_Save: ; 1290b
; Save the game.
call BufferScreen
- callba SaveMenu
+ farcall SaveMenu
jr nc, .asm_12919
ld a, 0
ret
@@ -456,7 +456,7 @@ StartMenu_Option: ; 1291c
; Game options.
call FadeToMenu
- callba OptionsMenu
+ farcall OptionsMenu
ld a, 6
ret
; 12928
@@ -466,7 +466,7 @@ StartMenu_Status: ; 12928
; Player status.
call FadeToMenu
- callba TrainerCard
+ farcall TrainerCard
call CloseSubmenu
ld a, 0
ret
@@ -480,7 +480,7 @@ StartMenu_Pokedex: ; 12937
jr z, .asm_12949
call FadeToMenu
- callba Pokedex
+ farcall Pokedex
call CloseSubmenu
.asm_12949
@@ -492,7 +492,7 @@ StartMenu_Pokedex: ; 12937
StartMenu_Pokegear: ; 1294c
call FadeToMenu
- callba PokeGear
+ farcall PokeGear
call CloseSubmenu
ld a, 0
ret
@@ -502,7 +502,7 @@ StartMenu_Pokegear: ; 1294c
StartMenu_Pack: ; 1295b
call FadeToMenu
- callba Pack
+ farcall Pack
ld a, [wcf66]
and a
jr nz, .used_item
@@ -531,17 +531,17 @@ StartMenu_Pokemon: ; 12976
call ClearBGPalettes
.menu
- callba LoadPartyMenuGFX
- callba InitPartyMenuWithCancel
- callba InitPartyMenuGFX
+ farcall LoadPartyMenuGFX
+ farcall InitPartyMenuWithCancel
+ farcall InitPartyMenuGFX
.menunoreload
- callba WritePartyMenuTilemap
- callba PrintPartyMenuText
+ farcall WritePartyMenuTilemap
+ farcall PrintPartyMenuText
call WaitBGMap
call SetPalettes ; load regular palettes?
call DelayFrame
- callba PartyMenuSelect
+ farcall PartyMenuSelect
jr c, .return ; if cancelled or pressed B
call PokemonActionSubmenu
@@ -594,13 +594,13 @@ HasNoItems: ; 129d5
TossItemFromPC: ; 129f4
push de
call PartyMonItemName
- callba _CheckTossableItem
+ farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
jr nz, .key_item
ld hl, .TossHowMany
call MenuTextBox
- callba SelectQuantityToToss
+ farcall SelectQuantityToToss
push af
call CloseWindow
call ExitMenu
@@ -614,7 +614,7 @@ TossItemFromPC: ; 129f4
pop af
jr c, .quit
pop hl
- ld a, [wd107]
+ ld a, [CurItemQuantity]
call TossItem
call PartyMonItemName
ld hl, .TossedThisMany
@@ -678,8 +678,8 @@ PartyMonItemName: ; 12a6c
CancelPokemonAction: ; 12a79
- callba InitPartyMenuWithCancel
- callba UnfreezeMonIcons
+ farcall InitPartyMenuWithCancel
+ farcall UnfreezeMonIcons
ld a, 1
ret
; 12a88
@@ -689,7 +689,7 @@ PokemonActionSubmenu: ; 12a88
hlcoord 1, 15
lb bc, 2, 18
call ClearBox
- callba MonSubmenu
+ farcall MonSubmenu
call GetCurNick
ld a, [MenuSelection]
ld hl, .Actions
@@ -742,13 +742,13 @@ SwitchPartyMons: ; 12aec
inc a
ld [wSwitchMon], a
- callba HoldSwitchmonIcon
- callba InitPartyMenuNoCancel
+ farcall HoldSwitchmonIcon
+ farcall InitPartyMenuNoCancel
ld a, PARTYMENUACTION_MOVE
ld [PartyMenuActionText], a
- callba WritePartyMenuTilemap
- callba PrintPartyMenuText
+ farcall WritePartyMenuTilemap
+ farcall PrintPartyMenuText
hlcoord 0, 1
ld bc, 20 * 2
@@ -760,18 +760,18 @@ SwitchPartyMons: ; 12aec
call SetPalettes
call DelayFrame
- callba PartyMenuSelect
+ farcall PartyMenuSelect
bit 1, b
jr c, .DontSwitch
- callba _SwitchPartyMons
+ farcall _SwitchPartyMons
xor a
ld [PartyMenuActionText], a
- callba LoadPartyMenuGFX
- callba InitPartyMenuWithCancel
- callba InitPartyMenuGFX
+ farcall LoadPartyMenuGFX
+ farcall InitPartyMenuWithCancel
+ farcall InitPartyMenuGFX
ld a, 1
ret
@@ -828,10 +828,10 @@ GiveTakePartyMonItem: ; 12b60
.GiveItem:
- callba DepositSellInitPackBuffers
+ farcall DepositSellInitPackBuffers
.loop
- callba DepositSellPack
+ farcall DepositSellPack
ld a, [wcf66]
and a
@@ -870,7 +870,7 @@ TryGiveItemToPartymon: ; 12bd9
push hl
ld d, a
- callba ItemIsMail
+ farcall ItemIsMail
pop hl
jr c, .please_remove_mail
ld a, [hl]
@@ -930,7 +930,7 @@ GivePartyItem: ; 12c4c
ld a, [CurItem]
ld [hl], a
ld d, a
- callba ItemIsMail
+ farcall ItemIsMail
jr nc, .done
call ComposeMailMessage
@@ -951,7 +951,7 @@ TakePartyItem: ; 12c60
call ReceiveItemFromPokemon
jr nc, .asm_12c94
- callba ItemIsMail
+ farcall ItemIsMail
call GetPartyItemLocation
ld a, [hl]
ld [wd265], a
@@ -1063,7 +1063,7 @@ StartMenuYesNo: ; 12cf5
ComposeMailMessage: ; 12cfe (4:6cfe)
ld de, wTempMailMessage
- callba _ComposeMailMessage
+ farcall _ComposeMailMessage
ld hl, PlayerName
ld de, wTempMailAuthor
ld bc, NAME_LENGTH - 1
@@ -1116,7 +1116,7 @@ MonMailAction: ; 12d45
jp .done
.read
- callba ReadPartyMonMail
+ farcall ReadPartyMonMail
ld a, $0
ret
@@ -1126,7 +1126,7 @@ MonMailAction: ; 12d45
jr c, .RemoveMailToBag
ld a, [CurPartyMon]
ld b, a
- callba SendMailToPC
+ farcall SendMailToPC
jr c, .MailboxFull
ld hl, .sentmailtopctext
call MenuTextBoxBackup
@@ -1234,7 +1234,7 @@ OpenPartyStats: ; 12e00
MonMenu_Cut: ; 12e1b
- callba CutFunction
+ farcall CutFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1249,13 +1249,13 @@ MonMenu_Cut: ; 12e1b
MonMenu_Fly: ; 12e30
- callba FlyFunction
+ farcall FlyFunction
ld a, [wFieldMoveSucceeded]
cp $2
jr z, .Fail
cp $0
jr z, .Error
- callba TrainerRankings_Fly
+ farcall TrainerRankings_Fly
ld b, $4
ld a, $2
ret
@@ -1274,7 +1274,7 @@ MonMenu_Fly: ; 12e30
; 12e55
MonMenu_Flash: ; 12e55
- callba OWFlash
+ farcall OWFlash
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1288,7 +1288,7 @@ MonMenu_Flash: ; 12e55
; 12e6a
MonMenu_Strength: ; 12e6a
- callba StrengthFunction
+ farcall StrengthFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1302,7 +1302,7 @@ MonMenu_Strength: ; 12e6a
; 12e7f
MonMenu_Whirlpool: ; 12e7f
- callba WhirlpoolFunction
+ farcall WhirlpoolFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1316,7 +1316,7 @@ MonMenu_Whirlpool: ; 12e7f
; 12e94
MonMenu_Waterfall: ; 12e94
- callba WaterfallFunction
+ farcall WaterfallFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1330,7 +1330,7 @@ MonMenu_Waterfall: ; 12e94
; 12ea9
MonMenu_Teleport: ; 12ea9
- callba TeleportFunction
+ farcall TeleportFunction
ld a, [wFieldMoveSucceeded]
and a
jr z, .Fail
@@ -1344,7 +1344,7 @@ MonMenu_Teleport: ; 12ea9
; 12ebd
MonMenu_Surf: ; 12ebd
- callba SurfFunction
+ farcall SurfFunction
ld a, [wFieldMoveSucceeded]
and a
jr z, .Fail
@@ -1358,7 +1358,7 @@ MonMenu_Surf: ; 12ebd
; 12ed1
MonMenu_Dig: ; 12ed1
- callba DigFunction
+ farcall DigFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1374,7 +1374,7 @@ MonMenu_Dig: ; 12ed1
MonMenu_Softboiled_MilkDrink: ; 12ee6
call .CheckMonHasEnoughHP
jr nc, .NotEnoughHP
- callba Softboiled_MilkDrinkFunction
+ farcall Softboiled_MilkDrinkFunction
jr .finish
.NotEnoughHP:
@@ -1417,7 +1417,7 @@ MonMenu_Softboiled_MilkDrink: ; 12ee6
; 12f26
MonMenu_Headbutt: ; 12f26
- callba HeadbuttFunction
+ farcall HeadbuttFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1431,7 +1431,7 @@ MonMenu_Headbutt: ; 12f26
; 12f3b
MonMenu_RockSmash: ; 12f3b
- callba RockSmashFunction
+ farcall RockSmashFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail
@@ -1445,7 +1445,7 @@ MonMenu_RockSmash: ; 12f3b
; 12f50
MonMenu_SweetScent: ; 12f50
- callba SweetScentFromMenu
+ farcall SweetScentFromMenu
ld b, $4
ld a, $2
ret
@@ -1762,8 +1762,8 @@ SetUpMoveScreenBG: ; 13172
call ClearSprites
xor a
ld [hBGMapMode], a
- callba LoadStatsScreenPageTilesGFX
- callba ClearSpriteAnims2
+ farcall LoadStatsScreenPageTilesGFX
+ farcall ClearSpriteAnims2
ld a, [CurPartyMon]
ld e, a
ld d, $0
@@ -1772,7 +1772,7 @@ SetUpMoveScreenBG: ; 13172
ld a, [hl]
ld [wd265], a
ld e, $2
- callba LoadMenuMonIcon
+ farcall LoadMenuMonIcon
hlcoord 0, 1
ld b, 9
ld c, 18
@@ -1792,7 +1792,7 @@ SetUpMoveScreenBG: ; 13172
hlcoord 5, 1
call PlaceString
push bc
- callba CopyPkmnToTempMon
+ farcall CopyPkmnToTempMon
pop hl
call PrintLevel
ld hl, PlayerHPPal
diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm
index 6a59019f0..da02808b1 100755
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -3,7 +3,7 @@ BattleStatsScreenInit: ; 4dc7b (13:5c7b)
cp LINK_MOBILE
jr nz, StatsScreenInit
- ld a, [wBattleMode] ; wd22d (aliases: EnemyMonEnd)
+ ld a, [wBattleMode]
and a
jr z, StatsScreenInit
jr _MobileStatsScreenInit
@@ -33,7 +33,7 @@ StatsScreenInit_gotaddress: ; 4dc94
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
- callba StatsScreen_LoadFont
+ farcall StatsScreen_LoadFont
pop hl
call _hl_
call ClearBGPalettes
@@ -83,13 +83,13 @@ StatsScreenMobile: ; 4dcf7
or $1
ld [wcf64], a
.loop
- callba Mobile_SetOverworldDelay
+ farcall Mobile_SetOverworldDelay
ld a, [wJumptableIndex]
and $7f
ld hl, StatsScreenPointerTable
rst JumpTable
call StatsScreen_WaitAnim
- callba MobileComms_CheckInactivityTimer
+ farcall MobileComms_CheckInactivityTimer
jr c, .exit
ld a, [wJumptableIndex]
bit 7, a
@@ -121,14 +121,14 @@ StatsScreen_WaitAnim: ; 4dd3a (13:5d3a)
ret
.try_anim
- callba SetUpPokeAnim
+ farcall SetUpPokeAnim
jr nc, .finish
ld hl, wcf64
res 6, [hl]
.finish
ld hl, wcf64
res 5, [hl]
- callba HDMATransferTileMapToWRAMBank3
+ farcall HDMATransferTileMapToWRAMBank3
ret
StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62)
@@ -148,7 +148,7 @@ MonStatsInit: ; 4dd72 (13:5d72)
res 6, [hl]
call ClearBGPalettes
call ClearTileMap
- callba HDMATransferTileMapToWRAMBank3
+ farcall HDMATransferTileMapToWRAMBank3
call StatsScreen_CopyToTempMon
ld a, [CurPartySpecies]
cp EGG
@@ -234,14 +234,14 @@ StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2)
jr .done
.breedmon
- callba CopyPkmnToTempMon
+ farcall CopyPkmnToTempMon
ld a, [CurPartySpecies]
cp EGG
jr z, .done
ld a, [MonType]
cp BOXMON
jr c, .done
- callba CalcTempmonStats
+ farcall CalcTempmonStats
.done
and a
ret
@@ -254,7 +254,7 @@ StatsScreen_GetJoypad: ; 4de2c (13:5e2c)
push hl
push de
push bc
- callba StatsScreenDPad
+ farcall StatsScreenDPad
pop bc
pop de
pop hl
@@ -377,7 +377,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea)
call .PlaceHPBar
xor a
ld [hBGMapMode], a
- ld a, [CurBaseData] ; wd236 (aliases: BaseDexNo)
+ ld a, [BaseDexNo]
ld [wd265], a
ld [CurSpecies], a
hlcoord 8, 0
@@ -401,7 +401,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea)
hlcoord 9, 4
ld a, "/"
ld [hli], a
- ld a, [CurBaseData] ; wd236 (aliases: BaseDexNo)
+ ld a, [BaseDexNo]
ld [wd265], a
call GetPokemonName
call PlaceString
@@ -419,8 +419,8 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea)
ld a, [hli]
ld d, a
ld e, [hl]
- callba ComputeHPBarPixels
- ld hl, wcda1
+ farcall ComputeHPBarPixels
+ ld hl, wCurHPPal
call SetHPPal
ld b, SCGB_STATS_SCREEN_HP_PALS
call GetSGBLayout
@@ -429,7 +429,7 @@ StatsScreen_InitUpperHalf: ; 4deea (13:5eea)
.PlaceGenderChar: ; 4df66 (13:5f66)
push hl
- callba GetGender
+ farcall GetGender
pop hl
ret c
ld a, "♂"
@@ -453,7 +453,7 @@ Function4df7f: ; 4df7f
ld bc, SCREEN_WIDTH
ld d, SCREEN_HEIGHT
.loop
- ld a, $31
+ ld a, "|"
ld [hl], a
add hl, bc
dec d
@@ -480,14 +480,14 @@ StatsScreen_PlacePageSwitchArrows: ; 4df9b (13:5f9b)
StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6)
ld bc, TempMonDVs
- callba CheckShininess
+ farcall CheckShininess
ret nc
hlcoord 19, 0
ld [hl], "<SHINY>"
ret
StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
- ld a, [BaseDexNo] ; wd236 (aliases: BaseDexNo)
+ ld a, [BaseDexNo]
ld [wd265], a
ld [CurSpecies], a
xor a
@@ -519,7 +519,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
ld a, [wcf64]
and $3
ld c, a
- callba LoadStatsScreenPals
+ farcall LoadStatsScreenPals
call DelayFrame
ld hl, wcf64
set 5, [hl]
@@ -583,7 +583,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
hlcoord 9, 8
ld de, SCREEN_WIDTH
ld b, 10
- ld a, $31
+ ld a, "|"
.vertical_divider
ld [hl], a
add hl, de
@@ -601,7 +601,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
call .CalcExpToNextLevel
hlcoord 13, 13
lb bc, 3, 7
- ld de, Buffer1 ; wd1ea (aliases: MagikarpLength)
+ ld de, Buffer1
call PrintNum
ld de, .LevelUpStr
hlcoord 10, 12
@@ -639,7 +639,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
jr z, .AlreadyAtMaxLevel
inc a
ld d, a
- callba CalcExpAtLevel
+ farcall CalcExpAtLevel
ld hl, TempMonExp + 2
ld hl, TempMonExp + 2
ld a, [hQuotient + 2]
@@ -649,14 +649,14 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
ld a, [hQuotient + 1]
sbc [hl]
dec hl
- ld [Buffer2], a ; wd1eb (aliases: MovementType)
+ ld [Buffer2], a
ld a, [hQuotient]
sbc [hl]
- ld [Buffer1], a ; wd1ea (aliases: MagikarpLength)
+ ld [Buffer1], a
ret
.AlreadyAtMaxLevel:
- ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
+ ld hl, Buffer1
xor a
ld [hli], a
ld [hli], a
@@ -719,7 +719,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
and a
ret z
ld b, a
- callba TimeCapsule_ReplaceTeruSama
+ farcall TimeCapsule_ReplaceTeruSama
ld a, b
ld [wd265], a
call GetItemName
@@ -743,7 +743,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
hlcoord 10, 8
ld de, SCREEN_WIDTH
ld b, 10
- ld a, $31
+ ld a, "|"
.BluePageVerticalDivider:
ld [hl], a
add hl, de
@@ -768,7 +768,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
ld hl, .OTNamePointers
call GetNicknamePointer
call CopyNickname
- callba CheckNickErrors
+ farcall CheckNickErrors
hlcoord 2, 13
call PlaceString
ld a, [TempMonCaughtGender]
@@ -866,7 +866,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226)
ret c
call StatsScreen_LoadTextBoxSpaceGFX
ld de, VTiles2 tile $00
- predef FrontpicPredef
+ predef GetAnimatedFrontpicPredef
hlcoord 0, 0
ld d, $0
ld e, ANIM_MON_MENU
@@ -891,7 +891,7 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad)
.PartyMon: ; 4e2bf (13:62bf)
ld a, [CurPartyMon]
- ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
+ ld hl, PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld b, h
@@ -918,7 +918,7 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad)
ret
.Tempmon: ; 4e2ed (13:62ed)
- ld bc, TempMonSpecies ; wd10e (aliases: TempMon)
+ ld bc, TempMonSpecies
jr .CheckEggFaintedFrzSlp ; utterly pointless
.CheckEggFaintedFrzSlp: ; 4e2f2 (13:62f2)
@@ -965,6 +965,7 @@ StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307)
ret
; 4e32a (13:632a)
+; unreferenced
Unknown_4e32a: ; 4e32a
; A blank tile?
ds 16
@@ -973,7 +974,7 @@ Unknown_4e32a: ; 4e32a
EggStatsScreen: ; 4e33a
xor a
ld [hBGMapMode], a
- ld hl, wcda1
+ ld hl, wCurHPPal
call SetHPPal
ld b, SCGB_STATS_SCREEN_HP_PALS
call GetSGBLayout
@@ -1013,7 +1014,7 @@ EggStatsScreen: ; 4e33a
call DelayFrame
hlcoord 0, 0
call PrepMonFrontpic
- callba HDMATransferTileMapToWRAMBank3
+ farcall HDMATransferTileMapToWRAMBank3
call StatsScreen_AnimateEgg
ld a, [TempMonHappiness]
@@ -1071,7 +1072,7 @@ StatsScreen_AnimateEgg: ; 4e497 (13:6497)
ld [wBoxAlignment], a
call StatsScreen_LoadTextBoxSpaceGFX
ld de, VTiles2 tile $00
- predef FrontpicPredef
+ predef GetAnimatedFrontpicPredef
pop de
hlcoord 0, 0
ld d, $0
diff --git a/engine/std_scripts.asm b/engine/std_scripts.asm
index 4b69a4de1..297725c60 100644
--- a/engine/std_scripts.asm
+++ b/engine/std_scripts.asm
@@ -1,5 +1,5 @@
StdScripts::
- dba PokeCenterNurseScript
+ dba PokecenterNurseScript
dba DifficultBookshelfScript
dba PictureBookshelfScript
dba MagazineBookshelfScript
@@ -15,7 +15,7 @@ StdScripts::
dba TrashCanScript
dba StrengthBoulderScript
dba SmashRockScript
- dba PokeCenterSignScript
+ dba PokecenterSignScript
dba MartSignScript
dba GoldenrodRocketsScript
dba RadioTowerRocketsScript
@@ -52,7 +52,7 @@ StdScripts::
dba GameCornerCoinVendorScript
dba HappinessCheckScript
-PokeCenterNurseScript:
+PokecenterNurseScript:
; EVENT_WELCOMED_TO_POKECOM_CENTER is never set
opentext
@@ -236,8 +236,8 @@ StrengthBoulderScript:
SmashRockScript:
farjump AskRockSmashScript
-PokeCenterSignScript:
- farjumptext PokeCenterSignText
+PokecenterSignScript:
+ farjumptext PokecenterSignText
MartSignScript
farjumptext MartSignText
@@ -297,7 +297,7 @@ RadioTowerRocketsScript:
clearevent EVENT_USED_THE_CARD_KEY_IN_THE_RADIO_TOWER
setevent EVENT_MAHOGANY_TOWN_POKEFAN_M_BLOCKS_EAST
specialphonecall SPECIALCALL_WEIRDBROADCAST
- domaptrigger MAHOGANY_TOWN, $1
+ setmapscene MAHOGANY_TOWN, $1
end
BugContestResultsWarpScript:
@@ -354,8 +354,8 @@ BugContestResults_DidNotLeaveMons
waitbutton
BugContestResults_CleanUp
closetext
- dotrigger $0
- domaptrigger ROUTE_35_NATIONAL_PARK_GATE, $0
+ setscene $0
+ setmapscene ROUTE_35_NATIONAL_PARK_GATE, $0
setevent EVENT_BUG_CATCHING_CONTESTANT_1A
setevent EVENT_BUG_CATCHING_CONTESTANT_2A
setevent EVENT_BUG_CATCHING_CONTESTANT_3A
@@ -497,7 +497,7 @@ InitializeEventsScript:
setevent EVENT_USED_THE_CARD_KEY_IN_THE_RADIO_TOWER
setevent EVENT_RIVAL_CHERRYGROVE_CITY
setevent EVENT_RIVAL_AZALEA_TOWN
- setevent EVENT_RIVAL_UNDERGROUND_PATH
+ setevent EVENT_RIVAL_GOLDENROD_UNDERGROUND
setevent EVENT_AZALEA_TOWN_SLOWPOKES
setevent EVENT_KURTS_HOUSE_SLOWPOKE
setevent EVENT_GUIDE_GENT_VISIBLE_IN_CHERRYGROVE
@@ -550,8 +550,8 @@ InitializeEventsScript:
setevent EVENT_ECRUTEAK_POKE_CENTER_BILL
setevent EVENT_MYSTERY_GIFT_DELIVERY_GUY
setevent EVENT_LAKE_OF_RAGE_LANCE
- setevent EVENT_WAREHOUSE_LAYOUT_1
- setevent EVENT_WAREHOUSE_BLOCKED_OFF
+ setevent EVENT_GOLDENROD_DEPT_STORE_B1F_LAYOUT_1
+ setevent EVENT_GOLDENROD_UNDERGROUND_WAREHOUSE_BLOCKED_OFF
setevent EVENT_DRAGONS_DEN_CLAIR
setevent EVENT_RIVAL_OLIVINE_CITY
setevent EVENT_RIVAL_VICTORY_ROAD
@@ -1786,7 +1786,7 @@ ReceiveItemScript: ; 0xbcdb9
ReceiveTogepiEggScript: ; 0xbcdc3
waitsfx
farwritetext ReceivedItemText
- playsound SFX_GET_EGG_FROM_DAYCARE_LADY
+ playsound SFX_GET_EGG_FROM_DAY_CARE_LADY
waitsfx
end
; 0xbcdcd
diff --git a/engine/tempmon.asm b/engine/tempmon.asm
new file mode 100644
index 000000000..be989d14b
--- /dev/null
+++ b/engine/tempmon.asm
@@ -0,0 +1,127 @@
+CopyPkmnToTempMon: ; 5084a
+; gets the BaseData of a Pkmn
+; and copys the PkmnStructure to TempMon
+
+ ld a, [CurPartyMon]
+ ld e, a
+ call GetPkmnSpecies
+ ld a, [CurPartySpecies]
+ ld [CurSpecies], a
+ call GetBaseData
+
+ ld a, [MonType]
+ ld hl, PartyMon1Species
+ ld bc, PARTYMON_STRUCT_LENGTH
+ and a
+ jr z, .copywholestruct
+ ld hl, OTPartyMon1Species
+ ld bc, PARTYMON_STRUCT_LENGTH
+ cp OTPARTYMON
+ jr z, .copywholestruct
+ ld bc, BOXMON_STRUCT_LENGTH
+ callfar CopyBoxmonToTempMon
+ jr .done
+
+.copywholestruct
+ ld a, [CurPartyMon]
+ call AddNTimes
+ ld de, TempMon
+ ld bc, PARTYMON_STRUCT_LENGTH
+ call CopyBytes
+
+.done
+ ret
+
+CalcwBufferMonStats: ; 5088b
+ ld bc, wBufferMon
+ jr _TempMonStatsCalculation
+
+CalcTempmonStats: ; 50890
+ ld bc, TempMon
+_TempMonStatsCalculation: ; 50893
+ ld hl, MON_LEVEL
+ add hl, bc
+ ld a, [hl]
+ ld [CurPartyLevel], a
+ ld hl, MON_MAXHP
+ add hl, bc
+ ld d, h
+ ld e, l
+ ld hl, MON_STAT_EXP - 1
+ add hl, bc
+ push bc
+ ld b, $1
+ predef CalcPkmnStats
+ pop bc
+ ld hl, MON_HP
+ add hl, bc
+ ld d, h
+ ld e, l
+ ld a, [CurPartySpecies]
+ cp EGG
+ jr nz, .not_egg
+ xor a
+ ld [de], a
+ inc de
+ ld [de], a
+ jr .zero_status
+
+.not_egg
+ push bc
+ ld hl, MON_MAXHP
+ add hl, bc
+ ld bc, 2
+ call CopyBytes
+ pop bc
+
+.zero_status
+ ld hl, MON_STATUS
+ add hl, bc
+ xor a
+ ld [hli], a
+ ld [hl], a
+ ret
+
+GetPkmnSpecies: ; 508d5
+; [MonType] has the type of the Pkmn
+; e = Nr. of Pkmn (i.e. [CurPartyMon])
+
+ ld a, [MonType]
+ and a ; PARTYMON
+ jr z, .partymon
+ cp OTPARTYMON
+ jr z, .otpartymon
+ cp BOXMON
+ jr z, .boxmon
+ cp TEMPMON
+ jr z, .breedmon
+ ; WILDMON
+
+.partymon
+ ld hl, PartySpecies
+ jr .done
+
+.otpartymon
+ ld hl, OTPartySpecies
+ jr .done
+
+.boxmon
+ ld a, BANK(sBoxSpecies)
+ call GetSRAMBank
+ ld hl, sBoxSpecies
+ call .done
+ call CloseSRAM
+ ret
+
+.breedmon
+ ld a, [wBreedMon1Species]
+ jr .done2
+
+.done
+ ld d, 0
+ add hl, de
+ ld a, [hl]
+
+.done2
+ ld [CurPartySpecies], a
+ ret
diff --git a/engine/tile_events.asm b/engine/tile_events.asm
index 1595d436f..23a7a3c85 100755
--- a/engine/tile_events.asm
+++ b/engine/tile_events.asm
@@ -1,12 +1,12 @@
CheckWarpCollision:: ; 1499a
; Is this tile a warp?
ld a, [PlayerStandingTile]
- cp $60
+ cp COLL_PIT
jr z, .warp
- cp $68
+ cp COLL_PIT_68
jr z, .warp
and $f0
- cp $70
+ cp HI_NYBBLE_WARPS
jr z, .warp
and a
ret
@@ -20,13 +20,13 @@ CheckDirectionalWarp:: ; 149af
; If this is a directional warp, clear carry (press the designated button to warp).
; Else, set carry (immediate warp).
ld a, [PlayerStandingTile]
- cp $70 ; Warp on down
+ cp COLL_WARP_CARPET_DOWN
jr z, .directional
- cp $76 ; Warp on left
+ cp COLL_WARP_CARPET_LEFT
jr z, .directional
- cp $78 ; Warp on up
+ cp COLL_WARP_CARPET_UP
jr z, .directional
- cp $7e ; Warp on right
+ cp COLL_WARP_CARPET_RIGHT
jr z, .directional
scf
ret
@@ -45,15 +45,15 @@ CheckWarpFacingDown: ; 149c6
; 149d3
.blocks ; 149d3
- db $71 ; door
- db $79
- db $7a ; stairs
- db $73
- db $7b ; cave entrance
- db $74
- db $7c ; warp pad
- db $75
- db $7d
+ db COLL_DOOR
+ db COLL_DOOR_79
+ db COLL_STAIRCASE
+ db COLL_STAIRCASE_73
+ db COLL_CAVE
+ db COLL_CAVE_74
+ db COLL_WARP_PANEL
+ db COLL_DOOR_75
+ db COLL_DOOR_7D
db -1
; 149dd
@@ -66,16 +66,16 @@ CheckGrassCollision:: ; 149dd
; 149ea
.blocks ; 149ea
- db $08
- db $18 ; tall grass
- db $14 ; tall grass
- db $28
- db $29
- db $48
- db $49
- db $4a
- db $4b
- db $4c
+ db COLL_CUT_08
+ db COLL_TALL_GRASS
+ db COLL_LONG_GRASS
+ db COLL_CUT_28
+ db COLL_WATER
+ db COLL_GRASS_48
+ db COLL_GRASS_49
+ db COLL_GRASS_4A
+ db COLL_GRASS_4B
+ db COLL_GRASS_4C
db -1
; 149f5
@@ -88,22 +88,22 @@ CheckCutCollision: ; 149f5
; 14a00
.blocks ; 14a00
- db $12 ; cut tree
- db $1a ; cut tree
- db $10 ; tall grass
- db $18 ; tall grass
- db $14 ; tall grass
- db $1c ; tall grass
+ db COLL_CUT_TREE
+ db COLL_CUT_TREE_1A
+ db COLL_TALL_GRASS_10
+ db COLL_TALL_GRASS
+ db COLL_LONG_GRASS
+ db COLL_LONG_GRASS_1C
db -1
; 14a07
GetWarpSFX:: ; 14a07
ld a, [PlayerStandingTile]
ld de, SFX_ENTER_DOOR
- cp $71 ; door
+ cp COLL_DOOR
ret z
ld de, SFX_WARP_TO
- cp $7c ; warp pad
+ cp COLL_WARP_PANEL
ret z
ld de, SFX_EXIT_BUILDING
ret
diff --git a/engine/time.asm b/engine/time.asm
index 296cc335d..61ef614c3 100755
--- a/engine/time.asm
+++ b/engine/time.asm
@@ -200,7 +200,7 @@ CheckPokerusTick:: ; 114e7
and a
jr z, .done ; not even a day has passed since game start
ld b, a
- callba ApplyPokerusTick
+ farcall ApplyPokerusTick
.done
xor a
ret
@@ -282,7 +282,7 @@ DoMysteryGiftIfDayHasPassed: ; 11548
ld hl, Buffer1
call InitOneDayCountdown
call CloseSRAM
- callba Function1050c8
+ farcall Function1050c8
.not_timed_out
ld a, BANK(sMysteryGiftTimer)
diff --git a/engine/time_capsule.asm b/engine/time_capsule.asm
new file mode 100755
index 000000000..577b2dce8
--- /dev/null
+++ b/engine/time_capsule.asm
@@ -0,0 +1,147 @@
+; These functions seem to be related to backwards compatibility
+
+ValidateOTTrademon: ; fb57e
+ ld a, [wd003]
+ ld hl, OTPartyMon1Species
+ call GetPartyLocation
+ push hl
+ ld a, [wd003]
+ inc a
+ ld c, a
+ ld b, 0
+ ld hl, OTPartyCount
+ add hl, bc
+ ld a, [hl]
+ pop hl
+ cp EGG
+ jr z, .matching_or_egg
+ cp [hl]
+ jr nz, .abnormal
+
+.matching_or_egg
+ ld b, h
+ ld c, l
+ ld hl, MON_LEVEL
+ add hl, bc
+ ld a, [hl]
+ cp MAX_LEVEL + 1
+ jr nc, .abnormal
+ ld a, [wLinkMode]
+ cp LINK_TIMECAPSULE
+ jr nz, .normal
+ ld hl, OTPartySpecies
+ ld a, [wd003]
+ ld c, a
+ ld b, 0
+ add hl, bc
+ ld a, [hl]
+
+ ; Magnemite and Magneton's types changed
+ ; from Electric to Electric/Steel.
+ cp MAGNEMITE
+ jr z, .normal
+ cp MAGNETON
+ jr z, .normal
+
+ ld [CurSpecies], a
+ call GetBaseData
+ ld hl, wLinkOTPartyMonTypes
+ add hl, bc
+ add hl, bc
+ ld a, [BaseType1]
+ cp [hl]
+ jr nz, .abnormal
+ inc hl
+ ld a, [BaseType2]
+ cp [hl]
+ jr nz, .abnormal
+
+.normal
+ and a
+ ret
+
+.abnormal
+ scf
+ ret
+; fb5dd
+
+Functionfb5dd: ; fb5dd
+ ld a, [wd002]
+ ld d, a
+ ld a, [PartyCount]
+ ld b, a
+ ld c, $0
+.loop
+ ld a, c
+ cp d
+ jr z, .next
+ push bc
+ ld a, c
+ ld hl, PartyMon1HP
+ call GetPartyLocation
+ pop bc
+ ld a, [hli]
+ or [hl]
+ jr nz, .done
+
+.next
+ inc c
+ dec b
+ jr nz, .loop
+ ld a, [wd003]
+ ld hl, OTPartyMon1HP
+ call GetPartyLocation
+ ld a, [hli]
+ or [hl]
+ jr nz, .done
+ scf
+ ret
+
+.done
+ and a
+ ret
+; fb60d
+
+PlaceTradePartnerNamesAndParty: ; fb60d
+ hlcoord 4, 0
+ ld de, PlayerName
+ call PlaceString
+ ld a, $14
+ ld [bc], a
+ hlcoord 4, 8
+ ld de, OTPlayerName
+ call PlaceString
+ ld a, $14
+ ld [bc], a
+ hlcoord 7, 1
+ ld de, PartySpecies
+ call .PlaceSpeciesNames
+ hlcoord 7, 9
+ ld de, OTPartySpecies
+.PlaceSpeciesNames: ; fb634
+ ld c, $0
+.loop
+ ld a, [de]
+ cp -1
+ ret z
+ ld [wd265], a
+ push bc
+ push hl
+ push de
+ push hl
+ ld a, c
+ ld [hProduct], a
+ call GetPokemonName
+ pop hl
+ call PlaceString
+ pop de
+ inc de
+ pop hl
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ pop bc
+ inc c
+ jr .loop
+; fb656
+
+INCLUDE "data/time_capsule/special_stats.asm"
diff --git a/engine/time_capsule/conversion.asm b/engine/time_capsule/conversion.asm
deleted file mode 100755
index 561721074..000000000
--- a/engine/time_capsule/conversion.asm
+++ /dev/null
@@ -1,682 +0,0 @@
-; These functions seem to be related to backwards compatibility
-
-ValidateOTTrademon: ; fb57e
- ld a, [wd003]
- ld hl, OTPartyMon1Species
- call GetPartyLocation
- push hl
- ld a, [wd003]
- inc a
- ld c, a
- ld b, 0
- ld hl, OTPartyCount
- add hl, bc
- ld a, [hl]
- pop hl
- cp EGG
- jr z, .matching_or_egg
- cp [hl]
- jr nz, .abnormal
-
-.matching_or_egg
- ld b, h
- ld c, l
- ld hl, MON_LEVEL
- add hl, bc
- ld a, [hl]
- cp MAX_LEVEL + 1
- jr nc, .abnormal
- ld a, [wLinkMode]
- cp LINK_TIMECAPSULE
- jr nz, .normal
- ld hl, OTPartySpecies
- ld a, [wd003]
- ld c, a
- ld b, 0
- add hl, bc
- ld a, [hl]
-
- ; Magnemite and Magneton's types changed
- ; from Electric to Electric/Steel.
- cp MAGNEMITE
- jr z, .normal
- cp MAGNETON
- jr z, .normal
-
- ld [CurSpecies], a
- call GetBaseData
- ld hl, wLinkOTPartyMonTypes
- add hl, bc
- add hl, bc
- ld a, [BaseType1]
- cp [hl]
- jr nz, .abnormal
- inc hl
- ld a, [BaseType2]
- cp [hl]
- jr nz, .abnormal
-
-.normal
- and a
- ret
-
-.abnormal
- scf
- ret
-; fb5dd
-
-Functionfb5dd: ; fb5dd
- ld a, [wd002]
- ld d, a
- ld a, [PartyCount]
- ld b, a
- ld c, $0
-.loop
- ld a, c
- cp d
- jr z, .next
- push bc
- ld a, c
- ld hl, PartyMon1HP
- call GetPartyLocation
- pop bc
- ld a, [hli]
- or [hl]
- jr nz, .done
-
-.next
- inc c
- dec b
- jr nz, .loop
- ld a, [wd003]
- ld hl, OTPartyMon1HP
- call GetPartyLocation
- ld a, [hli]
- or [hl]
- jr nz, .done
- scf
- ret
-
-.done
- and a
- ret
-; fb60d
-
-PlaceTradePartnerNamesAndParty: ; fb60d
- hlcoord 4, 0
- ld de, PlayerName
- call PlaceString
- ld a, $14
- ld [bc], a
- hlcoord 4, 8
- ld de, OTPlayerName
- call PlaceString
- ld a, $14
- ld [bc], a
- hlcoord 7, 1
- ld de, PartySpecies
- call .PlaceSpeciesNames
- hlcoord 7, 9
- ld de, OTPartySpecies
-.PlaceSpeciesNames: ; fb634
- ld c, $0
-.loop
- ld a, [de]
- cp -1
- ret z
- ld [wd265], a
- push bc
- push hl
- push de
- push hl
- ld a, c
- ld [hProduct], a
- call GetPokemonName
- pop hl
- call PlaceString
- pop de
- inc de
- pop hl
- ld bc, SCREEN_WIDTH
- add hl, bc
- pop bc
- inc c
- jr .loop
-; fb656
-
-KantoMonSpecials: ; fb656
-; The original special base stat for
-; each Kanto monster from Red/Blue.
- db 65 ; BULBASAUR
- db 80 ; IVYSAUR
- db 100 ; VENUSAUR
- db 50 ; CHARMANDER
- db 65 ; CHARMELEON
- db 85 ; CHARIZARD
- db 50 ; SQUIRTLE
- db 65 ; WARTORTLE
- db 85 ; BLASTOISE
- db 20 ; CATERPIE
- db 25 ; METAPOD
- db 80 ; BUTTERFREE
- db 20 ; WEEDLE
- db 25 ; KAKUNA
- db 45 ; BEEDRILL
- db 35 ; PIDGEY
- db 50 ; PIDGEOTTO
- db 70 ; PIDGEOT
- db 25 ; RATTATA
- db 50 ; RATICATE
- db 31 ; SPEAROW
- db 61 ; FEAROW
- db 40 ; EKANS
- db 65 ; ARBOK
- db 50 ; PIKACHU
- db 90 ; RAICHU
- db 30 ; SANDSHREW
- db 55 ; SANDSLASH
- db 40 ; NIDORAN_F
- db 55 ; NIDORINA
- db 75 ; NIDOQUEEN
- db 40 ; NIDORAN_M
- db 55 ; NIDORINO
- db 75 ; NIDOKING
- db 60 ; CLEFAIRY
- db 85 ; CLEFABLE
- db 65 ; VULPIX
- db 100 ; NINETALES
- db 25 ; JIGGLYPUFF
- db 50 ; WIGGLYTUFF
- db 40 ; ZUBAT
- db 75 ; GOLBAT
- db 75 ; ODDISH
- db 85 ; GLOOM
- db 100 ; VILEPLUME
- db 55 ; PARAS
- db 80 ; PARASECT
- db 40 ; VENONAT
- db 90 ; VENOMOTH
- db 45 ; DIGLETT
- db 70 ; DUGTRIO
- db 40 ; MEOWTH
- db 65 ; PERSIAN
- db 50 ; PSYDUCK
- db 80 ; GOLDUCK
- db 35 ; MANKEY
- db 60 ; PRIMEAPE
- db 50 ; GROWLITHE
- db 80 ; ARCANINE
- db 40 ; POLIWAG
- db 50 ; POLIWHIRL
- db 70 ; POLIWRATH
- db 105 ; ABRA
- db 120 ; KADABRA
- db 135 ; ALAKAZAM
- db 35 ; MACHOP
- db 50 ; MACHOKE
- db 65 ; MACHAMP
- db 70 ; BELLSPROUT
- db 85 ; WEEPINBELL
- db 100 ; VICTREEBEL
- db 100 ; TENTACOOL
- db 120 ; TENTACRUEL
- db 30 ; GEODUDE
- db 45 ; GRAVELER
- db 55 ; GOLEM
- db 65 ; PONYTA
- db 80 ; RAPIDASH
- db 40 ; SLOWPOKE
- db 80 ; SLOWBRO
- db 95 ; MAGNEMITE
- db 120 ; MAGNETON
- db 58 ; FARFETCH_D
- db 35 ; DODUO
- db 60 ; DODRIO
- db 70 ; SEEL
- db 95 ; DEWGONG
- db 40 ; GRIMER
- db 65 ; MUK
- db 45 ; SHELLDER
- db 85 ; CLOYSTER
- db 100 ; GASTLY
- db 115 ; HAUNTER
- db 130 ; GENGAR
- db 30 ; ONIX
- db 90 ; DROWZEE
- db 115 ; HYPNO
- db 25 ; KRABBY
- db 50 ; KINGLER
- db 55 ; VOLTORB
- db 80 ; ELECTRODE
- db 60 ; EXEGGCUTE
- db 125 ; EXEGGUTOR
- db 40 ; CUBONE
- db 50 ; MAROWAK
- db 35 ; HITMONLEE
- db 35 ; HITMONCHAN
- db 60 ; LICKITUNG
- db 60 ; KOFFING
- db 85 ; WEEZING
- db 30 ; RHYHORN
- db 45 ; RHYDON
- db 105 ; CHANSEY
- db 100 ; TANGELA
- db 40 ; KANGASKHAN
- db 70 ; HORSEA
- db 95 ; SEADRA
- db 50 ; GOLDEEN
- db 80 ; SEAKING
- db 70 ; STARYU
- db 100 ; STARMIE
- db 100 ; MR__MIME
- db 55 ; SCYTHER
- db 95 ; JYNX
- db 85 ; ELECTABUZZ
- db 85 ; MAGMAR
- db 55 ; PINSIR
- db 70 ; TAUROS
- db 20 ; MAGIKARP
- db 100 ; GYARADOS
- db 95 ; LAPRAS
- db 48 ; DITTO
- db 65 ; EEVEE
- db 110 ; VAPOREON
- db 110 ; JOLTEON
- db 110 ; FLAREON
- db 75 ; PORYGON
- db 90 ; OMANYTE
- db 115 ; OMASTAR
- db 45 ; KABUTO
- db 70 ; KABUTOPS
- db 60 ; AERODACTYL
- db 65 ; SNORLAX
- db 125 ; ARTICUNO
- db 125 ; ZAPDOS
- db 125 ; MOLTRES
- db 50 ; DRATINI
- db 70 ; DRAGONAIR
- db 100 ; DRAGONITE
- db 154 ; MEWTWO
- db 100 ; MEW
-; fb6ed
-
-
-INCLUDE "event/name_rater.asm"
-
-
-PlaySlowCry: ; fb841
- ld a, [ScriptVar]
- call LoadCryHeader
- jr c, .done
-
- ld hl, CryPitch
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld bc, -$140
- add hl, bc
- ld a, l
- ld [CryPitch], a
- ld a, h
- ld [CryPitch + 1], a
- ld hl, CryLength
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ld bc, $60
- add hl, bc
- ld a, l
- ld [CryLength], a
- ld a, h
- ld [CryLength + 1], a
- callba _PlayCryHeader
- call WaitSFX
-
-.done
- ret
-; fb877
-
-NewPokedexEntry: ; fb877
- ld a, [hMapAnims]
- push af
- xor a
- ld [hMapAnims], a
- call LowVolume
- call ClearBGPalettes
- call ClearTileMap
- call UpdateSprites
- call ClearSprites
- ld a, [wPokedexStatus]
- push af
- ld a, [hSCX]
- add $5
- ld [hSCX], a
- xor a
- ld [wPokedexStatus], a
- callba _NewPokedexEntry
- call WaitPressAorB_BlinkCursor
- ld a, $1
- ld [wPokedexStatus], a
- callba DisplayDexEntry
- call WaitPressAorB_BlinkCursor
- pop af
- ld [wPokedexStatus], a
- call MaxVolume
- call RotateThreePalettesRight
- ld a, [hSCX]
- add -5 ; 251 ; NUM_POKEMON
- ld [hSCX], a
- call .ReturnFromDexRegistration
- pop af
- ld [hMapAnims], a
- ret
-; fb8c8
-
-.ReturnFromDexRegistration: ; fb8c8
- call ClearTileMap
- call LoadFontsExtra
- call LoadStandardFont
- callba Pokedex_PlaceFrontpicTopLeftCorner
- call WaitBGMap2
- callba GetEnemyMonDVs
- ld a, [hli]
- ld [TempMonDVs], a
- ld a, [hl]
- ld [TempMonDVs + 1], a
- ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
- call GetSGBLayout
- call SetPalettes
- ret
-; fb8f1
-
-ConvertMon_2to1: ; fb8f1
-; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265.
- push bc
- push hl
- ld a, [wd265]
- ld b, a
- ld c, 0
- ld hl, Pokered_MonIndices
-.loop
- inc c
- ld a, [hli]
- cp b
- jr nz, .loop
- ld a, c
- ld [wd265], a
- pop hl
- pop bc
- ret
-; fb908
-
-ConvertMon_1to2: ; fb908
-; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265.
- push bc
- push hl
- ld a, [wd265]
- dec a
- ld hl, Pokered_MonIndices
- ld b, 0
- ld c, a
- add hl, bc
- ld a, [hl]
- ld [wd265], a
- pop hl
- pop bc
- ret
-; fb91c
-
-Pokered_MonIndices: ; fb91c
- db RHYDON
- db KANGASKHAN
- db NIDORAN_M
- db CLEFAIRY
- db SPEAROW
- db VOLTORB
- db NIDOKING
- db SLOWBRO
- db IVYSAUR
- db EXEGGUTOR
- db LICKITUNG
- db EXEGGCUTE
- db GRIMER
- db GENGAR
- db NIDORAN_F
- db NIDOQUEEN
- db CUBONE
- db RHYHORN
- db LAPRAS
- db ARCANINE
- db MEW
- db GYARADOS
- db SHELLDER
- db TENTACOOL
- db GASTLY
- db SCYTHER
- db STARYU
- db BLASTOISE
- db PINSIR
- db TANGELA
- db SCIZOR
- db SHUCKLE
- db GROWLITHE
- db ONIX
- db FEAROW
- db PIDGEY
- db SLOWPOKE
- db KADABRA
- db GRAVELER
- db CHANSEY
- db MACHOKE
- db MR__MIME
- db HITMONLEE
- db HITMONCHAN
- db ARBOK
- db PARASECT
- db PSYDUCK
- db DROWZEE
- db GOLEM
- db HERACROSS
- db MAGMAR
- db HO_OH
- db ELECTABUZZ
- db MAGNETON
- db KOFFING
- db SNEASEL
- db MANKEY
- db SEEL
- db DIGLETT
- db TAUROS
- db TEDDIURSA
- db URSARING
- db SLUGMA
- db FARFETCH_D
- db VENONAT
- db DRAGONITE
- db MAGCARGO
- db SWINUB
- db PILOSWINE
- db DODUO
- db POLIWAG
- db JYNX
- db MOLTRES
- db ARTICUNO
- db ZAPDOS
- db DITTO
- db MEOWTH
- db KRABBY
- db CORSOLA
- db REMORAID
- db OCTILLERY
- db VULPIX
- db NINETALES
- db PIKACHU
- db RAICHU
- db DELIBIRD
- db MANTINE
- db DRATINI
- db DRAGONAIR
- db KABUTO
- db KABUTOPS
- db HORSEA
- db SEADRA
- db SKARMORY
- db HOUNDOUR
- db SANDSHREW
- db SANDSLASH
- db OMANYTE
- db OMASTAR
- db JIGGLYPUFF
- db WIGGLYTUFF
- db EEVEE
- db FLAREON
- db JOLTEON
- db VAPOREON
- db MACHOP
- db ZUBAT
- db EKANS
- db PARAS
- db POLIWHIRL
- db POLIWRATH
- db WEEDLE
- db KAKUNA
- db BEEDRILL
- db HOUNDOOM
- db DODRIO
- db PRIMEAPE
- db DUGTRIO
- db VENOMOTH
- db DEWGONG
- db KINGDRA
- db PHANPY
- db CATERPIE
- db METAPOD
- db BUTTERFREE
- db MACHAMP
- db DONPHAN
- db GOLDUCK
- db HYPNO
- db GOLBAT
- db MEWTWO
- db SNORLAX
- db MAGIKARP
- db PORYGON2
- db STANTLER
- db MUK
- db SMEARGLE
- db KINGLER
- db CLOYSTER
- db TYROGUE
- db ELECTRODE
- db CLEFABLE
- db WEEZING
- db PERSIAN
- db MAROWAK
- db HITMONTOP
- db HAUNTER
- db ABRA
- db ALAKAZAM
- db PIDGEOTTO
- db PIDGEOT
- db STARMIE
- db BULBASAUR
- db VENUSAUR
- db TENTACRUEL
- db SMOOCHUM
- db GOLDEEN
- db SEAKING
- db ELEKID
- db MAGBY
- db MILTANK
- db BLISSEY
- db PONYTA
- db RAPIDASH
- db RATTATA
- db RATICATE
- db NIDORINO
- db NIDORINA
- db GEODUDE
- db PORYGON
- db AERODACTYL
- db RAIKOU
- db MAGNEMITE
- db ENTEI
- db SUICUNE
- db CHARMANDER
- db SQUIRTLE
- db CHARMELEON
- db WARTORTLE
- db CHARIZARD
- db LARVITAR
- db PUPITAR
- db TYRANITAR
- db LUGIA
- db ODDISH
- db GLOOM
- db VILEPLUME
- db BELLSPROUT
- db WEEPINBELL
- db VICTREEBEL
- db CHIKORITA
- db BAYLEEF
- db MEGANIUM
- db CYNDAQUIL
- db QUILAVA
- db TYPHLOSION
- db TOTODILE
- db CROCONAW
- db FERALIGATR
- db SENTRET
- db FURRET
- db HOOTHOOT
- db NOCTOWL
- db LEDYBA
- db LEDIAN
- db SPINARAK
- db ARIADOS
- db CROBAT
- db CHINCHOU
- db LANTURN
- db PICHU
- db CLEFFA
- db IGGLYBUFF
- db TOGEPI
- db TOGETIC
- db NATU
- db XATU
- db MAREEP
- db FLAAFFY
- db AMPHAROS
- db BELLOSSOM
- db MARILL
- db AZUMARILL
- db SUDOWOODO
- db POLITOED
- db HOPPIP
- db SKIPLOOM
- db JUMPLUFF
- db AIPOM
- db SUNKERN
- db SUNFLORA
- db YANMA
- db WOOPER
- db QUAGSIRE
- db ESPEON
- db UMBREON
- db MURKROW
- db SLOWKING
- db MISDREAVUS
- db UNOWN
- db WOBBUFFET
- db GIRAFARIG
- db PINECO
- db FORRETRESS
- db DUNSPARCE
- db GLIGAR
- db STEELIX
- db SNUBBULL
- db GRANBULL
- db QWILFISH
- db WOBBUFFET
- db WOBBUFFET
-; fba18
diff --git a/engine/time_capsule_2.asm b/engine/time_capsule_2.asm
new file mode 100644
index 000000000..5da72e7c8
--- /dev/null
+++ b/engine/time_capsule_2.asm
@@ -0,0 +1,39 @@
+ConvertMon_2to1: ; fb8f1
+; Takes the Gen-2 Pokemon number stored in wd265, finds it in the Pokered_MonIndices table, and returns its index in wd265.
+ push bc
+ push hl
+ ld a, [wd265]
+ ld b, a
+ ld c, 0
+ ld hl, Pokered_MonIndices
+.loop
+ inc c
+ ld a, [hli]
+ cp b
+ jr nz, .loop
+ ld a, c
+ ld [wd265], a
+ pop hl
+ pop bc
+ ret
+; fb908
+
+ConvertMon_1to2: ; fb908
+; Takes the Gen-1 Pokemon number stored in wd265 and returns the corresponding value from Pokered_MonIndices in wd265.
+ push bc
+ push hl
+ ld a, [wd265]
+ dec a
+ ld hl, Pokered_MonIndices
+ ld b, 0
+ ld c, a
+ add hl, bc
+ ld a, [hl]
+ ld [wd265], a
+ pop hl
+ pop bc
+ ret
+; fb91c
+
+
+INCLUDE "data/time_capsule/mon_order.asm"
diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm
index 263a83fc1..a4a07bc4d 100644
--- a/engine/timeofdaypals.asm
+++ b/engine/timeofdaypals.asm
@@ -1,3 +1,7 @@
+Predef35: ; 8c000
+Predef36:
+ ret
+
UpdateTimeOfDayPal:: ; 8c001
call UpdateTime
ld a, [TimeOfDay]
@@ -196,10 +200,6 @@ endr
ret
; 8c0e5
-brightlevel: MACRO
- db (\1 << 6) | (\2 << 4) | (\3 << 2) | \4
-ENDM
-
ReplaceTimeOfDayPals: ; 8c0e5
ld hl, .BrightnessLevels
ld a, [wMapTimeOfDay]
@@ -230,14 +230,14 @@ ReplaceTimeOfDayPals: ; 8c0e5
; 8c10f (23:410f)
.BrightnessLevels: ; 8c10f
- brightlevel 3, 2, 1, 0
- brightlevel 1, 1, 1, 1
- brightlevel 2, 2, 2, 2
- brightlevel 0, 0, 0, 0
- brightlevel 3, 3, 3, 3
- brightlevel 3, 2, 1, 0
- brightlevel 3, 2, 1, 0
- brightlevel 3, 2, 1, 0
+ dc 3, 2, 1, 0
+ dc 1, 1, 1, 1
+ dc 2, 2, 2, 2
+ dc 0, 0, 0, 0
+ dc 3, 3, 3, 3
+ dc 3, 2, 1, 0
+ dc 3, 2, 1, 0
+ dc 3, 2, 1, 0
; 8c117
GetTimePalette: ; 8c117
diff --git a/engine/timeset.asm b/engine/timeset.asm
index d560ae817..417517005 100755
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -10,9 +10,9 @@ InitClock: ; 90672 (24:4672)
ld a, $10
ld [MusicFade], a
ld a, MUSIC_NONE % $100
- ld [MusicFadeIDLo], a
+ ld [MusicFadeID], a
ld a, MUSIC_NONE / $100
- ld [MusicFadeIDHi], a
+ ld [MusicFadeID + 1], a
ld c, 8
call DelayFrames
call RotateFourPalettesLeft
@@ -23,28 +23,28 @@ InitClock: ; 90672 (24:4672)
xor a
ld [hBGMapMode], a
call LoadStandardFont
- ld de, GFX_908fb
+ ld de, TimeSetBackgroundGFX
ld hl, VTiles2 tile $00
- lb bc, BANK(GFX_908fb), 1
+ lb bc, BANK(TimeSetBackgroundGFX), 1
call Request1bpp
- ld de, GFX_90903
+ ld de, TimeSetUpArrowGFX
ld hl, VTiles2 tile $01
- lb bc, BANK(GFX_90903), 1
+ lb bc, BANK(TimeSetUpArrowGFX), 1
call Request1bpp
- ld de, GFX_9090b
+ ld de, TimeSetDownArrowGFX
ld hl, VTiles2 tile $02
- lb bc, BANK(GFX_9090b), 1
+ lb bc, BANK(TimeSetDownArrowGFX), 1
call Request1bpp
call .ClearScreen
call WaitBGMap
call RotateFourPalettesRight
ld hl, Text_WokeUpOak
call PrintText
- ld hl, wc608
+ ld hl, wTimeSetBuffer
ld bc, 50
xor a
call ByteFill
- ld a, $a
+ ld a, 10 ; default hour = 10 AM
ld [wInitHourBuffer], a
.loop
@@ -98,7 +98,7 @@ InitClock: ; 90672 (24:4672)
call SetMinutes
jr nc, .SetMinutesLoop
- ld a, [BattleMonNick + 5]
+ ld a, [wInitMinuteBuffer]
ld [StringBuffer2 + 2], a
call .ClearScreen
ld hl, Text_WhoaMins
@@ -237,7 +237,7 @@ SetMinutes: ; 90810 (24:4810)
ret
.d_down
- ld hl, BattleMonNick + 5
+ ld hl, wInitMinuteBuffer
ld a, [hl]
and a
jr nz, .decrease
@@ -248,7 +248,7 @@ SetMinutes: ; 90810 (24:4810)
jr .finish_dpad
.d_up
- ld hl, BattleMonNick + 5
+ ld hl, wInitMinuteBuffer
ld a, [hl]
cp 59
jr c, .increase
@@ -271,7 +271,7 @@ SetMinutes: ; 90810 (24:4810)
ret
DisplayMinutesWithMinString: ; 90859 (24:4859)
- ld de, BattleMonNick + 5
+ ld de, wInitMinuteBuffer
call PrintTwoDigitNumberRightAlign
inc hl
ld de, String_min
@@ -355,25 +355,25 @@ OakText_ResponseToSetTime: ; 0x908b8
call PrintHour
ld [hl], ":"
inc hl
- ld de, BattleMonNick + 5
+ ld de, wInitMinuteBuffer
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ld b, h
ld c, l
ld a, [wInitHourBuffer]
- cp 4
- jr c, .NITE
- cp 11
- jr c, .MORN
- cp 18
- jr c, .DAY
-.NITE:
+ cp MORN_HOUR
+ jr c, .nite
+ cp DAY_HOUR + 1
+ jr c, .morn
+ cp NITE_HOUR
+ jr c, .day
+.nite:
ld hl, .sodark
ret
-.MORN:
+.morn:
ld hl, .overslept
ret
-.DAY:
+.day:
ld hl, .yikes
ret
; 908ec (24:48ec)
@@ -396,12 +396,12 @@ OakText_ResponseToSetTime: ; 0x908b8
db "@"
; 0x908fb
-GFX_908fb: ; 908fb
-INCBIN "gfx/unknown/0908fb.1bpp"
-GFX_90903: ; 90903
-INCBIN "gfx/unknown/090903.1bpp"
-GFX_9090b: ; 9090b
-INCBIN "gfx/unknown/09090b.1bpp"
+TimeSetBackgroundGFX: ; 908fb
+INCBIN "gfx/timeset/background.1bpp"
+TimeSetUpArrowGFX: ; 90903
+INCBIN "gfx/timeset/up_arrow.1bpp"
+TimeSetDownArrowGFX: ; 9090b
+INCBIN "gfx/timeset/down_arrow.1bpp"
; 90913
Special_SetDayOfWeek: ; 90913
@@ -409,13 +409,13 @@ Special_SetDayOfWeek: ; 90913
push af
ld a, $1
ld [hInMenu], a
- ld de, GFX_90903
+ ld de, TimeSetUpArrowGFX
ld hl, VTiles1 tile $6f
- lb bc, BANK(GFX_90903), 1
+ lb bc, BANK(TimeSetUpArrowGFX), 1
call Request1bpp
- ld de, GFX_9090b
+ ld de, TimeSetDownArrowGFX
ld hl, VTiles1 tile $75
- lb bc, BANK(GFX_9090b), 1
+ lb bc, BANK(TimeSetDownArrowGFX), 1
call Request1bpp
xor a
ld [wTempDayOfWeek], a
@@ -482,7 +482,7 @@ Special_SetDayOfWeek: ; 90913
ld a, [hl]
and a
jr nz, .decrease
- ld a, 6 + 1
+ ld a, SATURDAY + 1
.decrease
dec a
@@ -494,7 +494,7 @@ Special_SetDayOfWeek: ; 90913
ld a, [hl]
cp 6
jr c, .increase
- ld a, 0 - 1
+ ld a, SUNDAY - 1
.increase
inc a
@@ -531,6 +531,7 @@ Special_SetDayOfWeek: ; 90913
; 909f2
.WeekdayStrings: ; 909f2
+; entries correspond to CurDay constants (see constants/wram_constants.asm)
dw .Sunday
dw .Monday
dw .Tuesday
@@ -589,7 +590,7 @@ Special_InitialSetDSTFlag: ; 90a54
ld a, [hMinutes]
ld c, a
decoord 1, 14
- callba PrintHoursMins
+ farcall PrintHoursMins
ld hl, .DSTIsThatOK
ret
; 90a83 (24:4a83)
@@ -620,7 +621,7 @@ Special_InitialClearDSTFlag: ; 90a88
ld a, [hMinutes]
ld c, a
decoord 1, 14
- callba PrintHoursMins
+ farcall PrintHoursMins
ld hl, .IsThatOK
ret
; 90ab7
@@ -731,26 +732,26 @@ PrintHour: ; 90b3e (24:4b3e)
GetTimeOfDayString: ; 90b58 (24:4b58)
ld a, c
- cp 4
+ cp MORN_HOUR
jr c, .nite
- cp 10
+ cp DAY_HOUR
jr c, .morn
- cp 18
+ cp NITE_HOUR
jr c, .day
.nite
- ld de, .NITE
+ ld de, .nite_string
ret
.morn
- ld de, .MORN
+ ld de, .morn_string
ret
.day
- ld de, .DAY
+ ld de, .day_string
ret
; 90b71 (24:4b71)
-.NITE: db "NITE@"
-.MORN: db "MORN@"
-.DAY: db "DAY@"
+.nite_string: db "NITE@"
+.morn_string: db "MORN@"
+.day_string: db "DAY@"
; 90b7f
AdjustHourForAMorPM:
@@ -758,12 +759,12 @@ AdjustHourForAMorPM:
ld a, c
or a
jr z, .midnight
- cp 12
+ cp NOON_HOUR
ret c
ret z
- sub 12
+ sub NOON_HOUR
ret
.midnight
- ld a, 12
+ ld a, NOON_HOUR
ret
diff --git a/engine/title.asm b/engine/title.asm
index 36e2851d3..ba7f34764 100644
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -10,10 +10,10 @@ _TitleScreen: ; 10ed67
; Reset timing variables
ld hl, wJumptableIndex
- ld [hli], a ; cf63 ; Scene?
- ld [hli], a ; cf64
- ld [hli], a ; cf65 ; Timer lo
- ld [hl], a ; cf66 ; Timer hi
+ ld [hli], a ; wJumptableIndex
+ ld [hli], a ; wIntroSceneFrameCounter
+ ld [hli], a ; wTitleScreenTimer
+ ld [hl], a ; wTitleScreenTimer + 1
; Turn LCD off
call DisableLCD
@@ -145,12 +145,12 @@ _TitleScreen: ; 10ed67
; Update palette colors
ld hl, TitleScreenPalettes
ld de, UnknBGPals
- ld bc, 4 * 32
+ ld bc, 16 palettes
call CopyBytes
ld hl, TitleScreenPalettes
ld de, BGPals
- ld bc, 4 * 32
+ ld bc, 16 palettes
call CopyBytes
; Restore WRAM bank
@@ -399,84 +399,4 @@ INCBIN "gfx/title/crystal.2bpp.lz"
; 10fede
TitleScreenPalettes:
-; BG
- RGB 00, 00, 00
- RGB 19, 00, 00
- RGB 15, 08, 31
- RGB 15, 08, 31
-
- RGB 00, 00, 00
- RGB 31, 31, 31
- RGB 15, 16, 31
- RGB 31, 01, 13
-
- RGB 00, 00, 00
- RGB 07, 07, 07
- RGB 31, 31, 31
- RGB 02, 03, 30
-
- RGB 00, 00, 00
- RGB 13, 13, 13
- RGB 31, 31, 18
- RGB 02, 03, 30
-
- RGB 00, 00, 00
- RGB 19, 19, 19
- RGB 29, 28, 12
- RGB 02, 03, 30
-
- RGB 00, 00, 00
- RGB 25, 25, 25
- RGB 28, 25, 06
- RGB 02, 03, 30
-
- RGB 00, 00, 00
- RGB 31, 31, 31
- RGB 26, 21, 00
- RGB 02, 03, 30
-
- RGB 00, 00, 00
- RGB 11, 11, 19
- RGB 31, 31, 31
- RGB 00, 00, 00
-
-; OBJ
- RGB 00, 00, 00
- RGB 10, 00, 15
- RGB 17, 05, 22
- RGB 19, 09, 31
-
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
+INCLUDE "data/palettes/title.pal"
diff --git a/engine/tmhm.asm b/engine/tmhm.asm
index dc5d698e1..78d3b1707 100755
--- a/engine/tmhm.asm
+++ b/engine/tmhm.asm
@@ -45,69 +45,5 @@ GetTMHMMove: ; 1166a
ret
; 1167a
-TMHMMoves: ; 1167a
- db DYNAMICPUNCH
- db HEADBUTT
- db CURSE
- db ROLLOUT
- db ROAR
- db TOXIC
- db ZAP_CANNON
- db ROCK_SMASH
- db PSYCH_UP
- db HIDDEN_POWER
- db SUNNY_DAY
- db SWEET_SCENT
- db SNORE
- db BLIZZARD
- db HYPER_BEAM
- db ICY_WIND
- db PROTECT
- db RAIN_DANCE
- db GIGA_DRAIN
- db ENDURE
- db FRUSTRATION
- db SOLARBEAM
- db IRON_TAIL
- db DRAGONBREATH
- db THUNDER
- db EARTHQUAKE
- db RETURN
- db DIG
- db PSYCHIC_M
- db SHADOW_BALL
- db MUD_SLAP
- db DOUBLE_TEAM
- db ICE_PUNCH
- db SWAGGER
- db SLEEP_TALK
- db SLUDGE_BOMB
- db SANDSTORM
- db FIRE_BLAST
- db SWIFT
- db DEFENSE_CURL
- db THUNDERPUNCH
- db DREAM_EATER
- db DETECT
- db REST
- db ATTRACT
- db THIEF
- db STEEL_WING
- db FIRE_PUNCH
- db FURY_CUTTER
- db NIGHTMARE
- db CUT
- db FLY
- db SURF
- db STRENGTH
- db FLASH
- db WHIRLPOOL
- db WATERFALL
-; Move tutor
- db FLAMETHROWER
- db THUNDERBOLT
- db ICE_BEAM
-
- db 0 ; end
-; 116b7
+INCLUDE "data/tmhm_moves.asm"
diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm
index 8d19aaf81..c111fa7f9 100755
--- a/engine/tmhm2.asm
+++ b/engine/tmhm2.asm
@@ -23,7 +23,7 @@ TMHMPocket: ; 2c76f (b:476f)
.ConvertItemToTMHMNumber: ; 2c798 (b:4798)
ld a, [CurItem]
ld c, a
- callab GetNumberedTMHM
+ callfar GetNumberedTMHM
ld a, c
ld [CurItem], a
ret
@@ -31,7 +31,7 @@ TMHMPocket: ; 2c76f (b:476f)
ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7)
ld a, [CurItem]
ld c, a
- callab GetTMHMNumber
+ callfar GetTMHMNumber
ld a, c
ld [wCurTMHM], a
ret
@@ -77,18 +77,18 @@ ChooseMonToLearnTMHM: ; 2c7fb
call CopyBytes
call ClearBGPalettes
ChooseMonToLearnTMHM_NoRefresh: ; 2c80a
- callba LoadPartyMenuGFX
- callba InitPartyMenuWithCancel
- callba InitPartyMenuGFX
+ farcall LoadPartyMenuGFX
+ farcall InitPartyMenuWithCancel
+ farcall InitPartyMenuGFX
ld a, PARTYMENUACTION_TEACH_TMHM
ld [PartyMenuActionText], a
.loopback
- callba WritePartyMenuTilemap
- callba PrintPartyMenuText
+ farcall WritePartyMenuTilemap
+ farcall PrintPartyMenuText
call WaitBGMap
call SetPalettes
call DelayFrame
- callba PartyMenuSelect
+ farcall PartyMenuSelect
push af
ld a, [CurPartySpecies]
cp EGG
@@ -138,7 +138,7 @@ TeachTMHM: ; 2c867
jr .nope
.compatible
- callab KnowsMove
+ callfar KnowsMove
jr c, .nope
predef LearnMove
@@ -146,13 +146,13 @@ TeachTMHM: ; 2c867
and a
jr z, .nope
- callba TrainerRankings_TMsHMsTaught
+ farcall TrainerRankings_TMsHMsTaught
ld a, [CurItem]
call IsHM
ret c
ld c, HAPPINESS_LEARNMOVE
- callab ChangeHappiness
+ callfar ChangeHappiness
call ConsumeTM
jr .learned_move
diff --git a/engine/trade/animation.asm b/engine/trade_animation.asm
index fa351ba3d..711ba4d19 100755
--- a/engine/trade/animation.asm
+++ b/engine/trade_animation.asm
@@ -100,7 +100,7 @@ TradeAnimationPlayer2: ; 28f63
tradeanim_end
RunTradeAnimScript: ; 28fa1
- ld hl, wTradeAnimPointer
+ ld hl, wTradeAnimAddress
ld [hl], e
inc hl
ld [hl], d
@@ -143,7 +143,7 @@ RunTradeAnimScript: ; 28fa1
call ClearTileMap
call DisableLCD
call LoadFontsBattleExtra
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
ld a, [hCGB]
and a
jr z, .NotCGB
@@ -181,7 +181,7 @@ RunTradeAnimScript: ; 28fa1
ld [hWX], a
ld a, $90
ld [hWY], a
- callba GetTrademonFrontpic
+ farcall GetTrademonFrontpic
call EnableLCD
call LoadTradeBallAndCableGFX
ld a, [wPlayerTrademonSpecies]
@@ -208,7 +208,7 @@ DoTradeAnimation: ; 29082
bit 7, a
jr nz, .finished
call .DoTradeAnimCommand
- callab PlaySpriteAnimations
+ callfar PlaySpriteAnimations
ld hl, wcf65
inc [hl]
call DelayFrame
@@ -236,6 +236,7 @@ DoTradeAnimation: ; 29082
; 290af
.JumpTable: ; 290af
+; entries correspond to macros/trade_anim.asm enumeration
dw TradeAnim_AdvanceScriptPointer ; 00
dw TradeAnim_ShowGivemonData ; 01
dw TradeAnim_ShowGetmonData ; 02
@@ -294,7 +295,7 @@ TradeAnim_IncrementJumptableIndex: ; 2910f
; 29114
TradeAnim_AdvanceScriptPointer: ; 29114
- ld hl, wTradeAnimPointer
+ ld hl, wTradeAnimAddress
ld e, [hl]
inc hl
ld d, [hl]
@@ -341,7 +342,7 @@ TradeAnim_InitTubeAnim: ; 2914e
push af
call DisableLCD
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
hlbgcoord 20, 3
ld bc, 12
ld a, $60
@@ -487,7 +488,7 @@ TradeAnim_TubeToPlayer8: ; 29229
call ClearTileMap
call ClearSprites
call DisableLCD
- callab ClearSpriteAnims
+ callfar ClearSpriteAnims
hlbgcoord 0, 0
ld bc, sScratch - VBGMap0
ld a, " "
@@ -861,7 +862,7 @@ TradeAnim_ShowGetmonData: ; 29461
; 29487
TradeAnim_AnimateFrontpic: ; 29487
- callba AnimateTrademonFrontpic
+ farcall AnimateTrademonFrontpic
call TradeAnim_AdvanceScriptPointer
ret
@@ -876,7 +877,7 @@ TradeAnim_GetFrontpic: ; 29491
ld [CurSpecies], a
call GetBaseData
pop de
- predef GetFrontpic
+ predef GetMonFrontpic
ret
; 294a9
@@ -1110,7 +1111,7 @@ TrademonStats_PrintTrademonID: ; 29611
TradeAnim_RockingBall: ; 2961b
depixel 10, 11, 4, 0
- ld a, SPRITE_ANIM_INDEX_0E
+ ld a, SPRITE_ANIM_INDEX_TRADE_POKE_BALL
call _InitSpriteAnimStruct
call TradeAnim_AdvanceScriptPointer
ld a, $20
@@ -1121,7 +1122,7 @@ TradeAnim_RockingBall: ; 2961b
TradeAnim_DropBall: ; 2962c
depixel 10, 11, 4, 0
- ld a, SPRITE_ANIM_INDEX_0E
+ ld a, SPRITE_ANIM_INDEX_TRADE_POKE_BALL
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
@@ -1138,7 +1139,7 @@ TradeAnim_DropBall: ; 2962c
TradeAnim_Poof: ; 29649
depixel 10, 11, 4, 0
- ld a, SPRITE_ANIM_INDEX_0F
+ ld a, SPRITE_ANIM_INDEX_TRADE_POOF
call _InitSpriteAnimStruct
call TradeAnim_AdvanceScriptPointer
ld a, $10
@@ -1153,7 +1154,7 @@ TradeAnim_BulgeThroughTube: ; 29660
ld a, %11100100 ; 3,2,1,0
call DmgToCgbObjPal0
depixel 5, 11
- ld a, SPRITE_ANIM_INDEX_10
+ ld a, SPRITE_ANIM_INDEX_TRADE_TUBE_BULGE
call _InitSpriteAnimStruct
call TradeAnim_AdvanceScriptPointer
ld a, $40
@@ -1520,7 +1521,7 @@ LoadTradeBallAndCableGFX: ; 2982b
LoadTradeBubbleGFX: ; 2985a
call DelayFrame
ld e, $3
- callab LoadMenuMonIcon
+ callfar LoadMenuMonIcon
ld de, TradeBubbleGFX
ld hl, VTiles0 tile $72
lb bc, BANK(TradeBubbleGFX), $4
diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm
index 23defe919..01a033650 100755
--- a/engine/trainer_card.asm
+++ b/engine/trainer_card.asm
@@ -34,7 +34,7 @@ TrainerCard: ; 25105
call ClearTileMap
call DisableLCD
- callba GetCardPic
+ farcall GetCardPic
ld hl, CardRightCornerGFX
ld de, VTiles2 tile $1c
@@ -448,7 +448,7 @@ TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415)
ret nz
hlcoord 15, 12
ld a, [hl]
- xor %01010001 ; $7F <--> $2E
+ xor " " ^ $2e ; alternate between space and small colon ($2e) tiles
ld [hl], a
ret
@@ -606,11 +606,11 @@ TrainerCard_JohtoBadgesOAM: ; 254c9
db $1c | $80, $20, $24, $20 | $80
; 25523
-CardStatusGFX: INCBIN "gfx/misc/card_status.2bpp"
+CardStatusGFX: INCBIN "gfx/trainer_card/card_status.2bpp"
-LeaderGFX: INCBIN "gfx/misc/leaders.2bpp"
-LeaderGFX2: INCBIN "gfx/misc/leaders.2bpp"
-BadgeGFX: INCBIN "gfx/misc/badges.2bpp"
-BadgeGFX2: INCBIN "gfx/misc/badges.2bpp"
+LeaderGFX: INCBIN "gfx/trainer_card/leaders.2bpp"
+LeaderGFX2: INCBIN "gfx/trainer_card/leaders.2bpp"
+BadgeGFX: INCBIN "gfx/trainer_card/badges.2bpp"
+BadgeGFX2: INCBIN "gfx/trainer_card/badges.2bpp"
-CardRightCornerGFX: INCBIN "gfx/misc/card_right_corner.2bpp"
+CardRightCornerGFX: INCBIN "gfx/trainer_card/card_right_corner.2bpp"
diff --git a/engine/trainer_scripts.asm b/engine/trainer_scripts.asm
new file mode 100644
index 000000000..212cd7f28
--- /dev/null
+++ b/engine/trainer_scripts.asm
@@ -0,0 +1,31 @@
+TalkToTrainerScript:: ; 0xbe66a
+ faceplayer
+ trainerflagaction CHECK_FLAG
+ iftrue AlreadyBeatenTrainerScript
+ loadmemtrainer
+ encountermusic
+ jump StartBattleWithMapTrainerScript
+
+SeenByTrainerScript:: ; 0xbe675
+ loadmemtrainer
+ encountermusic
+ showemote EMOTE_SHOCK, LAST_TALKED, 30
+ callasm TrainerWalkToPlayer
+ applymovement2 MovementBuffer
+ writeobjectxy LAST_TALKED
+ faceobject PLAYER, LAST_TALKED
+ jump StartBattleWithMapTrainerScript
+
+StartBattleWithMapTrainerScript: ; 0xbe68a
+ opentext
+ trainertext $0
+ waitbutton
+ closetext
+ loadmemtrainer
+ startbattle
+ reloadmapafterbattle
+ trainerflagaction SET_FLAG
+ loadvar wRunningTrainerBattleScript, -1
+
+AlreadyBeatenTrainerScript:
+ scripttalkafter
diff --git a/engine/unown_dex.asm b/engine/unown_dex.asm
new file mode 100755
index 000000000..dc6db9dc6
--- /dev/null
+++ b/engine/unown_dex.asm
@@ -0,0 +1,52 @@
+UpdateUnownDex: ; fba18
+ ld a, [UnownLetter]
+ ld c, a
+ ld b, NUM_UNOWN
+ ld hl, UnownDex
+.loop
+ ld a, [hli]
+ and a
+ jr z, .done
+ cp c
+ ret z
+ dec b
+ jr nz, .loop
+ ret
+
+.done
+ dec hl
+ ld [hl], c
+ ret
+; fba2e
+
+PrintUnownWord: ; fba2e (3e:7a2e)
+ hlcoord 4, 15
+ ld bc, 12
+ ld a, " "
+ call ByteFill
+ ld a, [wDexCurrentUnownIndex]
+ ld e, a
+ ld d, 0
+ ld hl, UnownDex
+ add hl, de
+ ld a, [hl]
+ ld e, a
+ ld d, 0
+ ld hl, UnownWords
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld e, a
+ ld d, [hl]
+ hlcoord 4, 15
+.loop
+ ld a, [de]
+ cp -1
+ ret z
+ inc de
+ ld [hli], a
+ jr .loop
+; fba5a (3e:7a5a)
+
+
+INCLUDE "data/unown_words.asm"
diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm
index a1fed2520..3afe8a17d 100755
--- a/engine/unown_puzzle.asm
+++ b/engine/unown_puzzle.asm
@@ -1,7 +1,8 @@
-puzcoord EQUS "* 6 +"
PUZZLE_BORDER EQU $ee
PUZZLE_VOID EQU $ef
+puzcoord EQUS "* 6 +"
+
UnownPuzzle: ; e1190
ld a, [hInMenu]
push af
@@ -13,7 +14,7 @@ UnownPuzzle: ; e1190
xor a
ld [hBGMapMode], a
call DisableLCD
- ld hl, wMisc
+ ld hl, wMisc ; includes wPuzzlePieces
ld bc, wMiscEnd - wMisc
xor a
call ByteFill
diff --git a/engine/unowndex.asm b/engine/unowndex.asm
deleted file mode 100755
index d7fe63dc3..000000000
--- a/engine/unowndex.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-UpdateUnownDex: ; fba18
- ld a, [UnownLetter]
- ld c, a
- ld b, 26
- ld hl, UnownDex
-.loop
- ld a, [hli]
- and a
- jr z, .done
- cp c
- ret z
- dec b
- jr nz, .loop
- ret
-
-.done
- dec hl
- ld [hl], c
- ret
-; fba2e
-
-
-PrintUnownWord: ; fba2e (3e:7a2e)
- hlcoord 4, 15
- ld bc, 12
- ld a, " "
- call ByteFill
- ld a, [wDexCurrentUnownIndex]
- ld e, a
- ld d, 0
- ld hl, UnownDex
- add hl, de
- ld a, [hl]
- ld e, a
- ld d, 0
- ld hl, UnownWords
- add hl, de
- add hl, de
- ld a, [hli]
- ld e, a
- ld d, [hl]
- hlcoord 4, 15
-.loop
- ld a, [de]
- cp -1
- ret z
- inc de
- ld [hli], a
- jr .loop
-; fba5a (3e:7a5a)
-
-UnownWords: ; fba5a
- dw UnownWord1
- dw UnownWord1
- dw UnownWord2
- dw UnownWord3
- dw UnownWord4
- dw UnownWord5
- dw UnownWord6
- dw UnownWord7
- dw UnownWord8
- dw UnownWord9
- dw UnownWord10
- dw UnownWord11
- dw UnownWord12
- dw UnownWord13
- dw UnownWord14
- dw UnownWord15
- dw UnownWord16
- dw UnownWord17
- dw UnownWord18
- dw UnownWord19
- dw UnownWord20
- dw UnownWord21
- dw UnownWord22
- dw UnownWord23
- dw UnownWord24
- dw UnownWord25
- dw UnownWord26
-; fba90
-
-unownword: macro
-x = 1
- rept STRLEN(\1)
- db STRSUB(\1, x, 1) - $40
-x = x + 1
- endr
- db -1
-endm
-
-
-UnownWord1: unownword "ANGRY"
-UnownWord2: unownword "BEAR"
-UnownWord3: unownword "CHASE"
-UnownWord4: unownword "DIRECT"
-UnownWord5: unownword "ENGAGE"
-UnownWord6: unownword "FIND"
-UnownWord7: unownword "GIVE"
-UnownWord8: unownword "HELP"
-UnownWord9: unownword "INCREASE"
-UnownWord10: unownword "JOIN"
-UnownWord11: unownword "KEEP"
-UnownWord12: unownword "LAUGH"
-UnownWord13: unownword "MAKE"
-UnownWord14: unownword "NUZZLE"
-UnownWord15: unownword "OBSERVE"
-UnownWord16: unownword "PERFORM"
-UnownWord17: unownword "QUICKEN"
-UnownWord18: unownword "REASSURE"
-UnownWord19: unownword "SEARCH"
-UnownWord20: unownword "TELL"
-UnownWord21: unownword "UNDO"
-UnownWord22: unownword "VANISH"
-UnownWord23: unownword "WANT"
-UnownWord24: unownword "XXXXX"
-UnownWord25: unownword "YIELD"
-UnownWord26: unownword "ZOOM"
-; fbb32
diff --git a/engine/unused_title.asm b/engine/unused_title.asm
new file mode 100644
index 000000000..2075d86d9
--- /dev/null
+++ b/engine/unused_title.asm
@@ -0,0 +1,201 @@
+UnusedTitleScreen: ; 10c000
+
+ call ClearBGPalettes
+ call ClearTileMap
+ call DisableLCD
+
+; Turn BG Map update off
+ xor a
+ ld [hBGMapMode], a
+
+; Reset timing variables
+ ld hl, wJumptableIndex
+ ld [hli], a ; wJumptableIndex
+ ld [hli], a ; wIntroSceneFrameCounter
+ ld [hli], a ; wTitleScreenTimer
+ ld [hl], a ; wTitleScreenTimer + 1
+
+ ld hl, UnusedTitleBG_GFX
+ ld de, VTiles2
+ ld bc, VBGMap0 - VTiles2
+ call CopyBytes
+
+ ld hl, UnusedTitleBG_GFX + $80 tiles
+ ld de, VTiles1
+ ld bc, VTiles2 - VTiles1
+ call CopyBytes
+
+ ld hl, UnusedTitleFG_GFX
+ ld de, VTiles0
+ ld bc, VTiles1 - VTiles0
+ call CopyBytes
+
+ ld hl, UnusedTitleBG_Tilemap
+ debgcoord 0, 0
+ ld bc, 32 * 32
+.copy
+ ld a, 0
+ ld [rVBK], a
+ ld a, [hli]
+ ld [de], a
+ ld a, 1
+ ld [rVBK], a
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec bc
+ ld a, b
+ or c
+ jr nz, .copy
+
+ ld hl, UnusedTitleFG_OAM
+ ld de, Sprites
+ ld bc, $a0
+ call CopyBytes
+
+ call EnableLCD
+ ld a, [rLCDC]
+ set 1, a
+ set 2, a
+ ld [rLCDC], a
+
+ call DelayFrame
+
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+
+ ld hl, UnusedTitleBG_Palettes
+ ld de, UnknBGPals
+ ld bc, 8 palettes
+ call CopyBytes
+
+ ld hl, UnusedTitleFG_Palettes
+ ld de, UnknOBPals
+ ld bc, 8 palettes
+ call CopyBytes
+
+ ld hl, UnusedTitleBG_Palettes
+ ld de, BGPals
+ ld bc, 8 palettes
+ call CopyBytes
+
+ ld hl, UnusedTitleFG_Palettes
+ ld de, OBPals
+ ld bc, 8 palettes
+ call CopyBytes
+
+ pop af
+ ld [rSVBK], a
+
+ ld a, $1
+ ld [hCGBPalUpdate], a
+
+ ld de, MUSIC_TITLE
+ call PlayMusic
+
+ ret
+; 10c0b1
+
+UnusedTitleBG_GFX: ; 10c0b1
+INCBIN "gfx/title/old_bg.2bpp"
+; 10d0b1
+
+UnusedTitleBG_Tilemap: ; 10d0b1
+; 32x32 (tile, attributes)
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $01,$00, $02,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $03,$00, $04,$00, $05,$01, $06,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $07,$05, $08,$05, $09,$05, $0a,$05, $0b,$00, $0c,$00, $0d,$00, $0e,$00, $0f,$01, $10,$01, $11,$01, $12,$01, $13,$05, $14,$05, $15,$05, $16,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $17,$04, $18,$04, $19,$04, $1a,$04, $1b,$00, $1c,$00, $1d,$02, $1e,$02, $1f,$07, $20,$07, $21,$01, $22,$01, $23,$04, $24,$04, $25,$04, $26,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $27,$04, $28,$04, $29,$04, $2a,$04, $2b,$00, $2c,$00, $2d,$03, $2e,$01, $2f,$01, $30,$01, $31,$01, $32,$01, $33,$04, $34,$04, $35,$04, $36,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $37,$04, $38,$04, $39,$04, $3a,$04, $3b,$00, $3c,$00, $3d,$01, $00,$00, $00,$00, $3e,$07, $3f,$01, $40,$01, $41,$04, $42,$04, $43,$04, $44,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $45,$04, $46,$04, $47,$04, $48,$04, $49,$00, $3c,$00, $4a,$01, $00,$00, $00,$00, $4b,$07, $3f,$01, $4c,$01, $4d,$06, $4e,$06, $4f,$06, $50,$06, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $51,$04, $52,$06, $53,$06, $54,$06, $55,$00, $3c,$00, $56,$01, $00,$00, $00,$00, $57,$07, $58,$01, $59,$01, $5a,$06, $5b,$06, $5c,$06, $5d,$06, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $5e,$06, $5f,$06, $60,$06, $61,$06, $62,$00, $63,$00, $64,$03, $65,$01, $66,$01, $67,$07, $68,$01, $69,$01, $26,$04, $6a,$06, $26,$04, $26,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $6b,$00, $6c,$05, $6d,$05, $6e,$05, $6f,$00, $70,$02, $71,$02, $72,$01, $73,$00, $74,$02, $75,$01, $76,$01, $77,$05, $78,$05, $79,$05, $6b,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $7a,$00, $7b,$00, $7c,$00, $7d,$00, $0f,$01, $7e,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $a2,$00, $80,$00, $81,$00, $82,$00, $83,$00, $84,$07, $85,$01, $86,$01, $87,$01, $88,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $89,$00, $8a,$00, $8b,$00, $8c,$07, $8d,$01, $8e,$01, $8f,$01, $90,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $91,$01, $92,$01, $93,$01, $94,$01, $95,$01, $00,$00, $00,$00, $00,$00, $96,$05, $97,$05, $98,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $99,$05, $9a,$05, $9b,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $9c,$05, $9d,$05, $9e,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $9f,$05, $a0,$05, $a1,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $6b,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+ db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
+; 10d8b1
+
+UnusedTitleBG_Palettes: ; 10d8b1
+INCLUDE "data/palettes/unused_title/bg.pal"
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+
+ RGB 31, 31, 31
+ RGB 20, 04, 20
+ RGB 16, 08, 16
+ RGB 24, 00, 24
+
+rept 54
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+endr
+; 10dab1
+
+UnusedTitleFG_GFX: ; 10dab1
+INCBIN "gfx/title/old_fg.2bpp"
+; 10eab1
+
+UnusedTitleFG_Palettes: ; 10eab1
+INCLUDE "data/palettes/unused_title/ob.pal"
+; 10ecb1
+
+UnusedTitleFG_OAM: ; 10ecb1
+ db $18, $38, $00, $01, $18, $40, $02, $01, $18, $48, $04, $01, $18, $50, $06, $01
+ db $18, $58, $08, $01, $18, $60, $0a, $01, $18, $68, $0c, $01, $18, $70, $0e, $01
+
+ db $28, $38, $10, $00, $28, $40, $12, $00, $28, $48, $14, $00, $28, $50, $16, $00
+ db $28, $58, $18, $00, $28, $60, $1a, $00, $28, $68, $1c, $00, $28, $70, $1e, $00
+
+ db $38, $38, $20, $00, $38, $40, $22, $00, $38, $48, $24, $00, $38, $50, $26, $00
+ db $38, $58, $28, $00, $38, $60, $2a, $00, $38, $68, $2c, $00, $38, $70, $2e, $00
+
+ db $48, $38, $30, $02, $48, $40, $32, $02, $48, $48, $34, $02, $48, $50, $36, $02
+ db $48, $58, $38, $02, $48, $60, $3a, $02, $48, $68, $3c, $02, $48, $70, $3e, $02
+
+ db $58, $38, $40, $01, $58, $40, $42, $01, $58, $48, $44, $01, $58, $50, $46, $01
+ db $58, $58, $48, $01, $58, $60, $4a, $01, $58, $68, $4c, $01, $58, $70, $4e, $01
+; 10ed51
+
+
+Function10ed51: ; 10ed51
+ call _TitleScreen
+.loop
+ call JoyTextDelay
+ ld a, [hJoyLast]
+ ld b, a
+ and 1
+ jr nz, .done
+ call SuicuneFrameIterator
+ call DelayFrame
+ jr .loop
+.done
+ ret
+; 10ed67
diff --git a/engine/variables.asm b/engine/variables.asm
index fde2583b7..1b418ea3c 100755
--- a/engine/variables.asm
+++ b/engine/variables.asm
@@ -35,9 +35,9 @@ _GetVarAction:: ; 80648 (20:4648)
; 80671 (20:4671)
.VarActionTable: ; 80671
-; $00: copy [de] to StringBuffer2
-; $40: return address in de
-; $80: call function
+; RETVAR_STRBUF2: copy [de] to StringBuffer2
+; RETVAR_ADDR_DE: return address in de
+; RETVAR_EXECUTE: call function
dwb StringBuffer2, RETVAR_STRBUF2
dwb PartyCount, RETVAR_STRBUF2
dwb .BattleResult, RETVAR_EXECUTE
@@ -53,7 +53,7 @@ _GetVarAction:: ; 80648 (20:4648)
dwb MapGroup, RETVAR_STRBUF2
dwb MapNumber, RETVAR_STRBUF2
dwb .UnownCaught, RETVAR_EXECUTE
- dwb wPermission, RETVAR_STRBUF2
+ dwb wEnvironment, RETVAR_STRBUF2
dwb .BoxFreeSpace, RETVAR_EXECUTE
dwb wBugContestMinsRemaining, RETVAR_STRBUF2
dwb XCoord, RETVAR_STRBUF2
diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm
index 180aada87..fadf7d4a6 100755
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -3,12 +3,12 @@ HandleNewMap: ; 1045b0
call Clearwc7e8
call ResetMapBufferEventFlags
call ResetFlashIfOutOfCave
- call GetCurrentMapTrigger
+ call GetCurrentMapSceneID
call ResetBikeFlags
ld a, MAPCALLBACK_NEWMAP
call RunMapCallback
InitCommandQueue: ; 1045c4
- callba ClearCmdQueue
+ farcall ClearCmdQueue
ld a, MAPCALLBACK_CMDQUEUE
call RunMapCallback
call GetMapHeaderTimeOfDayNybble
@@ -164,14 +164,14 @@ LoadWarpData: ; 1046c6
ret
.SaveDigWarp: ; 1046df (41:46df)
- call GetMapPermission
+ call GetMapEnvironment
call CheckOutdoorMap
ret nz
ld a, [wNextMapGroup]
ld b, a
ld a, [wNextMapNumber]
ld c, a
- call GetAnyMapPermission
+ call GetAnyMapEnvironment
call CheckIndoorMap
ret nz
ld a, [wPrevMapGroup]
@@ -184,7 +184,7 @@ LoadWarpData: ; 1046c6
ret z
.not_mt_moon_or_tin_tower
ld a, [wPrevWarp]
- ld [wDigWarp], a
+ ld [wDigWarpNumber], a
ld a, [wPrevMapGroup]
ld [wDigMapGroup], a
ld a, [wPrevMapNumber]
@@ -192,14 +192,14 @@ LoadWarpData: ; 1046c6
ret
.SetSpawn: ; 104718 (41:4718)
- call GetMapPermission
+ call GetMapEnvironment
call CheckOutdoorMap
ret nz
ld a, [wNextMapGroup]
ld b, a
ld a, [wNextMapNumber]
ld c, a
- call GetAnyMapPermission
+ call GetAnyMapEnvironment
call CheckIndoorMap
ret nz
ld a, [wNextMapGroup]
@@ -225,8 +225,8 @@ LoadMapTimeOfDay: ; 104750
res 6, [hl]
ld a, $1
ld [wSpriteUpdatesEnabled], a
- callba ReplaceTimeOfDayPals
- callba UpdateTimeOfDayPal
+ farcall ReplaceTimeOfDayPals
+ farcall UpdateTimeOfDayPal
call OverworldTextModeSwitch
call .ClearBGMap
call .PushAttrMap
@@ -239,7 +239,7 @@ LoadMapTimeOfDay: ; 104750
ld [wBGMapAnchor], a
ld [hSCY], a
ld [hSCX], a
- callba ApplyBGMapAnchorToObjects
+ farcall ApplyBGMapAnchorToObjects
ld a, [rVBK]
push af
@@ -254,7 +254,7 @@ LoadMapTimeOfDay: ; 104750
pop af
ld [rVBK], a
- ld a, $60
+ ld a, "<BLACK>"
ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0
call ByteFill
@@ -298,9 +298,9 @@ LoadGraphics: ; 1047cf
ld [hMapAnims], a
xor a
ld [hTileAnimFrame], a
- callba RefreshSprites
+ farcall RefreshSprites
call LoadFontsExtra
- callba LoadOverworldFont
+ farcall LoadOverworldFont
ret
LoadMapPalettes: ; 1047eb
@@ -310,10 +310,10 @@ LoadMapPalettes: ; 1047eb
RefreshMapSprites: ; 1047f0
call ClearSprites
- callba ReturnFromMapSetupScript
+ farcall ReturnFromMapSetupScript
call GetMovementPermissions
- callba RefreshPlayerSprite
- callba CheckReplaceKrisSprite
+ farcall RefreshPlayerSprite
+ farcall CheckReplaceKrisSprite
ld hl, wPlayerSpriteSetupFlags
bit 6, [hl]
jr nz, .skip
diff --git a/engine/wildmons.asm b/engine/wildmons.asm
index 6208cfbce..9aed7017a 100755
--- a/engine/wildmons.asm
+++ b/engine/wildmons.asm
@@ -65,7 +65,7 @@ FindNest: ; 2a01f
inc hl
inc hl
inc hl
- ld a, NUM_WILDMONS_PER_AREA_TIME_OF_DAY * 3
+ ld a, NUM_GRASSMON * 3
call .SearchMapForMon
jr nc, .next_grass
ld [de], a
@@ -73,7 +73,7 @@ FindNest: ; 2a01f
.next_grass
pop hl
- ld bc, WILDMON_GRASS_STRUCTURE_LENGTH
+ ld bc, GRASS_WILDDATA_LENGTH
add hl, bc
jr .FindGrass
; 2a06e
@@ -271,14 +271,14 @@ ChooseWildEncounter: ; 2a14f
inc hl
inc hl
call CheckOnWater
- ld de, .WaterMonTable
+ ld de, WaterMonProbTable
jr z, .watermon
inc hl
inc hl
ld a, [TimeOfDay]
ld bc, $e
call AddNTimes
- ld de, .GrassMonTable
+ ld de, GrassMonProbTable
.watermon
; hl contains the pointer to the wild mon data, let's save that to the stack
@@ -357,21 +357,7 @@ ChooseWildEncounter: ; 2a14f
ret
; 2a1cb
-.GrassMonTable: ; 2a1cb
- db 30, $0 ; 30% chance
- db 60, $2 ; 30% chance
- db 80, $4 ; 20% chance
- db 90, $6 ; 10% chance
- db 95, $8 ; 5% chance
- db 99, $a ; 4% chance
- db 100, $c ; 1% chance
-; 2a1d9
-
-.WaterMonTable: ; 2a1d9
- db 60, $0 ; 60% chance
- db 90, $2 ; 30% chance
- db 100, $4 ; 10% chance
-; 2a1df
+INCLUDE "data/wild/probabilities.asm"
CheckRepelEffect:: ; 2a1df
; If there is no active Repel, there's no need to be here.
@@ -798,29 +784,9 @@ _BackUpMapIndices: ; 2a3f6
ret
; 2a40f
-RoamMaps: ; 2a40f
-; Maps that roaming monsters can be on,
-; and possible maps they can jump to.
-; Notably missing are Route 40 and
-; Route 41, which are water routes.
- roam_map ROUTE_29, 2, ROUTE_30, ROUTE_46
- roam_map ROUTE_30, 2, ROUTE_29, ROUTE_31
- roam_map ROUTE_31, 3, ROUTE_30, ROUTE_32, ROUTE_36
- roam_map ROUTE_32, 3, ROUTE_36, ROUTE_31, ROUTE_33
- roam_map ROUTE_33, 2, ROUTE_32, ROUTE_34
- roam_map ROUTE_34, 2, ROUTE_33, ROUTE_35
- roam_map ROUTE_35, 2, ROUTE_34, ROUTE_36
- roam_map ROUTE_36, 4, ROUTE_35, ROUTE_31, ROUTE_32, ROUTE_37
- roam_map ROUTE_37, 3, ROUTE_36, ROUTE_38, ROUTE_42
- roam_map ROUTE_38, 3, ROUTE_37, ROUTE_39, ROUTE_42
- roam_map ROUTE_39, 1, ROUTE_38
- roam_map ROUTE_42, 4, ROUTE_43, ROUTE_44, ROUTE_37, ROUTE_38
- roam_map ROUTE_43, 2, ROUTE_42, ROUTE_44
- roam_map ROUTE_44, 3, ROUTE_42, ROUTE_43, ROUTE_45
- roam_map ROUTE_45, 2, ROUTE_44, ROUTE_46
- roam_map ROUTE_46, 2, ROUTE_45, ROUTE_29
- db -1
-; 2a4a0
+
+INCLUDE "data/wild/roammon_maps.asm"
+
ValidateTempWildMonSpecies: ; 2a4a0
; Due to a development oversight, this function is called with the wild Pokemon's level, not its species, in a.
@@ -836,9 +802,10 @@ ValidateTempWildMonSpecies: ; 2a4a0
ret
; 2a4ab
-RandomPhoneRareWildMon: ; 2a4ab
-; Related to the phone?
- callba GetCallerLocation
+; Finds a rare wild Pokemon in the route of the trainer calling, then checks if it's been Seen already.
+; The trainer will then tell you about the Pokemon if you haven't seen it.
+RandomUnseenWildMon: ; 2a4ab
+ farcall GetCallerLocation
ld d, b
ld e, c
ld hl, JohtoGrassWildMons
@@ -911,7 +878,7 @@ RandomPhoneRareWildMon: ; 2a4ab
; 0x2a51f
RandomPhoneWildMon: ; 2a51f
- callba GetCallerLocation
+ farcall GetCallerLocation
ld d, b
ld e, c
ld hl, JohtoGrassWildMons
@@ -952,7 +919,7 @@ RandomPhoneWildMon: ; 2a51f
RandomPhoneMon: ; 2a567
; Get a random monster owned by the trainer who's calling.
- callba GetCallerLocation
+ farcall GetCallerLocation
ld hl, TrainerGroups
ld a, d
dec a
@@ -1034,20 +1001,9 @@ RandomPhoneMon: ; 2a567
; 2a5e9
-JohtoGrassWildMons: ; 0x2a5e9
INCLUDE "data/wild/johto_grass.asm"
-
-JohtoWaterWildMons: ; 0x2b11d
INCLUDE "data/wild/johto_water.asm"
-
-KantoGrassWildMons: ; 0x2b274
INCLUDE "data/wild/kanto_grass.asm"
-
-KantoWaterWildMons: ; 0x2b7f7
INCLUDE "data/wild/kanto_water.asm"
-
-SwarmGrassWildMons: ; 0x2b8d0
INCLUDE "data/wild/swarm_grass.asm"
-
-SwarmWaterWildMons: ; 0x2b92f
INCLUDE "data/wild/swarm_water.asm"