mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Font6Func
This commit is contained in:
parent
ed9e0e2054
commit
15212c4f8d
@ -5,529 +5,6 @@
|
||||
|
||||
.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}
|
||||
|
@ -78,6 +78,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 TextPrinter
|
||||
{
|
||||
struct TextSubPrinter { // TODO: Better name
|
||||
@ -99,20 +115,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;
|
||||
@ -138,6 +141,8 @@ struct FontInfo
|
||||
u8 shadowColor:4;
|
||||
};
|
||||
|
||||
extern const struct FontInfo *gFonts;
|
||||
|
||||
struct GlyphWidthFunc{
|
||||
u32 font_id;
|
||||
u32 (*func)(u16 glyphId, bool32 isJapanese);
|
||||
@ -149,11 +154,26 @@ struct KeypadIcon {
|
||||
u8 height;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u8 flag_0:1;
|
||||
u8 flag_1:1;
|
||||
u8 flag_2:1;
|
||||
} TextFlags;
|
||||
|
||||
extern TextFlags gTextFlags;
|
||||
|
||||
extern u8 gStringVar1[];
|
||||
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));
|
||||
@ -182,8 +202,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);
|
||||
|
@ -253,6 +253,7 @@ SECTIONS {
|
||||
asm/item_icon.o(.text);
|
||||
asm/party_menu.o(.text);
|
||||
asm/battle_tent.o(.text);
|
||||
src/unk_text_util_2.o(.text);
|
||||
asm/unk_text_util_2.o(.text);
|
||||
src/multiboot.o(.text);
|
||||
asm/unk_81BAD84.o(.text);
|
||||
|
12
src/text.c
12
src/text.c
@ -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,
|
||||
@ -1973,7 +1969,7 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
|
||||
}
|
||||
}
|
||||
|
||||
bool8 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
||||
bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
bool8 result = FALSE;
|
||||
if (gTextFlags.flag_2 != 0)
|
||||
@ -1992,9 +1988,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);
|
||||
|
200
src/unk_text_util_2.c
Normal file
200
src/unk_text_util_2.c
Normal file
@ -0,0 +1,200 @@
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "window.h"
|
||||
#include "text.h"
|
||||
#include "sound.h"
|
||||
|
||||
extern const u8 gUnknown_08616124[];
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user