From c5254084c26c749db81b721fdaf67f05a5da6095 Mon Sep 17 00:00:00 2001 From: petrie911 <69443847+petrie911@users.noreply.github.com> Date: Mon, 15 Aug 2022 13:55:42 -0500 Subject: [PATCH] Matched several functions (#1020) * matchmaker, matchmaker * more matches * one fix * I'll format you good * cleanup Co-authored-by: petrie911 --- include/z64cutscene.h | 9 ++- spec | 16 ----- src/code/z_demo.c | 38 +++++------ src/code/z_message.c | 65 ++++++------------- .../actors/ovl_Bg_Spdweb/z_bg_spdweb.c | 60 +++++++---------- src/overlays/actors/ovl_En_Arrow/z_en_arrow.c | 16 ++--- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 59 ++++++----------- .../ovl_Obj_Spidertent/z_obj_spidertent.c | 21 +++--- .../ovl_Obj_Spinyroll/z_obj_spinyroll.c | 60 +++++++---------- .../ovl_Obj_Spinyroll/z_obj_spinyroll.h | 14 ++-- .../ovl_Object_Kankyo/z_object_kankyo.c | 9 ++- 11 files changed, 132 insertions(+), 235 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index a9bca748e2..f4cc10802c 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -145,13 +145,12 @@ typedef enum { /* 0x108 */ CS_CMD_UNK_108 = 0x108, /* 0x109 */ CS_CMD_UNK_109, /* 0x12C */ CS_CMD_PLAYSEQ = 0x12C, - /* 0x12D */ CS_CMD_UNK_12D, - /* 0x130 */ CS_CMD_130 = 0x130, + /* 0x12D */ CS_CMD_STOPSEQ, + /* 0x12E */ CS_CMD_PLAYAMBIENCE, + /* 0x12F */ CS_CMD_FADEAMBIENCE, + /* 0x130 */ CS_CMD_130, /* 0x131 */ CS_CMD_131, /* 0x132 */ CS_CMD_132, - /* 0x133 */ CS_CMD_STOPSEQ, - /* 0x134 */ CS_CMD_PLAYAMBIENCE, - /* 0x135 */ CS_CMD_FADEAMBIENCE, /* 0x15E */ CS_CMD_TERMINATOR = 0x15E, /* 0x15F */ CS_CMD_CHOOSE_CREDITS_SCENES, /* 0x190 */ CS_CMD_RUMBLE = 0x190 diff --git a/spec b/spec index 864d24d696..e17d3af91b 100644 --- a/spec +++ b/spec @@ -813,11 +813,7 @@ beginseg name "ovl_En_Arrow" compress include "build/src/overlays/actors/ovl_En_Arrow/z_en_arrow.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_En_Arrow/ovl_En_Arrow_reloc.o" -#else - include "build/data/ovl_En_Arrow/ovl_En_Arrow.reloc.o" -#endif endseg beginseg @@ -2367,11 +2363,7 @@ beginseg name "ovl_Bg_Spdweb" compress include "build/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Bg_Spdweb/ovl_Bg_Spdweb_reloc.o" -#else - include "build/data/ovl_Bg_Spdweb/ovl_Bg_Spdweb.reloc.o" -#endif endseg beginseg @@ -2512,11 +2504,7 @@ beginseg name "ovl_Obj_Spinyroll" compress include "build/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Obj_Spinyroll/ovl_Obj_Spinyroll_reloc.o" -#else - include "build/data/ovl_Obj_Spinyroll/ovl_Obj_Spinyroll.reloc.o" -#endif endseg beginseg @@ -3799,11 +3787,7 @@ beginseg name "ovl_Obj_Spidertent" compress include "build/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.o" -#ifdef NON_MATCHING include "build/src/overlays/actors/ovl_Obj_Spidertent/ovl_Obj_Spidertent_reloc.o" -#else - include "build/data/ovl_Obj_Spidertent/ovl_Obj_Spidertent.reloc.o" -#endif endseg beginseg diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 223f76b5a5..8923669a77 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -488,6 +488,7 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { } } #else +void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd); #pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/func_800EADB0.s") #endif @@ -1111,8 +1112,6 @@ void func_800ECD7C(CutsceneContext* csCtx, u8** cutscenePtr, s16 index) { } } -#ifdef NON_MATCHING -// Some stack issues, and a few instructions in the "wrong" places /** * Loops over the cutscene data itself (`cutscenePtr`), applying the effects of each command instantaneously (for most * commands). @@ -1141,14 +1140,13 @@ void func_800ECD7C(CutsceneContext* csCtx, u8** cutscenePtr, s16 index) { */ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr) { s32 i; - s16 phi_s0; - s32 totalEntries; s32 j; - u32 cmdType; // sp5C s32 pad; - s32 cmdEntries; // sp58 - s32 cutsceneEndFrame; // sp50 - s16 phi_s0_23; + s32 totalEntries; + u32 cmdType; + s32 cmdEntries; + s32 pad2; + s32 cutsceneEndFrame; CsCmdBase* cmd; // Read the command list count and the ending frame for this cutscene @@ -1177,14 +1175,14 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc // Check special cases of command types. This are generic ActorActions // Ranges: [0x64, 0x96), 0xC9, [0x1C2, 0x258) if (((cmdType >= 100) && (cmdType < 150)) || (cmdType == 201) || ((cmdType >= 450) && (cmdType < 600))) { - for (phi_s0 = 0; phi_s0 < ARRAY_COUNT(D_801F4DC8); phi_s0++) { - if ((u16)cmdType == D_801F4DC8[phi_s0]) { - func_800ECD7C(csCtx, &cutscenePtr, phi_s0); + for (j = 0; j < ARRAY_COUNT(D_801F4DC8); j = (s16)(j + 1)) { + if (D_801F4DC8[j] == (u16)cmdType) { + func_800ECD7C(csCtx, &cutscenePtr, j); cmdType = -2; break; - } else if (D_801F4DC8[phi_s0] == 0) { - D_801F4DC8[phi_s0] = cmdType; - func_800ECD7C(csCtx, &cutscenePtr, phi_s0); + } else if (D_801F4DC8[j] == 0) { + D_801F4DC8[j] = cmdType; + func_800ECD7C(csCtx, &cutscenePtr, j); cmdType = -2; break; } @@ -1314,15 +1312,15 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc cutscenePtr += sizeof(s32); for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((csCtx->frames >= cmd->startFrame) && (csCtx->frames < cmd->endFrame)) { - csCtx->playerAction = (CsCmdActorAction*)cutscenePtr; + if ((cmd->startFrame <= csCtx->frames) && (csCtx->frames < cmd->endFrame)) { + csCtx->playerAction = (CsCmdActorAction*)cmd; } cutscenePtr += sizeof(CsCmdActorAction); } break; case CS_CMD_CAMERA: - cutscenePtr = &cutscenePtr[Cutscene_Command_Camera(play, cutscenePtr)]; + cutscenePtr += Cutscene_Command_Camera(play, cutscenePtr); break; case CS_CMD_TERMINATOR: @@ -1349,7 +1347,7 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; if (cmd->base != 0xFFFF) { - Cutscene_Command_Textbox(play, csCtx, (CsCmdTextbox*)cutscenePtr); + Cutscene_Command_Textbox(play, csCtx, (CsCmdTextbox*)cmd); } cutscenePtr += sizeof(CsCmdTextbox); } @@ -1395,10 +1393,6 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc } } } -#else -void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutscenePtr); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/Cutscene_ProcessCommands.s") -#endif /* End of command handling section */ diff --git a/src/code/z_message.c b/src/code/z_message.c index 14fe241c44..16e1203d75 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -254,62 +254,39 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3) #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D304.s") -#ifdef NON_EQUIVALENT -extern u16* D_801D0188; -extern s16* D_801D0250; +extern u16 D_801D0188[][9]; +extern s16 D_801D0250[]; void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { - f32 sp3C; - s16 temp_s0; - s16 temp_s1; - s16 temp_s1_2; + MessageContext* msgCtx = &play->msgCtx; + PauseContext* pauseCtx = &play->pauseCtx; s16 temp_s6; - s32 temp_s2; - s32 temp_s2_2; - u16* temp_v0; + s16 temp_s1 = *arg3; + s32 temp_s2 = *arg1; + f32 sp3C = *arg2; s16 phi_v0; s16 phi_s0; - s16 phi_s1; - s32 phi_s2; - s16 phi_s1_2; - s32 phi_s2_2; - temp_s1 = *arg3; - temp_s2 = *arg1; - sp3C = *arg2; if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) { phi_v0 = 0xA; } else { - phi_v0 = play->pauseCtx.unk_238[PAUSE_WORLD_MAP]; + phi_v0 = pauseCtx->unk_238[PAUSE_WORLD_MAP]; } - temp_s6 = *(&D_801D0250 + (phi_v0 * 2)); - phi_s0 = 0; - phi_s1_2 = temp_s1; - phi_s2_2 = temp_s2; - if ((s32)temp_s6 > 0) { - phi_s1 = temp_s1; - phi_s2 = temp_s2; - do { - temp_v0 = (phi_v0 * 0x12) + &D_801D0188 + (phi_s0 * 2); - (play + 0x4908 + (phi_s1 * 2))->decodedBuffer = (u16)*temp_v0; - Font_LoadChar(play, *temp_v0, phi_s2); - temp_s0 = phi_s0 + 1; - temp_s1_2 = phi_s1 + 1; - temp_s2_2 = phi_s2 + 0x80; - phi_s0 = temp_s0; - phi_s1 = temp_s1_2; - phi_s2 = temp_s2_2; - phi_s1_2 = temp_s1_2; - phi_s2_2 = temp_s2_2; - } while ((s32)temp_s0 < (s32)temp_s6); + + temp_s6 = D_801D0250[phi_v0]; + + for (phi_s0 = 0; phi_s0 < temp_s6; phi_s0++, temp_s1++, temp_s2 += 0x80) { + msgCtx->decodedBuffer.wchar[temp_s1] = D_801D0188[phi_v0][phi_s0]; + Font_LoadChar(play, D_801D0188[phi_v0][phi_s0], temp_s2); } - *arg3 = phi_s1_2 - 1; - *arg1 = phi_s2_2; - *arg2 = sp3C + ((f32)(temp_s6 - 1) * (16.0f * play->msgCtx.unk12098)); + + temp_s1--; + sp3C += (temp_s6 - 1) * (16.0f * msgCtx->unk12098); + + *arg3 = temp_s1; + *arg1 = temp_s2; + *arg2 = sp3C; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D62C.s") -#endif #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8014D7B4.s") diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index c484100bf1..296f562686 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -350,23 +350,20 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -#ifdef NON_MATCHING void func_809CE830(BgSpdweb* this, PlayState* play) { Vec3f spDC; Vec3f spD0; Vec3f spC4; - f32 spB0; - f32 spA4; - f32 sp9C; - f32 sp94; - f32 sp90; - f32 temp_f20; - f32 temp_f22; - f32 temp_f28; - f32 temp_f30; s32 i; - s16 temp_s0; s16 temp_s3; + s16 temp_s0; + f32 cosF2; + f32 sinF2; + f32 cosQ; + f32 sinQ; + f32 cosF1; + f32 sinF1; + f32 temp_f28; if (this->unk_162 != 0) { this->unk_162--; @@ -382,38 +379,34 @@ void func_809CE830(BgSpdweb* this, PlayState* play) { if ((this->unk_162 % 3) == 0) { temp_s3 = Rand_ZeroOne() * 0x2AAA; - spB0 = Math_CosS(this->dyna.actor.shape.rot.x); - temp_f20 = Math_SinS(this->dyna.actor.shape.rot.x); - temp_f30 = Math_CosS(this->dyna.actor.shape.rot.y); - spA4 = Math_SinS(this->dyna.actor.shape.rot.y); - if (1) {} + cosQ = Math_CosS(this->dyna.actor.shape.rot.x); + sinQ = Math_SinS(this->dyna.actor.shape.rot.x); + cosF1 = Math_CosS(this->dyna.actor.shape.rot.y); + sinF1 = Math_SinS(this->dyna.actor.shape.rot.y); - spC4.x = this->dyna.actor.world.pos.x + ((90.0f * temp_f20) * spA4); - spC4.y = this->dyna.actor.world.pos.y + (90.0f * spB0); - spC4.z = this->dyna.actor.world.pos.z + ((90.0f * temp_f20) * temp_f30); - - sp94 = temp_f20 * spA4; - sp90 = temp_f20 * temp_f30; + spC4.x = this->dyna.actor.world.pos.x + 90.0f * sinQ * sinF1; + spC4.y = this->dyna.actor.world.pos.y + 90.0f * cosQ; + spC4.z = this->dyna.actor.world.pos.z + 90.0f * sinQ * cosF1; for (i = 0; i < 6; i++) { temp_s0 = (s32)randPlusMinusPoint5Scaled(0x2800) + temp_s3; - temp_f20 = Math_SinS(temp_s0); - temp_f22 = Math_CosS(temp_s0); + sinF2 = Math_SinS(temp_s0); + cosF2 = Math_CosS(temp_s0); - spD0.x = spC4.x + (90.0f * ((sp94 * temp_f22) + (temp_f30 * temp_f20))); - spD0.y = spC4.y + ((90.0f * spB0) * temp_f22); - spD0.z = spC4.z + (90.0f * ((sp90 * temp_f22) - (spA4 * temp_f20))); + spD0.x = spC4.x + 90.0f * ((cosF1 * sinF2) + (sinQ * sinF1 * cosF2)); + spD0.y = spC4.y + 90.0f * cosQ * cosF2; + spD0.z = spC4.z + 90.0f * ((sinQ * cosF1 * cosF2) - (sinF1 * sinF2)); temp_f28 = Math_Vec3f_DistXYZ(&this->dyna.actor.home.pos, &spD0) * (1.0f / 90.0f); if (temp_f28 < 0.65f) { temp_f28 = 1.0f - temp_f28; - temp_f20 = Math_SinS(BINANG_ROT180(temp_s0)); - temp_f22 = Math_CosS(BINANG_ROT180(temp_s0)); + sinF2 = Math_SinS(BINANG_ROT180(temp_s0)); + cosF2 = Math_CosS(BINANG_ROT180(temp_s0)); } - spDC.x = (6.5f * temp_f28) * ((temp_f30 * temp_f20) + (temp_f22 * sp94)); - spDC.y = temp_f22 * ((6.5f * temp_f28) * spB0); - spDC.z = (6.5f * temp_f28) * ((temp_f22 * sp90) - (spA4 * temp_f20)); + spDC.x = 6.5f * temp_f28 * ((cosF1 * sinF2) + (sinQ * sinF1 * cosF2)); + spDC.y = 6.5f * temp_f28 * cosQ * cosF2; + spDC.z = 6.5f * temp_f28 * ((sinQ * cosF1 * cosF2) - (sinF1 * sinF2)); EffectSsDeadDb_Spawn(play, &this->dyna.actor.home.pos, &spDC, &gZeroVec3f, &D_809CF208, &D_809CF20C, 0x3C, 8, 0xE); @@ -423,9 +416,6 @@ void func_809CE830(BgSpdweb* this, PlayState* play) { SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.home.pos, 11, NA_SE_EN_EXTINCT); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spdweb/func_809CE830.s") -#endif void func_809CEBC0(BgSpdweb* this, PlayState* play) { Player* player = GET_PLAYER(play); diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index ab68d87691..46d42a8173 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -315,9 +315,6 @@ void func_8088AA98(EnArrow* this, PlayState* play) { } } -#ifdef NON_MATCHING -// Stack. Scoped variable required to fix code gen at the bottom, likely sp60/54 there, -// but sp50 must be declared below those so maybe not? void func_8088ACE0(EnArrow* this, PlayState* play) { CollisionPoly* spAC; s32 spA8; @@ -329,8 +326,6 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { f32 sp78; f32 sp74; f32 temp_f12_2; - Vec3f sp60; - Vec3f sp54; s32 sp50; if ((DECR(this->unk_260) == 0) || @@ -470,9 +465,8 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); } - this->unk_262 = BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &sp9C, - &this->actor.wallPoly, true, true, true, true, &spA8); - if (this->unk_262 != 0) { + if ((this->unk_262 = BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, + &sp9C, &this->actor.wallPoly, true, true, true, true, &spA8))) { func_800B90AC(play, &this->actor, this->actor.wallPoly, spA8, &sp9C); Math_Vec3f_Copy(&this->actor.world.pos, &sp9C); this->actor.wallBgId = spA8; @@ -485,7 +479,8 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { if (this->unk_264 != NULL) { if (this->unk_264->update != NULL) { - s32 pad; + Vec3f sp60; + Vec3f sp54; Math_Vec3f_Sum(&this->unk_228, &this->unk_268, &sp60); Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_268, &sp54); @@ -511,9 +506,6 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { } } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Arrow/func_8088ACE0.s") -#endif void func_8088B630(EnArrow* this, PlayState* play) { SkelAnime_Update(&this->arrow.skelAnime); diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 7d6f76b7a0..a69cbe213b 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -781,11 +781,10 @@ void func_808DA3F4(EnSw* this, PlayState* play) { func_808D94D0(this, play, 0, 0, temp_s1); } -#ifdef NON_MATCHING void func_808DA578(EnSw* this, PlayState* play) { f32 temp_f0; - s32 test; - s32 test2; + f32 temp; + s16 temp2; Vec3f sp30; if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -795,7 +794,8 @@ void func_808DA578(EnSw* this, PlayState* play) { if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp30, &this->unk_374); func_808D9894(this, &sp30); - func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp30.z, sp30.x)); + temp2 = Math_FAtan2F(sp30.z, sp30.x); + func_808D94D0(this, play, 0, 0, temp2); } } else if (this->unk_410 & 0x20) { Math_Vec3f_Copy(&this->unk_374, &this->actor.home.pos); @@ -805,28 +805,18 @@ void func_808DA578(EnSw* this, PlayState* play) { this->skelAnime.curFrame = 0.0f; } - temp_f0 = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); - if (!(this->unk_410 & 0x20)) { - test = this->unk_414; - test2 = temp_f0; - if ((test != 0) && (test < test2)) { - this->unk_410 |= 0x20; - } + temp = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); + if (!(this->unk_410 & 0x20) && ((s32)this->unk_414 != 0) && ((s32)this->unk_414 < (s32)temp)) { + this->unk_410 |= 0x20; } - this->unk_414 = temp_f0; + this->unk_414 = temp; } -#else -void func_808DA578(EnSw* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA578.s") -#endif -#ifdef NON_MATCHING void func_808DA6FC(EnSw* this, PlayState* play) { f32 sp4C; - s32 temp; - s32 temp2; - Vec3f sp38; f32 temp_f0; + s16 temp2; + Vec3f sp38; if (!Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { temp_f0 = this->skelAnime.endFrame - this->skelAnime.curFrame; @@ -835,7 +825,8 @@ void func_808DA6FC(EnSw* this, PlayState* play) { if ((this->actor.speedXZ == 0.0f) && (this->unk_44C != 0.0f)) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); - func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); + temp2 = Math_FAtan2F(sp38.z, sp38.x); + func_808D94D0(this, play, 0, 0, temp2); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); @@ -843,9 +834,8 @@ void func_808DA6FC(EnSw* this, PlayState* play) { } sp4C = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); - temp = this->unk_414; - temp2 = sp4C; - if ((temp != 0) && (temp < temp2)) { + + if (((s32)this->unk_414 != 0) && ((s32)this->unk_414 < (s32)sp4C)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_374); this->unk_454 = Rand_S16Offset(20, 20); this->unk_456 = (Rand_ZeroOne() * 10.0f) + 3.0f; @@ -854,10 +844,6 @@ void func_808DA6FC(EnSw* this, PlayState* play) { } this->unk_414 = sp4C; } -#else -void func_808DA6FC(EnSw* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DA6FC.s") -#endif void func_808DA89C(EnSw* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { @@ -966,15 +952,13 @@ void func_808DAA60(EnSw* this, PlayState* play) { func_808D94D0(this, play, 0, 0, sp40); } -#ifdef NON_MATCHING void func_808DACF4(EnSw* this, PlayState* play) { f32 sp4C; - f32 temp_f0; - s32 temp_f6; + f32 temp; + s16 temp_f6; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) == 0) { Vec3f sp38; - f32 temp; temp = this->skelAnime.endFrame - this->skelAnime.curFrame; this->unk_44C = 0.1f * temp; @@ -983,7 +967,8 @@ void func_808DACF4(EnSw* this, PlayState* play) { Math_Vec3f_Copy(&sp38, &this->unk_374); func_808D9894(this, &sp38); - func_808D94D0(this, play, 0, 0, Math_FAtan2F(sp38.z, sp38.x)); + temp_f6 = Math_FAtan2F(sp38.z, sp38.x); + func_808D94D0(this, play, 0, 0, temp_f6); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALWALL_DASH); @@ -991,8 +976,8 @@ void func_808DACF4(EnSw* this, PlayState* play) { } sp4C = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->unk_374); - temp_f6 = this->unk_414; - if ((temp_f6 != 0) && (temp_f6 < (s32)sp4C)) { + + if (((s32)this->unk_414 != 0) && ((s32)this->unk_414 < (s32)sp4C)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_374); this->unk_4A0 += this->unk_49C; if ((this->unk_4A0 >= this->unk_1E4->count) || (this->unk_4A0 < 0)) { @@ -1009,10 +994,6 @@ void func_808DACF4(EnSw* this, PlayState* play) { } this->unk_414 = sp4C; } -#else -void func_808DACF4(EnSw* this, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sw/func_808DACF4.s") -#endif void func_808DAEB4(EnSw* this, PlayState* play) { Vec3f sp5C; diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 4fb83303b4..05fe851a9c 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -695,15 +695,11 @@ void func_80B30AD4(ObjSpidertent* this) { this->actionFunc = func_80B30AF8; } -#ifdef NON_MATCHING void func_80B30AF8(ObjSpidertent* this, PlayState* play) { ObjSpidertentStruct* temp_s0 = &D_80B31350[OBJSPIDERTENT_GET_1(&this->dyna.actor)]; - TriNorm* triNorm; s32 i; s32 j; s32 pad; - Vec3f sp60; - f32 sp5C; this->unk_3C6++; @@ -762,10 +758,10 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); } - if (this->unk_3C1 >= 0x20) { + if (this->unk_3C1 >= 32) { if (this->unk_3C7 > 0) { this->unk_3C7--; - } else if (this->unk_3C1 >= 0x33) { + } else if (this->unk_3C1 > 50) { Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EN_EXTINCT); this->unk_3C7 = Rand_S16Offset(2, 2); } else { @@ -781,11 +777,15 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { } for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { - triNorm = &this->collider.elements[i].dim; + TriNorm* triNorm = &this->collider.elements[i].dim; + Vec3f sp60; + f32 sp5C; for (j = 0; j < ARRAY_COUNT(this->unk_3B0); j++) { - if (!(this->unk_3B0[j] < 5.0f) && !(this->unk_3C0 & (1 << j)) && - func_80B2FB94(&this->unk_3A4, this->unk_3B0[j], triNorm, &sp60, &sp5C)) { + if ((this->unk_3B0[j] < 5.0f) || (this->unk_3C0 & (1 << j))) { + continue; + } + if (func_80B2FB94(&this->unk_3A4, this->unk_3B0[j], triNorm, &sp60, &sp5C)) { func_80B300F4(this, play, triNorm, &sp60, sp5C, j); } } @@ -795,9 +795,6 @@ void func_80B30AF8(ObjSpidertent* this, PlayState* play) { Actor_MarkForDeath(&this->dyna.actor); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spidertent/func_80B30AF8.s") -#endif void ObjSpidertent_Update(Actor* thisx, PlayState* play) { ObjSpidertent* this = THIS; diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c index 3a1cae3721..0db945c96c 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c @@ -272,26 +272,25 @@ void func_80A1DFA0(ObjSpinyroll* this) { for (i = 0; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++) { for (j = 0, phi_f12 = temp_f0; j < this->unk_3A4.unk_F4; j++, phi_f12 -= temp_f2) { - this->unk_3A4.unk_00[i].unk_00[j].unk_00 = phi_f12; + this->unk_3A4.unk_00[i][j].unk_00 = phi_f12; } } } -#ifdef NON_MATCHING -// play not in s reg, something with ptr->unk_F0 = temp_s1; line s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { + f32 temp_f0; + ObjSpinyrollStruct* ptr = &this->unk_3A4; + f32 temp_f20; s32 i; s32 j; - ObjSpinyrollStruct2* ptr = &this->unk_3A4; - f32 temp_f0; - f32 temp_f20; Vec3f spC8; Vec3f spBC; Vec3f spB0; - ObjSpinyrollStruct* temp_s1; + ObjSpinyrollSubStruct* temp_s1; f32 temp_f22; f32 temp_f24; f32 temp; + s32 pad; s32 sp98; spC8.y = this->dyna.actor.world.pos.y + 10.0f; @@ -304,19 +303,17 @@ s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { temp = D_80A1F1F4[i]; temp_f22 = temp * this->unk_4C4.x; temp_f24 = temp * this->unk_4C4.z; - temp_s1 = &ptr->unk_00[i]; for (j = 0; j < ptr->unk_F4; j++) { - spC8.x = - (temp_s1->unk_00[j].unk_00 * Math_CosS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.x; - spC8.z = - (temp_s1->unk_00[j].unk_00 * -Math_SinS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.z; + temp_s1 = &ptr->unk_00[i][j]; + spC8.x = (temp_s1->unk_00 * Math_CosS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.x; + spC8.z = (temp_s1->unk_00 * -Math_SinS(this->dyna.actor.world.rot.y)) + this->dyna.actor.world.pos.z; spBC.x = temp_f22 + spC8.x; spBC.z = temp_f24 + spC8.z; - if (BgCheck_EntityLineTest3(&play->colCtx, &spC8, &spBC, &spB0, &temp_s1->unk_00[j].unk_04, 1, 0, 0, 1, - &temp_s1->unk_00[j].bgId, &this->dyna.actor, 0.0f)) { + if (BgCheck_EntityLineTest3(&play->colCtx, &spC8, &spBC, &spB0, &temp_s1->unk_04, 1, 0, 0, 1, + &temp_s1->bgId, &this->dyna.actor, 0.0f)) { if (arg3 && (this->dyna.actor.flags & ACTOR_FLAG_40)) { func_80A1DA50(play, this, &spC8, &spB0); } @@ -334,10 +331,6 @@ s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) { return sp98; } -#else -s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spinyroll/func_80A1E074.s") -#endif s32 func_80A1E2D8(ObjSpinyroll* this, PlayState* play, s32 arg2) { Vec3f sp1C; @@ -363,10 +356,9 @@ s32 func_80A1E394(CollisionContext* colCtx, f32* arg1, CollisionPoly** polyOut, return BgCheck_EntityCheckCeiling(colCtx, arg1, arg4, 24.0f, polyOut, bgId, &this->dyna.actor); } -#ifdef NON_MATCHING s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { - f32 temp_f20; - ObjSpinyrollStruct2* spC8; + f32 phi_f26; + ObjSpinyrollStruct* spC8 = &this->unk_3A4; f32 phi_f22; ObjSpinyrollColFunc spC0; s32 i; @@ -374,11 +366,12 @@ s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { Vec3f spAC; Vec3f spA0; Vec3f sp94; - ObjSpinyrollStruct* temp_s0; - f32 phi_f26; + ObjSpinyrollSubStruct* temp_s0; + f32 temp_f20; + s32 pad; s32 sp84; - - spC8 = &this->unk_3A4; + s32 pad2; + f32* temp; if (this->unk_4C4.y > 0.0f) { spC0 = func_80A1E394; @@ -393,18 +386,19 @@ s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { phi_f22 = FLT_MAX; spC8->unk_F0 = NULL; - for (i = 0; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++) { - sp94.z = D_80A1F1FC[i]; - temp_s0 = &spC8->unk_00[i]; + for (i = 0, temp = D_80A1F1FC; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++, temp++) { + sp94.z = *temp; for (j = 0; j < spC8->unk_F4; j++) { - sp94.x = temp_s0->unk_00[j].unk_00; + temp_s0 = &spC8->unk_00[i][j]; + + sp94.x = temp_s0->unk_00; func_80A1DAAC(&spAC, &sp94, this->dyna.actor.world.rot.y); spAC.x += this->dyna.actor.world.pos.x; spAC.z += this->dyna.actor.world.pos.z; - if (spC0(&play->colCtx, &spA0.y, &temp_s0->unk_00[j].unk_04, &temp_s0->unk_00[j].bgId, &spAC, this)) { + if (spC0(&play->colCtx, &spA0.y, &temp_s0->unk_04, &temp_s0->bgId, &spAC, this)) { temp_f20 = fabsf(spA0.y - spAC.y); if (temp_f20 <= 24.0f) { if (arg3 && (this->dyna.actor.flags & ACTOR_FLAG_40)) { @@ -425,10 +419,6 @@ s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) { } return sp84; } -#else -s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Spinyroll/func_80A1E3D8.s") -#endif s32 func_80A1E648(ObjSpinyroll* this, PlayState* play, s32 arg2) { f32 sp1C; @@ -442,7 +432,7 @@ s32 func_80A1E648(ObjSpinyroll* this, PlayState* play, s32 arg2) { DynaPolyActor* func_80A1E694(ObjSpinyroll* this, PlayState* play) { if (this->unk_3A4.unk_F0 != NULL) { - return DynaPoly_GetActor(&play->colCtx, this->unk_3A4.unk_F0->unk_00[0].bgId); + return DynaPoly_GetActor(&play->colCtx, this->unk_3A4.unk_F0->bgId); } return NULL; } diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h index 741385264a..10322586a7 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h @@ -24,22 +24,16 @@ typedef struct { } ObjSpinyrollSubStruct; // size = 0xC typedef struct { - /* 0x00 */ ObjSpinyrollSubStruct unk_00[10]; -} ObjSpinyrollStruct; // size = 0x78 - -typedef struct { - /* 0x00 */ ObjSpinyrollStruct unk_00[2]; - /* 0xF0 */ ObjSpinyrollStruct* unk_F0; + /* 0x00 */ ObjSpinyrollSubStruct unk_00[2][10]; + /* 0xF0 */ ObjSpinyrollSubStruct* unk_F0; /* 0xF4 */ s32 unk_F4; -} ObjSpinyrollStruct2; // size = 0xF8? +} ObjSpinyrollStruct; // size = 0xF8? typedef struct ObjSpinyroll { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ ColliderTris collider; /* 0x17C */ ColliderTrisElement colliderElements[6]; - /* 0x3A4 */ ObjSpinyrollStruct2 unk_3A4; - ///* 0x494 */ ObjSpinyrollStruct* unk_494; // alternative testing - ///* 0x498 */ s32 unk_498; + /* 0x3A4 */ ObjSpinyrollStruct unk_3A4; /* 0x49C */ s32 unk_49C; /* 0x4A0 */ ObjSpinyrollActionFunc actionFunc; /* 0x4A4 */ f32 unk_4A4; diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index a21e6c4f18..0247cd23a7 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -648,23 +648,22 @@ f32 func_808DDE74(void) { } #ifdef NON_MATCHING -// play->envCtx.unk_F2[1] needs to be loaded into s0 and then copied to s7 +// s2/s3 swapped void func_808DDE9C(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjectKankyo* this = THIS; Player* player = GET_PLAYER(play); s32 i; - s16 temp; + u8 phi_s5; + u16 end = play->envCtx.unk_F2[1]; f32 temp_f12; f32 temp_f20; f32 temp_f22; f32 temp_f2; - u8 phi_s5; - s32 end = play->envCtx.unk_F2[1]; OPEN_DISPS(play->state.gfxCtx); - if (end != 0) { + if (end) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 255, 255, 25); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20);