Match some D_8018E7AC related functions in code_80091750.c (#492)

This commit is contained in:
VDavid003
2023-11-09 00:00:29 +01:00
committed by GitHub
parent 8b3577c214
commit 58d3f26f47
6 changed files with 79 additions and 380 deletions
+72 -138
View File
@@ -2469,38 +2469,28 @@ void func_80093E40(void) {
func_80093C98(1);
}
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023
extern void *D_8018D9B4;
extern void *D_8018D9B8;
extern ? D_8018E7AC;
extern ? D_8018E7B1;
void func_80093E60(void) {
? *var_v1;
s32 i;
D_8018D9B4 = get_next_available_memory_addr(0x00002800U);
D_8018D9B0 = get_next_available_memory_addr(0x000124F8U);
D_8018D9B8 = get_next_available_memory_addr(0x00001000U);
D_8018D9BC = get_next_available_memory_addr(4U);
var_v1 = &D_8018E7AC;
do {
var_v1 += 1;
var_v1->unk-1 = 0;
} while ((u32) var_v1 < (u32) &D_8018E7B1);
*D_8018E838 = 0;
*D_8018E838 = 0;
*D_8018E838 = 0;
*D_8018E838 = 0;
for (i = 0; i < 5; i++) {
D_8018E7AC[i] = 0;
}
for (i = 0; i < 4; i++) {
D_8018E838[i] = 0;
}
func_80099110();
func_8009A344();
func_8009E620();
func_80092258();
D_8018ED91 = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80093E60.s")
#endif
void func_80093F10(void) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
@@ -6320,82 +6310,58 @@ void func_8009CA6C(s32 arg0) {
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009CA6C.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023
extern ? D_8018E7AC;
extern ? D_8018E7B8;
extern ? D_8018E7D0;
extern ? D_8018E7E8;
extern ? D_8018E810;
extern u32 D_8018E7D0[];
extern struct UnkStruct_8018E7E8 D_8018E7E8[];
extern struct UnkStruct_8018E7E8 D_8018E810[];
void func_8009CBE4(s32 arg0, s32 arg1, s32 arg2) {
u32 *sp40;
u32 *sp3C;
RGBA16 *temp_v0_4;
s16 var_ra;
s16 var_t2;
s16 var_t3;
s16 var_t5;
s32 temp_t0;
s32 temp_t1;
s32 temp_v0;
s32 temp_v0_2;
s32 temp_v1_3;
struct UnkStruct_800DC5EC *temp_v0_3;
u32 *temp_t4;
u32 *temp_t9;
u32 temp_t6;
void *temp_a0;
void *temp_a0_2;
void *temp_v1;
void *temp_v1_2;
RGBA16* color;
s16 x, y, w, h;
s32 pad[3];
struct UnkStruct_800DC5EC* unk;
struct UnkStruct_8018E7E8 *size, *start;
if ((gModeSelection == 0) || (gModeSelection == 1)) {
temp_v0 = arg0 * 8;
temp_v1 = temp_v0 + &D_8018E7E8;
temp_a0 = temp_v0 + &D_8018E810;
var_t2 = temp_v1->unk0;
var_t3 = temp_v1->unk2;
var_t5 = temp_a0->unk0;
var_ra = temp_a0->unk2;
start = &(D_8018E7E8[arg0]);
size = &(D_8018E810[arg0]);
x = start->x;
y = start->y;
w = size->x;
h = size->y;
} else if (arg0 >= 4) {
start = &(D_8018E7E8[arg0]);
size = &(D_8018E810[arg0]);
x = start->x;
y = start->y;
w = size->x;
h = size->y;
} else {
temp_v0_2 = arg0 * 8;
if (arg0 >= 4) {
temp_v1_2 = temp_v0_2 + &D_8018E7E8;
temp_a0_2 = temp_v0_2 + &D_8018E810;
var_t2 = temp_v1_2->unk0;
var_t3 = temp_v1_2->unk2;
var_t5 = temp_a0_2->unk0;
var_ra = temp_a0_2->unk2;
} else {
temp_v0_3 = &D_8015F480[arg0];
var_t2 = temp_v0_3->screenStartX;
var_t3 = temp_v0_3->screenStartY;
var_t5 = temp_v0_3->screenWidth;
var_ra = temp_v0_3->screenHeight;
}
unk = &D_8015F480[arg0];
x = unk->screenStartX;
y = unk->screenStartY;
w = unk->screenWidth;
h = unk->screenHeight;
}
temp_v0_4 = &D_800E7AE8[arg2];
temp_t1 = arg0 * 4;
temp_t4 = temp_t1 + &D_8018E7D0;
temp_v1_3 = var_t5 / 2;
temp_t0 = var_ra / 2;
temp_t9 = temp_t1 + &D_8018E7B8;
sp3C = temp_t9;
sp40 = temp_t4;
gDisplayListHead = draw_box(gDisplayListHead, var_t2 - temp_v1_3, var_t3 - temp_t0, temp_v1_3 + var_t2, temp_t0 + var_t3, (s32) temp_v0_4->red, (s32) temp_v0_4->green, (s32) temp_v0_4->blue, 0xFF - ((u32) (*temp_t4 * 0xFF) / (u32) *temp_t9));
if ((arg1 == 0) && (temp_t6 = *temp_t4 + 1, *temp_t4 = temp_t6, ((temp_t6 < (u32) *sp3C) == 0))) {
color = &D_800E7AE8[arg2];
gDisplayListHead = draw_box(gDisplayListHead,
x - (w / 2),
y - (h / 2),
(w / 2) + x,
(h / 2) + y,
color->red,
color->green,
color->blue,
0xFF - (D_8018E7D0[arg0] * 0xFF / D_8018E7B8[arg0]));
if ((arg1 == 0) && (D_8018E7D0[arg0] += 1, (D_8018E7D0[arg0] >= D_8018E7B8[arg0]))) {
if (gGamestate == 4) {
*(&D_8018E7AC + arg0) = 6;
D_8018E7AC[arg0] = 6;
return;
}
*(&D_8018E7AC + arg0) = 0;
D_8018E7AC[arg0] = 0;
D_8018EE0C = 0;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009CBE4.s")
#endif
void func_8009CDDC(s32 arg0, s32 arg1) {
func_8009CBE4(arg0, arg1, 0);
@@ -7061,73 +7027,41 @@ void func_8009E000(s32 arg0) {
func_8009DF8C(arg0, 7);
}
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023
extern ? D_8018E7AC;
extern ? D_8018E7B8;
extern ? D_8018E7D0;
void func_8009E020(s32 arg0, s32 arg1) {
s32 *temp_a2;
s32 temp_v0_2;
s32 var_a1;
s8 *temp_v1;
s8 temp_v0;
s32 temp;
var_a1 = arg1;
if (var_a1 == 0) {
var_a1 = 1;
if (arg1 == 0) {
arg1 = 1;
}
temp_v1 = arg0 + &D_8018E7AC;
temp_v0 = *temp_v1;
if ((temp_v0 != 1) && (temp_v0 != 6)) {
temp_v0_2 = arg0 * 4;
temp_a2 = temp_v0_2 + &D_8018E7B8;
*temp_v1 = 1;
*temp_a2 = var_a1;
if ((u32) var_a1 >= 0x100U) {
*temp_a2 = 0x000000FF;
temp = D_8018E7AC[arg0];
if ((temp != 1) && (temp != 6)) {
D_8018E7AC[arg0] = 1;
D_8018E7B8[arg0] = arg1;
if ((u32) arg1 >= 0x100U) {
D_8018E7B8[arg0] = 0xFF;
}
*(&D_8018E7D0 + temp_v0_2) = 0;
D_8018E7D0[arg0] = 0;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E020.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023
extern ? D_8018E7AC;
extern ? D_8018E7B8;
extern ? D_8018E7D0;
void func_8009E088(s32 arg0, s32 arg1) {
s32 *temp_a2;
s32 temp_v0_2;
s32 var_a1;
s8 *temp_v1;
s8 temp_v0;
s32 temp;
var_a1 = arg1;
if (var_a1 == 0) {
var_a1 = 1;
if (arg1 == 0) {
arg1 = 1;
}
temp_v1 = arg0 + &D_8018E7AC;
temp_v0 = *temp_v1;
if ((temp_v0 != 2) && (temp_v0 != 5)) {
temp_v0_2 = arg0 * 4;
temp_a2 = temp_v0_2 + &D_8018E7B8;
*temp_v1 = 2;
*temp_a2 = var_a1;
if ((u32) var_a1 >= 0x100U) {
*temp_a2 = 0x000000FF;
temp = D_8018E7AC[arg0];
if ((temp != 2) && (temp != 5)) {
D_8018E7AC[arg0] = 2;
D_8018E7B8[arg0] = arg1;
if ((u32) arg1 >= 0x100U) {
D_8018E7B8[arg0] = 0xFF;
}
*(&D_8018E7D0 + temp_v0_2) = 0;
D_8018E7D0[arg0] = 0;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E088.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023