mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 23:10:22 +00:00
Decompiled ovl_Item_B_Heart <3 (#271)
* Decompiled ovl_Item_B_Heart <3 * Update src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
parent
5f7bce6e2e
commit
15f75b0ddd
10 changed files with 91 additions and 325 deletions
|
@ -15,7 +15,11 @@ void ItemBHeart_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void ItemBHeart_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx);
|
||||
|
||||
extern Gfx D_06001290[];
|
||||
extern Gfx D_06001470[];
|
||||
|
||||
const ActorInit Item_B_Heart_InitVars = {
|
||||
ACTOR_ITEM_B_HEART,
|
||||
ACTORTYPE_MISC,
|
||||
|
@ -27,13 +31,87 @@ const ActorInit Item_B_Heart_InitVars = {
|
|||
(ActorFunc)ItemBHeart_Update,
|
||||
(ActorFunc)ItemBHeart_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Item_B_Heart/ItemBHeart_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Item_B_Heart/ItemBHeart_Destroy.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 0, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Item_B_Heart/ItemBHeart_Update.s")
|
||||
void ItemBHeart_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ItemBHeart* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Item_B_Heart/func_80B85264.s")
|
||||
if (Flags_GetCollectible(globalCtx, 0x1F)) {
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Item_B_Heart/ItemBHeart_Draw.s")
|
||||
void ItemBHeart_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void ItemBHeart_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ItemBHeart* this = THIS;
|
||||
|
||||
func_80B85264(this, globalCtx);
|
||||
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
if (func_8002F410(&this->actor, globalCtx)) {
|
||||
Flags_SetCollectible(globalCtx, 0x1F);
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
func_8002F434(&this->actor, globalCtx, GI_HEART_CONTAINER_2, 30.0f, 40.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B85264(ItemBHeart* this, GlobalContext* globalCtx) {
|
||||
f32 temp;
|
||||
|
||||
this->unk_164 += 1;
|
||||
temp = ((Math_Sins(this->unk_164 * 1548) * 5.0f) + 20.0f);
|
||||
Math_SmoothScaleMaxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + temp, 0.1f, this->unk_158);
|
||||
Math_SmoothScaleMaxF(&this->unk_158, 2.0f, 1.0f, 0.1f);
|
||||
this->actor.shape.rot.y += 0x400;
|
||||
|
||||
Math_SmoothScaleMaxF(&this->actor.scale.x, 0.4f, 0.1f, 0.01f);
|
||||
this->actor.scale.y = this->actor.scale.z = this->actor.scale.x;
|
||||
}
|
||||
|
||||
void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ItemBHeart* this = THIS;
|
||||
Actor* actorIt;
|
||||
u8 flag = 0;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
Gfx* dispRefs[4];
|
||||
|
||||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_item_b_heart.c", 506);
|
||||
|
||||
actorIt = globalCtx->actorCtx.actorList[ACTORTYPE_ITEMACTION].first;
|
||||
|
||||
while (actorIt != NULL) {
|
||||
if ((actorIt->id == ACTOR_DOOR_WARP1) && (actorIt->projectedPos.z > this->actor.projectedPos.z)) {
|
||||
flag = 1;
|
||||
break;
|
||||
} else {
|
||||
actorIt = actorIt->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 551),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, D_06001290);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, D_06001470);
|
||||
} else {
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 557),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, D_06001290);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, D_06001470);
|
||||
}
|
||||
|
||||
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_item_b_heart.c", 561);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,11 @@ struct ItemBHeart;
|
|||
|
||||
typedef struct ItemBHeart {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x20];
|
||||
/* 0x014C */ char unk_14C[0xC];
|
||||
/* 0x0158 */ f32 unk_158;
|
||||
/* 0x015C */ char unk_15C[0x8];
|
||||
/* 0x0164 */ s16 unk_164;
|
||||
/* 0x0166 */ char unk_166[0x6];
|
||||
} ItemBHeart; // size = 0x016C
|
||||
|
||||
extern const ActorInit Item_B_Heart_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue