ovl_Bg_F40_Flift decompiled (#885)

* ovl_Bg_F40_Flift decompiled

* format

* pr reviews

* pr review
This commit is contained in:
Alejandro Asenjo 2022-07-11 23:10:29 -03:00 committed by GitHub
parent 9bcd3e2fea
commit 69b4bd8998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 19 deletions

3
spec
View File

@ -1129,8 +1129,7 @@ beginseg
name "ovl_Bg_F40_Flift"
compress
include "build/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.o"
include "build/data/ovl_Bg_F40_Flift/ovl_Bg_F40_Flift.data.o"
include "build/data/ovl_Bg_F40_Flift/ovl_Bg_F40_Flift.reloc.o"
include "build/src/overlays/actors/ovl_Bg_F40_Flift/ovl_Bg_F40_Flift_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_bg_f40_flift.h"
#include "objects/object_f40_obj/object_f40_obj.h"
#define FLAGS (ACTOR_FLAG_10)
@ -15,7 +16,9 @@ void BgF40Flift_Destroy(Actor* thisx, PlayState* play);
void BgF40Flift_Update(Actor* thisx, PlayState* play);
void BgF40Flift_Draw(Actor* thisx, PlayState* play);
#if 0
void func_808D75F0(BgF40Flift* this, PlayState* play);
void func_808D7714(BgF40Flift* this, PlayState* play);
const ActorInit Bg_F40_Flift_InitVars = {
ACTOR_BG_F40_FLIFT,
ACTORCAT_BG,
@ -28,28 +31,65 @@ const ActorInit Bg_F40_Flift_InitVars = {
(ActorFunc)BgF40Flift_Draw,
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_808D7830[] = {
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 5000, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#endif
void BgF40Flift_Init(Actor* thisx, PlayState* play) {
BgF40Flift* this = THIS;
extern InitChainEntry D_808D7830[];
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 1);
DynaPolyActor_LoadMesh(play, &this->dyna, &object_f40_obj_Colheader_004240);
this->dyna.actor.params = 1;
this->actionFunc = func_808D75F0;
}
extern UNK_TYPE D_06004038;
extern UNK_TYPE D_06004240;
void BgF40Flift_Destroy(Actor* thisx, PlayState* play) {
BgF40Flift* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Flift/BgF40Flift_Init.s")
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Flift/BgF40Flift_Destroy.s")
void func_808D75F0(BgF40Flift* this, PlayState* play) {
if (((this->dyna.actor.params == 1) && (DynaPolyActor_IsInRidingMovingState(&this->dyna))) ||
((this->dyna.actor.params == -1) && (!DynaPolyActor_IsInRidingMovingState(&this->dyna)))) {
this->timer = 96;
this->actionFunc = func_808D7714;
} else {
if (this->timer == 0) {
this->timer = 48;
}
this->timer--;
if (this->dyna.actor.params == 1) {
this->dyna.actor.world.pos.y = (sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y;
} else {
this->dyna.actor.world.pos.y =
(sin_rad(this->timer * (M_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Flift/func_808D75F0.s")
void func_808D7714(BgF40Flift* this, PlayState* play) {
if (this->timer != 0) {
this->timer--;
this->dyna.actor.world.pos.y =
(((cos_rad(this->timer * (M_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) +
this->dyna.actor.home.pos.y;
} else {
this->dyna.actor.params = -this->dyna.actor.params;
this->actionFunc = func_808D75F0;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Flift/func_808D7714.s")
void BgF40Flift_Update(Actor* thisx, PlayState* play) {
BgF40Flift* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Flift/BgF40Flift_Update.s")
this->actionFunc(this, play);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_F40_Flift/BgF40Flift_Draw.s")
void BgF40Flift_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, object_f40_obj_DL_004038);
}

View File

@ -8,10 +8,9 @@ struct BgF40Flift;
typedef void (*BgF40FliftActionFunc)(struct BgF40Flift*, PlayState*);
typedef struct BgF40Flift {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x18];
/* 0x015C */ BgF40FliftActionFunc actionFunc;
/* 0x0160 */ char unk_160[0x4];
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ BgF40FliftActionFunc actionFunc;
/* 0x160 */ s32 timer;
} BgF40Flift; // size = 0x164
extern const ActorInit Bg_F40_Flift_InitVars;