move two functions to dungeon_message.c

This commit is contained in:
DizzyEggg 2024-10-25 20:21:56 +02:00
parent 4c4ec10806
commit a2bc2f66ec
7 changed files with 59 additions and 118 deletions

View File

@ -4518,103 +4518,4 @@ _080521CA:
bx r1 bx r1
thumb_func_end sub_805210C thumb_func_end sub_805210C
thumb_func_start sub_80521D0
sub_80521D0:
push {r4-r6,lr}
movs r1, 0
ldr r5, _08052200
ldr r6, _08052204
ldr r4, _08052208
ldr r3, _0805220C
movs r2, 0
_080521DE:
ldr r0, [r4]
adds r0, r3
adds r0, r1
strb r2, [r0]
adds r1, 0x1
cmp r1, 0x9
ble _080521DE
movs r0, 0
str r0, [r5]
movs r0, 0x1
strb r0, [r6]
movs r0, 0
bl sub_8052210
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08052200: .4byte gUnknown_202F1E8
_08052204: .4byte gUnknown_203B434
_08052208: .4byte gDungeon
_0805220C: .4byte 0x0001c054
thumb_func_end sub_80521D0
thumb_func_start sub_8052210
sub_8052210:
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
movs r4, 0
ldr r5, _08052280
_0805221A:
lsls r0, r4, 6
ldr r1, [r5]
adds r0, r1
ldr r1, _08052284
adds r0, r1
ldr r1, _08052288
bl strcpy
adds r4, 0x1
cmp r4, 0x9
ble _0805221A
ldr r1, _08052280
ldr r0, [r1]
ldr r2, _0805228C
adds r0, r2
movs r3, 0
strb r3, [r0]
ldr r0, [r1]
adds r2, 0x1
adds r1, r0, r2
strh r3, [r1]
adds r2, 0x2
adds r1, r0, r2
strh r3, [r1]
adds r2, 0x2
adds r1, r0, r2
strh r3, [r1]
ldr r1, _08052290
adds r2, r0, r1
movs r1, 0x4
strh r1, [r2]
ldr r2, _08052294
adds r0, r2
str r3, [r0]
cmp r6, 0
beq _08052278
ldr r0, _08052298
ldr r0, [r0]
cmp r0, 0x3
bne _08052278
movs r0, 0
movs r1, 0
bl sub_803EAF0
movs r0, 0xB
bl sub_803E46C
_08052278:
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08052280: .4byte gDungeon
_08052284: .4byte 0x0001bdd4
_08052288: .4byte gUnknown_80F7AE8
_0805228C: .4byte 0x0001c05f
_08052290: .4byte 0x0001c066
_08052294: .4byte 0x0001c06c
_08052298: .4byte gUnknown_202EDD0
thumb_func_end sub_8052210
.align 2,0 .align 2,0

View File

@ -20,6 +20,9 @@ struct DungeonDialogueStruct
const u8 *str; const u8 *str;
}; };
void sub_80521D0(void);
void sub_8052210(bool8 a0);
// These functions display the string if certain conditions are met. The conditions differ depending on the function. The string is then saved to the message log. // These functions display the string if certain conditions are met. The conditions differ depending on the function. The string is then saved to the message log.
void TryDisplayDungeonLoggableMessage(Entity *pokemon, const char *str); void TryDisplayDungeonLoggableMessage(Entity *pokemon, const char *str);
void TryDisplayDungeonLoggableMessage2(Entity *r0, const char *str); void TryDisplayDungeonLoggableMessage2(Entity *r0, const char *str);

View File

@ -17,6 +17,7 @@
#include "game_options.h" #include "game_options.h"
#include "code_800558C.h" #include "code_800558C.h"
#include "dungeon_range.h" #include "dungeon_range.h"
#include "dungeon_message.h"
#include "code_806CD90.h" #include "code_806CD90.h"
#include "dungeon_items.h" #include "dungeon_items.h"
#include "constants/item.h" #include "constants/item.h"
@ -63,10 +64,8 @@ extern u8 gUnknown_202D068[];
extern s32 gUnknown_202EDCC; extern s32 gUnknown_202EDCC;
extern u32 gUnknown_3001018[]; extern u32 gUnknown_3001018[];
extern void sub_8052210(u32);
extern void sub_8040A84(); extern void sub_8040A84();
extern void sub_8083D44(void); extern void sub_8083D44(void);
extern void sub_8052210(u32);
extern void sub_8049ED4(void); extern void sub_8049ED4(void);
extern void sub_8040A84(void); extern void sub_8040A84(void);
extern void sub_80400D4(void); extern void sub_80400D4(void);

View File

@ -33,7 +33,6 @@ extern bool8 sub_8042CC0(void);
extern void sub_8042D7C(void); extern void sub_8042D7C(void);
extern u8 sub_8043D10(void); extern u8 sub_8043D10(void);
extern bool8 sub_8045888(Entity *); extern bool8 sub_8045888(Entity *);
extern void sub_8052210(u32);
// This func plays the appropriate ascend/descend SFX for stairs depending on the direction // This func plays the appropriate ascend/descend SFX for stairs depending on the direction
void PlayStairsSound(void) void PlayStairsSound(void)

