mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 14:20:11 +00:00
Document BodyBreak (en_part, body part spawner) (#797)
* done * status defines * whoops * comment wording * size calc change * elseif
This commit is contained in:
parent
1ac9479cae
commit
3fbdccbdba
22 changed files with 128 additions and 116 deletions
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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[] = {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue