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

Ovl_Obj_Hana OK (#394)

* initial commit

* Deleted unused asm files.

* Formatting, simplified scale floats in HanaParams structs

* Removed a comment, replaced thisx with this->actor

* Renamed hanaParams data symbol, added missing static keywords, formatting

* Formatting suggestions
This commit is contained in:
emilybrooks 2020-09-20 06:37:54 -07:00 committed by GitHub
parent 44dac7af67
commit 7bd4686f1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 194 deletions

View file

@ -15,7 +15,6 @@ void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Obj_Hana_InitVars = {
ACTOR_OBJ_HANA,
ACTORTYPE_PROP,
@ -27,11 +26,74 @@ const ActorInit Obj_Hana_InitVars = {
(ActorFunc)ObjHana_Update,
(ActorFunc)ObjHana_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Destroy.s")
static ColliderCylinderInit sCylinderInit = {
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{ 8, 10, 0, { 0, 0, 0 } },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Update.s")
static CollisionCheckInfoInit sColChkInfoInit = { 0, 0xC, 0x3C, 0xFF };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Draw.s")
typedef struct {
/* 0x00 */ Gfx* dList;
/* 0x04 */ f32 scale;
/* 0x08 */ f32 yOffset;
/* 0x0C */ s16 radius;
/* 0x0E */ s16 height;
} HanaParams; // size = 0x10
static HanaParams sHanaParams[] = {
{ 0x05000500, 0.01f, 0.0f, -1, 0 },
{ 0x0500A880, 0.1f, 58.0f, 10, 18 },
{ 0x0500B9D0, 0.4f, 0.0f, 12, 44 },
};
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 900, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 60, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
};
void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjHana* this = THIS;
s16 type = this->actor.params & 3;
HanaParams* params = &sHanaParams[type];
Actor_ProcessInitChain(&this->actor, sInitChain);
Actor_SetScale(&this->actor, params->scale);
this->actor.shape.unk_08 = params->yOffset;
if (params->radius >= 0) {
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_CylinderUpdate(&this->actor, &this->collider);
this->collider.dim.radius = params->radius;
this->collider.dim.height = params->height;
func_80061ED4(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
}
if (type == 2 && (gSaveContext.eventChkInf[4] & 1)) {
Actor_Kill(&this->actor);
}
}
void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx) {
ObjHana* this = THIS;
if (sHanaParams[this->actor.params & 3].radius >= 0) {
Collider_DestroyCylinder(globalCtx, &this->collider);
}
}
void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjHana* this = THIS;
if (sHanaParams[this->actor.params & 3].radius >= 0 && this->actor.xzDistFromLink < 400.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, sHanaParams[thisx->params & 3].dList);
}

View file

@ -8,7 +8,7 @@ struct ObjHana;
typedef struct ObjHana {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x4C];
/* 0x014C */ ColliderCylinder collider;
} ObjHana; // size = 0x0198
extern const ActorInit Obj_Hana_InitVars;