mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Fix overworld frame for non-speech textbox sizes (#10)
This commit is contained in:
parent
be5f3ad6e1
commit
e5171321a9
@ -17,7 +17,7 @@
|
|||||||
OW_TEXTBOX_FRAME_MIN_HEIGHT EQU 4
|
OW_TEXTBOX_FRAME_MIN_HEIGHT EQU 4
|
||||||
OW_TEXTBOX_FRAME_MIN_WIDTH EQU 6
|
OW_TEXTBOX_FRAME_MIN_WIDTH EQU 6
|
||||||
|
|
||||||
OverworldTextbox::
|
_OverworldTextbox::
|
||||||
; Draw a textbox at de with room for b rows and c columns using the 2bpp overworld frame tiles.
|
; Draw a textbox at de with room for b rows and c columns using the 2bpp overworld frame tiles.
|
||||||
ld a, b
|
ld a, b
|
||||||
cp OW_TEXTBOX_FRAME_MIN_HEIGHT - 2
|
cp OW_TEXTBOX_FRAME_MIN_HEIGHT - 2
|
||||||
@ -32,30 +32,41 @@ OverworldTextbox::
|
|||||||
ld h, d
|
ld h, d
|
||||||
ld l, e
|
ld l, e
|
||||||
; top row
|
; top row
|
||||||
|
push hl
|
||||||
ld [hl], OW_TEXTBOX_FRAME_TOP_LEFT_CORNER
|
ld [hl], OW_TEXTBOX_FRAME_TOP_LEFT_CORNER
|
||||||
inc hl
|
inc hl
|
||||||
ld e, 0
|
ld e, 0
|
||||||
call .GetTileArrangementPointer
|
call .GetTileArrangementPointer
|
||||||
call .CopyHorizontalTiles
|
call .CopyHorizontalTiles
|
||||||
ld [hl], OW_TEXTBOX_FRAME_TOP_RIGHT_CORNER
|
ld [hl], OW_TEXTBOX_FRAME_TOP_RIGHT_CORNER
|
||||||
|
pop hl
|
||||||
; left column
|
; left column
|
||||||
inc hl
|
|
||||||
push hl
|
push hl
|
||||||
|
ld de, SCREEN_WIDTH
|
||||||
|
add hl, de
|
||||||
ld e, 4
|
ld e, 4
|
||||||
call .GetTileArrangementPointer
|
call .GetTileArrangementPointer
|
||||||
call .CopyVerticalTiles
|
call .CopyVerticalTiles
|
||||||
pop hl
|
pop hl
|
||||||
; right column
|
; right column
|
||||||
|
ld de, SCREEN_WIDTH
|
||||||
|
add hl, de
|
||||||
push hl
|
push hl
|
||||||
ld de, SCREEN_WIDTH - 1
|
ld e, c
|
||||||
|
ld d, 0
|
||||||
|
inc de
|
||||||
add hl, de
|
add hl, de
|
||||||
ld e, 6
|
ld e, 6
|
||||||
call .GetTileArrangementPointer
|
call .GetTileArrangementPointer
|
||||||
call .CopyVerticalTiles
|
call .CopyVerticalTiles
|
||||||
; bottom row
|
; bottom row
|
||||||
; we are in the bottom right corner, so first go back to the start of the line
|
; we are in the bottom right corner, so first go back to the start of the line
|
||||||
ld de, -(SCREEN_WIDTH - 1)
|
ld a, c
|
||||||
add hl, de
|
.loop
|
||||||
|
dec hl
|
||||||
|
dec a
|
||||||
|
jr nz, .loop
|
||||||
|
dec hl
|
||||||
ld [hl], OW_TEXTBOX_FRAME_BOTTOM_LEFT_CORNER
|
ld [hl], OW_TEXTBOX_FRAME_BOTTOM_LEFT_CORNER
|
||||||
inc hl
|
inc hl
|
||||||
ld e, 2
|
ld e, 2
|
||||||
@ -64,6 +75,7 @@ OverworldTextbox::
|
|||||||
ld [hl], OW_TEXTBOX_FRAME_BOTTOM_RIGHT_CORNER
|
ld [hl], OW_TEXTBOX_FRAME_BOTTOM_RIGHT_CORNER
|
||||||
; background
|
; background
|
||||||
pop hl
|
pop hl
|
||||||
|
; we are in the left column, second line
|
||||||
inc hl
|
inc hl
|
||||||
ld a, OW_TEXTBOX_FRAME_BACKGROUND
|
ld a, OW_TEXTBOX_FRAME_BACKGROUND
|
||||||
jp FillBoxWithByte
|
jp FillBoxWithByte
|
||||||
@ -154,6 +166,8 @@ ENDM
|
|||||||
.TilesTop1:
|
.TilesTop1:
|
||||||
ow_textbox_tiles TOP_1, TOP_1, TOP_2, TOP_2
|
ow_textbox_tiles TOP_1, TOP_1, TOP_2, TOP_2
|
||||||
.TilesBottom1:
|
.TilesBottom1:
|
||||||
|
; to support textboxes with a prompt cursor, the last two tiles before the bottom right corner
|
||||||
|
; must be the same, as the previous tile is copied into the cursor tile to clear the cursor.
|
||||||
ow_textbox_tiles BOTTOM_1, BOTTOM_1, BOTTOM_2, BOTTOM_2
|
ow_textbox_tiles BOTTOM_1, BOTTOM_1, BOTTOM_2, BOTTOM_2
|
||||||
.TilesLeft1:
|
.TilesLeft1:
|
||||||
ow_textbox_tiles LEFT_1, LEFT_2
|
ow_textbox_tiles LEFT_1, LEFT_2
|
||||||
|
Loading…
Reference in New Issue
Block a user