1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 19:13:42 +00:00

cleanup around ColliderTrisElement, ColliderTris usage

This commit is contained in:
Dragorn421 2025-02-15 11:21:42 +01:00
parent 29a9fab5ad
commit d90beb2655
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
10 changed files with 43 additions and 43 deletions

View file

@ -142,7 +142,7 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) {
BgHakaSgami* this = (BgHakaSgami*)thisx;
EffectBlureInit1 blureInit;
s32 i;
ColliderTris* colliderScythe = &this->colliderScythe;
ColliderTris* scytheCollider = &this->scytheCollider;
Actor_ProcessInitChain(thisx, sInitChain);
@ -153,8 +153,8 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) {
thisx->flags |= ACTOR_FLAG_REACT_TO_LENS;
}
Collider_InitTris(play, colliderScythe);
Collider_SetTris(play, colliderScythe, thisx, &sTrisInit, this->colliderScytheItems);
Collider_InitTris(play, scytheCollider);
Collider_SetTris(play, scytheCollider, thisx, &sTrisInit, this->scytheColliderElements);
Collider_InitCylinder(play, &this->scytheCenterCollider);
Collider_SetCylinder(play, &this->scytheCenterCollider, thisx, &sCylinderInit);
@ -199,7 +199,7 @@ void BgHakaSgami_Destroy(Actor* thisx, PlayState* play) {
Effect_Delete(play, this->blureEffectIndex[0]);
Effect_Delete(play, this->blureEffectIndex[1]);
Collider_DestroyTris(play, &this->colliderScythe);
Collider_DestroyTris(play, &this->scytheCollider);
Collider_DestroyCylinder(play, &this->scytheCenterCollider);
}
@ -256,14 +256,14 @@ void BgHakaSgami_Spin(BgHakaSgami* this, PlayState* play) {
elementInit->dim.vtx[j].x * actorRotYSin;
}
Collider_SetTrisVertices(&this->colliderScythe, i, &scytheVertices[0], &scytheVertices[1], &scytheVertices[2]);
Collider_SetTrisVertices(&this->scytheCollider, i, &scytheVertices[0], &scytheVertices[1], &scytheVertices[2]);
for (j = 0; j < 3; j++) {
scytheVertices[j].x = (2 * this->actor.world.pos.x) - scytheVertices[j].x;
scytheVertices[j].z = (2 * this->actor.world.pos.z) - scytheVertices[j].z;
}
Collider_SetTrisVertices(&this->colliderScythe, (i + 2) % 4, &scytheVertices[0], &scytheVertices[1],
Collider_SetTrisVertices(&this->scytheCollider, (i + 2) % 4, &scytheVertices[0], &scytheVertices[1],
&scytheVertices[2]);
}
@ -288,7 +288,7 @@ void BgHakaSgami_Spin(BgHakaSgami* this, PlayState* play) {
EffectBlure_AddVertex(Effect_GetByIndex(this->blureEffectIndex[1]), &scytheVertices[0], &scytheVertices[1]);
}
CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderScythe.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->scytheCollider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->scytheCenterCollider.base);
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ROLLCUTTER_MOTOR - SFX_FLAG);
}

View file

@ -16,8 +16,8 @@ typedef struct BgHakaSgami {
/* 0x0152 */ s16 timer;
/* 0x0154 */ s32 blureEffectIndex[2];
/* 0x015C */ ColliderCylinder scytheCenterCollider;
/* 0x01A8 */ ColliderTris colliderScythe;
/* 0x01C8 */ ColliderTrisElement colliderScytheItems[4];
/* 0x01A8 */ ColliderTris scytheCollider;
/* 0x01C8 */ ColliderTrisElement scytheColliderElements[4];
} BgHakaSgami; // size = 0x0338
#endif

View file

