Skip to content

Commit

Permalink
Match func_8009A374 (#592)
Browse files Browse the repository at this point in the history
* Match func_8009A374

* Clean up func_8009A478
  • Loading branch information
spazzylemons authored Apr 3, 2024
1 parent 40700ce commit 705fb6d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 132 deletions.
73 changes: 0 additions & 73 deletions asm/non_matchings/code_80091750/func_8009A374.s

This file was deleted.

115 changes: 56 additions & 59 deletions src/code_80091750.c
Original file line number Diff line number Diff line change
Expand Up @@ -4647,73 +4647,70 @@ void func_8009A344(void) {
}
}

#ifdef NON_MATCHING
// https://decomp.me/scratch/BRs75
// Too much stuff on the stack, but removing the padding
// causes some stack offsets to be wrong :/
s32 func_8009A374(MkAnimation *arg0) {
s32 stackPadding0;
MkAnimation *temp_v0;
s32 var_a1;
struct_8018DEE0_entry *temp_v1;
s32 func_8009A374(MkAnimation *anim) {
s32 i;
struct_8018DEE0_entry *entry;

temp_v0 = segmented_to_virtual_dupe_2(arg0);
var_a1 = 0;
while (D_8018DEE0[var_a1].visible != 0) {
var_a1++;
if (var_a1 >= 0x10) {
while(TRUE);
}
}
temp_v1 = &D_8018DEE0[var_a1];
temp_v1->textureSequence = temp_v0;
temp_v1->sequenceIndex = -1;
temp_v1->frameCountDown = 0;
temp_v1->visible = 0x80000000;
temp_v1->D_8018E118_index = gNumD_8018E118Entries;
if (temp_v0->mk64Texture != NULL) {
func_8009969C(temp_v0->mk64Texture);
}
if ((temp_v0 + 1)->mk64Texture != NULL) {
func_8009969C((temp_v0 + 1)->mk64Texture);
anim = segmented_to_virtual_dupe_2(anim);
i = 0;
while (D_8018DEE0[i].visible) {
i++;
if (i >= 0x10) {
// No more space.
while (1);
}
}

entry = &D_8018DEE0[i];
entry->textureSequence = anim;
entry->sequenceIndex = -1;
entry->frameCountDown = 0;
entry->visible = 0x80000000;
entry->D_8018E118_index = gNumD_8018E118Entries;

if (anim[0].mk64Texture) {
func_8009969C(anim[0].mk64Texture);
}
if (anim[1].mk64Texture) {
func_8009969C(anim[1].mk64Texture);
} else {
func_8009969C(temp_v0->mk64Texture);
func_8009969C(anim[0].mk64Texture);
}
temp_v1->unk14 = 0;
return var_a1;

entry->unk14 = 0;
return i;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A374.s")
#endif

s32 func_8009A478(MkAnimation *arg0, s32 arg1) {
s32 var_a1;
MkAnimation *temp_v0;
s32 func_8009A478(MkAnimation* anim, s32 arg1) {
s32 i;
struct_8018DEE0_entry* entry;

temp_v0 = segmented_to_virtual_dupe_2(arg0);
var_a1 = 0;
while (D_8018DEE0[var_a1].visible != 0) {
var_a1++;
if (var_a1 >= 0x10) {
while(TRUE);
}
}
D_8018DEE0[var_a1].textureSequence = temp_v0;
D_8018DEE0[var_a1].sequenceIndex = -1;
D_8018DEE0[var_a1].frameCountDown = 0;
D_8018DEE0[var_a1].visible = 0x80000000;
D_8018DEE0[var_a1].D_8018E118_index = gNumD_8018E118Entries;
if (temp_v0->mk64Texture != NULL) {
func_80099958(temp_v0->mk64Texture, arg1, 0);
}
if ((temp_v0 + 1)->mk64Texture != NULL) {
func_80099958((temp_v0 + 1)->mk64Texture, arg1, 1);
anim = segmented_to_virtual_dupe_2(anim);
i = 0;
while (D_8018DEE0[i].visible) {
i++;
if (i >= 0x10) {
// No more space.
while(1);
}
}

entry = &D_8018DEE0[i];
entry->textureSequence = anim;
entry->sequenceIndex = -1;
entry->frameCountDown = 0;
entry->visible = 0x80000000;
entry->D_8018E118_index = gNumD_8018E118Entries;
if (anim[0].mk64Texture) {
func_80099958(anim[0].mk64Texture, arg1, 0);
}
if (anim[1].mk64Texture) {
func_80099958(anim[1].mk64Texture, arg1, 1);
} else {
func_80099958(temp_v0->mk64Texture, arg1, 1);
func_80099958(anim[0].mk64Texture, arg1, 1);
}
// ?????????????????????
D_8018DEE0[var_a1].unk14 = (temp_v0->mk64Texture != ((void *) 0)) * 0;
return var_a1;
entry->unk14 = 0;
return i;
}

void func_8009A594(s32 arg0, s32 arg1, MkAnimation *arg2) {
Expand Down

0 comments on commit 705fb6d

Please sign in to comment.