Split print_move_description and mon_menu

This commit is contained in:
mid-kid 2018-08-06 17:20:05 +02:00
parent 98e670f363
commit 86c1b05fbc
6 changed files with 1574 additions and 1574 deletions

View File

@ -557,18 +557,3 @@ CountTMsHMs:
ld a, b ld a, b
ld [wTempTMHM], a ld [wTempTMHM], a
ret ret
PrintMoveDesc:
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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,290 @@
INCLUDE "data/mon_menu.asm"
MonSubmenu:
xor a
ld [hBGMapMode], a
call GetMonSubmenuItems
farcall FreezeMonIcons
ld hl, .MenuHeader
call LoadMenuHeader
call .GetTopCoord
call PopulateMonMenu
ld a, 1
ld [hBGMapMode], a
call MonMenuLoop
ld [wMenuSelection], a
call ExitMenu
ret
.MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 6, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw 0
db 1 ; default option
.GetTopCoord:
; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1)
ld a, [wBuffer1]
inc a
add a
ld b, a
ld a, [wMenuBorderBottomCoord]
sub b
inc a
ld [wMenuBorderTopCoord], a
call MenuBox
ret
MonMenuLoop:
.loop
ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags
ld [wMenuDataFlags], a
ld a, [wBuffer1] ; items
ld [wMenuDataItems], a
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
set 6, [hl]
call StaticMenuJoypad
ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, [hJoyPressed]
bit A_BUTTON_F, a
jr nz, .select
bit B_BUTTON_F, a
jr nz, .cancel
jr .loop
.cancel
ld a, MONMENUITEM_CANCEL
ret
.select
ld a, [wMenuCursorY]
dec a
ld c, a
ld b, 0
ld hl, wBuffer2
add hl, bc
ld a, [hl]
ret
PopulateMonMenu:
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
ld de, wBuffer2
.loop
ld a, [de]
inc de
cp -1
ret z
push de
push hl
call GetMonMenuString
pop hl
call PlaceString
ld bc, 2 * SCREEN_WIDTH
add hl, bc
pop de
jr .loop
GetMonMenuString:
ld hl, MonMenuOptions + 1
ld de, 3
call IsInArray
dec hl
ld a, [hli]
cp MONMENU_MENUOPTION
jr z, .NotMove
inc hl
ld a, [hl]
ld [wNamedObjectIndexBuffer], a
call GetMoveName
ret
.NotMove:
inc hl
ld a, [hl]
dec a
ld hl, MonMenuOptionStrings
call GetNthString
ld d, h
ld e, l
ret
GetMonSubmenuItems:
call ResetMonSubmenu
ld a, [wCurPartySpecies]
cp EGG
jr z, .egg
ld a, [wLinkMode]
and a
jr nz, .skip_moves
ld a, MON_MOVES
call GetPartyParamLocation
ld d, h
ld e, l
ld c, NUM_MOVES
.loop
push bc
push de
ld a, [de]
and a
jr z, .next
push hl
call IsFieldMove
pop hl
jr nc, .next
call AddMonMenuItem
.next
pop de
inc de
pop bc
dec c
jr nz, .loop
.skip_moves
ld a, MONMENUITEM_STATS
call AddMonMenuItem
ld a, MONMENUITEM_SWITCH
call AddMonMenuItem
ld a, MONMENUITEM_MOVE
call AddMonMenuItem
ld a, [wLinkMode]
and a
jr nz, .skip2
push hl
ld a, MON_ITEM
call GetPartyParamLocation
ld d, [hl]
farcall ItemIsMail
pop hl
ld a, MONMENUITEM_MAIL
jr c, .ok
ld a, MONMENUITEM_ITEM
.ok
call AddMonMenuItem
.skip2
ld a, [wBuffer1]
cp NUM_MONMENU_ITEMS
jr z, .ok2
ld a, MONMENUITEM_CANCEL
call AddMonMenuItem
.ok2
call TerminateMonSubmenu
ret
.egg
ld a, MONMENUITEM_STATS
call AddMonMenuItem
ld a, MONMENUITEM_SWITCH
call AddMonMenuItem
ld a, MONMENUITEM_CANCEL
call AddMonMenuItem
call TerminateMonSubmenu
ret
IsFieldMove:
ld b, a
ld hl, MonMenuOptions
.next
ld a, [hli]
cp -1
jr z, .nope
cp MONMENU_MENUOPTION
jr z, .nope
ld d, [hl]
inc hl
ld a, [hli]
cp b
jr nz, .next
ld a, d
scf
.nope
ret
ResetMonSubmenu:
xor a
ld [wBuffer1], a
ld hl, wBuffer2
ld bc, NUM_MONMENU_ITEMS + 1
call ByteFill
ret
TerminateMonSubmenu:
ld a, [wBuffer1]
ld e, a
ld d, 0
ld hl, wBuffer2
add hl, de
ld [hl], -1
ret
AddMonMenuItem:
push hl
push de
push af
ld a, [wBuffer1]
ld e, a
inc a
ld [wBuffer1], a
ld d, 0
ld hl, wBuffer2
add hl, de
pop af
ld [hl], a
pop de
pop hl
ret
BattleMonMenu:
ld hl, MenuHeader_0x24ed4
call CopyMenuHeader
xor a
ld [hBGMapMode], a
call MenuBox
call UpdateSprites
call PlaceVerticalMenuItems
call WaitBGMap
call CopyMenuData
ld a, [wMenuDataFlags]
bit 7, a
jr z, .set_carry
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
set 6, [hl]
call StaticMenuJoypad
ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, [hJoyPressed]
bit B_BUTTON_F, a
jr z, .clear_carry
ret z
.set_carry
scf
ret
.clear_carry
and a
ret
MenuHeader_0x24ed4:
db 0 ; flags
menu_coords 11, 11, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw MenuData_0x24edc
db 1 ; default option
MenuData_0x24edc:
db STATICMENU_CURSOR | STATICMENU_NO_TOP_SPACING ; flags
db 3 ; items
db "SWITCH@"
db "STATS@"
db "CANCEL@"

