summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fame_checker.c108
-rw-r--r--src/text.c22
2 files changed, 118 insertions, 12 deletions
diff --git a/src/fame_checker.c b/src/fame_checker.c
index c5039fa5f..0c7072fb4 100644
--- a/src/fame_checker.c
+++ b/src/fame_checker.c
@@ -109,6 +109,7 @@ void sub_812DB28(void);
void sub_812E000(void);
void sub_812E048(void);
u16 sub_812E064(void);
+void sub_812E094(u8);
void sub_812E110(u8 taskId);
void sub_812E178(u8 a0, s16 a1);
void sub_812E4A4(u8 a0);
@@ -119,9 +120,18 @@ extern const u8 gUnknown_841E5B9[];
extern const u8 gUnknown_841E5D2[];
extern const u16 gUnknown_845C600[];
-extern const u8 *const gUnknown_845F63C[];
+extern const u16 gUnknown_845DD20[];
+extern const u16 gUnknown_845E540[];
+extern const u16 gUnknown_845ED60[];
+extern const u16 gUnknown_845F580[];
+extern const u16 gUnknown_845F5C0[];
extern const struct TextColor gUnknown_845F5E0;
+extern const struct TextColor gUnknown_845F5E3;
+extern const u8 gUnknown_845F61C[];
+extern const u8 *const gUnknown_845F63C[];
extern const u8 *const gUnknown_845F6BC[];
+extern const u8 *const gUnknown_845F89C[];
+extern const u8 *const gUnknown_845FA1C[];
extern const u8 gUnknown_845F83C[];
extern const struct BgTemplate gUnknown_845FBF4[4];
extern const struct SpriteSheet gUnknown_845FB9C[];
@@ -130,6 +140,10 @@ extern const struct WindowTemplate gUnknown_845FC04[];
extern const struct SpriteTemplate gUnknown_845FC44;
extern const struct SpriteTemplate gUnknown_845FC78;
extern const struct SpriteTemplate gUnknown_845FCB8;
+extern const struct SpriteTemplate gUnknown_845FCE4;
+extern const struct SpriteTemplate gUnknown_845FCFC;
+extern const struct SpriteTemplate gUnknown_845FD14;
+extern const struct SpriteTemplate gUnknown_845FD2C;
void sub_812C380(void)
{
@@ -833,3 +847,95 @@ void sub_812D814(void)
FreeSpriteTilesByTag(SPRITETAG_1008);
FreeSpriteTilesByTag(SPRITETAG_1009);
}
+
+void sub_812D840(struct Sprite * sprite)
+{
+ if (sprite->data[0] == 1)
+ {
+ if (sprite->pos2.x - 10 < 0)
+ {
+ sprite->pos2.x = 0;
+ sprite->data[0] = 0;
+ }
+ else
+ sprite->pos2.x -= 10;
+ }
+ else if (sprite->data[0] == 2)
+ {
+ if (sprite->pos2.x > 240)
+ {
+ sprite->pos2.x = 240;
+ sprite->data[0] = 0;
+ }
+ else
+ sprite->pos2.x += 10;
+ }
+}
+
+u8 sub_812D888(u8 a0)
+{
+ u8 r4;
+ if (a0 == 1)
+ {
+ r4 = CreateSprite(&gUnknown_845FCE4, 0x94, 0x42, 0);
+ LoadPalette(gUnknown_845ED60, 0x160, 0x20);
+ gSprites[r4].oam.paletteNum = 6;
+ }
+ else if (a0 == 14)
+ {
+ r4 = CreateSprite(&gUnknown_845FCFC, 0x94, 0x42, 0);
+ LoadPalette(gUnknown_845DD20, 0x160, 0x20);
+ gSprites[r4].oam.paletteNum = 6;
+ }
+ else if (a0 == 0)
+ {
+ r4 = CreateSprite(&gUnknown_845FD14, 0x94, 0x42, 0);
+ LoadPalette(gUnknown_845F580, 0x160, 0x20);
+ gSprites[r4].oam.paletteNum = 6;
+ }
+ else if (a0 == 13)
+ {
+ r4 = CreateSprite(&gUnknown_845FD2C, 0x94, 0x42, 0);
+ LoadPalette(gUnknown_845E540, 0x160, 0x20);
+ gSprites[r4].oam.paletteNum = 6;
+ }
+ else
+ {
+ r4 = sub_810C2A4(gUnknown_845F61C[a0], 1, 0x94, 0x42, 6, 0xFFFF);
+ }
+ gSprites[r4].callback = sub_812D840;
+ if (gSaveBlock1Ptr->fameChecker[a0].unk_0_0 == 1)
+ LoadPalette(gUnknown_845F5C0, 0x160, 0x20);
+ return r4;
+}
+
+void sub_812D9A8(u8 taskId, u16 a1)
+{
+ s16 * data = gTasks[taskId].data;
+ u16 r1 = a1;
+ if (a1 == gUnknown_203B0FC->unk_07_2 - 1)
+ r1 = a1 - 1;
+ if ( gUnknown_203B0FC->unk_0C[r1] == 1
+ || gUnknown_203B0FC->unk_0C[r1] == 14
+ || gUnknown_203B0FC->unk_0C[r1] == 0
+ || gUnknown_203B0FC->unk_0C[r1] == 13
+ )
+ DestroySprite(&gSprites[data[2]]);
+ else
+ sub_810C2E8(data[2]);
+}
+
+void sub_812DA14(u8 a0)
+{
+ s32 width;
+ u32 r5 = 6 * gUnknown_203B0FC->unk_0C[sub_812E064()] + a0;
+ sub_812E094(1);
+ gUnknown_3005EC8 = 1;
+ FillWindowPixelRect(3, 0x00, 0, 0, 0x58, 0x20);
+ width = (0x54 - GetStringWidth(0, gUnknown_845F89C[r5], 0)) / 2;
+ AddTextPrinterParametrized2(3, 0, width, 0, 0, 2, &gUnknown_845F5E3, -1, gUnknown_845F89C[r5]);
+ StringExpandPlaceholders(gStringVar1, gUnknown_845FA1C[r5]);
+ width = (0x54 - GetStringWidth(0, gStringVar1, 0)) / 2;
+ AddTextPrinterParametrized2(3, 0, width, 10, 0, 2, &gUnknown_845F5E3, -1, gStringVar1);
+ sub_812CEE0(3);
+}
diff --git a/src/text.c b/src/text.c
index d4d25b5aa..874e12fd5 100644
--- a/src/text.c
+++ b/src/text.c
@@ -17,7 +17,7 @@ extern void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16
extern u8 GetKeypadIconWidth(u8 keypadIconId);
extern void CopyWindowToVram(u8 windowId, u8 mode);
extern u16 Font6Func(struct TextPrinter *textPrinter);
-extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese);
+extern s32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese);
extern void PlaySE(u16 songNum);
extern u8* UnkTextUtil_GetPtrI(u8 a1);
@@ -1388,7 +1388,7 @@ _08005D6A:\n\
.syntax divided");
}
-u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
+s32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
{
int i;
u8 width;
@@ -1479,7 +1479,7 @@ u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing)
return (u8)(GetFontAttribute(fontId, 0) + letterSpacing) * width;
}
-u32 (*GetFontWidthFunc(u8 glyphId))(u16 _glyphId, bool32 _isJapanese)
+s32 (*GetFontWidthFunc(u8 glyphId))(u16 _glyphId, bool32 _isJapanese)
{
u32 i;
@@ -1492,11 +1492,11 @@ u32 (*GetFontWidthFunc(u8 glyphId))(u16 _glyphId, bool32 _isJapanese)
return NULL;
}
-u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
+s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
{
bool8 isJapanese;
int minGlyphWidth;
- u32 (*func)(u16 glyphId, bool32 isJapanese);
+ s32 (*func)(u16 glyphId, bool32 isJapanese);
int localLetterSpacing;
register u32 lineWidth asm("r5");
u8 *bufferPointer;
@@ -1863,7 +1863,7 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
}
}
-u32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese)
+s32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese)
{
if (isJapanese == TRUE)
return 8;
@@ -1896,7 +1896,7 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
}
}
-u32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese)
+s32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese)
{
if (isJapanese == TRUE)
return 8;
@@ -1962,7 +1962,7 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
}
}
-u32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese)
+s32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese)
{
if (isJapanese == TRUE)
{
@@ -2012,7 +2012,7 @@ void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese)
DecompressGlyphFont2(glyphId, isJapanese);
}
-u32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese)
+s32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese)
{
if(isJapanese == TRUE)
return 10;
@@ -2078,7 +2078,7 @@ void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese)
}
}
-u32 GetGlyphWidthFont4(u16 glyphId, bool32 isJapanese)
+s32 GetGlyphWidthFont4(u16 glyphId, bool32 isJapanese)
{
if(isJapanese == TRUE)
{
@@ -2149,7 +2149,7 @@ void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese)
}
}
-u32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese)
+s32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese)
{
if(isJapanese == TRUE)
{