Decompile DRA func_8012E7A4 (#585)

This is an interesting one!

I have no idea what the function does, but it has a bunch of hard-coded
offsets into g_Entities.

There is also a conditional block, which for some reason is at the top
in US and at the bottom in HD. Also, the US version has a potential
`return`, while HD does not (and will always do the func_8010FAF4 and
g_Player.unk66++).

Otherwise, glad I was able to solve this one and resolve the weirdness
with HD on my own, always nice to have a PR with problems resolved in
advance :)
This commit is contained in:
bismurphy 2023-09-13 10:53:28 -04:00 committed by GitHub
parent a21a241d1c
commit 436aa325bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 2 deletions

View File

@ -155,6 +155,7 @@ D_800B07C8 = 0x800B088C;
D_800B0830 = 0x800B08F4;
D_800B083C = 0x800B0900;
D_800B0858 = 0x800B091C;
D_800B08CC = 0x800B0990;
D_800B0914 = 0x800B09D8;
D_800B0918 = 0x800B09DC;
D_800B091C = 0x800B09E0;
@ -1023,10 +1024,12 @@ D_801390D8 = 0x80138CA4;
g_sfxRingBuffer1 = 0x80138CA8;
D_801390DE = 0x80138CAA;
D_801390E0 = 0x80138CAC;
D_801396E0 = 0x801392AC;
D_801396E4 = 0x801392B0;
D_801396E6 = 0x801392B2;
D_801396E8 = 0x801392B4;
D_801396EA = 0x801392B6;
D_801396EC = 0x801392B8;
D_801396F0 = 0x801392BC;
D_801396F4 = 0x801392C0;
D_801396F8 = 0x801392C4;

View File

@ -314,4 +314,10 @@ typedef struct Unkstruct_801C7954 {
/* 0x0A */ u16 y1;
/* 0x0C */ u16 x3;
/* 0x0E */ u16 x2;
} Unkstruct_801C7954; // size = 0x10
} Unkstruct_801C7954; // size = 0x10
typedef struct {
s32 unk0;
s32 unk4;
s32 unk8;
} unk_800B08CC; // size = 0xC

View File

@ -475,7 +475,66 @@ void func_8012E550(void) {
}
}
INCLUDE_ASM("dra/nonmatchings/8D3E8", func_8012E7A4);
void func_8012E7A4(void) {
s32 i;
Entity* entity;
#if defined(VERSION_US)
if (g_Entities[16].entityId != 0x22) {
if (func_8011AAFC(g_CurrentEntity, 0x23002CU, 0) == NULL) {
return;
}
func_8010FAF4();
g_Player.unk66++;
}
#endif
for (i = 0; i < 6; i++) {
D_800B08CC[i].unk0 = 0;
}
D_801396EC = PLAYER.animCurFrame;
D_801396E0 = PLAYER.animSet;
func_8010E168(1, 4);
DestroyEntity(&g_Entities[17]);
g_Entities[17].entityId = 0x38;
DestroyEntity(&g_Entities[18]);
g_Entities[18].entityId = 0x37;
DestroyEntity(&g_Entities[19]);
g_Entities[19].entityId = 0x39;
DestroyEntity(&g_Entities[20]);
g_Entities[20].entityId = 0x3A;
for (entity = &g_Entities[21], i = 0; i < 9; i++, entity++) {
DestroyEntity(entity);
entity->entityId = 0x3B;
entity->params = i;
}
DestroyEntity(&g_Entities[30]);
g_Entities[30].entityId = 0x3C;
func_8012CED4();
PLAYER.animFrameIdx = 4;
PLAYER.animFrameDuration = 4;
PLAYER.step_s = 8;
D_80138430 = 0x800;
PLAYER.unk5A = 0x7E;
PLAYER.animSet = 0xF;
PLAYER.rotAngle = 0;
g_Player.unk48 = 0;
g_Player.unk46 = 0;
g_Player.unk44 = 0;
D_8013842C = 0;
PLAYER.velocityX = 0;
PLAYER.velocityY = 0;
PLAYER.palette = 0x810D;
PLAYER.zPriority = g_zEntityCenter.S16.unk0 - 2;
#if defined(VERSION_HD)
if (g_Entities[16].entityId != 0x22) {
func_8011AAFC(g_CurrentEntity, 0x23002C, 0);
func_8010FAF4();
g_Player.unk66++;
}
#endif
}
INCLUDE_ASM("dra/nonmatchings/8D3E8", func_8012E9C0);

View File

@ -401,6 +401,7 @@ extern s32 D_800B0798[];
extern s32 D_800B07C8;
extern s32 D_800B0830[];
extern s32 D_800B083C[];
extern unk_800B08CC D_800B08CC[];
extern s32 D_800B0914;
extern s32 D_800B0918;
extern s32 D_800B091C;
@ -608,10 +609,12 @@ extern s8 D_801390C4;
extern GpuBuffer* g_BackBuffer;
extern u8 D_801390D8;
extern SfxRingBufferItem g_sfxRingBuffer1[MAX_SND_COUNT];
extern u16 D_801396E0;
extern u16 D_801396E4;
extern Multi D_801396E6;
extern u16 D_801396E8;
extern s16 D_801396EA;
extern u16 D_801396EC;
extern s32 D_801396F0;
extern volatile s16 D_801396F4;
extern s32 D_801396F8[0x20];