mirror of
https://github.com/zeldaret/oot.git
synced 2025-04-06 22:56:45 +00:00
WIP/experimental: ColliderCylinderElement
This commit is contained in:
parent
fa8bf586e0
commit
cfc8c32ace
5 changed files with 167 additions and 146 deletions
|
@ -189,28 +189,34 @@ typedef struct {
|
||||||
* Cylinder collider
|
* Cylinder collider
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* 0x00 */ ColliderElement base;
|
||||||
|
/* 0x28 */ Cylinder16 dim;
|
||||||
|
} ColliderCylinderElement; // size = 0x34
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* 0x00 */ ColliderElementInit base;
|
||||||
|
/* 0x18 */ Cylinder16 dim;
|
||||||
|
} ColliderCylinderElementInit; // size = 0x24
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ Collider base;
|
/* 0x00 */ Collider base;
|
||||||
/* 0x18 */ ColliderElement elem;
|
/* 0x18 */ ColliderCylinderElement element;
|
||||||
/* 0x40 */ Cylinder16 dim;
|
|
||||||
} ColliderCylinder; // size = 0x4C
|
} ColliderCylinder; // size = 0x4C
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ ColliderInit base;
|
/* 0x00 */ ColliderInit base;
|
||||||
/* 0x08 */ ColliderElementInit elem;
|
/* 0x08 */ ColliderCylinderElementInit element;
|
||||||
/* 0x20 */ Cylinder16 dim;
|
|
||||||
} ColliderCylinderInit; // size = 0x2C
|
} ColliderCylinderInit; // size = 0x2C
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ ColliderInitType1 base;
|
/* 0x00 */ ColliderInitType1 base;
|
||||||
/* 0x08 */ ColliderElementInit elem;
|
/* 0x08 */ ColliderCylinderElementInit element;
|
||||||
/* 0x20 */ Cylinder16 dim;
|
|
||||||
} ColliderCylinderInitType1; // size = 0x2C
|
} ColliderCylinderInitType1; // size = 0x2C
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ ColliderInitToActor base;
|
/* 0x00 */ ColliderInitToActor base;
|
||||||
/* 0x08 */ ColliderElementInit elem;
|
/* 0x08 */ ColliderCylinderElementInit element;
|
||||||
/* 0x20 */ Cylinder16 dim;
|
|
||||||
} ColliderCylinderInitToActor; // size = 0x2C
|
} ColliderCylinderInitToActor; // size = 0x2C
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -496,8 +496,8 @@ s32 Collider_SetCylinderDim(PlayState* play, Cylinder16* dest, Cylinder16* src)
|
||||||
*/
|
*/
|
||||||
s32 Collider_InitCylinder(PlayState* play, ColliderCylinder* cyl) {
|
s32 Collider_InitCylinder(PlayState* play, ColliderCylinder* cyl) {
|
||||||
Collider_InitBase(play, &cyl->base);
|
Collider_InitBase(play, &cyl->base);
|
||||||
Collider_InitElement(play, &cyl->elem);
|
Collider_InitElement(play, &cyl->element.base);
|
||||||
Collider_InitCylinderDim(play, &cyl->dim);
|
Collider_InitCylinderDim(play, &cyl->element.dim);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,8 +506,8 @@ s32 Collider_InitCylinder(PlayState* play, ColliderCylinder* cyl) {
|
||||||
*/
|
*/
|
||||||
s32 Collider_DestroyCylinder(PlayState* play, ColliderCylinder* cyl) {
|
s32 Collider_DestroyCylinder(PlayState* play, ColliderCylinder* cyl) {
|
||||||
Collider_DestroyBase(play, &cyl->base);
|
Collider_DestroyBase(play, &cyl->base);
|
||||||
Collider_DestroyElement(play, &cyl->elem);
|
Collider_DestroyElement(play, &cyl->element.base);
|
||||||
Collider_DestroyCylinderDim(play, &cyl->dim);
|
Collider_DestroyCylinderDim(play, &cyl->element.dim);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,8 +517,8 @@ s32 Collider_DestroyCylinder(PlayState* play, ColliderCylinder* cyl) {
|
||||||
*/
|
*/
|
||||||
s32 Collider_SetCylinderToActor(PlayState* play, ColliderCylinder* dest, ColliderCylinderInitToActor* src) {
|
s32 Collider_SetCylinderToActor(PlayState* play, ColliderCylinder* dest, ColliderCylinderInitToActor* src) {
|
||||||
Collider_SetBaseToActor(play, &dest->base, &src->base);
|
Collider_SetBaseToActor(play, &dest->base, &src->base);
|
||||||
Collider_SetElement(play, &dest->elem, &src->elem);
|
Collider_SetElement(play, &dest->element.base, &src->element.base);
|
||||||
Collider_SetCylinderDim(play, &dest->dim, &src->dim);
|
Collider_SetCylinderDim(play, &dest->element.dim, &src->element.dim);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,8 +527,8 @@ s32 Collider_SetCylinderToActor(PlayState* play, ColliderCylinder* dest, Collide
|
||||||
*/
|
*/
|
||||||
s32 Collider_SetCylinderType1(PlayState* play, ColliderCylinder* dest, Actor* actor, ColliderCylinderInitType1* src) {
|
s32 Collider_SetCylinderType1(PlayState* play, ColliderCylinder* dest, Actor* actor, ColliderCylinderInitType1* src) {
|
||||||
Collider_SetBaseType1(play, &dest->base, actor, &src->base);
|
Collider_SetBaseType1(play, &dest->base, actor, &src->base);
|
||||||
Collider_SetElement(play, &dest->elem, &src->elem);
|
Collider_SetElement(play, &dest->element.base, &src->element.base);
|
||||||
Collider_SetCylinderDim(play, &dest->dim, &src->dim);
|
Collider_SetCylinderDim(play, &dest->element.dim, &src->element.dim);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,8 +537,8 @@ s32 Collider_SetCylinderType1(PlayState* play, ColliderCylinder* dest, Actor* ac
|
||||||
*/
|
*/
|
||||||
s32 Collider_SetCylinder(PlayState* play, ColliderCylinder* dest, Actor* actor, ColliderCylinderInit* src) {
|
s32 Collider_SetCylinder(PlayState* play, ColliderCylinder* dest, Actor* actor, ColliderCylinderInit* src) {
|
||||||
Collider_SetBase(play, &dest->base, actor, &src->base);
|
Collider_SetBase(play, &dest->base, actor, &src->base);
|
||||||
Collider_SetElement(play, &dest->elem, &src->elem);
|
Collider_SetElement(play, &dest->element.base, &src->element.base);
|
||||||
Collider_SetCylinderDim(play, &dest->dim, &src->dim);
|
Collider_SetCylinderDim(play, &dest->element.dim, &src->element.dim);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ s32 Collider_ResetCylinderAT(PlayState* play, Collider* col) {
|
||||||
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
||||||
|
|
||||||
Collider_ResetATBase(play, &cyl->base);
|
Collider_ResetATBase(play, &cyl->base);
|
||||||
Collider_ResetATElement(play, &cyl->elem);
|
Collider_ResetATElement(play, &cyl->element.base);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ s32 Collider_ResetCylinderAC(PlayState* play, Collider* col) {
|
||||||
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
||||||
|
|
||||||
Collider_ResetACBase(play, &cyl->base);
|
Collider_ResetACBase(play, &cyl->base);
|
||||||
Collider_ResetACElement(play, &cyl->elem);
|
Collider_ResetACElement(play, &cyl->element.base);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ s32 Collider_ResetCylinderOC(PlayState* play, Collider* col) {
|
||||||
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
||||||
|
|
||||||
Collider_ResetOCBase(play, &cyl->base);
|
Collider_ResetOCBase(play, &cyl->base);
|
||||||
Collider_ResetOCElement(play, &cyl->elem);
|
Collider_ResetOCElement(play, &cyl->element.base);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,7 +1076,7 @@ void Collider_Draw(PlayState* play, Collider* col) {
|
||||||
|
|
||||||
case COLSHAPE_CYLINDER:
|
case COLSHAPE_CYLINDER:
|
||||||
cyl = (ColliderCylinder*)col;
|
cyl = (ColliderCylinder*)col;
|
||||||
Math3D_DrawCylinder(play, &cyl->dim);
|
Math3D_DrawCylinder(play, &cyl->element.dim);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COLSHAPE_TRIS:
|
case COLSHAPE_TRIS:
|
||||||
|
@ -1795,18 +1795,19 @@ void CollisionCheck_ATJntSphVsACCyl(PlayState* play, CollisionCheckContext* colC
|
||||||
f32 overlapSize;
|
f32 overlapSize;
|
||||||
f32 centerDist;
|
f32 centerDist;
|
||||||
|
|
||||||
if (atJntSph->count > 0 && atJntSph->elements != NULL && acCyl->dim.radius > 0 && acCyl->dim.height > 0) {
|
if (atJntSph->count > 0 && atJntSph->elements != NULL && acCyl->element.dim.radius > 0 &&
|
||||||
if (CollisionCheck_SkipElementBump(&acCyl->elem) == true) {
|
acCyl->element.dim.height > 0) {
|
||||||
|
if (CollisionCheck_SkipElementBump(&acCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (atJntSphElem = atJntSph->elements; atJntSphElem < atJntSph->elements + atJntSph->count; atJntSphElem++) {
|
for (atJntSphElem = atJntSph->elements; atJntSphElem < atJntSph->elements + atJntSph->count; atJntSphElem++) {
|
||||||
if (CollisionCheck_SkipElementTouch(&atJntSphElem->base) == true) {
|
if (CollisionCheck_SkipElementTouch(&atJntSphElem->base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_NoSharedFlags(&atJntSphElem->base, &acCyl->elem) == true) {
|
if (CollisionCheck_NoSharedFlags(&atJntSphElem->base, &acCyl->element.base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Math3D_SphVsCylOverlapCenterDist(&atJntSphElem->dim.worldSphere, &acCyl->dim, &overlapSize,
|
if (Math3D_SphVsCylOverlapCenterDist(&atJntSphElem->dim.worldSphere, &acCyl->element.dim, &overlapSize,
|
||||||
¢erDist)) {
|
¢erDist)) {
|
||||||
Vec3f hitPos;
|
Vec3f hitPos;
|
||||||
Vec3f atPos;
|
Vec3f atPos;
|
||||||
|
@ -1816,11 +1817,11 @@ void CollisionCheck_ATJntSphVsACCyl(PlayState* play, CollisionCheckContext* colC
|
||||||
atPos.x = atJntSphElem->dim.worldSphere.center.x;
|
atPos.x = atJntSphElem->dim.worldSphere.center.x;
|
||||||
atPos.y = atJntSphElem->dim.worldSphere.center.y;
|
atPos.y = atJntSphElem->dim.worldSphere.center.y;
|
||||||
atPos.z = atJntSphElem->dim.worldSphere.center.z;
|
atPos.z = atJntSphElem->dim.worldSphere.center.z;
|
||||||
acPos.x = acCyl->dim.pos.x;
|
acPos.x = acCyl->element.dim.pos.x;
|
||||||
acPos.y = acCyl->dim.pos.y;
|
acPos.y = acCyl->element.dim.pos.y;
|
||||||
acPos.z = acCyl->dim.pos.z;
|
acPos.z = acCyl->element.dim.pos.z;
|
||||||
if (!IS_ZERO(centerDist)) {
|
if (!IS_ZERO(centerDist)) {
|
||||||
acToHit = acCyl->dim.radius / centerDist;
|
acToHit = acCyl->element.dim.radius / centerDist;
|
||||||
if (acToHit <= 1.0f) {
|
if (acToHit <= 1.0f) {
|
||||||
hitPos.x = ((atPos.x - acPos.x) * acToHit) + acPos.x;
|
hitPos.x = ((atPos.x - acPos.x) * acToHit) + acPos.x;
|
||||||
hitPos.y = ((atPos.y - acPos.y) * acToHit) + acPos.y;
|
hitPos.y = ((atPos.y - acPos.y) * acToHit) + acPos.y;
|
||||||
|
@ -1831,8 +1832,8 @@ void CollisionCheck_ATJntSphVsACCyl(PlayState* play, CollisionCheckContext* colC
|
||||||
} else {
|
} else {
|
||||||
Math_Vec3f_Copy(&hitPos, &atPos);
|
Math_Vec3f_Copy(&hitPos, &atPos);
|
||||||
}
|
}
|
||||||
CollisionCheck_SetATvsAC(play, &atJntSph->base, &atJntSphElem->base, &atPos, &acCyl->base, &acCyl->elem,
|
CollisionCheck_SetATvsAC(play, &atJntSph->base, &atJntSphElem->base, &atPos, &acCyl->base,
|
||||||
&acPos, &hitPos);
|
&acCyl->element.base, &acPos, &hitPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1847,27 +1848,28 @@ void CollisionCheck_ATCylVsACJntSph(PlayState* play, CollisionCheckContext* colC
|
||||||
f32 centerDist;
|
f32 centerDist;
|
||||||
ColliderJntSphElement* acJntSphElem;
|
ColliderJntSphElement* acJntSphElem;
|
||||||
|
|
||||||
if (acJntSph->count > 0 && acJntSph->elements != NULL && atCyl->dim.radius > 0 && atCyl->dim.height > 0) {
|
if (acJntSph->count > 0 && acJntSph->elements != NULL && atCyl->element.dim.radius > 0 &&
|
||||||
if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true) {
|
atCyl->element.dim.height > 0) {
|
||||||
|
if (CollisionCheck_SkipElementTouch(&atCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (acJntSphElem = acJntSph->elements; acJntSphElem < acJntSph->elements + acJntSph->count; acJntSphElem++) {
|
for (acJntSphElem = acJntSph->elements; acJntSphElem < acJntSph->elements + acJntSph->count; acJntSphElem++) {
|
||||||
if (CollisionCheck_SkipElementBump(&acJntSphElem->base) == true) {
|
if (CollisionCheck_SkipElementBump(&acJntSphElem->base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acJntSphElem->base) == true) {
|
if (CollisionCheck_NoSharedFlags(&atCyl->element.base, &acJntSphElem->base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Math3D_SphVsCylOverlapCenterDist(&acJntSphElem->dim.worldSphere, &atCyl->dim, &overlapSize,
|
if (Math3D_SphVsCylOverlapCenterDist(&acJntSphElem->dim.worldSphere, &atCyl->element.dim, &overlapSize,
|
||||||
¢erDist)) {
|
¢erDist)) {
|
||||||
Vec3f hitPos;
|
Vec3f hitPos;
|
||||||
Vec3f atPos;
|
Vec3f atPos;
|
||||||
Vec3f acPos;
|
Vec3f acPos;
|
||||||
f32 acToHit;
|
f32 acToHit;
|
||||||
|
|
||||||
atPos.x = atCyl->dim.pos.x;
|
atPos.x = atCyl->element.dim.pos.x;
|
||||||
atPos.y = atCyl->dim.pos.y;
|
atPos.y = atCyl->element.dim.pos.y;
|
||||||
atPos.z = atCyl->dim.pos.z;
|
atPos.z = atCyl->element.dim.pos.z;
|
||||||
acPos.x = acJntSphElem->dim.worldSphere.center.x;
|
acPos.x = acJntSphElem->dim.worldSphere.center.x;
|
||||||
acPos.y = acJntSphElem->dim.worldSphere.center.y;
|
acPos.y = acJntSphElem->dim.worldSphere.center.y;
|
||||||
acPos.z = acJntSphElem->dim.worldSphere.center.z;
|
acPos.z = acJntSphElem->dim.worldSphere.center.z;
|
||||||
|
@ -1883,8 +1885,8 @@ void CollisionCheck_ATCylVsACJntSph(PlayState* play, CollisionCheckContext* colC
|
||||||
} else {
|
} else {
|
||||||
Math_Vec3f_Copy(&hitPos, &atPos);
|
Math_Vec3f_Copy(&hitPos, &atPos);
|
||||||
}
|
}
|
||||||
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->elem, &atPos, &acJntSph->base, &acJntSphElem->base,
|
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->element.base, &atPos, &acJntSph->base,
|
||||||
&acPos, &hitPos);
|
&acJntSphElem->base, &acPos, &hitPos);
|
||||||
if (!(acJntSph->base.ocFlags2 & OC2_FIRST_ONLY)) {
|
if (!(acJntSph->base.ocFlags2 & OC2_FIRST_ONLY)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2083,33 +2085,36 @@ void CollisionCheck_ATCylVsACCyl(PlayState* play, CollisionCheckContext* colChkC
|
||||||
f32 centerDistXZ;
|
f32 centerDistXZ;
|
||||||
Vec3f hitPos;
|
Vec3f hitPos;
|
||||||
|
|
||||||
if (atCyl->dim.radius > 0 && atCyl->dim.height > 0 && acCyl->dim.radius > 0 && acCyl->dim.height > 0) {
|
if (atCyl->element.dim.radius > 0 && atCyl->element.dim.height > 0 && acCyl->element.dim.radius > 0 &&
|
||||||
if (CollisionCheck_SkipElementBump(&acCyl->elem) == true) {
|
acCyl->element.dim.height > 0) {
|
||||||
|
if (CollisionCheck_SkipElementBump(&acCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true) {
|
if (CollisionCheck_SkipElementTouch(&atCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acCyl->elem) == true) {
|
if (CollisionCheck_NoSharedFlags(&atCyl->element.base, &acCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Math3D_CylOutsideCylDist(&atCyl->dim, &acCyl->dim, &deadSpace, ¢erDistXZ) == true) {
|
if (Math3D_CylOutsideCylDist(&atCyl->element.dim, &acCyl->element.dim, &deadSpace, ¢erDistXZ) == true) {
|
||||||
Vec3f atPos;
|
Vec3f atPos;
|
||||||
Vec3f acPos;
|
Vec3f acPos;
|
||||||
f32 acToHit;
|
f32 acToHit;
|
||||||
|
|
||||||
Math_Vec3s_ToVec3f(&atPos, &atCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&atPos, &atCyl->element.dim.pos);
|
||||||
Math_Vec3s_ToVec3f(&acPos, &acCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&acPos, &acCyl->element.dim.pos);
|
||||||
if (!IS_ZERO(centerDistXZ)) {
|
if (!IS_ZERO(centerDistXZ)) {
|
||||||
acToHit = acCyl->dim.radius / centerDistXZ;
|
acToHit = acCyl->element.dim.radius / centerDistXZ;
|
||||||
hitPos.y = (f32)acCyl->dim.pos.y + acCyl->dim.yShift + acCyl->dim.height * 0.5f;
|
hitPos.y = (f32)acCyl->element.dim.pos.y + acCyl->element.dim.yShift + acCyl->element.dim.height * 0.5f;
|
||||||
hitPos.x = ((f32)atCyl->dim.pos.x - acCyl->dim.pos.x) * acToHit + acCyl->dim.pos.x;
|
hitPos.x =
|
||||||
hitPos.z = ((f32)atCyl->dim.pos.z - acCyl->dim.pos.z) * acToHit + acCyl->dim.pos.z;
|
((f32)atCyl->element.dim.pos.x - acCyl->element.dim.pos.x) * acToHit + acCyl->element.dim.pos.x;
|
||||||
|
hitPos.z =
|
||||||
|
((f32)atCyl->element.dim.pos.z - acCyl->element.dim.pos.z) * acToHit + acCyl->element.dim.pos.z;
|
||||||
} else {
|
} else {
|
||||||
Math_Vec3s_ToVec3f(&hitPos, &acCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&hitPos, &acCyl->element.dim.pos);
|
||||||
}
|
}
|
||||||
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->elem, &atPos, &acCyl->base, &acCyl->elem, &acPos,
|
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->element.base, &atPos, &acCyl->base,
|
||||||
&hitPos);
|
&acCyl->element.base, &acPos, &hitPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2120,28 +2125,29 @@ void CollisionCheck_ATCylVsACTris(PlayState* play, CollisionCheckContext* colChk
|
||||||
ColliderTrisElement* acTrisElem;
|
ColliderTrisElement* acTrisElem;
|
||||||
Vec3f hitPos;
|
Vec3f hitPos;
|
||||||
|
|
||||||
if (atCyl->dim.radius > 0 && atCyl->dim.height > 0 && acTris->count > 0 && acTris->elements != NULL) {
|
if (atCyl->element.dim.radius > 0 && atCyl->element.dim.height > 0 && acTris->count > 0 &&
|
||||||
if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true) {
|
acTris->elements != NULL) {
|
||||||
|
if (CollisionCheck_SkipElementTouch(&atCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (acTrisElem = acTris->elements; acTrisElem < acTris->elements + acTris->count; acTrisElem++) {
|
for (acTrisElem = acTris->elements; acTrisElem < acTris->elements + acTris->count; acTrisElem++) {
|
||||||
if (CollisionCheck_SkipElementBump(&acTrisElem->base) == true) {
|
if (CollisionCheck_SkipElementBump(&acTrisElem->base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acTrisElem->base) == true) {
|
if (CollisionCheck_NoSharedFlags(&atCyl->element.base, &acTrisElem->base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Math3D_CylTriVsIntersect(&atCyl->dim, &acTrisElem->dim, &hitPos) == true) {
|
if (Math3D_CylTriVsIntersect(&atCyl->element.dim, &acTrisElem->dim, &hitPos) == true) {
|
||||||
Vec3f atPos;
|
Vec3f atPos;
|
||||||
Vec3f acPos;
|
Vec3f acPos;
|
||||||
|
|
||||||
Math_Vec3s_ToVec3f(&atPos, &atCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&atPos, &atCyl->element.dim.pos);
|
||||||
|
|
||||||
acPos.x = (acTrisElem->dim.vtx[0].x + acTrisElem->dim.vtx[1].x + acTrisElem->dim.vtx[2].x) * (1.0f / 3);
|
acPos.x = (acTrisElem->dim.vtx[0].x + acTrisElem->dim.vtx[1].x + acTrisElem->dim.vtx[2].x) * (1.0f / 3);
|
||||||
acPos.y = (acTrisElem->dim.vtx[0].y + acTrisElem->dim.vtx[1].y + acTrisElem->dim.vtx[2].y) * (1.0f / 3);
|
acPos.y = (acTrisElem->dim.vtx[0].y + acTrisElem->dim.vtx[1].y + acTrisElem->dim.vtx[2].y) * (1.0f / 3);
|
||||||
acPos.z = (acTrisElem->dim.vtx[0].z + acTrisElem->dim.vtx[1].z + acTrisElem->dim.vtx[2].z) * (1.0f / 3);
|
acPos.z = (acTrisElem->dim.vtx[0].z + acTrisElem->dim.vtx[1].z + acTrisElem->dim.vtx[2].z) * (1.0f / 3);
|
||||||
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->elem, &atPos, &acTris->base, &acTrisElem->base,
|
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->element.base, &atPos, &acTris->base,
|
||||||
&acPos, &hitPos);
|
&acTrisElem->base, &acPos, &hitPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2156,25 +2162,26 @@ void CollisionCheck_ATTrisVsACCyl(PlayState* play, CollisionCheckContext* colChk
|
||||||
Vec3f atPos;
|
Vec3f atPos;
|
||||||
Vec3f acPos;
|
Vec3f acPos;
|
||||||
|
|
||||||
if (acCyl->dim.radius > 0 && acCyl->dim.height > 0 && atTris->count > 0 && atTris->elements != NULL) {
|
if (acCyl->element.dim.radius > 0 && acCyl->element.dim.height > 0 && atTris->count > 0 &&
|
||||||
if (CollisionCheck_SkipElementBump(&acCyl->elem) == true) {
|
atTris->elements != NULL) {
|
||||||
|
if (CollisionCheck_SkipElementBump(&acCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (atTrisElem = atTris->elements; atTrisElem < atTris->elements + atTris->count; atTrisElem++) {
|
for (atTrisElem = atTris->elements; atTrisElem < atTris->elements + atTris->count; atTrisElem++) {
|
||||||
if (CollisionCheck_SkipElementTouch(&atTrisElem->base) == true) {
|
if (CollisionCheck_SkipElementTouch(&atTrisElem->base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_NoSharedFlags(&atTrisElem->base, &acCyl->elem) == true) {
|
if (CollisionCheck_NoSharedFlags(&atTrisElem->base, &acCyl->element.base) == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math3D_CylTriVsIntersect(&acCyl->dim, &atTrisElem->dim, &hitPos) == true) {
|
if (Math3D_CylTriVsIntersect(&acCyl->element.dim, &atTrisElem->dim, &hitPos) == true) {
|
||||||
atPos.x = (atTrisElem->dim.vtx[0].x + atTrisElem->dim.vtx[1].x + atTrisElem->dim.vtx[2].x) * (1.0f / 3);
|
atPos.x = (atTrisElem->dim.vtx[0].x + atTrisElem->dim.vtx[1].x + atTrisElem->dim.vtx[2].x) * (1.0f / 3);
|
||||||
atPos.y = (atTrisElem->dim.vtx[0].y + atTrisElem->dim.vtx[1].y + atTrisElem->dim.vtx[2].y) * (1.0f / 3);
|
atPos.y = (atTrisElem->dim.vtx[0].y + atTrisElem->dim.vtx[1].y + atTrisElem->dim.vtx[2].y) * (1.0f / 3);
|
||||||
atPos.z = (atTrisElem->dim.vtx[0].z + atTrisElem->dim.vtx[1].z + atTrisElem->dim.vtx[2].z) * (1.0f / 3);
|
atPos.z = (atTrisElem->dim.vtx[0].z + atTrisElem->dim.vtx[1].z + atTrisElem->dim.vtx[2].z) * (1.0f / 3);
|
||||||
Math_Vec3s_ToVec3f(&acPos, &acCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&acPos, &acCyl->element.dim.pos);
|
||||||
CollisionCheck_SetATvsAC(play, &atTris->base, &atTrisElem->base, &atPos, &acCyl->base, &acCyl->elem,
|
CollisionCheck_SetATvsAC(play, &atTris->base, &atTrisElem->base, &atPos, &acCyl->base,
|
||||||
&acPos, &hitPos);
|
&acCyl->element.base, &acPos, &hitPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2188,21 +2195,21 @@ void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChk
|
||||||
ColliderCylinder* atCyl = (ColliderCylinder*)atCol;
|
ColliderCylinder* atCyl = (ColliderCylinder*)atCol;
|
||||||
ColliderQuad* acQuad = (ColliderQuad*)acCol;
|
ColliderQuad* acQuad = (ColliderQuad*)acCol;
|
||||||
|
|
||||||
if (atCyl->dim.height > 0 && atCyl->dim.radius > 0) {
|
if (atCyl->element.dim.height > 0 && atCyl->element.dim.radius > 0) {
|
||||||
if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true ||
|
if (CollisionCheck_SkipElementTouch(&atCyl->element.base) == true ||
|
||||||
CollisionCheck_SkipElementBump(&acQuad->elem) == true) {
|
CollisionCheck_SkipElementBump(&acQuad->elem) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acQuad->elem) == true) {
|
if (CollisionCheck_NoSharedFlags(&atCyl->element.base, &acQuad->elem) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Math3D_TriNorm(&tri1, &acQuad->dim.quad[2], &acQuad->dim.quad[3], &acQuad->dim.quad[1]);
|
Math3D_TriNorm(&tri1, &acQuad->dim.quad[2], &acQuad->dim.quad[3], &acQuad->dim.quad[1]);
|
||||||
Math3D_TriNorm(&tri2, &acQuad->dim.quad[1], &acQuad->dim.quad[0], &acQuad->dim.quad[2]);
|
Math3D_TriNorm(&tri2, &acQuad->dim.quad[1], &acQuad->dim.quad[0], &acQuad->dim.quad[2]);
|
||||||
if (Math3D_CylTriVsIntersect(&atCyl->dim, &tri1, &hitPos) == true) {
|
if (Math3D_CylTriVsIntersect(&atCyl->element.dim, &tri1, &hitPos) == true) {
|
||||||
Vec3f atPos1;
|
Vec3f atPos1;
|
||||||
Vec3f acPos1;
|
Vec3f acPos1;
|
||||||
|
|
||||||
Math_Vec3s_ToVec3f(&atPos1, &atCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&atPos1, &atCyl->element.dim.pos);
|
||||||
acPos1.x =
|
acPos1.x =
|
||||||
(acQuad->dim.quad[0].x + (acQuad->dim.quad[1].x + (acQuad->dim.quad[3].x + acQuad->dim.quad[2].x))) /
|
(acQuad->dim.quad[0].x + (acQuad->dim.quad[1].x + (acQuad->dim.quad[3].x + acQuad->dim.quad[2].x))) /
|
||||||
4.0f;
|
4.0f;
|
||||||
|
@ -2212,13 +2219,13 @@ void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChk
|
||||||
acPos1.z =
|
acPos1.z =
|
||||||
(acQuad->dim.quad[0].z + (acQuad->dim.quad[1].z + (acQuad->dim.quad[3].z + acQuad->dim.quad[2].z))) /
|
(acQuad->dim.quad[0].z + (acQuad->dim.quad[1].z + (acQuad->dim.quad[3].z + acQuad->dim.quad[2].z))) /
|
||||||
4.0f;
|
4.0f;
|
||||||
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->elem, &atPos1, &acQuad->base, &acQuad->elem, &acPos1,
|
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->element.base, &atPos1, &acQuad->base, &acQuad->elem,
|
||||||
&hitPos);
|
&acPos1, &hitPos);
|
||||||
} else if (Math3D_CylTriVsIntersect(&atCyl->dim, &tri2, &hitPos) == true) {
|
} else if (Math3D_CylTriVsIntersect(&atCyl->element.dim, &tri2, &hitPos) == true) {
|
||||||
Vec3f atPos2;
|
Vec3f atPos2;
|
||||||
Vec3f acPos2;
|
Vec3f acPos2;
|
||||||
|
|
||||||
Math_Vec3s_ToVec3f(&atPos2, &atCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&atPos2, &atCyl->element.dim.pos);
|
||||||
acPos2.x =
|
acPos2.x =
|
||||||
(acQuad->dim.quad[0].x + (acQuad->dim.quad[1].x + (acQuad->dim.quad[3].x + acQuad->dim.quad[2].x))) /
|
(acQuad->dim.quad[0].x + (acQuad->dim.quad[1].x + (acQuad->dim.quad[3].x + acQuad->dim.quad[2].x))) /
|
||||||
4.0f;
|
4.0f;
|
||||||
|
@ -2228,8 +2235,8 @@ void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChk
|
||||||
acPos2.z =
|
acPos2.z =
|
||||||
(acQuad->dim.quad[0].z + (acQuad->dim.quad[1].z + (acQuad->dim.quad[3].z + acQuad->dim.quad[2].z))) /
|
(acQuad->dim.quad[0].z + (acQuad->dim.quad[1].z + (acQuad->dim.quad[3].z + acQuad->dim.quad[2].z))) /
|
||||||
4.0f;
|
4.0f;
|
||||||
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->elem, &atPos2, &acQuad->base, &acQuad->elem, &acPos2,
|
CollisionCheck_SetATvsAC(play, &atCyl->base, &atCyl->element.base, &atPos2, &acQuad->base, &acQuad->elem,
|
||||||
&hitPos);
|
&acPos2, &hitPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2244,17 +2251,17 @@ void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChk
|
||||||
ColliderQuad* atQuad = (ColliderQuad*)atCol;
|
ColliderQuad* atQuad = (ColliderQuad*)atCol;
|
||||||
ColliderCylinder* acCyl = (ColliderCylinder*)acCol;
|
ColliderCylinder* acCyl = (ColliderCylinder*)acCol;
|
||||||
|
|
||||||
if (acCyl->dim.height > 0 && acCyl->dim.radius > 0) {
|
if (acCyl->element.dim.height > 0 && acCyl->element.dim.radius > 0) {
|
||||||
if (CollisionCheck_SkipElementBump(&acCyl->elem) == true ||
|
if (CollisionCheck_SkipElementBump(&acCyl->element.base) == true ||
|
||||||
CollisionCheck_SkipElementTouch(&atQuad->elem) == true) {
|
CollisionCheck_SkipElementTouch(&atQuad->elem) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (CollisionCheck_NoSharedFlags(&atQuad->elem, &acCyl->elem) == true) {
|
if (CollisionCheck_NoSharedFlags(&atQuad->elem, &acCyl->element.base) == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Math3D_TriNorm(&tri1, &atQuad->dim.quad[2], &atQuad->dim.quad[3], &atQuad->dim.quad[1]);
|
Math3D_TriNorm(&tri1, &atQuad->dim.quad[2], &atQuad->dim.quad[3], &atQuad->dim.quad[1]);
|
||||||
Math3D_TriNorm(&tri2, &atQuad->dim.quad[2], &atQuad->dim.quad[1], &atQuad->dim.quad[0]);
|
Math3D_TriNorm(&tri2, &atQuad->dim.quad[2], &atQuad->dim.quad[1], &atQuad->dim.quad[0]);
|
||||||
if (Math3D_CylTriVsIntersect(&acCyl->dim, &tri1, &hitPos) == true) {
|
if (Math3D_CylTriVsIntersect(&acCyl->element.dim, &tri1, &hitPos) == true) {
|
||||||
if (Collider_QuadSetNearestAC(play, atQuad, &hitPos)) {
|
if (Collider_QuadSetNearestAC(play, atQuad, &hitPos)) {
|
||||||
Vec3f atPos1;
|
Vec3f atPos1;
|
||||||
Vec3f acPos1;
|
Vec3f acPos1;
|
||||||
|
@ -2268,13 +2275,13 @@ void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChk
|
||||||
atPos1.z = (atQuad->dim.quad[0].z +
|
atPos1.z = (atQuad->dim.quad[0].z +
|
||||||
(atQuad->dim.quad[1].z + (atQuad->dim.quad[3].z + atQuad->dim.quad[2].z))) /
|
(atQuad->dim.quad[1].z + (atQuad->dim.quad[3].z + atQuad->dim.quad[2].z))) /
|
||||||
4.0f;
|
4.0f;
|
||||||
Math_Vec3s_ToVec3f(&acPos1, &acCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&acPos1, &acCyl->element.dim.pos);
|
||||||
CollisionCheck_SetATvsAC(play, &atQuad->base, &atQuad->elem, &atPos1, &acCyl->base, &acCyl->elem,
|
CollisionCheck_SetATvsAC(play, &atQuad->base, &atQuad->elem, &atPos1, &acCyl->base,
|
||||||
&acPos1, &hitPos);
|
&acCyl->element.base, &acPos1, &hitPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Math3D_CylTriVsIntersect(&acCyl->dim, &tri2, &hitPos) == true) {
|
if (Math3D_CylTriVsIntersect(&acCyl->element.dim, &tri2, &hitPos) == true) {
|
||||||
if (Collider_QuadSetNearestAC(play, atQuad, &hitPos)) {
|
if (Collider_QuadSetNearestAC(play, atQuad, &hitPos)) {
|
||||||
Vec3f atPos2;
|
Vec3f atPos2;
|
||||||
Vec3f acPos2;
|
Vec3f acPos2;
|
||||||
|
@ -2288,9 +2295,9 @@ void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChk
|
||||||
atPos2.z = (atQuad->dim.quad[0].z +
|
atPos2.z = (atQuad->dim.quad[0].z +
|
||||||
(atQuad->dim.quad[1].z + (atQuad->dim.quad[3].z + atQuad->dim.quad[2].z))) /
|
(atQuad->dim.quad[1].z + (atQuad->dim.quad[3].z + atQuad->dim.quad[2].z))) /
|
||||||
4.0f;
|
4.0f;
|
||||||
Math_Vec3s_ToVec3f(&acPos2, &acCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&acPos2, &acCyl->element.dim.pos);
|
||||||
CollisionCheck_SetATvsAC(play, &atQuad->base, &atQuad->elem, &atPos2, &acCyl->base, &acCyl->elem,
|
CollisionCheck_SetATvsAC(play, &atQuad->base, &atQuad->elem, &atPos2, &acCyl->base,
|
||||||
&acPos2, &hitPos);
|
&acCyl->element.base, &acPos2, &hitPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2530,11 +2537,12 @@ void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colChkCt
|
||||||
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
||||||
Vec3f hitPos;
|
Vec3f hitPos;
|
||||||
|
|
||||||
if ((cyl->elem.bumperFlags & BUMP_DRAW_HITMARK) && (cyl->elem.acHitInfo != NULL) &&
|
if ((cyl->element.base.bumperFlags & BUMP_DRAW_HITMARK) && (cyl->element.base.acHitInfo != NULL) &&
|
||||||
!(cyl->elem.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) {
|
!(cyl->element.base.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) {
|
||||||
Math_Vec3s_ToVec3f(&hitPos, &cyl->elem.bumper.hitPos);
|
Math_Vec3s_ToVec3f(&hitPos, &cyl->element.base.bumper.hitPos);
|
||||||
CollisionCheck_HitEffects(play, cyl->elem.acHit, cyl->elem.acHitInfo, &cyl->base, &cyl->elem, &hitPos);
|
CollisionCheck_HitEffects(play, cyl->element.base.acHit, cyl->element.base.acHitInfo, &cyl->base,
|
||||||
cyl->elem.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK;
|
&cyl->element.base, &hitPos);
|
||||||
|
cyl->element.base.acHitInfo->toucherFlags |= TOUCH_DREW_HITMARK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2829,20 +2837,21 @@ void CollisionCheck_OC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCh
|
||||||
f32 overlap;
|
f32 overlap;
|
||||||
|
|
||||||
if (leftJntSph->count > 0 && leftJntSph->elements != NULL) {
|
if (leftJntSph->count > 0 && leftJntSph->elements != NULL) {
|
||||||
if ((rightCyl->base.ocFlags1 & OC1_ON) && (rightCyl->elem.ocElemFlags & OCELEM_ON)) {
|
if ((rightCyl->base.ocFlags1 & OC1_ON) && (rightCyl->element.base.ocElemFlags & OCELEM_ON)) {
|
||||||
for (leftJntSphElem = leftJntSph->elements; leftJntSphElem < leftJntSph->elements + leftJntSph->count;
|
for (leftJntSphElem = leftJntSph->elements; leftJntSphElem < leftJntSph->elements + leftJntSph->count;
|
||||||
leftJntSphElem++) {
|
leftJntSphElem++) {
|
||||||
if (!(leftJntSphElem->base.ocElemFlags & OCELEM_ON)) {
|
if (!(leftJntSphElem->base.ocElemFlags & OCELEM_ON)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Math3D_SphVsCylOverlapDist(&leftJntSphElem->dim.worldSphere, &rightCyl->dim, &overlap) == true) {
|
if (Math3D_SphVsCylOverlapDist(&leftJntSphElem->dim.worldSphere, &rightCyl->element.dim, &overlap) ==
|
||||||
|
true) {
|
||||||
Vec3f leftPos;
|
Vec3f leftPos;
|
||||||
Vec3f rightPos;
|
Vec3f rightPos;
|
||||||
|
|
||||||
Math_Vec3s_ToVec3f(&leftPos, &leftJntSphElem->dim.worldSphere.center);
|
Math_Vec3s_ToVec3f(&leftPos, &leftJntSphElem->dim.worldSphere.center);
|
||||||
Math_Vec3s_ToVec3f(&rightPos, &rightCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&rightPos, &rightCyl->element.dim.pos);
|
||||||
CollisionCheck_SetOCvsOC(&leftJntSph->base, &leftJntSphElem->base, &leftPos, &rightCyl->base,
|
CollisionCheck_SetOCvsOC(&leftJntSph->base, &leftJntSphElem->base, &leftPos, &rightCyl->base,
|
||||||
&rightCyl->elem, &rightPos, overlap);
|
&rightCyl->element.base, &rightPos, overlap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2861,15 +2870,15 @@ void CollisionCheck_OC_CylVsCyl(PlayState* play, CollisionCheckContext* colChkCt
|
||||||
f32 deadSpace;
|
f32 deadSpace;
|
||||||
|
|
||||||
if ((leftCyl->base.ocFlags1 & OC1_ON) && (rightCyl->base.ocFlags1 & OC1_ON)) {
|
if ((leftCyl->base.ocFlags1 & OC1_ON) && (rightCyl->base.ocFlags1 & OC1_ON)) {
|
||||||
if ((leftCyl->elem.ocElemFlags & OCELEM_ON) && (rightCyl->elem.ocElemFlags & OCELEM_ON)) {
|
if ((leftCyl->element.base.ocElemFlags & OCELEM_ON) && (rightCyl->element.base.ocElemFlags & OCELEM_ON)) {
|
||||||
if (Math3D_CylOutsideCyl(&leftCyl->dim, &rightCyl->dim, &deadSpace) == true) {
|
if (Math3D_CylOutsideCyl(&leftCyl->element.dim, &rightCyl->element.dim, &deadSpace) == true) {
|
||||||
Vec3f leftPos;
|
Vec3f leftPos;
|
||||||
Vec3f rightPos;
|
Vec3f rightPos;
|
||||||
|
|
||||||
Math_Vec3s_ToVec3f(&leftPos, &leftCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&leftPos, &leftCyl->element.dim.pos);
|
||||||
Math_Vec3s_ToVec3f(&rightPos, &rightCyl->dim.pos);
|
Math_Vec3s_ToVec3f(&rightPos, &rightCyl->element.dim.pos);
|
||||||
CollisionCheck_SetOCvsOC(&leftCyl->base, &leftCyl->elem, &leftPos, &rightCyl->base, &rightCyl->elem,
|
CollisionCheck_SetOCvsOC(&leftCyl->base, &leftCyl->element.base, &leftPos, &rightCyl->base,
|
||||||
&rightPos, deadSpace);
|
&rightCyl->element.base, &rightPos, deadSpace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3090,7 +3099,7 @@ void CollisionCheck_ApplyDamageJntSph(PlayState* play, CollisionCheckContext* co
|
||||||
void CollisionCheck_ApplyDamageCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* col) {
|
void CollisionCheck_ApplyDamageCyl(PlayState* play, CollisionCheckContext* colChkCtx, Collider* col) {
|
||||||
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
||||||
|
|
||||||
CollisionCheck_ApplyDamage(play, colChkCtx, &cyl->base, &cyl->elem);
|
CollisionCheck_ApplyDamage(play, colChkCtx, &cyl->base, &cyl->element.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3174,10 +3183,10 @@ s32 CollisionCheck_LineOC_Cyl(PlayState* play, CollisionCheckContext* colChkCtx,
|
||||||
static Vec3f intersectB;
|
static Vec3f intersectB;
|
||||||
ColliderCylinder* cylinder = (ColliderCylinder*)collider;
|
ColliderCylinder* cylinder = (ColliderCylinder*)collider;
|
||||||
|
|
||||||
if (!(cylinder->elem.ocElemFlags & OCELEM_ON)) {
|
if (!(cylinder->element.base.ocElemFlags & OCELEM_ON)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Math3D_CylVsLineSeg(&cylinder->dim, a, b, &intersectA, &intersectB) != 0) {
|
if (Math3D_CylVsLineSeg(&cylinder->element.dim, a, b, &intersectA, &intersectB) != 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -3251,18 +3260,18 @@ s32 CollisionCheck_LineOCCheck(PlayState* play, CollisionCheckContext* colChkCtx
|
||||||
* Moves the ColliderCylinder's position to the actor's position
|
* Moves the ColliderCylinder's position to the actor's position
|
||||||
*/
|
*/
|
||||||
void Collider_UpdateCylinder(Actor* actor, ColliderCylinder* cyl) {
|
void Collider_UpdateCylinder(Actor* actor, ColliderCylinder* cyl) {
|
||||||
cyl->dim.pos.x = actor->world.pos.x;
|
cyl->element.dim.pos.x = actor->world.pos.x;
|
||||||
cyl->dim.pos.y = actor->world.pos.y;
|
cyl->element.dim.pos.y = actor->world.pos.y;
|
||||||
cyl->dim.pos.z = actor->world.pos.z;
|
cyl->element.dim.pos.z = actor->world.pos.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ColliderCylinder's position
|
* Sets the ColliderCylinder's position
|
||||||
*/
|
*/
|
||||||
void Collider_SetCylinderPosition(ColliderCylinder* cyl, Vec3s* pos) {
|
void Collider_SetCylinderPosition(ColliderCylinder* cyl, Vec3s* pos) {
|
||||||
cyl->dim.pos.x = pos->x;
|
cyl->element.dim.pos.x = pos->x;
|
||||||
cyl->dim.pos.y = pos->y;
|
cyl->element.dim.pos.y = pos->y;
|
||||||
cyl->dim.pos.z = pos->z;
|
cyl->element.dim.pos.z = pos->z;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,14 +42,16 @@ static ColliderCylinderInit sCylinderInit = {
|
||||||
COLSHAPE_CYLINDER,
|
COLSHAPE_CYLINDER,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ELEMTYPE_UNK2,
|
{
|
||||||
{ 0x00000000, 0x00, 0x00 },
|
ELEMTYPE_UNK2,
|
||||||
{ 0xFFCFFFFF, 0x00, 0x00 },
|
{ 0x00000000, 0x00, 0x00 },
|
||||||
TOUCH_NONE,
|
{ 0xFFCFFFFF, 0x00, 0x00 },
|
||||||
BUMP_ON,
|
TOUCH_NONE,
|
||||||
OCELEM_ON,
|
BUMP_ON,
|
||||||
|
OCELEM_ON,
|
||||||
|
},
|
||||||
|
{ 25, 60, 0, { 0, 0, 0 } },
|
||||||
},
|
},
|
||||||
{ 25, 60, 0, { 0, 0, 0 } },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @bug gHookshotPostCol and gHookshotPostDL are referenced below for type A_OBJ_UNKNOWN_6 but they aren't available
|
//! @bug gHookshotPostCol and gHookshotPostDL are referenced below for type A_OBJ_UNKNOWN_6 but they aren't available
|
||||||
|
|
|
@ -42,14 +42,16 @@ static ColliderCylinderInit sCylinderInit = {
|
||||||
COLSHAPE_CYLINDER,
|
COLSHAPE_CYLINDER,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ELEMTYPE_UNK0,
|
{
|
||||||
{ 0x00000000, 0x00, 0x00 },
|
ELEMTYPE_UNK0,
|
||||||
{ 0x00000010, 0x00, 0x00 },
|
{ 0x00000000, 0x00, 0x00 },
|
||||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
{ 0x00000010, 0x00, 0x00 },
|
||||||
BUMP_ON,
|
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||||
OCELEM_NONE,
|
BUMP_ON,
|
||||||
|
OCELEM_NONE,
|
||||||
|
},
|
||||||
|
{ 10, 30, 0, { 0, 0, 0 } },
|
||||||
},
|
},
|
||||||
{ 10, 30, 0, { 0, 0, 0 } },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static InitChainEntry sInitChain[] = {
|
static InitChainEntry sInitChain[] = {
|
||||||
|
|
|
@ -51,14 +51,16 @@ static ColliderCylinderInit sCylinderInit = {
|
||||||
COLSHAPE_CYLINDER,
|
COLSHAPE_CYLINDER,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ELEMTYPE_UNK0,
|
{
|
||||||
{ 0xFFCFFFFF, 0x00, 0x04 },
|
ELEMTYPE_UNK0,
|
||||||
{ 0xFFCFFFFF, 0x00, 0x00 },
|
{ 0xFFCFFFFF, 0x00, 0x04 },
|
||||||
TOUCH_ON | TOUCH_SFX_NORMAL,
|
{ 0xFFCFFFFF, 0x00, 0x00 },
|
||||||
BUMP_ON,
|
TOUCH_ON | TOUCH_SFX_NORMAL,
|
||||||
OCELEM_ON,
|
BUMP_ON,
|
||||||
|
OCELEM_ON,
|
||||||
|
},
|
||||||
|
{ 30, 90, 0, { 0, 0, 0 } },
|
||||||
},
|
},
|
||||||
{ 30, 90, 0, { 0, 0, 0 } },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static ColliderTrisElementInit sTrisElementsInit[2] = {
|
static ColliderTrisElementInit sTrisElementsInit[2] = {
|
||||||
|
@ -120,7 +122,7 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) {
|
||||||
|
|
||||||
if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) {
|
if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) {
|
||||||
this->timer = 20;
|
this->timer = 20;
|
||||||
this->colliderCylinder.dim.yShift = 10;
|
this->colliderCylinder.element.dim.yShift = 10;
|
||||||
thisx->velocity.y = 0.1f;
|
thisx->velocity.y = 0.1f;
|
||||||
|
|
||||||
if (thisx->params == HAKA_TRAP_GUILLOTINE_FAST) {
|
if (thisx->params == HAKA_TRAP_GUILLOTINE_FAST) {
|
||||||
|
@ -149,8 +151,8 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) {
|
||||||
thisx->floorHeight = thisx->home.pos.y - 225.0f;
|
thisx->floorHeight = thisx->home.pos.y - 225.0f;
|
||||||
this->unk_16A = (thisx->floorHeight + 50.0f) - 25.0f;
|
this->unk_16A = (thisx->floorHeight + 50.0f) - 25.0f;
|
||||||
|
|
||||||
this->colliderCylinder.dim.radius = 10;
|
this->colliderCylinder.element.dim.radius = 10;
|
||||||
this->colliderCylinder.dim.height = 40;
|
this->colliderCylinder.element.dim.height = 40;
|
||||||
} else {
|
} else {
|
||||||
if (thisx->params == HAKA_TRAP_SPIKED_WALL) {
|
if (thisx->params == HAKA_TRAP_SPIKED_WALL) {
|
||||||
CollisionHeader_GetVirtual(&object_haka_objects_Col_0081D0, &colHeader);
|
CollisionHeader_GetVirtual(&object_haka_objects_Col_0081D0, &colHeader);
|
||||||
|
@ -163,11 +165,11 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) {
|
||||||
Collider_InitTris(play, &this->colliderSpikes);
|
Collider_InitTris(play, &this->colliderSpikes);
|
||||||
Collider_SetTris(play, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem);
|
Collider_SetTris(play, &this->colliderSpikes, thisx, &sTrisInit, this->colliderSpikesItem);
|
||||||
|
|
||||||
this->colliderCylinder.dim.radius = 18;
|
this->colliderCylinder.element.dim.radius = 18;
|
||||||
this->colliderCylinder.dim.height = 115;
|
this->colliderCylinder.element.dim.height = 115;
|
||||||
|
|
||||||
this->colliderCylinder.elem.toucherFlags &= ~TOUCH_SFX_NORMAL;
|
this->colliderCylinder.element.base.toucherFlags &= ~TOUCH_SFX_NORMAL;
|
||||||
this->colliderCylinder.elem.toucherFlags |= TOUCH_SFX_WOOD;
|
this->colliderCylinder.element.base.toucherFlags |= TOUCH_SFX_WOOD;
|
||||||
|
|
||||||
this->actionFunc = func_808801B8;
|
this->actionFunc = func_808801B8;
|
||||||
}
|
}
|
||||||
|
@ -222,8 +224,8 @@ void func_8087FFC0(BgHakaTrap* this, PlayState* play) {
|
||||||
sp28.z = zNonNegative * 15.0f;
|
sp28.z = zNonNegative * 15.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->colliderCylinder.dim.pos.x = this->dyna.actor.world.pos.x + sp28.x * cosine + sp28.z * sine;
|
this->colliderCylinder.element.dim.pos.x = this->dyna.actor.world.pos.x + sp28.x * cosine + sp28.z * sine;
|
||||||
this->colliderCylinder.dim.pos.z = this->dyna.actor.world.pos.z + sp28.x * sine + sp28.z * cosine;
|
this->colliderCylinder.element.dim.pos.z = this->dyna.actor.world.pos.z + sp28.x * sine + sp28.z * cosine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_808801B8(BgHakaTrap* this, PlayState* play) {
|
void func_808801B8(BgHakaTrap* this, PlayState* play) {
|
||||||
|
@ -485,7 +487,7 @@ void BgHakaTrap_Update(Actor* thisx, PlayState* play) {
|
||||||
this->actionFunc(this, play);
|
this->actionFunc(this, play);
|
||||||
|
|
||||||
if ((this->dyna.actor.params != HAKA_TRAP_PROPELLER) && (thisx->params != HAKA_TRAP_SPIKED_BOX)) {
|
if ((this->dyna.actor.params != HAKA_TRAP_PROPELLER) && (thisx->params != HAKA_TRAP_SPIKED_BOX)) {
|
||||||
this->colliderCylinder.dim.pos.y = actorPos->y;
|
this->colliderCylinder.element.dim.pos.y = actorPos->y;
|
||||||
|
|
||||||
if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) {
|
if ((thisx->params == HAKA_TRAP_GUILLOTINE_SLOW) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) {
|
||||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base);
|
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base);
|
||||||
|
|
Loading…
Add table
Reference in a new issue