Constants for board menu gfx sizes (#11)

This commit is contained in:
xCrystal 2023-09-23 11:50:25 +02:00
parent ca919cdf98
commit 193882bc77
6 changed files with 18 additions and 13 deletions

View File

@ -186,4 +186,5 @@ DEF OVERWORLD_FRAME_FIRST_TILE EQU "┌"
DEF BOARD_MENU_BG_FIRST_TILE EQU "A" DEF BOARD_MENU_BG_FIRST_TILE EQU "A"
; Object tile locations (vTiles0) ; Object tile locations (vTiles0)
DEF BOARD_MENU_OAM_FIRST_TILE EQU $20 DEF SECONDARY_SPRITES_FIRST_TILE EQU $20
DEF BOARD_MENU_OAM_FIRST_TILE EQU SECONDARY_SPRITES_FIRST_TILE

View File

@ -59,6 +59,10 @@ DEF SPRITE_GFX_LIST_CAPACITY EQU 1 + WALKING_SPRITE_GFX_LIST_CAPACITY + STILL_SP
const ANIM_MON_EGG1 const ANIM_MON_EGG1
const ANIM_MON_EGG2 const ANIM_MON_EGG2
BOARD_MENU_ITEM_WIDTH EQU 3
BOARD_MENU_ITEM_HEIGHT EQU 3
BOARD_MENU_ITEM_SIZE EQU BOARD_MENU_ITEM_WIDTH * BOARD_MENU_ITEM_HEIGHT
; LoadHUD indexes (see engine/gfx/hud.asm) ; LoadHUD indexes (see engine/gfx/hud.asm)
const_def 1 const_def 1
const HUD_OVERWORLD ; 1 const HUD_OVERWORLD ; 1

View File

@ -1,11 +1,11 @@
LoadBoardMenuGFX:: LoadBoardMenuGFX::
ld de, .BoardMenuGFX ld de, .BoardMenuGFX
ld hl, vTiles0 + BOARD_MENU_BG_FIRST_TILE * LEN_2BPP_TILE ld hl, vTiles0 + BOARD_MENU_BG_FIRST_TILE * LEN_2BPP_TILE
lb bc, BANK(.BoardMenuGFX), 18 * 3 lb bc, BANK(.BoardMenuGFX), TEXTBOX_INNERW * BOARD_MENU_ITEM_HEIGHT
call Get2bppViaHDMA call Get2bppViaHDMA
ld de, .BoardMenuOAMGFX ld de, .BoardMenuOAMGFX
ld hl, vTiles0 + BOARD_MENU_OAM_FIRST_TILE * LEN_2BPP_TILE ld hl, vTiles0 + BOARD_MENU_OAM_FIRST_TILE * LEN_2BPP_TILE
lb bc, BANK(.BoardMenuOAMGFX), 3 * 3 * NUM_BOARD_MENU_ITEMS lb bc, BANK(.BoardMenuOAMGFX), BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS
call Get2bppViaHDMA call Get2bppViaHDMA
ret ret
@ -13,7 +13,7 @@ LoadBoardMenuGFX::
INCBIN "gfx/board/menu.2bpp" INCBIN "gfx/board/menu.2bpp"
.BoardMenuOAMGFX: .BoardMenuOAMGFX:
table_width 3 * 3 * LEN_2BPP_TILE, .BoardMenuOAMGFX table_width BOARD_MENU_ITEM_SIZE * LEN_2BPP_TILE, .BoardMenuOAMGFX
INCBIN "gfx/board/menu_die.2bpp" INCBIN "gfx/board/menu_die.2bpp"
INCBIN "gfx/board/menu_party.2bpp" INCBIN "gfx/board/menu_party.2bpp"
INCBIN "gfx/board/menu_pack.2bpp" INCBIN "gfx/board/menu_pack.2bpp"

View File

@ -25,7 +25,7 @@ _LoadOverworldFontAndFrame::
RestoreOverworldFontOverBoardMenuGFX:: RestoreOverworldFontOverBoardMenuGFX::
ld de, OverworldFontGFX ld de, OverworldFontGFX
ld hl, vTiles1 ld hl, vTiles1
lb bc, BANK(OverworldFontGFX), 18 * 3 lb bc, BANK(OverworldFontGFX), TEXTBOX_INNERW * BOARD_MENU_ITEM_HEIGHT
jp Get2bppViaHDMA jp Get2bppViaHDMA
OverworldFontGFX: OverworldFontGFX:

View File

@ -3082,20 +3082,20 @@ InitSecondarySprites:
ld hl, BoardMenuOAM ld hl, BoardMenuOAM
ld a, [wBoardMenuCursorPosition] ld a, [wBoardMenuCursorPosition]
ld bc, 3 * 3 * SPRITEOAMSTRUCT_LENGTH ld bc, BOARD_MENU_ITEM_SIZE * SPRITEOAMSTRUCT_LENGTH
call AddNTimes call AddNTimes
; find the beginning of free space in OAM, and assure there's space for 3 * 3 objects ; find the beginning of free space in OAM, and assure there's space for a BOARD_MENU_ITEM_SIZE object
ldh a, [hUsedSpriteIndex] ldh a, [hUsedSpriteIndex]
cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (3 * 3 * SPRITEOAMSTRUCT_LENGTH) + 1 cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (BOARD_MENU_ITEM_SIZE * SPRITEOAMSTRUCT_LENGTH) + 1
jr nc, .oam_full jr nc, .oam_full
; copy the sprite data (3 * 3 objects) of that item to the available space in OAM ; copy the sprite data (BOARD_MENU_ITEM_SIZE objects) of that item to the available space in OAM
ld e, a ld e, a
ld d, HIGH(wShadowOAM) ld d, HIGH(wShadowOAM)
ld bc, 3 * 3 * SPRITEOAMSTRUCT_LENGTH ld bc, BOARD_MENU_ITEM_SIZE * SPRITEOAMSTRUCT_LENGTH
call CopyBytes call CopyBytes
ldh a, [hUsedSpriteIndex] ldh a, [hUsedSpriteIndex]
add (3 * 3 * SPRITEOAMSTRUCT_LENGTH) add (BOARD_MENU_ITEM_SIZE * SPRITEOAMSTRUCT_LENGTH)
ldh [hUsedSpriteIndex], a ldh [hUsedSpriteIndex], a
.oam_full .oam_full

View File

@ -119,7 +119,7 @@ Party::
farcall WritePartyMenuTilemap farcall WritePartyMenuTilemap
farcall PlacePartyMenuText farcall PlacePartyMenuText
call WaitBGMap call WaitBGMap
call SetPalettes ; load regular palettes? call SetPalettes
call DelayFrame call DelayFrame
farcall PartyMenuSelect farcall PartyMenuSelect
ret c ; if cancelled or pressed B ret c ; if cancelled or pressed B