Separate data/mon_menu.asm

This commit is contained in:
Rangi 2018-01-23 10:46:26 -05:00
parent fc61d58dc4
commit 94ae404732
6 changed files with 134 additions and 117 deletions

View File

@ -8,6 +8,7 @@ PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE
PALRGB_WHITE EQUS "palred 31 + palgreen 31 + palblue 31" ; $7fff
SCREEN_WIDTH EQU 20 ; tiles
SCREEN_HEIGHT EQU 18 ; tiles
SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels
@ -18,11 +19,13 @@ BG_MAP_HEIGHT EQU 32 ; tiles
WMISC_WIDTH EQU 6 * 4
WMISC_HEIGHT EQU 5 * 4
HP_BAR_LENGTH EQU 6 ; tiles
EXP_BAR_LENGTH EQU 8 ; tiles
HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * TILE_WIDTH ; pixels
EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels
; sprite_oam_struct members (see macros/wram.asm)
const_def
const SPRITEOAMSTRUCT_YCOORD ; 0
@ -31,3 +34,16 @@ EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels
const SPRITEOAMSTRUCT_ATTRIBUTES ; 3
SPRITEOAMSTRUCT_LENGTH EQU const_value
NUM_SPRITE_OAM_STRUCTS EQU 40 ; see Sprites
; PokeAnims indexes (see engine/pic_animation.asm)
const_def
const ANIM_MON_SLOW
const ANIM_MON_NORMAL
const ANIM_MON_MENU
const ANIM_MON_TRADE
const ANIM_MON_EVOLVE
const ANIM_MON_HATCH
const ANIM_MON_UNUSED
const ANIM_MON_EGG1
const ANIM_MON_EGG2

View File

@ -31,3 +31,37 @@
shift_const SCROLLINGMENU_ENABLE_FUNCTION3
shift_const SCROLLINGMENU_ENABLE_START
shift_const SCROLLINGMENU_ENABLE_SELECT
; MonMenuOptions indexes (see data/mon_menu.asm)
; used by PokemonActionSubmenu (see engine/start_menu.asm)
const_value set 1
; moves
const MONMENUITEM_CUT ; 1
const MONMENUITEM_FLY ; 2
const MONMENUITEM_SURF ; 3
const MONMENUITEM_STRENGTH ; 4
const MONMENUITEM_WATERFALL ; 5
const MONMENUITEM_FLASH ; 6
const MONMENUITEM_WHIRLPOOL ; 7
const MONMENUITEM_DIG ; 8
const MONMENUITEM_TELEPORT ; 9
const MONMENUITEM_SOFTBOILED ; 10
const MONMENUITEM_HEADBUTT ; 11
const MONMENUITEM_ROCKSMASH ; 12
const MONMENUITEM_MILKDRINK ; 13
const MONMENUITEM_SWEETSCENT ; 14
; options
const MONMENUITEM_STATS ; 15
const MONMENUITEM_SWITCH ; 16
const MONMENUITEM_ITEM ; 17
const MONMENUITEM_CANCEL ; 18
const MONMENUITEM_MOVE ; 19
const MONMENUITEM_MAIL ; 20
const MONMENUITEM_ERROR ; 21
; MonMenuOptions categories
MONMENU_FIELD_MOVE EQU 0
MONMENU_MENUOPTION EQU 1
NUM_MONMENU_ITEMS EQU 8

View File

