mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 23:10:22 +00:00
Decompiled ovl_En_Blkobj (#242)
* Decompiled ovl_En_Blkobj * PR suggestions * gfx commands
This commit is contained in:
parent
b251f3f7e3
commit
eb10acb8ed
16 changed files with 157 additions and 429 deletions
|
@ -15,7 +15,11 @@ void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void func_809C2148(EnBlkobj* this, GlobalContext* globalCtx);
|
||||
void func_809C21A0(EnBlkobj* this, GlobalContext* globalCtx);
|
||||
void func_809C2218(EnBlkobj* this, GlobalContext* globalCtx);
|
||||
void func_809C22F4(EnBlkobj* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit En_Blkobj_InitVars = {
|
||||
ACTOR_EN_BLKOBJ,
|
||||
ACTORTYPE_PROP,
|
||||
|
@ -27,23 +31,152 @@ const ActorInit En_Blkobj_InitVars = {
|
|||
(ActorFunc)EnBlkobj_Update,
|
||||
(ActorFunc)EnBlkobj_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/func_809C2060.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/EnBlkobj_Init.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 800, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneScale, 200, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/EnBlkobj_Destroy.s")
|
||||
Gfx D_809C2590[] = {
|
||||
gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/func_809C2148.s")
|
||||
Gfx D_809C25A0[] = {
|
||||
gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/func_809C21A0.s")
|
||||
extern Gfx D_060014E0[];
|
||||
extern Gfx D_060053D0[];
|
||||
extern UNK_TYPE D_06007564;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/func_809C2218.s")
|
||||
void func_809C2060(EnBlkobj* this, EnBlkobjActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
this->unk_166 = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/func_809C22F4.s")
|
||||
void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnBlkobj* this = THIS;
|
||||
s32 localC = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/EnBlkobj_Update.s")
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, 0);
|
||||
if (Flags_GetClear(globalCtx, this->dyna.actor.room)) {
|
||||
this->unk_164 = 0xFF;
|
||||
func_809C2060(this, func_809C22F4);
|
||||
} else {
|
||||
DynaPolyInfo_Alloc(&D_06007564, &localC);
|
||||
this->dyna.dynaPolyId =
|
||||
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC);
|
||||
func_809C2060(this, func_809C2148);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/func_809C2324.s")
|
||||
void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnBlkobj* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Blkobj/EnBlkobj_Draw.s")
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
}
|
||||
|
||||
void func_809C2148(EnBlkobj* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
|
||||
if (this->dyna.actor.xzDistFromLink < 120.0f) {
|
||||
func_809C2060(this, func_809C21A0);
|
||||
}
|
||||
player->stateFlags2 |= 0x4000000;
|
||||
}
|
||||
|
||||
void func_809C21A0(EnBlkobj* this, GlobalContext* globalCtx) {
|
||||
if (!(this->dyna.actor.flags & 0x40)) {
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TORCH2, this->dyna.actor.posRot.pos.x,
|
||||
this->dyna.actor.posRot.pos.y, this->dyna.actor.posRot.pos.z, 0, this->dyna.actor.yawTowardsLink, 0,
|
||||
0);
|
||||
func_809C2060(this, func_809C2218);
|
||||
}
|
||||
}
|
||||
|
||||
void func_809C2218(EnBlkobj* this, GlobalContext* globalCtx) {
|
||||
s32 temp;
|
||||
|
||||
if (this->unk_166 == 0) {
|
||||
if (Actor_Find(&globalCtx->actorCtx, ACTOR_EN_TORCH2, ACTORTYPE_BOSS) == NULL) {
|
||||
Flags_SetClear(globalCtx, this->dyna.actor.room);
|
||||
this->unk_166 += 1;
|
||||
}
|
||||
} else {
|
||||
if ((this->unk_166++ < 0x65) ^ 1) {
|
||||
temp = (this->unk_166 - 0x64) >> 2;
|
||||
if (temp > 5) {
|
||||
temp = 5;
|
||||
}
|
||||
this->unk_164 += temp;
|
||||
if (this->unk_164 > 0xFF) {
|
||||
this->unk_164 = 0xFF;
|
||||
func_809C2060(this, func_809C22F4);
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_809C22F4(EnBlkobj* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnBlkobj* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void func_809C2324(GlobalContext* globalCtx, Gfx* dList, s32 alpha) {
|
||||
Gfx* segment;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
Gfx* dispRefs[4];
|
||||
|
||||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 322);
|
||||
|
||||
if (alpha == 0xFF) {
|
||||
segment = D_809C2590;
|
||||
} else {
|
||||
segment = D_809C25A0;
|
||||
}
|
||||
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 0x08, segment);
|
||||
gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x00, 0x00, 0x00, alpha);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, dList);
|
||||
|
||||
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 330);
|
||||
}
|
||||
|
||||
void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnBlkobj* this = THIS;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 temp_a3;
|
||||
u32 gameplayFrames;
|
||||
Gfx* dispRefs[5];
|
||||
|
||||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 349);
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
|
||||
gameplayFrames = globalCtx->gameplayFrames % 128;
|
||||
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 0x0D,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32));
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 363),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
if (this->unk_164 != 0) {
|
||||
func_809C2324(globalCtx, D_060014E0, this->unk_164);
|
||||
}
|
||||
temp_a3 = 0xFF - this->unk_164;
|
||||
if (temp_a3 != 0) {
|
||||
func_809C2324(globalCtx, D_060053D0, temp_a3);
|
||||
}
|
||||
|
||||
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 375);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,13 @@
|
|||
|
||||
struct EnBlkobj;
|
||||
|
||||
typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, GlobalContext*);
|
||||
|
||||
typedef struct EnBlkobj {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x20];
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ s16 unk_164;
|
||||
/* 0x0166 */ s16 unk_166;
|
||||
/* 0x0168 */ EnBlkobjActionFunc actionFunc;
|
||||
} EnBlkobj; // size = 0x016C
|
||||
|
||||
extern const ActorInit En_Blkobj_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue