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
|
|
|
|
|
ld hl, Text_BootedTM ; Booted up a TM
|
|
|
|
|
ld a, [wCurItem]
|
|
|
|
|
cp HM01
|
|
|
|
|
jr c, .TM
|
|
|
|
|
ld hl, Text_BootedHM ; Booted up an HM
|
|
|
|
|
.TM:
|
|
|
|
|
call PrintText
|
|
|
|
|
ld hl, Text_ItContained
|
|
|
|
|
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
|
|
|
|
|
ld hl, Text_TMHMNotCompatible
|
|
|
|
|
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
|
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
|
Text_BootedTM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
; Booted up a TM.
|
|
|
|
|
text_jump UnknownText_0x1c0373
|
|
|
|
|
db "@"
|
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
|
Text_BootedHM:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
; Booted up an HM.
|
|
|
|
|
text_jump UnknownText_0x1c0384
|
|
|
|
|
db "@"
|
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
|
Text_ItContained:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
; It contained @ . Teach @ to a #MON?
|
|
|
|
|
text_jump UnknownText_0x1c0396
|
|
|
|
|
db "@"
|
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
|
Text_TMHMNotCompatible:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
; is not compatible with @ . It can't learn @ .
|
|
|
|
|
text_jump UnknownText_0x1c03c2
|
|
|
|
|
db "@"
|
|
|
|
|
|
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
|
|
|
|
|
call TextBox
|
|
|
|
|
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
|
|
|
|
|
call PrintMoveDesc
|
|
|
|
|
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
|
2018-03-25 07:18:33 -07:00
|
|
|
|
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
|
|
|
|
|
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
|
2018-03-25 07:18:33 -07:00
|
|
|
|
ld de, TMHM_String_Cancel
|
|
|
|
|
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
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
Unreferenced_Function2ca95:
|
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
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
TMHM_String_Cancel:
|
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
|
|
|
|
|
ld de, TMHM_String_Cancel
|
|
|
|
|
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
|
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
|
Unreferenced_Function2cadf:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
call ConvertCurItemIntoCurTMHM
|
|
|
|
|
call .CheckHaveRoomForTMHM
|
|
|
|
|
ld hl, .NoRoomText
|
|
|
|
|
jr nc, .print
|
|
|
|
|
ld hl, .ReceivedText
|
|
|
|
|
.print
|
|
|
|
|
jp PrintText
|
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
|
.NoRoomText:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
; You have no room for any more @ S.
|
|
|
|
|
text_jump UnknownText_0x1c03fa
|
|
|
|
|
db "@"
|
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
|
.ReceivedText:
|
2018-03-25 07:18:33 -07:00
|
|
|
|
; You received @ !
|
|
|
|
|
text_jump UnknownText_0x1c0421
|
|
|
|
|
db "@"
|
|
|
|
|
|
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
|
|
|
|
|
cp NUM_TMS * 2
|
|
|
|
|
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
|