1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-02 22:14:33 +00:00
* init done

* Everything done except for draw

* matching

* Tidied for pr

* merge master into en_ba

* run format.sh

* fixing merge mistakes

* how many different ways can I screw up a merge challenge

* some pr comments
This commit is contained in:
AdamKiddle 2021-02-15 22:59:59 +00:00 committed by GitHub
parent 2c56a6e99a
commit 56e94e1e34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 516 additions and 2145 deletions

View file

@ -15,10 +15,18 @@ void EnBa_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnBa_Update(Actor* thisx, GlobalContext* globalCtx);
void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000890;
extern UNK_TYPE D_06001D80;
void EnBa_SetupIdle(EnBa* this);
void EnBa_SetupFallAsBlob(EnBa* this);
void EnBa_Idle(EnBa* this, GlobalContext* globalCtx);
void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx);
void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx);
void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx);
void EnBa_Die(EnBa* this, GlobalContext* globalCtx);
void EnBa_SetupSwingAtPlayer(EnBa* this);
extern Gfx D_06000890[];
extern Gfx D_06001D80[];
/*
const ActorInit En_Ba_InitVars = {
ACTOR_EN_BA,
ACTORCAT_ENEMY,
@ -31,7 +39,9 @@ const ActorInit En_Ba_InitVars = {
(ActorFunc)EnBa_Draw,
};
static ColliderJntSphElementInit D_809B808C[2] = {
static Vec3f D_809B8080 = { 0.0f, 0.0f, 32.0f };
static ColliderJntSphElementInit sJntSphElementInit[2] = {
{
{
ELEMTYPE_UNK0,
@ -56,7 +66,7 @@ static ColliderJntSphElementInit D_809B808C[2] = {
},
};
static ColliderJntSphInit D_809B80D4 = {
static ColliderJntSphInit sJntSphInit = {
{
COLTYPE_HIT0,
AT_ON | AT_TYPE_ENEMY,
@ -66,35 +76,448 @@ static ColliderJntSphInit D_809B80D4 = {
COLSHAPE_JNTSPH,
},
2,
D_809B808C,
sJntSphElementInit,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B6350.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/EnBa_Init.s")
void EnBa_SetupAction(EnBa* this, EnBaActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/EnBa_Destroy.s")
static Vec3f D_809B80E4 = { 0.01f, 0.01f, 0.01f };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B6568.s")
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, 21, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 0, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B65A8.s")
void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) {
EnBa* this = THIS;
Vec3f sp38 = D_809B80E4;
s32 pad;
s16 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B69D4.s")
Actor_ProcessInitChain(&this->actor, sInitChain);
this->actor.world.pos.y = this->actor.home.pos.y + 100.0f;
for (i = 13; i >= 0; i--) {
this->unk200[i] = sp38;
this->unk2A8[i].x = -0x4000;
this->unk158[i] = this->actor.world.pos;
this->unk158[i].y = this->actor.world.pos.y - (i + 1) * 32.0f;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B6A44.s")
this->actor.targetMode = 4;
this->upperParams = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B6B04.s")
if (this->actor.params < EN_BA_DEAD_BLOB) {
if (Flags_GetSwitch(globalCtx, this->upperParams)) {
Actor_Kill(&this->actor);
return;
}
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f);
Actor_SetScale(&this->actor, 0.01f);
EnBa_SetupIdle(this);
this->actor.colChkInfo.health = 4;
this->actor.colChkInfo.mass = MASS_HEAVY;
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems);
} else {
Actor_SetScale(&this->actor, 0.021f);
EnBa_SetupFallAsBlob(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B6B58.s")
void EnBa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnBa* this = THIS;
Collider_DestroyJntSph(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B7174.s")
void EnBa_SetupIdle(EnBa* this) {
this->unk14C = 2;
this->unk31C = 1500;
this->actor.speedXZ = 10.0f;
EnBa_SetupAction(this, EnBa_Idle);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B71F0.s")
void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 i;
s32 pad;
Vec3s sp5C;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B75A0.s")
if ((this->actor.colChkInfo.mass == MASS_IMMOVABLE) && (this->actor.xzDistToPlayer > 175.0f)) {
Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 330.0f, 1.0f, 7.0f, 0.0f);
} else {
this->actor.flags |= 1;
Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 100.0f, 1.0f, 10.0f, 0.0f);
}
this->unk2FC = this->actor.world.pos;
if (globalCtx->gameplayFrames % 16 == 0) {
this->unk308.z += Rand_CenteredFloat(180.0f);
this->unk314 += Rand_CenteredFloat(180.0f);
this->unk308.x = Math_SinF(this->unk308.z) * 80.0f;
this->unk308.y = Math_CosF(this->unk314) * 80.0f;
}
this->unk2FC.y -= 448.0f;
this->unk2FC.x += this->unk308.x;
this->unk2FC.z += this->unk308.y;
func_80033AEC(&this->unk2FC, &this->unk158[13], 1.0f, this->actor.speedXZ, 0.0f, 0.0f);
for (i = 12; i >= 0; i--) {
func_80035844(&this->unk158[i + 1], &this->unk158[i], &sp5C, 0);
Matrix_Translate(this->unk158[i + 1].x, this->unk158[i + 1].y, this->unk158[i + 1].z, MTXMODE_NEW);
Matrix_RotateRPY(sp5C.x, sp5C.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[i]);
}
func_80035844(&this->unk158[0], &this->unk2FC, &sp5C, 0);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk2A8[0].y, 3, this->unk31C, 182);
Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk2A8[0].x, 3, this->unk31C, 182);
Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[0]);
this->unk2A8[13].y = sp5C.y;
this->unk2A8[13].x = sp5C.x + 0x8000;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/func_809B781C.s")
for (i = 0; i < 13; i++) {
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[i + 1].y, 3, this->unk31C, 182);
Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[i + 1].x, 3, this->unk31C, 182);
Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]);
}
this->unk2A8[13].x = this->unk2A8[12].x;
this->unk2A8[13].y = this->unk2A8[12].y;
if (!(player->stateFlags1 & 0x4000000) && (this->actor.xzDistToPlayer <= 175.0f) &&
(this->actor.world.pos.y == this->actor.home.pos.y + 100.0f)) {
EnBa_SetupSwingAtPlayer(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/EnBa_Update.s")
void EnBa_SetupFallAsBlob(EnBa* this) {
this->unk14C = 0;
this->actor.speedXZ = Rand_CenteredFloat(8.0f);
this->actor.world.rot.y = Rand_CenteredFloat(65535.0f);
this->unk318 = 20;
this->actor.gravity = -2.0f;
EnBa_SetupAction(this, EnBa_FallAsBlob);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ba/EnBa_Draw.s")
/**
* Action function of the pink fleshy blobs that spawn and fall to the floor when a tentacle dies
*/
void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 1) {
this->actor.scale.y -= 0.001f;
this->actor.scale.x += 0.0005f;
this->actor.scale.z += 0.0005f;
this->unk318--;
if (this->unk318 == 0) {
Actor_Kill(&this->actor);
}
} else {
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 28.0f, 80.0f, 5);
}
}
void EnBa_SetupSwingAtPlayer(EnBa* this) {
this->unk14C = 3;
this->unk318 = 20;
this->unk31A = 0;
this->unk31C = 1500;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->actor.speedXZ = 20.0f;
EnBa_SetupAction(this, EnBa_SwingAtPlayer);
}
void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s16 temp;
s16 i;
Vec3s sp58;
s16 phi_fp;
Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 60.0f, 1.0f, 10.0f, 0.0f);
if ((this->actor.xzDistToPlayer <= 175.0f) || (this->unk31A != 0)) {
if (this->unk318 == 20) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HAND_UP);
this->unk31C = 1500;
}
if (this->unk318 != 0) {
this->unk31A = 10;
this->unk318--;
if (this->unk318 >= 11) {
this->unk2FC = player->actor.world.pos;
this->unk2FC.y += 30.0f;
phi_fp = this->actor.yawTowardsPlayer;
} else {
phi_fp = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2FC);
}
Math_SmoothStepToS(&this->unk31C, 1500, 1, 30, 0);
func_80035844(&this->actor.world.pos, &this->unk158[0], &sp58, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, sp58.y, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->actor.shape.rot.x, (sp58.x + 0x8000), 1, this->unk31C, 0);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateRPY((this->actor.shape.rot.x - 0x8000), this->actor.shape.rot.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[0]);
for (i = 0; i < 13; i++) {
Math_SmoothStepToS(&this->unk2A8[i].x, (i * 1200) - 0x4000, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->unk2A8[i].y, phi_fp, 1, this->unk31C, 0);
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Matrix_RotateRPY((this->unk2A8[i].x - 0x8000), this->unk2A8[i].y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]);
}
} else {
if (this->unk31A == 10) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HAND_DOWN);
}
if (this->unk31A != 0) {
this->unk31C = 8000;
this->actor.speedXZ = 30.0f;
phi_fp = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2FC);
temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk158[0]) + 0x8000;
Math_SmoothStepToS(&this->actor.shape.rot.y, phi_fp, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk31C, 0);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
MTXMODE_NEW);
Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, this->unk158);
for (i = 0; i < 13; i++) {
temp = -Math_CosS(this->unk31A * 0xCCC) * (i * 1200);
Math_SmoothStepToS(&this->unk2A8[i].x, temp - 0x4000, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->unk2A8[i].y, phi_fp, 1, this->unk31C, 0);
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]);
}
this->unk31A--;
} else if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & 0x4000000)) {
EnBa_SetupIdle(this);
} else {
EnBa_SetupSwingAtPlayer(this);
this->unk318 = 27;
this->unk31C = 750;
}
}
this->unk2A8[13].x = this->unk2A8[12].x;
this->unk2A8[13].y = this->unk2A8[12].y;
if (this->collider.base.atFlags & 2) {
this->collider.base.atFlags &= ~2;
if (this->collider.base.at == &player->actor) {
func_8002F71C(globalCtx, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f);
}
}
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
return;
}
if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & 0x4000000)) {
EnBa_SetupIdle(this);
} else {
EnBa_SetupSwingAtPlayer(this);
this->unk318 = 27;
this->unk31C = 750;
}
}
void func_809B7174(EnBa* this) {
this->unk14C = 1;
this->unk31C = 1500;
this->unk318 = 20;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->actor.speedXZ = 10.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BALINADE_HAND_DAMAGE);
Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 12);
EnBa_SetupAction(this, EnBa_RecoilFromDamage);
}
void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) {
s32 i;
Vec3s sp6C;
Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 330.0f, 1.0f, 30.0f, 0.0f);
this->unk2FC = this->actor.world.pos;
if (globalCtx->gameplayFrames % 16 == 0) {
this->unk308.z += Rand_CenteredFloat(180.0f);
this->unk314 += Rand_CenteredFloat(180.0f);
this->unk308.x = Math_SinF(this->unk308.z) * 80.0f;
this->unk308.y = Math_CosF(this->unk314) * 80.0f;
}
this->unk2FC.y -= 448.0f;
this->unk2FC.x += this->unk308.x;
this->unk2FC.z += this->unk308.y;
func_80033AEC(&this->unk2FC, &this->unk158[13], 1.0f, this->actor.speedXZ, 0.0f, 0.0f);
for (i = 12; i >= 0; i--) {
func_80035844(&this->unk158[i + 1], &this->unk158[i], &sp6C, 0);
Matrix_Translate(this->unk158[i + 1].x, this->unk158[i + 1].y, this->unk158[i + 1].z, MTXMODE_NEW);
Matrix_RotateRPY(sp6C.x, sp6C.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[i]);
}
func_80035844(&this->actor.world.pos, &this->unk158[0], &sp6C, 0);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Math_SmoothStepToS(&this->actor.shape.rot.y, sp6C.y, 3, this->unk31C, 182);
Math_SmoothStepToS(&this->actor.shape.rot.x, sp6C.x + 0x8000, 3, this->unk31C, 182);
Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[0]);
for (i = 0; i < 13; i++) {
func_80035844(&this->unk158[i], &this->unk158[i + 1], &sp6C, 0);
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Math_SmoothStepToS(&this->unk2A8[i].y, sp6C.y, 3, this->unk31C, 182);
Math_SmoothStepToS(&this->unk2A8[i].x, sp6C.x + 0x8000, 3, this->unk31C, 182);
Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]);
}
this->unk2A8[13].x = this->unk2A8[12].x;
this->unk2A8[13].y = this->unk2A8[12].y;
this->unk318--;
if (this->unk318 == 0) {
EnBa_SetupIdle(this);
}
}
void func_809B75A0(EnBa* this, GlobalContext* globalCtx2) {
s16 unk_temp;
s32 i;
Vec3f sp74 = { 0.0f, 0.0f, 0.0f };
GlobalContext* globalCtx = globalCtx2;
this->unk31C = 2500;
EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_BALINADE_HAND_DEAD, 1, 1, 40);
this->unk14C = 0;
for (i = 7; i < 14; i++) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BA, this->unk158[i].x, this->unk158[i].y,
this->unk158[i].z, 0, 0, 0, EN_BA_DEAD_BLOB);
}
unk_temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk158[0]) + 0x8000;
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->actor.shape.rot.x, unk_temp, 1, this->unk31C, 0);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[0]);
this->actor.flags &= ~1;
for (i = 5; i < 13; i++) {
Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[5].x, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[5].y, 1, this->unk31C, 0);
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&sp74, &this->unk158[i + 1]);
}
this->unk31A = 15;
EnBa_SetupAction(this, EnBa_Die);
}
void EnBa_Die(EnBa* this, GlobalContext* globalCtx) {
Vec3f sp6C = { 0.0f, 0.0f, 0.0f };
s16 temp;
s32 i;
if (this->unk31A != 0) {
this->actor.speedXZ = 30.0f;
this->unk31C = 8000;
this->actor.world.pos.y += 8.0f;
temp = Math_Vec3f_Pitch(&this->actor.world.pos, &this->unk158[0]) + 0x8000;
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk31C, 0);
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[0]);
for (i = 0; i < 5; i++) {
temp = -Math_CosS(this->unk31A * 0x444) * (i * 400);
Math_SmoothStepToS(&this->unk2A8[i].x, temp - 0x4000, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->unk2A8[i].y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0);
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]);
}
for (i = 5; i < 13; i++) {
Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[5].x, 1, this->unk31C, 0);
Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[5].y, 1, this->unk31C, 0);
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY);
Matrix_MultVec3f(&sp6C, &this->unk158[i + 1]);
}
this->unk31A--;
} else {
Flags_SetSwitch(globalCtx, this->upperParams);
Actor_Kill(&this->actor);
}
}
void EnBa_Update(Actor* thisx, GlobalContext* globalCtx) {
EnBa* this = THIS;
if ((this->actor.params < EN_BA_DEAD_BLOB) && (this->collider.base.acFlags & 2)) {
this->collider.base.acFlags &= ~2;
this->actor.colChkInfo.health--;
if (this->actor.colChkInfo.health == 0) {
func_809B75A0(this, globalCtx);
} else {
func_809B7174(this);
}
}
this->actionFunc(this, globalCtx);
if (this->actor.params < EN_BA_DEAD_BLOB) {
this->actor.focus.pos = this->unk158[6];
}
if (this->unk14C >= 2) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
static Gfx* D_809B8118[] = { 0x060024F0, 0x060027F0, 0x060029F0 };
void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnBa* this = THIS;
s32 pad;
s16 i;
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, sizeof(Mtx) * 14);
Vec3f unused = { 0.0f, 0.0f, 448.0f };
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ba.c", 933);
func_80093D18(globalCtx->state.gfxCtx);
if (this->actor.params < EN_BA_DEAD_BLOB) {
Matrix_Push();
gSPSegment(POLY_OPA_DISP++, 0x0C, mtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809B8118[this->actor.params]));
gSPSegment(POLY_OPA_DISP++, 0x09,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0,
(globalCtx->gameplayFrames * -10) % 128, 32, 32));
for (i = 0; i < 14; i++, mtx++) {
Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW);
Matrix_RotateRPY(this->unk2A8[i].x, this->unk2A8[i].y, this->unk2A8[i].z, MTXMODE_APPLY);
Matrix_Scale(this->unk200[i].x, this->unk200[i].y, this->unk200[i].z, MTXMODE_APPLY);
if ((i == 6) || (i == 13)) {
switch (i) {
case 13:
Collider_UpdateSpheres(i, &this->collider);
break;
default:
Matrix_Scale(0.5f, 0.5f, 1.0f, MTXMODE_APPLY);
Collider_UpdateSpheres(8, &this->collider);
break;
}
}
Matrix_ToMtx(mtx, "../z_en_ba.c", 970);
}
Matrix_Pull();
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ba.c", 973),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06000890);
} else {
gSPSegment(POLY_OPA_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->gameplayFrames * 2) % 128,
(globalCtx->gameplayFrames * 2) % 128, 32, 32, 1,
(globalCtx->gameplayFrames * -5) % 128, (globalCtx->gameplayFrames * -5) % 128, 32,
32));
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 125, 100, 255);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ba.c", 991),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, D_06001D80);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ba.c", 995);
}