View File

@ -0,0 +1,14 @@
PrintMoveDesc:
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

View File

@ -57,6 +57,7 @@ INCLUDE "engine/events/whiteout.asm"
INCLUDE "engine/events/forced_movement.asm" INCLUDE "engine/events/forced_movement.asm"
INCLUDE "engine/events/itemfinder.asm" INCLUDE "engine/events/itemfinder.asm"
INCLUDE "engine/menus/start_menu.asm" INCLUDE "engine/menus/start_menu.asm"
INCLUDE "engine/pokemon/mon_menu.asm"
INCLUDE "engine/overworld/select_menu.asm" INCLUDE "engine/overworld/select_menu.asm"
INCLUDE "engine/events/elevator.asm" INCLUDE "engine/events/elevator.asm"
INCLUDE "engine/events/bug_contest/contest.asm" INCLUDE "engine/events/bug_contest/contest.asm"
@ -109,7 +110,7 @@ INCLUDE "engine/overworld/map_objects_2.asm"
INCLUDE "engine/menus/scrolling_menu.asm" INCLUDE "engine/menus/scrolling_menu.asm"
INCLUDE "engine/items/switch_items.asm" INCLUDE "engine/items/switch_items.asm"
INCLUDE "engine/menus/menu_2.asm" INCLUDE "engine/menus/menu_2.asm"
INCLUDE "engine/pokemon/mon_menu.asm" INCLUDE "engine/pokemon/mon_submenu.asm"
INCLUDE "engine/battle/menu.asm" INCLUDE "engine/battle/menu.asm"
INCLUDE "engine/items/buy_sell_toss.asm" INCLUDE "engine/items/buy_sell_toss.asm"
INCLUDE "engine/menus/trainer_card.asm" INCLUDE "engine/menus/trainer_card.asm"
@ -144,6 +145,7 @@ 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/items/tmhm.asm" INCLUDE "engine/items/tmhm.asm"
INCLUDE "engine/pokemon/print_move_description.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"