start code_80521D0

This commit is contained in:
DizzyEggg 2024-10-18 16:35:13 +02:00
parent 25436f0352
commit bf99d37eda
9 changed files with 242 additions and 476 deletions

View File

@ -5,410 +5,6 @@
.text .text
thumb_func_start sub_80523A8
sub_80523A8:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x40
adds r3, r0, 0
adds r4, r1, 0
lsls r2, 24
lsrs r2, 24
mov r10, r2
ldr r0, _080523D0
ldr r1, [r0]
adds r2, r0, 0
cmp r1, r3
beq _080523D8
movs r7, 0x1
ldr r1, _080523D4
b _080523DE
.align 2, 0
_080523D0: .4byte gUnknown_202F1E8
_080523D4: .4byte gUnknown_203B434
_080523D8:
ldr r0, _080523F0
ldrb r7, [r0]
adds r1, r0, 0
_080523DE:
movs r0, 0x1
mov r8, r0
str r3, [r2]
movs r0, 0
strb r0, [r1]
movs r1, 0
mov r9, r1
b _080523FA
.align 2, 0
_080523F0: .4byte gUnknown_203B434
_080523F4:
movs r0, 0
bl sub_803E46C
_080523FA:
ldr r6, _0805249C
ldr r2, [r6]
ldr r3, _080524A0
adds r0, r2, r3
movs r3, 0
ldrsh r1, [r0, r3]
adds r1, 0x1
cmp r1, 0xA
bne _0805240E
movs r1, 0
_0805240E:
ldr r3, _080524A4
adds r0, r2, r3
movs r3, 0
ldrsh r0, [r0, r3]
cmp r1, r0
beq _080523F4
ldrb r0, [r4]
cmp r0, 0
beq _080524B0
ldr r5, _080524A0
adds r0, r2, r5
movs r3, 0
ldrsh r1, [r0, r3]
ldr r3, _080524A8
adds r0, r2, r3
adds r0, r1
strb r7, [r0]
adds r0, r4, 0
mov r1, sp
mov r2, sp
adds r2, 0x3E
movs r3, 0x80
bl xxx_format_string
adds r4, r0, 0
ldrb r0, [r4]
cmp r0, 0xD
bne _08052448
adds r4, 0x1
_08052448:
ldrb r0, [r4]
cmp r0, 0xA
bne _08052450
adds r4, 0x1
_08052450:
mov r0, sp
adds r1, r7, 0
mov r2, r8
bl sub_8053210
movs r7, 0
movs r0, 0
mov r8, r0
mov r1, r10
cmp r1, 0
beq _080523FA
movs r2, 0x1
mov r9, r2
ldr r1, [r6]
adds r0, r1, r5
movs r3, 0
ldrsh r0, [r0, r3]
lsls r0, 6
adds r0, r1
ldr r1, _080524AC
adds r0, r1
mov r1, sp
movs r2, 0x40
bl strncpy
ldr r0, [r6]
adds r1, r0, r5
ldrh r0, [r1]
adds r0, 0x1
strh r0, [r1]
lsls r0, 16
asrs r0, 16
cmp r0, 0xA
bne _080523FA
mov r2, r8
strh r2, [r1]
b _080523FA
.align 2, 0
_0805249C: .4byte gDungeon
_080524A0: .4byte 0x0001c060
_080524A4: .4byte 0x0001c062
_080524A8: .4byte 0x0001c054
_080524AC: .4byte 0x0001bdd4
_080524B0:
mov r3, r9
cmp r3, 0
beq _080524D4
ldr r0, _080524E4
ldr r2, [r0]
ldr r3, _080524E8
adds r1, r2, r3
movs r0, 0xF0
strh r0, [r1]
ldr r0, _080524EC
adds r2, r0
ldr r0, [r2]
cmp r0, 0
bne _080524D0
movs r0, 0x1
str r0, [r2]
_080524D0:
bl sub_805E804
_080524D4:
add sp, 0x40
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080524E4: .4byte gDungeon
_080524E8: .4byte 0x0001c064
_080524EC: .4byte 0x0001c06c
thumb_func_end sub_80523A8
thumb_func_start xxx_draw_string_80524F0
xxx_draw_string_80524F0:
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x3C
ldr r0, _0805251C
ldr r0, [r0]
ldr r1, _08052520
adds r7, r0, r1
ldr r2, _08052524
adds r5, r0, r2
ldr r1, [r5]
cmp r1, 0x1
beq _08052528
cmp r1, 0x1
bcs _08052510
b _0805267C
_08052510:
cmp r1, 0x2
beq _0805253C
cmp r1, 0x3
bne _0805251A
b _0805265C
_0805251A:
b _0805267C
.align 2, 0
_0805251C: .4byte gDungeon
_08052520: .4byte 0x0001bdd4
_08052524: .4byte 0x0001c06c
_08052528:
bl sub_800EC74
lsls r0, 24
cmp r0, 0
beq _08052534
b _0805267C
_08052534:
movs r0, 0x3
movs r1, 0
bl sub_803EAF0
_0805253C:
ldr r3, _08052560
adds r0, r7, r3
movs r1, 0
ldrsh r4, [r0, r1]
movs r2, 0xA3
lsls r2, 2
adds r0, r7, r2
movs r3, 0
ldrsh r0, [r0, r3]
cmp r4, r0
bne _08052564
movs r0, 0xA6
lsls r0, 2
adds r1, r7, r0
movs r0, 0
str r0, [r1]
b _0805267C
.align 2, 0
_08052560: .4byte 0x0000028e
_08052564:
lsls r0, r4, 6
adds r5, r7, r0
add r1, sp, 0x4
movs r0, 0x4
strh r0, [r1]
ldr r2, _080525B0
adds r6, r7, r2
ldrh r0, [r6]
strh r0, [r1, 0x2]
movs r3, 0x7
mov r8, r3
str r3, [sp, 0x14]
movs r0, 0
bl sub_80073B8
movs r1, 0xA0
lsls r1, 2
adds r0, r7, r1
adds r0, r4
ldrb r0, [r0]
cmp r0, 0
beq _080525AA
movs r2, 0
ldrsh r0, [r6, r2]
cmp r0, 0x7
ble _080525AA
adds r2, r0, 0
subs r2, 0x1
mov r0, r8
str r0, [sp]
movs r0, 0
movs r1, 0
movs r3, 0xE0
bl sub_80078A4
_080525AA:
adds r6, r4, 0x1
b _080525F2
.align 2, 0
_080525B0: .4byte 0x00000292
_080525B4:
add r1, sp, 0x38
adds r0, r5, 0
bl xxx_get_next_char_from_string
adds r5, r0, 0
ldr r4, [sp, 0x38]
cmp r4, 0x60
bne _080525D0
add r1, sp, 0x4
adds r0, r1, 0
ldrh r0, [r0]
adds r0, 0x6
strh r0, [r1]
b _080525F2
_080525D0:
add r0, sp, 0x4
movs r1, 0
ldrsh r0, [r0, r1]
add r1, sp, 0x4
movs r2, 0x2
ldrsh r1, [r1, r2]
ldr r3, [sp, 0x14]
movs r2, 0
str r2, [sp]
adds r2, r4, 0
bl xxx_call_draw_char
add r2, sp, 0x4
adds r1, r2, 0
ldrh r1, [r1]
adds r1, r0
strh r1, [r2]
_080525F2:
adds r0, r5, 0
add r1, sp, 0x4
bl xxx_handle_format_global
adds r5, r0, 0
ldrb r0, [r5]
cmp r0, 0
beq _0805260A
cmp r0, 0xD
beq _0805260A
cmp r0, 0xA
bne _080525B4
_0805260A:
movs r0, 0
bl sub_80073E0
movs r3, 0xA4
lsls r3, 2
adds r1, r7, r3
movs r0, 0xF0
strh r0, [r1]
adds r4, r6, 0
cmp r4, 0xA
bne _08052622
movs r4, 0
_08052622:
ldr r1, _08052654
adds r0, r7, r1
strh r4, [r0]
ldr r2, _08052658
adds r1, r7, r2
ldrh r0, [r1]
adds r0, 0xB
strh r0, [r1]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2F
ble _0805267C
movs r0, 0x25
strh r0, [r1]
movs r3, 0xA5
lsls r3, 2
adds r1, r7, r3
movs r0, 0
strh r0, [r1]
movs r0, 0xA6
lsls r0, 2
adds r1, r7, r0
movs r0, 0x3
str r0, [r1]
b _0805267C
.align 2, 0
_08052654: .4byte 0x0000028e
_08052658: .4byte 0x00000292
_0805265C:
ldr r1, _080526C4
adds r4, r0, r1
ldrh r0, [r4]
adds r0, 0x1
strh r0, [r4]
ldr r0, _080526C8
ldr r1, [r0]
movs r0, 0
bl _call_via_r1
movs r2, 0
ldrsh r0, [r4, r2]
cmp r0, 0xA
ble _0805267C
movs r0, 0x2
str r0, [r5]
_0805267C:
ldr r3, _080526CC
adds r0, r7, r3
ldrb r0, [r0]
cmp r0, 0
bne _080526B8
movs r0, 0xA4
lsls r0, 2
adds r1, r7, r0
ldrh r2, [r1]
movs r3, 0
ldrsh r0, [r1, r3]
cmp r0, 0
beq _080526B8
subs r0, r2, 0x1
strh r0, [r1]
lsls r0, 16
asrs r1, r0, 16
cmp r1, 0
bne _080526B8
movs r2, 0xA6
lsls r2, 2
adds r0, r7, r2
str r1, [r0]
movs r0, 0
movs r1, 0
bl sub_803EAF0
movs r0, 0
bl sub_8052210
_080526B8:
add sp, 0x3C
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080526C4: .4byte 0x0001c068
_080526C8: .4byte gUnknown_203B08C
_080526CC: .4byte 0x0000028a
thumb_func_end xxx_draw_string_80524F0
thumb_func_start sub_80526D0 thumb_func_start sub_80526D0
sub_80526D0: sub_80526D0:
push {r4,r5,lr} push {r4,r5,lr}

View File

@ -6,19 +6,19 @@
#include "structs/str_text.h" #include "structs/str_text.h"
// code_80130A8.s // code_80130A8.s
extern void sub_8013E54(void); void sub_8013E54(void);
extern void sub_8013F84(void); void sub_8013F84(void);
extern void sub_80140B4(UnkTextStruct2 *); void sub_80140B4(UnkTextStruct2 *);
extern void sub_80140DC(void); void sub_80140DC(void);
extern void sub_8014114(void); void sub_8014114(void);
extern void xxx_info_box_80141B4(const u8 *, u32, OpenedFile **, u16); void xxx_info_box_80141B4(const u8 *, u32, OpenedFile **, u16);
extern void sub_8014248(const u8 *, u32, u32, const MenuItem *, void *, u32, u32, OpenedFile **, u32); void sub_8014248(const u8 *, u32, u32, const MenuItem *, void *, u32, u32, OpenedFile **, u32);
extern s32 sub_80144A4(s32 *); s32 sub_80144A4(s32 *);
extern void sub_80151C0(u32, u8 *); void sub_80151C0(u32, u8 *);
extern u32 sub_80154F0(void); u32 sub_80154F0(void);
extern void sub_80155F0(void); void sub_80155F0(void);
extern void xxx_draw_string_80144C4(void); void xxx_draw_string_80144C4(void);
extern void PrintFormatStringOnWindow(u32, u32, const u8 *, u32 windowId, u32); void PrintFormatStringOnWindow(u32, u32, const u8 *, u32 windowId, u32);
extern void xxx_format_string(const u8 *, u8 *, u8 *, u32); u8 *xxx_format_string(const u8 *, u8 *, u8 *, u32);
#endif // GUARD_CODE_80130A8_H #endif // GUARD_CODE_80130A8_H

