mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-01-23 09:16:20 -08:00
recomment text box functions
This commit is contained in:
parent
3975e86baa
commit
77aa2d9e16
63
main.asm
63
main.asm
@ -1132,42 +1132,32 @@ INCBIN "baserom.gbc", $fdb, $fe8 - $fdb
|
|||||||
|
|
||||||
|
|
||||||
TextBox: ; fe8
|
TextBox: ; fe8
|
||||||
; draw a text box of given location/size
|
; Draw a text box width c height b at hl
|
||||||
; ? hl
|
; Dimensions do not include the border.
|
||||||
; size bc
|
|
||||||
; ? de
|
|
||||||
|
|
||||||
; draw border
|
|
||||||
push bc
|
push bc
|
||||||
push hl
|
push hl
|
||||||
call TextBoxBorder
|
call TextBoxBorder
|
||||||
pop hl
|
pop hl
|
||||||
pop bc
|
pop bc
|
||||||
; fill textbox area with palette 7
|
|
||||||
jr TextBoxPalette
|
jr TextBoxPalette
|
||||||
; ff1
|
; ff1
|
||||||
|
|
||||||
|
|
||||||
TextBoxBorder: ; ff1
|
TextBoxBorder: ; ff1
|
||||||
; draw a text box
|
|
||||||
; upper-left corner at coordinates hl
|
|
||||||
; height b
|
|
||||||
; width c
|
|
||||||
|
|
||||||
; first row
|
; Top
|
||||||
push hl
|
push hl
|
||||||
ld a, "┌"
|
ld a, "┌"
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
inc a ; horizontal border ─
|
inc a ; "─"
|
||||||
call NPlaceChar
|
call NPlaceChar
|
||||||
inc a ; upper-right border ┐
|
inc a ; "┐"
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
; middle rows
|
; Middle
|
||||||
pop hl
|
pop hl
|
||||||
ld de, 20
|
ld de, 20 ; screen width
|
||||||
add hl, de ; skip the top row
|
add hl, de
|
||||||
|
|
||||||
.PlaceRow
|
.PlaceRow
|
||||||
push hl
|
push hl
|
||||||
ld a, "│"
|
ld a, "│"
|
||||||
@ -1175,25 +1165,25 @@ TextBoxBorder: ; ff1
|
|||||||
ld a, " "
|
ld a, " "
|
||||||
call NPlaceChar
|
call NPlaceChar
|
||||||
ld [hl], "│"
|
ld [hl], "│"
|
||||||
|
|
||||||
pop hl
|
pop hl
|
||||||
ld de, 20
|
ld de, 20 ; screen width
|
||||||
add hl, de ; move to next row
|
add hl, de
|
||||||
dec b
|
dec b
|
||||||
jr nz, .PlaceRow
|
jr nz, .PlaceRow
|
||||||
|
|
||||||
; bottom row
|
; Bottom
|
||||||
ld a, "└"
|
ld a, "└"
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld a, "─"
|
ld a, "─"
|
||||||
call NPlaceChar
|
call NPlaceChar
|
||||||
ld [hl], "┘"
|
ld [hl], "┘"
|
||||||
|
|
||||||
ret
|
ret
|
||||||
; 101e
|
; 101e
|
||||||
|
|
||||||
|
|
||||||
NPlaceChar: ; 101e
|
NPlaceChar: ; 101e
|
||||||
; place a row of width c of identical characters
|
; Place char a c times
|
||||||
ld d,c
|
ld d,c
|
||||||
.loop
|
.loop
|
||||||
ld [hli],a
|
ld [hli],a
|
||||||
@ -1204,17 +1194,14 @@ NPlaceChar: ; 101e
|
|||||||
|
|
||||||
|
|
||||||
TextBoxPalette: ; 1024
|
TextBoxPalette: ; 1024
|
||||||
; fill textbox area with pal 07
|
; Fill text box width c height b at hl with pal 7
|
||||||
; hl: tile address
|
|
||||||
; b: height
|
|
||||||
; c: width
|
|
||||||
ld de, AttrMap - TileMap
|
ld de, AttrMap - TileMap
|
||||||
add hl, de
|
add hl, de
|
||||||
inc b
|
inc b
|
||||||
inc b
|
inc b
|
||||||
inc c
|
inc c
|
||||||
inc c
|
inc c
|
||||||
ld a, $07 ; palette
|
ld a, 7 ; pal
|
||||||
.gotoy
|
.gotoy
|
||||||
push bc
|
push bc
|
||||||
push hl
|
push hl
|
||||||
@ -1223,7 +1210,7 @@ TextBoxPalette: ; 1024
|
|||||||
dec c
|
dec c
|
||||||
jr nz, .gotox
|
jr nz, .gotox
|
||||||
pop hl
|
pop hl
|
||||||
ld de, $0014 ; screen width in tiles (20)
|
ld de, 20 ; screen width
|
||||||
add hl, de
|
add hl, de
|
||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
@ -1234,25 +1221,27 @@ TextBoxPalette: ; 1024
|
|||||||
|
|
||||||
SpeechTextBox: ; 103e
|
SpeechTextBox: ; 103e
|
||||||
; Standard textbox.
|
; Standard textbox.
|
||||||
ld hl, $c590 ; tile 0, 12
|
hlcoord 0, 12
|
||||||
ld b, $4 ; height
|
ld b, 4 ; height
|
||||||
ld c, $12 ; width ; SCREEN_WIDTH - 2 (border)
|
ld c, 18 ; screen width - 2 (border)
|
||||||
jp TextBox
|
jp TextBox
|
||||||
; 1048
|
; 1048
|
||||||
|
|
||||||
|
|
||||||
INCBIN "baserom.gbc", $1048, $1057 - $1048
|
INCBIN "baserom.gbc", $1048, $1057 - $1048
|
||||||
|
|
||||||
PrintText: ; 0x1057
|
|
||||||
|
PrintText: ; 1057
|
||||||
call $106c
|
call $106c
|
||||||
push hl
|
push hl
|
||||||
ld hl, $c5b9
|
hlcoord 1, 14
|
||||||
ld bc, $0312
|
ld bc, 18 + 3<<8
|
||||||
call ClearBox
|
call ClearBox
|
||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
PrintTextBoxText: ; 1065
|
PrintTextBoxText: ; 1065
|
||||||
ld bc, $c5b9 ; TileMap(1,14)
|
bccoord 1, 14
|
||||||
call $13e5 ; PrintText
|
call $13e5
|
||||||
ret
|
ret
|
||||||
; 106c
|
; 106c
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user