-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from huderlem/master
Move Deleter (and small bugfix for move relearner)
- Loading branch information
Showing
5 changed files
with
225 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters