mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 23:10:22 +00:00
Decompiled ovl_Bg_Jya_Zurerukabe (#424)
* Decompiled ovl_Bg_Jya_Zurerukabe * PR suggestions, cleanup * PR suggestion
This commit is contained in:
parent
d292d81958
commit
024d5d69bf
16 changed files with 177 additions and 505 deletions
|
@ -1,5 +1,13 @@
|
|||
/*
|
||||
* File: z_bg_jya_zurerukabe.c
|
||||
* Overlay: ovl_Bg_Jya_Zurerukabe
|
||||
* Description:
|
||||
*/
|
||||
|
||||
#include "z_bg_jya_zurerukabe.h"
|
||||
|
||||
#include <vt.h>
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((BgJyaZurerukabe*)thisx)
|
||||
|
@ -9,7 +17,14 @@ void BgJyaZurerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void BgJyaZurerukabe_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgJyaZurerukabe_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx);
|
||||
void func_8089B7B4(BgJyaZurerukabe* this);
|
||||
void func_8089B7C4(BgJyaZurerukabe* this, GlobalContext* globalCtx);
|
||||
void func_8089B80C(BgJyaZurerukabe* this);
|
||||
void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx);
|
||||
|
||||
static f32 D_8089B9C0[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
const ActorInit Bg_Jya_Zurerukabe_InitVars = {
|
||||
ACTOR_BG_JYA_ZURERUKABE,
|
||||
ACTORTYPE_BG,
|
||||
|
@ -21,23 +36,160 @@ const ActorInit Bg_Jya_Zurerukabe_InitVars = {
|
|||
(ActorFunc)BgJyaZurerukabe_Update,
|
||||
(ActorFunc)BgJyaZurerukabe_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/func_8089B440.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/func_8089B4C8.s")
|
||||
static s16 D_8089B9F0[4] = { 943, 1043, 1243, 1343 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/BgJyaZurerukabe_Init.s")
|
||||
static s16 D_8089B9F8[4] = { -1, 1, -1, 1 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/BgJyaZurerukabe_Destroy.s")
|
||||
static s16 D_8089BA00[4] = { 48, 48, 36, 36 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/func_8089B7B4.s")
|
||||
static f32 D_8089BA08[4] = { 8.0f, 8.0f, 10.0f, 10.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/func_8089B7C4.s")
|
||||
static s16 D_8089BA18[6][2] = {
|
||||
{ 0x0388, 0x0395 }, { 0x03EA, 0x03FF }, { 0x0454, 0x0467 },
|
||||
{ 0x04B4, 0x04C1 }, { 0x0518, 0x0528 }, { 0x0581, 0x0590 },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/func_8089B80C.s")
|
||||
static s16 D_8089BA30[6] = {
|
||||
0, 0, 1, 2, 2, 3,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/func_8089B870.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/BgJyaZurerukabe_Update.s")
|
||||
extern Gfx D_06012340[];
|
||||
extern UNK_PTR D_06012508;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Zurerukabe/BgJyaZurerukabe_Draw.s")
|
||||
void func_8089B440(BgJyaZurerukabe* this, GlobalContext* globalCtx, void* arg2, s32 flags) {
|
||||
s32 pad;
|
||||
s32 localC = 0;
|
||||
s32 pad2;
|
||||
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, flags);
|
||||
DynaPolyInfo_Alloc(arg2, &localC);
|
||||
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC);
|
||||
|
||||
if (this->dyna.dynaPolyId == 0x32) {
|
||||
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 194,
|
||||
this->dyna.actor.id, this->dyna.actor.params);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
|
||||
if ((player->stateFlags1 == 0x200000) && (player->actor.wallPoly != NULL)) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_8089BA18); i++) {
|
||||
f32 posY = player->actor.posRot.pos.y;
|
||||
if ((posY >= D_8089BA18[i][0]) && (posY <= D_8089BA18[i][1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
if (fabsf(D_8089B9C0[D_8089BA30[i]]) > 1.0f) {
|
||||
func_8002F6D4(globalCtx, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
if (fabsf(D_8089B9C0[D_8089BA30[i]] - D_8089B9C0[D_8089BA30[i + 1]]) > 1.0f) {
|
||||
func_8002F6D4(globalCtx, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BgJyaZurerukabe_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgJyaZurerukabe* this = THIS;
|
||||
s32 i;
|
||||
|
||||
func_8089B440(this, globalCtx, &D_06012508, DPM_UNK);
|
||||
Actor_ProcessInitChain(thisx, sInitChain);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_8089B9F0); i++) {
|
||||
if (fabsf(D_8089B9F0[i] - this->dyna.actor.initPosRot.pos.y) < 1.0f) {
|
||||
this->unk_168 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == ARRAY_COUNT(D_8089B9F0)) {
|
||||
osSyncPrintf(VT_COL(RED, WHITE));
|
||||
osSyncPrintf("home pos が変更されたみたい(%s %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 299,
|
||||
this->dyna.actor.params);
|
||||
osSyncPrintf(VT_RST);
|
||||
}
|
||||
|
||||
this->unk_16E = D_8089B9F8[this->unk_168];
|
||||
func_8089B7B4(this);
|
||||
osSyncPrintf("(jya ずれる壁)(arg_data 0x%04x)\n", this->dyna.actor.params);
|
||||
}
|
||||
|
||||
void BgJyaZurerukabe_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgJyaZurerukabe* this = THIS;
|
||||
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
D_8089B9C0[this->unk_168] = 0.0f;
|
||||
}
|
||||
|
||||
void func_8089B7B4(BgJyaZurerukabe* this) {
|
||||
this->actionFunc = func_8089B7C4;
|
||||
}
|
||||
|
||||
void func_8089B7C4(BgJyaZurerukabe* this, GlobalContext* globalCtx) {
|
||||
if (this->unk_16A <= 0) {
|
||||
func_8089B80C(this);
|
||||
}
|
||||
D_8089B9C0[this->unk_168] = 0.0f;
|
||||
}
|
||||
|
||||
void func_8089B80C(BgJyaZurerukabe* this) {
|
||||
this->actionFunc = func_8089B870;
|
||||
this->unk_16A = D_8089BA00[this->unk_168];
|
||||
|
||||
if (ABS(this->unk_16C) == 4) {
|
||||
this->unk_16E = -this->unk_16E;
|
||||
}
|
||||
|
||||
this->unk_16C += this->unk_16E;
|
||||
}
|
||||
|
||||
void func_8089B870(BgJyaZurerukabe* this, GlobalContext* globalCtx) {
|
||||
if (Math_ApproxF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x + (this->unk_16C * 75),
|
||||
D_8089BA08[this->unk_168])) {
|
||||
func_8089B7B4(this);
|
||||
}
|
||||
|
||||
D_8089B9C0[this->unk_168] = D_8089BA08[this->unk_168] * this->unk_16E;
|
||||
func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
|
||||
}
|
||||
|
||||
void BgJyaZurerukabe_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgJyaZurerukabe* this = THIS;
|
||||
|
||||
if (this->unk_16A > 0) {
|
||||
this->unk_16A--;
|
||||
}
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
|
||||
if (this->unk_168 == 0) {
|
||||
func_8089B4C8(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void BgJyaZurerukabe_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Gfx_DrawDListOpa(globalCtx, D_06012340);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,15 @@
|
|||
|
||||
struct BgJyaZurerukabe;
|
||||
|
||||
typedef void (*BgJyaZurerukabeActionFunc)(struct BgJyaZurerukabe*, GlobalContext*);
|
||||
|
||||
typedef struct BgJyaZurerukabe {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x24];
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgJyaZurerukabeActionFunc actionFunc;
|
||||
/* 0x0168 */ s16 unk_168;
|
||||
/* 0x016A */ s16 unk_16A;
|
||||
/* 0x016C */ s16 unk_16C;
|
||||
/* 0x016E */ s16 unk_16E;
|
||||
} BgJyaZurerukabe; // size = 0x0170
|
||||
|
||||
extern const ActorInit Bg_Jya_Zurerukabe_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue