1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 06:40:15 +00:00

Decompiled ovl_Bg_Hidan_Kousi (#136)

This commit is contained in:
Ethan Roseman 2020-05-14 19:42:26 -04:00 committed by GitHub
parent 44ffb7ec62
commit d35a47e044
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 141 additions and 431 deletions

View file

@ -1,3 +1,9 @@
/*
* File: z_bg_hidan_kousi.c
* Overlay: ovl_Bg_Hidan_Kousi
* Description:
*/
#include "z_bg_hidan_kousi.h"
#define FLAGS 0x00000010
@ -9,7 +15,19 @@ void BgHidanKousi_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgHidanKousi_Update(Actor* thisx, GlobalContext* globalCtx);
void BgHidanKousi_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80889ACC(BgHidanKousi* this);
void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx);
void func_80889BC0(BgHidanKousi* this, GlobalContext* globalCtx);
void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx);
void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx);
void func_80889D28(BgHidanKousi* this, GlobalContext* globalCtx);
f32 D_80889E40[] = {
120.0f,
150.0f,
150.0f,
};
const ActorInit Bg_Hidan_Kousi_InitVars = {
ACTOR_BG_HIDAN_KOUSI,
ACTORTYPE_PROP,
@ -21,25 +39,129 @@ const ActorInit Bg_Hidan_Kousi_InitVars = {
(ActorFunc)BgHidanKousi_Update,
(ActorFunc)BgHidanKousi_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/BgHidanKousi_SetupAction.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/BgHidanKousi_Init.s")
static InitChainEntry D_80889E6C[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/BgHidanKousi_Destroy.s")
u32 D_80889E70[] = {
0x0600E2CC,
0x0600E380,
0x0600E430,
};
s16 D_80889E7C[] = {
0x4000,
0xC000,
0xC000,
0x0000,
};
u32 D_80889E84[] = {
0x0600C798,
0x0600BFA8,
0x0600BB58,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/func_80889ACC.s")
void BgHidanKousi_SetupAction(BgHidanKousi* this, BgHidanKousiActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/func_80889B5C.s")
void BgHidanKousi_Init(Actor* thisx, GlobalContext* globalCtx) {
BgHidanKousi* this = THIS;
s32 pad;
u32 localC = 0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/func_80889BC0.s")
DynaPolyInfo_SetActorMove(&this->dyna, 0);
Actor_SetHeight(thisx, 50.0f);
osSyncPrintf("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params, thisx->params & 0xFF,
((s32)thisx->params >> 8) & 0xFF);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/func_80889C18.s")
Actor_ProcessInitChain(thisx, D_80889E6C);
if (((thisx->params & 0xFF) < 0) || ((thisx->params & 0xFF) >= 3)) {
osSyncPrintf("arg_data おかしい 【格子】\n");
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/func_80889C90.s")
DynaPolyInfo_Alloc(D_80889E70[thisx->params & 0xFF], &localC);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localC);
thisx->posRot.rot.y = D_80889E7C[this->dyna.actor.params & 0xFF] + thisx->shape.rot.y;
if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0xFF)) {
func_80889ACC(this);
BgHidanKousi_SetupAction(this, func_80889D28);
} else {
BgHidanKousi_SetupAction(this, func_80889B5C);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/func_80889D28.s")
void BgHidanKousi_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgHidanKousi* this = THIS;
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/BgHidanKousi_Update.s")
void func_80889ACC(BgHidanKousi* this) {
s32 pad[2];
Vec3s* rot = &this->dyna.actor.posRot.rot;
f32 temp1 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_Sins(rot->y);
f32 temp2 = D_80889E40[this->dyna.actor.params & 0xFF] * Math_Coss(rot->y);
Vec3f* initPos = &this->dyna.actor.initPosRot.pos;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Kousi/BgHidanKousi_Draw.s")
this->dyna.actor.posRot.pos.x = initPos->x + temp1;
this->dyna.actor.posRot.pos.z = initPos->z + temp2;
}
void func_80889B5C(BgHidanKousi* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0xFF)) {
BgHidanKousi_SetupAction(this, func_80889BC0);
func_80080480(globalCtx, this);
this->unk_168 = 0xC8;
}
}
void func_80889BC0(BgHidanKousi* this, GlobalContext* globalCtx) {
this->unk_168 -= 1;
if (this->dyna.actor.type == func_8005B198() || (this->unk_168 <= 0)) {
BgHidanKousi_SetupAction(this, func_80889C18);
}
}
void func_80889C18(BgHidanKousi* this, GlobalContext* globalCtx) {
this->dyna.actor.speedXZ += 0.2f;
if (this->dyna.actor.speedXZ > 2.0f) {
this->dyna.actor.speedXZ = 2.0f;
BgHidanKousi_SetupAction(this, func_80889C90);
}
Actor_MoveForward(&this->dyna.actor);
func_8002F974(&this->dyna.actor, 0x2036);
}
void func_80889C90(BgHidanKousi* this, GlobalContext* globalCtx) {
func_8002D7EC(&this->dyna.actor);
if (D_80889E40[this->dyna.actor.params & 0xFF] <
Math_Vec3f_DistXYZ(&this->dyna.actor.initPosRot.pos, &this->dyna.actor.posRot.pos)) {
func_80889ACC(this);
BgHidanKousi_SetupAction(this, func_80889D28);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_STOP);
} else {
func_8002F974(&this->dyna.actor, 0x2036);
}
}
void func_80889D28(BgHidanKousi* this, GlobalContext* globalCtx) {
}
void BgHidanKousi_Update(Actor* thisx, GlobalContext* globalCtx) {
BgHidanKousi* this = THIS;
this->actionFunc(this, globalCtx);
}
void BgHidanKousi_Draw(Actor* thisx, GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* dispRefs[4];
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 350);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 354),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyOpa.p++, D_80889E84[thisx->params & 0xFF]);
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 359);
}

View file

@ -6,9 +6,12 @@
struct BgHidanKousi;
typedef void (*BgHidanKousiActionFunc)(struct BgHidanKousi*, GlobalContext*);
typedef struct BgHidanKousi {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x20];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgHidanKousiActionFunc actionFunc;
/* 0x0168 */ s16 unk_168;
} BgHidanKousi; // size = 0x016C
extern const ActorInit Bg_Hidan_Kousi_InitVars;