mirror of
https://github.com/zeldaret/oot.git
synced 2025-05-11 03:23:46 +00:00
cleanup around ColliderTrisElementInit
, ColliderTrisInit
usage
This commit is contained in:
parent
d90beb2655
commit
763dfeffa6
5 changed files with 45 additions and 43 deletions
|
@ -41,7 +41,7 @@ ActorProfile Bg_Mizu_Bwall_Profile = {
|
|||
/**/ BgMizuBwall_Draw,
|
||||
};
|
||||
|
||||
static ColliderTrisElementInit sTrisElementInitFloor[2] = {
|
||||
static ColliderTrisElementInit sTrisElementsInitFloor[2] = {
|
||||
{
|
||||
{
|
||||
ELEM_MATERIAL_UNK0,
|
||||
|
@ -76,10 +76,10 @@ static ColliderTrisInit sTrisInitFloor = {
|
|||
COLSHAPE_TRIS,
|
||||
},
|
||||
2,
|
||||
sTrisElementInitFloor,
|
||||
sTrisElementsInitFloor,
|
||||
};
|
||||
|
||||
static ColliderTrisElementInit sTrisElementInitRutoWall[1] = {
|
||||
static ColliderTrisElementInit sTrisElementsInitRutoWall[1] = {
|
||||
{
|
||||
{
|
||||
ELEM_MATERIAL_UNK0,
|
||||
|
@ -103,10 +103,10 @@ static ColliderTrisInit sTrisInitRutoWall = {
|
|||
COLSHAPE_TRIS,
|
||||
},
|
||||
1,
|
||||
sTrisElementInitRutoWall,
|
||||
sTrisElementsInitRutoWall,
|
||||
};
|
||||
|
||||
static ColliderTrisElementInit sTrisElementInitWall[2] = {
|
||||
static ColliderTrisElementInit sTrisElementsInitWall[2] = {
|
||||
{
|
||||
{
|
||||
ELEM_MATERIAL_UNK0,
|
||||
|
@ -141,7 +141,7 @@ static ColliderTrisInit sTrisInitUnusedWall = {
|
|||
COLSHAPE_TRIS,
|
||||
},
|
||||
2,
|
||||
sTrisElementInitWall,
|
||||
sTrisElementsInitWall,
|
||||
};
|
||||
|
||||
static ColliderTrisInit sTrisInitStingerWall = {
|
||||
|
@ -154,7 +154,7 @@ static ColliderTrisInit sTrisInitStingerWall = {
|
|||
COLSHAPE_TRIS,
|
||||
},
|
||||
2,
|
||||
sTrisElementInitWall,
|
||||
sTrisElementsInitWall,
|
||||
};
|
||||
|
||||
static Gfx* sDLists[] = {
|
||||
|
@ -215,7 +215,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementsInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
offset.x = sTrisInitFloor.elements[i].dim.vtx[j].x;
|
||||
offset.y = sTrisInitFloor.elements[i].dim.vtx[j].y;
|
||||
|
@ -255,7 +255,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitRutoWall); i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementsInitRutoWall); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
offset.x = sTrisInitRutoWall.elements[i].dim.vtx[j].x;
|
||||
offset.y = sTrisInitRutoWall.elements[i].dim.vtx[j].y;
|
||||
|
@ -295,7 +295,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementsInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
//! @bug This uses the wrong set of collision triangles, causing the collider to be
|
||||
//! flat to the ground instead of vertical. It should use sTrisInitUnusedWall.
|
||||
|
@ -337,7 +337,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementsInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
//! @bug This uses the wrong set of collision triangles, causing the collider to be
|
||||
//! flat to the ground instead of vertical. It should use sTrisInitStingerWall.
|
||||
|
@ -379,7 +379,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
|
|||
sin = Math_SinS(this->dyna.actor.shape.rot.y);
|
||||
cos = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(sTrisElementsInitFloor); i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
//! @bug This uses the wrong set of collision triangles, causing the collider to be
|
||||
//! flat to the ground instead of vertical. It should use sTrisInitStingerWall.
|
||||
|
|
|
@ -102,7 +102,7 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, PlayState* play) {
|
|||
static s16 paintingPosX[] = { -1302, -866, 1421, 985 };
|
||||
static s16 paintingPosY[] = { 1107, 1091 };
|
||||
static s16 paintingPosZ[] = { -3384, -3252 };
|
||||
ColliderTrisElementInit* item;
|
||||
ColliderTrisElementInit* elementInit;
|
||||
Vec3f* vtxVec;
|
||||
s32 i1;
|
||||
s32 i2;
|
||||
|
@ -123,10 +123,10 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, PlayState* play) {
|
|||
scaleY = 1.0f;
|
||||
}
|
||||
for (i1 = 0; i1 < sTrisInit.count; i1++) {
|
||||
item = &sTrisInit.elements[i1];
|
||||
elementInit = &sTrisInit.elements[i1];
|
||||
if (1) {} // This section looks like a macro of some sort.
|
||||
for (i2 = 0; i2 < 3; i2++) {
|
||||
vtxVec = &item->dim.vtx[i2];
|
||||
vtxVec = &elementInit->dim.vtx[i2];
|
||||
sp9C[i2].x = (vtxVec->x * coss) + (this->dyna.actor.home.pos.x + (sins * vtxVec->z));
|
||||
sp9C[i2].y = (vtxVec->y * scaleY) + this->dyna.actor.home.pos.y;
|
||||
sp9C[i2].z = this->dyna.actor.home.pos.z + (coss * vtxVec->z) - (vtxVec->x * sins);
|
||||
|
|
|
@ -89,7 +89,7 @@ void BgYdanMaruta_Init(Actor* thisx, PlayState* play) {
|
|||
f32 sinRotY;
|
||||
f32 cosRotY;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
ColliderTrisElementInit* triInit;
|
||||
ColliderTrisElementInit* triElemInit;
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
Collider_InitTris(play, &this->collider);
|
||||
|
@ -99,10 +99,10 @@ void BgYdanMaruta_Init(Actor* thisx, PlayState* play) {
|
|||
thisx->params = PARAMS_GET_U(thisx->params, 8, 8); // thisx is required to match here
|
||||
|
||||
if (this->dyna.actor.params == 0) {
|
||||
triInit = &sTrisElementsInit[0];
|
||||
triElemInit = &sTrisElementsInit[0];
|
||||
this->actionFunc = func_808BEFF4;
|
||||
} else {
|
||||
triInit = &sTrisElementsInit[1];
|
||||
triElemInit = &sTrisElementsInit[1];
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
CollisionHeader_GetVirtual(&gDTFallingLadderCol, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
|
||||
|
@ -119,16 +119,16 @@ void BgYdanMaruta_Init(Actor* thisx, PlayState* play) {
|
|||
cosRotY = Math_CosS(this->dyna.actor.shape.rot.y);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
sp4C[i].x = (triInit->dim.vtx[i].x * cosRotY) + this->dyna.actor.world.pos.x;
|
||||
sp4C[i].y = triInit->dim.vtx[i].y + this->dyna.actor.world.pos.y;
|
||||
sp4C[i].z = this->dyna.actor.world.pos.z - (triInit->dim.vtx[i].x * sinRotY);
|
||||
sp4C[i].x = (triElemInit->dim.vtx[i].x * cosRotY) + this->dyna.actor.world.pos.x;
|
||||
sp4C[i].y = triElemInit->dim.vtx[i].y + this->dyna.actor.world.pos.y;
|
||||
sp4C[i].z = this->dyna.actor.world.pos.z - (triElemInit->dim.vtx[i].x * sinRotY);
|
||||
}
|
||||
|
||||
Collider_SetTrisVertices(&this->collider, 0, &sp4C[0], &sp4C[1], &sp4C[2]);
|
||||
|
||||
sp4C[1].x = (triInit->dim.vtx[2].x * cosRotY) + this->dyna.actor.world.pos.x;
|
||||
sp4C[1].y = triInit->dim.vtx[0].y + this->dyna.actor.world.pos.y;
|
||||
sp4C[1].z = this->dyna.actor.world.pos.z - (triInit->dim.vtx[2].x * sinRotY);
|
||||
sp4C[1].x = (triElemInit->dim.vtx[2].x * cosRotY) + this->dyna.actor.world.pos.x;
|
||||
sp4C[1].y = triElemInit->dim.vtx[0].y + this->dyna.actor.world.pos.y;
|
||||
sp4C[1].z = this->dyna.actor.world.pos.z - (triElemInit->dim.vtx[2].x * sinRotY);
|
||||
|
||||
Collider_SetTrisVertices(&this->collider, 1, &sp4C[0], &sp4C[2], &sp4C[1]);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ ActorProfile Bg_Ydan_Sp_Profile = {
|
|||
/**/ BgYdanSp_Draw,
|
||||
};
|
||||
|
||||
static ColliderTrisElementInit sTrisItemsInit[2] = {
|
||||
static ColliderTrisElementInit sTrisElementsInit[2] = {
|
||||
{
|
||||
{
|
||||
ELEM_MATERIAL_UNK0,
|
||||
|
@ -86,7 +86,7 @@ static ColliderTrisInit sTrisInit = {
|
|||
COLSHAPE_TRIS,
|
||||
},
|
||||
2,
|
||||
sTrisItemsInit,
|
||||
sTrisElementsInit,
|
||||
};
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
|
@ -95,11 +95,11 @@ static InitChainEntry sInitChain[] = {
|
|||
|
||||
void BgYdanSp_Init(Actor* thisx, PlayState* play) {
|
||||
BgYdanSp* this = (BgYdanSp*)thisx;
|
||||
ColliderTrisElementInit* ti0 = &sTrisItemsInit[0];
|
||||
ColliderTrisElementInit* triElemInit0 = &sTrisElementsInit[0];
|
||||
Vec3f tri[3];
|
||||
s32 i;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
ColliderTrisElementInit* ti1 = &sTrisItemsInit[1];
|
||||
ColliderTrisElementInit* triElemInit1 = &sTrisElementsInit[1];
|
||||
f32 cossY;
|
||||
f32 sinsY;
|
||||
f32 cossX;
|
||||
|
@ -117,9 +117,9 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) {
|
|||
this->actionFunc = BgYdanSp_FloorWebIdle;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
tri[i].x = ti0->dim.vtx[i].x + this->dyna.actor.world.pos.x;
|
||||
tri[i].y = ti0->dim.vtx[i].y + this->dyna.actor.world.pos.y;
|
||||
tri[i].z = ti0->dim.vtx[i].z + this->dyna.actor.world.pos.z;
|
||||
tri[i].x = triElemInit0->dim.vtx[i].x + this->dyna.actor.world.pos.x;
|
||||
tri[i].y = triElemInit0->dim.vtx[i].y + this->dyna.actor.world.pos.y;
|
||||
tri[i].z = triElemInit0->dim.vtx[i].z + this->dyna.actor.world.pos.z;
|
||||
}
|
||||
|
||||
Collider_SetTrisVertices(&this->colliderTris, 0, &tri[0], &tri[1], &tri[2]);
|
||||
|
@ -137,18 +137,20 @@ void BgYdanSp_Init(Actor* thisx, PlayState* play) {
|
|||
cossX = Math_CosS(this->dyna.actor.shape.rot.x);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
tri[i].x =
|
||||
this->dyna.actor.world.pos.x + (cossY * ti1->dim.vtx[i].x) - (sinsY * ti1->dim.vtx[i].y * nSinsX);
|
||||
tri[i].y = this->dyna.actor.world.pos.y + (ti1->dim.vtx[i].y * cossX);
|
||||
tri[i].z =
|
||||
this->dyna.actor.world.pos.z - (sinsY * ti1->dim.vtx[i].x) + (ti1->dim.vtx[i].y * cossY * nSinsX);
|
||||
tri[i].x = this->dyna.actor.world.pos.x + (cossY * triElemInit1->dim.vtx[i].x) -
|
||||
(sinsY * triElemInit1->dim.vtx[i].y * nSinsX);
|
||||
tri[i].y = this->dyna.actor.world.pos.y + (triElemInit1->dim.vtx[i].y * cossX);
|
||||
tri[i].z = this->dyna.actor.world.pos.z - (sinsY * triElemInit1->dim.vtx[i].x) +
|
||||
(triElemInit1->dim.vtx[i].y * cossY * nSinsX);
|
||||
}
|
||||
|
||||
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);
|
||||
tri[1].x = this->dyna.actor.world.pos.x + (cossY * triElemInit1->dim.vtx[0].x) -
|
||||
(triElemInit1->dim.vtx[2].y * sinsY * nSinsX);
|
||||
tri[1].y = this->dyna.actor.world.pos.y + (triElemInit1->dim.vtx[2].y * cossX);
|
||||
tri[1].z = this->dyna.actor.world.pos.z - (sinsY * triElemInit1->dim.vtx[0].x) +
|
||||
(triElemInit1->dim.vtx[2].y * cossY * nSinsX);
|
||||
Collider_SetTrisVertices(&this->colliderTris, 1, &tri[0], &tri[2], &tri[1]);
|
||||
}
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
|
|
@ -126,7 +126,7 @@ static ColliderCylinderInit sBodyColliderInit = {
|
|||
{ 20, 70, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
static ColliderTrisElementInit sFrontShieldingTrisInit[2] = {
|
||||
static ColliderTrisElementInit sFrontShieldingTrisElementsInit[2] = {
|
||||
{
|
||||
{
|
||||
ELEM_MATERIAL_UNK2,
|
||||
|
@ -151,7 +151,7 @@ static ColliderTrisElementInit sFrontShieldingTrisInit[2] = {
|
|||
},
|
||||
};
|
||||
|
||||
static ColliderTrisInit sFrontShieldingInit = {
|
||||
static ColliderTrisInit sFrontShieldingTrisInit = {
|
||||
{
|
||||
COL_MATERIAL_METAL,
|
||||
AT_NONE,
|
||||
|
@ -161,7 +161,7 @@ static ColliderTrisInit sFrontShieldingInit = {
|
|||
COLSHAPE_TRIS,
|
||||
},
|
||||
2,
|
||||
sFrontShieldingTrisInit,
|
||||
sFrontShieldingTrisElementsInit,
|
||||
};
|
||||
|
||||
static ColliderQuadInit sAttackColliderInit = {
|
||||
|
@ -285,7 +285,7 @@ void EnMb_Init(Actor* thisx, PlayState* play) {
|
|||
Collider_InitCylinder(play, &this->bodyCollider);
|
||||
Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit);
|
||||
Collider_InitTris(play, &this->frontShieldingCollider);
|
||||
Collider_SetTris(play, &this->frontShieldingCollider, &this->actor, &sFrontShieldingInit, this->frontShieldingColliderElements);
|
||||
Collider_SetTris(play, &this->frontShieldingCollider, &this->actor, &sFrontShieldingTrisInit, this->frontShieldingColliderElements);
|
||||
Collider_InitQuad(play, &this->attackCollider);
|
||||
Collider_SetQuad(play, &this->attackCollider, &this->actor, &sAttackColliderInit);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue