2018-06-24 07:09:41 -07:00
|
|
|
|
TMHMPocket:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
|
ldh [hInMenu], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call TMHM_PocketLoop
|
|
|
|
|
ld a, $0
|
2018-08-25 11:28:22 -07:00
|
|
|
|
ldh [hInMenu], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ret nc
|
|
|
|
|
call PlaceHollowCursor
|
|
|
|
|
call WaitBGMap
|
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
dec a
|
|
|
|
|
ld [wCurItemQuantity], a
|
|
|
|
|
ld hl, wTMsHMs
|
|
|
|
|
ld c, a
|
|
|
|
|
ld b, 0
|
|
|
|
|
add hl, bc
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
ld [wItemQuantityBuffer], a
|
|
|
|
|
call .ConvertItemToTMHMNumber
|
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
.ConvertItemToTMHMNumber:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
ld c, a
|
|
|
|
|
callfar GetNumberedTMHM
|
|
|
|
|
ld a, c
|
|
|
|
|
ld [wCurItem], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
ConvertCurItemIntoCurTMHM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
ld c, a
|
|
|
|
|
callfar GetTMHMNumber
|
|
|
|
|
ld a, c
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld [wTempTMHM], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
GetTMHMItemMove:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call ConvertCurItemIntoCurTMHM
|
|
|
|
|
predef GetTMHMMove
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
AskTeachTMHM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld hl, wOptions
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
push af
|
|
|
|
|
res NO_TEXT_SCROLL, [hl]
|
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
cp TM01
|
|
|
|
|
jr c, .NotTMHM
|
|
|
|
|
call GetTMHMItemMove
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld a, [wTempTMHM]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld [wPutativeTMHMMove], a
|
|
|
|
|
call GetMoveName
|
|
|
|
|
call CopyName1
|
2019-10-20 15:24:17 -07:00
|
|
|
|
ld hl, BootedTMText ; Booted up a TM
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
cp HM01
|
|
|
|
|
jr c, .TM
|
2019-10-20 15:24:17 -07:00
|
|
|
|
ld hl, BootedHMText ; Booted up an HM
|
2018-03-25 07:18:33 -07:00
|
|
|
|
.TM:
|
|
|
|
|
call PrintText
|
2019-10-20 15:24:17 -07:00
|
|
|
|
ld hl, ContainedMoveText
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call PrintText
|
|
|
|
|
call YesNoBox
|
|
|
|
|
.NotTMHM:
|
|
|
|
|
pop bc
|
|
|
|
|
ld a, b
|
|
|
|
|
ld [wOptions], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
ChooseMonToLearnTMHM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld hl, wStringBuffer2
|
|
|
|
|
ld de, wTMHMMoveNameBackup
|
|
|
|
|
ld bc, 12
|
|
|
|
|
call CopyBytes
|
|
|
|
|
call ClearBGPalettes
|
2018-06-24 07:09:41 -07:00
|
|
|
|
ChooseMonToLearnTMHM_NoRefresh:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
farcall LoadPartyMenuGFX
|
|
|
|
|
farcall InitPartyMenuWithCancel
|
|
|
|
|
farcall InitPartyMenuGFX
|
|
|
|
|
ld a, PARTYMENUACTION_TEACH_TMHM
|
|
|
|
|
ld [wPartyMenuActionText], a
|
|
|
|
|
.loopback
|
|
|
|
|
farcall WritePartyMenuTilemap
|
|
|
|
|
farcall PrintPartyMenuText
|
|
|
|
|
call WaitBGMap
|
|
|
|
|
call SetPalettes
|
|
|
|
|
call DelayFrame
|
|
|
|
|
farcall PartyMenuSelect
|
|
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
|
ld a, [wCurPartySpecies]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
cp EGG
|
|
|
|
|
pop bc ; now contains the former contents of af
|
|
|
|
|
jr z, .egg
|
|
|
|
|
push bc
|
|
|
|
|
ld hl, wTMHMMoveNameBackup
|
|
|
|
|
ld de, wStringBuffer2
|
|
|
|
|
ld bc, 12
|
|
|
|
|
call CopyBytes
|
|
|
|
|
pop af ; now contains the original contents of af
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.egg
|
2015-11-11 13:11:08 -08:00
|
|
|
|
push hl
|
2018-03-25 07:18:33 -07:00
|
|
|
|
push de
|
|
|
|
|
push bc
|
|
|
|
|
push af
|
|
|
|
|
ld de, SFX_WRONG
|
|
|
|
|
call PlaySFX
|
|
|
|
|
call WaitSFX
|
|
|
|
|
pop af
|
|
|
|
|
pop bc
|
|
|
|
|
pop de
|
|
|
|
|
pop hl
|
|
|
|
|
jr .loopback
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TeachTMHM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
predef CanLearnTMHMMove
|
|
|
|
|
|
|
|
|
|
push bc
|
|
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
|
ld hl, wPartyMonNicknames
|
|
|
|
|
call GetNick
|
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
|
and a
|
|
|
|
|
jr nz, .compatible
|
|
|
|
|
push de
|
|
|
|
|
ld de, SFX_WRONG
|
|
|
|
|
call PlaySFX
|
|
|
|
|
pop de
|
2019-10-20 15:24:17 -07:00
|
|
|
|
ld hl, TMHMNotCompatibleText
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call PrintText
|
|
|
|
|
jr .nope
|
|
|
|
|
|
|
|
|
|
.compatible
|
|
|
|
|
callfar KnowsMove
|
|
|
|
|
jr c, .nope
|
|
|
|
|
|
|
|
|
|
predef LearnMove
|
|
|
|
|
ld a, b
|
|
|
|
|
and a
|
|
|
|
|
jr z, .nope
|
|
|
|
|
|
|
|
|
|
farcall StubbedTrainerRankings_TMsHMsTaught
|
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
call IsHM
|
|
|
|
|
ret c
|
|
|
|
|
|
|
|
|
|
ld c, HAPPINESS_LEARNMOVE
|
|
|
|
|
callfar ChangeHappiness
|
|
|
|
|
call ConsumeTM
|
|
|
|
|
jr .learned_move
|
|
|
|
|
|
|
|
|
|
.nope
|
|
|
|
|
and a
|
|
|
|
|
ret
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
2018-03-25 07:18:33 -07:00
|
|
|
|
.unused
|
|
|
|
|
ld a, 2
|
|
|
|
|
ld [wItemEffectSucceeded], a
|
|
|
|
|
.learned_move
|
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
|
BootedTMText:
|
|
|
|
|
text_far _BootedTMText
|
2018-11-17 10:33:03 -08:00
|
|
|
|
text_end
|
2018-03-25 07:18:33 -07:00
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
|
BootedHMText:
|
|
|
|
|
text_far _BootedHMText
|
2018-11-17 10:33:03 -08:00
|
|
|
|
text_end
|
2018-03-25 07:18:33 -07:00
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
|
ContainedMoveText:
|
|
|
|
|
text_far _ContainedMoveText
|
2018-11-17 10:33:03 -08:00
|
|
|
|
text_end
|
2018-03-25 07:18:33 -07:00
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
|
TMHMNotCompatibleText:
|
|
|
|
|
text_far _TMHMNotCompatibleText
|
2018-11-17 10:33:03 -08:00
|
|
|
|
text_end
|
2018-03-25 07:18:33 -07:00
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_PocketLoop:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
|
ldh [hBGMapMode], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call TMHM_DisplayPocketItems
|
|
|
|
|
ld a, 2
|
|
|
|
|
ld [w2DMenuCursorInitY], a
|
|
|
|
|
ld a, 7
|
|
|
|
|
ld [w2DMenuCursorInitX], a
|
|
|
|
|
ld a, 1
|
|
|
|
|
ld [w2DMenuNumCols], a
|
|
|
|
|
ld a, 5
|
|
|
|
|
sub d
|
|
|
|
|
inc a
|
|
|
|
|
cp 6
|
|
|
|
|
jr nz, .okay
|
|
|
|
|
dec a
|
|
|
|
|
.okay
|
|
|
|
|
ld [w2DMenuNumRows], a
|
|
|
|
|
ld a, $c
|
|
|
|
|
ld [w2DMenuFlags1], a
|
|
|
|
|
xor a
|
|
|
|
|
ld [w2DMenuFlags2], a
|
|
|
|
|
ld a, $20
|
|
|
|
|
ld [w2DMenuCursorOffsets], a
|
|
|
|
|
ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN | D_LEFT | D_RIGHT
|
|
|
|
|
ld [wMenuJoypadFilter], a
|
|
|
|
|
ld a, [wTMHMPocketCursor]
|
|
|
|
|
inc a
|
|
|
|
|
ld [wMenuCursorY], a
|
|
|
|
|
ld a, $1
|
|
|
|
|
ld [wMenuCursorX], a
|
|
|
|
|
jr TMHM_ShowTMMoveDescription
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_JoypadLoop:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call TMHM_DisplayPocketItems
|
|
|
|
|
call StaticMenuJoypad
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
|
dec a
|
|
|
|
|
ld [wTMHMPocketCursor], a
|
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
|
ldh [hBGMapMode], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, [w2DMenuFlags2]
|
|
|
|
|
bit 7, a
|
|
|
|
|
jp nz, TMHM_ScrollPocket
|
|
|
|
|
ld a, b
|
|
|
|
|
ld [wMenuJoypad], a
|
|
|
|
|
bit A_BUTTON_F, a
|
|
|
|
|
jp nz, TMHM_ChooseTMorHM
|
|
|
|
|
bit B_BUTTON_F, a
|
|
|
|
|
jp nz, TMHM_ExitPack
|
|
|
|
|
bit D_RIGHT_F, a
|
|
|
|
|
jp nz, TMHM_ExitPocket
|
|
|
|
|
bit D_LEFT_F, a
|
|
|
|
|
jp nz, TMHM_ExitPocket
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_ShowTMMoveDescription:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call TMHM_CheckHoveringOverCancel
|
|
|
|
|
jp nc, TMHM_ExitPocket
|
|
|
|
|
hlcoord 0, 12
|
|
|
|
|
ld b, 4
|
|
|
|
|
ld c, SCREEN_WIDTH - 2
|
2019-04-08 05:15:10 -07:00
|
|
|
|
call Textbox
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
cp NUM_TMS + NUM_HMS + 1
|
|
|
|
|
jr nc, TMHM_JoypadLoop
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld [wTempTMHM], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
predef GetTMHMMove
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld a, [wTempTMHM]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld [wCurSpecies], a
|
|
|
|
|
hlcoord 1, 14
|
2020-05-25 00:54:42 -07:00
|
|
|
|
call PrintMoveDescription
|
2018-03-25 07:18:33 -07:00
|
|
|
|
jp TMHM_JoypadLoop
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_ChooseTMorHM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call TMHM_PlaySFX_ReadText2
|
2018-07-28 16:27:34 -07:00
|
|
|
|
call CountTMsHMs ; This stores the count to wTempTMHM.
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, [wMenuCursorY]
|
|
|
|
|
dec a
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [wTMHMPocketScrollPosition]
|
|
|
|
|
add b
|
|
|
|
|
ld b, a
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld a, [wTempTMHM]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
cp b
|
|
|
|
|
jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_CheckHoveringOverCancel:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call TMHM_GetCurrentPocketPosition
|
|
|
|
|
ld a, [wMenuCursorY]
|
2015-11-11 13:11:08 -08:00
|
|
|
|
ld b, a
|
|
|
|
|
.loop
|
2018-03-25 07:18:33 -07:00
|
|
|
|
inc c
|
|
|
|
|
ld a, c
|
|
|
|
|
cp NUM_TMS + NUM_HMS + 1
|
|
|
|
|
jr nc, .okay
|
2015-11-11 13:11:08 -08:00
|
|
|
|
ld a, [hli]
|
|
|
|
|
and a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
jr z, .loop
|
|
|
|
|
dec b
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
ld a, c
|
|
|
|
|
.okay
|
|
|
|
|
ld [wCurItem], a
|
|
|
|
|
cp -1
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_ExitPack:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call TMHM_PlaySFX_ReadText2
|
2018-06-24 07:09:41 -07:00
|
|
|
|
_TMHM_ExitPack:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, $2
|
|
|
|
|
ld [wMenuJoypad], a
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_ExitPocket:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_ScrollPocket:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, b
|
|
|
|
|
bit 7, a
|
|
|
|
|
jr nz, .skip
|
|
|
|
|
ld hl, wTMHMPocketScrollPosition
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
and a
|
|
|
|
|
jp z, TMHM_JoypadLoop
|
|
|
|
|
dec [hl]
|
|
|
|
|
call TMHM_DisplayPocketItems
|
|
|
|
|
jp TMHM_ShowTMMoveDescription
|
|
|
|
|
|
|
|
|
|
.skip
|
|
|
|
|
call TMHM_GetCurrentPocketPosition
|
|
|
|
|
ld b, 5
|
|
|
|
|
.loop
|
|
|
|
|
inc c
|
|
|
|
|
ld a, c
|
|
|
|
|
cp NUM_TMS + NUM_HMS + 1
|
|
|
|
|
jp nc, TMHM_JoypadLoop
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
and a
|
|
|
|
|
jr z, .loop
|
|
|
|
|
dec b
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
ld hl, wTMHMPocketScrollPosition
|
|
|
|
|
inc [hl]
|
|
|
|
|
call TMHM_DisplayPocketItems
|
|
|
|
|
jp TMHM_ShowTMMoveDescription
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_DisplayPocketItems:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, [wBattleType]
|
|
|
|
|
cp BATTLETYPE_TUTORIAL
|
|
|
|
|
jp z, Tutorial_TMHMPocket
|
|
|
|
|
|
|
|
|
|
hlcoord 5, 2
|
|
|
|
|
lb bc, 10, 15
|
|
|
|
|
ld a, " "
|
|
|
|
|
call ClearBox
|
|
|
|
|
call TMHM_GetCurrentPocketPosition
|
|
|
|
|
ld d, $5
|
|
|
|
|
.loop2
|
2015-11-11 13:11:08 -08:00
|
|
|
|
inc c
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld a, c
|
|
|
|
|
cp NUM_TMS + NUM_HMS + 1
|
|
|
|
|
jr nc, .NotTMHM
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
and a
|
|
|
|
|
jr z, .loop2
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, c
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld [wTempTMHM], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
push hl
|
|
|
|
|
push de
|
|
|
|
|
push bc
|
|
|
|
|
call TMHMPocket_GetCurrentLineCoord
|
|
|
|
|
push hl
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld a, [wTempTMHM]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
cp NUM_TMS + 1
|
|
|
|
|
jr nc, .HM
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld de, wTempTMHM
|
2018-03-25 07:18:33 -07:00
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
|
call PrintNum
|
|
|
|
|
jr .okay
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
2018-03-25 07:18:33 -07:00
|
|
|
|
.HM:
|
|
|
|
|
push af
|
|
|
|
|
sub NUM_TMS
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld [wTempTMHM], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld [hl], "H"
|
|
|
|
|
inc hl
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld de, wTempTMHM
|
2019-11-03 17:17:04 -08:00
|
|
|
|
lb bc, PRINTNUM_LEFTALIGN | 1, 2
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call PrintNum
|
|
|
|
|
pop af
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld [wTempTMHM], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
.okay
|
|
|
|
|
predef GetTMHMMove
|
2018-07-29 13:00:11 -07:00
|
|
|
|
ld a, [wNamedObjectIndexBuffer]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld [wPutativeTMHMMove], a
|
|
|
|
|
call GetMoveName
|
|
|
|
|
pop hl
|
|
|
|
|
ld bc, 3
|
|
|
|
|
add hl, bc
|
|
|
|
|
push hl
|
|
|
|
|
call PlaceString
|
|
|
|
|
pop hl
|
|
|
|
|
pop bc
|
|
|
|
|
ld a, c
|
|
|
|
|
push bc
|
|
|
|
|
cp NUM_TMS + 1
|
|
|
|
|
jr nc, .hm2
|
|
|
|
|
ld bc, SCREEN_WIDTH + 9
|
|
|
|
|
add hl, bc
|
|
|
|
|
ld [hl], "×"
|
|
|
|
|
inc hl
|
|
|
|
|
ld a, "0" ; why are we doing this?
|
|
|
|
|
pop bc
|
|
|
|
|
push bc
|
|
|
|
|
ld a, b
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld [wTempTMHM], a
|
|
|
|
|
ld de, wTempTMHM
|
2018-03-25 07:18:33 -07:00
|
|
|
|
lb bc, 1, 2
|
|
|
|
|
call PrintNum
|
|
|
|
|
.hm2
|
|
|
|
|
pop bc
|
|
|
|
|
pop de
|
2015-11-11 13:11:08 -08:00
|
|
|
|
pop hl
|
2018-03-25 07:18:33 -07:00
|
|
|
|
dec d
|
|
|
|
|
jr nz, .loop2
|
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
|
|
.NotTMHM:
|
|
|
|
|
call TMHMPocket_GetCurrentLineCoord
|
|
|
|
|
inc hl
|
|
|
|
|
inc hl
|
|
|
|
|
inc hl
|
2015-11-11 13:11:08 -08:00
|
|
|
|
push de
|
2020-05-29 04:16:49 -07:00
|
|
|
|
ld de, TMHM_CancelString
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call PlaceString
|
2015-11-11 13:11:08 -08:00
|
|
|
|
pop de
|
2018-03-25 07:18:33 -07:00
|
|
|
|
.done
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHMPocket_GetCurrentLineCoord:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
hlcoord 5, 0
|
|
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
|
|
|
|
ld a, 6
|
|
|
|
|
sub d
|
|
|
|
|
ld e, a
|
|
|
|
|
; AddNTimes
|
|
|
|
|
.loop
|
|
|
|
|
add hl, bc
|
|
|
|
|
dec e
|
|
|
|
|
jr nz, .loop
|
2015-11-11 13:11:08 -08:00
|
|
|
|
ret
|
|
|
|
|
|
2020-10-05 17:10:01 -07:00
|
|
|
|
PlaceMoveNameAfterTMHMName: ; unreferenced
|
|
|
|
|
; Similar to a part of TMHM_DisplayPocketItems.
|
2018-03-25 07:18:33 -07:00
|
|
|
|
pop hl
|
|
|
|
|
ld bc, 3
|
|
|
|
|
add hl, bc
|
|
|
|
|
predef GetTMHMMove
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld a, [wTempTMHM]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld [wPutativeTMHMMove], a
|
|
|
|
|
call GetMoveName
|
|
|
|
|
push hl
|
|
|
|
|
call PlaceString
|
2015-11-11 13:11:08 -08:00
|
|
|
|
pop hl
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ret
|
|
|
|
|
|
2020-05-29 04:16:49 -07:00
|
|
|
|
TMHM_CancelString:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
db "CANCEL@"
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_GetCurrentPocketPosition:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld hl, wTMsHMs
|
|
|
|
|
ld a, [wTMHMPocketScrollPosition]
|
|
|
|
|
ld b, a
|
|
|
|
|
inc b
|
2015-11-11 13:11:08 -08:00
|
|
|
|
ld c, 0
|
2018-03-25 07:18:33 -07:00
|
|
|
|
.loop
|
|
|
|
|
inc c
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
and a
|
|
|
|
|
jr z, .loop
|
|
|
|
|
dec b
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
dec hl
|
|
|
|
|
dec c
|
2015-11-11 13:11:08 -08:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
Tutorial_TMHMPocket:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
hlcoord 9, 3
|
|
|
|
|
push de
|
2020-05-29 04:16:49 -07:00
|
|
|
|
ld de, TMHM_CancelString
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call PlaceString
|
|
|
|
|
pop de
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_PlaySFX_ReadText2:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
push de
|
|
|
|
|
ld de, SFX_READ_TEXT_2
|
|
|
|
|
call PlaySFX
|
|
|
|
|
pop de
|
|
|
|
|
ret
|
|
|
|
|
|
2020-10-05 13:15:57 -07:00
|
|
|
|
VerboseReceiveTMHM: ; unreferenced
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call ConvertCurItemIntoCurTMHM
|
|
|
|
|
call .CheckHaveRoomForTMHM
|
2019-10-20 15:24:17 -07:00
|
|
|
|
ld hl, .NoRoomTMHMText
|
2018-03-25 07:18:33 -07:00
|
|
|
|
jr nc, .print
|
2019-10-20 15:24:17 -07:00
|
|
|
|
ld hl, .ReceivedTMHMText
|
2018-03-25 07:18:33 -07:00
|
|
|
|
.print
|
|
|
|
|
jp PrintText
|
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
|
.NoRoomTMHMText:
|
|
|
|
|
text_far _NoRoomTMHMText
|
2018-11-17 10:33:03 -08:00
|
|
|
|
text_end
|
2018-03-25 07:18:33 -07:00
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
|
.ReceivedTMHMText:
|
|
|
|
|
text_far _ReceivedTMHMText
|
2018-11-17 10:33:03 -08:00
|
|
|
|
text_end
|
2018-03-25 07:18:33 -07:00
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
.CheckHaveRoomForTMHM:
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld a, [wTempTMHM]
|
2015-11-11 13:11:08 -08:00
|
|
|
|
dec a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld hl, wTMsHMs
|
2015-11-11 13:11:08 -08:00
|
|
|
|
ld b, 0
|
|
|
|
|
ld c, a
|
|
|
|
|
add hl, bc
|
|
|
|
|
ld a, [hl]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
inc a
|
2020-10-05 13:15:57 -07:00
|
|
|
|
cp MAX_ITEM_STACK + 1
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ret nc
|
|
|
|
|
ld [hl], a
|
2015-11-11 13:11:08 -08:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
ConsumeTM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call ConvertCurItemIntoCurTMHM
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld a, [wTempTMHM]
|
2018-03-25 07:18:33 -07:00
|
|
|
|
dec a
|
|
|
|
|
ld hl, wTMsHMs
|
|
|
|
|
ld b, 0
|
|
|
|
|
ld c, a
|
|
|
|
|
add hl, bc
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
and a
|
|
|
|
|
ret z
|
|
|
|
|
dec a
|
|
|
|
|
ld [hl], a
|
|
|
|
|
ret nz
|
|
|
|
|
ld a, [wTMHMPocketScrollPosition]
|
|
|
|
|
and a
|
|
|
|
|
ret z
|
|
|
|
|
dec a
|
|
|
|
|
ld [wTMHMPocketScrollPosition], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
CountTMsHMs:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld b, 0
|
|
|
|
|
ld c, NUM_TMS + NUM_HMS
|
|
|
|
|
ld hl, wTMsHMs
|
|
|
|
|
.loop
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
and a
|
|
|
|
|
jr z, .skip
|
|
|
|
|
inc b
|
|
|
|
|
.skip
|
|
|
|
|
dec c
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
ld a, b
|
2018-07-28 16:27:34 -07:00
|
|
|
|
ld [wTempTMHM], a
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ret
|