From 9e9b60772271538f0d81a207b3e06d9a8796d8f7 Mon Sep 17 00:00:00 2001 From: Dominik Peters Date: Tue, 24 Jun 2025 21:41:09 +0200 Subject: [PATCH] match: func_8001E93C (#644) --- README.md | 12 ++++++------ src/objects.c | 35 ++++++++++++++--------------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 918f2060..6bbe9bed 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fd As of June 24, 2025, this is our current score: -    Decomp progress: 94.13% +    Decomp progress: 94.29%     Documentation progress: 59.95% @@ -121,16 +121,16 @@ As of June 24, 2025, this is our current score: ``` ===================================================================== ADVENTURE ONE (ASM -> C Decompilation) - --------------- 94.13% Complete (94.84% NON_MATCHING) --------------- - # Decompiled functions: 1931 - # GLOBAL_ASM remaining: 19 + --------------- 94.29% Complete (94.99% NON_MATCHING) --------------- + # Decompiled functions: 1932 + # GLOBAL_ASM remaining: 18 # NON_MATCHING functions: 4 - # NON_EQUIVALENT WIP functions: 15 + # NON_EQUIVALENT WIP functions: 14 ---------------------------- Game Status ---------------------------- Balloons: 45/47, Keys: 4/4, Trophies: 4/5 T.T. Amulets: 4/4, Wizpig Amulets: 4/4 --------------------------------------------------------------------- - We are collecting silver coins in Spaceport Alpha. (1/8 silver coins) + We are collecting silver coins in Spaceport Alpha. (2/8 silver coins) ===================================================================== ADVENTURE TWO (Cleanup & Documentation) -------------------------- 59.95% Complete -------------------------- diff --git a/src/objects.c b/src/objects.c index 5dc60ea2..cbd22e9b 100644 --- a/src/objects.c +++ b/src/objects.c @@ -8599,8 +8599,6 @@ void func_8001E89C(void) { } } -// https://decomp.me/scratch/OKbBN -#ifdef NON_EQUIVALENT void func_8001E93C(void) { s32 pad[3]; LevelObjectEntry_OverridePos *overridePos; @@ -8614,9 +8612,8 @@ void func_8001E93C(void) { s16 animActorIndex2; s32 var_a0; Object *animObj1; - Object *animObj2; - LevelObjectEntry_Animation *animation1; // Not 100% positive this is an animation yet. - LevelObjectEntry_Animation *animation2; // Not 100% positive this is an animation yet. + LevelObjectEntry_Animation *animation1; + LevelObjectEntry_Animation *animation2; if (D_8011AE7E) { for (numOfObjs = 0; numOfObjs < D_8011AE78; numOfObjs++) { @@ -8667,10 +8664,8 @@ void func_8001E93C(void) { do { stopLooping = TRUE; for (i = 0; i < numOfObjs - 1; i++) { - animObj1 = D_8011AE74[i + 0]; - animObj2 = D_8011AE74[i + 1]; - animation1 = &animObj1->segment.level_entry->animation; - animation2 = &animObj2->segment.level_entry->animation; + animation1 = &D_8011AE74[i]->segment.level_entry->animation; + animation2 = &D_8011AE74[i + 1]->segment.level_entry->animation; animActorIndex1 = animation1->actorIndex; animActorIndex2 = animation2->actorIndex; @@ -8681,20 +8676,22 @@ void func_8001E93C(void) { animActorIndex2 -= 400; } - if (!gCutsceneID && !gCutsceneID) {} // fake - if (animActorIndex2 < animActorIndex1) { - D_8011AE74[i] = animObj2; + animObj1 = D_8011AE74[i]; + D_8011AE74[i] = D_8011AE74[i + 1]; D_8011AE74[i + 1] = animObj1; stopLooping = FALSE; } else if (animActorIndex1 == animActorIndex2) { if (animation2->order < animation1->order) { - D_8011AE74[i] = animObj2; + animObj1 = D_8011AE74[i]; + D_8011AE74[i] = D_8011AE74[i + 1]; D_8011AE74[i + 1] = animObj1; stopLooping = FALSE; - } else if (animation1->order == animation2->order && (animObj2->properties.animatedObj.action == 1 || - animObj1->properties.animatedObj.action == 2)) { - D_8011AE74[i] = animObj2; + } else if (animation1->order == animation2->order && + (D_8011AE74[i + 1]->properties.animatedObj.action == 1 || + D_8011AE74[i]->properties.animatedObj.action == 2)) { + animObj1 = D_8011AE74[i]; + D_8011AE74[i] = D_8011AE74[i + 1]; D_8011AE74[i + 1] = animObj1; stopLooping = FALSE; } @@ -8703,7 +8700,7 @@ void func_8001E93C(void) { } while (stopLooping == FALSE); var_a0 = -101; - for (i = 0; i < numOfObjs; i++) { + for (i = 0; i < numOfObjs; i += 1) { animation1 = &D_8011AE74[i]->segment.level_entry->animation; if (animation1->actorIndex != var_a0) { var_a0 = animation1->actorIndex; @@ -8711,7 +8708,6 @@ void func_8001E93C(void) { } animation1->order = sp28++; // It is possible that sp28 could not be initalized? D_8011AE74[i]->properties.animatedObj.action = 0; - if (!i) {} // fake } D_8011AE78 = numOfObjs; @@ -8720,9 +8716,6 @@ void func_8001E93C(void) { } D_8011AE7E = FALSE; } -#else -#pragma GLOBAL_ASM("asm/nonmatchings/objects/func_8001E93C.s") -#endif void func_8001EE74(void) { LevelObjectEntry_Animation *animation;