@ -142,52 +142,6 @@ const_value set 1
const ATK_EQ_DEF
; PokeAnims indexes (see engine/pic_animation.asm)
const_def
const ANIM_MON_SLOW
const ANIM_MON_NORMAL
const ANIM_MON_MENU
const ANIM_MON_TRADE
const ANIM_MON_EVOLVE
const ANIM_MON_HATCH
const ANIM_MON_UNUSED
const ANIM_MON_EGG1
const ANIM_MON_EGG2
; MonMenuOptions indexes (see engine/mon_menu.asm)
const_value set 1
; moves
const MONMENU_CUT ; 1
const MONMENU_FLY ; 2
const MONMENU_SURF ; 3
const MONMENU_STRENGTH ; 4
const MONMENU_WATERFALL ; 5
const MONMENU_FLASH ; 6
const MONMENU_WHIRLPOOL ; 7
const MONMENU_DIG ; 8
const MONMENU_TELEPORT ; 9
const MONMENU_SOFTBOILED ; 10
const MONMENU_HEADBUTT ; 11
const MONMENU_ROCKSMASH ; 12
const MONMENU_MILKDRINK ; 13
const MONMENU_SWEETSCENT ; 14
; options
const MONMENU_STATS ; 15
const MONMENU_SWITCH ; 16
const MONMENU_ITEM ; 17
const MONMENU_CANCEL ; 18
const MONMENU_MOVE ; 19
const MONMENU_MAIL ; 20
const MONMENU_ERROR ; 21
; MonMenuOptions types
MONMENU_FIELD_MOVE EQU 0
MONMENU_MENUOPTION EQU 1
NUM_MONMENU_ITEMS EQU 8
; wild data
NUM_GRASSMON EQU 7 ; data/wild/*_grass.asm table size

48
data/mon_menu.asm Normal file
View File

@ -0,0 +1,48 @@
; MonMenuOptionStrings indexes
const_value set 1
const MONMENUVALUE_STATS ; 1
const MONMENUVALUE_SWITCH ; 2
const MONMENUVALUE_ITEM ; 3
const MONMENUVALUE_CANCEL ; 4
const MONMENUVALUE_MOVE ; 5
const MONMENUVALUE_MAIL ; 6
const MONMENUVALUE_ERROR ; 7
MonMenuOptionStrings: ; 24caf
; entries correspond to MONMENUVALUE_* constants
db "STATS@"
db "SWITCH@"
db "ITEM@"
db "CANCEL@"
db "MOVE@"
db "MAIL@"
db "ERROR!@"
; 24cd9
MonMenuOptions: ; 24cd9
; category, item, value; actions are in PokemonActionSubmenu (see engine/start_menu.asm)
; moves
db MONMENU_FIELD_MOVE, MONMENUITEM_CUT, CUT
db MONMENU_FIELD_MOVE, MONMENUITEM_FLY, FLY
db MONMENU_FIELD_MOVE, MONMENUITEM_SURF, SURF
db MONMENU_FIELD_MOVE, MONMENUITEM_STRENGTH, STRENGTH
db MONMENU_FIELD_MOVE, MONMENUITEM_FLASH, FLASH
db MONMENU_FIELD_MOVE, MONMENUITEM_WATERFALL, WATERFALL
db MONMENU_FIELD_MOVE, MONMENUITEM_WHIRLPOOL, WHIRLPOOL
db MONMENU_FIELD_MOVE, MONMENUITEM_DIG, DIG
db MONMENU_FIELD_MOVE, MONMENUITEM_TELEPORT, TELEPORT
db MONMENU_FIELD_MOVE, MONMENUITEM_SOFTBOILED, SOFTBOILED
db MONMENU_FIELD_MOVE, MONMENUITEM_HEADBUTT, HEADBUTT
db MONMENU_FIELD_MOVE, MONMENUITEM_ROCKSMASH, ROCK_SMASH
db MONMENU_FIELD_MOVE, MONMENUITEM_MILKDRINK, MILK_DRINK
db MONMENU_FIELD_MOVE, MONMENUITEM_SWEETSCENT, SWEET_SCENT
; options
db MONMENU_MENUOPTION, MONMENUITEM_STATS, MONMENUVALUE_STATS
db MONMENU_MENUOPTION, MONMENUITEM_SWITCH, MONMENUVALUE_SWITCH
db MONMENU_MENUOPTION, MONMENUITEM_ITEM, MONMENUVALUE_ITEM
db MONMENU_MENUOPTION, MONMENUITEM_CANCEL, MONMENUVALUE_CANCEL
db MONMENU_MENUOPTION, MONMENUITEM_MOVE, MONMENUVALUE_MOVE
db MONMENU_MENUOPTION, MONMENUITEM_MAIL, MONMENUVALUE_MAIL
db MONMENU_MENUOPTION, MONMENUITEM_ERROR, MONMENUVALUE_ERROR
db -1
; 24d19

View File

@ -1,39 +1,4 @@
MonMenuOptionStrings: ; 24caf
db "STATS@"
db "SWITCH@"
db "ITEM@"
db "CANCEL@"
db "MOVE@"
db "MAIL@"
db "ERROR!@"
; 24cd9
MonMenuOptions: ; 24cd9
; moves
db MONMENU_FIELD_MOVE, MONMENU_CUT, CUT
db MONMENU_FIELD_MOVE, MONMENU_FLY, FLY
db MONMENU_FIELD_MOVE, MONMENU_SURF, SURF
db MONMENU_FIELD_MOVE, MONMENU_STRENGTH, STRENGTH
db MONMENU_FIELD_MOVE, MONMENU_FLASH, FLASH
db MONMENU_FIELD_MOVE, MONMENU_WATERFALL, WATERFALL
db MONMENU_FIELD_MOVE, MONMENU_WHIRLPOOL, WHIRLPOOL
db MONMENU_FIELD_MOVE, MONMENU_DIG, DIG
db MONMENU_FIELD_MOVE, MONMENU_TELEPORT, TELEPORT
db MONMENU_FIELD_MOVE, MONMENU_SOFTBOILED, SOFTBOILED
db MONMENU_FIELD_MOVE, MONMENU_HEADBUTT, HEADBUTT
db MONMENU_FIELD_MOVE, MONMENU_ROCKSMASH, ROCK_SMASH
db MONMENU_FIELD_MOVE, MONMENU_MILKDRINK, MILK_DRINK
db MONMENU_FIELD_MOVE, MONMENU_SWEETSCENT, SWEET_SCENT
; options
db MONMENU_MENUOPTION, MONMENU_STATS, 1 ; STATS
db MONMENU_MENUOPTION, MONMENU_SWITCH, 2 ; SWITCH
db MONMENU_MENUOPTION, MONMENU_ITEM, 3 ; ITEM
db MONMENU_MENUOPTION, MONMENU_CANCEL, 4 ; CANCEL
db MONMENU_MENUOPTION, MONMENU_MOVE, 5 ; MOVE
db MONMENU_MENUOPTION, MONMENU_MAIL, 6 ; MAIL
db MONMENU_MENUOPTION, MONMENU_ERROR, 7 ; ERROR!
db -1
; 24d19
INCLUDE "data/mon_menu.asm"
MonSubmenu: ; 24d19
xor a
@ -95,7 +60,7 @@ MonMenuLoop: ; 24d59
jr .loop
.cancel
ld a, MONMENU_CANCEL ; CANCEL
ld a, MONMENUITEM_CANCEL
ret
.select
@ -111,7 +76,7 @@ MonMenuLoop: ; 24d59
PopulateMonMenu: ; 24d91
call MenuBoxCoord2Tile
ld bc, $2a ; 42
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
ld de, Buffer2
.loop
@ -124,7 +89,7 @@ PopulateMonMenu: ; 24d91
call GetMonMenuString
pop hl
call PlaceString
ld bc, $28 ; 40
ld bc, 2 * SCREEN_WIDTH
add hl, bc
pop de
jr .loop
@ -136,7 +101,7 @@ GetMonMenuString: ; 24db0
call IsInArray
dec hl
ld a, [hli]
cp 1
cp MONMENU_MENUOPTION
jr z, .NotMove
inc hl
ld a, [hl]
@ -188,11 +153,11 @@ GetMonSubmenuItems: ; 24dd4
jr nz, .loop
.skip_moves
ld a, MONMENU_STATS
ld a, MONMENUITEM_STATS
call AddMonMenuItem
ld a, MONMENU_SWITCH
ld a, MONMENUITEM_SWITCH
call AddMonMenuItem
ld a, MONMENU_MOVE
ld a, MONMENUITEM_MOVE
call AddMonMenuItem
ld a, [wLinkMode]
and a
@ -203,9 +168,9 @@ GetMonSubmenuItems: ; 24dd4
ld d, [hl]
farcall ItemIsMail
pop hl
ld a, MONMENU_MAIL
ld a, MONMENUITEM_MAIL
jr c, .ok
ld a, MONMENU_ITEM
ld a, MONMENUITEM_ITEM
.ok
call AddMonMenuItem
@ -214,7 +179,7 @@ GetMonSubmenuItems: ; 24dd4
ld a, [Buffer1]
cp NUM_MONMENU_ITEMS
jr z, .ok2
ld a, MONMENU_CANCEL
ld a, MONMENUITEM_CANCEL
call AddMonMenuItem
.ok2
@ -222,11 +187,11 @@ GetMonSubmenuItems: ; 24dd4
ret
.egg
ld a, MONMENU_STATS
ld a, MONMENUITEM_STATS
call AddMonMenuItem
ld a, MONMENU_SWITCH
ld a, MONMENUITEM_SWITCH
call AddMonMenuItem
ld a, MONMENU_CANCEL
ld a, MONMENUITEM_CANCEL
call AddMonMenuItem
call TerminateMonSubmenu
ret
@ -265,7 +230,7 @@ ResetMonSubmenu: ; 24e68
TerminateMonSubmenu: ; 24e76
ld a, [Buffer1]
ld e, a
ld d, $0
ld d, 0
ld hl, Buffer2
add hl, de
ld [hl], -1
@ -280,7 +245,7 @@ AddMonMenuItem: ; 24e83
ld e, a
inc a
ld [Buffer1], a
ld d, $0
ld d, 0
ld hl, Buffer2
add hl, de
pop af

View File

@ -729,26 +729,26 @@ PokemonActionSubmenu: ; 12a88
ret
.Actions:
dbw MONMENU_CUT, MonMenu_Cut
dbw MONMENU_FLY, MonMenu_Fly
dbw MONMENU_SURF, MonMenu_Surf
dbw MONMENU_STRENGTH, MonMenu_Strength
dbw MONMENU_FLASH, MonMenu_Flash
dbw MONMENU_WHIRLPOOL, MonMenu_Whirlpool
dbw MONMENU_DIG, MonMenu_Dig
dbw MONMENU_TELEPORT, MonMenu_Teleport
dbw MONMENU_SOFTBOILED, MonMenu_Softboiled_MilkDrink
dbw MONMENU_MILKDRINK, MonMenu_Softboiled_MilkDrink
dbw MONMENU_HEADBUTT, MonMenu_Headbutt
dbw MONMENU_WATERFALL, MonMenu_Waterfall
dbw MONMENU_ROCKSMASH, MonMenu_RockSmash
dbw MONMENU_SWEETSCENT, MonMenu_SweetScent
dbw MONMENU_STATS, OpenPartyStats
dbw MONMENU_SWITCH, SwitchPartyMons
dbw MONMENU_ITEM, GiveTakePartyMonItem
dbw MONMENU_CANCEL, CancelPokemonAction
dbw MONMENU_MOVE, ManagePokemonMoves
dbw MONMENU_MAIL, MonMailAction
dbw MONMENUITEM_CUT, MonMenu_Cut
dbw MONMENUITEM_FLY, MonMenu_Fly
dbw MONMENUITEM_SURF, MonMenu_Surf
dbw MONMENUITEM_STRENGTH, MonMenu_Strength
dbw MONMENUITEM_FLASH, MonMenu_Flash
dbw MONMENUITEM_WHIRLPOOL, MonMenu_Whirlpool
dbw MONMENUITEM_DIG, MonMenu_Dig
dbw MONMENUITEM_TELEPORT, MonMenu_Teleport
dbw MONMENUITEM_SOFTBOILED, MonMenu_Softboiled_MilkDrink
dbw MONMENUITEM_MILKDRINK, MonMenu_Softboiled_MilkDrink
dbw MONMENUITEM_HEADBUTT, MonMenu_Headbutt
dbw MONMENUITEM_WATERFALL, MonMenu_Waterfall
dbw MONMENUITEM_ROCKSMASH, MonMenu_RockSmash
dbw MONMENUITEM_SWEETSCENT, MonMenu_SweetScent
dbw MONMENUITEM_STATS, OpenPartyStats
dbw MONMENUITEM_SWITCH, SwitchPartyMons
dbw MONMENUITEM_ITEM, GiveTakePartyMonItem
dbw MONMENUITEM_CANCEL, CancelPokemonAction
dbw MONMENUITEM_MOVE, ManagePokemonMoves
dbw MONMENUITEM_MAIL, MonMailAction
; 12aec