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