mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 06:10:21 +00:00
ovl_bg_ice_turara OK (#467)
* ovl_Bg_Ice_Turara.c OK * =Updated z_bg_ice_turara.c to address comments * Params and all functions named * remove unnecessary linebreak * Update src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Changed enum names Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
parent
385c419aa2
commit
9a9025f01c
16 changed files with 173 additions and 575 deletions
|
@ -15,7 +15,21 @@ void BgIceTurara_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void BgIceTurara_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgIceTurara_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void BgIceTurara_Stalagmite(BgIceTurara* this, GlobalContext* globalCtx);
|
||||
void BgIceTurara_Wait(BgIceTurara* this, GlobalContext* globalCtx);
|
||||
void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx);
|
||||
void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx);
|
||||
void BgIceTurara_Regrow(BgIceTurara* this, GlobalContext* globalCtx);
|
||||
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{ COLTYPE_UNK10, 0x11, 0x09, 0x00, 0x20, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x4FC007CA, 0x00, 0x00 }, 0x01, 0x01, 0x00 },
|
||||
{ 13, 120, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
extern Gfx D_060023D0[];
|
||||
extern ColHeader D_06002594;
|
||||
|
||||
const ActorInit Bg_Ice_Turara_InitVars = {
|
||||
ACTOR_BG_ICE_TURARA,
|
||||
ACTORTYPE_PROP,
|
||||
|
@ -27,23 +41,152 @@ const ActorInit Bg_Ice_Turara_InitVars = {
|
|||
(ActorFunc)BgIceTurara_Update,
|
||||
(ActorFunc)BgIceTurara_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/BgIceTurara_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/BgIceTurara_Destroy.s")
|
||||
InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneScale, 600, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(gravity, -3, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(minVelocityY, -30, ICHAIN_CONTINUE),
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/func_80892040.s")
|
||||
void BgIceTurara_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIceTurara* this = THIS;
|
||||
s32 pad;
|
||||
ColHeader* colHeader = NULL;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/func_80892220.s")
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, 0);
|
||||
DynaPolyInfo_Alloc(&D_06002594, &colHeader);
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
|
||||
Collider_CylinderUpdate(&this->dyna.actor, &this->collider);
|
||||
this->dyna.dynaPolyId =
|
||||
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
if (this->dyna.actor.params == TURARA_STALAGMITE) {
|
||||
this->actionFunc = BgIceTurara_Stalagmite;
|
||||
} else {
|
||||
this->dyna.actor.shape.rot.x = -0x8000;
|
||||
this->dyna.actor.shape.unk_08 = 1200.0f;
|
||||
this->actionFunc = BgIceTurara_Wait;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/func_80892280.s")
|
||||
void BgIceTurara_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIceTurara* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/func_808922B8.s")
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/func_80892424.s")
|
||||
void BgIceTurara_Break(BgIceTurara* this, GlobalContext* globalCtx, f32 arg2) {
|
||||
static Vec3f accel = { 0.0f, -1.0f, 0.0f };
|
||||
static Color_RGBA8 primColor = { 170, 255, 255, 255 };
|
||||
static Color_RGBA8 envColor = { 0, 50, 100, 255 };
|
||||
Vec3f vel;
|
||||
Vec3f pos;
|
||||
s32 j;
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/func_80892574.s")
|
||||
Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.posRot.pos, 30, NA_SE_EV_ICE_BROKEN);
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 10; j++) {
|
||||
pos.x = this->dyna.actor.posRot.pos.x + Math_Rand_CenteredFloat(8.0f);
|
||||
pos.y = this->dyna.actor.posRot.pos.y + (Math_Rand_ZeroOne() * arg2) + (i * arg2);
|
||||
pos.z = this->dyna.actor.posRot.pos.z + Math_Rand_CenteredFloat(8.0f);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/BgIceTurara_Update.s")
|
||||
vel.x = Math_Rand_CenteredFloat(7.0f);
|
||||
vel.z = Math_Rand_CenteredFloat(7.0f);
|
||||
vel.y = (Math_Rand_ZeroOne() * 4.0f) + 8.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Turara/BgIceTurara_Draw.s")
|
||||
EffectSsEnIce_Spawn(globalCtx, &pos, (Math_Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor,
|
||||
&envColor, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BgIceTurara_Stalagmite(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
if (this->collider.base.acFlags & 2) {
|
||||
BgIceTurara_Break(this, globalCtx, 50.0f);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
void BgIceTurara_Wait(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
if (this->dyna.actor.xzDistFromLink < 60.0f) {
|
||||
this->shiverTimer = 10;
|
||||
this->actionFunc = BgIceTurara_Shiver;
|
||||
}
|
||||
}
|
||||
|
||||
void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
s16 phi_v0_3;
|
||||
s16 phi_v0_2;
|
||||
f32 sp28;
|
||||
|
||||
if (this->shiverTimer != 0) {
|
||||
this->shiverTimer--;
|
||||
}
|
||||
if (!(this->shiverTimer % 4)) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_ICE_SWING);
|
||||
}
|
||||
if (this->shiverTimer == 0) {
|
||||
this->dyna.actor.posRot.pos.x = this->dyna.actor.initPosRot.pos.x;
|
||||
this->dyna.actor.posRot.pos.z = this->dyna.actor.initPosRot.pos.z;
|
||||
Collider_CylinderUpdate(&this->dyna.actor, &this->collider);
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
this->actionFunc = BgIceTurara_Fall;
|
||||
} else {
|
||||
sp28 = Math_Rand_ZeroOne();
|
||||
phi_v0_2 = (Math_Rand_ZeroOne() < 0.5f ? -1 : 1);
|
||||
this->dyna.actor.posRot.pos.x = (phi_v0_2 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.initPosRot.pos.x;
|
||||
sp28 = Math_Rand_ZeroOne();
|
||||
phi_v0_3 = (Math_Rand_ZeroOne() < 0.5f ? -1 : 1);
|
||||
this->dyna.actor.posRot.pos.z = (phi_v0_3 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.initPosRot.pos.z;
|
||||
}
|
||||
}
|
||||
|
||||
void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
if ((this->collider.base.atFlags & 2) || (this->dyna.actor.bgCheckFlags & 1)) {
|
||||
this->collider.base.atFlags &= ~2;
|
||||
this->dyna.actor.bgCheckFlags &= ~1;
|
||||
if (this->dyna.actor.posRot.pos.y < this->dyna.actor.groundY) {
|
||||
this->dyna.actor.posRot.pos.y = this->dyna.actor.groundY;
|
||||
}
|
||||
BgIceTurara_Break(this, globalCtx, 40.0f);
|
||||
if (this->dyna.actor.params == TURARA_STALACTITE_REGROW) {
|
||||
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y + 120.0f;
|
||||
func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
this->actionFunc = BgIceTurara_Regrow;
|
||||
} else {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Actor_MoveForward(&this->dyna.actor);
|
||||
this->dyna.actor.posRot.pos.y += 40.0f;
|
||||
func_8002E4B4(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
this->dyna.actor.posRot.pos.y -= 40.0f;
|
||||
Collider_CylinderUpdate(&this->dyna.actor, &this->collider);
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
||||
void BgIceTurara_Regrow(BgIceTurara* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 1.0f)) {
|
||||
this->actionFunc = BgIceTurara_Wait;
|
||||
this->dyna.actor.velocity.y = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void BgIceTurara_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIceTurara* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void BgIceTurara_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Gfx_DrawDListOpa(globalCtx, D_060023D0);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,19 @@
|
|||
|
||||
struct BgIceTurara;
|
||||
|
||||
typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, GlobalContext*);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TURARA_STALAGMITE,
|
||||
/* 1 */ TURARA_STALACTITE,
|
||||
/* 2 */ TURARA_STALACTITE_REGROW
|
||||
} BgIceTuraraType;
|
||||
|
||||
typedef struct BgIceTurara {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x6C];
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgIceTuraraActionFunc actionFunc;
|
||||
/* 0x0168 */ s16 shiverTimer;
|
||||
/* 0x016C */ ColliderCylinder collider;
|
||||
} BgIceTurara; // size = 0x01B8
|
||||
|
||||
extern const ActorInit Bg_Ice_Turara_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue