1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 23:10:22 +00:00

z_bg_menkuri_eye OK (#374)

* z_bg_menkuri_eye OK

* Fixed up a few things in Update

* Made all requested fixes.
This commit is contained in:
fullgrowngaming 2020-09-14 13:27:23 -07:00 committed by GitHub
parent eba7a30d86
commit 9891ac04c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 105 additions and 358 deletions

View file

@ -15,7 +15,6 @@ void BgMenkuriEye_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx);
void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Bg_Menkuri_Eye_InitVars = {
ACTOR_BG_MENKURI_EYE,
ACTORTYPE_BG,
@ -27,11 +26,104 @@ const ActorInit Bg_Menkuri_Eye_InitVars = {
(ActorFunc)BgMenkuriEye_Update,
(ActorFunc)BgMenkuriEye_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Menkuri_Eye/BgMenkuriEye_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Menkuri_Eye/BgMenkuriEye_Destroy.s")
extern Gfx D_06002D20[];
s32 D_8089C1A0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Menkuri_Eye/BgMenkuriEye_Update.s")
static ColliderJntSphItemInit sJntSphItemsInit[1] = {
{
{ 0x04, { 0x00000000, 0x00, 0x00 }, { 0x0001F820, 0x00, 0x00 }, 0x00, 0x01, 0x00 },
{ 1, { { 0, 0, 0 }, 14 }, 100 },
},
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Menkuri_Eye/BgMenkuriEye_Draw.s")
static ColliderJntSphInit sJntSphInit = {
{ COLTYPE_UNK10, 0x00, 0x09, 0x00, 0x20, COLSHAPE_JNTSPH },
1,
sJntSphItemsInit,
};
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
void BgMenkuriEye_Init(Actor* thisx, GlobalContext* globalCtx) {
BgMenkuriEye* this = THIS;
ColliderJntSphItem* colliderList;
Actor_ProcessInitChain(&this->actor, sInitChain);
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems);
this->collider.list->dim.worldSphere.center.x = this->actor.posRot.pos.x;
this->collider.list->dim.worldSphere.center.y = this->actor.posRot.pos.y;
this->collider.list->dim.worldSphere.center.z = this->actor.posRot.pos.z;
colliderList = this->collider.list;
colliderList->dim.worldSphere.radius = colliderList->dim.modelSphere.radius;
if (!Flags_GetSwitch(globalCtx, this->actor.params)) {
D_8089C1A0 = 0;
}
this->framesUntilDisable = -1;
}
void BgMenkuriEye_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgMenkuriEye* this = THIS;
Collider_DestroyJntSph(globalCtx, &this->collider);
}
void BgMenkuriEye_Update(Actor* thisx, GlobalContext* globalCtx) {
BgMenkuriEye* this = THIS;
if (!Flags_GetSwitch(globalCtx, this->actor.params)) {
if (this->framesUntilDisable != -1) {
if (this->framesUntilDisable != 0) {
this->framesUntilDisable -= 1;
}
if (this->framesUntilDisable == 0) {
this->framesUntilDisable = -1;
D_8089C1A0 -= 1;
}
}
}
if ((this->collider.base.acFlags & 2) &&
(ABS((s16)(this->collider.base.ac->posRot.rot.y - this->actor.shape.rot.y)) > 0x5000)) {
this->collider.base.acFlags &= ~0x2;
if (this->framesUntilDisable == -1) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_AMOS_DAMAGE);
D_8089C1A0 += 1;
D_8089C1A0 = CLAMP_MAX(D_8089C1A0, 4);
}
this->framesUntilDisable = 416;
if (D_8089C1A0 == 4) {
Flags_SetSwitch(globalCtx, this->actor.params);
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
}
if (this->framesUntilDisable == -1) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
Actor_SetHeight(&this->actor, 0.0f);
}
void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgMenkuriEye* this = THIS;
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_menkuri_eye.c", 292);
func_80093D84(globalCtx->state.gfxCtx);
if (Flags_GetSwitch(globalCtx, this->actor.params)) {
gDPSetEnvColor(oGfxCtx->polyXlu.p++, 200, 0, 0, 255);
} else if (this->framesUntilDisable == -1) {
gDPSetEnvColor(oGfxCtx->polyXlu.p++, 200, 0, 0, 0);
} else {
gDPSetEnvColor(oGfxCtx->polyXlu.p++, 200, 0, 0, 255);
}
Matrix_Translate(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0);
Matrix_RotateRPY(this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, 1);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1);
gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_menkuri_eye.c", 331),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(oGfxCtx->polyXlu.p++, D_06002D20);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_menkuri_eye.c", 335);
}

View file

@ -8,9 +8,9 @@ struct BgMenkuriEye;
typedef struct BgMenkuriEye {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x4];
/* 0x0150 */ Collider collider;
/* 0x0168 */ char unk_168[0x48];
/* 0x014C */ s16 framesUntilDisable;
/* 0x0150 */ ColliderJntSph collider;
/* 0x0170 */ ColliderJntSphItem colliderItems[1];
} BgMenkuriEye; // size = 0x01B0
extern const ActorInit Bg_Menkuri_Eye_InitVars;