mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Board menu (#11) [Commit 1]
This commit is contained in:
parent
c405c955ba
commit
1f33436a64
@ -111,3 +111,12 @@ DEF NUM_PARTYMENUACTIONS EQU const_value
|
|||||||
const NAME_6 ; duplicate of NAME_MON
|
const NAME_6 ; duplicate of NAME_MON
|
||||||
const NAME_7 ; duplicate of NAME_MON
|
const NAME_7 ; duplicate of NAME_MON
|
||||||
DEF NUM_NAME_TYPES EQU const_value
|
DEF NUM_NAME_TYPES EQU const_value
|
||||||
|
|
||||||
|
; Board menu items (see engine/board/menu.asm)
|
||||||
|
const_def
|
||||||
|
const BOARDMENUITEM_DIE
|
||||||
|
const BOARDMENUITEM_POKEMON
|
||||||
|
const BOARDMENUITEM_BAG
|
||||||
|
const BOARDMENUITEM_POKEGEAR
|
||||||
|
const BOARDMENUITEM_EXIT
|
||||||
|
DEF NUM_BOARD_MENU_ITEMS EQU const_value
|
@ -19,7 +19,7 @@ DEF NUM_SPRITEDATA_FIELDS EQU _RS
|
|||||||
const PAL_OW_BLUE ; 1
|
const PAL_OW_BLUE ; 1
|
||||||
const PAL_OW_GREEN ; 2
|
const PAL_OW_GREEN ; 2
|
||||||
const PAL_OW_BROWN ; 3
|
const PAL_OW_BROWN ; 3
|
||||||
const PAL_OW_PINK ; 4
|
const PAL_OW_MISC ; 4
|
||||||
const PAL_OW_EMOTE ; 5
|
const PAL_OW_EMOTE ; 5
|
||||||
const PAL_OW_TREE ; 6
|
const PAL_OW_TREE ; 6
|
||||||
const PAL_OW_ROCK ; 7
|
const PAL_OW_ROCK ; 7
|
||||||
|
74
engine/board/menu.asm
Executable file
74
engine/board/menu.asm
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
DEF BOARD_MENU_BG_FIRST_TILE EQU "A"
|
||||||
|
DEF BOARD_MENU_OAM_FIRST_TILE EQU BOARD_MENU_BG_FIRST_TILE + 18 * 3
|
||||||
|
|
||||||
|
BoardMenu::
|
||||||
|
; returns the selected menu item (BOARDMENUITEM_*) in wScriptVar upon exit
|
||||||
|
ld a, [wBoardMenuLastCursorPosition]
|
||||||
|
ld [wBoardMenuCursorPosition], a
|
||||||
|
farcall LoadBoardMenuGFX
|
||||||
|
call DrawBoardMenuTiles
|
||||||
|
call ApplyTilemap
|
||||||
|
call UpdateSprites
|
||||||
|
; draw board menu OAM after overworld sprites
|
||||||
|
call DrawBoardMenuOAM
|
||||||
|
|
||||||
|
.loop
|
||||||
|
call GetBoardMenuSelection
|
||||||
|
jr c, .done
|
||||||
|
ld hl, wBoardMenuCursorPosition
|
||||||
|
ld a, [wBoardMenuLastCursorPosition]
|
||||||
|
cp [hl]
|
||||||
|
jr z, .loop
|
||||||
|
|
||||||
|
; menu item change: refresh board menu OAM and save cursor position
|
||||||
|
call DrawBoardMenuOAM
|
||||||
|
ld a, [wBoardMenuCursorPosition]
|
||||||
|
ld [wBoardMenuLastCursorPosition], a
|
||||||
|
jr .loop
|
||||||
|
|
||||||
|
.done
|
||||||
|
ld a, [wBoardMenuCursorPosition]
|
||||||
|
ld [wScriptVar], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
DrawBoardMenuTiles:
|
||||||
|
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
|
||||||
|
ld a, BOARD_MENU_BG_FIRST_TILE
|
||||||
|
lb bc, 3, 18
|
||||||
|
jp FillBoxWithConsecutiveBytes
|
||||||
|
|
||||||
|
DrawBoardMenuOAM:
|
||||||
|
ld hl, BoardMenuItemPals
|
||||||
|
ld a, [wBoardMenuLastCursorPosition]
|
||||||
|
ld bc, PALETTE_SIZE
|
||||||
|
call AddNTimes
|
||||||
|
; set wOBPals2 directly rather than wOBPals1 to avoid calling ApplyPals and overwriting other overworld pals
|
||||||
|
ld de, wOBPals2 palette PAL_OW_MISC
|
||||||
|
ld bc, PALETTE_SIZE
|
||||||
|
ld a, BANK(wOBPals2)
|
||||||
|
call FarCopyWRAM
|
||||||
|
|
||||||
|
ld hl, .OAM
|
||||||
|
ld a, [wBoardMenuCursorPosition]
|
||||||
|
ld bc, 3 * 3 * SPRITEOAMSTRUCT_LENGTH
|
||||||
|
call AddNTimes
|
||||||
|
; find the beginning of free space in OAM, and assure there's space for 3 * 3 objects
|
||||||
|
ldh a, [hUsedSpriteIndex]
|
||||||
|
cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (3 * 3 * SPRITEOAMSTRUCT_LENGTH)
|
||||||
|
jr nc, .oam_full
|
||||||
|
; copy the sprite data (3 * 3 objects) of that item to the available space in OAM
|
||||||
|
ld e, a
|
||||||
|
ld d, HIGH(wShadowOAM)
|
||||||
|
ld bc, 3 * 3 * SPRITEOAMSTRUCT_LENGTH
|
||||||
|
call CopyBytes
|
||||||
|
.oam_full
|
||||||
|
ret
|
||||||
|
|
||||||
|
.OAM:
|
||||||
|
|
||||||
|
GetBoardMenuSelection:
|
||||||
|
scf
|
||||||
|
ret
|
||||||
|
|
||||||
|
BoardMenuItemPals:
|
||||||
|
INCLUDE "gfx/board/menu.pal"
|
22
engine/gfx/load_board_gfx.asm
Executable file
22
engine/gfx/load_board_gfx.asm
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
LoadBoardMenuGFX::
|
||||||
|
ld de, .BoardMenuGFX
|
||||||
|
ld hl, vTiles1
|
||||||
|
lb bc, BANK(.BoardMenuGFX), 18 * 3
|
||||||
|
call Get2bppViaHDMA
|
||||||
|
ld de, .BoardMenuOAMGFX
|
||||||
|
ld hl, vTiles1 + (18 * 3) * LEN_2BPP_TILE
|
||||||
|
lb bc, BANK(.BoardMenuOAMGFX), 3 * 3 * NUM_BOARD_MENU_ITEMS
|
||||||
|
call Get2bppViaHDMA
|
||||||
|
ret
|
||||||
|
|
||||||
|
.BoardMenuGFX:
|
||||||
|
INCBIN "gfx/board/menu.2bpp"
|
||||||
|
|
||||||
|
.BoardMenuOAMGFX:
|
||||||
|
table_width 3 * 3 * LEN_2BPP_TILE, .BoardMenuOAMGFX
|
||||||
|
INCBIN "gfx/board/menu_die.2bpp"
|
||||||
|
INCBIN "gfx/board/menu_pokemon.2bpp"
|
||||||
|
INCBIN "gfx/board/menu_bag.2bpp"
|
||||||
|
INCBIN "gfx/board/menu_pokegear.2bpp"
|
||||||
|
INCBIN "gfx/board/menu_exit.2bpp"
|
||||||
|
assert_table_length NUM_BOARD_MENU_ITEMS
|
@ -14,8 +14,8 @@
|
|||||||
const OW_TEXTBOX_FRAME_RIGHT_2
|
const OW_TEXTBOX_FRAME_RIGHT_2
|
||||||
const OW_TEXTBOX_FRAME_BACKGROUND
|
const OW_TEXTBOX_FRAME_BACKGROUND
|
||||||
|
|
||||||
OW_TEXTBOX_FRAME_MIN_HEIGHT EQU 4
|
DEF OW_TEXTBOX_FRAME_MIN_HEIGHT EQU 4
|
||||||
OW_TEXTBOX_FRAME_MIN_WIDTH EQU 6
|
DEF OW_TEXTBOX_FRAME_MIN_WIDTH EQU 6
|
||||||
|
|
||||||
_OverworldTextbox::
|
_OverworldTextbox::
|
||||||
; Draw a textbox at de with room for b rows and c columns using the 2bpp overworld frame tiles.
|
; Draw a textbox at de with room for b rows and c columns using the 2bpp overworld frame tiles.
|
||||||
|
@ -27,7 +27,7 @@ StartMenu::
|
|||||||
.GotMenuData:
|
.GotMenuData:
|
||||||
call LoadMenuHeader
|
call LoadMenuHeader
|
||||||
call .SetUpMenuItems
|
call .SetUpMenuItems
|
||||||
ld a, [wBattleMenuCursorPosition]
|
ld a, [wStartMenuLastCursorPosition]
|
||||||
ld [wMenuCursorPosition], a
|
ld [wMenuCursorPosition], a
|
||||||
call .DrawMenuAccount
|
call .DrawMenuAccount
|
||||||
call DrawVariableLengthMenuBox
|
call DrawVariableLengthMenuBox
|
||||||
@ -43,7 +43,7 @@ StartMenu::
|
|||||||
call UpdateSprites
|
call UpdateSprites
|
||||||
call UpdateTimePals
|
call UpdateTimePals
|
||||||
call .SetUpMenuItems
|
call .SetUpMenuItems
|
||||||
ld a, [wBattleMenuCursorPosition]
|
ld a, [wStartMenuLastCursorPosition]
|
||||||
ld [wMenuCursorPosition], a
|
ld [wMenuCursorPosition], a
|
||||||
|
|
||||||
.Select:
|
.Select:
|
||||||
@ -51,7 +51,7 @@ StartMenu::
|
|||||||
jr c, .Exit
|
jr c, .Exit
|
||||||
call ._DrawMenuAccount
|
call ._DrawMenuAccount
|
||||||
ld a, [wMenuCursorPosition]
|
ld a, [wMenuCursorPosition]
|
||||||
ld [wBattleMenuCursorPosition], a
|
ld [wStartMenuLastCursorPosition], a
|
||||||
call PlayClickSFX
|
call PlayClickSFX
|
||||||
call PlaceHollowCursor
|
call PlaceHollowCursor
|
||||||
call .OpenMenu
|
call .OpenMenu
|
||||||
|
29
gfx/board/menu.pal
Executable file
29
gfx/board/menu.pal
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
; item 1 (BOARDMENUITEM_DIE)
|
||||||
|
RGB 31, 31, 31
|
||||||
|
RGB 10, 10, 31
|
||||||
|
RGB 00, 00, 21
|
||||||
|
RGB 00, 00, 00
|
||||||
|
|
||||||
|
; item 2 (BOARDMENUITEM_POKEMON)
|
||||||
|
RGB 31, 31, 31
|
||||||
|
RGB 31, 26, 26
|
||||||
|
RGB 30, 00, 00
|
||||||
|
RGB 00, 00, 00
|
||||||
|
|
||||||
|
; item 3 (BOARDMENUITEM_BAG)
|
||||||
|
RGB 31, 31, 31
|
||||||
|
RGB 10, 31, 10
|
||||||
|
RGB 00, 21, 10
|
||||||
|
RGB 00, 00, 00
|
||||||
|
|
||||||
|
; item 4 (BOARDMENUITEM_POKEGEAR)
|
||||||
|
RGB 31, 31, 31
|
||||||
|
RGB 21, 21, 09
|
||||||
|
RGB 11, 11, 00
|
||||||
|
RGB 00, 00, 00
|
||||||
|
|
||||||
|
; item 5 (BOARDMENUITEM_EXIT)
|
||||||
|
RGB 31, 31, 31
|
||||||
|
RGB 20, 20, 00
|
||||||
|
RGB 10, 10, 00
|
||||||
|
RGB 00, 00, 00
|
BIN
gfx/board/menu.png
Executable file
BIN
gfx/board/menu.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 994 B |
BIN
gfx/board/menu_bag.png
Executable file
BIN
gfx/board/menu_bag.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 369 B |
BIN
gfx/board/menu_die.png
Executable file
BIN
gfx/board/menu_die.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 377 B |
BIN
gfx/board/menu_exit.png
Executable file
BIN
gfx/board/menu_exit.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 273 B |
BIN
gfx/board/menu_pokegear.png
Executable file
BIN
gfx/board/menu_pokegear.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 374 B |
BIN
gfx/board/menu_pokemon.png
Executable file
BIN
gfx/board/menu_pokemon.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 361 B |
@ -19,6 +19,23 @@ FillBoxWithByte::
|
|||||||
jr nz, .row
|
jr nz, .row
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
FillBoxWithConsecutiveBytes::
|
||||||
|
.row
|
||||||
|
push bc
|
||||||
|
push hl
|
||||||
|
.col
|
||||||
|
ld [hli], a
|
||||||
|
inc a
|
||||||
|
dec c
|
||||||
|
jr nz, .col
|
||||||
|
pop hl
|
||||||
|
ld bc, SCREEN_WIDTH
|
||||||
|
add hl, bc
|
||||||
|
pop bc
|
||||||
|
dec b
|
||||||
|
jr nz, .row
|
||||||
|
ret
|
||||||
|
|
||||||
ClearTilemap::
|
ClearTilemap::
|
||||||
; Fill wTilemap with blank tiles.
|
; Fill wTilemap with blank tiles.
|
||||||
|
|
||||||
|
@ -79,6 +79,8 @@ ROMX $14
|
|||||||
"Unused Egg Pic"
|
"Unused Egg Pic"
|
||||||
ROMX $15
|
ROMX $15
|
||||||
"Map Scripts 1"
|
"Map Scripts 1"
|
||||||
|
ROMX $1e
|
||||||
|
"Board 1"
|
||||||
ROMX $20
|
ROMX $20
|
||||||
"bank20"
|
"bank20"
|
||||||
ROMX $21
|
ROMX $21
|
||||||
|
5
main.asm
5
main.asm
@ -232,6 +232,10 @@ INCLUDE "data/pokemon/base_stats.asm"
|
|||||||
INCLUDE "data/pokemon/names.asm"
|
INCLUDE "data/pokemon/names.asm"
|
||||||
INCLUDE "data/pokemon/unused_pic_banks.asm"
|
INCLUDE "data/pokemon/unused_pic_banks.asm"
|
||||||
|
|
||||||
|
SECTION "Board 1", ROMX
|
||||||
|
|
||||||
|
INCLUDE "engine/board/menu.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "bank20", ROMX
|
SECTION "bank20", ROMX
|
||||||
|
|
||||||
@ -386,6 +390,7 @@ INCLUDE "engine/overworld/warp_connection.asm"
|
|||||||
INCLUDE "engine/battle/used_move_text.asm"
|
INCLUDE "engine/battle/used_move_text.asm"
|
||||||
INCLUDE "engine/gfx/load_overworld_font.asm"
|
INCLUDE "engine/gfx/load_overworld_font.asm"
|
||||||
INCLUDE "engine/gfx/overworld_textbox.asm"
|
INCLUDE "engine/gfx/overworld_textbox.asm"
|
||||||
|
INCLUDE "engine/gfx/load_board_gfx.asm"
|
||||||
|
|
||||||
|
|
||||||
SECTION "Title", ROMX
|
SECTION "Title", ROMX
|
||||||
|
@ -12,9 +12,14 @@ Level1_Map1_MapScripts:
|
|||||||
|
|
||||||
PlayersHouseDoll1Script::
|
PlayersHouseDoll1Script::
|
||||||
opentext
|
opentext
|
||||||
|
callasm .BoardMenu
|
||||||
|
waitbutton
|
||||||
pokemart MARTTYPE_STANDARD, MART_AZALEA
|
pokemart MARTTYPE_STANDARD, MART_AZALEA
|
||||||
closetext
|
closetext
|
||||||
end
|
end
|
||||||
|
.BoardMenu:
|
||||||
|
farcall BoardMenu
|
||||||
|
ret
|
||||||
; describedecoration DECODESC_LEFT_DOLL
|
; describedecoration DECODESC_LEFT_DOLL
|
||||||
|
|
||||||
PlayersHouseDoll2Script:
|
PlayersHouseDoll2Script:
|
||||||
@ -132,4 +137,4 @@ Level1_Map1_MapEvents:
|
|||||||
object_event 4, 4, SPRITE_DOLL_1, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, PlayersHouseDoll1Script, -1
|
object_event 4, 4, SPRITE_DOLL_1, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, PlayersHouseDoll1Script, -1
|
||||||
object_event 5, 4, SPRITE_DOLL_2, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, PlayersHouseDoll2Script, -1
|
object_event 5, 4, SPRITE_DOLL_2, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, PlayersHouseDoll2Script, -1
|
||||||
object_event 0, 1, SPRITE_BIG_DOLL, SPRITEMOVEDATA_BIGDOLL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, PlayersHouseBigDollScript, -1
|
object_event 0, 1, SPRITE_BIG_DOLL, SPRITEMOVEDATA_BIGDOLL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, PlayersHouseBigDollScript, -1
|
||||||
object_event 6, 6, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 1, TrainerYoungsterMikey, -1
|
object_event 6, 6, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 1, TrainerYoungsterMikey, -1
|
||||||
|
10
ram/wram.asm
10
ram/wram.asm
@ -1160,6 +1160,11 @@ wMenuData_ItemsPointerAddr:: dw
|
|||||||
wMenuData_ScrollingMenuFunction1:: ds 3
|
wMenuData_ScrollingMenuFunction1:: ds 3
|
||||||
wMenuData_ScrollingMenuFunction2:: ds 3
|
wMenuData_ScrollingMenuFunction2:: ds 3
|
||||||
wMenuData_ScrollingMenuFunction3:: ds 3
|
wMenuData_ScrollingMenuFunction3:: ds 3
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
; Board Menu
|
||||||
|
wBoardMenuCursorPosition:: db
|
||||||
|
|
||||||
ENDU
|
ENDU
|
||||||
wMenuDataEnd::
|
wMenuDataEnd::
|
||||||
|
|
||||||
@ -1663,7 +1668,10 @@ wStringBuffer3:: ds STRING_BUFFER_LENGTH
|
|||||||
wStringBuffer4:: ds STRING_BUFFER_LENGTH
|
wStringBuffer4:: ds STRING_BUFFER_LENGTH
|
||||||
wStringBuffer5:: ds STRING_BUFFER_LENGTH
|
wStringBuffer5:: ds STRING_BUFFER_LENGTH
|
||||||
|
|
||||||
wBattleMenuCursorPosition:: db
|
wBattleMenuCursorPosition::
|
||||||
|
wStartMenuLastCursorPosition::
|
||||||
|
wBoardMenuLastCursorPosition::
|
||||||
|
db
|
||||||
|
|
||||||
wCurBattleMon::
|
wCurBattleMon::
|
||||||
; index of the player's mon currently in battle (0-5)
|
; index of the player's mon currently in battle (0-5)
|
||||||
|
Loading…
Reference in New Issue
Block a user