From 454b1caa52b4447b57f57e929cbc831016d55c63 Mon Sep 17 00:00:00 2001 From: cadmic Date: Sun, 4 Feb 2024 19:28:18 -0800 Subject: [PATCH] Match more retail actors (#1711) * More actors * Format --- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 4 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 9 +++ .../actors/ovl_Obj_Kibako2/z_obj_kibako2.c | 2 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 43 ++++++++------ .../actors/ovl_Obj_Mure3/z_obj_mure3.c | 3 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 2 + .../ovl_Obj_Warp2block/z_obj_warp2block.c | 56 +++++++++---------- .../ovl_Object_Kankyo/z_object_kankyo.c | 2 + .../actors/ovl_Oceff_Wipe/z_oceff_wipe.c | 2 + src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 3 +- 10 files changed, 75 insertions(+), 51 deletions(-) diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index fb7db74af1..69351a718e 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -469,7 +469,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (mREG(1) == 1)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (OOT_DEBUG && mREG(1) == 1)) { path = (this->dyna.actor.params >> 8) & 0x1F; if (path == 0x1F) { PRINTF(VT_COL(RED, WHITE)); @@ -504,7 +504,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->dyna.actor); return; } - } else if ((Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) != 0) || (mREG(1) == 1)) { + } else if ((Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) != 0) || (OOT_DEBUG && mREG(1) == 1)) { ObjBean_SetupWaitForWater(this); } else { ObjBean_SetupWaitForBean(this); diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index edf6b71a69..f399f017ef 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -94,9 +94,11 @@ void ObjHsblock_Init(Actor* thisx, PlayState* play) { } } +#if OOT_DEBUG mREG(13) = 255; mREG(14) = 255; mREG(15) = 255; +#endif } void ObjHsblock_Destroy(Actor* thisx, PlayState* play) { @@ -158,9 +160,16 @@ void ObjHsblock_Draw(Actor* thisx, PlayState* play) { if (play->sceneId == SCENE_FIRE_TEMPLE) { color = &sFireTempleColor; } else { +#if OOT_DEBUG defaultColor.r = mREG(13); defaultColor.g = mREG(14); defaultColor.b = mREG(15); +#else + defaultColor.r = 255; + defaultColor.g = 255; + defaultColor.b = 255; +#endif + color = &defaultColor; } diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 2954fb1717..44b2389993 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -125,8 +125,8 @@ void ObjKibako2_Init(Actor* thisx, PlayState* play) { ObjKibako2_InitCollider(thisx, play); CollisionHeader_GetVirtual(&gLargeCrateCol, &colHeader); bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - this->collectibleFlag = this->dyna.actor.home.rot.z & 0x3F; this->dyna.bgId = bgId; + this->collectibleFlag = this->dyna.actor.home.rot.z & 0x3F; this->actionFunc = ObjKibako2_Idle; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x = 0; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 4968e8ec68..7a6f06f9d0 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -109,9 +109,12 @@ void ObjMure_Init(Actor* thisx, PlayState* play) { this->actionFunc = ObjMure_InitialAction; PRINTF("群れな敵 (arg_data 0x%04x)(chNum(%d) ptn(%d) svNum(%d) type(%d))\n", thisx->params, this->chNum, this->ptn, this->svNum, this->type); + +#if OOT_DEBUG if (ObjMure_GetMaxChildSpawns(this) <= 0) { PRINTF("Warning : 個体数が設定されていません(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 268, thisx->params); } +#endif } void ObjMure_Destroy(Actor* thisx, PlayState* play) { @@ -125,48 +128,52 @@ s32 ObjMure_GetMaxChildSpawns(ObjMure* this) { } void ObjMure_GetSpawnPos(Vec3f* outPos, Vec3f* inPos, s32 ptn, s32 idx) { +#if OOT_DEBUG if (ptn >= 4) { PRINTF("おかしなの (%s %d)\n", "../z_obj_mure.c", 307); } +#endif + *outPos = *inPos; } void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { - ActorContext* ac; + Actor* actor = &this->actor; s32 i; Vec3f pos; s32 pad; s32 maxChildren = ObjMure_GetMaxChildSpawns(this); for (i = 0; i < maxChildren; i++) { +#if OOT_DEBUG if (this->children[i] != NULL) { // "Error: I already have a child(%s %d)(arg_data 0x%04x)" - PRINTF("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 333, this->actor.params); + PRINTF("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 333, actor->params); } +#endif + switch (this->childrenStates[i]) { case OBJMURE_CHILD_STATE_1: break; case OBJMURE_CHILD_STATE_2: - ac = &play->actorCtx; - ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); + ObjMure_GetSpawnPos(&pos, &actor->world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); + Actor_Spawn(&play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, + actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { this->children[i]->flags |= ACTOR_FLAG_ENKUSA_CUT; - this->children[i]->room = this->actor.room; + this->children[i]->room = actor->room; } else { PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 359); } break; default: - ac = &play->actorCtx; - ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); + ObjMure_GetSpawnPos(&pos, &actor->world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); + Actor_Spawn(&play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, + actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { - this->children[i]->room = this->actor.room; + this->children[i]->room = actor->room; } else { PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 382); } @@ -175,21 +182,23 @@ void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { } } -void ObjMure_SpawnActors1(ObjMure* this, PlayState* play) { - ActorContext* ac = (ActorContext*)play; // fake match +void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { + PlayState* play = play2; Actor* actor = &this->actor; Vec3f spawnPos; s32 maxChildren = ObjMure_GetMaxChildSpawns(this); s32 i; for (i = 0; i < maxChildren; i++) { +#if OOT_DEBUG if (this->children[i] != NULL) { PRINTF("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 407, actor->params); } - ac = &play->actorCtx; +#endif + ObjMure_GetSpawnPos(&spawnPos, &actor->world.pos, this->ptn, i); - this->children[i] = Actor_Spawn(ac, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, - actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, + this->children[i] = Actor_Spawn(&play2->actorCtx, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, + spawnPos.z, actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, (this->type == 4 && i == 0) ? 1 : sSpawnParams[this->type]); if (this->children[i] != NULL) { this->childrenStates[i] = OBJMURE_CHILD_STATE_0; diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index a2f2ecf3a0..a535314609 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -106,9 +106,10 @@ void func_80B9ABA0(ObjMure3* this, PlayState* play) { void func_80B9ACE4(ObjMure3* this, PlayState* play) { s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; s32 i; + EnItem00** collectible; for (i = 0; i < count; i++) { - EnItem00** collectible = &this->unk_150[i]; + collectible = &this->unk_150[i]; if (!((this->unk_16C >> i) & 1) && (*collectible != NULL)) { if (Actor_HasParent(&(*collectible)->actor, play) || ((*collectible)->actor.update == NULL)) { diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 9e1c15429a..f4dfe51a6e 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -283,6 +283,8 @@ void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { } flameScale *= 0.0027f; + if (1) {} + Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 76d6eff609..73919d7d30 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -74,39 +74,37 @@ void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play) { } s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play) { - s32 pad; - Actor* temp_a3; - Player* player; - Vec3f sp20; - f32 temp_f2; - if (DynaPolyActor_IsPlayerAbove(&this->dyna)) { return 0; - } - - temp_a3 = this->dyna.actor.child; - player = GET_PLAYER(play); - if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || - (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { - - func_8002DBD0(&this->dyna.actor, &sp20, &player->actor.world.pos); - temp_f2 = (this->dyna.actor.scale.x * 50.0f) + 6.0f; - - if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { - return 0; - } - - func_8002DBD0(temp_a3, &sp20, &player->actor.world.pos); - temp_f2 = (temp_a3->scale.x * 50.0f) + 6.0f; - - if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { - return 0; - } } else { - return 0; - } + s32 pad; + Actor* temp_a3 = this->dyna.actor.child; + Player* player = GET_PLAYER(play); + Vec3f sp20; + f32 temp_f2; - return 1; + if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || + (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { + + func_8002DBD0(&this->dyna.actor, &sp20, &player->actor.world.pos); + temp_f2 = (this->dyna.actor.scale.x * 50.0f) + 6.0f; + + if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { + return 0; + } + + func_8002DBD0(temp_a3, &sp20, &player->actor.world.pos); + temp_f2 = (temp_a3->scale.x * 50.0f) + 6.0f; + + if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { + return 0; + } + } else { + return 0; + } + + return 1; + } } void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play) { 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 64ee2c89d7..5ce4d3b6b6 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -860,6 +860,8 @@ void ObjectKankyo_DrawSunGraveSpark(Actor* thisx, PlayState* play2) { (u8)(255 * this->effects[0].amplitude), 255 - (u8)(255 * this->effects[0].amplitude), this->effects[0].alpha); + if (1) {} + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_object_kankyo.c", 1416), G_MTX_LOAD); diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 27373e2b76..b4a696fecd 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -124,5 +124,7 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) { 32, 1, 0 - scroll, scroll * (-2), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_wipe.c", 398); } diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 6bb83051e6..bc7bf1caa6 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -163,7 +163,6 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { Player* player = GET_PLAYER(play); EnItem00* collectible; s32 pad; - Vec3f spawnPos; if (this->collider.base.acFlags & AC_HIT) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); @@ -174,6 +173,8 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { if (1) {} gSaveContext.cutsceneTrigger = 1; } else { + Vec3f spawnPos; + spawnPos.x = 700.0f; spawnPos.y = -800.0f; spawnPos.z = 7261.0f;