diff options
| author | Maide <34639600+Kelebek1@users.noreply.github.com> | 2021-08-08 20:28:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-08 15:28:45 -0400 |
| commit | f5cbbc3268d96af455e2ccfe46bbcc145452eb8d (patch) | |
| tree | 3817f433624cac69e2d9bc1281091a1d41fef108 /src | |
| parent | a35f091505b1d744d3e397b46839f5b408795cd9 (diff) | |
Daiku2 (#228)
* Daiku2
* PR
* Macros
* NBS
* PR
* Format
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/z_actor.c | 19 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Bom/z_en_bom.h | 12 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c | 557 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h | 47 |
4 files changed, 592 insertions, 43 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 778f8ad18..fd6580f51 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -845,7 +845,24 @@ void Actor_FreeOverlay(ActorOverlay* entry) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800BE03C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800BE0B8.s") +Actor* func_800BE0B8(GlobalContext* globalCtx, Actor* inActor, s16 arg2, u8 arg3, f32 arg4) { + Actor* actor = globalCtx->actorCtx.actorList[arg3].first; + + while (actor != NULL) { + if (actor == inActor || ((arg2 != -1) && (arg2 != actor->id))) { + actor = actor->next; + continue; + } + + if (Actor_DistanceBetweenActors(inActor, actor) <= arg4) { + return actor; + } + + actor = actor->next; + } + + return NULL; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800BE184.s") 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 32b43f32c..65dd183a7 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -8,11 +8,13 @@ struct EnBom; typedef void (*EnBomActionFunc)(struct EnBom* this, GlobalContext* globalCtx); typedef struct EnBom { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0xAC]; - /* 0x01F0 */ s16 timer; - /* 0x01F2 */ char unk_1F2[0xE]; - /* 0x0200 */ EnBomActionFunc actionFunc; + /* 0x000 */ Actor actor; + /* 0x144 */ char unk_144[0xAC]; + /* 0x1F0 */ s16 timer; + /* 0x1F2 */ char unk_1F2[0x7]; + /* 0x1F9 */ u8 unk_1F9; + /* 0x1FA */ char unk_1FA[0x6]; + /* 0x200 */ EnBomActionFunc actionFunc; } EnBom; // size = 0x204 extern const ActorInit En_Bom_InitVars; diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index 3ae06ef82..9e34154a2 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -1,4 +1,11 @@ +/* + * File: z_en_daiku2.c + * Overlay: ovl_En_Daiku2 + * Description: Milk Road Carpenter + */ + #include "z_en_daiku2.h" +#include "overlays/actors/ovl_En_Bom/z_en_bom.h" #define FLAGS 0x00000009 @@ -9,13 +16,36 @@ void EnDaiku2_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnDaiku2_Update(Actor* thisx, GlobalContext* globalCtx); void EnDaiku2_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx); void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE6B40(EnDaiku2* this, GlobalContext* globalCtx); void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE6CFC(EnDaiku2* this); void func_80BE6D40(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE6EB0(EnDaiku2* this); void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE7600(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE71A0(EnDaiku2* this); void func_80BE71D8(EnDaiku2* this, GlobalContext* globalCtx); +void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5); +void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx); + +extern AnimationHeader D_06002134; +extern AnimationHeader D_06002FA0; +extern AnimationHeader D_0600ACD0; +extern AnimationHeader D_0600C92C; +extern AnimationHeader D_06000C44; +extern AnimationHeader D_0600C234; +extern AnimationHeader D_06000600; +extern AnimationHeader D_06001114; +extern AnimationHeader D_0600B690; +extern AnimationHeader D_06001A24; +extern AnimationHeader D_0600D328; +extern FlexSkeletonHeader D_0600A850; +extern Gfx D_06009638[]; +extern Gfx D_0600A390[]; +extern Gfx D_060009E0[]; -#if 0 const ActorInit En_Daiku2_InitVars = { ACTOR_EN_DAIKU2, ACTORCAT_NPC, @@ -28,60 +58,523 @@ const ActorInit En_Daiku2_InitVars = { (ActorFunc)EnDaiku2_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BE7900 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static u16 sTextIds[] = { + 0x32CB, 0x32CC, 0x32CD, 0x32CE, 0x32CF, 0x32D0, 0x32D1, 0x32D2, +}; + +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 20, 60, 0, { 0, 0, 0 } }, }; -#endif +void func_80BE61D0(EnDaiku2* this) { + if ((this->unk_27A != -1) && (this->unk_258 != 0)) { + if (func_8013D68C(this->unk_258, this->unk_25C, &this->unk_268) == 0) { + Actor_MarkForDeath(&this->actor); + } + } +} + +void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx) { + EnDaiku2* this = THIS; + s32 day = gSaveContext.day; + + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 40.0f); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->jointTable, this->morphTable, 17); + this->actor.targetMode = 0; + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + this->unk_278 = ENDAIKU2_GET_7F(&this->actor); + this->unk_27A = ENDAIKU2_GET_1F80(&this->actor); + this->unk_258 = func_8013D648(globalCtx, this->unk_27A, 0x3F); + this->unk_280 = ENDAIKU2_GET_8000(&this->actor); + Actor_SetScale(&this->actor, 0.01f); + if (!this->unk_280) { + if (day == 3) { + Actor_MarkForDeath(&this->actor); + return; + } + + if (this->unk_278 == ENDAIKU2_GET_7F_127) { + this->unk_278 = ENDAIKU2_GET_7F_MINUS1; + } else if (Flags_GetSwitch(globalCtx, this->unk_278)) { + this->unk_25C = this->unk_258->count - 1; + func_80BE61D0(this); + Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_268); + } + } else if (day != 3) { + Actor_MarkForDeath(&this->actor); + return; + } + + this->actor.gravity = -3.0f; + Math_Vec3f_Copy(&this->unk_268, &this->actor.world.pos); + func_80BE65B4(this, globalCtx); +} + +void EnDaiku2_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnDaiku2* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void func_80BE6408(EnDaiku2* this, s32 arg1) { + static AnimationHeader* sAnimations[] = { + &D_06002FA0, &D_0600ACD0, &D_0600C92C, &D_06000C44, &D_0600C234, &D_06000600, + &D_06001114, &D_0600B690, &D_06001A24, &D_06002134, &D_0600D328, + }; + static u8 D_80BE7958[] = { + 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, + }; + f32 sp34 = 1.0f; + + this->unk_276 = arg1; + this->unk_284 = SkelAnime_GetFrameCount(&sAnimations[this->unk_276]->common); + if (this->unk_276 == 3) { + sp34 = 2.0f; + } + SkelAnime_ChangeAnim(&this->skelAnime, sAnimations[this->unk_276], sp34, 0.0f, this->unk_284, + D_80BE7958[this->unk_276], -4.0f); +} + +s32 func_80BE64C0(EnDaiku2* this, GlobalContext* globalCtx) { + EnBom* bomb; + Vec3f sp30; + + Math_Vec3f_Copy(&sp30, &this->actor.world.pos); + Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); + bomb = (EnBom*)func_800BE0B8(globalCtx, &this->actor, -1, ACTORCAT_EXPLOSIVES, BREG(7) + 240.0f); + Math_Vec3f_Copy(&this->actor.world.pos, &sp30); + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && !Flags_GetSwitch(globalCtx, this->unk_278) && (bomb != NULL) && + (bomb->actor.id == ACTOR_EN_BOM)) { + if (bomb->unk_1F9 == 0) { + this->actor.textId = 0x32D3; + } else { + this->actor.textId = 0x32D4; + } + + return true; + } + + return false; +} + +void func_80BE65B4(EnDaiku2* this, GlobalContext* globalCtx) { + switch (gSaveContext.day - 1) { + case 0: + this->unk_28A = 0; + if (gSaveContext.weekEventReg[64] & 2) { + this->unk_28A = 6; + } + func_80BE6408(this, 8); + break; + + case 1: + this->unk_28A = 2; + if (gSaveContext.weekEventReg[64] & 4) { + this->unk_28A = 7; + } + func_80BE6408(this, 8); + break; + + case 2: + this->unk_28A = 4; + this->unk_264 = 1.0f; + func_80BE6408(this, 10); + break; + } + + this->unk_264 = 1.0f; + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(globalCtx, this->unk_278)) { + this->unk_28A = 5; + if (this->unk_276 != 10) { + func_80BE6408(this, 10); + } + } + + this->unk_288 = 0; + this->actionFunc = func_80BE66E4; +} + +void func_80BE66E4(EnDaiku2* this, GlobalContext* globalCtx) { + f32 sp9C = this->skelAnime.animCurrentFrame; + s32 sp98 = gSaveContext.day - 1; + s32 i; + Vec3f sp88; + Vec3f sp7C; + Vec3f sp70; + s32 pad[2]; + s16 temp_v0; + + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.home.rot.y, 1, 0xBB8, 0x0); + if (sp98 != 2) { + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(globalCtx, this->unk_278)) { + this->unk_28A = 5; + if (this->unk_276 != 10) { + func_80BE6408(this, 10); + } + } + } + + this->actor.textId = sTextIds[this->unk_28A]; + + if (func_800B84D0(&this->actor, globalCtx)) { + func_80BE6B40(this, globalCtx); + return; + } + + if ((this->unk_28A != 5) && (sp98 != 2) && func_80BE64C0(this, globalCtx)) { + func_80BE6CFC(this); + return; + } + + func_800B8614(&this->actor, globalCtx, 80.0f); + if ((this->unk_276 == 8) && func_801378B8(&this->skelAnime, 6.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_ROCK_BROKEN); + + for (i = 0; i < 10; i++) { + Math_Vec3f_Copy(&sp70, &this->actor.world.pos); + + sp70.x += Math_SinS(this->actor.world.rot.y) * 70.0f; + sp70.y += 40.0f; + sp70.z += Math_CosS(this->actor.world.rot.y) * 70.0f; + + sp70.x += randPlusMinusPoint5Scaled(5.0f); + sp70.y += randPlusMinusPoint5Scaled(5.0f); + sp70.z += randPlusMinusPoint5Scaled(5.0f); + + sp88.y = -1.0f; + + sp7C.x = (Rand_ZeroOne() - 0.5f) * 4.0f; + sp7C.y = (Rand_ZeroOne() * 10.0f) + 4.0f; + sp7C.z = (Rand_ZeroOne() - 0.5f) * 4.0f; + + func_80BE7504(this, &sp70, &sp7C, &sp88, 0.01f - (Rand_ZeroFloat(1.0f) * 0.005f), 40); + } + } + + temp_v0 = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.home.rot.y)); + if (temp_v0 > 0x2890) { + if (sp98 != 2) { + if ((this->unk_276 == 5) || (this->unk_276 == 9)) { + func_80BE6408(this, 10); + } else if ((this->unk_276 == 10) && (this->unk_284 <= sp9C)) { + this->unk_284 = SkelAnime_GetFrameCount(&D_06002134.common); + SkelAnime_ChangeAnim(&this->skelAnime, &D_06002134, -1.0f, this->unk_284, 0.0f, 2, -4.0f); + this->unk_276 = 11; + } else if ((this->unk_276 == 11) && (sp9C <= 0.0f)) { + func_80BE6408(this, 8); + } + } + } else if (sp98 != 2) { + if ((this->unk_276 != 9) && (this->unk_276 != 10)) { + func_80BE6408(this, 9); + } else if ((this->unk_276 == 9) && (this->unk_284 <= sp9C)) { + func_80BE6408(this, 10); + } + } +} + +void func_80BE6B40(EnDaiku2* this, GlobalContext* globalCtx) { + s32 day = gSaveContext.day; + + this->unk_288 = 1; + if ((day != 3) && Flags_GetSwitch(globalCtx, this->unk_278)) { + this->actionFunc = func_80BE6BC0; + } else { + func_80BE6408(this, 5); + this->actionFunc = func_80BE6BC0; + } +} + +void func_80BE6BC0(EnDaiku2* this, GlobalContext* globalCtx) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0x0); + if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + s32 day = gSaveContext.day - 1; + + func_801477B4(globalCtx); + + if (this->unk_288 == 2) { + this->actionFunc = func_80BE6D40; + } else if (this->unk_288 == 3) { + this->actionFunc = func_80BE6EF0; + } else if ((this->unk_28A == 0) || (this->unk_28A == 2)) { + this->unk_28A++; + func_80151938(globalCtx, sTextIds[this->unk_28A]); + } else { + switch (day) { + case 0: + gSaveContext.weekEventReg[64] |= 2; + break; + + case 1: + gSaveContext.weekEventReg[64] |= 4; + break; + } + func_80BE65B4(this, globalCtx); + } + } +} + +void func_80BE6CFC(EnDaiku2* this) { + func_80BE6408(this, 3); + this->unk_288 = 2; + this->actionFunc = func_80BE6D40; + this->unk_264 = 0.0f; +} + +void func_80BE6D40(EnDaiku2* this, GlobalContext* globalCtx) { + s32 pad[3]; + s16 sp3A = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_268); + + if (func_800B84D0(&this->actor, globalCtx)) { + this->actionFunc = func_80BE6BC0; + return; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, sp3A, 1, 0x7D0, 0xA); + Math_ApproachF(&this->actor.world.pos.x, this->unk_268.x, 0.5f, fabsf(Math_SinS(this->actor.world.rot.y) * 6.0f)); + Math_ApproachF(&this->actor.world.pos.z, this->unk_268.z, 0.5f, fabsf(Math_CosS(this->actor.world.rot.y) * 6.0f)); + + if ((sqrtf(SQ(this->actor.world.pos.x - this->unk_268.x) + SQ(this->actor.world.pos.z - this->unk_268.z)) < 4.0f) && + (this->unk_258 != 0)) { + this->unk_25C++; + if (this->unk_25C >= this->unk_258->count) { + func_80BE6EB0(this); + return; + } + func_80BE61D0(this); + } + func_800B8614(&this->actor, globalCtx, 80.0f); +} + +void func_80BE6EB0(EnDaiku2* this) { + func_80BE6408(this, 2); + this->unk_274 = 0; + this->unk_288 = 3; + this->actionFunc = func_80BE6EF0; +} + +void func_80BE6EF0(EnDaiku2* this, GlobalContext* globalCtx) { + f32 sp5C = this->skelAnime.animCurrentFrame; + s32 pad[4]; + Vec3f sp40; + s16 var; + + if (func_800B84D0(&this->actor, globalCtx)) { + this->actionFunc = func_80BE6BC0; + return; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.home.rot.y, 1, 0xBB8, 0x0); + if (this->unk_284 <= sp5C) { + this->unk_274 = 1; + } + + if (this->unk_274 != 0) { + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_268), 1, 0x7D0, + 0xA); + Math_ApproachF(&this->actor.world.pos.x, this->unk_268.x, 0.5f, + fabsf(Math_SinS(this->actor.world.rot.y) * 4.0f)); + Math_ApproachF(&this->actor.world.pos.z, this->unk_268.z, 0.5f, + fabsf(Math_CosS(this->actor.world.rot.y) * 4.0f)); + if ((sqrtf(SQ(this->actor.world.pos.x - this->unk_268.x) + SQ(this->actor.world.pos.z - this->unk_268.z)) < + 4.0f) && + (this->unk_258 != 0)) { + if (!func_80BE64C0(this, globalCtx)) { + if (this->unk_276 != 3) { + func_80BE6408(this, 3); + } + + if ((this->unk_278 >= ENDAIKU2_GET_7F_0) && Flags_GetSwitch(globalCtx, this->unk_278)) { + this->unk_28A = 5; + if (this->unk_276 != 10) { + func_80BE6408(this, 10); + } + func_80BE65B4(this, globalCtx); + return; + } + + this->unk_25C--; + if (this->unk_25C < 0) { + this->unk_25C = 0; + func_80BE71A0(this); + return; + } + func_80BE61D0(this); + } + } else if (func_80BE64C0(this, globalCtx)) { + Math_Vec3f_Copy(&sp40, &this->unk_268); + var = this->unk_25C; + this->unk_25C++; + if (this->unk_25C < this->unk_258->count) { + func_80BE61D0(this); + func_80BE6CFC(this); + return; + } + this->unk_25C = var; + Math_Vec3f_Copy(&this->unk_268, &sp40); + } + } + func_800B8614(&this->actor, globalCtx, 80.0f); +} + +void func_80BE71A0(EnDaiku2* this) { + func_80BE6408(this, 9); + this->actionFunc = func_80BE71D8; +} + +void func_80BE71D8(EnDaiku2* this, GlobalContext* globalCtx) { + f32 currentFrame = this->skelAnime.animCurrentFrame; + + if (func_80BE64C0(this, globalCtx)) { + func_80BE6CFC(this); + } else if ((this->unk_276 == 9) && (this->unk_284 <= currentFrame)) { + func_80BE6408(this, 0); + } else if ((this->unk_276 == 0) && (this->unk_284 <= currentFrame)) { + func_80BE6408(this, 5); + } else if ((this->unk_276 == 5) && (this->unk_284 <= currentFrame)) { + func_80BE65B4(this, globalCtx); + } +} + +void EnDaiku2_Update(Actor* thisx, GlobalContext* globalCtx) { + EnDaiku2* this = THIS; + s32 pad; -extern ColliderCylinderInit D_80BE7900; + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + this->actionFunc(this, globalCtx); + this->actor.shape.rot.y = this->actor.world.rot.y; + Actor_SetHeight(&this->actor, 65.0f); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Math_ApproachF(&this->unk_260, this->unk_264, 0.3f, 2.0f); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + func_80BE7600(this, globalCtx); +} -extern UNK_TYPE D_060009E0; -extern UNK_TYPE D_06002134; -extern UNK_TYPE D_06002FA0; -extern UNK_TYPE D_06009638; +void EnDaiku2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnDaiku2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE61D0.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/EnDaiku2_Init.s") + func_8012C28C(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/EnDaiku2_Destroy.s") + if (limbIndex == 14) { + Matrix_Scale(this->unk_260, this->unk_260, this->unk_260, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_06009638); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE6408.s") + if (limbIndex == 15) { + gSPDisplayList(POLY_OPA_DISP++, D_0600A390); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE64C0.s") + CLOSE_DISPS(globalCtx->state.gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE65B4.s") +void EnDaiku2_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnDaiku2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE66E4.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE6B40.s") + func_8012C28C(globalCtx->state.gfxCtx); + gDPSetEnvColor(POLY_OPA_DISP++, 245, 155, 0, 255); + SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, NULL, + EnDaiku2_PostLimbDraw, &this->actor); + func_80BE7718(this, globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE6BC0.s") + CLOSE_DISPS(globalCtx->state.gfxCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE6CFC.s") +void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5) { + s16 i; + EnDaiku2Particle* particle = &this->particles[0]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE6D40.s") + for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { + if (!particle->isEnabled) { + particle->isEnabled = true; + particle->unk_04 = *arg1; + particle->unk_10 = *arg2; + particle->unk_1C = *arg3; + particle->unk_30 = arg4; + particle->unk_34 = arg5; + particle->unk_28.x = randPlusMinusPoint5Scaled(30000.0f); + particle->unk_28.y = randPlusMinusPoint5Scaled(30000.0f); + particle->unk_28.z = randPlusMinusPoint5Scaled(30000.0f); + break; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE6EB0.s") +void func_80BE7600(EnDaiku2* this, GlobalContext* globalCtx) { + s32 i; + EnDaiku2Particle* particle = &this->particles[0]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE6EF0.s") + for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { + if (particle->isEnabled) { + particle->unk_04.x += particle->unk_10.x; + particle->unk_28.x += 0x100; + particle->unk_28.z += 0x130; + particle->unk_04.y += particle->unk_10.y; + particle->unk_04.z += particle->unk_10.z; + particle->unk_10.y += particle->unk_1C.y; + if (particle->unk_34 != 0) { + particle->unk_34 -= 1; + } else { + particle->isEnabled = false; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE71A0.s") +void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx) { + s32 i; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + EnDaiku2Particle* particle = &this->particles[0]; + s32 objectIdx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE71D8.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/EnDaiku2_Update.s") + func_8012C28C(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE738C.s") + objectIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_BOMBIWA); + if ((objectIdx >= 0) && Object_IsLoaded(&globalCtx->objectCtx, objectIdx)) { + gDPPipeSync(POLY_OPA_DISP++); + gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIdx].segment); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/EnDaiku2_Draw.s") + for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { + if (particle->isEnabled) { + SysMatrix_StatePush(); + SysMatrix_InsertTranslation(particle->unk_04.x, particle->unk_04.y, particle->unk_04.z, MTXMODE_NEW); + SysMatrix_InsertXRotation_s(particle->unk_28.x, MTXMODE_APPLY); + Matrix_RotateY(particle->unk_28.y, MTXMODE_APPLY); + SysMatrix_InsertZRotation_s(particle->unk_28.z, MTXMODE_APPLY); + Matrix_Scale(particle->unk_30, particle->unk_30, particle->unk_30, MTXMODE_APPLY); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE7504.s") + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, D_060009E0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE7600.s") + SysMatrix_StatePop(); + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Daiku2/func_80BE7718.s") + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index ce01de1b1..5baadf2f0 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -5,13 +5,50 @@ struct EnDaiku2; -typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2* this, GlobalContext* globalCtx); +typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, GlobalContext*); + +#define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F); +#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F); +#define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1); + +enum { + /* -1 */ ENDAIKU2_GET_7F_MINUS1 = -1, + /* 0 */ ENDAIKU2_GET_7F_0, + /* 127 */ ENDAIKU2_GET_7F_127 = 127, +}; + +typedef struct EnDaiku2Particle { + /* 0x00 */ u8 isEnabled; + /* 0x04 */ Vec3f unk_04; + /* 0x10 */ Vec3f unk_10; + /* 0x1C */ Vec3f unk_1C; + /* 0x28 */ Vec3s unk_28; + /* 0x30 */ f32 unk_30; + /* 0x34 */ s16 unk_34; +} EnDaiku2Particle; // size = 0x38 typedef struct EnDaiku2 { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x110]; - /* 0x0254 */ EnDaiku2ActionFunc actionFunc; - /* 0x0258 */ char unk_258[0xB70]; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[17]; + /* 0x1EE */ Vec3s morphTable[17]; + /* 0x254 */ EnDaiku2ActionFunc actionFunc; + /* 0x258 */ Path* unk_258; + /* 0x25C */ s16 unk_25C; + /* 0x260 */ f32 unk_260; + /* 0x264 */ f32 unk_264; + /* 0x268 */ Vec3f unk_268; + /* 0x274 */ s16 unk_274; + /* 0x276 */ s16 unk_276; + /* 0x278 */ s16 unk_278; + /* 0x27A */ s16 unk_27A; + /* 0x27C */ UNK_TYPE1 unk_27C[0x4]; + /* 0x280 */ s32 unk_280; + /* 0x284 */ f32 unk_284; + /* 0x288 */ s16 unk_288; + /* 0x28A */ s16 unk_28A; + /* 0x28C */ EnDaiku2Particle particles[50]; + /* 0xD7C */ ColliderCylinder collider; } EnDaiku2; // size = 0xDC8 extern const ActorInit En_Daiku2_InitVars; |
