1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

BgGndFiremeiro OK and documented (#850)

* OK, data imported

* Name everything

* Delete asm
This commit is contained in:
EllipticEllipsis 2021-06-14 18:50:16 +01:00 committed by GitHub
parent d3db43df00
commit d399c3deb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 119 additions and 420 deletions

View file

@ -16,14 +16,10 @@ void BgGndFiremeiro_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgGndFiremeiro_Update(Actor* thisx, GlobalContext* globalCtx);
void BgGndFiremeiro_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_808795AC(BgGndFiremeiro* this, GlobalContext* globalCtx);
void func_80879668(BgGndFiremeiro* this, GlobalContext* globalCtx);
void func_80879808(BgGndFiremeiro* this, GlobalContext* globalCtx);
void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx);
void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx);
void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx);
// extern Gfx gFireTrialPlatformDL[];
// extern CollisionHeader gFireTrialPlatformCol;
/*
const ActorInit Bg_Gnd_Firemeiro_InitVars = {
ACTOR_BG_GND_FIREMEIRO,
ACTORCAT_PROP,
@ -35,17 +31,122 @@ const ActorInit Bg_Gnd_Firemeiro_InitVars = {
(ActorFunc)BgGndFiremeiro_Update,
(ActorFunc)BgGndFiremeiro_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Firemeiro/BgGndFiremeiro_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Firemeiro/BgGndFiremeiro_Destroy.s")
void BgGndFiremeiro_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgGndFiremeiro* this = THIS;
CollisionHeader* colHeader = NULL;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Firemeiro/func_808795AC.s")
ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);
Actor_SetScale(&this->dyna.actor, 0.1f);
this->initPos = this->dyna.actor.world.pos;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Firemeiro/func_80879668.s")
if (this->dyna.actor.params == 0) {
DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&gFireTrialPlatformCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->actionFunc = BgGndFiremeiro_Rise;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Firemeiro/func_80879808.s")
void BgGndFiremeiro_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
BgGndFiremeiro* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Firemeiro/BgGndFiremeiro_Update.s")
if (this->dyna.actor.params == 0) {
if (1) {}
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Firemeiro/BgGndFiremeiro_Draw.s")
void BgGndFiremeiro_Sink(BgGndFiremeiro* this, GlobalContext* globalCtx) {
f32 sunkHeight = this->initPos.y - 150.0f;
if (func_8004356C(&this->dyna)) {
this->timer = 10;
}
if (sunkHeight < this->dyna.actor.world.pos.y) {
this->dyna.actor.world.pos.y -= 0.5f;
if (this->dyna.actor.world.pos.y < sunkHeight) {
this->dyna.actor.world.pos.y = sunkHeight;
}
func_8002F948(&this->dyna.actor, NA_SE_EV_ROLL_STAND_2 - SFX_FLAG);
}
if (this->timer > 0) {
this->timer--;
} else {
this->actionFunc = BgGndFiremeiro_Rise;
}
}
void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx) {
s32 pad;
f32 randSign;
if (func_8004356C(&this->dyna)) { // Player standing on it
if (this->timer > 0) {
this->timer--;
randSign = ((this->timer & 1) ? 2.0f : -2.0f);
this->dyna.actor.world.pos = this->initPos;
this->dyna.actor.world.pos.x += randSign * Math_SinS(this->timer * 0x2FFF);
this->dyna.actor.world.pos.z += randSign * Math_CosS(this->timer * 0x2FFF);
this->dyna.actor.world.pos.y += Math_CosS(this->timer * 0x7FFF);
if (!(this->timer % 4)) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_SHAKE);
}
} else {
this->timer = 10;
this->dyna.actor.world.pos = this->initPos;
this->actionFunc = BgGndFiremeiro_Sink;
}
} else {
this->dyna.actor.world.pos = this->initPos;
this->actionFunc = BgGndFiremeiro_Rise;
}
}
void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Actor* thisx = &this->dyna.actor;
if ((player->currentBoots != PLAYER_BOOTS_HOVER) && func_8004356C(&this->dyna)) { // Player standing on it
if (thisx->world.pos.y < this->initPos.y) {
this->actionFunc = BgGndFiremeiro_Sink;
this->timer = 20;
} else {
this->actionFunc = BgGndFiremeiro_Shake;
this->timer = 20;
}
} else {
if (thisx->world.pos.y < this->initPos.y) {
thisx->world.pos.y += 2.0f;
if (this->initPos.y < thisx->world.pos.y) {
thisx->world.pos.y = this->initPos.y;
}
}
}
}
void BgGndFiremeiro_Update(Actor* thisx, GlobalContext* globalCtx) {
BgGndFiremeiro* this = THIS;
this->actionFunc(this, globalCtx);
}
void BgGndFiremeiro_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 280);
func_800943C8(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 282),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gFireTrialPlatformDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 285);
}

View file

@ -10,8 +10,8 @@ typedef void (*BgGndFiremeiroActionFunc)(struct BgGndFiremeiro*, GlobalContext*)
typedef struct BgGndFiremeiro {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ Vec3f unk_164;
/* 0x0170 */ char unk_170[0x4];
/* 0x0164 */ Vec3f initPos;
/* 0x0170 */ u16 timer;
/* 0x0174 */ BgGndFiremeiroActionFunc actionFunc;
} BgGndFiremeiro; // size = 0x0178