Don't hide sprites behind a 2BPP textbox if they are partially outside of it, and make 2BPP textboxes have priority over objects (#7); Generalize 1bpp/2bpp text state tracking (#10) [reworks 052d246e]

This commit is contained in:
xCrystal
2023-08-31 18:41:05 +02:00
parent 9f835560d7
commit 2957bce0a9
10 changed files with 73 additions and 32 deletions

View File

@@ -209,8 +209,8 @@ MenuBox::
call GetMenuBoxDims
dec b
dec c
ld a, [wMenuBoxUse2bppFrame]
and a
ld a, [wTextboxFlags]
bit TEXT_2BPP_F, a
jp z, Textbox1bpp
ld d, h
ld e, l

View File

@@ -72,7 +72,7 @@ Textbox1bpp::
call TextboxBorder
pop hl
pop bc
jr TextboxPalette
jr TextboxAttributes1bpp
TextboxBorder::
; Top
@@ -120,15 +120,23 @@ TextboxBorder::
jr nz, .loop
ret
TextboxPalette::
; Fill text box width c height b at hl with pal 7
TextboxAttributes1bpp::
; Fill text box width c height b at hl with PAL_BG_TEXT
ld a, PAL_BG_TEXT
jr _TextboxAttributes
TextboxAttributes2bpp::
; Fill text box width c height b at hl with PAL_BG_TEXT | PRIORITY
ld a, PAL_BG_TEXT | PRIORITY
; fallthrough
_TextboxAttributes:
ld de, wAttrmap - wTilemap
add hl, de
inc b
inc b
inc c
inc c
ld a, PAL_BG_TEXT
.col
push bc
push hl
@@ -155,7 +163,7 @@ Textbox2bpp::
farcall _OverworldTextbox
pop hl
pop bc
jp TextboxPalette
jp TextboxAttributes2bpp
RadioTerminator::
ld hl, .stop

View File

@@ -46,6 +46,9 @@ OpenText2bpp::
ld a, BANK(ReanchorBGMap_NoOAMUpdate)
rst Bankswitch
ld hl, wTextboxFlags
set TEXT_2BPP_F, [hl]
; assumes that the overworld 2bpp font and frame are loaded when calling this
call ReanchorBGMap_NoOAMUpdate ; anchor bgmap
call SpeechTextbox2bpp
@@ -64,6 +67,9 @@ OpenText1bpp::
ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; aka BANK(LoadFont_NoOAMUpdate)
rst Bankswitch
ld hl, wTextboxFlags
res TEXT_2BPP_F, [hl]
call ReanchorBGMap_NoOAMUpdate ; anchor bgmap
call SpeechTextbox1bpp
call HDMATransferTilemapAndAttrmap_OpenAndCloseMenu ; transfer bgmap