From 193882bc77a84c088fdfe0f47c0311dfddaf29ed Mon Sep 17 00:00:00 2001 From: xCrystal Date: Sat, 23 Sep 2023 11:50:25 +0200 Subject: [PATCH] Constants for board menu gfx sizes (#11) --- charmap.asm | 5 +++-- constants/gfx_constants.asm | 4 ++++ engine/gfx/load_board_gfx.asm | 6 +++--- engine/gfx/load_overworld_font.asm | 2 +- engine/overworld/map_objects.asm | 12 ++++++------ engine/pokemon/mon_menu.asm | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/charmap.asm b/charmap.asm index 8101e54eb..2cfe7086c 100644 --- a/charmap.asm +++ b/charmap.asm @@ -183,7 +183,8 @@ popc ; Background tile equivalences (vTiles1) 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) -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 diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index c3709869f..ae84f528c 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -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_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) const_def 1 const HUD_OVERWORLD ; 1 diff --git a/engine/gfx/load_board_gfx.asm b/engine/gfx/load_board_gfx.asm index b3724d4ff..c76de68e2 100755 --- a/engine/gfx/load_board_gfx.asm +++ b/engine/gfx/load_board_gfx.asm @@ -1,11 +1,11 @@ LoadBoardMenuGFX:: ld de, .BoardMenuGFX 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 ld de, .BoardMenuOAMGFX 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 ret @@ -13,7 +13,7 @@ LoadBoardMenuGFX:: INCBIN "gfx/board/menu.2bpp" .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_party.2bpp" INCBIN "gfx/board/menu_pack.2bpp" diff --git a/engine/gfx/load_overworld_font.asm b/engine/gfx/load_overworld_font.asm index e7b28fcb7..e71c4d7e3 100644 --- a/engine/gfx/load_overworld_font.asm +++ b/engine/gfx/load_overworld_font.asm @@ -25,7 +25,7 @@ _LoadOverworldFontAndFrame:: RestoreOverworldFontOverBoardMenuGFX:: ld de, OverworldFontGFX ld hl, vTiles1 - lb bc, BANK(OverworldFontGFX), 18 * 3 + lb bc, BANK(OverworldFontGFX), TEXTBOX_INNERW * BOARD_MENU_ITEM_HEIGHT jp Get2bppViaHDMA OverworldFontGFX: diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 2423525bc..0ec067b70 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -3082,20 +3082,20 @@ InitSecondarySprites: ld hl, BoardMenuOAM ld a, [wBoardMenuCursorPosition] - ld bc, 3 * 3 * SPRITEOAMSTRUCT_LENGTH + ld bc, BOARD_MENU_ITEM_SIZE * SPRITEOAMSTRUCT_LENGTH 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] - 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 -; 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 d, HIGH(wShadowOAM) - ld bc, 3 * 3 * SPRITEOAMSTRUCT_LENGTH + ld bc, BOARD_MENU_ITEM_SIZE * SPRITEOAMSTRUCT_LENGTH call CopyBytes ldh a, [hUsedSpriteIndex] - add (3 * 3 * SPRITEOAMSTRUCT_LENGTH) + add (BOARD_MENU_ITEM_SIZE * SPRITEOAMSTRUCT_LENGTH) ldh [hUsedSpriteIndex], a .oam_full diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index 7972f7944..398fe8400 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -119,7 +119,7 @@ Party:: farcall WritePartyMenuTilemap farcall PlacePartyMenuText call WaitBGMap - call SetPalettes ; load regular palettes? + call SetPalettes call DelayFrame farcall PartyMenuSelect ret c ; if cancelled or pressed B