2018-06-24 14:09:41 +00:00
|
|
|
LearnMove:
|
2020-02-13 17:30:13 +00:00
|
|
|
call LoadTilemapToTempTilemap
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMonNicknames
|
2015-11-28 20:13:40 +00:00
|
|
|
call GetNick
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wStringBuffer1
|
2015-12-19 01:07:09 +00:00
|
|
|
ld de, wMonOrItemNameBuffer
|
2018-01-20 17:25:55 +00:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-11-28 20:13:40 +00:00
|
|
|
call CopyBytes
|
|
|
|
|
|
|
|
.loop
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1Moves
|
2015-11-28 20:13:40 +00:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2015-11-28 20:13:40 +00:00
|
|
|
call AddNTimes
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld b, NUM_MOVES
|
|
|
|
; Get the first empty move slot. This routine also serves to
|
|
|
|
; determine whether the Pokemon learning the moves already has
|
|
|
|
; all four slots occupied, in which case one would need to be
|
|
|
|
; deleted.
|
|
|
|
.next
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .learn
|
|
|
|
inc hl
|
|
|
|
dec b
|
|
|
|
jr nz, .next
|
|
|
|
; If we're here, we enter the routine for forgetting a move
|
|
|
|
; to make room for the new move we're trying to learn.
|
|
|
|
push de
|
|
|
|
call ForgetMove
|
|
|
|
pop de
|
|
|
|
jp c, .cancel
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
2018-07-28 23:27:34 +00:00
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2015-11-28 20:13:40 +00:00
|
|
|
|
|
|
|
ld b, a
|
|
|
|
ld a, [wBattleMode]
|
|
|
|
and a
|
|
|
|
jr z, .not_disabled
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wDisabledMove]
|
2015-11-28 20:13:40 +00:00
|
|
|
cp b
|
|
|
|
jr nz, .not_disabled
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wDisabledMove], a
|
|
|
|
ld [wPlayerDisableCount], a
|
2015-11-28 20:13:40 +00:00
|
|
|
.not_disabled
|
|
|
|
|
|
|
|
call GetMoveName
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, Text_1_2_and_Poof ; 1, 2 and…
|
2015-11-28 20:13:40 +00:00
|
|
|
call PrintText
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
.learn
|
2015-12-02 18:24:18 +00:00
|
|
|
ld a, [wPutativeTMHMMove]
|
2015-11-28 20:13:40 +00:00
|
|
|
ld [hl], a
|
|
|
|
ld bc, MON_PP - MON_MOVES
|
|
|
|
add hl, bc
|
|
|
|
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
dec a
|
|
|
|
ld hl, Moves + MOVE_PP
|
|
|
|
ld bc, MOVE_LENGTH
|
|
|
|
call AddNTimes
|
|
|
|
ld a, BANK(Moves)
|
|
|
|
call GetFarByte
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
ld a, [wBattleMode]
|
|
|
|
and a
|
|
|
|
jp z, .learned
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2015-11-28 20:13:40 +00:00
|
|
|
ld b, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurBattleMon]
|
2015-11-28 20:13:40 +00:00
|
|
|
cp b
|
|
|
|
jp nz, .learned
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerSubStatus5]
|
2015-11-28 20:13:40 +00:00
|
|
|
bit SUBSTATUS_TRANSFORMED, a
|
|
|
|
jp nz, .learned
|
|
|
|
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wBattleMonMoves
|
2015-11-28 20:13:40 +00:00
|
|
|
ld bc, NUM_MOVES
|
|
|
|
call CopyBytes
|
2018-01-23 22:39:09 +00:00
|
|
|
ld bc, wPartyMon1PP - (wPartyMon1Moves + NUM_MOVES)
|
2015-11-28 20:13:40 +00:00
|
|
|
add hl, bc
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wBattleMonPP
|
2015-11-28 20:13:40 +00:00
|
|
|
ld bc, NUM_MOVES
|
|
|
|
call CopyBytes
|
|
|
|
jp .learned
|
|
|
|
|
|
|
|
.cancel
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, StopLearningMoveText
|
2015-11-28 20:13:40 +00:00
|
|
|
call PrintText
|
|
|
|
call YesNoBox
|
|
|
|
jp c, .loop
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, DidNotLearnMoveText
|
2015-11-28 20:13:40 +00:00
|
|
|
call PrintText
|
|
|
|
ld b, 0
|
|
|
|
ret
|
|
|
|
|
|
|
|
.learned
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, LearnedMoveText
|
2015-11-28 20:13:40 +00:00
|
|
|
call PrintText
|
|
|
|
ld b, 1
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ForgetMove:
|
2015-11-28 20:13:40 +00:00
|
|
|
push hl
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, AskForgetMoveText
|
2015-11-28 20:13:40 +00:00
|
|
|
call PrintText
|
|
|
|
call YesNoBox
|
|
|
|
pop hl
|
|
|
|
ret c
|
|
|
|
ld bc, -NUM_MOVES
|
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
ld de, wListMoves_MoveIndicesBuffer
|
|
|
|
ld bc, NUM_MOVES
|
|
|
|
call CopyBytes
|
|
|
|
pop hl
|
|
|
|
.loop
|
|
|
|
push hl
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, MoveAskForgetText
|
2015-11-28 20:13:40 +00:00
|
|
|
call PrintText
|
|
|
|
hlcoord 5, 2
|
|
|
|
ld b, NUM_MOVES * 2
|
|
|
|
ld c, MOVE_NAME_LENGTH
|
2019-04-08 12:15:10 +00:00
|
|
|
call Textbox
|
2015-11-28 20:13:40 +00:00
|
|
|
hlcoord 5 + 2, 2 + 2
|
|
|
|
ld a, SCREEN_WIDTH * 2
|
2020-11-04 00:53:07 +00:00
|
|
|
ld [wListMovesLineSpacing], a
|
2018-01-16 19:30:10 +00:00
|
|
|
predef ListMoves
|
2018-01-23 21:38:52 +00:00
|
|
|
; w2DMenuData
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, $4
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [w2DMenuCursorInitY], a
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, $6
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [w2DMenuCursorInitX], a
|
2015-12-04 13:46:11 +00:00
|
|
|
ld a, [wNumMoves]
|
2015-11-28 20:13:40 +00:00
|
|
|
inc a
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [w2DMenuNumRows], a
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, $1
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [w2DMenuNumCols], a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld [wMenuCursorY], a
|
|
|
|
ld [wMenuCursorX], a
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, $3
|
2015-12-20 17:54:08 +00:00
|
|
|
ld [wMenuJoypadFilter], a
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, $20
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [w2DMenuFlags1], a
|
2015-11-28 20:13:40 +00:00
|
|
|
xor a
|
2015-12-19 19:48:30 +00:00
|
|
|
ld [w2DMenuFlags2], a
|
2015-11-28 20:13:40 +00:00
|
|
|
ld a, $20
|
2015-12-21 19:10:16 +00:00
|
|
|
ld [w2DMenuCursorOffsets], a
|
2015-12-15 23:59:49 +00:00
|
|
|
call StaticMenuJoypad
|
2015-11-28 20:13:40 +00:00
|
|
|
push af
|
2020-02-13 17:30:13 +00:00
|
|
|
call SafeLoadTempTilemapToTilemap
|
2015-11-28 20:13:40 +00:00
|
|
|
pop af
|
|
|
|
pop hl
|
|
|
|
bit 1, a
|
|
|
|
jr nz, .cancel
|
|
|
|
push hl
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-28 20:13:40 +00:00
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
push bc
|
|
|
|
call IsHMMove
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ld a, d
|
|
|
|
jr c, .hmmove
|
|
|
|
pop hl
|
|
|
|
add hl, bc
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.hmmove
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, MoveCantForgetHMText
|
2015-11-28 20:13:40 +00:00
|
|
|
call PrintText
|
|
|
|
pop hl
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.cancel
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
LearnedMoveText:
|
|
|
|
text_far _LearnedMoveText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-28 20:13:40 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
MoveAskForgetText:
|
|
|
|
text_far _MoveAskForgetText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-28 20:13:40 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
StopLearningMoveText:
|
|
|
|
text_far _StopLearningMoveText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-28 20:13:40 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
DidNotLearnMoveText:
|
|
|
|
text_far _DidNotLearnMoveText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-28 20:13:40 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
AskForgetMoveText:
|
|
|
|
text_far _AskForgetMoveText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-28 20:13:40 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Text_1_2_and_Poof:
|
2019-10-20 22:24:17 +00:00
|
|
|
text_far Text_MoveForgetCount ; 1, 2 and…
|
2018-11-17 18:33:03 +00:00
|
|
|
text_asm
|
2015-11-28 20:13:40 +00:00
|
|
|
push de
|
|
|
|
ld de, SFX_SWITCH_POKEMON
|
|
|
|
call PlaySFX
|
|
|
|
pop de
|
2019-10-20 22:24:17 +00:00
|
|
|
ld hl, .MoveForgotText
|
2015-11-28 20:13:40 +00:00
|
|
|
ret
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
.MoveForgotText:
|
|
|
|
text_far _MoveForgotText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-28 20:13:40 +00:00
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
MoveCantForgetHMText:
|
|
|
|
text_far _MoveCantForgetHMText
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|