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

Automatic object xml creation (#596)

* new tool

* fixes

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
petrie911 2021-01-04 11:06:51 -06:00 committed by GitHub
parent 794538f6f7
commit 8cd367c43b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 238 additions and 33 deletions

View file

@ -56,16 +56,17 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
};
f32 D_80898794[] = { 0.13f, 0.1f, 0.1f };
static f32 D_80898794[] = { 0.13f, 0.1f, 0.1f };
Vec3f D_808987A0[] = { 0.0f, 14.0f, 0.0f };
static Vec3f D_808987A0[] = { 0.0f, 14.0f, 0.0f };
Vec3f D_808987AC[] = { 0.0f, 8.0f, 0.0f };
static Vec3f D_808987AC[] = { 0.0f, 8.0f, 0.0f };
extern Gfx D_06000880[];
void BgJyaHaheniron_ColliderInit(BgJyaHaheniron* this, GlobalContext* globalCtx) {
s32 pad;
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &D_80898764, this->colliderItems);
}
@ -104,23 +105,28 @@ void BgJyaHaheniron_SpawnFragments(GlobalContext* globalCtx, Vec3f* vec1, Vec3f*
}
void BgJyaHaheniron_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgJyaHaheniron* this = THIS;
Actor_ProcessInitChain(thisx, sInitChain);
Actor_ProcessInitChain(&this->actor, sInitChain);
Actor_SetScale(&this->actor, D_80898794[this->actor.params]);
if (thisx->params == 0) {
if (this->actor.params == 0) {
BgJyaHaheniron_ColliderInit(this, globalCtx);
thisx->shape.rot.z = (Rand_ZeroOne() * 65535.0f);
this->actor.shape.rot.z = (Rand_ZeroOne() * 65535.0f);
BgJyaHaheniron_SetupChairCrumble(this);
} else if (thisx->params == 1) {
} else if (this->actor.params == 1) {
BgJyaHaheniron_SetupPillarCrumble(this);
} else if (thisx->params == 2) {
} else if (this->actor.params == 2) {
BgJyaHaheniron_SetupRubbleCollide(this);
}
}
void BgJyaHaheniron_Destroy(Actor* thisx, GlobalContext* globalCtx) {
if (thisx->params == 0) {
Collider_DestroyJntSph(globalCtx, &THIS->collider);
s32 pad;
BgJyaHaheniron* this = THIS;
if (this->actor.params == 0) {
Collider_DestroyJntSph(globalCtx, &this->collider);
}
}
@ -133,14 +139,14 @@ void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx)
Actor_MoveForward(&this->actor);
func_8002E4B4(globalCtx, &this->actor, 5.0f, 8.0f, 0.0f, 0x85);
if ((this->actor.bgCheckFlags & 9) ||
((this->collider.base.atFlags & 2) && (this->collider.base.at) && (this->collider.base.at->type == 2))) {
if ((this->actor.bgCheckFlags & 9) || ((this->collider.base.atFlags & 2) && (this->collider.base.at != NULL) &&
(this->collider.base.at->type == ACTORTYPE_PLAYER))) {
vec.x = -Rand_ZeroOne() * this->actor.velocity.x;
vec.y = -Rand_ZeroOne() * this->actor.velocity.y;
vec.z = -Rand_ZeroOne() * this->actor.velocity.z;
BgJyaHaheniron_SpawnFragments(globalCtx, &this->actor.posRot, &vec);
Actor_Kill(&this->actor);
} else if (this->timer >= 61) {
} else if (this->timer > 60) {
Actor_Kill(&this->actor);
} else {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider);
@ -177,17 +183,20 @@ void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, GlobalContext* globalCtx
}
void BgJyaHaheniron_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgJyaHaheniron* this = THIS;
this->timer++;
this->actionFunc(this, globalCtx);
}
void BgJyaHaheniron_Draw(Actor* thisx, GlobalContext* globalCtx) {
static Gfx* dLists[] = { 0x06000880, 0x06000AE0, 0x06000600 };
s32 pad;
BgJyaHaheniron* this = THIS;
if (thisx->params == 0) {
if (this->actor.params == 0) {
func_800628A4(0, &this->collider);
}
Gfx_DrawDListOpa(globalCtx, dLists[thisx->params]);
Gfx_DrawDListOpa(globalCtx, dLists[this->actor.params]);
}