View File

@ -211,6 +211,22 @@ struct unkStruct_Dungeon64C
u32 unk4; u32 unk4;
}; };
#define UNK_1BBD4_STR_COUNT 10
struct UnkStructDungeon1BDD4
{
u8 unk0[UNK_1BBD4_STR_COUNT][64];
u8 unk1C054[UNK_1BBD4_STR_COUNT]; // 0x280
u8 unk1C05E; // 0x28A
u8 fill1C05F; // 0x28B
s16 unk1C060; // 0x28C
s16 unk1C062; // 0x29E
s16 unk1C064; // 0x290
s16 unk1C066; // 0x292
s16 unk1C068; // 0x294
u32 unk1C06C; // 0x298
};
// size: 0x1CEDC // size: 0x1CEDC
typedef struct Dungeon typedef struct Dungeon
{ {
@ -379,10 +395,8 @@ typedef struct Dungeon
/* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX]; /* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX];
/* 0x181E4 */ OpenedFile *paletFile; /* 0x181E4 */ OpenedFile *paletFile;
/* 0x181E8 */ UnkDungeonGlobal_unk181E8_sub unk181e8; /* 0x181E8 */ UnkDungeonGlobal_unk181E8_sub unk181e8;
u8 fill18220[0x1C05E - 0x1822C]; u8 fill18220[0x1BDD4 - 0x1822C];
u8 unk1C05E; struct UnkStructDungeon1BDD4 unk1BDD4;
u8 fill1C05F[0x1C06C - 0x1C05F];
u32 unk1C06C;
u8 fill1C070[0x1C570 - 0x1C070]; u8 fill1C070[0x1C570 - 0x1C070];
/* 0x1C570 */ DungeonLocation unk1C570; /* 0x1C570 */ DungeonLocation unk1C570;
/* 0x1C574 */ UnkDungeonGlobal_unk1C574 unk1C574; /* 0x1C574 */ UnkDungeonGlobal_unk1C574 unk1C574;

View File

@ -32,6 +32,39 @@ struct unkStruct_80B8848
u32 xxx_call_draw_char(s32, s32, u32, u32, u32); u32 xxx_call_draw_char(s32, s32, u32, u32, u32);
struct UnkDrawStringStruct;
struct UnkDrawStringStruct
{
s16 unk0;
s16 unk2;
s16 unk4;
s16 unk6;
s16 unk8;
s16 unkA;
s32 unkC;
u32 unk10;
u32 unk14;
u32 unk18;
u32 unk1C;
u8 unk20;
u8 unk21;
u8 fill22;
u8 fill23;
const u8* (*unk24)(const u8 *, const u8 *, struct UnkDrawStringStruct*);
u8 fill28;
u8 fill29;
u8 fill2A;
u8 fill2B;
u32 unk2C;
u8 fill30;
u8 fill31;
u8 fill32;
u8 fill33;
u32 unk34;
};
void RestoreUnkTextStruct_8006518(UnkTextStruct2 *); void RestoreUnkTextStruct_8006518(UnkTextStruct2 *);
void sub_8006554(UnkTextStruct1 *, u32 *, u32 *, u16 *, u32, const UnkTextStruct2 *, u8, u32, UnkTextStruct2_sub *, u8); void sub_8006554(UnkTextStruct1 *, u32 *, u32 *, u16 *, u32, const UnkTextStruct2 *, u8, u32, UnkTextStruct2_sub *, u8);
void sub_80073B8(s32); void sub_80073B8(s32);
@ -41,6 +74,8 @@ void sub_800792C(u32, s32, s32, s32, u32);
void sub_8007A78(u32, s32, s32, s32, u32); void sub_8007A78(u32, s32, s32, s32, u32);
void sub_8007B7C(u32, s32, s32, s32, u32); void sub_8007B7C(u32, s32, s32, s32, u32);
void sub_8007E20(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, u32 *a5, u32 a6); void sub_8007E20(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, u32 *a5, u32 a6);
const u8 *xxx_get_next_char_from_string(const u8 *a1, u32 *a0);
const u8 *xxx_handle_format_global(const u8 *str, struct UnkDrawStringStruct *unkStrPtr);
// text.s // text.s
extern const struct unkChar *GetCharacter(s32); extern const struct unkChar *GetCharacter(s32);

View File

@ -86,9 +86,9 @@ void sub_803E490(u32 unused)
sub_803EDF0(); sub_803EDF0();
if(gDungeon->unk181e8.unk18215 != 0 && gDungeon->unk1C06C != 3) if(gDungeon->unk181e8.unk18215 != 0 && gDungeon->unk1BDD4.unk1C06C != 3)
sub_8004AF0(gUnknown_203B40D, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (u8 *)gDungeon->unk17C); sub_8004AF0(gUnknown_203B40D, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (u8 *)gDungeon->unk17C);
nullsub_8(gGameOptionsRef->unkA); nullsub_8(gGameOptionsRef->unkA);
sub_8005180(); sub_8005180();
nullsub_12(); nullsub_12();
@ -103,13 +103,13 @@ void sub_803E490(u32 unused)
nullsub_13(); nullsub_13();
sub_8005304(); sub_8005304();
nullsub_14(); nullsub_14();
TransferBGPaletteBuffer(); TransferBGPaletteBuffer();
sub_8009908(); sub_8009908();
xxx_call_update_bg_vram(); xxx_call_update_bg_vram();
sub_8040788(); sub_8040788();
xxx_call_update_bg_sound_input(); xxx_call_update_bg_sound_input();
gDungeon->unk181e8.unk18213 = 0; gDungeon->unk181e8.unk18213 = 0;
UpdateDungeonMusic(); UpdateDungeonMusic();
sub_8011860(); sub_8011860();
@ -156,7 +156,7 @@ void sub_803E708(s32 a0, u32 a1)
void sub_803E724(s32 r0) void sub_803E724(s32 r0)
{ {
do do
{ {
sub_803E46C(r0); sub_803E46C(r0);
} while (gRealInputs.held & 0xF0); } while (gRealInputs.held & 0xF0);
@ -225,7 +225,7 @@ void sub_803E7C8(void)
gUnknown_203B40D = 0; gUnknown_203B40D = 0;
} }
void sub_803E830(void) void sub_803E830(void)
{ {
s32 index; s32 index;

View File

@ -101,7 +101,7 @@ void sub_803E874(bool8 r10, s32 r9)
index++; index++;
} }
if (gDungeon->unk181e8.unk18215 == 0 || gDungeon->unk1C06C == 3) { if (gDungeon->unk181e8.unk18215 == 0 || gDungeon->unk1BDD4.unk1C06C == 3) {
sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (void *) &gDungeon->unk17C); sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
} }
@ -169,7 +169,7 @@ void sub_803EA10(void)
index++; index++;
} }
if (gDungeon->unk181e8.unk18215 == 0 || gDungeon->unk1C06C == 3) { if (gDungeon->unk181e8.unk18215 == 0 || gDungeon->unk1BDD4.unk1C06C == 3) {
sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (void *) &gDungeon->unk17C); sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (void *) &gDungeon->unk17C);
} }

