through sub_812DA14

This commit is contained in:
PikalaxALT
2018-11-25 21:12:07 -05:00
parent 1f9c58abed
commit 5c013a0897
5 changed files with 132 additions and 379 deletions
-355
View File
@@ -5,361 +5,6 @@
.text
thumb_func_start sub_812D840
sub_812D840: @ 812D840
push {lr}
adds r2, r0, 0
movs r1, 0x2E
ldrsh r0, [r2, r1]
cmp r0, 0x1
bne _0812D864
movs r3, 0x24
ldrsh r0, [r2, r3]
subs r0, 0xA
cmp r0, 0
bge _0812D85E
movs r0, 0
strh r0, [r2, 0x24]
strh r0, [r2, 0x2E]
b _0812D882
_0812D85E:
ldrh r0, [r2, 0x24]
subs r0, 0xA
b _0812D880
_0812D864:
cmp r0, 0x2
bne _0812D882
ldrh r1, [r2, 0x24]
movs r3, 0x24
ldrsh r0, [r2, r3]
cmp r0, 0xF0
ble _0812D87C
movs r1, 0
movs r0, 0xF0
strh r0, [r2, 0x24]
strh r1, [r2, 0x2E]
b _0812D882
_0812D87C:
adds r0, r1, 0
adds r0, 0xA
_0812D880:
strh r0, [r2, 0x24]
_0812D882:
pop {r0}
bx r0
thumb_func_end sub_812D840
thumb_func_start sub_812D888
sub_812D888: @ 812D888
push {r4,r5,lr}
sub sp, 0x8
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x1
bne _0812D8B0
ldr r0, _0812D8A8 @ =gUnknown_845FCE4
movs r1, 0x94
movs r2, 0x42
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r4, r0, 24
ldr r0, _0812D8AC @ =gUnknown_845ED60
b _0812D906
.align 2, 0
_0812D8A8: .4byte gUnknown_845FCE4
_0812D8AC: .4byte gUnknown_845ED60
_0812D8B0:
cmp r5, 0xE
bne _0812D8D0
ldr r0, _0812D8C8 @ =gUnknown_845FCFC
movs r1, 0x94
movs r2, 0x42
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r4, r0, 24
ldr r0, _0812D8CC @ =gUnknown_845DD20
b _0812D906
.align 2, 0
_0812D8C8: .4byte gUnknown_845FCFC
_0812D8CC: .4byte gUnknown_845DD20
_0812D8D0:
cmp r5, 0
bne _0812D8F0
ldr r0, _0812D8E8 @ =gUnknown_845FD14
movs r1, 0x94
movs r2, 0x42
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r4, r0, 24
ldr r0, _0812D8EC @ =gUnknown_845F580
b _0812D906
.align 2, 0
_0812D8E8: .4byte gUnknown_845FD14
_0812D8EC: .4byte gUnknown_845F580
_0812D8F0:
cmp r5, 0xD
bne _0812D934
ldr r0, _0812D928 @ =gUnknown_845FD2C
movs r1, 0x94
movs r2, 0x42
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r4, r0, 24
ldr r0, _0812D92C @ =gUnknown_845E540
_0812D906:
movs r1, 0xB0
lsls r1, 1
movs r2, 0x20
bl LoadPalette
ldr r1, _0812D930 @ =gSprites
lsls r0, r4, 4
adds r0, r4
lsls r0, 2
adds r0, r1
ldrb r2, [r0, 0x5]
movs r1, 0xF
ands r1, r2
movs r2, 0x60
orrs r1, r2
strb r1, [r0, 0x5]
b _0812D950
.align 2, 0
_0812D928: .4byte gUnknown_845FD2C
_0812D92C: .4byte gUnknown_845E540
_0812D930: .4byte gSprites
_0812D934:
ldr r0, _0812D98C @ =gUnknown_845F61C
adds r0, r5, r0
ldrb r0, [r0]
movs r1, 0x6
str r1, [sp]
ldr r1, _0812D990 @ =0x0000ffff
str r1, [sp, 0x4]
movs r1, 0x1
movs r2, 0x94
movs r3, 0x42
bl sub_810C2A4
lsls r0, 24
lsrs r4, r0, 24
_0812D950:
ldr r1, _0812D994 @ =gSprites
lsls r0, r4, 4
adds r0, r4
lsls r0, 2
adds r1, 0x1C
adds r0, r1
ldr r1, _0812D998 @ =sub_812D840
str r1, [r0]
ldr r0, _0812D99C @ =gSaveBlock1Ptr
ldr r0, [r0]
lsls r1, r5, 2
adds r0, r1
ldr r1, _0812D9A0 @ =0x00003a54
adds r0, r1
ldrb r0, [r0]
lsls r0, 30
lsrs r0, 30
cmp r0, 0x1
bne _0812D982
ldr r0, _0812D9A4 @ =gUnknown_845F5C0
movs r1, 0xB0
lsls r1, 1
movs r2, 0x20
bl LoadPalette
_0812D982:
adds r0, r4, 0
add sp, 0x8
pop {r4,r5}
pop {r1}
bx r1
.align 2, 0
_0812D98C: .4byte gUnknown_845F61C
_0812D990: .4byte 0x0000ffff
_0812D994: .4byte gSprites
_0812D998: .4byte sub_812D840
_0812D99C: .4byte gSaveBlock1Ptr
_0812D9A0: .4byte 0x00003a54
_0812D9A4: .4byte gUnknown_845F5C0
thumb_func_end sub_812D888
thumb_func_start sub_812D9A8
sub_812D9A8: @ 812D9A8
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 16
lsls r2, r0, 2
adds r2, r0
lsls r2, 3
ldr r0, _0812D9FC @ =gTasks+0x8
adds r4, r2, r0
lsrs r1, 16
ldr r0, _0812DA00 @ =gUnknown_203B0FC
ldr r2, [r0]
ldrb r0, [r2, 0x7]
lsrs r3, r0, 2
subs r0, r3, 0x1
cmp r1, r0
bne _0812D9D0
subs r0, r3, 0x2
lsls r0, 16
lsrs r1, r0, 16
_0812D9D0:
adds r0, r2, 0
adds r0, 0xC
adds r0, r1
ldrb r0, [r0]
cmp r0, 0x1
beq _0812D9E8
cmp r0, 0xE
beq _0812D9E8
cmp r0, 0
beq _0812D9E8
cmp r0, 0xD
bne _0812DA08
_0812D9E8:
movs r0, 0x4
ldrsh r1, [r4, r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, _0812DA04 @ =gSprites
adds r0, r1
bl DestroySprite
b _0812DA0E
.align 2, 0
_0812D9FC: .4byte gTasks+0x8
_0812DA00: .4byte gUnknown_203B0FC
_0812DA04: .4byte gSprites
_0812DA08:
ldrh r0, [r4, 0x4]
bl sub_810C2E8
_0812DA0E:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_812D9A8
thumb_func_start sub_812DA14
sub_812DA14: @ 812DA14
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x14
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl sub_812E064
ldr r1, _0812DAF8 @ =gUnknown_203B0FC
ldr r1, [r1]
lsls r0, 16
lsrs r0, 16
adds r1, 0xC
adds r1, r0
ldrb r0, [r1]
lsls r5, r0, 1
adds r5, r0
lsls r5, 1
adds r5, r4
movs r0, 0x1
bl sub_812E094
ldr r1, _0812DAFC @ =gUnknown_3005EC8
movs r0, 0x1
strb r0, [r1]
movs r0, 0x58
str r0, [sp]
movs r0, 0x20
str r0, [sp, 0x4]
movs r0, 0x3
movs r1, 0
movs r2, 0
movs r3, 0
bl FillWindowPixelRect
ldr r0, _0812DB00 @ =gUnknown_845F89C
lsls r5, 2
adds r0, r5, r0
ldr r6, [r0]
movs r0, 0
adds r1, r6, 0
movs r2, 0
bl GetStringWidth
movs r4, 0x54
subs r0, r4, r0
lsrs r1, r0, 31
adds r0, r1
asrs r0, 1
lsls r2, r0, 24
lsrs r2, 24
movs r7, 0
str r7, [sp]
movs r0, 0x2
mov r10, r0
str r0, [sp, 0x4]
ldr r0, _0812DB04 @ =gUnknown_845F5E3
mov r9, r0
str r0, [sp, 0x8]
movs r0, 0x1
negs r0, r0
mov r8, r0
str r0, [sp, 0xC]
str r6, [sp, 0x10]
movs r0, 0x3
movs r1, 0
movs r3, 0
bl AddTextPrinterParametrized2
ldr r6, _0812DB08 @ =gStringVar1
ldr r0, _0812DB0C @ =gUnknown_845FA1C
adds r5, r0
ldr r1, [r5]
adds r0, r6, 0
bl StringExpandPlaceholders
movs r0, 0
adds r1, r6, 0
movs r2, 0
bl GetStringWidth
subs r4, r0
lsrs r0, r4, 31
adds r4, r0
asrs r0, r4, 1
lsls r2, r0, 24
lsrs r2, 24
str r7, [sp]
mov r0, r10
str r0, [sp, 0x4]
mov r0, r9
str r0, [sp, 0x8]
mov r0, r8
str r0, [sp, 0xC]
str r6, [sp, 0x10]
movs r0, 0x3
movs r1, 0
movs r3, 0xA
bl AddTextPrinterParametrized2
movs r0, 0x3
bl sub_812CEE0
add sp, 0x14
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0812DAF8: .4byte gUnknown_203B0FC
_0812DAFC: .4byte gUnknown_3005EC8
_0812DB00: .4byte gUnknown_845F89C
_0812DB04: .4byte gUnknown_845F5E3
_0812DB08: .4byte gStringVar1
_0812DB0C: .4byte gUnknown_845FA1C
thumb_func_end sub_812DA14
thumb_func_start sub_812DB10
sub_812DB10: @ 812DB10
push {lr}
+2
View File
@@ -11,5 +11,7 @@ u16 sub_818D8AC(u16 species, bool8 isFrontPic, s16 x, s16 y, u8 paletteSlot, u16
u16 sub_818D8F0(u16 spriteId);
u16 sub_818D938(u16 species, bool8 isFrontPic, u16 destX, u16 destY, u8 paletteSlot, u8 windowId);
u8 sub_818D97C(u8 a0, u8 a1);
u8 sub_810C2A4(u16, u8, s16, s16, u8, u16);
void sub_810C2E8(u16);
#endif //GUARD_BATTLE_DOME_CARDS_H
+12 -12
View File
@@ -161,7 +161,7 @@ extern const struct FontInfo *gFonts;
struct GlyphWidthFunc
{
u32 font_id;
u32 (*func)(u16 glyphId, bool32 isJapanese);
s32 (*func)(u16 glyphId, bool32 isJapanese);
};
struct KeypadIcon
@@ -224,9 +224,9 @@ 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);
u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32);
u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing);
s32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing);
s32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32);
s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing);
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str);
u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y);
u8 GetKeypadIconTileOffset(u8 keypadIconId);
@@ -236,19 +236,19 @@ void SetDefaultFontsPointer(void);
u8 GetFontAttribute(u8 fontId, u8 attributeId);
u8 GetMenuCursorDimensionByFont(u8 fontId, u8 whichDimension);
void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese);
u32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont0(u16 glyphId, bool32 isJapanese);
void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese);
u32 GetGlyphWidthFont7(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont7(u16 glyphId, bool32 isJapanese);
void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese);
u32 GetGlyphWidthFont8(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont8(u16 glyphId, bool32 isJapanese);
void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese);
u32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese);
void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese);
u32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont1(u16 glyphId, bool32 isJapanese);
void DecompressGlyphFont9(u16 glyphId);
u32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese);
u32 GetGlyphWidthFont4(u16 glyphId, bool32 isJapanese);
u32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont4(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese);
void sub_80062B0(struct Sprite *sprite);
#endif // GUARD_TEXT_H
+107 -1
View File
@@ -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);
}
+11 -11
View File
@@ -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)
{