diff options
| author | fullgrowngaming <42490167+fullgrowngaming@users.noreply.github.com> | 2020-08-18 10:52:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-18 13:52:44 -0400 |
| commit | 13891f1366da8b09f151c33a7d597541ccfbf46b (patch) | |
| tree | 857387b17f744b1571cf36d1616eaf411c37e236 /src | |
| parent | 3dc3722570b6b8c9bd3f05b2ac1de208f39ff86d (diff) | |
z_en_yukabyun decompiled (#318)
* Decomped Yukabyun (flying floor tiles)
* z_en_yukabyun
* Ran the formatting script, plus fixed negative number stuff in the Update function
* Changed unk_152 to unsigned to get rid of cast
* Made all the suggested changes.
* Update undefined_syms.txt
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c | 122 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h | 7 |
2 files changed, 118 insertions, 11 deletions
diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index f95fc8804..3e708b9c5 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -15,7 +15,10 @@ void EnYukabyun_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx); void EnYukabyun_Draw(Actor* thisx, GlobalContext* globalCtx); -/* +void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx); +void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx); +void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx); + const ActorInit En_Yukabyun_InitVars = { ACTOR_EN_YUKABYUN, ACTORTYPE_ENEMY, @@ -27,19 +30,118 @@ const ActorInit En_Yukabyun_InitVars = { (ActorFunc)EnYukabyun_Update, (ActorFunc)EnYukabyun_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/EnYukabyun_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/EnYukabyun_Destroy.s") +static ColliderCylinderInit sCylinderInit = { + { COLTYPE_UNK10, 0x11, 0x09, 0x3D, 0x10, COLSHAPE_CYLINDER }, + { 0x00, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x09, 0x01, 0x01 }, + { 28, 8, 0, { 0, 0, 0 } }, +}; + +static InitChainEntry sInitChain[] = { + ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE), + ICHAIN_F32(unk_4C, 16, ICHAIN_STOP), +}; + +UNK_PTR D_80B43F64[] = { 0x06000AF0, 0x06000000}; + +extern UNK_TYPE D_06000A60; +extern Gfx D_06000970[]; + +void EnYukabyun_Init(Actor* thisx, GlobalContext* globalCtx) { + EnYukabyun* this = THIS; + + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 0.4f); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + this->actor.params++; + this->unk_152 = 0; + this->unk_150 = (u8)(this->actor.params) * 0xA + 0x14; + this->actionfunc = func_80B43A94; +} + +void EnYukabyun_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnYukabyun* this = THIS; + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void func_80B43A94(EnYukabyun* this, GlobalContext* globalCtx) { + if (this->unk_150 != 0) { + this->unk_150--; + } + if (this->unk_150 == 0) { + this->actor.flags |= 0x1005; + this->actionfunc = func_80B43AD4; + } +} + +void func_80B43AD4(EnYukabyun* this, GlobalContext* globalCtx) { + this->unk_150 += 0xA0; + this->actor.shape.rot.y += this->unk_150; + if (this->unk_150 >= 0x2000) { + this->actor.posRot.rot.y = this->actor.yawTowardsLink; + this->actor.speedXZ = 10.0f; + this->actionfunc = func_80B43B6C; + } + Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 30.0f, 1.0f); + func_8002F974(&this->actor, NA_SE_EN_YUKABYUN_FLY - SFX_FLAG); +} + +void func_80B43B6C(EnYukabyun* this, GlobalContext* globalCtx) { + this->actor.shape.rot.y += this->unk_150; + if (this->actor.xzDistFromLink > 5000.0f) { + Actor_Kill(&this->actor); + return; + } + func_8002F974(&this->actor, NA_SE_EN_YUKABYUN_FLY - SFX_FLAG); +} + +void func_80B43BCC(EnYukabyun* this, GlobalContext* globalCtx) { + func_800297A4(globalCtx, &this->actor.posRot.pos, 8.0f, 0, 0x514, 0x12C, 0xF, 0x5F, 0xA, &D_06000A60); + Actor_Kill(&this->actor); +} + +void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx) { + EnYukabyun* this = THIS; + s32 pad; + + if (((this->collider.base.atFlags & 2) || (this->collider.base.acFlags & 2) || + ((this->collider.base.maskA & 2) && !(this->collider.base.oc->id == ACTOR_EN_YUKABYUN))) || + ((this->actionfunc == func_80B43B6C) && (this->actor.bgCheckFlags & 8))) { + this->collider.base.atFlags &= ~0x2; + this->collider.base.acFlags &= ~0x2; + this->collider.base.maskA &= ~0x2; + this->actor.flags &= ~0x5; + Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 30, NA_SE_EN_OCTAROCK_ROCK); + this->actionfunc = func_80B43BCC; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/func_80B43A94.s") + this->actionfunc(this, globalCtx); + Actor_MoveForward(&this->actor); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/func_80B43AD4.s") + if (!(this->actionfunc == func_80B43A94 || this->actionfunc == func_80B43BCC)) { + func_8002E4B4(globalCtx, &this->actor, 5.0f, 20.0f, 8.0f, 5); + Collider_CylinderUpdate(&this->actor, &this->collider); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/func_80B43B6C.s") + this->actor.flags |= 0x1000000; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/func_80B43BCC.s") + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + } + Actor_SetHeight(&this->actor, 4.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/EnYukabyun_Update.s") +void EnYukabyun_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnYukabyun* this = THIS; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + Gfx* dispRefs[4]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Yukabyun/EnYukabyun_Draw.s") + Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 366); + func_80093D18(globalCtx->state.gfxCtx); + gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B43F64[this->unk_152])); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 373), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfxCtx->polyOpa.p++, D_06000970); + Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 378); +} diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h index 010917423..f335e4d1b 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h @@ -6,9 +6,14 @@ struct EnYukabyun; +typedef void (*EnYukabyunActionFunc)(struct EnYukabyun*, GlobalContext*); + typedef struct EnYukabyun { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x54]; + /* 0x014C */ EnYukabyunActionFunc actionfunc; + /* 0x0150 */ s16 unk_150; + /* 0x0152 */ u8 unk_152; + /* 0x0154 */ ColliderCylinder collider; } EnYukabyun; // size = 0x01A0 extern const ActorInit En_Yukabyun_InitVars; |