View File

@ -593,7 +593,7 @@ void xxx_dungeon_8042F6C(struct UnkStruct_xxx_dungeon_8042F6C *r8)
gDungeon->unkB = 1; gDungeon->unkB = 1;
gDungeon->unkD = 1; gDungeon->unkD = 1;
gDungeon->unkE = 0; gDungeon->unkE = 0;
gDungeon->unk1C05E = 0; gDungeon->unk1BDD4.unk1C05E = 0;
if (!r6) { if (!r6) {
gDungeon->unk679 = 0; gDungeon->unk679 = 0;
gDungeon->unk68C = 0; gDungeon->unk68C = 0;

View File

@ -1,9 +1,15 @@
#include "global.h" #include "global.h"
#include "dungeon.h"
#include "structs/dungeon_entity.h"
#include "code_80521D0.h" #include "code_80521D0.h"
#include "code_803E46C.h"
#include "code_80130A8.h"
#include "code_800E9E4.h"
#include "text2.h"
extern void sub_80526D0(u8 r0); extern void sub_80526D0(u8 r0);
extern bool8 sub_8045888(Entity *r0); extern bool8 sub_8045888(Entity *r0);
extern void sub_80523A8(Entity *r0, const char r1[], u8 r2); void sub_80523A8(Entity *r0, const char *str, u8 r2);
extern u8 sub_8052DC0(Entity *); extern u8 sub_8052DC0(Entity *);
extern u8 sub_803F428(Position *); extern u8 sub_803F428(Position *);
@ -19,19 +25,19 @@ void SendMessage(Entity *pokemon, const char message[])
} }
} }
void sub_80522C8(Entity *r0, const char r1[]) void sub_80522C8(Entity *r0, const char *str)
{ {
if (sub_8045888(r0)){ if (sub_8045888(r0)){
sub_80523A8(r0, r1, 0); sub_80523A8(r0, str, 0);
} }
} }
void sub_80522E8(Entity *r0, const char r1[]) void sub_80522E8(Entity *r0, const char *str)
{ {
sub_80523A8(r0, r1, 0); sub_80523A8(r0, str, 0);
} }
void sub_80522F4(Entity *r0, Entity *r1, const char r2[]) void sub_80522F4(Entity *r0, Entity *r1, const char *str)
{ {
u8 flag; u8 flag;
flag = sub_8045888(r0) ? TRUE : FALSE; flag = sub_8045888(r0) ? TRUE : FALSE;
@ -41,11 +47,11 @@ void sub_80522F4(Entity *r0, Entity *r1, const char r2[])
} }
if(flag) if(flag)
{ {
sub_80523A8(r0, r2, 1); sub_80523A8(r0, str, 1);
} }
} }
void sub_805232C(Entity *r0, Entity *r1, const char r2[]) void sub_805232C(Entity *r0, Entity *r1, const char *str)
{ {
u8 flag; u8 flag;
flag = sub_8045888(r0) ? TRUE : FALSE; flag = sub_8045888(r0) ? TRUE : FALSE;
@ -55,11 +61,11 @@ void sub_805232C(Entity *r0, Entity *r1, const char r2[])
} }
if(flag) if(flag)
{ {
sub_80523A8(r0, r2, 0); sub_80523A8(r0, str, 0);
} }
} }
void sub_8052364(Entity *r0, Position *pos, const char r2[]) void sub_8052364(Entity *r0, Position *pos, const char *str)
{ {
u8 flag; u8 flag;
flag = sub_8045888(r0) ? TRUE : FALSE; flag = sub_8045888(r0) ? TRUE : FALSE;
@ -69,11 +75,158 @@ void sub_8052364(Entity *r0, Position *pos, const char r2[])
} }
if(flag) if(flag)
{ {
sub_80523A8(r0, r2, 1); sub_80523A8(r0, str, 1);
} }
} }
void sub_805239C(Entity *r0, const char r1[]) void sub_805239C(Entity *r0, const char *str)
{ {
sub_80523A8(r0, r1, 1); sub_80523A8(r0, str, 1);
} }
void sub_8053210(u8 *txt, u32 a1, u32 a2);
extern Entity *gUnknown_202F1E8;
extern u8 gUnknown_203B434;
extern void sub_805E804(void);
void sub_80523A8(Entity *r0, const char *str, bool8 r2)
{
u8 txt[64];
u32 r7;
bool32 r8, r9;
if (gUnknown_202F1E8 != r0) {
r7 = 1;
}
else {
r7 = gUnknown_203B434;
}
r8 = 1;
gUnknown_202F1E8 = r0;
gUnknown_203B434 = 0;
r9 = FALSE;
while (1) {
while (1) {
s32 val = gDungeon->unk1BDD4.unk1C060;
if (++val == UNK_1BBD4_STR_COUNT) {
val = 0;
}
if (val != gDungeon->unk1BDD4.unk1C062) {
break;
}
sub_803E46C(0);
}
if (*str == '\0')
break;
gDungeon->unk1BDD4.unk1C054[gDungeon->unk1BDD4.unk1C060] = r7;
str = xxx_format_string(str, txt, txt + 62, 128);
if (*str == '\r') str++;
if (*str == '\n') str++;
sub_8053210(txt, r7, r8);
r7 = 0;
r8 = 0;
if (r2) {
u8 *dst;
r9 = TRUE;
dst = gDungeon->unk1BDD4.unk0[gDungeon->unk1BDD4.unk1C060];
dst++;dst--; // TODO: use ASM_MATCH_TRICK
strncpy(dst, txt, 64);
if (++gDungeon->unk1BDD4.unk1C060 == UNK_1BBD4_STR_COUNT) {
gDungeon->unk1BDD4.unk1C060 = 0;
}
}
}
if (r9) {
gDungeon->unk1BDD4.unk1C064 = 0xF0;
if (gDungeon->unk1BDD4.unk1C06C == 0) {
gDungeon->unk1BDD4.unk1C06C = 1;
}
sub_805E804();
}
}
extern void (*gUnknown_203B08C)(s32);
extern void sub_803EAF0(s32, s32);
extern void sub_8052210(u32);
void xxx_draw_string_80524F0(void)
{
struct UnkStructDungeon1BDD4 *strPtr = &gDungeon->unk1BDD4;
switch (strPtr->unk1C06C) {
case 0:
break;
case 1:
if (sub_800EC74())
break;
sub_803EAF0(3, 0);
// fall through
case 2: {
struct UnkDrawStringStruct sp;
s32 id = strPtr->unk1C062;
if (id == strPtr->unk1C060) {
strPtr->unk1C06C = 0;
}
else {
const u8 *txtPtr = strPtr->unk0[id];
sp.unk0 = 4;
sp.unk2 = strPtr->unk1C066;
sp.unk10 = 7;
sub_80073B8(0);
if (strPtr->unk1C054[id] != 0 && strPtr->unk1C066 >= 8) {
sub_80078A4(0, 0, strPtr->unk1C066 - 1, 0xE0, 7);
}
while (1) {
txtPtr = xxx_handle_format_global(txtPtr, &sp);
if (*txtPtr == '\0' || *txtPtr == '\r' || *txtPtr == '\n')
break;
txtPtr = xxx_get_next_char_from_string(txtPtr, &sp.unk34);
if (sp.unk34 == 96) {
sp.unk0 += 6;
}
else {
sp.unk0 += xxx_call_draw_char(sp.unk0, sp.unk2, sp.unk34, sp.unk10, 0);
}
}
sub_80073E0(0);
strPtr->unk1C064 = 240;
if (++id == UNK_1BBD4_STR_COUNT) {
id = 0;
}
strPtr->unk1C062 = id;
strPtr->unk1C066 += 11;
if (strPtr->unk1C066 >= 48) {
strPtr->unk1C066 = 37;
strPtr->unk1C068 = 0;
strPtr->unk1C06C = 3;
}
}
break;
}
case 3:
strPtr->unk1C068++;
gUnknown_203B08C(0);
if (strPtr->unk1C068 > 10) {
strPtr->unk1C06C = 2;
}
break;
}
if (strPtr->unk1C05E == 0 && strPtr->unk1C064 != 0 && --strPtr->unk1C064 == 0) {
strPtr->unk1C06C = 0;
sub_803EAF0(0, 0);
sub_8052210(0);
}
}

