From 563f717bc68308af6a86573721bfa36b14bcf4d6 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 8 Feb 2024 05:46:51 +1100 Subject: [PATCH] Misc 1: Retail Overlay Actors OK (#1703) --- .../actors/ovl_Arms_Hook/z_arms_hook.c | 53 +++++++++++-------- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 8 ++- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 2 +- .../ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c | 26 +++++---- .../ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c | 11 ++-- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 5 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 6 +-- .../actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c | 6 +++ .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 3 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 2 + .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 3 +- .../z_bg_hidan_firewall.c | 3 +- 12 files changed, 74 insertions(+), 54 deletions(-) diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 5b1e963064..d085142969 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -139,25 +139,6 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { Player* player = GET_PLAYER(play); - Actor* touchedActor; - Actor* grabbed; - Vec3f bodyDistDiffVec; - Vec3f newPos; - f32 bodyDistDiff; - f32 phi_f16; - DynaPolyActor* dynaPolyActor; - f32 curGrabbedDist; - f32 grabbedDist; - s32 pad; - CollisionPoly* poly; - s32 bgId; - Vec3f intersectPos; - Vec3f prevFrameDiff; - Vec3f sp60; - f32 polyNormalX; - f32 polyNormalZ; - f32 velocity; - s32 pad1; if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) { ArmsHook_DetachHookFromActor(this); @@ -170,7 +151,8 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) && (this->collider.elem.atHitElem->elemType != ELEMTYPE_UNK4)) { - touchedActor = this->collider.base.at; + Actor* touchedActor = this->collider.base.at; + if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_9 | ACTOR_FLAG_10))) { if (this->collider.elem.atHitElem->bumperFlags & BUMP_HOOKABLE) { ArmsHook_AttachHookToActor(this, touchedActor); @@ -182,7 +164,20 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { this->timer = 0; Audio_PlaySfxGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } else if (DECR(this->timer) == 0) { + return; + } + + if (DECR(this->timer) == 0) { + Actor* grabbed; + Vec3f bodyDistDiffVec; + Vec3f newPos; + f32 bodyDistDiff; + f32 phi_f16; + s32 pad1; + f32 curGrabbedDist; + f32 grabbedDist; + f32 velocity; + grabbed = this->grabbed; if (grabbed != NULL) { if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) { @@ -250,6 +245,12 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { } } } else { + CollisionPoly* poly; + s32 bgId; + Vec3f intersectPos; + Vec3f prevFrameDiff; + Vec3f sp60; + Actor_MoveXZGravity(&this->actor); Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff); Math_Vec3f_Sum(&this->unk_1E8, &prevFrameDiff, &this->unk_1E8); @@ -260,13 +261,17 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true, &bgId) && !func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) { - polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x); - polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z); + f32 polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x); + f32 polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z); + s32 pad; + Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos); this->actor.world.pos.x += 10.0f * polyNormalX; this->actor.world.pos.z += 10.0f * polyNormalZ; this->timer = 0; if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) { + DynaPolyActor* dynaPolyActor; + if (bgId != BGCHECK_SCENE) { dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL) { @@ -308,6 +313,8 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) { if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) { OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850); + if (1) {} + if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); Matrix_MultVec3f(&D_80865B88, &hookNewTip); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index 2220e8f546..d754036fb5 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -90,17 +90,21 @@ static InitChainEntry sInitChain[] = { static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f }; void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) { - s16 pad1; + s32 pad; CollisionHeader* colHeader = NULL; - s16 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if OOT_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index f2779f3c61..4187b34023 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -252,7 +252,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { } if (givingReward) { - if (!IS_CUTSCENE_LAYER) { + if (!IS_CUTSCENE_LAYER || !OOT_DEBUG) { if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 95f18f4b7c..7cf14989c1 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -97,12 +97,11 @@ void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play2) { void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { Actor* thisx = &this->dyna.actor; Actor* prop; - BgGanonOtyuka* platform; + s16 i; f32 dx; f32 dy; f32 dz; Vec3f center; - s16 i; if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) { PRINTF("OTC O 1\n"); @@ -113,20 +112,19 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { prop = prop->next; continue; - } - - platform = (BgGanonOtyuka*)prop; - - dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x; - dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y; - dz = platform->dyna.actor.world.pos.z - this->dyna.actor.world.pos.z + D_80876A68[i].z; - - if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) { - platform->visibleSides |= sSides[i]; - break; } else { - prop = prop->next; + BgGanonOtyuka* platform = (BgGanonOtyuka*)prop; + + dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x; + dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y; + dz = platform->dyna.actor.world.pos.z - this->dyna.actor.world.pos.z + D_80876A68[i].z; + + if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) { + platform->visibleSides |= sSides[i]; + break; + } } + prop = prop->next; } } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c index e7ea4f3655..e717fcc356 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c @@ -125,15 +125,18 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) { } else if ((this->unk_198 % 6) == 0) { s32 i; s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f + s16 temp_1; + f32 temp_3; + f32 temp_4; + f32 distXZ; vecA.y = 0.0f; vecB.y = thisx->world.pos.y; for (i = 0; i < 6; i++) { - s16 temp_1 = Rand_CenteredFloat(0x2800) + temp_2; - f32 temp_3 = Math_SinS(temp_1); - f32 temp_4 = Math_CosS(temp_1); - f32 distXZ; + temp_1 = Rand_CenteredFloat(0x2800) + temp_2; + temp_3 = Math_SinS(temp_1); + temp_4 = Math_CosS(temp_1); vecB.x = thisx->world.pos.x + (120.0f * temp_3); vecB.z = thisx->world.pos.z + (120.0f * temp_4); diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 8e129ae40e..ed45e2cfc8 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -315,8 +315,6 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) { if (this->vFlameScale > 0) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716); - if (1) {} - Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, @@ -327,6 +325,9 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) { Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); scale = this->vFlameScale * 0.00001f; + + if (1) {} + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_gate.c", 744), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 8caf50d340..b7d3248962 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -85,14 +85,14 @@ void BgHakaMegane_Destroy(Actor* thisx, PlayState* play) { } void func_8087DB24(BgHakaMegane* this, PlayState* play) { - CollisionHeader* colHeader; - CollisionHeader* collision; - if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->dyna.actor.objectSlot = this->requiredObjectSlot; this->dyna.actor.draw = BgHakaMegane_Draw; Actor_SetObjectDependency(play, &this->dyna.actor); if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { + CollisionHeader* colHeader; + CollisionHeader* collision; + this->actionFunc = func_8087DBF0; collision = sCollisionHeaders[this->dyna.actor.params]; if (collision != NULL) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index 4bd23fcaac..19e7e18a74 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -199,7 +199,11 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) { f32 angleTemp; OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528); + Gfx_SetupDL_25Opa(play->state.gfxCtx); + + if (1) {} + if (this->dyna.actor.params == 0) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_ship.c", 534), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -220,7 +224,9 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910); } + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568); + if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) { s32 pad; Vec3f sp2C; diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 1e205a090f..5c0a4fc067 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -352,6 +352,7 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) { f32 floorHeight; f32 yIntersect; s32 i; + s32 bgId; this->dyna.actor.velocity.y *= 1.6f; @@ -366,8 +367,6 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) { floorHeight = this->dyna.actor.floorHeight; for (i = 0; i < 3; i++) { - s32 bgId; - yIntersect = BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) - 25.0f; diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index c868ca72a1..85549a63d7 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -490,6 +490,8 @@ void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904); + if (1) {} + if (BgHeavyBlock_LiftedUp == this->actionFunc) { Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, &thisx->shape.rot); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index e7ec041a3e..536a8abcdd 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -86,11 +86,12 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { this->treasureFlag = (thisx->params >> 6) & 0x3F; thisx->params &= 0x3F; - if ((this->actor.params < 0) || (this->actor.params > 0x3F)) { + if (OOT_DEBUG && ((this->actor.params < 0) || (this->actor.params > 0x3F))) { // "Save bit is not set" PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", 373, this->actor.params); } + Actor_SetScale(&this->actor, hcParams->scale); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index 441fe805f1..52f904432f 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -58,8 +58,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE }; void BgHidanFirewall_Init(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; - this->actor.scale.x = 0.12f; - this->actor.scale.z = 0.12f; + this->actor.scale.x = this->actor.scale.z = 0.12f; this->actor.scale.y = 0.01f; this->unk_150 = 0;