Groundwork for Tradeback Move Tutor

Currently the move tutor is a little bit broken - the IDs are 1 above how they should be. Shell speculates that it's searching at the table starting from Kangaskhan due to the way the decrements shake up but it may just be making things more complicated than they are.

Big cheese code is `PrepareTradebackMoveList`, it's where things are mucking up.

Also, the code can be significantly optimised, as it's currently being adapted from the function above, `PrepareRelearnableMoveList`; It doesn't need to check levels, for example.

Note that the relearner functions properly, so use it as a reference. I may have removed something important.

Technically, we could have NO_MON as an entry which may make things shake out properly. But I'd rather have a proper fix.
This commit is contained in:
Llinos Evans 2023-04-23 06:11:05 +01:00
parent 5e21c159f9
commit 2f01628cd9
24 changed files with 1657 additions and 97 deletions

View file

@ -0,0 +1,15 @@
CitrineTradebackHouse_Script:
jp EnableAutoTextBoxDrawing
CitrineTradebackHouse_TextPointers:
dw TradebackTutorText1
dw CitrineTradebackHouseGuy
dw CitrineTradebackHouseBooklet
CitrineTradebackHouseBooklet:
text_far _CitrineTradebackHouseBooklet
text_end
CitrineTradebackHouseGuy:
text_far _CitrineTradebackHouseGuy
text_end

View file

@ -1,57 +0,0 @@
VermilionOldRodHouse_Script:
jp EnableAutoTextBoxDrawing
VermilionOldRodHouse_TextPointers:
dw VermilionHouse2Text1
VermilionHouse2Text1:
text_asm
ld a, [wd728]
bit 3, a ; got old rod?
jr nz, .got_item
ld hl, VermilionHouse2Text_560b1
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jr nz, .refused
lb bc, CANDY_JAR, 1 ; used to be the old rod, but since I've replaced it, for now he'll give you this. I believe this house is currently unused, so no issues..? ~ PvK
call GiveItem
jr nc, .bag_full
ld hl, wd728
set 3, [hl] ; got old rod
ld hl, VermilionHouse2Text_560b6
jr .done
.bag_full
ld hl, VermilionHouse2Text_560ca
jr .done
.refused
ld hl, VermilionHouse2Text_560c0
jr .done
.got_item
ld hl, VermilionHouse2Text_560c5
.done
call PrintText
jp TextScriptEnd
VermilionHouse2Text_560b1:
text_far _VermilionHouse2Text_560b1
text_end
VermilionHouse2Text_560b6:
text_far _VermilionHouse2Text_560b6
sound_get_item_1
text_far _VermilionHouse2Text_560bb
text_end
VermilionHouse2Text_560c0:
text_far _VermilionHouse2Text_560c0
text_end
VermilionHouse2Text_560c5:
text_far _VermilionHouse2Text_560c5
text_end
VermilionHouse2Text_560ca:
text_far _VermilionHouse2Text_560ca
text_end

View file

@ -0,0 +1,131 @@
TradebackTutorText1:
text_asm
; Display the list of moves to the player.
ld hl, TradebackTutorGreetingText
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jp nz, .exit
xor a
;charge 1000 money
ld [hMoney], a
ld [hMoney + 2], a
ld a, $0A
ld [hMoney + 1], a
call HasEnoughMoney
jr nc, .enoughMoney
; not enough money
ld hl, TradebackTutorNotEnoughMoneyText
call PrintText
jp TextScriptEnd
.enoughMoney
ld hl, TradebackTutorSaidYesText
call PrintText
; Select pokemon from party.
call SaveScreenTilesToBuffer2
xor a
ld [wListScrollOffset], a
ld [wPartyMenuTypeOrMessageID], a
ld [wUpdateSpritesEnabled], a
ld [wMenuItemToSwap], a
call DisplayPartyMenu
push af
call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns
call LoadGBPal
pop af
jp c, .exit
ld a, [wWhichPokemon]
ld b, a
push bc
ld hl, PrepareTradebackMoveList
ld b, Bank(PrepareTradebackMoveList)
call Bankswitch
ld a, [wMoveBuffer]
and a
jr nz, .chooseMove
pop bc
ld hl, TradebackTutorNoMovesText
call PrintText
jp TextScriptEnd
.chooseMove
ld hl, TradebackTutorWhichMoveText
call PrintText
xor a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld a, MOVESLISTMENU
ld [wListMenuID], a
ld de, wMoveBuffer
ld hl, wListPointer
ld [hl], e
inc hl
ld [hl], d
xor a
ld [wPrintItemPrices], a ; don't print prices
call DisplayListMenuID
pop bc
jr c, .exit ; exit if player chose cancel
push bc
; Save the selected move id.
ld a, [wcf91]
ld [wMoveNum], a
ld [wd11e],a
call GetMoveName
call CopyToStringBuffer ; copy name to wcf4b
pop bc
ld a, b
ld [wWhichPokemon], a
ld a, [wLetterPrintingDelayFlags]
push af
xor a
ld [wLetterPrintingDelayFlags], a
predef LearnMove
pop af
ld [wLetterPrintingDelayFlags], a
ld a, b
and a
jr z, .exit
; Charge 1000 money
xor a
ld [wPriceTemp], a
ld [wPriceTemp + 2], a
ld a, $0A
ld [wPriceTemp + 1], a
ld hl, wPriceTemp + 2
ld de, wPlayerMoney + 2
ld c, $3
predef SubBCDPredef
ld hl, TradebackTutorByeText
call PrintText
jp TextScriptEnd
.exit
ld hl, TradebackTutorByeText
call PrintText
jp TextScriptEnd
TradebackTutorGreetingText:
text_far _TradebackTutorGreetingText
text_end
TradebackTutorSaidYesText:
text_far _TradebackTutorSaidYesText
text_end
TradebackTutorNotEnoughMoneyText:
text_far _TradebackTutorNotEnoughMoneyText
text_end
TradebackTutorWhichMoveText:
text_far _TradebackTutorWhichMoveText
text_end
TradebackTutorByeText:
text_far _TradebackTutorByeText
text_end
TradebackTutorNoMovesText:
text_far _TradebackTutorNoMovesText
text_end