From 3c7c83f889f6625d22702b78d65ea7cd7b05b51d Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 22 Mar 2016 19:37:33 -0700 Subject: [PATCH 1/2] Fix move_relearner bug where it was trying to print item prices with the moves. --- scripts/move_relearner.asm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/move_relearner.asm b/scripts/move_relearner.asm index 86f77129e..6dd0b4b20 100755 --- a/scripts/move_relearner.asm +++ b/scripts/move_relearner.asm @@ -58,6 +58,8 @@ MoveRelearnerText1: ld [hl], e inc hl ld [hl], d + xor a + ld [wcf93], a ; don't print prices call DisplayListMenuID pop bc jr c, .exit ; exit if player chose cancel From 6b9446d79d93f589f042320fe384d81b8b8d595a Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 22 Mar 2016 19:39:26 -0700 Subject: [PATCH 2/2] Implement move deleter. --- scripts/move_deleter.asm | 169 +++++++++++++++++++++++++++++++++++++ text.asm | 1 + text/maps/move_deleter.asm | 49 +++++++++++ wram.asm | 6 +- 4 files changed, 223 insertions(+), 2 deletions(-) create mode 100755 scripts/move_deleter.asm create mode 100755 text/maps/move_deleter.asm diff --git a/scripts/move_deleter.asm b/scripts/move_deleter.asm new file mode 100755 index 000000000..16fcb77ab --- /dev/null +++ b/scripts/move_deleter.asm @@ -0,0 +1,169 @@ +MoveDeleterText1: + db 8 ; asm + ld hl, MoveDeleterGreetingText + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jp nz, .exit + ld hl, MoveDeleterSaidYesText + call PrintText + ; Select pokemon from party. + call SaveScreenTilesToBuffer2 + xor a + ld [wListScrollOffset], a + ld [wd07d], 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 + call PrepareDeletableMoveList + pop bc + ld a, [wDeletableMoves] + cp 2 + jr nc, .chooseMove + pop bc + ld hl, MoveDeleterOneMoveText + call PrintText + jp TextScriptEnd +.chooseMove + push bc + xor a + ld [wListScrollOffset], a + ld [wCurrentMenuItem], a + ld hl, MoveDeleterWhichMoveText + call PrintText + ld a, MOVESLISTMENU + ld [wListMenuID], a + ld de, wRelearnableMoves + ld hl, wList + ld [hl], e + inc hl + ld [hl], d + xor a + ld [wcf93], a ; don't print prices + call DisplayListMenuID + pop bc + jr c, .exit ; exit if player chose cancel + ; Save the selected move id. + ld a, [wcf91] + ld d, a + push de + push bc + ld [wMoveNum], a + ld [wd11e],a + call GetMoveName + call CopyStringToCF4B ; copy name to wcf4b + ld hl, MoveDeleterConfirmText + call PrintText + call YesNoChoice + pop bc + pop de + ld a, [wCurrentMenuItem] + and a + jr nz, .chooseMove + push de + ld a, b ; a = mon index + ld hl, wPartyMon1Moves + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ; hl = pointer to mon's moves + ; Search for the move, and set it to 0. + pop de ; d = move id + call DeleteMove + ld hl, MoveDeleterForgotText + call PrintText +.exit + ld hl, MoveDeleterByeText + call PrintText + jp TextScriptEnd + +DeleteMove: +; d = move id + ld b, 0 +.searchLoop + ld a, [hli] + cp d + jr z, .foundMoveLoop + inc b + jr .searchLoop +.foundMoveLoop + ld a, b + cp 3 + jr z, .zeroLastMove + ld a, [hl] + dec hl + ld [hli], a + inc hl + inc b + jr .foundMoveLoop +.zeroLastMove + dec hl + xor a + ld [hl], a + ret + +PrepareDeletableMoveList: +; Places a list of the selected pokemon's moves at wDeletableMoves. +; First byte is count, and last byte is $ff. +; Input: party mon index = [wWhichPokemon] + ld a, [wWhichPokemon] + ld hl, wPartyMon1Moves + ld bc, wPartyMon2 - wPartyMon1 + call AddNTimes + ; hl = pointer to mon's 4 moves + ld b, 0 ; count of moves + ld c, 4 + 1 ; 4 moves + ld de, wDeletableMoves + 1 +.loop + dec c + jr z, .done + ld a, [hli] + and a + jr z, .loop + ld [de], a + inc de + inc b + jr .loop +.done + ld a, $ff ; terminate the list + ld [de], a + ld a, b ; store number of moves + ld [wDeletableMoves], a + ret + +MoveDeleterGreetingText: + TX_FAR _MoveDeleterGreetingText + db "@" + +MoveDeleterSaidYesText: + TX_FAR _MoveDeleterSaidYesText + db "@" + +MoveDeleterWhichMoveText: + TX_FAR _MoveDeleterWhichMoveText + db "@" + +MoveDeleterConfirmText: + TX_FAR _MoveDeleterConfirmText + db "@" + +MoveDeleterForgotText: + TX_FAR _MoveDeleterForgotText + db "@" + +MoveDeleterByeText: + TX_FAR _MoveDeleterByeText + db "@" + +MoveDeleterOneMoveText: + TX_FAR _MoveDeleterOneMoveText + db "@" diff --git a/text.asm b/text.asm index ea32dfa81..4fa36b0e3 100755 --- a/text.asm +++ b/text.asm @@ -236,6 +236,7 @@ INCLUDE "text/maps/seafoam_islands_b2f.asm" INCLUDE "text/maps/seafoam_islands_b3f.asm" INCLUDE "text/maps/seafoam_islands_b4f.asm" INCLUDE "text/maps/move_relearner.asm" +INCLUDE "text/maps/move_deleter.asm" _AIBattleWithdrawText:: ; 880be (22:40be) TX_RAM W_TRAINERNAME diff --git a/text/maps/move_deleter.asm b/text/maps/move_deleter.asm new file mode 100755 index 000000000..1a89c4f37 --- /dev/null +++ b/text/maps/move_deleter.asm @@ -0,0 +1,49 @@ +_MoveDeleterGreetingText:: + text "Umm..." + + para "Oh, yes, I'm the" + line "MOVE DELETER." + + para "I can make" + line "#MON forget" + cont "moves." + + para "Shall I make a" + line "#MON forget?" + done + +_MoveDeleterSaidYesText:: + text "Which #MON" + line "should forget a" + cont "move?" + prompt + +_MoveDeleterWhichMoveText:: + text "Which move should" + line "it forget, then?" + done + +_MoveDeleterConfirmText:: + text "Make it forget" + line "@" + TX_RAM wcf4b + text "?" + prompt + +_MoveDeleterForgotText:: + text "@" + TX_RAM wcf4b + text " was" + line "forgotten!" + prompt + +_MoveDeleterByeText:: + text "Come visit me" + line "again!" + done + +_MoveDeleterOneMoveText:: + text "That #MON" + line "knows only one" + cont "move." + done diff --git a/wram.asm b/wram.asm index 5ce68ca48..270cfe6ce 100755 --- a/wram.asm +++ b/wram.asm @@ -377,8 +377,10 @@ wRelearnableMoves:: ; List of move ids that can be re-learend (Move Relearner) ; First byte is the number of moves in this list. ; List is terminated with $ff -wMoveRelearnerFlags:: -; Bit 0 is set if a move was replaced. Reset if player canceled. +wDeletableMoves:: +; List of move ids that can be deleted (Move Deleter) +; First byte is the number of moves in this list. +; List is terminated with $ff ds 10 wcca1:: ds 49