diff --git a/include/global.h b/include/global.h index a137740..09cf670 100644 --- a/include/global.h +++ b/include/global.h @@ -104,7 +104,7 @@ typedef struct unk_D_86002F58_004_000 { /* 0x064 */ char pad064[0x3C]; /* 0x0A0 */ s32 unk_0A0; /* 0x0A4 */ char pad0A4[2]; - /* 0x0A6 */ s8 unk_0A6; + /* 0x0A6 */ u8 unk_0A6; /* 0x0A7 */ char pad0A7[5]; /* 0x0AC */ Vec3f unk_0AC; /* 0x0B8 */ char pad0B8[0x24]; diff --git a/src/32D10.c b/src/32D10.c index f8baba6..c89874a 100644 --- a/src/32D10.c +++ b/src/32D10.c @@ -1,9 +1,115 @@ -#include "global.h" #include "32D10.h" +#include "334D0.h" +#include "src/util.h" +#include "src/fragments/31/fragment31.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/32D10/func_80032110.s") +extern s16 D_800AF778[4]; +extern s16 D_800AF780[4]; +extern s16 D_800AF788[4]; +extern s16 D_800AF790[4]; +extern s16 D_800AF798[4]; +extern s16 D_800AF7A0[4]; +extern s16 D_800AF7AE; +extern s16 D_800AF7C0[]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/32D10/func_80032244.s") +void func_80032110(u8 arg0, s16 arg1) { + D_800AF778[arg0] = 0x167 - ((arg1 % 10) * 0x24); + D_800AF780[arg0] = 0x167 - (((arg1 / 10) % 10) * 0x24); + D_800AF788[arg0] = 0x167 - (((arg1 / 100) % 10) * 0x24); +} + +void func_80032244(u8 arg0, s16 arg1) { + s16 tmp; + s16 tmp2; + + D_800AF790[arg0] = 0x167 - ((arg1 % 10) * 0x24); + D_800AF798[arg0] = 0x167 - (((arg1 / 10) % 10) * 0x24); + D_800AF7A0[arg0] = 0x167 - (((arg1 / 100) % 10) * 0x24); + + tmp2 = D_800AF790[arg0]; + tmp = D_800AF778[arg0]; + if (((tmp2 < 0x5A) && (tmp >= 0x10F)) || ((tmp < 0x5A) && (tmp2 >= 0x10F))) { + if (tmp < tmp2) { + D_800AF778[arg0] -= 6; + } + + if (tmp2 < tmp) { + D_800AF778[arg0] += 6; + } + } else { + if (tmp < tmp2) { + D_800AF778[arg0] += 6; + } + + if (tmp2 < tmp) { + D_800AF778[arg0] -= 6; + } + } + + if (D_800AF778[arg0] < 0) { + D_800AF778[arg0] += 0x168; + } + + if (D_800AF778[arg0] >= 0x168) { + D_800AF778[arg0] -= 0x168; + } + + tmp2 = D_800AF798[arg0]; + tmp = D_800AF780[arg0]; + if (((tmp2 < 0x5A) && (tmp >= 0x10F)) || ((tmp < 0x5A) && (tmp2 >= 0x10F))) { + if (tmp < tmp2) { + D_800AF780[arg0] -= 6; + } + + if (tmp2 < tmp) { + D_800AF780[arg0] += 6; + } + } else { + if (tmp < tmp2) { + D_800AF780[arg0] += 6; + } + + if (tmp2 < tmp) { + D_800AF780[arg0] -= 6; + } + } + + if (D_800AF780[arg0] < 0) { + D_800AF780[arg0] += 0x168; + } + + if (D_800AF780[arg0] >= 0x168) { + D_800AF780[arg0] -= 0x168; + } + + tmp2 = D_800AF7A0[arg0]; + tmp = D_800AF788[arg0]; + if (((tmp2 < 0x5A) && (tmp >= 0x10F)) || ((tmp < 0x5A) && (tmp2 >= 0x10F))) { + if (tmp < tmp2) { + D_800AF788[arg0] -= 6; + } + + if (tmp2 < tmp) { + D_800AF788[arg0] += 6; + } + } else { + if (tmp < tmp2) { + D_800AF788[arg0] += 6; + } + + if (tmp2 < tmp) { + D_800AF788[arg0] -= 6; + } + } + + if (D_800AF788[arg0] < 0) { + D_800AF788[arg0] += 0x168; + } + + if (D_800AF788[arg0] >= 0x168) { + D_800AF788[arg0] -= 0x168; + } +} #pragma GLOBAL_ASM("asm/us/nonmatchings/32D10/func_80032570.s") @@ -13,7 +119,20 @@ #pragma GLOBAL_ASM("asm/us/nonmatchings/32D10/func_800325E0.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/32D10/func_8003260C.s") +void func_8003260C(unk_D_86002F58_004_000* arg0) { + void (*func)(void*); + s32 unk1A = arg0->unk_01A; + s32 idx = arg0->unk_0A6; + + D_800AF7AE = 0; + + if (unk1A < 0x98) { + D_800AF7C0[idx & 1] = 0; + func_80032A34(idx & 1); + func = Util_ConvertAddrToVirtAddr(func_810007A8); + func(arg0); + } +} #pragma GLOBAL_ASM("asm/us/nonmatchings/32D10/func_80032670.s") diff --git a/src/32D10.h b/src/32D10.h index 2dd9d4e..1f837fe 100644 --- a/src/32D10.h +++ b/src/32D10.h @@ -3,7 +3,7 @@ #include "global.h" -void func_80032110(u8, s32); +void func_80032110(u8, s16); void func_80032244(u8, s16); void func_8003260C(unk_D_86002F58_004_000*); diff --git a/src/334D0.c b/src/334D0.c index 083f8c1..512ad98 100644 --- a/src/334D0.c +++ b/src/334D0.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "334D0.h" #pragma GLOBAL_ASM("asm/us/nonmatchings/334D0/func_800328D0.s") diff --git a/src/334D0.h b/src/334D0.h new file mode 100644 index 0000000..2fdcd3a --- /dev/null +++ b/src/334D0.h @@ -0,0 +1,8 @@ +#ifndef _334D0_H_ +#define _334D0_H_ + +#include "global.h" + +void func_80032A34(s32); + +#endif // _334D0_H_ diff --git a/src/fragments/31/fragment31.h b/src/fragments/31/fragment31.h new file mode 100644 index 0000000..42bc2c7 --- /dev/null +++ b/src/fragments/31/fragment31.h @@ -0,0 +1,8 @@ +#ifndef _FRAGMENT31_H_ +#define _FRAGMENT31_H_ + +#include "global.h" + +void func_810007A8(unk_D_86002F58_004_000*); + +#endif // _FRAGMENT31_H_