@ -171,8 +171,8 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) {
CollisionHeader_GetVirtual(&object_haka_objects_Col_008D10, &colHeader);
}
Collider_InitTris(play, &this->colliderSpikes);
Collider_SetTris(play, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem);
Collider_InitTris(play, &this->spikesCollider);
Collider_SetTris(play, &this->spikesCollider, thisx, &sTrisInit, this->spikesColliderElements);
this->colliderCylinder.dim.radius = 18;
this->colliderCylinder.dim.height = 115;
@ -202,7 +202,7 @@ void BgHakaTrap_Destroy(Actor* thisx, PlayState* play) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if ((this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) ||
(this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_2)) {
Collider_DestroyTris(play, &this->colliderSpikes);
Collider_DestroyTris(play, &this->spikesCollider);
}
}
@ -253,7 +253,7 @@ void func_808801B8(BgHakaTrap* this, PlayState* play) {
func_8087FFC0(this, play);
if (this->colliderSpikes.base.acFlags & AC_HIT) {
if (this->spikesCollider.base.acFlags & AC_HIT) {
this->timer = 20;
D_80880F30 = 1;
this->actionFunc = func_808802D8;
@ -502,7 +502,7 @@ void BgHakaTrap_Update(Actor* thisx, PlayState* play) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base);
} else {
if (this->actionFunc == func_808801B8) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSpikes.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->spikesCollider.base);
}
CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base);
@ -518,10 +518,10 @@ void func_80880D68(BgHakaTrap* this) {
Matrix_MultVec3f(&sTrisElementsInit[0].dim.vtx[0], &vec1);
Matrix_MultVec3f(&sTrisElementsInit[0].dim.vtx[1], &vec2);
Matrix_MultVec3f(&sTrisElementsInit[0].dim.vtx[2], &vec3);
Collider_SetTrisVertices(&this->colliderSpikes, 0, &vec1, &vec2, &vec3);
Collider_SetTrisVertices(&this->spikesCollider, 0, &vec1, &vec2, &vec3);
Matrix_MultVec3f(&sTrisElementsInit[1].dim.vtx[2], &vec2);
Collider_SetTrisVertices(&this->colliderSpikes, 1, &vec1, &vec3, &vec2);
Collider_SetTrisVertices(&this->spikesCollider, 1, &vec1, &vec3, &vec2);
}
void BgHakaTrap_Draw(Actor* thisx, PlayState* play) {

View file

@ -25,8 +25,8 @@ typedef struct BgHakaTrap {
/* 0x016A */ s16 unk_16A; // used as boolean for HAKA_TRAP_GUILLOTINE_SLOW/FAST, s16 for HAKA_TRAP_SPIKED_BOX
/* 0x016C */ Vec3f unk_16C;
/* 0x0178 */ ColliderCylinder colliderCylinder;
/* 0x01C4 */ ColliderTris colliderSpikes;
/* 0x01E4 */ ColliderTrisElement colliderSpikesItem[2];
/* 0x01C4 */ ColliderTris spikesCollider;
/* 0x01E4 */ ColliderTrisElement spikesColliderElements[2];
} BgHakaTrap; // size = 0x029C
#endif

View file

@ -110,8 +110,8 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) {
this->burnSwitchFlag = PARAMS_GET_U(thisx->params, 6, 6);
this->dyna.actor.params = PARAMS_GET_U(thisx->params, 12, 4);
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Collider_InitTris(play, &this->trisCollider);
Collider_SetTris(play, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems);
Collider_InitTris(play, &this->colliderTris);
Collider_SetTris(play, &this->colliderTris, &this->dyna.actor, &sTrisInit, this->colliderTrisElements);
if (this->dyna.actor.params == WEB_FLOOR) {
CollisionHeader_GetVirtual(&gDTWebFloorCol, &colHeader);
this->actionFunc = BgYdanSp_FloorWebIdle;
@ -122,10 +122,10 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) {
tri[i].z = ti0->dim.vtx[i].z + this->dyna.actor.world.pos.z;
}
Collider_SetTrisVertices(&this->trisCollider, 0, &tri[0], &tri[1], &tri[2]);
Collider_SetTrisVertices(&this->colliderTris, 0, &tri[0], &tri[1], &tri[2]);
tri[1].x = tri[0].x;
tri[1].z = tri[2].z;
Collider_SetTrisVertices(&this->trisCollider, 1, &tri[0], &tri[2], &tri[1]);
Collider_SetTrisVertices(&this->colliderTris, 1, &tri[0], &tri[2], &tri[1]);
this->unk_16C = 0.0f;
} else {
CollisionHeader_GetVirtual(&gDTWebWallCol, &colHeader);
@ -144,12 +144,12 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.world.pos.z - (sinsY * ti1->dim.vtx[i].x) + (ti1->dim.vtx[i].y * cossY * nSinsX);
}
Collider_SetTrisVertices(&this->trisCollider, 0, &tri[0], &tri[1], &tri[2]);
Collider_SetTrisVertices(&this->colliderTris, 0, &tri[0], &tri[1], &tri[2]);
tri[1].x = this->dyna.actor.world.pos.x + (cossY * ti1->dim.vtx[0].x) - (ti1->dim.vtx[2].y * sinsY * nSinsX);
tri[1].y = this->dyna.actor.world.pos.y + (ti1->dim.vtx[2].y * cossX);
tri[1].z = this->dyna.actor.world.pos.z - (sinsY * ti1->dim.vtx[0].x) + (ti1->dim.vtx[2].y * cossY * nSinsX);
Collider_SetTrisVertices(&this->trisCollider, 1, &tri[0], &tri[2], &tri[1]);
Collider_SetTrisVertices(&this->colliderTris, 1, &tri[0], &tri[2], &tri[1]);
}
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->timer = 0;
@ -161,7 +161,7 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) {
void BgYdanSp_Destroy(Actor* thisx, PlayState* play) {
BgYdanSp* this = (BgYdanSp*)thisx;
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyTris(play, &this->trisCollider);
Collider_DestroyTris(play, &this->colliderTris);
}
void BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) {
@ -298,7 +298,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) {
BgYdanSp_BurnWeb(this, play);
return;
}
if (this->trisCollider.base.acFlags & AC_HIT) {
if (this->colliderTris.base.acFlags & AC_HIT) {
BgYdanSp_BurnWeb(this, play);
return;
}
@ -345,7 +345,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) {
}
}
BgYdanSp_UpdateFloorWebCollision(this);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->trisCollider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base);
}
void BgYdanSp_BurnWallWeb(BgYdanSp* this, PlayState* play) {
@ -406,7 +406,7 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) {
Vec3f sp30;
player = GET_PLAYER(play);
if (Flags_GetSwitch(play, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & AC_HIT)) {
if (Flags_GetSwitch(play, this->burnSwitchFlag) || (this->colliderTris.base.acFlags & AC_HIT)) {
this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f;
BgYdanSp_BurnWeb(this, play);
} else if (player->heldItemAction == PLAYER_IA_DEKU_STICK && player->unk_860 != 0) {
@ -417,7 +417,7 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) {
BgYdanSp_BurnWeb(this, play);
}
}
CollisionCheck_SetAC(play, &play->colChkCtx, &this->trisCollider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base);
}
void BgYdanSp_Update(Actor* thisx, PlayState* play) {

View file

@ -15,8 +15,8 @@ typedef struct BgYdanSp {
/* 0x0169 */ u8 burnSwitchFlag;
/* 0x016A */ s16 timer;
/* 0x016C */ f32 unk_16C;
/* 0x0170 */ ColliderTris trisCollider;
/* 0x0190 */ ColliderTrisElement trisColliderItems[2];
/* 0x0170 */ ColliderTris colliderTris;
/* 0x0190 */ ColliderTrisElement colliderTrisElements[2];
} BgYdanSp; // size = 0x0248
#endif

View file

@ -224,7 +224,7 @@ void EnIk_InitImpl(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->bodyCollider);
Collider_SetCylinder(play, &this->bodyCollider, thisx, &sCylinderInit);
Collider_InitTris(play, &this->shieldCollider);
Collider_SetTris(play, &this->shieldCollider, thisx, &sTrisInit, this->shieldColliderItems);
Collider_SetTris(play, &this->shieldCollider, thisx, &sTrisInit, this->shieldColliderElements);
Collider_InitQuad(play, &this->axeCollider);
Collider_SetQuad(play, &this->axeCollider, thisx, &sQuadInit);

View file

@ -109,7 +109,7 @@ typedef struct EnIk {
/* 0x0320 */ ColliderCylinder bodyCollider;
/* 0x036C */ ColliderQuad axeCollider;
/* 0x03EC */ ColliderTris shieldCollider;
/* 0x040C */ ColliderTrisElement shieldColliderItems[2];
/* 0x040C */ ColliderTrisElement shieldColliderElements[2];
/* 0x04C4 */ s32 blureIdx;
/* 0x04C8 */ s32 csAction;
/* 0x04CC */ s32 csDrawMode;

View file

@ -284,8 +284,8 @@ void EnMb_Init(Actor* thisx, PlayState* play) {
this->actor.colChkInfo.damageTable = &sSpearMoblinDamageTable;
Collider_InitCylinder(play, &this->bodyCollider);
Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit);
Collider_InitTris(play, &this->frontShielding);
Collider_SetTris(play, &this->frontShielding, &this->actor, &sFrontShieldingInit, this->frontShieldingTris);
Collider_InitTris(play, &this->frontShieldingCollider);
Collider_SetTris(play, &this->frontShieldingCollider, &this->actor, &sFrontShieldingInit, this->frontShieldingColliderElements);
Collider_InitQuad(play, &this->attackCollider);
Collider_SetQuad(play, &this->attackCollider, &this->actor, &sAttackColliderInit);
@ -349,7 +349,7 @@ void EnMb_Init(Actor* thisx, PlayState* play) {
void EnMb_Destroy(Actor* thisx, PlayState* play) {
EnMb* this = (EnMb*)thisx;
Collider_DestroyTris(play, &this->frontShielding);
Collider_DestroyTris(play, &this->frontShieldingCollider);
Collider_DestroyCylinder(play, &this->bodyCollider);
Collider_DestroyQuad(play, &this->attackCollider);
}
@ -1434,8 +1434,8 @@ void EnMb_ClubUpdateAttackCollider(Actor* thisx, PlayState* play) {
void EnMb_CheckColliding(EnMb* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->frontShielding.base.acFlags & AC_HIT) {
this->frontShielding.base.acFlags &= ~(AC_HIT | AC_BOUNCED);
if (this->frontShieldingCollider.base.acFlags & AC_HIT) {
this->frontShieldingCollider.base.acFlags &= ~(AC_HIT | AC_BOUNCED);
this->bodyCollider.base.acFlags &= ~AC_HIT;
} else if ((this->bodyCollider.base.acFlags & AC_HIT) && this->state >= ENMB_STATE_STUNNED) {
this->bodyCollider.base.acFlags &= ~AC_HIT;
@ -1502,7 +1502,7 @@ void EnMb_Update(Actor* thisx, PlayState* play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base);
}
if (this->state >= ENMB_STATE_IDLE) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->frontShielding.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->frontShieldingCollider.base);
}
if (this->attack > ENMB_ATTACK_NONE) {
CollisionCheck_SetAT(play, &play->colChkCtx, &this->attackCollider.base);
@ -1601,9 +1601,9 @@ void EnMb_Draw(Actor* thisx, PlayState* play) {
Matrix_MultVec3f(&frontShieldingTriModel0[i], &frontShieldingTri0[i]);
Matrix_MultVec3f(&frontShieldingTriModel1[i], &frontShieldingTri1[i]);
}
Collider_SetTrisVertices(&this->frontShielding, 0, &frontShieldingTri0[0], &frontShieldingTri0[1],
Collider_SetTrisVertices(&this->frontShieldingCollider, 0, &frontShieldingTri0[0], &frontShieldingTri0[1],
&frontShieldingTri0[2]);
Collider_SetTrisVertices(&this->frontShielding, 1, &frontShieldingTri1[0], &frontShieldingTri1[1],
Collider_SetTrisVertices(&this->frontShieldingCollider, 1, &frontShieldingTri1[0], &frontShieldingTri1[1],
&frontShieldingTri1[2]);
}

View file

@ -46,8 +46,8 @@ typedef struct EnMb {
/* 0x0364 */ f32 playerDetectionRange;
/* 0x0368 */ ColliderCylinder bodyCollider;
/* 0x03B4 */ ColliderQuad attackCollider; // for attacking the player
/* 0x0434 */ ColliderTris frontShielding; // Moblins don't have shields, but this acts as one
/* 0x0454 */ ColliderTrisElement frontShieldingTris[2];
/* 0x0434 */ ColliderTris frontShieldingCollider; // Moblins don't have shields, but this acts as one
/* 0x0454 */ ColliderTrisElement frontShieldingColliderElements[2];
} EnMb; // size = 0x050C
#endif