View File

@ -279,7 +279,6 @@ extern void sub_8068BDC(u8 r0);
extern s16 GetTurnLimit(u8 dungeon); extern s16 GetTurnLimit(u8 dungeon);
extern void sub_8041888(u8 param_1); extern void sub_8041888(u8 param_1);
extern void sub_8040150(bool8 param_1); extern void sub_8040150(bool8 param_1);
extern void sub_8052210(u32);
extern void sub_803D4AC(void); extern void sub_803D4AC(void);
extern void sub_804513C(void); extern void sub_804513C(void);
extern void sub_8043CD8(void); extern void sub_8043CD8(void);

View File

@ -93,7 +93,6 @@ void sub_80978C8(s16 a0);
void sub_8044C50(u16 a0); void sub_8044C50(u16 a0);
static void TryCreateModeArrows(Entity *leader); static void TryCreateModeArrows(Entity *leader);
bool8 sub_8094C48(void); bool8 sub_8094C48(void);
void sub_8052210(u8 a0);
bool8 sub_805EC4C(Entity *a0, u8 a1); bool8 sub_805EC4C(Entity *a0, u8 a1);
void sub_803E724(s32 a0); void sub_803E724(s32 a0);
void HandleTalkFieldAction(Entity *); void HandleTalkFieldAction(Entity *);

View File