View File

@ -3408,38 +3408,6 @@ UNUSED void sub_8008FF0(s32 x, u32 y, const u8 *str, u32 windowId, u32 a4)
UNUSED void nullsub_171(void) {} UNUSED void nullsub_171(void) {}
struct UnkDrawStringStruct;
struct UnkDrawStringStruct
{
s16 unk0;
s16 unk2;
s16 unk4;
s16 unk6;
s16 unk8;
s16 unkA;
s32 unkC;
u32 unk10;
u32 unk14;
u32 unk18;
u32 unk1C;
u8 unk20;
u8 unk21;
u8 fill22;
u8 fill23;
const u8* (*unk24)(const u8 *, const u8 *, struct UnkDrawStringStruct*);
u8 fill28;
u8 fill29;
u8 fill2A;
u8 fill2B;
u32 unk2C;
u8 fill30;
u8 fill31;
u8 fill32;
u8 fill33;
u32 unk34;
};
const u8 *HandleTextFormat(UnkTextStruct1 *strArr, const u8 *str, struct UnkDrawStringStruct *sp); const u8 *HandleTextFormat(UnkTextStruct1 *strArr, const u8 *str, struct UnkDrawStringStruct *sp);
void xxx_draw_string(UnkTextStruct1 *strArr, s32 x, s32 y, const u8 *str, u32 windowId, s32 a5, s32 a6, s32 a7) void xxx_draw_string(UnkTextStruct1 *strArr, s32 x, s32 y, const u8 *str, u32 windowId, s32 a5, s32 a6, s32 a7)