View file

@ -6,9 +6,32 @@
struct EnBa;
typedef void (*EnBaActionFunc)(struct EnBa*, GlobalContext*);
typedef enum {
/* 0x00 */ EN_BA_TENTACLE_RED,
/* 0x01 */ EN_BA_TENTACLE_GREEN,
/* 0x02 */ EN_BA_TENTACLE_GRAY,
/* 0x03 */ EN_BA_DEAD_BLOB
} EnBaType;
typedef struct EnBa {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x274];
/* 0x014C */ s32 unk14C;
/* 0x0150 */ EnBaActionFunc actionFunc;
/* 0x0154 */ s16 upperParams;
/* 0x0156 */ s16 unk156;
/* 0x0158 */ Vec3f unk158[14];
/* 0x0200 */ Vec3f unk200[14];
/* 0x02A8 */ Vec3s unk2A8[14];
/* 0x02FC */ Vec3f unk2FC;
/* 0x0308 */ Vec3f unk308;
/* 0x0314 */ f32 unk314;
/* 0x0318 */ s16 unk318;
/* 0x031A */ s16 unk31A;
/* 0x031C */ s16 unk31C;
/* 0x0320 */ ColliderJntSph collider;
/* 0x0340 */ ColliderJntSphElement colliderItems[2];
} EnBa; // size = 0x03C0
extern const ActorInit En_Ba_InitVars;