diff --git a/charmap.asm b/charmap.asm index a3980cf1f..1732c6d62 100644 --- a/charmap.asm +++ b/charmap.asm @@ -181,17 +181,25 @@ pushc charmap "\r", $0d popc -; Background tile equivalences (vTiles1) +;; Background tile equivalences (vTiles1) DEF OVERWORLD_FRAME_FIRST_TILE EQU "┌" DEF BOARD_MENU_BG_FIRST_TILE EQU "A" -; Object tile locations (vTiles0) -DEF SECONDARY_SPRITES_FIRST_TILE EQU $20 +;; Object tile locations (vTiles0) +DEF SECONDARY_SPRITES_FIRST_TILE EQU $20 -DEF BOARD_MENU_OAM_FIRST_TILE EQU SECONDARY_SPRITES_FIRST_TILE -DEF DIE_ROLL_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE + 45 ; max(BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS, DIE_SIZE * 10) -DEF DIE_NUMBERS_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE +; Menu and overworld +DEF BOARD_MENU_OAM_FIRST_TILE EQU SECONDARY_SPRITES_FIRST_TILE +DEF DIE_ROLL_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE + 45 ; max(BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS, DIE_SIZE * 10) +DEF DIE_NUMBERS_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE -DEF BRANCH_ARROWS_OAM_FIRST_TILE EQU DIE_NUMBERS_OAM_FIRST_TILE + 40 ; DIE_NUMBER_SIZE * 10 +; Branch space +DEF BRANCH_ARROWS_OAM_FIRST_TILE EQU DIE_NUMBERS_OAM_FIRST_TILE + 40 ; DIE_NUMBER_SIZE * 10 +DEF BRANCH_LEGEND_OAM_FIRST_TILE EQU BRANCH_ARROWS_OAM_FIRST_TILE + 4 ; BRANCH_ARROWS_OAM_FIRST_TILE + NUM_DIRECTIONS -DEF VIEW_MAP_MODE_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE + 45 ; max(BRANCH_ARROWS_OAM_FIRST_TILE + NUM_DIRECTIONS, BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS) +; View map mode (from overworld or from branch space) +DEF VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE EQU BOARD_MENU_OAM_FIRST_TILE + 45 ; max(BRANCH_ARROWS_OAM_FIRST_TILE + NUM_DIRECTIONS, BOARD_MENU_ITEM_SIZE * NUM_BOARD_MENU_ITEMS) +DEF VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE EQU VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE + 4 ; VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE + NUM_DIRECTIONS + +; Talker event +DEF TALKER_EVENT_LEGEND_OAM_FIRST_TILE EQU DIE_NUMBERS_OAM_FIRST_TILE + 40 ; DIE_NUMBER_SIZE * 10 diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index f146803ad..337319949 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -8,11 +8,12 @@ DEF AUTO_INPUT EQU $ff ; wDisplaySecondarySprites const_def - const SECONDARYSPRITES_BOARD_MENU_F ; 0 + const SECONDARYSPRITES_BOARD_MENU_F ; 0 const SECONDARYSPRITES_DIE_ROLL_F ; 1 const SECONDARYSPRITES_SPACES_LEFT_F ; 2 - const SECONDARYSPRITES_BRANCH_ARROWS_F ; 3 + const SECONDARYSPRITES_BRANCH_SPACE_F ; 3 const SECONDARYSPRITES_VIEW_MAP_MODE_F ; 4 + const SECONDARYSPRITES_TALKER_EVENT_F ; 5 ; wCurDexMode:: const_def diff --git a/data/sprites/secondary_sprites.asm b/data/sprites/secondary_sprites.asm index d61ba844a..2b2acfe51 100644 --- a/data/sprites/secondary_sprites.asm +++ b/data/sprites/secondary_sprites.asm @@ -1,3 +1,45 @@ +; OAM tile grid +/* + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 2 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 3 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 4 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 5 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 6 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 7 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 8 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | | 9 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |10 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |11 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |12 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |13 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |14 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |15 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |16 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |17 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |18 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| | | | | | | | | | | | | | | | | | | | |19 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +*/ + BoardMenuOAM: ; BOARDMENUITEM_DIE dbsprite 2, 16, 4, 0, BOARD_MENU_OAM_FIRST_TILE, PAL_OW_MISC @@ -121,9 +163,42 @@ BranchArrowsOAM: dbsprite 9, 8, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE + 2, PAL_OW_RED ; up dbsprite 9, 12, 4, 0, BRANCH_ARROWS_OAM_FIRST_TILE + 3, PAL_OW_RED ; down +BranchLegendOAM: +; the PAL_ argument is unused (actual palette comes from the player gender) + dbsprite 2, 16, 0, 4, BRANCH_LEGEND_OAM_FIRST_TILE + 2, PAL_OW_RED ; dpad icon + dbsprite 3, 16, 0, 4, BRANCH_LEGEND_OAM_FIRST_TILE + 5, PAL_OW_RED ; "choose" icon + dbsprite 4, 16, 0, 4, BRANCH_LEGEND_OAM_FIRST_TILE + 6, PAL_OW_RED ; + dbsprite 5, 16, 0, 4, BRANCH_LEGEND_OAM_FIRST_TILE + 7, PAL_OW_RED ; + dbsprite 2, 18, 0, 0, BRANCH_LEGEND_OAM_FIRST_TILE + 3, PAL_OW_RED ; select icon + dbsprite 3, 18, 0, 0, BRANCH_LEGEND_OAM_FIRST_TILE + 8, PAL_OW_RED ; "view" icon + dbsprite 4, 18, 0, 0, BRANCH_LEGEND_OAM_FIRST_TILE + 9, PAL_OW_RED ; + dbsprite 5, 18, 0, 0, BRANCH_LEGEND_OAM_FIRST_TILE + 10, PAL_OW_RED ; + ViewMapModeArrowsOAM: ; the PAL_ argument is unused (actual palette comes from the player gender) - dbsprite 10, 18, 4, 4, VIEW_MAP_MODE_OAM_FIRST_TILE + 3, PAL_OW_RED ; down - dbsprite 10, 2, 4, 4, VIEW_MAP_MODE_OAM_FIRST_TILE + 2, PAL_OW_RED ; up - dbsprite 1, 10, 4, 0, VIEW_MAP_MODE_OAM_FIRST_TILE + 1, PAL_OW_RED ; left - dbsprite 19, 10, 4, 0, VIEW_MAP_MODE_OAM_FIRST_TILE, PAL_OW_RED ; right + dbsprite 10, 18, 4, 4, VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE + 3, PAL_OW_RED ; down + dbsprite 10, 2, 4, 4, VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE + 2, PAL_OW_RED ; up + dbsprite 1, 10, 4, 0, VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE + 1, PAL_OW_RED ; left + dbsprite 19, 10, 4, 0, VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE, PAL_OW_RED ; right + +ViewMapModeLegendOAM: +; the PAL_ argument is unused (actual palette comes from the player gender) + dbsprite 2, 16, 0, 4, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 2, PAL_OW_RED ; dpad icon + dbsprite 3, 16, 0, 4, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 5, PAL_OW_RED ; "move" icon + dbsprite 4, 16, 0, 4, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 6, PAL_OW_RED ; + dbsprite 5, 16, 0, 4, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 7, PAL_OW_RED ; + dbsprite 2, 18, 0, 0, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 1, PAL_OW_RED ; B icon + dbsprite 3, 18, 0, 0, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 8, PAL_OW_RED ; "back" icon + dbsprite 4, 18, 0, 0, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 9, PAL_OW_RED ; + dbsprite 5, 18, 0, 0, VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 10, PAL_OW_RED ; + +TalkerEventLegendOAM: +; the PAL_ argument is unused (actual palette comes from the player gender) + dbsprite 2, 16, 0, 4, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 0, PAL_OW_RED ; A icon + dbsprite 3, 16, 0, 4, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 5, PAL_OW_RED ; "talk" icon + dbsprite 4, 16, 0, 4, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 6, PAL_OW_RED ; + dbsprite 5, 16, 0, 4, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 7, PAL_OW_RED ; + dbsprite 2, 18, 0, 0, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 1, PAL_OW_RED ; B icon + dbsprite 3, 18, 0, 0, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 8, PAL_OW_RED ; "skip" icon + dbsprite 4, 18, 0, 0, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 9, PAL_OW_RED ; + dbsprite 5, 18, 0, 0, TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 10, PAL_OW_RED ; diff --git a/engine/board/spaces.asm b/engine/board/spaces.asm index 8bac43304..6d15077b4 100755 --- a/engine/board/spaces.asm +++ b/engine/board/spaces.asm @@ -176,9 +176,9 @@ ArriveToBranchSpaceScript: call LoadTempSpaceBranchData call .DisableDirectionsRequiringLockedTechniques ; draw arrows for valid directions - farcall LoadBranchArrowsGFX + farcall LoadBranchSpaceGFX ld hl, wDisplaySecondarySprites - set SECONDARYSPRITES_BRANCH_ARROWS_F, [hl] + set SECONDARYSPRITES_BRANCH_SPACE_F, [hl] ; update sprites jp UpdateActiveSprites @@ -260,7 +260,7 @@ PromptPlayerToChooseBranchDirection: ld a, [hl] ld [wCurSpaceNextSpace], a ld hl, wDisplaySecondarySprites - res SECONDARYSPRITES_BRANCH_ARROWS_F, [hl] + res SECONDARYSPRITES_BRANCH_SPACE_F, [hl] ld a, TRUE ldh [hScriptVar], a jp PlayClickSFX @@ -292,7 +292,7 @@ PromptPlayerToChooseBranchDirection: set INVISIBLE_F, [hl] ld hl, wDisplaySecondarySprites res SECONDARYSPRITES_SPACES_LEFT_F, [hl] - res SECONDARYSPRITES_BRANCH_ARROWS_F, [hl] + res SECONDARYSPRITES_BRANCH_SPACE_F, [hl] farcall MockPlayerObject call UpdateSprites farcall LoadViewMapModeGFX diff --git a/engine/events/trainer_scripts.asm b/engine/events/trainer_scripts.asm index a1422abe3..fd95ea6f3 100644 --- a/engine/events/trainer_scripts.asm +++ b/engine/events/trainer_scripts.asm @@ -63,9 +63,15 @@ SeenByTalkerScript:: and TALKEREVENTTYPE_MASK cp TALKEREVENTTYPE_MANDATORY jr z, .skip + farcall LoadTalkerEventLegendGFX + ld hl, wDisplaySecondarySprites + set SECONDARYSPRITES_TALKER_EVENT_F, [hl] + call UpdateActiveSprites call JoyWaitAorB call PlayClickSFX call WaitSFX + ld hl, wDisplaySecondarySprites + res SECONDARYSPRITES_TALKER_EVENT_F, [hl] ldh a, [hJoyPressed] bit A_BUTTON_F, a jr z, .skip ; jump if b was pressed diff --git a/engine/gfx/load_board_gfx.asm b/engine/gfx/load_board_gfx.asm index 6ddb4979e..c86633cd4 100755 --- a/engine/gfx/load_board_gfx.asm +++ b/engine/gfx/load_board_gfx.asm @@ -39,11 +39,21 @@ LoadBoardMenuDieNumbersGFX:: .DieNumbersOAMGFX: INCBIN "gfx/board/die_numbers.2bpp" -LoadBranchArrowsGFX:: +LoadBranchSpaceGFX:: ld de, .BranchArrowsOAMGFX ld hl, vTiles0 + BRANCH_ARROWS_OAM_FIRST_TILE * LEN_2BPP_TILE lb bc, BANK(.BranchArrowsOAMGFX), NUM_DIRECTIONS call Get2bppViaHDMA + ld hl, vTiles0 + BRANCH_LEGEND_OAM_FIRST_TILE * LEN_2BPP_TILE + call LoadLegendButtonsGFX + ld de, LegendChooseOAMGFX + ld hl, vTiles0 + (BRANCH_LEGEND_OAM_FIRST_TILE + 5) * LEN_2BPP_TILE + lb bc, BANK(LegendChooseOAMGFX), 3 + call Get2bppViaHDMA + ld de, LegendViewOAMGFX + ld hl, vTiles0 + (BRANCH_LEGEND_OAM_FIRST_TILE + 8) * LEN_2BPP_TILE + lb bc, BANK(LegendViewOAMGFX), 3 + call Get2bppViaHDMA ret .BranchArrowsOAMGFX: @@ -51,10 +61,60 @@ INCBIN "gfx/board/branch_arrows.2bpp" LoadViewMapModeGFX:: ld de, .ViewMapModeArrowsOAMGFX - ld hl, vTiles0 + VIEW_MAP_MODE_OAM_FIRST_TILE * LEN_2BPP_TILE + ld hl, vTiles0 + VIEW_MAP_MODE_ARROWS_OAM_FIRST_TILE * LEN_2BPP_TILE lb bc, BANK(.ViewMapModeArrowsOAMGFX), NUM_DIRECTIONS call Get2bppViaHDMA + ld hl, vTiles0 + VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE * LEN_2BPP_TILE + call LoadLegendButtonsGFX + ld de, LegendMoveOAMGFX + ld hl, vTiles0 + (VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 5) * LEN_2BPP_TILE + lb bc, BANK(LegendMoveOAMGFX), 3 + call Get2bppViaHDMA + ld de, LegendBackOAMGFX + ld hl, vTiles0 + (VIEW_MAP_MODE_LEGEND_OAM_FIRST_FILE + 8) * LEN_2BPP_TILE + lb bc, BANK(LegendBackOAMGFX), 3 + call Get2bppViaHDMA ret .ViewMapModeArrowsOAMGFX: INCBIN "gfx/board/view_map_arrows.2bpp" + +LoadTalkerEventLegendGFX:: + ld hl, vTiles0 + TALKER_EVENT_LEGEND_OAM_FIRST_TILE * LEN_2BPP_TILE + call LoadLegendButtonsGFX + ld de, LegendTalkOAMGFX + ld hl, vTiles0 + (TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 5) * LEN_2BPP_TILE + lb bc, BANK(LegendTalkOAMGFX), 3 + call Get2bppViaHDMA + ld de, LegendSkipOAMGFX + ld hl, vTiles0 + (TALKER_EVENT_LEGEND_OAM_FIRST_TILE + 8) * LEN_2BPP_TILE + lb bc, BANK(LegendTalkOAMGFX), 3 + call Get2bppViaHDMA + ret + +LoadLegendButtonsGFX: + ld de, .LegendButtonsOAMGFX + lb bc, BANK(.LegendButtonsOAMGFX), 5 + call Get2bppViaHDMA + ret + +.LegendButtonsOAMGFX: +INCBIN "gfx/legend/buttons.2bpp" + +LegendTalkOAMGFX: +INCBIN "gfx/legend/talk.2bpp" + +LegendSkipOAMGFX: +INCBIN "gfx/legend/skip.2bpp" + +LegendChooseOAMGFX: +INCBIN "gfx/legend/choose.2bpp" + +LegendViewOAMGFX: +INCBIN "gfx/legend/view.2bpp" + +LegendMoveOAMGFX: +INCBIN "gfx/legend/move.2bpp" + +LegendBackOAMGFX: +INCBIN "gfx/legend/back.2bpp" diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index bc8a74bac..2350dedde 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -3112,10 +3112,12 @@ InitSecondarySprites: call nz, InitDieRollSprites bit SECONDARYSPRITES_SPACES_LEFT_F, a call nz, InitSpacesLeftNumberSprites - bit SECONDARYSPRITES_BRANCH_ARROWS_F, a + bit SECONDARYSPRITES_BRANCH_SPACE_F, a call nz, InitBranchArrowsSprites bit SECONDARYSPRITES_VIEW_MAP_MODE_F, a call nz, InitViewMapModeSprites + bit SECONDARYSPRITES_TALKER_EVENT_F, a + call nz, InitTalkerEventSprites ret InitBoardMenuSprites: @@ -3200,6 +3202,7 @@ InitSpacesLeftNumberSprites: InitBranchArrowsSprites: push af +;; arrows ; find the beginning of free space in OAM, and assure there's space for 4 objects ldh a, [hUsedSpriteIndex] cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (NUM_DIRECTIONS * SPRITEOAMSTRUCT_LENGTH) + 1 @@ -3252,6 +3255,35 @@ InitBranchArrowsSprites: dec c jr nz, .loop +;; legend +; find the beginning of free space in OAM, and assure there's space for 8 objects + ldh a, [hUsedSpriteIndex] + cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (8 * SPRITEOAMSTRUCT_LENGTH) + 1 + jr nc, .oam_full +; copy the sprite data of the legend to the available space in OAM. +; the palette byte overrides that data as it matches the player's color palette. + ld e, a + ld d, HIGH(wShadowOAM) + gender_to_pal + ld b, a + ld c, 8 ; number of objects + ld hl, BranchLegendOAM +.loop2 + push bc + ld bc, SPRITEOAMSTRUCT_LENGTH - 1 + call CopyBytes + pop bc + ld a, b ; palette + ld [de], a + inc hl + inc de + dec c + jr nz, .loop2 + + ldh a, [hUsedSpriteIndex] + add (8 * SPRITEOAMSTRUCT_LENGTH) + ldh [hUsedSpriteIndex], a + .oam_full pop af ret @@ -3259,6 +3291,7 @@ InitBranchArrowsSprites: InitViewMapModeSprites: push af +;; arrows ; find the beginning of free space in OAM, and assure there's space for 4 objects ldh a, [hUsedSpriteIndex] cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (NUM_DIRECTIONS * SPRITEOAMSTRUCT_LENGTH) + 1 @@ -3307,6 +3340,68 @@ InitViewMapModeSprites: dec c jr nz, .loop +;; legend +; find the beginning of free space in OAM, and assure there's space for 8 objects + ldh a, [hUsedSpriteIndex] + cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (8 * SPRITEOAMSTRUCT_LENGTH) + 1 + jr nc, .oam_full +; copy the sprite data of the legend to the available space in OAM. +; the palette byte overrides that data as it matches the player's color palette. + ld e, a + ld d, HIGH(wShadowOAM) + gender_to_pal + ld b, a + ld c, 8 ; number of objects + ld hl, ViewMapModeLegendOAM +.loop2 + push bc + ld bc, SPRITEOAMSTRUCT_LENGTH - 1 + call CopyBytes + pop bc + ld a, b ; palette + ld [de], a + inc hl + inc de + dec c + jr nz, .loop2 + + ldh a, [hUsedSpriteIndex] + add (8 * SPRITEOAMSTRUCT_LENGTH) + ldh [hUsedSpriteIndex], a + +.oam_full + pop af + ret + +InitTalkerEventSprites: +; find the beginning of free space in OAM, and assure there's space for 8 objects + ldh a, [hUsedSpriteIndex] + cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (8 * SPRITEOAMSTRUCT_LENGTH) + 1 + jr nc, .oam_full +; copy the sprite data of the legend to the available space in OAM. +; the palette byte overrides that data as it matches the player's color palette. + ld e, a + ld d, HIGH(wShadowOAM) + gender_to_pal + ld b, a + ld c, 8 ; number of objects + ld hl, TalkerEventLegendOAM +.loop2 + push bc + ld bc, SPRITEOAMSTRUCT_LENGTH - 1 + call CopyBytes + pop bc + ld a, b ; palette + ld [de], a + inc hl + inc de + dec c + jr nz, .loop2 + + ldh a, [hUsedSpriteIndex] + add (8 * SPRITEOAMSTRUCT_LENGTH) + ldh [hUsedSpriteIndex], a + .oam_full pop af ret diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 7b21f4dcd..de1dd4d39 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -1241,9 +1241,15 @@ Script_reloadmapafterviewmapmode: jr z, .in_board_menu ; .in_branch_space +; load branch space gfx (overwritten by view map mode gfx) +; refresh sprites first without view map mode objects to avoid visual glitch + ld hl, wDisplaySecondarySprites + res SECONDARYSPRITES_VIEW_MAP_MODE_F, [hl] + call UpdateActiveSprites + farcall LoadBranchSpaceGFX ld hl, wDisplaySecondarySprites set SECONDARYSPRITES_SPACES_LEFT_F, [hl] - set SECONDARYSPRITES_BRANCH_ARROWS_F, [hl] + set SECONDARYSPRITES_BRANCH_SPACE_F, [hl] ld hl, wPlayerSpriteSetupFlags ; get the facing direction from the mocked object's facing direction ld a, [wMapObject{d:LAST_OBJECT}Movement] diff --git a/gfx/legend/back.png b/gfx/legend/back.png new file mode 100755 index 000000000..2eb176bf0 Binary files /dev/null and b/gfx/legend/back.png differ diff --git a/gfx/legend/buttons.png b/gfx/legend/buttons.png new file mode 100755 index 000000000..f53a571e5 Binary files /dev/null and b/gfx/legend/buttons.png differ diff --git a/gfx/legend/choose.png b/gfx/legend/choose.png new file mode 100755 index 000000000..6b1541ab1 Binary files /dev/null and b/gfx/legend/choose.png differ diff --git a/gfx/legend/move.png b/gfx/legend/move.png new file mode 100755 index 000000000..bf3c4a56b Binary files /dev/null and b/gfx/legend/move.png differ diff --git a/gfx/legend/skip.png b/gfx/legend/skip.png new file mode 100755 index 000000000..fb6524ec0 Binary files /dev/null and b/gfx/legend/skip.png differ diff --git a/gfx/legend/talk.png b/gfx/legend/talk.png new file mode 100755 index 000000000..7f451ec24 Binary files /dev/null and b/gfx/legend/talk.png differ diff --git a/gfx/legend/view.png b/gfx/legend/view.png new file mode 100755 index 000000000..3519a5d0b Binary files /dev/null and b/gfx/legend/view.png differ