commit
e774b79b45
6 changed files with 262 additions and 621 deletions
|
@ -1,583 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start Font6Func
|
||||
@ int Font6Func(struct TextPrinter *x)
|
||||
Font6Func: @ 81BA250
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
adds r4, r6, 0
|
||||
adds r4, 0x14
|
||||
ldrb r0, [r6, 0x1C]
|
||||
cmp r0, 0x6
|
||||
bls _081BA260
|
||||
b _081BA660
|
||||
_081BA260:
|
||||
lsls r0, 2
|
||||
ldr r1, =_081BA270
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_081BA270:
|
||||
.4byte _081BA28C
|
||||
.4byte _081BA554
|
||||
.4byte _081BA566
|
||||
.4byte _081BA590
|
||||
.4byte _081BA5C8
|
||||
.4byte _081BA63C
|
||||
.4byte _081BA64E
|
||||
_081BA28C:
|
||||
ldr r2, =gMain
|
||||
ldrh r1, [r2, 0x2C]
|
||||
movs r0, 0x3
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081BA2A6
|
||||
ldrb r1, [r4]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081BA2A6
|
||||
movs r0, 0
|
||||
strb r0, [r6, 0x1E]
|
||||
_081BA2A6:
|
||||
ldrb r1, [r6, 0x1E]
|
||||
cmp r1, 0
|
||||
beq _081BA2E8
|
||||
ldrb r0, [r6, 0x1D]
|
||||
cmp r0, 0
|
||||
beq _081BA2E8
|
||||
subs r0, r1, 0x1
|
||||
strb r0, [r6, 0x1E]
|
||||
ldr r0, =gTextFlags
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _081BA2C4
|
||||
b _081BA50E
|
||||
_081BA2C4:
|
||||
ldrh r1, [r2, 0x2E]
|
||||
movs r0, 0x3
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _081BA2D0
|
||||
b _081BA50E
|
||||
_081BA2D0:
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x10
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
movs r0, 0
|
||||
strb r0, [r6, 0x1E]
|
||||
b _081BA50E
|
||||
.pool
|
||||
_081BA2E8:
|
||||
ldr r2, =gTextFlags
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x4
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081BA2FC
|
||||
movs r0, 0x3
|
||||
b _081BA2FE
|
||||
.pool
|
||||
_081BA2FC:
|
||||
ldrb r0, [r6, 0x1D]
|
||||
_081BA2FE:
|
||||
strb r0, [r6, 0x1E]
|
||||
ldr r0, [r6]
|
||||
ldrb r3, [r0]
|
||||
adds r0, 0x1
|
||||
str r0, [r6]
|
||||
adds r0, r3, 0
|
||||
subs r0, 0xF8
|
||||
cmp r0, 0x7
|
||||
bls _081BA312
|
||||
b _081BA52E
|
||||
_081BA312:
|
||||
lsls r0, 2
|
||||
ldr r1, =_081BA320
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_081BA320:
|
||||
.4byte _081BA524
|
||||
.4byte _081BA512
|
||||
.4byte _081BA504
|
||||
.4byte _081BA500
|
||||
.4byte _081BA36E
|
||||
.4byte _081BA368
|
||||
.4byte _081BA340
|
||||
.4byte _081BA660
|
||||
_081BA340:
|
||||
ldrb r0, [r6, 0x6]
|
||||
strb r0, [r6, 0x8]
|
||||
ldrb r1, [r6, 0x5]
|
||||
ldr r0, =gFonts
|
||||
ldr r2, [r0]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
ldrb r1, [r6, 0xB]
|
||||
ldrb r0, [r0, 0x5]
|
||||
adds r1, r0
|
||||
ldrb r0, [r6, 0x9]
|
||||
adds r0, r1
|
||||
strb r0, [r6, 0x9]
|
||||
_081BA35E:
|
||||
movs r0, 0x2
|
||||
b _081BA662
|
||||
.pool
|
||||
_081BA368:
|
||||
ldr r0, [r6]
|
||||
adds r0, 0x1
|
||||
b _081BA4C4
|
||||
_081BA36E:
|
||||
ldr r0, [r6]
|
||||
ldrb r3, [r0]
|
||||
adds r0, 0x1
|
||||
str r0, [r6]
|
||||
subs r0, r3, 0x1
|
||||
cmp r0, 0xF
|
||||
bls _081BA37E
|
||||
b _081BA52E
|
||||
_081BA37E:
|
||||
lsls r0, 2
|
||||
ldr r1, =_081BA38C
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_081BA38C:
|
||||
.4byte _081BA3CC
|
||||
.4byte _081BA3EE
|
||||
.4byte _081BA412
|
||||
.4byte _081BA42C
|
||||
.4byte _081BA478
|
||||
.4byte _081BA47E
|
||||
.4byte _081BA35E
|
||||
.4byte _081BA498
|
||||
.4byte _081BA4A8
|
||||
.4byte _081BA4BC
|
||||
.4byte _081BA4C0
|
||||
.4byte _081BA4C8
|
||||
.4byte _081BA4D2
|
||||
.4byte _081BA4DE
|
||||
.4byte _081BA4EE
|
||||
.4byte _081BA4C0
|
||||
_081BA3CC:
|
||||
ldr r2, [r6]
|
||||
ldrb r1, [r2]
|
||||
lsls r1, 4
|
||||
ldrb r3, [r6, 0xC]
|
||||
movs r0, 0xF
|
||||
ands r0, r3
|
||||
orrs r0, r1
|
||||
strb r0, [r6, 0xC]
|
||||
adds r2, 0x1
|
||||
str r2, [r6]
|
||||
lsls r0, 24
|
||||
lsrs r0, 28
|
||||
ldrb r2, [r6, 0xD]
|
||||
lsls r1, r2, 28
|
||||
lsrs r1, 28
|
||||
lsrs r2, 4
|
||||
b _081BA472
|
||||
_081BA3EE:
|
||||
ldr r1, [r6]
|
||||
ldrb r2, [r1]
|
||||
movs r0, 0xF
|
||||
ands r0, r2
|
||||
ldrb r3, [r6, 0xD]
|
||||
movs r2, 0x10
|
||||
negs r2, r2
|
||||
ands r2, r3
|
||||
orrs r2, r0
|
||||
strb r2, [r6, 0xD]
|
||||
adds r1, 0x1
|
||||
str r1, [r6]
|
||||
ldrb r0, [r6, 0xC]
|
||||
lsrs r0, 4
|
||||
lsls r1, r2, 28
|
||||
lsrs r1, 28
|
||||
lsrs r2, 4
|
||||
b _081BA472
|
||||
_081BA412:
|
||||
ldr r1, [r6]
|
||||
ldrb r0, [r1]
|
||||
lsls r0, 4
|
||||
ldrb r3, [r6, 0xD]
|
||||
movs r2, 0xF
|
||||
ands r2, r3
|
||||
orrs r2, r0
|
||||
strb r2, [r6, 0xD]
|
||||
adds r1, 0x1
|
||||
str r1, [r6]
|
||||
ldrb r0, [r6, 0xC]
|
||||
lsrs r0, 4
|
||||
b _081BA46A
|
||||
_081BA42C:
|
||||
ldr r3, [r6]
|
||||
ldrb r1, [r3]
|
||||
lsls r1, 4
|
||||
ldrb r4, [r6, 0xC]
|
||||
movs r2, 0xF
|
||||
adds r0, r2, 0
|
||||
ands r0, r4
|
||||
orrs r0, r1
|
||||
strb r0, [r6, 0xC]
|
||||
adds r5, r3, 0x1
|
||||
str r5, [r6]
|
||||
ldrb r3, [r3, 0x1]
|
||||
adds r1, r2, 0
|
||||
ands r1, r3
|
||||
ldrb r4, [r6, 0xD]
|
||||
movs r3, 0x10
|
||||
negs r3, r3
|
||||
ands r3, r4
|
||||
orrs r3, r1
|
||||
strb r3, [r6, 0xD]
|
||||
adds r4, r5, 0x1
|
||||
str r4, [r6]
|
||||
ldrb r1, [r5, 0x1]
|
||||
lsls r1, 4
|
||||
ands r2, r3
|
||||
orrs r2, r1
|
||||
strb r2, [r6, 0xD]
|
||||
adds r4, 0x1
|
||||
str r4, [r6]
|
||||
lsls r0, 24
|
||||
lsrs r0, 28
|
||||
_081BA46A:
|
||||
lsls r1, r2, 28
|
||||
lsrs r1, 28
|
||||
lsls r2, 24
|
||||
lsrs r2, 28
|
||||
_081BA472:
|
||||
bl GenerateFontHalfRowLookupTable
|
||||
b _081BA35E
|
||||
_081BA478:
|
||||
ldr r0, [r6]
|
||||
adds r0, 0x1
|
||||
b _081BA4C4
|
||||
_081BA47E:
|
||||
ldr r0, [r6]
|
||||
ldrb r0, [r0]
|
||||
movs r1, 0xF
|
||||
ands r1, r0
|
||||
ldrb r2, [r4]
|
||||
movs r0, 0x10
|
||||
negs r0, r0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r4]
|
||||
ldr r0, [r6]
|
||||
adds r0, 0x1
|
||||
b _081BA4C4
|
||||
_081BA498:
|
||||
ldr r0, [r6]
|
||||
ldrb r1, [r0]
|
||||
strb r1, [r6, 0x1E]
|
||||
adds r0, 0x1
|
||||
str r0, [r6]
|
||||
movs r0, 0x6
|
||||
strb r0, [r6, 0x1C]
|
||||
b _081BA35E
|
||||
_081BA4A8:
|
||||
movs r0, 0x1
|
||||
strb r0, [r6, 0x1C]
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x4
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081BA50E
|
||||
movs r0, 0
|
||||
strb r0, [r4, 0x2]
|
||||
b _081BA50E
|
||||
_081BA4BC:
|
||||
movs r0, 0x5
|
||||
b _081BA64A
|
||||
_081BA4C0:
|
||||
ldr r0, [r6]
|
||||
adds r0, 0x2
|
||||
_081BA4C4:
|
||||
str r0, [r6]
|
||||
b _081BA35E
|
||||
_081BA4C8:
|
||||
ldr r1, [r6]
|
||||
adds r0, r1, 0x1
|
||||
str r0, [r6]
|
||||
ldrb r3, [r1, 0x1]
|
||||
b _081BA52E
|
||||
_081BA4D2:
|
||||
ldr r1, [r6]
|
||||
ldrb r0, [r1]
|
||||
ldrb r2, [r6, 0x6]
|
||||
adds r0, r2
|
||||
strb r0, [r6, 0x8]
|
||||
b _081BA4E8
|
||||
_081BA4DE:
|
||||
ldr r1, [r6]
|
||||
ldrb r0, [r1]
|
||||
ldrb r2, [r6, 0x7]
|
||||
adds r0, r2
|
||||
strb r0, [r6, 0x9]
|
||||
_081BA4E8:
|
||||
adds r1, 0x1
|
||||
str r1, [r6]
|
||||
b _081BA35E
|
||||
_081BA4EE:
|
||||
ldrb r0, [r6, 0x4]
|
||||
ldrb r2, [r6, 0xD]
|
||||
lsls r2, 28
|
||||
lsrs r1, r2, 4
|
||||
orrs r1, r2
|
||||
lsrs r1, 24
|
||||
bl FillWindowPixelBuffer
|
||||
b _081BA35E
|
||||
_081BA500:
|
||||
movs r0, 0x2
|
||||
b _081BA506
|
||||
_081BA504:
|
||||
movs r0, 0x3
|
||||
_081BA506:
|
||||
strb r0, [r6, 0x1C]
|
||||
adds r0, r6, 0
|
||||
bl TextPrinterInitDownArrowCounters
|
||||
_081BA50E:
|
||||
movs r0, 0x3
|
||||
b _081BA662
|
||||
_081BA512:
|
||||
ldr r0, [r6]
|
||||
ldrb r3, [r0]
|
||||
movs r2, 0x80
|
||||
lsls r2, 1
|
||||
adds r1, r2, 0
|
||||
orrs r3, r1
|
||||
adds r0, 0x1
|
||||
str r0, [r6]
|
||||
b _081BA52E
|
||||
_081BA524:
|
||||
ldr r0, [r6]
|
||||
adds r0, 0x1
|
||||
str r0, [r6]
|
||||
movs r0, 0
|
||||
b _081BA662
|
||||
_081BA52E:
|
||||
adds r0, r3, 0
|
||||
bl DecompressGlyphFont6
|
||||
adds r0, r6, 0
|
||||
bl CopyGlyphToWindow
|
||||
ldr r0, =gUnknown_03002F90
|
||||
adds r0, 0x80
|
||||
ldrb r1, [r6, 0xA]
|
||||
ldrb r0, [r0]
|
||||
adds r1, r0
|
||||
ldrb r0, [r6, 0x8]
|
||||
adds r0, r1
|
||||
strb r0, [r6, 0x8]
|
||||
movs r0, 0
|
||||
b _081BA662
|
||||
.pool
|
||||
_081BA554:
|
||||
adds r0, r6, 0
|
||||
bl TextPrinterWait
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
beq _081BA50E
|
||||
movs r0, 0
|
||||
strb r0, [r6, 0x1C]
|
||||
b _081BA50E
|
||||
_081BA566:
|
||||
adds r0, r6, 0
|
||||
bl TextPrinterWaitWithDownArrow
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
beq _081BA50E
|
||||
ldrb r0, [r6, 0x4]
|
||||
ldrb r2, [r6, 0xD]
|
||||
lsls r2, 28
|
||||
lsrs r1, r2, 4
|
||||
orrs r1, r2
|
||||
lsrs r1, 24
|
||||
bl FillWindowPixelBuffer
|
||||
ldrb r0, [r6, 0x6]
|
||||
movs r1, 0
|
||||
strb r0, [r6, 0x8]
|
||||
ldrb r0, [r6, 0x7]
|
||||
strb r0, [r6, 0x9]
|
||||
strb r1, [r6, 0x1C]
|
||||
b _081BA50E
|
||||
_081BA590:
|
||||
adds r0, r6, 0
|
||||
bl TextPrinterWaitWithDownArrow
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
beq _081BA50E
|
||||
adds r0, r6, 0
|
||||
bl TextPrinterClearDownArrow
|
||||
ldrb r1, [r6, 0x5]
|
||||
ldr r0, =gFonts
|
||||
ldr r2, [r0]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
ldrb r1, [r6, 0xB]
|
||||
ldrb r0, [r0, 0x5]
|
||||
adds r1, r0
|
||||
strb r1, [r6, 0x1F]
|
||||
ldrb r0, [r6, 0x6]
|
||||
strb r0, [r6, 0x8]
|
||||
movs r0, 0x4
|
||||
strb r0, [r6, 0x1C]
|
||||
b _081BA50E
|
||||
.pool
|
||||
_081BA5C8:
|
||||
ldrb r2, [r6, 0x1F]
|
||||
cmp r2, 0
|
||||
beq _081BA638
|
||||
ldr r4, =gUnknown_08616124
|
||||
ldr r5, =gSaveBlock2Ptr
|
||||
ldr r0, [r5]
|
||||
ldrb r0, [r0, 0x14]
|
||||
lsls r1, r0, 29
|
||||
lsrs r0, r1, 29
|
||||
adds r0, r4
|
||||
ldrb r0, [r0]
|
||||
cmp r2, r0
|
||||
bcs _081BA604
|
||||
ldrb r0, [r6, 0x4]
|
||||
ldrb r1, [r6, 0xD]
|
||||
lsls r1, 28
|
||||
lsrs r3, r1, 4
|
||||
orrs r3, r1
|
||||
lsrs r3, 24
|
||||
movs r1, 0
|
||||
bl ScrollWindow
|
||||
movs r0, 0
|
||||
strb r0, [r6, 0x1F]
|
||||
b _081BA62E
|
||||
.pool
|
||||
_081BA604:
|
||||
ldrb r0, [r6, 0x4]
|
||||
lsrs r1, 29
|
||||
adds r1, r4
|
||||
ldrb r2, [r1]
|
||||
ldrb r1, [r6, 0xD]
|
||||
lsls r1, 28
|
||||
lsrs r3, r1, 4
|
||||
orrs r3, r1
|
||||
lsrs r3, 24
|
||||
movs r1, 0
|
||||
bl ScrollWindow
|
||||
ldr r0, [r5]
|
||||
ldrb r0, [r0, 0x14]
|
||||
lsls r0, 29
|
||||
lsrs r0, 29
|
||||
adds r0, r4
|
||||
ldrb r1, [r6, 0x1F]
|
||||
ldrb r0, [r0]
|
||||
subs r1, r0
|
||||
strb r1, [r6, 0x1F]
|
||||
_081BA62E:
|
||||
ldrb r0, [r6, 0x4]
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
b _081BA50E
|
||||
_081BA638:
|
||||
strb r2, [r6, 0x1C]
|
||||
b _081BA50E
|
||||
_081BA63C:
|
||||
bl IsSEPlaying
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0
|
||||
beq _081BA64A
|
||||
b _081BA50E
|
||||
_081BA64A:
|
||||
strb r0, [r6, 0x1C]
|
||||
b _081BA50E
|
||||
_081BA64E:
|
||||
ldrb r0, [r6, 0x1E]
|
||||
adds r1, r0, 0
|
||||
cmp r1, 0
|
||||
beq _081BA65C
|
||||
subs r0, 0x1
|
||||
strb r0, [r6, 0x1E]
|
||||
b _081BA50E
|
||||
_081BA65C:
|
||||
strb r1, [r6, 0x1C]
|
||||
b _081BA50E
|
||||
_081BA660:
|
||||
movs r0, 0x1
|
||||
_081BA662:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end Font6Func
|
||||
|
||||
thumb_func_start DecompressGlyphFont6
|
||||
DecompressGlyphFont6: @ 81BA668
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 16
|
||||
lsrs r2, r0, 19
|
||||
lsls r2, 9
|
||||
movs r1, 0xE0
|
||||
lsls r1, 11
|
||||
ands r1, r0
|
||||
lsrs r1, 11
|
||||
ldr r0, =gFont6BrailleGlyphs
|
||||
adds r1, r0
|
||||
adds r5, r2, r1
|
||||
ldr r4, =gUnknown_03002F90
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl DecompressGlyphTile
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x10
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x20
|
||||
bl DecompressGlyphTile
|
||||
movs r1, 0x80
|
||||
lsls r1, 1
|
||||
adds r0, r5, r1
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x40
|
||||
bl DecompressGlyphTile
|
||||
movs r1, 0x88
|
||||
lsls r1, 1
|
||||
adds r0, r5, r1
|
||||
adds r1, r4, 0
|
||||
adds r1, 0x60
|
||||
bl DecompressGlyphTile
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x80
|
||||
movs r1, 0x10
|
||||
strb r1, [r0]
|
||||
adds r0, 0x1
|
||||
strb r1, [r0]
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end DecompressGlyphFont6
|
||||
|
||||
thumb_func_start GetGlyphWidthFont6
|
||||
GetGlyphWidthFont6: @ 81BA6CC
|
||||
movs r0, 0x10
|
||||
bx lr
|
||||
thumb_func_end GetGlyphWidthFont6
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
|
@ -1,11 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
|
||||
gUnknown_08616124:: @ 8616124
|
||||
.incbin "baserom.gba", 0x616124, 0x4
|
||||
|
||||
.align 2
|
||||
gFont6BrailleGlyphs:: @ 8616128
|
||||
.incbin "data/graphics/fonts/font6.fwjpnfont"
|
|
@ -85,6 +85,22 @@
|
|||
|
||||
#define NUM_TEXT_PRINTERS 32
|
||||
|
||||
struct TextPrinterSubStruct
|
||||
{
|
||||
u8 font_type:4; // 0x14
|
||||
u8 font_type_upper:1;
|
||||
u8 font_type_5:3;
|
||||
u8 field_1:5;
|
||||
u8 field_1_upmid:2;
|
||||
u8 field_1_top:1;
|
||||
u8 frames_visible_counter;
|
||||
u8 field_3;
|
||||
u8 field_4; // 0x18
|
||||
u8 field_5;
|
||||
u8 field_6;
|
||||
u8 active;
|
||||
};
|
||||
|
||||
struct TextSubPrinter // TODO: Better name
|
||||
{
|
||||
u8* current_text_offset;
|
||||
|
@ -109,20 +125,7 @@ struct TextPrinter
|
|||
void (*callback)(struct TextSubPrinter *, u16); // 0x10
|
||||
|
||||
union {
|
||||
struct TextPrinterSubStruct
|
||||
{
|
||||
u8 font_type:4; // 0x14
|
||||
u8 font_type_upper:4;
|
||||
u8 field_1:5;
|
||||
u8 field_1_upmid:2;
|
||||
u8 field_1_top:1;
|
||||
u8 frames_visible_counter;
|
||||
u8 field_3;
|
||||
u8 field_4; // 0x18
|
||||
u8 field_5;
|
||||
u8 field_6;
|
||||
u8 active;
|
||||
} sub;
|
||||
struct TextPrinterSubStruct sub;
|
||||
|
||||
u8 sub_fields[8];
|
||||
} sub_union;
|
||||
|
@ -148,6 +151,8 @@ struct FontInfo
|
|||
u8 shadowColor:4;
|
||||
};
|
||||
|
||||
extern const struct FontInfo *gFonts;
|
||||
|
||||
struct GlyphWidthFunc
|
||||
{
|
||||
u32 font_id;
|
||||
|
@ -161,6 +166,14 @@ struct KeypadIcon
|
|||
u8 height;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u8 flag_0:1;
|
||||
u8 flag_1:1;
|
||||
u8 flag_2:1;
|
||||
} TextFlags;
|
||||
|
||||
extern TextFlags gTextFlags;
|
||||
|
||||
struct __attribute__((packed)) TextColor
|
||||
{
|
||||
u8 fgColor;
|
||||
|
@ -173,6 +186,13 @@ extern u8 gStringVar2[];
|
|||
extern u8 gStringVar3[];
|
||||
extern u8 gStringVar4[];
|
||||
|
||||
u8 gUnknown_03002F84;
|
||||
u8 gUnknown_03002F90[0x20];
|
||||
u8 gUnknown_03002FB0[0x20];
|
||||
u8 gUnknown_03002FD0[0x20];
|
||||
u8 gUnknown_03002FF0[0x20];
|
||||
u8 gGlyphDimensions[0x2];
|
||||
|
||||
void SetFontsPointer(const struct FontInfo *fonts);
|
||||
void DeactivateAllTextPrinters(void);
|
||||
u16 PrintTextOnWindow(u8 windowId, u8 fontId, u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16));
|
||||
|
@ -201,8 +221,8 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter);
|
|||
void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter);
|
||||
void TextPrinterClearDownArrow(struct TextPrinter *textPrinter);
|
||||
bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter);
|
||||
bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter);
|
||||
bool8 TextPrinterWait(struct TextPrinter *textPrinter);
|
||||
bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter);
|
||||
bool16 TextPrinterWait(struct TextPrinter *textPrinter);
|
||||
void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *counter, u8 *yCoordIndex);
|
||||
u16 RenderText(struct TextPrinter *textPrinter);
|
||||
u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing);
|
||||
|
|
|
@ -248,7 +248,7 @@ SECTIONS {
|
|||
asm/item_icon.o(.text);
|
||||
asm/party_menu.o(.text);
|
||||
asm/battle_tent.o(.text);
|
||||
asm/unk_text_util_2.o(.text);
|
||||
src/unk_text_util_2.o(.text);
|
||||
src/multiboot.o(.text);
|
||||
asm/unk_81BAD84.o(.text);
|
||||
asm/battle_controller_player_partner.o(.text);
|
||||
|
@ -453,7 +453,7 @@ SECTIONS {
|
|||
data/item_icon.o(.rodata);
|
||||
data/party_menu.o(.rodata);
|
||||
data/battle_tent.o(.rodata);
|
||||
data/unk_text_util_2.o(.rodata);
|
||||
src/unk_text_util_2.o(.rodata);
|
||||
data/unk_81BAD84.o(.rodata);
|
||||
data/battle_controller_player_partner.o(.rodata);
|
||||
data/fossil_special_fldeff_groundshake.o(.rodata);
|
||||
|
|
14
src/text.c
14
src/text.c
|
@ -1,9 +1,9 @@
|
|||
#include "global.h"
|
||||
#include "text.h"
|
||||
#include "main.h"
|
||||
#include "palette.h"
|
||||
#include "string_util.h"
|
||||
#include "window.h"
|
||||
#include "text.h"
|
||||
|
||||
extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
|
||||
extern void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
|
||||
|
@ -32,11 +32,7 @@ u8 gUnknown_03002FB0[0x20];
|
|||
u8 gUnknown_03002FD0[0x20];
|
||||
u8 gUnknown_03002FF0[0x20];
|
||||
u8 gGlyphDimensions[0x2];
|
||||
struct {
|
||||
u8 flag_0:1;
|
||||
u8 flag_1:1;
|
||||
u8 flag_2:1;
|
||||
} gTextFlags;
|
||||
TextFlags gTextFlags;
|
||||
|
||||
const u8 gFontHalfRowOffsets[] = {
|
||||
0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00,
|
||||
|
@ -1972,7 +1968,7 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
|
|||
}
|
||||
}
|
||||
|
||||
bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
||||
bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
bool8 result = FALSE;
|
||||
if (gTextFlags.flag_2 != 0)
|
||||
|
@ -1991,9 +1987,9 @@ bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
|||
return result;
|
||||
}
|
||||
|
||||
bool8 TextPrinterWait(struct TextPrinter *textPrinter)
|
||||
bool16 TextPrinterWait(struct TextPrinter *textPrinter)
|
||||
{
|
||||
bool8 result = FALSE;
|
||||
bool16 result = FALSE;
|
||||
if (gTextFlags.flag_2 != 0)
|
||||
{
|
||||
result = TextPrinterWaitAutoMode(textPrinter);
|
||||
|
|
219
src/unk_text_util_2.c
Normal file
219
src/unk_text_util_2.c
Normal file
|
@ -0,0 +1,219 @@
|
|||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "window.h"
|
||||
#include "text.h"
|
||||
#include "sound.h"
|
||||
|
||||
static const u8 gUnknown_08616124[] = {1, 2, 4};
|
||||
static const u16 gFont6BrailleGlyphs[] = INCBIN_U16("data/graphics/fonts/font6.fwjpnfont");
|
||||
|
||||
static void DecompressGlyphFont6(u16);
|
||||
|
||||
u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
u16 char_;
|
||||
struct TextPrinterSubStruct *sub;
|
||||
|
||||
sub = &textPrinter->sub_union.sub;
|
||||
switch (textPrinter->state)
|
||||
{
|
||||
case 0:
|
||||
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->font_type_upper)
|
||||
{
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
if (textPrinter->delayCounter && textPrinter->text_speed)
|
||||
{
|
||||
textPrinter->delayCounter --;
|
||||
if (gTextFlags.flag_0 && gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
{
|
||||
sub->font_type_upper = TRUE;
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
if (gTextFlags.flag_2)
|
||||
{
|
||||
textPrinter->delayCounter = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
textPrinter->delayCounter = textPrinter->text_speed;
|
||||
}
|
||||
char_ = *textPrinter->subPrinter.current_text_offset ++;
|
||||
switch (char_)
|
||||
{
|
||||
case EOS:
|
||||
return 1;
|
||||
case CHAR_NEWLINE:
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.currentY += gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
|
||||
return 2;
|
||||
case PLACEHOLDER_BEGIN:
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_BEGIN:
|
||||
char_ = *textPrinter->subPrinter.current_text_offset ++;
|
||||
switch (char_)
|
||||
{
|
||||
case 1:
|
||||
textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset ++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
return 2;
|
||||
case 2:
|
||||
textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset ++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
return 2;
|
||||
case 3:
|
||||
textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset ++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
return 2;
|
||||
case 4:
|
||||
textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.bgColor = *++ textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.shadowColor = *++ textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
return 2;
|
||||
case 5:
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
return 2;
|
||||
case 6:
|
||||
sub->font_type = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
return 2;
|
||||
case 7:
|
||||
return 2;
|
||||
case 8:
|
||||
textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->state = 6;
|
||||
return 2;
|
||||
case 9:
|
||||
textPrinter->state = 1;
|
||||
if (gTextFlags.flag_2)
|
||||
{
|
||||
sub->frames_visible_counter = 0;
|
||||
}
|
||||
return 3;
|
||||
case 10:
|
||||
textPrinter->state = 5;
|
||||
return 3;
|
||||
case 11:
|
||||
case 16:
|
||||
textPrinter->subPrinter.current_text_offset += 2;
|
||||
return 2;
|
||||
case 12:
|
||||
char_ = *++textPrinter->subPrinter.current_text_offset;
|
||||
break;
|
||||
case 13:
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset ++;
|
||||
return 2;
|
||||
case 14:
|
||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset ++;
|
||||
return 2;
|
||||
case 15:
|
||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
case CHAR_PROMPT_CLEAR:
|
||||
textPrinter->state = 2;
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return 3;
|
||||
case CHAR_PROMPT_SCROLL:
|
||||
textPrinter->state = 3;
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return 3;
|
||||
case 0xF9:
|
||||
char_ = *textPrinter->subPrinter.current_text_offset ++ | 0x100;
|
||||
break;
|
||||
case 0xF8:
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
return 0;
|
||||
}
|
||||
DecompressGlyphFont6(char_);
|
||||
CopyGlyphToWindow(textPrinter);
|
||||
textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing;
|
||||
return 0;
|
||||
case 1:
|
||||
if (TextPrinterWait(textPrinter))
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
case 2:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y;
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
case 3:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
TextPrinterClearDownArrow(textPrinter);
|
||||
textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->state = 4;
|
||||
}
|
||||
return 3;
|
||||
case 4:
|
||||
if (textPrinter->scrollDistance)
|
||||
{
|
||||
if (textPrinter->scrollDistance < gUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed])
|
||||
{
|
||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
textPrinter->scrollDistance = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, gUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
textPrinter->scrollDistance -= gUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed];
|
||||
}
|
||||
CopyWindowToVram(textPrinter->subPrinter.windowId, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
case 5:
|
||||
if (!IsSEPlaying())
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
case 6:
|
||||
if (textPrinter->delayCounter)
|
||||
{
|
||||
textPrinter->delayCounter --;
|
||||
}
|
||||
else
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void DecompressGlyphFont6(u16 glyph)
|
||||
{
|
||||
const u16 *glyphs;
|
||||
|
||||
glyphs = gFont6BrailleGlyphs + 0x100 * (glyph / 8) + 0x10 * (glyph % 8);
|
||||
DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90);
|
||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20));
|
||||
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40));
|
||||
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90 + 0x60));
|
||||
gUnknown_03002F90[0x80] = 0x10;
|
||||
gUnknown_03002F90[0x81] = 0x10;
|
||||
}
|
||||
|
||||
u8 GetGlyphWidthFont6(void)
|
||||
{
|
||||
return 0x10;
|
||||
}
|
Loading…
Reference in a new issue