From 312fcafe2db9379a01c1b7f1f3ea4cd783ca48fe Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sun, 20 Aug 2023 01:50:55 -0700 Subject: [PATCH] Small General cleanup (#1360) * Draw things * EffectSsFhgFlash_SpawnShock enum * gohtIndex * colliders * ObjGhaka_Init * func_80B3C39C * undef syms --- src/code/z_rcp.c | 4 ++-- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 6 +++--- src/overlays/actors/ovl_En_Bom/z_en_bom.h | 2 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 2 +- src/overlays/actors/ovl_En_Crow/z_en_crow.h | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 2 +- src/overlays/actors/ovl_En_Nnh/z_en_nnh.c | 11 ++++++----- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.c | 2 +- .../actors/ovl_En_Ruppecrow/z_en_ruppecrow.h | 2 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 2 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h | 2 +- src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 12 ++++++------ src/overlays/actors/ovl_player_actor/z_player.c | 3 ++- .../ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c | 6 +++--- undefined_syms.txt | 2 ++ 16 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 1e25aca8b9..0830fa5721 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1539,10 +1539,10 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g gSPDisplayList(DEBUG_DISP++, gGfxMasterDL->setupBuffers); if (clearZb) { - gSPDisplayList(gfxCtx->polyOpa.p++, D_0E000000.clearZBuffer); + gSPDisplayList(POLY_OPA_DISP++, D_0E000000.clearZBuffer); } if (clearFb) { - gSPDisplayList(gfxCtx->polyOpa.p++, D_0E000000.clearFrameBuffer); + gSPDisplayList(POLY_OPA_DISP++, D_0E000000.clearFrameBuffer); } CLOSE_DISPS(gfxCtx); diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 67dd857c09..a22bf3e46c 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -152,17 +152,17 @@ void EnBom_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); if (!this->isPowderKeg) { - Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit1, &this->collider3); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit1, this->collider2Elements); this->collider1.dim.radius = 6; this->collider1.dim.height = 11; } else { - Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, &this->collider3); + Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit2, this->collider2Elements); this->collider1.dim.radius = 20; this->collider1.dim.height = 36; func_80872648(play, &this->actor.world.pos); } - this->collider3.info.toucher.damage += ENBOM_GETZ_FF00(thisx); + this->collider2Elements[0].info.toucher.damage += ENBOM_GETZ_FF00(thisx); this->actor.shape.rot.z &= 0xFF; if (ENBOM_GETZ_80(&this->actor)) { this->actor.shape.rot.z |= 0xFF00; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index d115472301..7ca26d3cb6 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -26,7 +26,7 @@ typedef struct EnBom { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider1; /* 0x190 */ ColliderJntSph collider2; - /* 0x1B0 */ ColliderJntSphElement collider3; + /* 0x1B0 */ ColliderJntSphElement collider2Elements[1]; /* 0x1F0 */ s16 timer; /* 0x1F2 */ s16 flashSpeedScale; /* 0x1F4 */ f32 unk_1F4; diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 1cd89043e8..fcdd89d03c 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -130,7 +130,7 @@ void EnCrow_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, OBJECT_CROW_LIMB_MAX); - Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.h b/src/overlays/actors/ovl_En_Crow/z_en_crow.h index d2ebc554a0..fca2cc0b09 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.h +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.h @@ -32,7 +32,7 @@ typedef struct EnCrow { /* 0x194 */ Vec3s jointTable[OBJECT_CROW_LIMB_MAX]; /* 0x1CA */ Vec3s morphTable[OBJECT_CROW_LIMB_MAX]; /* 0x200 */ ColliderJntSph collider; - /* 0x220 */ ColliderJntSphElement colliderItems[1]; + /* 0x220 */ ColliderJntSphElement colliderElements[1]; /* 0x260 */ Vec3f bodyPartsPos[GUAY_BODYPART_MAX]; /* 0x290 */ f32 drawDmgEffAlpha; /* 0x294 */ f32 drawDmgEffFrozenSteamScale; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 636ab6bdfb..80fe5a8e1b 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -266,7 +266,7 @@ void EnIk_Init(Actor* thisx, PlayState* play) { this->morphTable, IRON_KNUCKLE_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); - Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->shieldColliderItems); + Collider_InitAndSetTris(play, &this->colliderTris, &this->actor, &sTrisInit, this->shieldColliderElements); Collider_InitAndSetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTableArmor, &sColChkInfoInit); this->actor.params = IK_GET_ARMOR_TYPE(&this->actor); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index 0d1625144c..a6d56bca6f 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -72,7 +72,7 @@ typedef struct EnIk { /* 0x03AC */ ColliderCylinder colliderCylinder; /* 0x03F8 */ ColliderQuad colliderQuad; /* 0x0478 */ ColliderTris colliderTris; - /* 0x0498 */ ColliderTrisElement shieldColliderItems[2]; + /* 0x0498 */ ColliderTrisElement shieldColliderElements[2]; /* 0x0550 */ IronKnuckleEffect effects[IRON_KNUCKLE_ARMOR_BODYPART_MAX]; } EnIk; // size = 0x668 diff --git a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c index f0d84366ca..e7ac95d3e6 100644 --- a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c +++ b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c @@ -104,10 +104,11 @@ void EnNnh_Update(Actor* thisx, PlayState* play) { } void EnNnh_Draw(Actor* thisx, PlayState* play) { - GraphicsContext* gfxCtx = play->state.gfxCtx; - s32 pad; + OPEN_DISPS(play->state.gfxCtx); - Gfx_SetupDL25_Opa(gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, gButlerSonMainBodyDL); + Gfx_SetupDL25_Opa(play->state.gfxCtx); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gButlerSonMainBodyDL); + + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 5359d5ecef..e94bc851b2 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -645,7 +645,7 @@ void EnRuppecrow_Init(Actor* thisx, PlayState* play2) { ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); Collider_InitJntSph(play, &this->collider); - Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); + Collider_InitAndSetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements->dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h index f34df83751..40eee81024 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h @@ -33,7 +33,7 @@ typedef struct EnRuppecrow { /* 0x24C */ Path* path; /* 0x250 */ s32 currentPoint; /* 0x254 */ ColliderJntSph collider; - /* 0x274 */ ColliderJntSphElement colliderElement; + /* 0x274 */ ColliderJntSphElement colliderElements[1]; /* 0x2B4 */ u16 isGoingCounterClockwise; /* 0x2B8 */ f32 speedModifier; /* 0x2BC */ s16 rupeeIndex; diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 946791a8b0..be3d243e05 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -339,7 +339,7 @@ void ObjComb_Init(Actor* thisx, PlayState* play) { return; } - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderElement); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if ((sp2C == 0) && Item_CanDropBigFairy(play, OBJCOMB_GET_3F(&this->actor), OBJCOMB_GET_7F00(&this->actor))) { this->unk_1B7 = 1; diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h index 0ee61baaf0..0b1873bb32 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -19,7 +19,7 @@ typedef struct ObjComb { /* 0x000 */ Actor actor; /* 0x144 */ ObjCombActionFunc actionFunc; /* 0x148 */ ColliderJntSph collider; - /* 0x168 */ ColliderJntSphElement colliderElement; + /* 0x168 */ ColliderJntSphElement colliderElements[1]; /* 0x1A8 */ s16 unk_1A8; /* 0x1AA */ s16 unk_1AA; /* 0x1AC */ s16 unk_1AC; diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 02d7f29736..09dbd8dab5 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -70,12 +70,12 @@ void func_80B3C2C4(ObjGhaka* this, PlayState* play) { void func_80B3C39C(ObjGhaka* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 distDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; + s16 yaw = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) { func_80B3C29C(this); - } else if (this->dyna.actor.xzDistToPlayer < 100.0f || this->dyna.actor.isTargeted) { - if (distDiff <= -0x5556 || distDiff >= 0x5556) { + } else if ((this->dyna.actor.xzDistToPlayer < 100.0f) || this->dyna.actor.isTargeted) { + if ((yaw <= -0x5556) || (yaw >= 0x5556)) { Actor_OfferTalkNearColChkInfoCylinder(&this->dyna.actor, play); if (player->transformation == PLAYER_FORM_GORON) { this->dyna.actor.textId = 0xCF3; @@ -85,8 +85,8 @@ void func_80B3C39C(ObjGhaka* this, PlayState* play) { } } - if (this->dyna.pushForce < 0.0f && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20) && - player->transformation == PLAYER_FORM_GORON) { + if ((this->dyna.pushForce < 0.0f) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20) && + (player->transformation == PLAYER_FORM_GORON)) { func_80B3C2B0(this); } else { player->stateFlags2 &= ~PLAYER_STATE2_10; @@ -158,7 +158,7 @@ void ObjGhaka_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&object_ghaka_Colheader_003CD0, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); - if (this->dyna.actor.floorPoly == 0) { + if (this->dyna.actor.floorPoly == NULL) { Actor_Kill(&this->dyna.actor); } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_20)) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 951d985389..89ba05a86f 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -33,6 +33,7 @@ #include "overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.h" #include "overlays/actors/ovl_Obj_Aqua/z_obj_aqua.h" +#include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" #include "overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -11315,7 +11316,7 @@ void func_808445C4(PlayState* play, Player* this) { pos.x = (Rand_CenteredFloat(5.0f) + bodyPartsPos->x) - this->actor.world.pos.x; pos.y = (Rand_CenteredFloat(5.0f) + bodyPartsPos->y) - this->actor.world.pos.y; pos.z = (Rand_CenteredFloat(5.0f) + bodyPartsPos->z) - this->actor.world.pos.z; - EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, scale, 1); + EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, scale, FHGFLASH_SHOCK_PLAYER); Actor_PlaySfx_FlaggedCentered1(&this->actor, NA_SE_PL_SPARK - SFX_FLAG); } } diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 4edc1e3b12..c8f5a74c72 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -97,12 +97,12 @@ void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) { s32 pad; Vec3f* bodyPartPos; BossHakugin* goht = (BossHakugin*)this->actor; - s32 index = goht->unk_191 - 3; + s32 gohtIndex = goht->unk_191 - 3; - if (index < 0) { + if (gohtIndex < 0) { bodyPartPos = &goht->unk_2F00[this->rParams][12].unk_00; } else { - bodyPartPos = &goht->unk_2F00[this->rParams][index].unk_00; + bodyPartPos = &goht->unk_2F00[this->rParams][gohtIndex].unk_00; } this->pos.x = Rand_CenteredFloat(70.0f) + bodyPartPos->x; diff --git a/undefined_syms.txt b/undefined_syms.txt index 0234b8ba9f..81f14ced86 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -640,6 +640,8 @@ D_0A000D40 = 0x0A000D40; D_0C000000 = 0x0C000000; +// segment 0x0D + // segment 0x0E D_0E000000 = 0x0E000000;