2018-08-06 08:20:05 -07:00
|
|
|
HasNoItems:
|
|
|
|
ld a, [wNumItems]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld a, [wNumKeyItems]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld a, [wNumBalls]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
ld hl, wTMsHMs
|
|
|
|
ld b, NUM_TMS + NUM_HMS
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr nz, .done
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
.done
|
|
|
|
and a
|
|
|
|
ret
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
TossItemFromPC:
|
|
|
|
push de
|
|
|
|
call PartyMonItemName
|
|
|
|
farcall _CheckTossableItem
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wItemAttributeValue]
|
2018-08-06 08:20:05 -07:00
|
|
|
and a
|
|
|
|
jr nz, .key_item
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .ItemsTossOutHowManyText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextbox
|
2018-08-06 08:20:05 -07:00
|
|
|
farcall SelectQuantityToToss
|
|
|
|
push af
|
|
|
|
call CloseWindow
|
2015-12-13 14:11:58 -08:00
|
|
|
call ExitMenu
|
2018-08-06 08:20:05 -07:00
|
|
|
pop af
|
|
|
|
jr c, .quit
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .ItemsThrowAwayText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextbox
|
2018-08-06 08:20:05 -07:00
|
|
|
call YesNoBox
|
|
|
|
push af
|
|
|
|
call ExitMenu
|
|
|
|
pop af
|
|
|
|
jr c, .quit
|
|
|
|
pop hl
|
|
|
|
ld a, [wCurItemQuantity]
|
|
|
|
call TossItem
|
|
|
|
call PartyMonItemName
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .ItemsDiscardedText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextbox
|
2018-08-06 08:20:05 -07:00
|
|
|
call ExitMenu
|
|
|
|
and a
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.key_item
|
|
|
|
call .CantToss
|
|
|
|
.quit
|
|
|
|
pop hl
|
|
|
|
scf
|
|
|
|
ret
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.ItemsTossOutHowManyText:
|
|
|
|
text_far _ItemsTossOutHowManyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.ItemsThrowAwayText:
|
|
|
|
text_far _ItemsThrowAwayText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.ItemsDiscardedText:
|
|
|
|
text_far _ItemsDiscardedText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
.CantToss:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .ItemsTooImportantText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.ItemsTooImportantText:
|
|
|
|
text_far _ItemsTooImportantText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
CantUseItem:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemsOakWarningText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxWaitButton
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemsOakWarningText:
|
|
|
|
text_far _ItemsOakWarningText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
PartyMonItemName:
|
|
|
|
ld a, [wCurItem]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2018-08-06 08:20:05 -07:00
|
|
|
call GetItemName
|
|
|
|
call CopyName1
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
CancelPokemonAction:
|
|
|
|
farcall InitPartyMenuWithCancel
|
|
|
|
farcall UnfreezeMonIcons
|
|
|
|
ld a, 1
|
|
|
|
ret
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2023-09-22 14:12:05 -07:00
|
|
|
Party::
|
|
|
|
.choosemenu
|
|
|
|
xor a
|
|
|
|
ld [wPartyMenuActionText], a ; Choose a POKéMON.
|
|
|
|
call ClearBGPalettes
|
|
|
|
|
|
|
|
.menu
|
|
|
|
farcall LoadPartyMenuGFX
|
|
|
|
farcall InitPartyMenuWithCancel
|
|
|
|
farcall InitPartyMenuGFX
|
|
|
|
|
|
|
|
.menunoreload
|
|
|
|
farcall WritePartyMenuTilemap
|
|
|
|
farcall PlacePartyMenuText
|
|
|
|
call WaitBGMap
|
2023-09-23 02:50:25 -07:00
|
|
|
call SetPalettes
|
2023-09-22 14:12:05 -07:00
|
|
|
call DelayFrame
|
|
|
|
farcall PartyMenuSelect
|
|
|
|
ret c ; if cancelled or pressed B
|
|
|
|
|
|
|
|
call PokemonActionSubmenu
|
|
|
|
and 3
|
|
|
|
cp 3
|
|
|
|
jr z, .menu
|
|
|
|
cp 0
|
|
|
|
jr z, .choosemenu
|
|
|
|
cp 1
|
|
|
|
jr z, .menunoreload
|
|
|
|
and a ; must be 2, which means quit after using field move
|
|
|
|
ret ; nc
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
PokemonActionSubmenu:
|
|
|
|
hlcoord 1, 15
|
|
|
|
lb bc, 2, 18
|
|
|
|
call ClearBox
|
|
|
|
farcall MonSubmenu
|
2021-03-17 13:16:02 -07:00
|
|
|
call GetCurNickname
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [wMenuSelection]
|
|
|
|
ld hl, .Actions
|
2015-12-13 14:11:58 -08:00
|
|
|
ld de, 3
|
|
|
|
call IsInArray
|
2018-08-06 08:20:05 -07:00
|
|
|
jr nc, .nothing
|
|
|
|
|
2015-12-13 14:11:58 -08:00
|
|
|
inc hl
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
jp hl
|
|
|
|
|
|
|
|
.nothing
|
|
|
|
ld a, 0
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.Actions:
|
|
|
|
dbw MONMENUITEM_CUT, MonMenu_Cut
|
|
|
|
dbw MONMENUITEM_FLY, MonMenu_Fly
|
|
|
|
dbw MONMENUITEM_SURF, MonMenu_Surf
|
|
|
|
dbw MONMENUITEM_STRENGTH, MonMenu_Strength
|
|
|
|
dbw MONMENUITEM_FLASH, MonMenu_Flash
|
|
|
|
dbw MONMENUITEM_WHIRLPOOL, MonMenu_Whirlpool
|
|
|
|
dbw MONMENUITEM_DIG, MonMenu_Dig
|
|
|
|
dbw MONMENUITEM_TELEPORT, MonMenu_Teleport
|
|
|
|
dbw MONMENUITEM_SOFTBOILED, MonMenu_Softboiled_MilkDrink
|
|
|
|
dbw MONMENUITEM_MILKDRINK, MonMenu_Softboiled_MilkDrink
|
|
|
|
dbw MONMENUITEM_HEADBUTT, MonMenu_Headbutt
|
|
|
|
dbw MONMENUITEM_WATERFALL, MonMenu_Waterfall
|
|
|
|
dbw MONMENUITEM_ROCKSMASH, MonMenu_RockSmash
|
|
|
|
dbw MONMENUITEM_SWEETSCENT, MonMenu_SweetScent
|
|
|
|
dbw MONMENUITEM_STATS, OpenPartyStats
|
|
|
|
dbw MONMENUITEM_SWITCH, SwitchPartyMons
|
|
|
|
dbw MONMENUITEM_ITEM, GiveTakePartyMonItem
|
|
|
|
dbw MONMENUITEM_CANCEL, CancelPokemonAction
|
|
|
|
dbw MONMENUITEM_MOVE, ManagePokemonMoves
|
|
|
|
dbw MONMENUITEM_MAIL, MonMailAction
|
|
|
|
|
|
|
|
SwitchPartyMons:
|
|
|
|
; Don't try if there's nothing to switch!
|
|
|
|
ld a, [wPartyCount]
|
|
|
|
cp 2
|
|
|
|
jr c, .DontSwitch
|
|
|
|
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
inc a
|
|
|
|
ld [wSwitchMon], a
|
|
|
|
|
|
|
|
farcall HoldSwitchmonIcon
|
|
|
|
farcall InitPartyMenuNoCancel
|
|
|
|
|
|
|
|
ld a, PARTYMENUACTION_MOVE
|
|
|
|
ld [wPartyMenuActionText], a
|
|
|
|
farcall WritePartyMenuTilemap
|
2023-08-11 03:28:14 -07:00
|
|
|
farcall PlacePartyMenuText
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
hlcoord 0, 1
|
|
|
|
ld bc, SCREEN_WIDTH * 2
|
|
|
|
ld a, [wSwitchMon]
|
2015-12-13 14:11:58 -08:00
|
|
|
dec a
|
2018-08-06 08:20:05 -07:00
|
|
|
call AddNTimes
|
|
|
|
ld [hl], "▷"
|
|
|
|
call WaitBGMap
|
|
|
|
call SetPalettes
|
|
|
|
call DelayFrame
|
|
|
|
|
|
|
|
farcall PartyMenuSelect
|
|
|
|
bit 1, b
|
|
|
|
jr c, .DontSwitch
|
|
|
|
|
|
|
|
farcall _SwitchPartyMons
|
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [wPartyMenuActionText], a
|
|
|
|
|
|
|
|
farcall LoadPartyMenuGFX
|
|
|
|
farcall InitPartyMenuWithCancel
|
|
|
|
farcall InitPartyMenuGFX
|
|
|
|
|
|
|
|
ld a, 1
|
|
|
|
ret
|
|
|
|
|
|
|
|
.DontSwitch:
|
|
|
|
xor a
|
|
|
|
ld [wPartyMenuActionText], a
|
|
|
|
call CancelPokemonAction
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
GiveTakePartyMonItem:
|
|
|
|
; Eggs can't hold items!
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2015-12-13 14:11:58 -08:00
|
|
|
cp EGG
|
2018-08-06 08:20:05 -07:00
|
|
|
jr z, .cancel
|
|
|
|
|
|
|
|
ld hl, GiveTakeItemMenuData
|
|
|
|
call LoadMenuHeader
|
|
|
|
call VerticalMenu
|
|
|
|
call ExitMenu
|
|
|
|
jr c, .cancel
|
|
|
|
|
2021-03-17 13:16:02 -07:00
|
|
|
call GetCurNickname
|
2018-08-06 08:20:05 -07:00
|
|
|
ld hl, wStringBuffer1
|
|
|
|
ld de, wMonOrItemNameBuffer
|
|
|
|
ld bc, MON_NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
cp 1
|
|
|
|
jr nz, .take
|
|
|
|
|
|
|
|
call LoadStandardMenuHeader
|
|
|
|
call ClearPalettes
|
|
|
|
call .GiveItem
|
|
|
|
call ClearPalettes
|
|
|
|
call LoadFontsBattleExtra
|
|
|
|
call ExitMenu
|
|
|
|
ld a, 0
|
|
|
|
ret
|
|
|
|
|
|
|
|
.take
|
|
|
|
call TakePartyItem
|
|
|
|
ld a, 3
|
|
|
|
ret
|
|
|
|
|
|
|
|
.cancel
|
|
|
|
ld a, 3
|
|
|
|
ret
|
|
|
|
|
|
|
|
.GiveItem:
|
|
|
|
farcall DepositSellInitPackBuffers
|
|
|
|
|
2015-12-13 14:11:58 -08:00
|
|
|
.loop
|
2018-08-06 08:20:05 -07:00
|
|
|
farcall DepositSellPack
|
|
|
|
|
2019-04-19 15:55:04 -07:00
|
|
|
ld a, [wPackUsedItem]
|
2015-12-13 14:11:58 -08:00
|
|
|
and a
|
2018-08-06 08:20:05 -07:00
|
|
|
jr z, .quit
|
|
|
|
|
2019-04-19 15:55:04 -07:00
|
|
|
ld a, [wCurPocket]
|
|
|
|
cp KEY_ITEM_POCKET
|
2015-12-13 14:11:58 -08:00
|
|
|
jr z, .next
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
call CheckTossableItem
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wItemAttributeValue]
|
2018-08-06 08:20:05 -07:00
|
|
|
and a
|
|
|
|
jr nz, .next
|
|
|
|
|
|
|
|
call TryGiveItemToPartymon
|
|
|
|
jr .quit
|
2015-12-13 14:11:58 -08:00
|
|
|
|
|
|
|
.next
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemCantHeldText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
jr .loop
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.quit
|
|
|
|
ret
|
|
|
|
|
|
|
|
TryGiveItemToPartymon:
|
2023-08-11 03:28:14 -07:00
|
|
|
call SpeechTextbox1bpp
|
2018-08-06 08:20:05 -07:00
|
|
|
call PartyMonItemName
|
|
|
|
call GetPartyItemLocation
|
|
|
|
ld a, [hl]
|
2015-12-13 14:11:58 -08:00
|
|
|
and a
|
2018-08-06 08:20:05 -07:00
|
|
|
jr z, .give_item_to_mon
|
|
|
|
|
2015-12-13 14:11:58 -08:00
|
|
|
push hl
|
2018-08-06 08:20:05 -07:00
|
|
|
ld d, a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ItemIsMail
|
2015-12-13 14:11:58 -08:00
|
|
|
pop hl
|
2018-08-06 08:20:05 -07:00
|
|
|
jr c, .please_remove_mail
|
|
|
|
ld a, [hl]
|
|
|
|
jr .already_holding_item
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.give_item_to_mon
|
|
|
|
call GiveItemToPokemon
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PokemonHoldItemText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
call GivePartyItem
|
|
|
|
ret
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.please_remove_mail
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PokemonRemoveMailText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
ret
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.already_holding_item
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2018-08-06 08:20:05 -07:00
|
|
|
call GetItemName
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PokemonAskSwapItemText
|
2018-08-06 08:20:05 -07:00
|
|
|
call StartMenuYesNo
|
|
|
|
jr c, .abort
|
|
|
|
|
|
|
|
call GiveItemToPokemon
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wNamedObjectIndex]
|
2018-08-06 08:20:05 -07:00
|
|
|
push af
|
|
|
|
ld a, [wCurItem]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2018-08-06 08:20:05 -07:00
|
|
|
pop af
|
|
|
|
ld [wCurItem], a
|
|
|
|
call ReceiveItemFromPokemon
|
|
|
|
jr nc, .bag_full
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PokemonSwapItemText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wNamedObjectIndex]
|
2018-08-06 08:20:05 -07:00
|
|
|
ld [wCurItem], a
|
|
|
|
call GivePartyItem
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.bag_full
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wNamedObjectIndex]
|
2018-08-06 08:20:05 -07:00
|
|
|
ld [wCurItem], a
|
|
|
|
call ReceiveItemFromPokemon
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemStorageFullText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
.abort
|
|
|
|
ret
|
|
|
|
|
|
|
|
GivePartyItem:
|
|
|
|
call GetPartyItemLocation
|
|
|
|
ld a, [wCurItem]
|
|
|
|
ld [hl], a
|
|
|
|
ld d, a
|
|
|
|
farcall ItemIsMail
|
|
|
|
jr nc, .done
|
|
|
|
call ComposeMailMessage
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
|
|
|
TakePartyItem:
|
2023-08-11 03:28:14 -07:00
|
|
|
call SpeechTextbox1bpp
|
2018-08-06 08:20:05 -07:00
|
|
|
call GetPartyItemLocation
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2020-10-04 19:34:50 -07:00
|
|
|
jr z, .not_holding_item
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
ld [wCurItem], a
|
|
|
|
call ReceiveItemFromPokemon
|
2020-10-04 19:34:50 -07:00
|
|
|
jr nc, .item_storage_full
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
farcall ItemIsMail
|
|
|
|
call GetPartyItemLocation
|
|
|
|
ld a, [hl]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld [hl], NO_ITEM
|
|
|
|
call GetItemName
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PokemonTookItemText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2020-10-04 19:34:50 -07:00
|
|
|
jr .done
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2020-10-04 19:34:50 -07:00
|
|
|
.not_holding_item
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PokemonNotHoldingText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2020-10-04 19:34:50 -07:00
|
|
|
jr .done
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2020-10-04 19:34:50 -07:00
|
|
|
.item_storage_full
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemStorageFullText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2020-10-04 19:34:50 -07:00
|
|
|
.done
|
2018-08-06 08:20:05 -07:00
|
|
|
ret
|
|
|
|
|
|
|
|
GiveTakeItemMenuData:
|
|
|
|
db MENU_SPRITE_ANIMS | MENU_BACKUP_TILES ; flags
|
|
|
|
menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
|
|
|
dw .Items
|
|
|
|
db 1 ; default option
|
|
|
|
|
|
|
|
.Items:
|
|
|
|
db STATICMENU_CURSOR ; flags
|
|
|
|
db 2 ; # items
|
|
|
|
db "GIVE@"
|
|
|
|
db "TAKE@"
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PokemonSwapItemText:
|
|
|
|
text_far _PokemonSwapItemText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PokemonHoldItemText:
|
|
|
|
text_far _PokemonHoldItemText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PokemonRemoveMailText:
|
|
|
|
text_far _PokemonRemoveMailText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PokemonNotHoldingText:
|
|
|
|
text_far _PokemonNotHoldingText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemStorageFullText:
|
|
|
|
text_far _ItemStorageFullText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PokemonTookItemText:
|
|
|
|
text_far _PokemonTookItemText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PokemonAskSwapItemText:
|
|
|
|
text_far _PokemonAskSwapItemText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemCantHeldText:
|
|
|
|
text_far _ItemCantHeldText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
GetPartyItemLocation:
|
|
|
|
push af
|
|
|
|
ld a, MON_ITEM
|
|
|
|
call GetPartyParamLocation
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
|
|
|
|
ReceiveItemFromPokemon:
|
|
|
|
ld a, 1
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantityChange], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld hl, wNumItems
|
|
|
|
jp ReceiveItem
|
|
|
|
|
|
|
|
GiveItemToPokemon:
|
|
|
|
ld a, 1
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantityChange], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld hl, wNumItems
|
|
|
|
jp TossItem
|
|
|
|
|
|
|
|
StartMenuYesNo:
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextbox
|
2018-08-06 08:20:05 -07:00
|
|
|
call YesNoBox
|
|
|
|
jp ExitMenu
|
|
|
|
|
|
|
|
ComposeMailMessage:
|
|
|
|
ld de, wTempMailMessage
|
|
|
|
farcall _ComposeMailMessage
|
|
|
|
ld hl, wPlayerName
|
|
|
|
ld de, wTempMailAuthor
|
|
|
|
ld bc, NAME_LENGTH - 1
|
|
|
|
call CopyBytes
|
|
|
|
ld hl, wPlayerID
|
|
|
|
ld bc, 2
|
|
|
|
call CopyBytes
|
|
|
|
ld a, [wCurPartySpecies]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [wCurItem]
|
|
|
|
ld [de], a
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, sPartyMail
|
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, wTempMail
|
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
|
|
|
ld a, BANK(sPartyMail)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2018-08-06 08:20:05 -07:00
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
MonMailAction:
|
|
|
|
; If in the time capsule or trade center,
|
|
|
|
; selecting the mail only allows you to
|
|
|
|
; read the mail.
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TIMECAPSULE
|
|
|
|
jr z, .read
|
|
|
|
cp LINK_TRADECENTER
|
|
|
|
jr z, .read
|
|
|
|
|
|
|
|
; Show the READ/TAKE/QUIT menu.
|
|
|
|
ld hl, .MenuHeader
|
|
|
|
call LoadMenuHeader
|
|
|
|
call VerticalMenu
|
|
|
|
call ExitMenu
|
|
|
|
|
|
|
|
; Interpret the menu.
|
|
|
|
jp c, .done
|
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
cp $1
|
|
|
|
jr z, .read
|
|
|
|
cp $2
|
|
|
|
jr z, .take
|
|
|
|
jp .done
|
|
|
|
|
|
|
|
.read
|
|
|
|
farcall ReadPartyMonMail
|
|
|
|
ld a, $0
|
|
|
|
ret
|
|
|
|
|
|
|
|
.take
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .MailAskSendToPCText
|
2018-08-06 08:20:05 -07:00
|
|
|
call StartMenuYesNo
|
|
|
|
jr c, .RemoveMailToBag
|
|
|
|
ld a, [wCurPartyMon]
|
2015-12-13 14:11:58 -08:00
|
|
|
ld b, a
|
2018-08-06 08:20:05 -07:00
|
|
|
farcall SendMailToPC
|
|
|
|
jr c, .MailboxFull
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .MailSentToPCText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.MailboxFull:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .MailboxFullText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.RemoveMailToBag:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .MailLoseMessageText
|
2018-08-06 08:20:05 -07:00
|
|
|
call StartMenuYesNo
|
|
|
|
jr c, .done
|
|
|
|
call GetPartyItemLocation
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wCurItem], a
|
|
|
|
call ReceiveItemFromPokemon
|
|
|
|
jr nc, .BagIsFull
|
|
|
|
call GetPartyItemLocation
|
|
|
|
ld [hl], $0
|
2021-03-17 13:16:02 -07:00
|
|
|
call GetCurNickname
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .MailDetachedText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.BagIsFull:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .MailNoSpaceText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2018-08-06 08:20:05 -07:00
|
|
|
jr .done
|
|
|
|
|
|
|
|
.done
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
.MenuHeader:
|
|
|
|
db MENU_BACKUP_TILES ; flags
|
|
|
|
menu_coords 12, 10, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
|
|
|
dw .MenuData
|
|
|
|
db 1 ; default option
|
|
|
|
|
|
|
|
.MenuData:
|
|
|
|
db STATICMENU_CURSOR ; flags
|
|
|
|
db 3 ; items
|
|
|
|
db "READ@"
|
|
|
|
db "TAKE@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.MailLoseMessageText:
|
|
|
|
text_far _MailLoseMessageText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.MailDetachedText:
|
|
|
|
text_far _MailDetachedText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.MailNoSpaceText:
|
|
|
|
text_far _MailNoSpaceText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.MailAskSendToPCText:
|
|
|
|
text_far _MailAskSendToPCText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.MailboxFullText:
|
|
|
|
text_far _MailboxFullText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.MailSentToPCText:
|
|
|
|
text_far _MailSentToPCText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
OpenPartyStats:
|
|
|
|
call LoadStandardMenuHeader
|
|
|
|
call ClearSprites
|
|
|
|
; PartyMon
|
|
|
|
xor a
|
|
|
|
ld [wMonType], a
|
|
|
|
call LowVolume
|
|
|
|
predef StatsScreenInit
|
|
|
|
call MaxVolume
|
|
|
|
call Call_ExitMenu
|
|
|
|
ld a, 0
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Cut:
|
|
|
|
farcall CutFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Fly:
|
|
|
|
farcall FlyFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $2
|
|
|
|
jr z, .Fail
|
|
|
|
cp $0
|
|
|
|
jr z, .Error
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Error:
|
|
|
|
ld a, $0
|
|
|
|
ret
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
.NoReload: ; unreferenced
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, $1
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Flash:
|
2020-02-11 04:46:56 -08:00
|
|
|
farcall FlashFunction
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Strength:
|
|
|
|
farcall StrengthFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Whirlpool:
|
|
|
|
farcall WhirlpoolFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Waterfall:
|
|
|
|
farcall WaterfallFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Teleport:
|
|
|
|
farcall TeleportFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
and a
|
|
|
|
jr z, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Surf:
|
|
|
|
farcall SurfFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
and a
|
|
|
|
jr z, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Dig:
|
|
|
|
farcall DigFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_Softboiled_MilkDrink:
|
|
|
|
call .CheckMonHasEnoughHP
|
|
|
|
jr nc, .NotEnoughHP
|
|
|
|
farcall Softboiled_MilkDrinkFunction
|
|
|
|
jr .finish
|
|
|
|
|
|
|
|
.NotEnoughHP:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .PokemonNotEnoughHPText
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
.finish
|
|
|
|
xor a
|
|
|
|
ld [wPartyMenuActionText], a
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.PokemonNotEnoughHPText:
|
|
|
|
text_far _PokemonNotEnoughHPText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
.CheckMonHasEnoughHP:
|
|
|
|
; Need to have at least (MaxHP / 5) HP left.
|
|
|
|
ld a, MON_MAXHP
|
|
|
|
call GetPartyParamLocation
|
2015-12-13 14:11:58 -08:00
|
|
|
ld a, [hli]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDividend + 0], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [hl]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDividend + 1], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, 5
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDivisor], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld b, 2
|
|
|
|
call Divide
|
|
|
|
ld a, MON_HP + 1
|
|
|
|
call GetPartyParamLocation
|
2018-08-26 10:49:38 -07:00
|
|
|
ldh a, [hQuotient + 3]
|
2018-08-06 08:20:05 -07:00
|
|
|
sub [hl]
|
|
|
|
dec hl
|
2018-08-26 10:49:38 -07:00
|
|
|
ldh a, [hQuotient + 2]
|
2018-08-06 08:20:05 -07:00
|
|
|
sbc [hl]
|
|
|
|
ret
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
MonMenu_Headbutt:
|
|
|
|
farcall HeadbuttFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_RockSmash:
|
|
|
|
farcall RockSmashFunction
|
|
|
|
ld a, [wFieldMoveSucceeded]
|
|
|
|
cp $1
|
|
|
|
jr nz, .Fail
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
.Fail:
|
|
|
|
ld a, $3
|
|
|
|
ret
|
|
|
|
|
|
|
|
MonMenu_SweetScent:
|
|
|
|
farcall SweetScentFromMenu
|
|
|
|
ld b, $4
|
|
|
|
ld a, $2
|
|
|
|
ret
|
|
|
|
|
|
|
|
ChooseMoveToDelete:
|
|
|
|
ld hl, wOptions
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set NO_TEXT_SCROLL, [hl]
|
|
|
|
call LoadFontsBattleExtra
|
|
|
|
call .ChooseMoveToDelete
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
|
|
|
ld [wOptions], a
|
|
|
|
push af
|
|
|
|
call ClearBGPalettes
|
|
|
|
pop af
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.ChooseMoveToDelete
|
|
|
|
call SetUpMoveScreenBG
|
2020-06-20 08:56:18 -07:00
|
|
|
ld de, DeleteMoveScreen2DMenuData
|
|
|
|
call Load2DMenuData
|
2018-08-06 08:20:05 -07:00
|
|
|
call SetUpMoveList
|
|
|
|
ld hl, w2DMenuFlags1
|
|
|
|
set 6, [hl]
|
|
|
|
jr .enter_loop
|
|
|
|
|
|
|
|
.loop
|
|
|
|
call ScrollingMenuJoypad
|
|
|
|
bit B_BUTTON_F, a
|
|
|
|
jp nz, .b_button
|
|
|
|
bit A_BUTTON_F, a
|
|
|
|
jp nz, .a_button
|
|
|
|
|
|
|
|
.enter_loop
|
|
|
|
call PrepareToPlaceMoveData
|
|
|
|
call PlaceMoveData
|
|
|
|
jp .loop
|
|
|
|
|
|
|
|
.a_button
|
|
|
|
and a
|
|
|
|
jr .finish
|
|
|
|
|
|
|
|
.b_button
|
|
|
|
scf
|
|
|
|
|
|
|
|
.finish
|
|
|
|
push af
|
2015-12-13 14:11:58 -08:00
|
|
|
xor a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld [wSwitchMon], a
|
|
|
|
ld hl, w2DMenuFlags1
|
|
|
|
res 6, [hl]
|
|
|
|
call ClearSprites
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2018-08-06 08:20:05 -07:00
|
|
|
pop af
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2020-06-20 08:56:18 -07:00
|
|
|
DeleteMoveScreen2DMenuData:
|
|
|
|
db 3, 1 ; cursor start y, x
|
|
|
|
db 3, 1 ; rows, columns
|
|
|
|
db $40, $00 ; flags
|
|
|
|
dn 2, 0 ; cursor offset
|
|
|
|
db D_UP | D_DOWN | A_BUTTON | B_BUTTON ; accepted buttons
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
ManagePokemonMoves:
|
|
|
|
ld a, [wCurPartySpecies]
|
|
|
|
cp EGG
|
|
|
|
jr z, .egg
|
|
|
|
ld hl, wOptions
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set NO_TEXT_SCROLL, [hl]
|
|
|
|
call MoveScreenLoop
|
|
|
|
pop af
|
|
|
|
ld [wOptions], a
|
|
|
|
call ClearBGPalettes
|
|
|
|
|
|
|
|
.egg
|
|
|
|
ld a, $0
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
MoveScreenLoop:
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
inc a
|
|
|
|
ld [wPartyMenuCursor], a
|
|
|
|
call SetUpMoveScreenBG
|
2019-11-03 10:46:00 -08:00
|
|
|
call PlaceMoveScreenArrows
|
2020-06-20 08:56:18 -07:00
|
|
|
ld de, MoveScreen2DMenuData
|
|
|
|
call Load2DMenuData
|
2018-08-06 08:20:05 -07:00
|
|
|
.loop
|
|
|
|
call SetUpMoveList
|
|
|
|
ld hl, w2DMenuFlags1
|
|
|
|
set 6, [hl]
|
|
|
|
jr .skip_joy
|
|
|
|
|
|
|
|
.joy_loop
|
|
|
|
call ScrollingMenuJoypad
|
|
|
|
bit 1, a
|
|
|
|
jp nz, .b_button
|
|
|
|
bit 0, a
|
|
|
|
jp nz, .a_button
|
|
|
|
bit 4, a
|
|
|
|
jp nz, .d_right
|
|
|
|
bit 5, a
|
|
|
|
jp nz, .d_left
|
|
|
|
|
|
|
|
.skip_joy
|
|
|
|
call PrepareToPlaceMoveData
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wSwappingMove]
|
2018-08-06 08:20:05 -07:00
|
|
|
and a
|
|
|
|
jr nz, .moving_move
|
|
|
|
call PlaceMoveData
|
|
|
|
jp .joy_loop
|
|
|
|
|
|
|
|
.moving_move
|
|
|
|
ld a, " "
|
|
|
|
hlcoord 1, 11
|
|
|
|
ld bc, 5
|
|
|
|
call ByteFill
|
|
|
|
hlcoord 1, 12
|
|
|
|
lb bc, 5, SCREEN_WIDTH - 2
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 1, 12
|
|
|
|
ld de, String_MoveWhere
|
|
|
|
call PlaceString
|
|
|
|
jp .joy_loop
|
|
|
|
.b_button
|
|
|
|
call PlayClickSFX
|
|
|
|
call WaitSFX
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wSwappingMove]
|
2018-08-06 08:20:05 -07:00
|
|
|
and a
|
|
|
|
jp z, .exit
|
|
|
|
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wSwappingMove]
|
2018-08-06 08:20:05 -07:00
|
|
|
ld [wMenuCursorY], a
|
|
|
|
xor a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wSwappingMove], a
|
2018-08-06 08:20:05 -07:00
|
|
|
hlcoord 1, 2
|
|
|
|
lb bc, 8, SCREEN_WIDTH - 2
|
|
|
|
call ClearBox
|
|
|
|
jp .loop
|
|
|
|
|
|
|
|
.d_right
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wSwappingMove]
|
2018-08-06 08:20:05 -07:00
|
|
|
and a
|
|
|
|
jp nz, .joy_loop
|
|
|
|
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld b, a
|
|
|
|
push bc
|
|
|
|
call .cycle_right
|
|
|
|
pop bc
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
cp b
|
|
|
|
jp z, .joy_loop
|
|
|
|
jp MoveScreenLoop
|
|
|
|
|
|
|
|
.d_left
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wSwappingMove]
|
2018-08-06 08:20:05 -07:00
|
|
|
and a
|
|
|
|
jp nz, .joy_loop
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld b, a
|
|
|
|
push bc
|
|
|
|
call .cycle_left
|
|
|
|
pop bc
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
cp b
|
|
|
|
jp z, .joy_loop
|
|
|
|
jp MoveScreenLoop
|
|
|
|
|
|
|
|
.cycle_right
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
inc a
|
|
|
|
ld [wCurPartyMon], a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, wPartySpecies
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp -1
|
|
|
|
jr z, .cycle_left
|
|
|
|
cp EGG
|
|
|
|
ret nz
|
|
|
|
jr .cycle_right
|
|
|
|
|
|
|
|
.cycle_left
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
.cycle_left_loop
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
dec a
|
|
|
|
ld [wCurPartyMon], a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, wPartySpecies
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
cp EGG
|
|
|
|
ret nz
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
and a
|
|
|
|
jr z, .cycle_right
|
|
|
|
jr .cycle_left_loop
|
|
|
|
|
|
|
|
.a_button
|
|
|
|
call PlayClickSFX
|
|
|
|
call WaitSFX
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wSwappingMove]
|
2018-08-06 08:20:05 -07:00
|
|
|
and a
|
|
|
|
jr nz, .place_move
|
|
|
|
ld a, [wMenuCursorY]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wSwappingMove], a
|
2018-08-06 08:20:05 -07:00
|
|
|
call PlaceHollowCursor
|
|
|
|
jp .moving_move
|
|
|
|
|
|
|
|
.place_move
|
|
|
|
ld hl, wPartyMon1Moves
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
call AddNTimes
|
2015-12-13 14:11:58 -08:00
|
|
|
push hl
|
2018-08-06 08:20:05 -07:00
|
|
|
call .copy_move
|
|
|
|
pop hl
|
2020-10-14 15:32:41 -07:00
|
|
|
ld bc, wPartyMon1PP - wPartyMon1Moves
|
2018-08-06 08:20:05 -07:00
|
|
|
add hl, bc
|
|
|
|
call .copy_move
|
|
|
|
ld a, [wBattleMode]
|
|
|
|
jr z, .swap_moves
|
|
|
|
ld hl, wBattleMonMoves
|
2020-10-14 15:32:41 -07:00
|
|
|
ld bc, wBattleMonStructEnd - wBattleMon
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
call AddNTimes
|
|
|
|
push hl
|
|
|
|
call .copy_move
|
|
|
|
pop hl
|
2020-10-14 15:32:41 -07:00
|
|
|
ld bc, wBattleMonPP - wBattleMonMoves
|
2018-08-06 08:20:05 -07:00
|
|
|
add hl, bc
|
|
|
|
call .copy_move
|
|
|
|
|
|
|
|
.swap_moves
|
|
|
|
ld de, SFX_SWITCH_POKEMON
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_SWITCH_POKEMON
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
hlcoord 1, 2
|
|
|
|
lb bc, 8, 18
|
|
|
|
call ClearBox
|
|
|
|
hlcoord 10, 10
|
|
|
|
lb bc, 1, 9
|
|
|
|
call ClearBox
|
|
|
|
jp .loop
|
|
|
|
|
|
|
|
.copy_move
|
|
|
|
push hl
|
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
dec a
|
|
|
|
ld c, a
|
2020-11-09 12:17:03 -08:00
|
|
|
ld b, 0
|
2018-08-06 08:20:05 -07:00
|
|
|
add hl, bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wSwappingMove]
|
2018-08-06 08:20:05 -07:00
|
|
|
dec a
|
|
|
|
ld c, a
|
2020-11-09 12:17:03 -08:00
|
|
|
ld b, 0
|
2018-08-06 08:20:05 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [de]
|
|
|
|
ld b, [hl]
|
|
|
|
ld [hl], a
|
|
|
|
ld a, b
|
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exit
|
|
|
|
xor a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wSwappingMove], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld hl, w2DMenuFlags1
|
|
|
|
res 6, [hl]
|
|
|
|
call ClearSprites
|
2020-02-13 09:30:13 -08:00
|
|
|
jp ClearTilemap
|
2018-08-06 08:20:05 -07:00
|
|
|
|
2020-06-20 08:56:18 -07:00
|
|
|
MoveScreen2DMenuData:
|
|
|
|
db 3, 1 ; cursor start y, x
|
|
|
|
db 3, 1 ; rows, columns
|
|
|
|
db $40, $00 ; flags
|
|
|
|
dn 2, 0 ; cursor offsets
|
|
|
|
db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON ; accepted buttons
|
2018-08-06 08:20:05 -07:00
|
|
|
|
|
|
|
String_MoveWhere:
|
|
|
|
db "Where?@"
|
|
|
|
|
|
|
|
SetUpMoveScreenBG:
|
|
|
|
call ClearBGPalettes
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2018-08-06 08:20:05 -07:00
|
|
|
call ClearSprites
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2018-08-06 08:20:05 -07:00
|
|
|
farcall LoadStatsScreenPageTilesGFX
|
|
|
|
farcall ClearSpriteAnims2
|
|
|
|
ld a, [wCurPartyMon]
|
2015-12-13 14:11:58 -08:00
|
|
|
ld e, a
|
2020-11-09 12:17:03 -08:00
|
|
|
ld d, 0
|
2018-08-06 08:20:05 -07:00
|
|
|
ld hl, wPartySpecies
|
2015-12-13 14:11:58 -08:00
|
|
|
add hl, de
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [hl]
|
|
|
|
ld [wTempIconSpecies], a
|
|
|
|
ld e, MONICON_MOVES
|
|
|
|
farcall LoadMenuMonIcon
|
|
|
|
hlcoord 0, 1
|
|
|
|
ld b, 9
|
|
|
|
ld c, 18
|
2023-08-11 03:28:14 -07:00
|
|
|
call Textbox1bpp
|
2018-08-06 08:20:05 -07:00
|
|
|
hlcoord 0, 11
|
|
|
|
ld b, 5
|
|
|
|
ld c, 18
|
2023-08-11 03:28:14 -07:00
|
|
|
call Textbox1bpp
|
2018-08-06 08:20:05 -07:00
|
|
|
hlcoord 2, 0
|
|
|
|
lb bc, 2, 3
|
|
|
|
call ClearBox
|
|
|
|
xor a
|
|
|
|
ld [wMonType], a
|
|
|
|
ld hl, wPartyMonNicknames
|
|
|
|
ld a, [wCurPartyMon]
|
2021-03-17 13:16:02 -07:00
|
|
|
call GetNickname
|
2018-08-06 08:20:05 -07:00
|
|
|
hlcoord 5, 1
|
|
|
|
call PlaceString
|
|
|
|
push bc
|
|
|
|
farcall CopyMonToTempMon
|
2015-12-13 14:11:58 -08:00
|
|
|
pop hl
|
2018-08-06 08:20:05 -07:00
|
|
|
call PrintLevel
|
|
|
|
ld hl, wPlayerHPPal
|
|
|
|
call SetHPPal
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_MOVE_LIST
|
|
|
|
call GetCGBLayout
|
2018-08-06 08:20:05 -07:00
|
|
|
hlcoord 16, 0
|
|
|
|
lb bc, 1, 3
|
|
|
|
jp ClearBox
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
SetUpMoveList:
|
2015-12-13 14:11:58 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wSwappingMove], a
|
2018-08-06 08:20:05 -07:00
|
|
|
ld [wMonType], a
|
|
|
|
predef CopyMonToTempMon
|
|
|
|
ld hl, wTempMonMoves
|
|
|
|
ld de, wListMoves_MoveIndicesBuffer
|
|
|
|
ld bc, NUM_MOVES
|
|
|
|
call CopyBytes
|
|
|
|
ld a, SCREEN_WIDTH * 2
|
2020-11-03 16:53:07 -08:00
|
|
|
ld [wListMovesLineSpacing], a
|
2018-08-06 08:20:05 -07:00
|
|
|
hlcoord 2, 3
|
|
|
|
predef ListMoves
|
|
|
|
hlcoord 10, 4
|
|
|
|
predef ListMovePP
|
2015-12-13 14:11:58 -08:00
|
|
|
call WaitBGMap
|
2018-08-06 08:20:05 -07:00
|
|
|
call SetPalettes
|
|
|
|
ld a, [wNumMoves]
|
|
|
|
inc a
|
|
|
|
ld [w2DMenuNumRows], a
|
|
|
|
hlcoord 0, 11
|
|
|
|
ld b, 5
|
|
|
|
ld c, 18
|
2023-08-11 03:28:14 -07:00
|
|
|
jp Textbox1bpp
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
PrepareToPlaceMoveData:
|
|
|
|
ld hl, wPartyMon1Moves
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
call AddNTimes
|
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
dec a
|
|
|
|
ld c, a
|
2020-11-09 12:17:03 -08:00
|
|
|
ld b, 0
|
2018-08-06 08:20:05 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wCurSpecies], a
|
|
|
|
hlcoord 1, 12
|
|
|
|
lb bc, 5, 18
|
|
|
|
jp ClearBox
|
|
|
|
|
|
|
|
PlaceMoveData:
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2018-08-06 08:20:05 -07:00
|
|
|
hlcoord 0, 10
|
|
|
|
ld de, String_MoveType_Top
|
|
|
|
call PlaceString
|
|
|
|
hlcoord 0, 11
|
|
|
|
ld de, String_MoveType_Bottom
|
|
|
|
call PlaceString
|
|
|
|
hlcoord 12, 12
|
|
|
|
ld de, String_MoveAtk
|
|
|
|
call PlaceString
|
|
|
|
ld a, [wCurSpecies]
|
|
|
|
ld b, a
|
|
|
|
hlcoord 2, 12
|
|
|
|
predef PrintMoveType
|
|
|
|
ld a, [wCurSpecies]
|
|
|
|
dec a
|
|
|
|
ld hl, Moves + MOVE_POWER
|
|
|
|
ld bc, MOVE_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, BANK(Moves)
|
|
|
|
call GetFarByte
|
|
|
|
hlcoord 16, 12
|
|
|
|
cp 2
|
|
|
|
jr c, .no_power
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wTextDecimalByte], a
|
|
|
|
ld de, wTextDecimalByte
|
2018-08-06 08:20:05 -07:00
|
|
|
lb bc, 1, 3
|
|
|
|
call PrintNum
|
|
|
|
jr .description
|
|
|
|
|
|
|
|
.no_power
|
|
|
|
ld de, String_MoveNoPower
|
|
|
|
call PlaceString
|
|
|
|
|
|
|
|
.description
|
|
|
|
hlcoord 1, 14
|
2020-05-25 00:54:42 -07:00
|
|
|
predef PrintMoveDescription
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
String_MoveType_Top:
|
|
|
|
db "┌─────┐@"
|
|
|
|
String_MoveType_Bottom:
|
|
|
|
db "│TYPE/└@"
|
|
|
|
String_MoveAtk:
|
|
|
|
db "ATK/@"
|
|
|
|
String_MoveNoPower:
|
|
|
|
db "---@"
|
|
|
|
|
2019-11-03 10:46:00 -08:00
|
|
|
PlaceMoveScreenArrows:
|
|
|
|
call PlaceMoveScreenLeftArrow
|
|
|
|
call PlaceMoveScreenRightArrow
|
2018-08-06 08:20:05 -07:00
|
|
|
ret
|
|
|
|
|
2019-11-03 10:46:00 -08:00
|
|
|
PlaceMoveScreenLeftArrow:
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [wCurPartyMon]
|
2015-12-13 14:11:58 -08:00
|
|
|
and a
|
2018-08-06 08:20:05 -07:00
|
|
|
ret z
|
|
|
|
ld c, a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, wPartyCount
|
|
|
|
add hl, de
|
|
|
|
.loop
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .prev
|
|
|
|
cp EGG
|
|
|
|
jr z, .prev
|
|
|
|
cp NUM_POKEMON + 1
|
|
|
|
jr c, .legal
|
|
|
|
|
|
|
|
.prev
|
|
|
|
dec hl
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
2015-12-13 14:11:58 -08:00
|
|
|
ret
|
|
|
|
|
2018-08-06 08:20:05 -07:00
|
|
|
.legal
|
|
|
|
hlcoord 16, 0
|
|
|
|
ld [hl], "◀"
|
|
|
|
ret
|
2015-12-13 14:11:58 -08:00
|
|
|
|
2019-11-03 10:46:00 -08:00
|
|
|
PlaceMoveScreenRightArrow:
|
2018-08-06 08:20:05 -07:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
inc a
|
|
|
|
ld c, a
|
|
|
|
ld a, [wPartyCount]
|
|
|
|
cp c
|
|
|
|
ret z
|
|
|
|
ld e, c
|
|
|
|
ld d, 0
|
|
|
|
ld hl, wPartySpecies
|
|
|
|
add hl, de
|
|
|
|
.loop
|
|
|
|
ld a, [hl]
|
|
|
|
cp -1
|
|
|
|
ret z
|
|
|
|
and a
|
|
|
|
jr z, .next
|
|
|
|
cp EGG
|
|
|
|
jr z, .next
|
|
|
|
cp NUM_POKEMON + 1
|
|
|
|
jr c, .legal
|
|
|
|
|
|
|
|
.next
|
|
|
|
inc hl
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.legal
|
|
|
|
hlcoord 18, 0
|
|
|
|
ld [hl], "▶"
|
|
|
|
ret
|