diff options
| author | fig02 <fig02srl@gmail.com> | 2021-04-27 21:32:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-27 21:32:15 -0400 |
| commit | 3fbdccbdbac4113ae04d77216b2a28b405e07734 (patch) | |
| tree | cf360d532c2318c0129818ccaa03d5d0be488d1b /src | |
| parent | 1ac9479caeccca1b4f03436a0cd7c91ee58cd505 (diff) | |
Document BodyBreak (en_part, body part spawner) (#797)
* done
* status defines
* whoops
* comment wording
* size calc change
* elseif
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/z_actor.c | 115 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Bb/z_en_bb.c | 15 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Bb/z_en_bb.h | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Ik/z_en_ik.c | 8 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Ik/z_en_ik.h | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Sb/z_en_sb.c | 6 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Sb/z_en_sb.h | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Skb/z_en_skb.c | 25 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Skb/z_en_skb.h | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Tite/z_en_tite.c | 21 | ||||
| -rwxr-xr-x | src/overlays/actors/ovl_En_Tite/z_en_tite.h | 2 |
13 files changed, 106 insertions, 98 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 9a0e62319..aec121001 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3037,104 +3037,111 @@ s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { return arg0[0]; } -void func_80032E24(struct_80032E24* arg0, s32 arg1, GlobalContext* globalCtx) { - u32 sp28; - u32 sp24; - u32 sp20; - - sp28 = (arg1 * sizeof(*arg0->unk_00)) + sizeof(*arg0->unk_00); - arg0->unk_00 = ZeldaArena_MallocDebug(sp28, "../z_actor.c", 7540); - if (arg0->unk_00 != NULL) { - sp24 = (arg1 * sizeof(*arg0->unk_0C)) + sizeof(*arg0->unk_0C); - arg0->unk_0C = ZeldaArena_MallocDebug(sp24, "../z_actor.c", 7543); - if (arg0->unk_0C != NULL) { - sp20 = (arg1 * sizeof(*arg0->unk_04)) + sizeof(*arg0->unk_04); - arg0->unk_04 = ZeldaArena_MallocDebug(sp20, "../z_actor.c", 7546); - if (arg0->unk_04 != NULL) { - Lib_MemSet((u8*)arg0->unk_00, sp28, 0); - Lib_MemSet((u8*)arg0->unk_0C, sp24, 0); - Lib_MemSet((u8*)arg0->unk_04, sp20, 0); - arg0->unk_10 = 1; +void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx) { + u32 matricesSize; + u32 dListsSize; + u32 objectIdsSize; + + matricesSize = (count + 1) * sizeof(*bodyBreak->matrices); + bodyBreak->matrices = ZeldaArena_MallocDebug(matricesSize, "../z_actor.c", 7540); + + if (bodyBreak->matrices != NULL) { + dListsSize = (count + 1) * sizeof(*bodyBreak->dLists); + bodyBreak->dLists = ZeldaArena_MallocDebug(dListsSize, "../z_actor.c", 7543); + + if (bodyBreak->dLists != NULL) { + objectIdsSize = (count + 1) * sizeof(*bodyBreak->objectIds); + bodyBreak->objectIds = ZeldaArena_MallocDebug(objectIdsSize, "../z_actor.c", 7546); + + if (bodyBreak->objectIds != NULL) { + Lib_MemSet((u8*)bodyBreak->matrices, matricesSize, 0); + Lib_MemSet((u8*)bodyBreak->dLists, dListsSize, 0); + Lib_MemSet((u8*)bodyBreak->objectIds, objectIdsSize, 0); + bodyBreak->val = 1; return; } } } - if (arg0->unk_00 != NULL) { - ZeldaArena_FreeDebug(arg0->unk_00, "../z_actor.c", 7558); + if (bodyBreak->matrices != NULL) { + ZeldaArena_FreeDebug(bodyBreak->matrices, "../z_actor.c", 7558); } - if (arg0->unk_0C != NULL) { - ZeldaArena_FreeDebug(arg0->unk_0C, "../z_actor.c", 7561); + if (bodyBreak->dLists != NULL) { + ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7561); } - if (arg0->unk_04 != NULL) { - ZeldaArena_FreeDebug(arg0->unk_04, "../z_actor.c", 7564); + if (bodyBreak->objectIds != NULL) { + ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7564); } } -void func_80032F54(struct_80032E24* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, Gfx** dList, s16 arg6) { +void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, + s16 objectId) { GlobalContext* globalCtx = Effect_GetGlobalCtx(); - if ((globalCtx->actorCtx.unk_00 == 0) && (arg0->unk_10 > 0)) { - if ((arg1 >= arg2) && (arg3 >= arg1) && (*dList != 0)) { - arg0->unk_0C[arg0->unk_10] = *dList; - Matrix_Get(&arg0->unk_00[arg0->unk_10]); - arg0->unk_04[arg0->unk_10] = arg6; - arg0->unk_10++; + if ((globalCtx->actorCtx.unk_00 == 0) && (bodyBreak->val > 0)) { + if ((limbIndex >= minLimbIndex) && (limbIndex <= maxLimbIndex) && (*dList != NULL)) { + bodyBreak->dLists[bodyBreak->val] = *dList; + Matrix_Get(&bodyBreak->matrices[bodyBreak->val]); + bodyBreak->objectIds[bodyBreak->val] = objectId; + bodyBreak->val++; } - if (arg1 != arg0->unk_14) { - arg0->unk_08++; + if (limbIndex != bodyBreak->prevLimbIndex) { + bodyBreak->count++; } - if ((u32)arg0->unk_08 >= arg4) { - arg0->unk_08 = arg0->unk_10 - 1; - arg0->unk_10 = -1; + if ((u32)bodyBreak->count >= count) { + bodyBreak->count = bodyBreak->val - 1; + bodyBreak->val = BODYBREAK_STATUS_READY; } } - arg0->unk_14 = arg1; + bodyBreak->prevLimbIndex = limbIndex; } -s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, s16 params) { +s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* globalCtx, s16 type) { EnPart* spawnedEnPart; MtxF* mtx; s16 objBankIndex; - if (arg1->unk_10 != -1) { + if (bodyBreak->val != BODYBREAK_STATUS_READY) { return false; } - while (arg1->unk_08 > 0) { - Matrix_Put(&arg1->unk_00[arg1->unk_08]); + while (bodyBreak->count > 0) { + Matrix_Put(&bodyBreak->matrices[bodyBreak->count]); Matrix_Scale(1.0f / actor->scale.x, 1.0f / actor->scale.y, 1.0f / actor->scale.z, MTXMODE_APPLY); - Matrix_Get(&arg1->unk_00[arg1->unk_08]); + Matrix_Get(&bodyBreak->matrices[bodyBreak->count]); - if (1) { // Necessary to match - if (arg1->unk_04[arg1->unk_08] >= 0) { - objBankIndex = arg1->unk_04[arg1->unk_08]; + if (1) { + if (bodyBreak->objectIds[bodyBreak->count] >= 0) { + objBankIndex = bodyBreak->objectIds[bodyBreak->count]; } else { objBankIndex = actor->objBankIndex; } } - mtx = &arg1->unk_00[arg1->unk_08]; + mtx = &bodyBreak->matrices[bodyBreak->count]; + spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, mtx->wx, - mtx->wy, mtx->wz, 0, 0, objBankIndex, params); + mtx->wy, mtx->wz, 0, 0, objBankIndex, type); + if (spawnedEnPart != NULL) { - func_800D20CC(&arg1->unk_00[arg1->unk_08], &spawnedEnPart->actor.shape.rot, 0); - spawnedEnPart->displayList = arg1->unk_0C[arg1->unk_08]; + func_800D20CC(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0); + spawnedEnPart->displayList = bodyBreak->dLists[bodyBreak->count]; spawnedEnPart->actor.scale = actor->scale; } - arg1->unk_08--; + bodyBreak->count--; } - arg1->unk_10 = 0; - ZeldaArena_FreeDebug(arg1->unk_00, "../z_actor.c", 7678); - ZeldaArena_FreeDebug(arg1->unk_0C, "../z_actor.c", 7679); - ZeldaArena_FreeDebug(arg1->unk_04, "../z_actor.c", 7680); + bodyBreak->val = BODYBREAK_STATUS_FINISHED; + + ZeldaArena_FreeDebug(bodyBreak->matrices, "../z_actor.c", 7678); + ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7679); + ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7680); return true; } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index c7cd5ec3f..474f8711e 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -362,7 +362,7 @@ void BgMizuMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) { u32 frames; if (1) {} - + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_movebg.c", 754); frames = globalCtx->gameplayFrames; diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index e0b5ca130..df841a566 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -169,7 +169,7 @@ void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalC GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s16 i; s32 pad; - + OPEN_DISPS(gfxCtx, "../z_efc_erupc.c", 368); for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) { if (particles->isActive) { diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 8cc1cf371..605e0406a 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -468,7 +468,7 @@ void EnBb_SetupDeath(EnBb* this, GlobalContext* globalCtx) { } void EnBb_Death(EnBb* this, GlobalContext* globalCtx) { - s16 sp4E = 3; + s16 enpartType = 3; Vec3f sp40 = { 0.0f, 0.5f, 0.0f }; Vec3f sp34 = { 0.0f, 0.0f, 0.0f }; @@ -480,13 +480,16 @@ void EnBb_Death(EnBb* this, GlobalContext* globalCtx) { this->actor.shape.rot.x -= 0x4E20; return; } - if (this->enPartInfo.unk_10 == 0) { - func_80032E24(&this->enPartInfo, 0xC, globalCtx); + + if (this->bodyBreak.val == BODYBREAK_STATUS_FINISHED) { + BodyBreak_Alloc(&this->bodyBreak, 12, globalCtx); } + if ((this->dmgEffect == 7) || (this->dmgEffect == 5)) { - sp4E = 0xB; + enpartType = 11; } - if (!func_8003305C(&this->actor, &this->enPartInfo, globalCtx, sp4E)) { + + if (!BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, enpartType)) { return; } Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xD0); @@ -1263,7 +1266,7 @@ void EnBb_Update(Actor* thisx, GlobalContext* globalCtx2) { void EnBb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnBb* this = THIS; - func_80032F54(&this->enPartInfo, limbIndex, 4, 0xF, 0xF, dList, -1); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_DEFAULT); } static Vec3f sFireIceOffsets[] = { diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.h b/src/overlays/actors/ovl_En_Bb/z_en_bb.h index d12fd825f..f2d4156b4 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.h +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.h @@ -42,7 +42,7 @@ typedef struct EnBb { /* 0x02AA */ u8 dmgEffect; /* 0x02AC */ ColliderJntSph collider; /* 0x02CC */ ColliderJntSphElement elements[1]; - /* 0x030C */ struct_80032E24 enPartInfo; + /* 0x030C */ BodyBreak bodyBreak; /* 0x0324 */ Actor* targetActor; } EnBb; // size = 0x0328 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 85c10b2b3..0b0d3f737 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -632,8 +632,8 @@ void func_80A75790(EnIk* this) { void func_80A758B0(EnIk* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); - if (func_8003305C(&this->actor, &this->unk_308, globalCtx, this->actor.params + 4)) { - this->unk_308.unk_10 = 0; + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 4)) { + this->bodyBreak.val = BODYBREAK_STATUS_FINISHED; } if (SkelAnime_Update(&this->skelAnime)) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4000) { @@ -730,7 +730,7 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { if (this->actor.params != 0) { if ((prevHealth > 10) && (this->actor.colChkInfo.health <= 10)) { this->unk_2FB = 1; - func_80032E24(&this->unk_308, 3, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 3, globalCtx); } } else if (this->actor.colChkInfo.health <= 10) { Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_BOSS); @@ -884,7 +884,7 @@ void EnIk_PostLimbDraw3(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1201); if (this->unk_2FB & 1) { - func_80032F54(&this->unk_308, limbIndex, 0x1A, 0x1B, 0x1C, dList, -1); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 26, 27, 28, dList, BODYBREAK_OBJECT_DEFAULT); } if (limbIndex == 12) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ik_inFight.c", 1217), 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 22a406ab2..24b110957 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -24,7 +24,7 @@ typedef struct EnIk { /* 0x0300 */ s16 unk_300; /* 0x0302 */ s16 switchFlags; /* 0x0304 */ EnIkActionFunc actionFunc; - /* 0x0308 */ struct_80032E24 unk_308; + /* 0x0308 */ BodyBreak bodyBreak; /* 0x0320 */ ColliderCylinder bodyCollider; /* 0x036C */ ColliderQuad axeCollider; /* 0x03EC */ ColliderTris shieldCollider; diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 381d2949d..966f40b31 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -425,7 +425,7 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { } if (this->actor.colChkInfo.health == 0) { this->hitByWindArrow = hitByWindArrow; - func_80032E24(&this->unk_1E0, 8, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 8, globalCtx); this->isDead = true; func_80032C7C(globalCtx, &this->actor); Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_SHELL_DEAD); @@ -454,7 +454,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { } else { this->actor.params = 1; } - if (func_8003305C(&this->actor, &this->unk_1E0, globalCtx, this->actor.params) != 0) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params)) { if (!this->hitByWindArrow) { Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x80); } else { @@ -480,7 +480,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { void EnSb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSb* this = THIS; - func_80032F54(&this->unk_1E0, limbIndex, 0, 6, 8, dList, -1); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 6, 8, dList, BODYBREAK_OBJECT_DEFAULT); } void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.h b/src/overlays/actors/ovl_En_Sb/z_en_sb.h index b35f79c85..3ffde5efd 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.h +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.h @@ -13,7 +13,7 @@ typedef struct EnSb { /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnSbActionFunc actionFunc; /* 0x0194 */ ColliderCylinder collider; - /* 0x01E0 */ struct_80032E24 unk_1E0; + /* 0x01E0 */ BodyBreak bodyBreak; /* 0x01F8 */ s16 fire; /* 0x01FA */ s16 behavior; /* 0x01FC */ s16 isDead; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 146c7c302..edaf434e9 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -380,7 +380,7 @@ void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) { // this cast is likely not real, but allows for a match u8* new_var; new_var = &this->unk_283; - if ((this->unk_283 != 1) || func_8003305C(&this->actor, &this->unk_28C, globalCtx, 1)) { + if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) { if ((*new_var) != 0) { this->unk_283 = (*new_var) | 2; } @@ -409,25 +409,24 @@ void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) { } this->unk_280 = 1; this->actor.flags &= ~1; - func_80032E24(&this->unk_28C, 18, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 18, globalCtx); this->unk_283 |= 4; EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28); EnSkb_SetupAction(this, func_80AFD880); } void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) { - if (func_8003305C(&this->actor, &this->unk_28C, globalCtx, 1) != 0) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) { if (this->actor.scale.x == 0.01f) { Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x10); + } else if (this->actor.scale.x <= 0.015f) { + Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE); } else { - if (this->actor.scale.x <= 0.015f) { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE); - } else { - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); - } + Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED); } + this->unk_283 |= 8; Actor_Kill(&this->actor); } @@ -482,7 +481,7 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { ((this->actor.colChkInfo.damageEffect == 0xE) && ((player->swordAnimation >= 4 && player->swordAnimation <= 11) || (player->swordAnimation == 20 || player->swordAnimation == 21)))) { - func_80032E24(&this->unk_28C, 2, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 2, globalCtx); this->unk_283 = 1; } } @@ -545,9 +544,9 @@ void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve Collider_UpdateSpheres(limbIndex, &this->collider); if ((this->unk_283 ^ 1) == 0) { - func_80032F54(&this->unk_28C, limbIndex, 0xB, 0xC, 0x12, dList, -1); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 11, 12, 18, dList, BODYBREAK_OBJECT_DEFAULT); } else if ((this->unk_283 | 4) == this->unk_283) { - func_80032F54(&this->unk_28C, limbIndex, 0, 0x12, 0x12, dList, -1); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 18, 18, dList, BODYBREAK_OBJECT_DEFAULT); } } #else diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 64b08ee9e..3e1392aa9 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -19,7 +19,7 @@ typedef struct EnSkb { /* 0x0283 */ u8 unk_283; /* 0x0284 */ EnSkbActionFunc actionFunc; /* 0x0288 */ s16 unk_288; - /* 0x028C */ struct_80032E24 unk_28C; + /* 0x028C */ BodyBreak bodyBreak; /* 0x02A4 */ ColliderJntSph collider; /* 0x02C4 */ ColliderJntSphElement colliderItem[2]; } EnSkb; // size = 0x0344 diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index f179c37f2..f79c95e2f 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -199,8 +199,8 @@ void EnTite_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&thisx->shape, -200.0f, ActorShadow_DrawCircle, 70.0f); this->flipState = TEKTITE_INITIAL; thisx->colChkInfo.damageTable = sDamageTable; - this->actionVar1 = 0; // value immediately overwritten in SetupIdle - this->unk_2C4.unk_10 = 0; + this->actionVar1 = 0; + this->bodyBreak.val = BODYBREAK_STATUS_FINISHED; thisx->focus.pos = thisx->world.pos; thisx->focus.pos.y += 20.0f; thisx->colChkInfo.health = 2; @@ -769,14 +769,14 @@ void EnTite_DeathCry(EnTite* this, GlobalContext* globalCtx) { DEADSOUND_REPEAT_MODE_OFF, 40); this->action = TEKTITE_FALL_APART; EnTite_SetupAction(this, EnTite_FallApart); - func_80032E24(&this->unk_2C4, 0x18, globalCtx); + BodyBreak_Alloc(&this->bodyBreak, 24, globalCtx); } /** * Spawn EnPart and drop items */ void EnTite_FallApart(EnTite* this, GlobalContext* globalCtx) { - if (func_8003305C(&this->actor, &this->unk_2C4, globalCtx, (this->actor.params + 0xB))) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, this->actor.params + 0xB)) { if (this->actor.params == TEKTITE_BLUE) { Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0); } else { @@ -971,26 +971,25 @@ void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } -/** - * Get the locations where the tektite feet are rendered - */ void EnTite_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** limbDList, Vec3s* rot, void* thisx) { EnTite* this = THIS; + switch (limbIndex) { case 8: Matrix_MultVec3f(&sFootOffset, &this->backRightFootPos); break; - case 0xD: + case 13: Matrix_MultVec3f(&sFootOffset, &this->frontRightFootPos); break; - case 0x12: + case 18: Matrix_MultVec3f(&sFootOffset, &this->backLeftFootPos); break; - case 0x17: + case 23: Matrix_MultVec3f(&sFootOffset, &this->frontLeftFootPos); break; } - func_80032F54(&this->unk_2C4, limbIndex, 0, 0x18, 0x18, limbDList, -1); + + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 24, 24, limbDList, BODYBREAK_OBJECT_DEFAULT); } void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index 40f290677..6eea6a69a 100755 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -21,7 +21,7 @@ typedef struct EnTite { /* 0x02BC */ u8 action; /* 0x02BD */ u8 flipState; /* 0x02C0 */ EnTiteActionFunc actionFunc; - /* 0x02C4 */ struct_80032E24 unk_2C4; // Data for EnPart which is spawned at death + /* 0x02C4 */ BodyBreak bodyBreak; /* 0x02DC */ s32 unk_2DC; // flags related to bgCheck drawn effects /* 0x02E0 */ s16 actionVar1; // Usage depends on current action function /* 0x02E2 */ u8 actionVar2; // Usage depends on current action function |
