mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-23 12:59:44 +00:00
ovl_Bg_Lotus decompiled (#1374)
* ovl_Bg_Lotus decompiled * improvements * improvements * padding removed * block removed * improvements * bracket * if-else * line
This commit is contained in:
parent
19a605c2e7
commit
cfe656be2f
3
spec
3
spec
@ -3294,8 +3294,7 @@ beginseg
|
||||
name "ovl_Bg_Lotus"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.o"
|
||||
include "build/data/ovl_Bg_Lotus/ovl_Bg_Lotus.data.o"
|
||||
include "build/data/ovl_Bg_Lotus/ovl_Bg_Lotus.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Bg_Lotus/ovl_Bg_Lotus_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -10,8 +10,11 @@ void BgLotus_Destroy(Actor* thisx, PlayState* play);
|
||||
void BgLotus_Update(Actor* thisx, PlayState* play);
|
||||
void BgLotus_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
/*
|
||||
const ActorInit Bg_Lotus_InitVars = {
|
||||
void func_80AD68DC(BgLotus* this, PlayState* play);
|
||||
void func_80AD6A88(BgLotus* this, PlayState* play);
|
||||
void func_80AD6B68(BgLotus* this, PlayState* play);
|
||||
|
||||
ActorInit Bg_Lotus_InitVars = {
|
||||
ACTOR_BG_LOTUS,
|
||||
ACTORCAT_BG,
|
||||
FLAGS,
|
||||
@ -20,22 +23,140 @@ const ActorInit Bg_Lotus_InitVars = {
|
||||
(ActorFunc)BgLotus_Init,
|
||||
(ActorFunc)BgLotus_Destroy,
|
||||
(ActorFunc)BgLotus_Update,
|
||||
(ActorFunc)BgLotus_Draw
|
||||
(ActorFunc)BgLotus_Draw,
|
||||
};
|
||||
*/
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Init.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Destroy.s")
|
||||
void BgLotus_Init(Actor* thisx, PlayState* play) {
|
||||
BgLotus* this = THIS;
|
||||
s32 pad;
|
||||
s32 sp2C;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6830.s")
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gLilyPadCol);
|
||||
this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &this->dyna.actor.floorPoly, &sp2C,
|
||||
&this->dyna.actor, &this->dyna.actor.world.pos);
|
||||
this->unk168 = 0x60;
|
||||
this->dyna.actor.world.rot.y = (s32)Rand_Next() >> 0x10;
|
||||
this->actionFunc = func_80AD68DC;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD68DC.s")
|
||||
void BgLotus_Destroy(Actor* thisx, PlayState* play) {
|
||||
BgLotus* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6A88.s")
|
||||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/func_80AD6B68.s")
|
||||
void func_80AD6830(BgLotus* this) {
|
||||
f32 temp_fv1;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Update.s")
|
||||
if (this->dyna.actor.params == 0) {
|
||||
temp_fv1 = Math_SinF(this->unk166 * (M_PI / 4)) * ((0.014f * (this->unk166 / (80.0f * 0.1f))) + 0.01f);
|
||||
this->dyna.actor.scale.x = (1.0f + temp_fv1) * 0.1f;
|
||||
this->dyna.actor.scale.z = (1.0f - temp_fv1) * 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Lotus/BgLotus_Draw.s")
|
||||
void func_80AD68DC(BgLotus* this, PlayState* play) {
|
||||
f32 sp34;
|
||||
|
||||
this->unk168--;
|
||||
sp34 = Math_SinF(this->unk168 * (M_PI / 48)) * 6.0f;
|
||||
|
||||
if (this->dyna.actor.params == 0) {
|
||||
this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * sp34) + this->dyna.actor.home.pos.x;
|
||||
this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * sp34) + this->dyna.actor.home.pos.z;
|
||||
if (this->unk168 == 0) {
|
||||
this->unk168 = 0x60;
|
||||
this->dyna.actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x12);
|
||||
}
|
||||
}
|
||||
if (this->unk160 < this->dyna.actor.floorHeight) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y = this->unk160;
|
||||
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
|
||||
if (!this->unk164) {
|
||||
EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 0x3E8, 0x578, 0);
|
||||
EffectSsGRipple_Spawn(play, &this->dyna.actor.world.pos, 0x3E8, 0x578, 8);
|
||||
this->unk166 = 40;
|
||||
}
|
||||
if (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) {
|
||||
this->unk166 = 40;
|
||||
this->dyna.actor.flags |= ACTOR_FLAG_10;
|
||||
this->actionFunc = func_80AD6A88;
|
||||
return;
|
||||
}
|
||||
this->unk164 = true;
|
||||
} else {
|
||||
this->unk164 = false;
|
||||
}
|
||||
}
|
||||
if (this->unk166 > 0) {
|
||||
this->unk166--;
|
||||
}
|
||||
func_80AD6830(this);
|
||||
}
|
||||
|
||||
void func_80AD6A88(BgLotus* this, PlayState* play) {
|
||||
if (this->dyna.actor.world.pos.y > this->unk160) {
|
||||
this->dyna.actor.world.pos.y = this->unk160;
|
||||
}
|
||||
this->dyna.actor.world.pos.y -= 1.0f;
|
||||
if (this->dyna.actor.world.pos.y <= this->dyna.actor.floorHeight) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
|
||||
this->unk166 = 0;
|
||||
}
|
||||
if (this->unk166 > 0) {
|
||||
this->unk166--;
|
||||
func_80AD6830(this);
|
||||
} else {
|
||||
if (Math_StepToF(&this->dyna.actor.scale.x, 0.0f, 5.0f * 0.001f)) {
|
||||
this->dyna.actor.draw = NULL;
|
||||
this->unk166 = 100;
|
||||
DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->actionFunc = func_80AD6B68;
|
||||
}
|
||||
this->dyna.actor.scale.z = this->dyna.actor.scale.x;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80AD6B68(BgLotus* this, PlayState* play) {
|
||||
if (this->unk166 > 0) {
|
||||
this->unk166--;
|
||||
} else if ((this->dyna.actor.xzDistToPlayer > 100.0f) && (this->dyna.actor.projectedPos.z < 0.0f)) {
|
||||
this->dyna.actor.draw = BgLotus_Draw;
|
||||
DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
Actor_SetScale(&this->dyna.actor, 0.1f);
|
||||
if (this->unk160 < this->dyna.actor.floorHeight) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y = this->unk160;
|
||||
}
|
||||
this->dyna.actor.flags &= ~ACTOR_FLAG_10;
|
||||
this->unk168 = 0x60;
|
||||
this->actionFunc = func_80AD68DC;
|
||||
this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x;
|
||||
this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z;
|
||||
}
|
||||
}
|
||||
|
||||
void BgLotus_Update(Actor* thisx, PlayState* play) {
|
||||
BgLotus* this = THIS;
|
||||
s32 pad;
|
||||
WaterBox* sp2C;
|
||||
|
||||
WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z,
|
||||
&this->unk160, &sp2C);
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
||||
void BgLotus_Draw(Actor* thisx, PlayState* play) {
|
||||
BgLotus* this = THIS;
|
||||
|
||||
Gfx_DrawDListOpa(play, gLilyPadDL);
|
||||
}
|
||||
|
@ -5,9 +5,15 @@
|
||||
|
||||
struct BgLotus;
|
||||
|
||||
typedef void (*BgLotusActionFunc)(struct BgLotus*, PlayState*);
|
||||
|
||||
typedef struct BgLotus {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x28];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ BgLotusActionFunc actionFunc;
|
||||
/* 0x160 */ f32 unk160;
|
||||
/* 0x164 */ u8 unk164;
|
||||
/* 0x166 */ s16 unk166;
|
||||
/* 0x168 */ s16 unk168;
|
||||
} BgLotus; // size = 0x16C
|
||||
|
||||
#endif // Z_BG_LOTUS_H
|
||||
|
Loading…
Reference in New Issue
Block a user