merge with master, update dungeon struct

This commit is contained in:
DizzyEggg
2024-10-13 15:37:03 +02:00
15 changed files with 1527 additions and 3132 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,10 +2,10 @@
#define GUARD_BG_PALETTE_BUFFER_H
void InitBGPaletteBuffer(void);
void nullsub_4(s32 index, u8 *colorArray, s32, u8 *);
void nullsub_5(void);
void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray);
void SetBGPaletteBufferColorRGB(s32 index, u8 *colorArray, s32, u8 *);
void nullsub_4(s32 index, const u8 *colorArray, s32, u8 *);
void nullsub_5(s32 index, const u8 *colorArray);
void SetBGPaletteBufferColorArray(s32 index, const u8 *colorArray);
void SetBGPaletteBufferColorRGB(s32 index, const u8 *colorArray, s32, u8 *);
void TransferBGPaletteBuffer(void);
#endif // GUARD_BG_PALETTE_BUFFER_H
#endif // GUARD_BG_PALETTE_BUFFER_H

View File

@@ -5,7 +5,7 @@
struct unkStruct_202D240
{
u32 *unk0;
u32 *unk4;
const u32 *unk4;
u32 size;
};
@@ -19,7 +19,7 @@ void vram_related_8009804(void);
void InitFontPalette(void);
void sub_80098A0(void);
void sub_80098BC(u32 *, u32 *, u32);
void sub_80098BC(u32 *, const u32 *, u32);
void sub_80098F8(u32);
void sub_8009908(void);
void sub_80099C0(void);

View File

@@ -2,7 +2,7 @@
#define GUARD_CPU_H
void CpuClear(void *, s32);
void CpuCopy(void *, void *, s32);
void CpuCopy(void *dest, const void *src, s32 size);
void nullsub_23(bool8);
void SetWindowTitle(u8 *);
void sub_800CDA8(u32);

View File

@@ -82,39 +82,44 @@ typedef struct DungeonMusicPlayer
// Size unknown?
typedef struct UnkDungeonGlobal_unk181E8_sub
{
/* 0x181E8 */ Position cameraPos;
/* 0x181EC */ Position cameraPosMirror;
/* 0x181F0 */ Position cameraPixelPos;
/* 0x181F4 */ Position cameraPixelPosMirror;
/* 0x181F8 */ Entity *cameraTarget;
u32 unk181FC;
u32 unk18200;
u32 unk18204;
u8 unk18208;
/* 0x18209 */ u8 visibilityRange; // Dungeon light level.
/* 0x1820A */ bool8 blinded; // Blacks out the screen when the player has the Blinker status.
u8 unk1820B;
u8 unk1820C;
u8 unk1820D;
u8 unk1820E;
u8 unk1820F;
/* 0x18210 */ bool8 hallucinating; // Displays Substitute and flower sprites when the player has the Cross-Eyed status.
u8 unk18211;
u8 unk18212;
u8 unk18213;
u8 unk18214;
u8 unk18215;
u8 fill18216;
u8 unk18217;
u8 unk18218;
u8 unk18219;
u8 unk1821A;
u8 unk1821B;
u8 unk1821C;
u8 fill1821D;
u8 fill1821E;
u8 fill1821F;
} UnkDungeonGlobal_unk181E8_sub;
/* 0x181E8 */ Position cameraPos; // x0
/* 0x181EC */ Position cameraPosMirror; // x4
/* 0x181F0 */ Position cameraPixelPos; // x8
/* 0x181F4 */ Position cameraPixelPosMirror; // xC
/* 0x181F8 */ Entity *cameraTarget; // x10
u32 unk181FC; // x14
u32 unk18200; // x18
u32 unk18204; // x1C
u8 unk18208; // x20
/* 0x18209 */ u8 visibilityRange; // x21 Dungeon light level.
/* 0x1820A */ bool8 blinded; // x22 Blacks out the screen when the player has the Blinker status.
u8 unk1820B; // x23
u8 unk1820C; // x24
u8 unk1820D; // x25
u8 unk1820E; // x26
u8 unk1820F; // x27
/* 0x18210 */ bool8 hallucinating; // x28 Displays Substitute and flower sprites when the player has the Cross-Eyed status.
u8 unk18211; // x29
u8 unk18212; // x2A
u8 unk18213; // x2B
u8 unk18214; // x2C
u8 unk18215; // x2D
u8 unk18216; // x2E
u8 unk18217; // x2F
u8 unk18218; // x30
u8 unk18219; // x31
u8 unk1821A; // x32
u8 unk1821B; // x33
u8 unk1821C; // x34
u8 fill1821D; // x35
s16 unk36; // x36
s16 unk38; // x38
s16 unk3A; // x3A
s16 unk3C; // x3C
s16 unk3E; // x3E
s16 unk40; // x40
s16 unk42; // x42
} UnkDungeonGlobal_unk181E8_sub; // x44
// Sizeof: 0x1C
typedef struct UnkDungeonGlobal_unk1C574
@@ -229,7 +234,7 @@ typedef struct Dungeon
u8 unk11;
s16 unk12;
s16 unk14;
u8 fill14[0xB8 - 0x16];
u32 unk18[(0xB8 - 0x18) / 4];
Entity *unkB8;
Entity *unkBC;
u8 fillC0[0x134 - 0xC0];
@@ -374,7 +379,7 @@ typedef struct Dungeon
/* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX];
/* 0x181E4 */ OpenedFile *paletFile;
/* 0x181E8 */ UnkDungeonGlobal_unk181E8_sub unk181e8;
u8 fill18220[0x1C05E - 0x18220];
u8 fill18220[0x1C05E - 0x1822C];
u8 unk1C05E;
u8 fill1C05F[0x1C06C - 0x1C05F];
u32 unk1C06C;

View File

@@ -13,6 +13,6 @@ void SelectCharmap(u32);
u32 UpdateFadeInTile(u32 a0);
u32 sub_80063B0(void);
void xxx_call_save_unk_text_struct_800641C(UnkTextStruct2 *a0, bool8 a1, bool8 a2);
void xxx_call_save_unk_text_struct_800641C(const UnkTextStruct2 *a0, bool8 a1, bool8 a2);
#endif // GUARD_TEXT1_H
#endif // GUARD_TEXT1_H

View File

@@ -208,7 +208,7 @@ SECTIONS {
src/code_803D110.o(.text);
asm/code_803D110.o(.text);
src/code_803E46C.o(.text);
asm/code_803E724.o(.text);
src/code_803E724.o(.text);
src/code_8040094.o(.text);
asm/code_8040094.o(.text);
src/code_8041AD0.o(.text);

View File

@@ -22,7 +22,7 @@ void InitBGPaletteBuffer(void)
}
// 99.48% (r3/r4 regswap) https://decomp.me/scratch/7Yc8i
void SetBGPaletteBufferColorRGB(s32 index, u8 *colorArray, s32 a1, u8 *a2)
void SetBGPaletteBufferColorRGB(s32 index, const u8 *colorArray, s32 a1, u8 *a2)
{
#ifdef NONMATCHING
s32 var;
@@ -43,7 +43,7 @@ void SetBGPaletteBufferColorRGB(s32 index, u8 *colorArray, s32 a1, u8 *a2)
sBGPaletteBuffer[index] = var = ((a2[4 * colorArray[2] + 2] * a1 / 256 & 0x1F) << 10) | ((a2[4 * colorArray[1] + 1] * a1 / 256 & 0x1F) << 5) | (a2[4 * colorArray[0]] * a1 / 256 & 0x1F);
}
void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray)
void SetBGPaletteBufferColorArray(s32 index, const u8 *colorArray)
{
sBGPaletteUsed[index / BG_PALETTE_BUFFER_CHUNK_SIZE] = TRUE;
sBGPaletteBuffer[index] = (colorArray[2] >> 3) << 10 | (colorArray[1] >> 3) << 5 | colorArray[0] >> 3;
@@ -55,11 +55,11 @@ void SetBGPaletteBufferColor(s32 index, u16 *color)
sBGPaletteBuffer[index] = *color;
}
void nullsub_4(s32 index, u8 *colorArray, s32 a1, u8 *a2)
void nullsub_4(s32 index, const u8 *colorArray, s32 a1, u8 *a2)
{
}
void nullsub_5(void)
void nullsub_5(s32 index, const u8 *colorArray)
{
}

View File

@@ -79,7 +79,7 @@ void sub_80098A0(void)
gUnknown_202D238[3] = 0;
}
void sub_80098BC(u32 *r0, u32 *r1, u32 r2)
void sub_80098BC(u32 *r0, const u32 *r1, u32 r2)
{
if (gUnknown_202D23C < 8) {
gUnknown_202D240[gUnknown_202D23C].unk0 = r0;

1461
src/code_803E724.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -333,7 +333,7 @@ extern s32 GetCameraXPos();
extern s32 GetCameraYPos();
extern void sub_803F878(u32, s32);
extern void SetupBossFightHP(Entity *, u32, u32);
extern void sub_803E9D0(void);
extern void BgColorCallNullsub4(void);
extern void DeoxysScreenFlash(void);
extern void sub_8085EB0();
@@ -3987,7 +3987,7 @@ void sub_808C0CC(void)
{
gUnknown_202EDC8 = 0x1f;
SetDungeonBGColorRGB(0,0,0,1,1);
sub_803E9D0();
BgColorCallNullsub4();
sub_803E46C(0x46);
gDungeon->unk7 = 0;
LugiaScreenFlash();
@@ -4109,7 +4109,7 @@ void sub_808C360(void)
{
gUnknown_202EDC8 = 0x1f;
SetDungeonBGColorRGB(0,0,0,1,1);
sub_803E9D0();
BgColorCallNullsub4();
sub_803E46C(0x46);
gDungeon->unk7 = 0;
KyogreScreenFlash();
@@ -4196,7 +4196,7 @@ void sub_808C550(void)
{
gUnknown_202EDC8 = 0x1f;
SetDungeonBGColorRGB(0,0,0,1,1);
sub_803E9D0();
BgColorCallNullsub4();
sub_803E46C(0x46);
gDungeon->unk7 = 0;
DeoxysScreenFlash();

View File

@@ -20,7 +20,7 @@ EWRAM_DATA unkStruct_202F3D0 gUnknown_202F3D0 = {0};
extern u32 gUnknown_8107314[];
s8 sub_8002984(s8, u8);
extern void sub_803E9D0(void);
extern void BgColorCallNullsub4(void);
extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32);
extern void PlaySoundEffect(u32);
extern void DisplayDungeonDialogue(const u8 *);
@@ -347,7 +347,7 @@ void sub_8086794(void)
for (i = 0; i < 200; i++) {
SetDungeonBGColorRGB(0, 0, 0, 1, 0);
sub_803E9D0();
BgColorCallNullsub4();
sub_803E46C(70);
if ((i & 3) == 0) {

View File

@@ -35,7 +35,7 @@ UNUSED static bool8 sub_800CDE0(void)
return TRUE;
}
void CpuCopy(void *dest, void *src, s32 size)
void CpuCopy(void *dest, const void *src, s32 size)
{
CpuCopy32(src, dest, size);
}

View File

@@ -144,7 +144,7 @@ void SetCharacterMask(int a0)
}
// TODO: Move xxx_call_save_unk_text_struct_800641C and SaveUnkTextStructAndXXX_8006438 to text2.c ? data.s shows text1 and text2 are merged somehow but not fully
void xxx_call_save_unk_text_struct_800641C(UnkTextStruct2 *a0, bool8 a1, bool8 a2)
void xxx_call_save_unk_text_struct_800641C(const UnkTextStruct2 *a0, bool8 a1, bool8 a2)
{
UnkTextStruct2_sub r3 = {0, 0};
SaveUnkTextStructAndXXX_8006438(a0, a1, a2, &r3);
@@ -186,4 +186,4 @@ static void SaveUnkTextStructAndXXX_8006438(const UnkTextStruct2 *a0, bool8 a1,
ptr1 = &gUnknown_20274A5;
*ptr2 = ptr0;
*ptr1 = 1;
}
}

View File

@@ -3532,7 +3532,7 @@ extern u8 gUnknown_20274A6[];
s32 InterpretColorChar(u8 a0);
#ifdef NONMATCHING
// https://decomp.me/scratch/AJ2km
// https://decomp.me/scratch/lp1Fo
const u8 *HandleTextFormat(UnkTextStruct1 *strArr, const u8 *str, struct UnkDrawStringStruct *sp)
{
while (*str == '#') {