pokered/engine/learn_move.asm

225 lines
3.4 KiB
NASM
Raw Normal View History

2014-05-22 22:13:20 +00:00
LearnMove: ; 6e43 (1:6e43)
call SaveScreenTilesToBuffer1
2015-02-07 20:27:36 +00:00
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
2014-05-22 22:13:20 +00:00
call GetPartyMonName
ld hl, wcd6d
ld de, wd036
2014-05-22 22:13:20 +00:00
ld bc, $b
call CopyData
DontAbandonLearning: ; 6e5b (1:6e5b)
2015-02-07 20:27:36 +00:00
ld hl, wPartyMon1Moves
2014-05-22 22:13:20 +00:00
ld bc, $2c
2015-02-07 20:27:36 +00:00
ld a, [wWhichPokemon]
2014-05-22 22:13:20 +00:00
call AddNTimes
ld d, h
ld e, l
ld b, $4
.asm_6e6b
ld a, [hl]
and a
jr z, .asm_6e8b
inc hl
dec b
jr nz, .asm_6e6b
push de
call TryingToLearn
pop de
jp c, AbandonLearning
push hl
push de
ld [wd11e], a
2014-05-22 22:13:20 +00:00
call GetMoveName
ld hl, OneTwoAndText
call PrintText
pop de
pop hl
.asm_6e8b
2015-02-08 08:17:03 +00:00
ld a, [wMoveNum]
2014-05-22 22:13:20 +00:00
ld [hl], a
ld bc, $15
add hl, bc
push hl
push de
dec a
2015-02-07 20:27:36 +00:00
ld hl, Moves
2014-05-22 22:13:20 +00:00
ld bc, $6
call AddNTimes
ld de, wHPBarMaxHP
2014-05-22 22:13:20 +00:00
ld a, BANK(Moves)
call FarCopyData
ld a, [wHPBarNewHP + 1]
2014-05-22 22:13:20 +00:00
pop de
pop hl
ld [hl], a
2015-02-07 20:27:36 +00:00
ld a, [W_ISINBATTLE]
2014-05-22 22:13:20 +00:00
and a
jp z, PrintLearnedMove
2015-02-07 20:27:36 +00:00
ld a, [wWhichPokemon]
2014-05-22 22:13:20 +00:00
ld b, a
2015-02-07 20:27:36 +00:00
ld a, [wPlayerMonNumber]
2014-05-22 22:13:20 +00:00
cp b
jp nz, PrintLearnedMove
ld h, d
ld l, e
ld de, wBattleMonMoves
2015-02-08 08:17:03 +00:00
ld bc, NUM_MOVES
2014-05-22 22:13:20 +00:00
call CopyData
ld bc, $11
add hl, bc
2015-02-07 20:27:36 +00:00
ld de, wBattleMonPP
2014-05-22 22:13:20 +00:00
ld bc, $4
call CopyData
jp PrintLearnedMove
AbandonLearning: ; 6eda (1:6eda)
ld hl, AbandonLearningText
call PrintText
hlCoord 14, 7
2014-05-22 22:13:20 +00:00
ld bc, $80f
2015-02-07 20:27:36 +00:00
ld a, TWO_OPTION_MENU
2015-02-07 10:43:08 +00:00
ld [wTextBoxID], a
2015-02-07 20:27:36 +00:00
call DisplayTextBoxID ; yes/no menu
ld a, [wCurrentMenuItem]
2014-05-22 22:13:20 +00:00
and a
jp nz, DontAbandonLearning
ld hl, DidNotLearnText
call PrintText
ld b, $0
ret
PrintLearnedMove: ; 6efe (1:6efe)
ld hl, LearnedMove1Text
call PrintText
ld b, $1
ret
TryingToLearn: ; 6f07 (1:6f07)
push hl
ld hl, TryingToLearnText
call PrintText
hlCoord 14, 7
2014-05-22 22:13:20 +00:00
ld bc, $80f
2015-02-07 20:27:36 +00:00
ld a, TWO_OPTION_MENU
2015-02-07 10:43:08 +00:00
ld [wTextBoxID], a
2015-02-07 20:27:36 +00:00
call DisplayTextBoxID ; yes/no menu
2014-05-22 22:13:20 +00:00
pop hl
2015-02-07 20:27:36 +00:00
ld a, [wCurrentMenuItem]
2014-05-22 22:13:20 +00:00
rra
ret c
ld bc, $fffc
add hl, bc
push hl
2015-02-08 08:17:03 +00:00
ld de, wMoves
ld bc, NUM_MOVES
2014-05-22 22:13:20 +00:00
call CopyData
2015-02-08 08:17:03 +00:00
callab FormatMovesString
2014-05-22 22:13:20 +00:00
pop hl
.asm_6f39
push hl
ld hl, WhichMoveToForgetText
call PrintText
hlCoord 4, 7
2014-05-22 22:13:20 +00:00
ld b, $4
ld c, $e
call TextBoxBorder
hlCoord 6, 8
2015-02-08 08:17:03 +00:00
ld de, wMovesString
2015-02-08 00:24:16 +00:00
ld a, [hFlags_0xFFF6]
2014-05-22 22:13:20 +00:00
set 2, a
2015-02-08 00:24:16 +00:00
ld [hFlags_0xFFF6], a
2014-05-22 22:13:20 +00:00
call PlaceString
2015-02-08 00:24:16 +00:00
ld a, [hFlags_0xFFF6]
2014-05-22 22:13:20 +00:00
res 2, a
2015-02-08 00:24:16 +00:00
ld [hFlags_0xFFF6], a
2015-02-07 20:27:36 +00:00
ld hl, wTopMenuItemY
2014-05-22 22:13:20 +00:00
ld a, $8
ld [hli], a
ld a, $5
ld [hli], a
xor a
ld [hli], a
inc hl
ld a, [wcd6c]
2014-05-22 22:13:20 +00:00
ld [hli], a
ld a, $3
ld [hli], a
ld [hl], $0
2015-02-08 00:24:16 +00:00
ld hl, hFlags_0xFFF6
2014-05-22 22:13:20 +00:00
set 1, [hl]
call HandleMenuInput
2015-02-08 00:24:16 +00:00
ld hl, hFlags_0xFFF6
2014-05-22 22:13:20 +00:00
res 1, [hl]
push af
call LoadScreenTilesFromBuffer1
pop af
pop hl
bit 1, a
jr nz, .asm_6fab
push hl
2015-02-07 20:27:36 +00:00
ld a, [wCurrentMenuItem]
2014-05-22 22:13:20 +00:00
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
push af
push bc
call IsMoveHM
pop bc
pop de
ld a, d
jr c, .asm_6fa2
pop hl
add hl, bc
and a
ret
.asm_6fa2
ld hl, HMCantDeleteText
call PrintText
pop hl
jr .asm_6f39
.asm_6fab
scf
ret
LearnedMove1Text: ; 6fb4 (1:6fb4)
TX_FAR _LearnedMove1Text
db $b,6,"@"
WhichMoveToForgetText: ; 6fb4 (1:6fb4)
TX_FAR _WhichMoveToForgetText
db "@"
AbandonLearningText: ; 6fb9 (1:6fb9)
TX_FAR _AbandonLearningText
db "@"
DidNotLearnText: ; 6fbe (1:6fbe)
TX_FAR _DidNotLearnText
db "@"
TryingToLearnText: ; 6fc3 (1:6fc3)
TX_FAR _TryingToLearnText
db "@"
OneTwoAndText: ; 6fc8 (1:6fc8)
TX_FAR _OneTwoAndText
db $a
2015-07-03 19:58:50 +00:00
TX_ASM
2014-05-22 22:13:20 +00:00
ld a, (SFX_02_58 - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent
ld hl, PoofText
ret
PoofText: ; 6fd7 (1:6fd7)
TX_FAR _PoofText
db $a
ForgotAndText: ; 6fdc (1:6fdc)
TX_FAR _ForgotAndText
db "@"
HMCantDeleteText: ; 6fe1 (1:6fe1)
TX_FAR _HMCantDeleteText
db "@"