@ -33,7 +33,6 @@ extern bool8 sub_8045888(Entity *r0);
extern u8 sub_803F428(Position *); extern u8 sub_803F428(Position *);
extern void sub_805E804(void); extern void sub_805E804(void);
extern void sub_803EAF0(s32, s32); extern void sub_803EAF0(s32, s32);
extern void sub_8052210(u32);
extern void sub_8040238(void); extern void sub_8040238(void);
extern void sub_8083E28(void); extern void sub_8083E28(void);
extern bool8 sub_8008D8C(u32 strId); extern bool8 sub_8008D8C(u32 strId);
@ -44,9 +43,9 @@ extern void sub_8007334(s32 a0);
extern void sub_80087EC(s32 a0, s32 a1, s32 a2, s32 a3, s32 a4); extern void sub_80087EC(s32 a0, s32 a1, s32 a2, s32 a3, s32 a4);
extern void sub_8083CE0(u8 param_1); extern void sub_8083CE0(u8 param_1);
extern u32 gUnknown_202EDD0;
extern u8 gUnknown_203B40C; extern u8 gUnknown_203B40C;
extern u8 gUnknown_202EE01; extern u8 gUnknown_202EE01;
extern Entity *gUnknown_202F1E8;
extern u8 gUnknown_203B434; extern u8 gUnknown_203B434;
extern void (*gUnknown_203B08C)(s32); extern void (*gUnknown_203B08C)(s32);
extern void (*gUnknown_203B084)(s32 a0); extern void (*gUnknown_203B084)(s32 a0);
@ -54,23 +53,69 @@ extern void (*gUnknown_203B080)(s32 a0);
extern u8 gAvailablePokemonNames[]; extern u8 gAvailablePokemonNames[];
extern u8 gUnknown_202E5D8[]; extern u8 gUnknown_202E5D8[];
extern u8 gUnknown_202DFE8[]; extern u8 gUnknown_202DFE8[];
extern SpriteOAM gUnknown_202F1F0;
extern SpriteOAM gUnknown_202F200; extern SpriteOAM gUnknown_202F200;
extern s32 gUnknown_202F1F8;
extern u8 gUnknown_202F1FC; extern u8 gUnknown_202F1FC;
extern UnkTextStruct1 gUnknown_2027370[4]; extern UnkTextStruct1 gUnknown_2027370[4];
extern s32 gUnknown_202EDCC; extern s32 gUnknown_202EDCC;
extern u8 gFontPalette[]; extern u8 gFontPalette[];
extern const u8 gUnknown_80F7AE8[];
extern const u8 gUnknown_80F7AF8[]; extern const u8 gUnknown_80F7AF8[];
extern const u8 gUnknown_80F7AFC[]; extern const u8 gUnknown_80F7AFC[];
extern const u8 gUnknown_80F7B04[]; extern const u8 gUnknown_80F7B04[];
extern const u16 gUnknown_80F7AEA[]; extern const u16 gUnknown_80F7AEA[];
extern Entity *gUnknown_202F1E8;
extern SpriteOAM gUnknown_202F1F0;
extern s32 gUnknown_202F1F8;
// Used for gUnknown_202F1FC // Used for gUnknown_202F1FC
#define FLAG_CAN_SCROLL_UP 0x1 #define FLAG_CAN_SCROLL_UP 0x1
#define FLAG_CAN_SCROLL_DOWN 0x2 #define FLAG_CAN_SCROLL_DOWN 0x2
// Needed to match :shrug:
static inline void InlineStrcpy(u8 *dst, const u8 *src)
{
strcpy(dst, src);
}
static inline void InlineStrncpy(u8 *dst, const u8 *src, s32 n)
{
strncpy(dst, src, n);
}
void sub_80521D0(void)
{
s32 i;
for (i = 0; i < UNK_1BBD4_STR_COUNT; i++) {
gDungeon->unk1BDD4.unk1C054[i] = 0;
}
gUnknown_202F1E8 = 0;
gUnknown_203B434 = 1;
sub_8052210(FALSE);
}
void sub_8052210(bool8 a0)
{
s32 i;
for (i = 0; i < UNK_1BBD4_STR_COUNT; i++) {
InlineStrcpy(gDungeon->unk1BDD4.unk0[i], gUnknown_80F7AE8);
}
gDungeon->unk1BDD4.unk1C05F = 0;
gDungeon->unk1BDD4.unk1C060 = 0;
gDungeon->unk1BDD4.unk1C062 = 0;
gDungeon->unk1BDD4.unk1C064 = 0;
gDungeon->unk1BDD4.unk1C066 = 4;
gDungeon->unk1BDD4.unk1C06C = 0;
if (a0 && gUnknown_202EDD0 == 3) {
sub_803EAF0(0, 0);
sub_803E46C(11);
}
}
void sub_805229C(void) void sub_805229C(void)
{ {
return sub_80526D0(0x50); return sub_80526D0(0x50);
@ -183,12 +228,8 @@ static void DisplayMessageAddToLog(Entity *r0, const char *str, bool8 r2)
r7 = 0; r7 = 0;
r8 = 0; r8 = 0;
if (r2) { if (r2) {
u8 *dst;
r9 = TRUE; r9 = TRUE;
dst = gDungeon->unk1BDD4.unk0[gDungeon->unk1BDD4.unk1C060]; InlineStrncpy(gDungeon->unk1BDD4.unk0[gDungeon->unk1BDD4.unk1C060], txt, 64);
ASM_MATCH_TRICK(dst);
strncpy(dst, txt, 64);
if (++gDungeon->unk1BDD4.unk1C060 == UNK_1BBD4_STR_COUNT) { if (++gDungeon->unk1BDD4.unk1C060 == UNK_1BBD4_STR_COUNT) {
gDungeon->unk1BDD4.unk1C060 = 0; gDungeon->unk1BDD4.unk1C060 = 0;
} }
@ -272,7 +313,7 @@ void xxx_draw_string_80524F0(void)
if (strPtr->unk1C05E == 0 && strPtr->unk1C064 != 0 && --strPtr->unk1C064 == 0) { if (strPtr->unk1C05E == 0 && strPtr->unk1C064 != 0 && --strPtr->unk1C064 == 0) {
strPtr->unk1C06C = 0; strPtr->unk1C06C = 0;
sub_803EAF0(0, 0); sub_803EAF0(0, 0);
sub_8052210(0); sub_8052210(FALSE);
} }
} }
@ -323,7 +364,7 @@ void DisplayDungeonMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const u8
} }
sub_803EAF0(2, 0); sub_803EAF0(2, 0);
sub_8052210(0); sub_8052210(FALSE);
monPortraitPtr = NULL; monPortraitPtr = NULL;
monPortrait.faceFile = NULL; monPortrait.faceFile = NULL;
@ -476,7 +517,7 @@ void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo)
sub_8052740(10); sub_8052740(10);
sub_803EAF0(2, 0); sub_803EAF0(2, 0);
sub_8052210(0); sub_8052210(FALSE);
CreateDialogueBoxAndPortrait(dialogueInfo->str, 0, monPortraitPtr, gUnknown_80F7AEA[dialogueInfo->unk0]); CreateDialogueBoxAndPortrait(dialogueInfo->str, 0, monPortraitPtr, gUnknown_80F7AEA[dialogueInfo->unk0]);
PRINT_STRING_WAIT_PRESS(&chosenMenuIndex); PRINT_STRING_WAIT_PRESS(&chosenMenuIndex);
@ -498,7 +539,7 @@ bool32 DisplayDungeonYesNoMessage(struct MonDialogueSpriteInfo *monSpriteInfo, c
sub_8052740(10); sub_8052740(10);
sub_803EAF0(2, 0); sub_803EAF0(2, 0);
sub_8052210(0); sub_8052210(FALSE);
monPortraitPtr = NULL; monPortraitPtr = NULL;
monPortrait.faceFile = NULL; monPortrait.faceFile = NULL;
@ -547,7 +588,7 @@ s32 DisplayDungeonMenuMessage(struct MonDialogueSpriteInfo *monSpriteInfo, const
sub_8052740(10); sub_8052740(10);
sub_803EAF0(2, 0); sub_803EAF0(2, 0);
sub_8052210(0); sub_8052210(FALSE);
monPortraitPtr = NULL; monPortraitPtr = NULL;
monPortrait.faceFile = NULL; monPortrait.faceFile = NULL;