Decompile function that might be related to collision detection

This commit is contained in:
Luciano Ciccariello 2022-03-12 12:54:59 +00:00
parent f233f5a2f5
commit d6fcd34d52
6 changed files with 114 additions and 4 deletions

View File

@ -128,6 +128,7 @@ mad_fix: stmad_dirs mad_patch $(BUILD_DIR)/MAD.BIN
MAD_PATCHES = \
-e "s/D_8003BF08/D_8003BF7C/g" -e "s/0x8003BF08/0x8003BF7C/g" \
-e "s/D_8003C6B0/g_pfnFreePolygons/g" -e "s/0x8003C6B0/0x8003C7B4/g" \
-e "s/D_8003C6B8/D_8003C7BC/g" -e "s/0x8003C6B8/0x8003C7BC/g" \
-e "s/D_8003C6D8/g_pfnPlaySfx/g" -e "s/0x8003C6D8/0x8003c7dc/g" \
-e "s/D_8003C704/D_8003C808/g" -e "s/0x8003C704/0x8003C808/g" \
-e "s/D_8003C724/D_8003C828/g" -e "s/0x8003C724/0x8003C828/g" \

View File

@ -186,6 +186,25 @@ typedef struct
s32 unk24;
} Unkstruct5;
typedef struct {
s16 x;
s16 y;
} Unkstruct6;
typedef struct {
s32 sp10;
s32 sp14;
s32 sp18;
s32 sp1C;
s32 sp20;
s16 sp24;
s16 sp26;
s16 sp28;
s16 sp2A;
s32 sp2C;
s32 sp30;
} Unkstruct7;
typedef struct
{
void *addr1;
@ -227,6 +246,7 @@ extern s32 D_8003C734;
extern void (*D_8003C744)(s32, s32);
extern void (*g_pfnUpdateStageEntities)(void);
extern RoomHeader* D_8003C784;
extern void (*D_8003C7BC)(s32, s32, Unkstruct7*, s32);
extern void (*g_pfnPlaySfx)(s32);
extern void (*g_pfnFreePolygons)(s32);
extern Unkstruct5* D_8003C808;

View File

@ -2,6 +2,7 @@
// OFFSET FIXED
extern void (*D_8003C6B0)(s32);
extern void (*D_8003C6B8)(s32, s32, Unkstruct7*, s32);
extern void (*D_8003C6D8)(s32);
extern s32 g_pfnLoadObjLayout; // It's 8003C8C4!
extern Entity* D_8006C26C;
@ -948,7 +949,29 @@ INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80195B44);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80195C38);
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80195E68);
bool func_80195E68(Unkstruct6* unk) {
Unkstruct7 a;
FallEntity();
D_8006C26C->posX.value += D_8006C26C->accelerationX;
D_8006C26C->posY.value += D_8006C26C->accelerationY;
if (D_8006C26C->accelerationY >= 0) {
s16 posX = D_8006C26C->posX.Data.high;
s16 posY = D_8006C26C->posY.Data.high;
posX += unk->x;
posY += unk->y;
D_8003C6B8(posX, posY, &a, 0);
if (a.sp10 & 1) {
D_8006C26C->posY.Data.high += a.sp28;
D_8006C26C->accelerationY = -D_8006C26C->accelerationY / 2;
if (D_8006C26C->accelerationY > -0x10000) {
return true;
}
}
}
return false;
}
INCLUDE_ASM("asm/st/mad/nonmatchings/D8C8", func_80195F64);

View File

@ -447,7 +447,29 @@ INCLUDE_ASM("asm/st/no3/nonmatchings/377D4", func_801C8F8C);
INCLUDE_ASM("asm/st/no3/nonmatchings/377D4", func_801C9080);
INCLUDE_ASM("asm/st/no3/nonmatchings/377D4", func_801C92B0);
bool func_801C92B0(Unkstruct6* unk) {
Unkstruct7 a;
FallEntity();
D_8006C3B8->posX.value += D_8006C3B8->accelerationX;
D_8006C3B8->posY.value += D_8006C3B8->accelerationY;
if (D_8006C3B8->accelerationY >= 0) {
s16 posX = D_8006C3B8->posX.Data.high;
s16 posY = D_8006C3B8->posY.Data.high;
posX += unk->x;
posY += unk->y;
D_8003C7BC(posX, posY, &a, 0);
if (a.sp10 & 1) {
D_8006C3B8->posY.Data.high += a.sp28;
D_8006C3B8->accelerationY = -D_8006C3B8->accelerationY / 2;
if (D_8006C3B8->accelerationY > -0x10000) {
return true;
}
}
}
return false;
}
INCLUDE_ASM("asm/st/no3/nonmatchings/377D4", func_801C93AC);

View File

@ -625,7 +625,29 @@ INCLUDE_ASM("asm/st/st0/nonmatchings/27D64", func_801B8014);
INCLUDE_ASM("asm/st/st0/nonmatchings/27D64", func_801B8108);
INCLUDE_ASM("asm/st/st0/nonmatchings/27D64", func_801B8338);
bool func_801B8338(Unkstruct6* unk) {
Unkstruct7 a;
FallEntity();
D_8006C3B8->posX.value += D_8006C3B8->accelerationX;
D_8006C3B8->posY.value += D_8006C3B8->accelerationY;
if (D_8006C3B8->accelerationY >= 0) {
s16 posX = D_8006C3B8->posX.Data.high;
s16 posY = D_8006C3B8->posY.Data.high;
posX += unk->x;
posY += unk->y;
D_8003C7BC(posX, posY, &a, 0);
if (a.sp10 & 1) {
D_8006C3B8->posY.Data.high += a.sp28;
D_8006C3B8->accelerationY = -D_8006C3B8->accelerationY / 2;
if (D_8006C3B8->accelerationY > -0x10000) {
return true;
}
}
}
return false;
}
INCLUDE_ASM("asm/st/st0/nonmatchings/27D64", func_801B8434);

View File

@ -961,7 +961,29 @@ void func_8018F928(Entity *arg0) {
INCLUDE_ASM("asm/st/wrp/nonmatchings/6FD0", func_8018FA1C);
INCLUDE_ASM("asm/st/wrp/nonmatchings/6FD0", func_8018FC4C);
bool func_8018FC4C(Unkstruct6* unk) {
Unkstruct7 a;
FallEntity();
D_8006C3B8->posX.value += D_8006C3B8->accelerationX;
D_8006C3B8->posY.value += D_8006C3B8->accelerationY;
if (D_8006C3B8->accelerationY >= 0) {
s16 posX = D_8006C3B8->posX.Data.high;
s16 posY = D_8006C3B8->posY.Data.high;
posX += unk->x;
posY += unk->y;
D_8003C7BC(posX, posY, &a, 0);
if (a.sp10 & 1) {
D_8006C3B8->posY.Data.high += a.sp28;
D_8006C3B8->accelerationY = -D_8006C3B8->accelerationY / 2;
if (D_8006C3B8->accelerationY > -0x10000) {
return true;
}
}
}
return false;
}
INCLUDE_ASM("asm/st/wrp/nonmatchings/6FD0", func_8018FD48);