Organize the engine/ directory, take 3

Renamed `title` to `movies`.
Moved some functions from `engine/routines/` to their fitting
directories, and cleaned up the base `engine/` directory.
Moved `engine/pokemon/tmhm.asm` back to `engine/items/`.

Made a new subdirectory:
* engine/tilesets: Contains all map-related graphics routines.
This commit is contained in:
mid-kid 2018-03-25 16:18:33 +02:00
parent 60e21a8663
commit 0d9241889f
36 changed files with 648 additions and 648 deletions

View File

@ -21,7 +21,7 @@ data/maps/map_data.o \
data/pokemon/dex_entries.o \ data/pokemon/dex_entries.o \
data/pokemon/egg_moves.o \ data/pokemon/egg_moves.o \
data/pokemon/evos_attacks.o \ data/pokemon/evos_attacks.o \
engine/title/credits.o \ engine/movie/credits.o \
engine/overworld/events.o \ engine/overworld/events.o \
gfx/pics.o \ gfx/pics.o \
gfx/sprites.o \ gfx/sprites.o \

View File

@ -203,7 +203,7 @@ Function49496: ; 49496
ret ret
; 494ac ; 494ac
INCLUDE "engine/gfx/tileset_palettes.asm" INCLUDE "engine/tilesets/tileset_palettes.asm"
MG_Mobile_Layout02: ; 49706 MG_Mobile_Layout02: ; 49706
ld hl, .Palette_49732 ld hl, .Palette_49732

View File

@ -1,49 +1,589 @@
CanLearnTMHMMove: ; 11639 TMHMPocket: ; 2c76f (b:476f)
ld a, [wCurPartySpecies] ld a, $1
ld [wCurSpecies], a ld [hInMenu], a
call GetBaseData call TMHM_PocketLoop
ld hl, wBaseTMHM ld a, $0
push hl ld [hInMenu], a
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
ld a, [wPutativeTMHMMove] .ConvertItemToTMHMNumber: ; 2c798 (b:4798)
ld a, [wCurItem]
ld c, a
callfar GetNumberedTMHM
ld a, c
ld [wCurItem], a
ret
ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7)
ld a, [wCurItem]
ld c, a
callfar GetTMHMNumber
ld a, c
ld [wCurTMHM], a
ret
GetTMHMItemMove: ; 2c7b6 (b:47b6)
call ConvertCurItemIntoCurTMHM
predef GetTMHMMove
ret
AskTeachTMHM: ; 2c7bf (b:47bf)
ld hl, wOptions
ld a, [hl]
push af
res NO_TEXT_SCROLL, [hl]
ld a, [wCurItem]
cp TM01
jr c, .NotTMHM
call GetTMHMItemMove
ld a, [wCurTMHM]
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
ChooseMonToLearnTMHM: ; 2c7fb
ld hl, wStringBuffer2
ld de, wTMHMMoveNameBackup
ld bc, 12
call CopyBytes
call ClearBGPalettes
ChooseMonToLearnTMHM_NoRefresh: ; 2c80a
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
ld a, [wCurPartySpecies]
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
push hl
push de
push bc
push af
ld de, SFX_WRONG
call PlaySFX
call WaitSFX
pop af
pop bc
pop de
pop hl
jr .loopback
; 2c867
TeachTMHM: ; 2c867
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
.unused
ld a, 2
ld [wItemEffectSucceeded], a
.learned_move
scf
ret
; 2c8bf (b:48bf)
Text_BootedTM: ; 0x2c8bf
; Booted up a TM.
text_jump UnknownText_0x1c0373
db "@"
; 0x2c8c4
Text_BootedHM: ; 0x2c8c4
; Booted up an HM.
text_jump UnknownText_0x1c0384
db "@"
; 0x2c8c9
Text_ItContained: ; 0x2c8c9
; It contained @ . Teach @ to a #MON?
text_jump UnknownText_0x1c0396
db "@"
; 0x2c8ce
Text_TMHMNotCompatible: ; 0x2c8ce
; is not compatible with @ . It can't learn @ .
text_jump UnknownText_0x1c03c2
db "@"
; 0x2c8d3
TMHM_PocketLoop: ; 2c8d3 (b:48d3)
xor a
ld [hBGMapMode], a
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
TMHM_JoypadLoop: ; 2c915 (b:4915)
call TMHM_DisplayPocketItems
call StaticMenuJoypad
ld b, a
ld a, [wMenuCursorY]
dec a
ld [wTMHMPocketCursor], a
xor a
ld [hBGMapMode], a
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
TMHM_ShowTMMoveDescription: ; 2c946 (b:4946)
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
ld [wd265], a
predef GetTMHMMove
ld a, [wd265]
ld [wCurSpecies], a
hlcoord 1, 14
call PrintMoveDesc
jp TMHM_JoypadLoop
TMHM_ChooseTMorHM: ; 2c974 (b:4974)
call TMHM_PlaySFX_ReadText2
call CountTMsHMs ; This stores the count to wd265.
ld a, [wMenuCursorY]
dec a
ld b, a
ld a, [wTMHMPocketScrollPosition]
add b
ld b, a
ld a, [wd265]
cp b
jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL
TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a)
call TMHM_GetCurrentPocketPosition
ld a, [wMenuCursorY]
ld b, a ld b, a
ld c, 0
ld hl, TMHMMoves
.loop .loop
inc c
ld a, c
cp NUM_TMS + NUM_HMS + 1
jr nc, .okay
ld a, [hli] ld a, [hli]
and a and a
jr z, .end jr z, .loop
cp b dec b
jr z, .asm_11659 jr nz, .loop
inc c ld a, c
jr .loop .okay
ld [wCurItem], a
cp -1
ret
.asm_11659 TMHM_ExitPack: ; 2c9a5 (b:49a5)
pop hl call TMHM_PlaySFX_ReadText2
ld b, CHECK_FLAG _TMHM_ExitPack: ; 2c9a8 (b:49a8)
ld a, $2
ld [wMenuJoypad], a
and a
ret
TMHM_ExitPocket: ; 2c9af (b:49af)
and a
ret
TMHM_ScrollPocket: ; 2c9b1 (b:49b1)
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
TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2)
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
inc c
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
ld [wd265], a
push hl
push de push de
ld d, 0 push bc
predef SmallFarFlagAction call TMHMPocket_GetCurrentLineCoord
push hl
ld a, [wd265]
cp NUM_TMS + 1
jr nc, .HM
ld de, wd265
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
jr .okay
.HM:
push af
sub NUM_TMS
ld [wd265], a
ld [hl], "H"
inc hl
ld de, wd265
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
call PrintNum
pop af
ld [wd265], a
.okay
predef GetTMHMMove
ld a, [wd265]
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
ld [wd265], a
ld de, wd265
lb bc, 1, 2
call PrintNum
.hm2
pop bc
pop de
pop hl
dec d
jr nz, .loop2
jr .done
.NotTMHM:
call TMHMPocket_GetCurrentLineCoord
inc hl
inc hl
inc hl
push de
ld de, TMHM_String_Cancel
call PlaceString
pop de
.done
ret
TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86)
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
ret
; 2ca95 (b:4a95)
Unreferenced_Function2ca95: ; 2ca95
pop hl
ld bc, 3
add hl, bc
predef GetTMHMMove
ld a, [wd265]
ld [wPutativeTMHMMove], a
call GetMoveName
push hl
call PlaceString
pop hl
ret
; 2caae
TMHM_String_Cancel: ; 2caae
db "CANCEL@"
; 2cab5
TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5)
ld hl, wTMsHMs
ld a, [wTMHMPocketScrollPosition]
ld b, a
inc b
ld c, 0
.loop
inc c
ld a, [hli]
and a
jr z, .loop
dec b
jr nz, .loop
dec hl
dec c
ret
Tutorial_TMHMPocket: ; 2caca (b:4aca)
hlcoord 9, 3
push de
ld de, TMHM_String_Cancel
call PlaceString
pop de pop de
ret ret
.end TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6)
pop hl push de
ld c, 0 ld de, SFX_READ_TEXT_2
call PlaySFX
pop de
ret ret
; 1166a ; 2cadf (b:4adf)
GetTMHMMove: ; 1166a Unreferenced_Function2cadf: ; 2cadf
call ConvertCurItemIntoCurTMHM
call .CheckHaveRoomForTMHM
ld hl, .NoRoomText
jr nc, .print
ld hl, .ReceivedText
.print
jp PrintText
; 2caf0
.NoRoomText: ; 0x2caf0
; You have no room for any more @ S.
text_jump UnknownText_0x1c03fa
db "@"
; 0x2caf5
.ReceivedText: ; 0x2caf5
; You received @ !
text_jump UnknownText_0x1c0421
db "@"
; 0x2cafa
.CheckHaveRoomForTMHM: ; 2cafa
ld a, [wd265] ld a, [wd265]
dec a dec a
ld hl, TMHMMoves ld hl, wTMsHMs
ld b, 0 ld b, 0
ld c, a ld c, a
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
inc a
cp NUM_TMS * 2
ret nc
ld [hl], a
ret
; 2cb0c
ConsumeTM: ; 2cb0c (b:4b0c)
call ConvertCurItemIntoCurTMHM
ld a, [wd265]
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
CountTMsHMs: ; 2cb2a (b:4b2a)
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
ld [wd265], a ld [wd265], a
ret ret
; 1167a
PrintMoveDesc: ; 2cb3e
INCLUDE "data/moves/tmhm_moves.asm" push hl
ld hl, MoveDescriptions
ld a, [wCurSpecies]
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
jp PlaceString
; 2cb52

49
engine/items/tmhm2.asm Executable file
View File

@ -0,0 +1,49 @@
CanLearnTMHMMove: ; 11639
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
ld hl, wBaseTMHM
push hl
ld a, [wPutativeTMHMMove]
ld b, a
ld c, 0
ld hl, TMHMMoves
.loop
ld a, [hli]
and a
jr z, .end
cp b
jr z, .asm_11659
inc c
jr .loop
.asm_11659
pop hl
ld b, CHECK_FLAG
push de
ld d, 0
predef SmallFarFlagAction
pop de
ret
.end
pop hl
ld c, 0
ret
; 1166a
GetTMHMMove: ; 1166a
ld a, [wd265]
dec a
ld hl, TMHMMoves
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wd265], a
ret
; 1167a
INCLUDE "data/moves/tmhm_moves.asm"

View File

@ -2029,7 +2029,7 @@ Unreferenced_Function28f09: ; 28f09
ret ret
; 28f24 ; 28f24
INCLUDE "engine/gfx/trade_animation.asm" INCLUDE "engine/movie/trade_animation.asm"
CheckTimeCapsuleCompatibility: ; 29bfb CheckTimeCapsuleCompatibility: ; 29bfb
; Checks to see if your party is compatible with the Gen 1 games. ; Checks to see if your party is compatible with the Gen 1 games.

View File

@ -1,589 +0,0 @@
TMHMPocket: ; 2c76f (b:476f)
ld a, $1
ld [hInMenu], a
call TMHM_PocketLoop
ld a, $0
ld [hInMenu], a
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
.ConvertItemToTMHMNumber: ; 2c798 (b:4798)
ld a, [wCurItem]
ld c, a
callfar GetNumberedTMHM
ld a, c
ld [wCurItem], a
ret
ConvertCurItemIntoCurTMHM: ; 2c7a7 (b:47a7)
ld a, [wCurItem]
ld c, a
callfar GetTMHMNumber
ld a, c
ld [wCurTMHM], a
ret
GetTMHMItemMove: ; 2c7b6 (b:47b6)
call ConvertCurItemIntoCurTMHM
predef GetTMHMMove
ret
AskTeachTMHM: ; 2c7bf (b:47bf)
ld hl, wOptions
ld a, [hl]
push af
res NO_TEXT_SCROLL, [hl]
ld a, [wCurItem]
cp TM01
jr c, .NotTMHM
call GetTMHMItemMove
ld a, [wCurTMHM]
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
ChooseMonToLearnTMHM: ; 2c7fb
ld hl, wStringBuffer2
ld de, wTMHMMoveNameBackup
ld bc, 12
call CopyBytes
call ClearBGPalettes
ChooseMonToLearnTMHM_NoRefresh: ; 2c80a
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
ld a, [wCurPartySpecies]
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
push hl
push de
push bc
push af
ld de, SFX_WRONG
call PlaySFX
call WaitSFX
pop af
pop bc
pop de
pop hl
jr .loopback
; 2c867
TeachTMHM: ; 2c867
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
.unused
ld a, 2
ld [wItemEffectSucceeded], a
.learned_move
scf
ret
; 2c8bf (b:48bf)
Text_BootedTM: ; 0x2c8bf
; Booted up a TM.
text_jump UnknownText_0x1c0373
db "@"
; 0x2c8c4
Text_BootedHM: ; 0x2c8c4
; Booted up an HM.
text_jump UnknownText_0x1c0384
db "@"
; 0x2c8c9
Text_ItContained: ; 0x2c8c9
; It contained @ . Teach @ to a #MON?
text_jump UnknownText_0x1c0396
db "@"
; 0x2c8ce
Text_TMHMNotCompatible: ; 0x2c8ce
; is not compatible with @ . It can't learn @ .
text_jump UnknownText_0x1c03c2
db "@"
; 0x2c8d3
TMHM_PocketLoop: ; 2c8d3 (b:48d3)
xor a
ld [hBGMapMode], a
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
TMHM_JoypadLoop: ; 2c915 (b:4915)
call TMHM_DisplayPocketItems
call StaticMenuJoypad
ld b, a
ld a, [wMenuCursorY]
dec a
ld [wTMHMPocketCursor], a
xor a
ld [hBGMapMode], a
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
TMHM_ShowTMMoveDescription: ; 2c946 (b:4946)
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
ld [wd265], a
predef GetTMHMMove
ld a, [wd265]
ld [wCurSpecies], a
hlcoord 1, 14
call PrintMoveDesc
jp TMHM_JoypadLoop
TMHM_ChooseTMorHM: ; 2c974 (b:4974)
call TMHM_PlaySFX_ReadText2
call CountTMsHMs ; This stores the count to wd265.
ld a, [wMenuCursorY]
dec a
ld b, a
ld a, [wTMHMPocketScrollPosition]
add b
ld b, a
ld a, [wd265]
cp b
jr z, _TMHM_ExitPack ; our cursor was hovering over CANCEL
TMHM_CheckHoveringOverCancel: ; 2c98a (b:498a)
call TMHM_GetCurrentPocketPosition
ld a, [wMenuCursorY]
ld b, a
.loop
inc c
ld a, c
cp NUM_TMS + NUM_HMS + 1
jr nc, .okay
ld a, [hli]
and a
jr z, .loop
dec b
jr nz, .loop
ld a, c
.okay
ld [wCurItem], a
cp -1
ret
TMHM_ExitPack: ; 2c9a5 (b:49a5)
call TMHM_PlaySFX_ReadText2
_TMHM_ExitPack: ; 2c9a8 (b:49a8)
ld a, $2
ld [wMenuJoypad], a
and a
ret
TMHM_ExitPocket: ; 2c9af (b:49af)
and a
ret
TMHM_ScrollPocket: ; 2c9b1 (b:49b1)
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
TMHM_DisplayPocketItems: ; 2c9e2 (b:49e2)
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
inc c
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
ld [wd265], a
push hl
push de
push bc
call TMHMPocket_GetCurrentLineCoord
push hl
ld a, [wd265]
cp NUM_TMS + 1
jr nc, .HM
ld de, wd265
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
jr .okay
.HM:
push af
sub NUM_TMS
ld [wd265], a
ld [hl], "H"
inc hl
ld de, wd265
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
call PrintNum
pop af
ld [wd265], a
.okay
predef GetTMHMMove
ld a, [wd265]
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
ld [wd265], a
ld de, wd265
lb bc, 1, 2
call PrintNum
.hm2
pop bc
pop de
pop hl
dec d
jr nz, .loop2
jr .done
.NotTMHM:
call TMHMPocket_GetCurrentLineCoord
inc hl
inc hl
inc hl
push de
ld de, TMHM_String_Cancel
call PlaceString
pop de
.done
ret
TMHMPocket_GetCurrentLineCoord: ; 2ca86 (b:4a86)
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
ret
; 2ca95 (b:4a95)
Unreferenced_Function2ca95: ; 2ca95
pop hl
ld bc, 3
add hl, bc
predef GetTMHMMove
ld a, [wd265]
ld [wPutativeTMHMMove], a
call GetMoveName
push hl
call PlaceString
pop hl
ret
; 2caae
TMHM_String_Cancel: ; 2caae
db "CANCEL@"
; 2cab5
TMHM_GetCurrentPocketPosition: ; 2cab5 (b:4ab5)
ld hl, wTMsHMs
ld a, [wTMHMPocketScrollPosition]
ld b, a
inc b
ld c, 0
.loop
inc c
ld a, [hli]
and a
jr z, .loop
dec b
jr nz, .loop
dec hl
dec c
ret
Tutorial_TMHMPocket: ; 2caca (b:4aca)
hlcoord 9, 3
push de
ld de, TMHM_String_Cancel
call PlaceString
pop de
ret
TMHM_PlaySFX_ReadText2: ; 2cad6 (b:4ad6)
push de
ld de, SFX_READ_TEXT_2
call PlaySFX
pop de
ret
; 2cadf (b:4adf)
Unreferenced_Function2cadf: ; 2cadf
call ConvertCurItemIntoCurTMHM
call .CheckHaveRoomForTMHM
ld hl, .NoRoomText
jr nc, .print
ld hl, .ReceivedText
.print
jp PrintText
; 2caf0
.NoRoomText: ; 0x2caf0
; You have no room for any more @ S.
text_jump UnknownText_0x1c03fa
db "@"
; 0x2caf5
.ReceivedText: ; 0x2caf5
; You received @ !
text_jump UnknownText_0x1c0421
db "@"
; 0x2cafa
.CheckHaveRoomForTMHM: ; 2cafa
ld a, [wd265]
dec a
ld hl, wTMsHMs
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
inc a
cp NUM_TMS * 2
ret nc
ld [hl], a
ret
; 2cb0c
ConsumeTM: ; 2cb0c (b:4b0c)
call ConvertCurItemIntoCurTMHM
ld a, [wd265]
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
CountTMsHMs: ; 2cb2a (b:4b2a)
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
ld [wd265], a
ret
PrintMoveDesc: ; 2cb3e
push hl
ld hl, MoveDescriptions
ld a, [wCurSpecies]
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
jp PlaceString
; 2cb52

View File

@ -3,13 +3,13 @@ INCLUDE "constants.asm"
SECTION "bank1", ROMX SECTION "bank1", ROMX
INCLUDE "engine/routines/placewaitingtext.asm" INCLUDE "engine/link/placewaitingtext.asm"
INCLUDE "engine/routines/loadpushoam.asm" INCLUDE "engine/gfx/loadpushoam.asm"
INCLUDE "engine/overworld/map_objects.asm" INCLUDE "engine/overworld/map_objects.asm"
INCLUDE "engine/menus/intro_menu.asm" INCLUDE "engine/menus/intro_menu.asm"
INCLUDE "engine/overworld/init_map.asm" INCLUDE "engine/overworld/init_map.asm"
INCLUDE "engine/pokemon/learn.asm" INCLUDE "engine/pokemon/learn.asm"
INCLUDE "engine/routines/checknickerrors.asm" INCLUDE "engine/pokemon/checknickerrors.asm"
INCLUDE "engine/routines/math.asm" INCLUDE "engine/routines/math.asm"
INCLUDE "data/items/attributes.asm" INCLUDE "data/items/attributes.asm"
INCLUDE "engine/overworld/npc_movement.asm" INCLUDE "engine/overworld/npc_movement.asm"
@ -21,13 +21,13 @@ SECTION "bank2", ROMX
INCLUDE "engine/overworld/player_object.asm" INCLUDE "engine/overworld/player_object.asm"
INCLUDE "engine/routines/sine.asm" INCLUDE "engine/routines/sine.asm"
INCLUDE "engine/predef.asm" INCLUDE "engine/routines/predef.asm"
INCLUDE "engine/gfx/color.asm" INCLUDE "engine/gfx/color.asm"
SECTION "bank3", ROMX SECTION "bank3", ROMX
INCLUDE "engine/routines/checktime.asm" INCLUDE "engine/events/checktime.asm"
INCLUDE "engine/events/specials.asm" INCLUDE "engine/events/specials.asm"
INCLUDE "engine/routines/printnum.asm" INCLUDE "engine/routines/printnum.asm"
INCLUDE "engine/pokemon/health.asm" INCLUDE "engine/pokemon/health.asm"
@ -48,7 +48,7 @@ SECTION "bank4", ROMX
INCLUDE "engine/items/pack.asm" INCLUDE "engine/items/pack.asm"
INCLUDE "engine/overworld/time.asm" INCLUDE "engine/overworld/time.asm"
INCLUDE "engine/items/tmhm.asm" INCLUDE "engine/items/tmhm2.asm"
INCLUDE "engine/menus/naming_screen.asm" INCLUDE "engine/menus/naming_screen.asm"
INCLUDE "engine/events/misc_scripts.asm" INCLUDE "engine/events/misc_scripts.asm"
INCLUDE "engine/events/heal_machine_anim.asm" INCLUDE "engine/events/heal_machine_anim.asm"
@ -64,7 +64,7 @@ INCLUDE "engine/events/std_collision.asm"
INCLUDE "engine/events/bug_contest/judging.asm" INCLUDE "engine/events/bug_contest/judging.asm"
INCLUDE "engine/events/pokerus/apply_pokerus_tick.asm" INCLUDE "engine/events/pokerus/apply_pokerus_tick.asm"
INCLUDE "engine/events/bug_contest/contest_2.asm" INCLUDE "engine/events/bug_contest/contest_2.asm"
INCLUDE "engine/routines/correcterrorsinplayerparty.asm" INCLUDE "engine/pokemon/correcterrorsinplayerparty.asm"
INCLUDE "engine/routines/getsquareroot.asm" INCLUDE "engine/routines/getsquareroot.asm"
@ -73,12 +73,12 @@ SECTION "bank5", ROMX
INCLUDE "engine/rtc/rtc.asm" INCLUDE "engine/rtc/rtc.asm"
INCLUDE "engine/overworld/overworld.asm" INCLUDE "engine/overworld/overworld.asm"
INCLUDE "engine/overworld/tile_events.asm" INCLUDE "engine/overworld/tile_events.asm"
INCLUDE "engine/save.asm" INCLUDE "engine/menus/save.asm"
INCLUDE "engine/overworld/spawn_points.asm" INCLUDE "engine/overworld/spawn_points.asm"
INCLUDE "engine/overworld/map_setup.asm" INCLUDE "engine/overworld/map_setup.asm"
INCLUDE "engine/events/pokecenter_pc.asm" INCLUDE "engine/events/pokecenter_pc.asm"
INCLUDE "engine/items/mart.asm" INCLUDE "engine/items/mart.asm"
INCLUDE "engine/money.asm" INCLUDE "engine/events/money.asm"
INCLUDE "data/items/marts.asm" INCLUDE "data/items/marts.asm"
INCLUDE "engine/events/mom.asm" INCLUDE "engine/events/mom.asm"
INCLUDE "engine/events/daycare.asm" INCLUDE "engine/events/daycare.asm"
@ -90,7 +90,7 @@ INCLUDE "gfx/tilesets.asm"
SECTION "Roofs", ROMX SECTION "Roofs", ROMX
INCLUDE "engine/gfx/mapgroup_roofs.asm" INCLUDE "engine/tilesets/mapgroup_roofs.asm"
SECTION "Clock Reset", ROMX SECTION "Clock Reset", ROMX
@ -144,7 +144,7 @@ INCLUDE "data/trainers/class_names.asm"
INCLUDE "engine/battle/ai/redundant.asm" INCLUDE "engine/battle/ai/redundant.asm"
INCLUDE "engine/events/move_deleter.asm" INCLUDE "engine/events/move_deleter.asm"
INCLUDE "engine/link/mystery_gift_2.asm" INCLUDE "engine/link/mystery_gift_2.asm"
INCLUDE "engine/pokemon/tmhm.asm" INCLUDE "engine/items/tmhm.asm"
INCLUDE "data/moves/descriptions.asm" INCLUDE "data/moves/descriptions.asm"
INCLUDE "engine/events/pokerus/pokerus.asm" INCLUDE "engine/events/pokerus/pokerus.asm"
INCLUDE "engine/battle/start_battle.asm" INCLUDE "engine/battle/start_battle.asm"
@ -205,15 +205,15 @@ INCLUDE "engine/events/buena_menu.asm"
SECTION "bank13", ROMX SECTION "bank13", ROMX
INCLUDE "engine/gfx/map_palettes.asm" INCLUDE "engine/tilesets/map_palettes.asm"
INCLUDE "gfx/tileset_palette_maps.asm" INCLUDE "gfx/tileset_palette_maps.asm"
INCLUDE "data/collision_permissions.asm" INCLUDE "data/collision_permissions.asm"
INCLUDE "engine/routines/emptyallsrambanks.asm" INCLUDE "engine/routines/emptyallsrambanks.asm"
INCLUDE "engine/routines/savemenu_copytilemapatonce.asm" INCLUDE "engine/menus/savemenu_copytilemapatonce.asm"
INCLUDE "engine/routines/checksave.asm" INCLUDE "engine/events/checksave.asm"
INCLUDE "data/maps/scenes.asm" INCLUDE "data/maps/scenes.asm"
INCLUDE "engine/overworld/loadmappart.asm" INCLUDE "engine/overworld/loadmappart.asm"
INCLUDE "engine/routines/phonering_copytilemapatonce.asm" INCLUDE "engine/phone/phonering_copytilemapatonce.asm"
Shrink1Pic: ; 4d249 Shrink1Pic: ; 4d249
INCBIN "gfx/new_game/shrink1.2bpp.lz" INCBIN "gfx/new_game/shrink1.2bpp.lz"
@ -232,13 +232,13 @@ INCLUDE "engine/pokemon/caught_data.asm"
INCLUDE "engine/pokemon/search2.asm" INCLUDE "engine/pokemon/search2.asm"
INCLUDE "engine/pokemon/stats_screen.asm" INCLUDE "engine/pokemon/stats_screen.asm"
INCLUDE "engine/events/catch_tutorial.asm" INCLUDE "engine/events/catch_tutorial.asm"
INCLUDE "engine/gfx/evolution_animation.asm" INCLUDE "engine/movie/evolution_animation.asm"
INCLUDE "engine/title/init_hof_credits.asm" INCLUDE "engine/movie/init_hof_credits.asm"
INCLUDE "engine/events/battle_tower/get_trainer_class.asm" INCLUDE "engine/events/battle_tower/get_trainer_class.asm"
INCLUDE "engine/battle/sliding_intro.asm" INCLUDE "engine/battle/sliding_intro.asm"
INCLUDE "mobile/print_opp_message.asm" INCLUDE "mobile/print_opp_message.asm"
INCLUDE "engine/battle/checkbattlescene.asm" INCLUDE "engine/battle/checkbattlescene.asm"
INCLUDE "engine/gfx/gbc_only.asm" INCLUDE "engine/movie/gbc_only.asm"
INCLUDE "engine/events/poke_seer.asm" INCLUDE "engine/events/poke_seer.asm"
@ -277,10 +277,10 @@ INCLUDE "data/phone/text/extra.asm"
SECTION "bank20", ROMX SECTION "bank20", ROMX
INCLUDE "engine/overworld/player_movement.asm" INCLUDE "engine/overworld/player_movement.asm"
INCLUDE "engine/engine_flags.asm" INCLUDE "engine/events/engine_flags.asm"
INCLUDE "engine/overworld/variables.asm" INCLUDE "engine/overworld/variables.asm"
INCLUDE "data/text/battle.asm" INCLUDE "data/text/battle.asm"
INCLUDE "engine/debug.asm" INCLUDE "engine/menus/debug.asm"
SECTION "bank21", ROMX SECTION "bank21", ROMX
@ -304,7 +304,7 @@ INCLUDE "mobile/mobile_22_2.asm"
SECTION "bank23", ROMX SECTION "bank23", ROMX
INCLUDE "engine/gfx/timeofdaypals.asm" INCLUDE "engine/tilesets/timeofdaypals.asm"
INCLUDE "engine/battle/battle_transition.asm" INCLUDE "engine/battle/battle_transition.asm"
INCLUDE "engine/events/field_moves.asm" INCLUDE "engine/events/field_moves.asm"
INCLUDE "engine/events/magnet_train.asm" INCLUDE "engine/events/magnet_train.asm"
@ -442,7 +442,7 @@ CopyrightGFX:: ; e4000
INCBIN "gfx/splash/copyright.2bpp" INCBIN "gfx/splash/copyright.2bpp"
INCLUDE "engine/menus/options_menu.asm" INCLUDE "engine/menus/options_menu.asm"
INCLUDE "engine/title/crystal_intro.asm" INCLUDE "engine/movie/crystal_intro.asm"
SECTION "bank3E", ROMX SECTION "bank3E", ROMX
@ -450,7 +450,7 @@ SECTION "bank3E", ROMX
INCLUDE "engine/gfx/load_font.asm" INCLUDE "engine/gfx/load_font.asm"
INCLUDE "engine/link/time_capsule.asm" INCLUDE "engine/link/time_capsule.asm"
INCLUDE "engine/events/name_rater.asm" INCLUDE "engine/events/name_rater.asm"
INCLUDE "engine/routines/playslowcry.asm" INCLUDE "engine/events/playslowcry.asm"
INCLUDE "engine/pokedex/newpokedexentry.asm" INCLUDE "engine/pokedex/newpokedexentry.asm"
INCLUDE "engine/link/time_capsule_2.asm" INCLUDE "engine/link/time_capsule_2.asm"
INCLUDE "engine/pokedex/unown_dex.asm" INCLUDE "engine/pokedex/unown_dex.asm"
@ -461,7 +461,7 @@ INCLUDE "engine/battle/misc.asm"
SECTION "bank3F", ROMX SECTION "bank3F", ROMX
INCLUDE "engine/gfx/tileset_anims.asm" INCLUDE "engine/tilesets/tileset_anims.asm"
INCLUDE "engine/events/npc_trade.asm" INCLUDE "engine/events/npc_trade.asm"
INCLUDE "engine/events/mom_phone.asm" INCLUDE "engine/events/mom_phone.asm"
@ -471,7 +471,7 @@ INCLUDE "mobile/mobile_40.asm"
SECTION "bank41", ROMX SECTION "bank41", ROMX
INCLUDE "engine/dma_transfer.asm" INCLUDE "engine/gfx/dma_transfer.asm"
INCLUDE "gfx/emotes.asm" INCLUDE "gfx/emotes.asm"
INCLUDE "engine/overworld/warp_connection.asm" INCLUDE "engine/overworld/warp_connection.asm"
INCLUDE "engine/link/mystery_gift.asm" INCLUDE "engine/link/mystery_gift.asm"
@ -493,8 +493,8 @@ INCBIN "gfx/intro/logo.2bpp.lz"
SECTION "Title", ROMX SECTION "Title", ROMX
INCLUDE "engine/title/unused_title.asm" INCLUDE "engine/movie/unused_title.asm"
INCLUDE "engine/title/title.asm" INCLUDE "engine/movie/title.asm"
INCLUDE "mobile/mobile_45.asm" INCLUDE "mobile/mobile_45.asm"
@ -586,7 +586,7 @@ INCLUDE "engine/rtc/printhoursmins.asm"
INCLUDE "engine/events/diploma.asm" INCLUDE "engine/events/diploma.asm"
INCLUDE "engine/pokedex/pokedex_3.asm" INCLUDE "engine/pokedex/pokedex_3.asm"
INCLUDE "engine/events/catch_tutorial_input.asm" INCLUDE "engine/events/catch_tutorial_input.asm"
INCLUDE "engine/routines/townmap_convertlinebreakcharacters.asm" INCLUDE "engine/pokegear/townmap_convertlinebreakcharacters.asm"
PokegearGFX: ; 1de2e4 PokegearGFX: ; 1de2e4
INCBIN "gfx/pokegear/pokegear.2bpp.lz" INCBIN "gfx/pokegear/pokegear.2bpp.lz"