mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
more cleanup
This commit is contained in:
+1
-1
@@ -1190,7 +1190,7 @@ typedef struct {
|
||||
/* 0x00 */ Vec3f unk_00;
|
||||
/* 0x0C */ Vec3f unk_0C;
|
||||
/* 0x18 */ f32 unk_18;
|
||||
/* 0x1C */ Linef unk_1C;
|
||||
/* 0x1C */ InfiniteLine unk_1C;
|
||||
/* 0x34 */ Vec3s unk_34;
|
||||
/* 0x3A */ s16 unk_3A;
|
||||
/* 0x3C */ s16 timer;
|
||||
|
||||
+20
-20
@@ -223,20 +223,20 @@ f32 Math_Atan2F_XY(f32 x, f32 y);
|
||||
f32 Math3D_Normalize(Vec3f* vec);
|
||||
s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* closestPoint);
|
||||
s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB, Vec3f* lineAClosestToB, Vec3f* lineBClosestToA);
|
||||
f32 Math3D_LineClosestToPoint(Linef* line, Vec3f* pos, Vec3f* closestPoint);
|
||||
f32 Math3D_LineClosestToPoint(InfiniteLine* line, Vec3f* pos, Vec3f* closestPoint);
|
||||
void Math3D_FindPointOnPlaneIntersect(float planeAAxis1Norm, f32 planeAAxis2Norm, f32 planeBAxis1Norm, f32 planeBAxis2Norm, f32 axis3Direction, f32 planeADist, f32 planeBDist, float* axis1Point, float* axis2Point);
|
||||
s32 Math3D_PlaneVsPlaneNewLine(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, InfiniteLine* intersect);
|
||||
// void Math3D_PlaneVsPlaneVsLineClosestPoint(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10);
|
||||
s32 Math3D_PlaneVsPlaneVsLineClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* point, Vec3f* closestPoint);
|
||||
void Math3D_PointOnDirectedLine(Vec3f* v0, Vec3f* dir, f32 scale, Vec3f* ret);
|
||||
void Math3D_LineSplitRatio(Vec3f* v0, Vec3f* v1, f32 ratio, Vec3f* ret);
|
||||
f32 Math3D_Cos(Vec3f* a, Vec3f* b);
|
||||
s32 Math3D_CosOut(Vec3f* a, Vec3f* b, f32* dst);
|
||||
void Math3D_Vec3fReflect(Vec3f* vec, Vec3f* normal, Vec3f* reflVec);
|
||||
s32 Math3D_PointInSquare2D(f32 upperLeftX, f32 lowerRightX, f32 upperLeftY, f32 lowerRightY, f32 x, f32 y);
|
||||
// void func_8017A09C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_8017A1D0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
s32 func_8017A09C(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2, f32 arg3, f32 arg4, f32 arg5);
|
||||
s32 func_8017A1D0(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2, f32 arg3, f32 arg4, f32 arg5);
|
||||
s32 func_8017A304(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2, f32 arg3, f32 arg4, f32 arg5);
|
||||
// UNK_TYPE4 func_8017A438(Vec3f* pfParm1, Vec3f* pfParm2, Vec3f* pfParm3, Vec3f* pfParm4, f32 param_5);
|
||||
s32 Math3D_SphCubeVsTriCube(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4);
|
||||
f32 Math3D_Dist1DSq(f32 a, f32 b);
|
||||
f32 Math3D_Dist1D(f32 a, f32 b);
|
||||
f32 Math3D_Dist2DSq(f32 x0, f32 y0, f32 x1, f32 y1);
|
||||
@@ -263,28 +263,28 @@ f32 Math3D_Plane(Plane* plane, Vec3f* pointOnPlane);
|
||||
f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p);
|
||||
f32 Math3D_DistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p);
|
||||
s32 Math3D_TriChkPointParaYImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 z, f32 x, f32 detMax, f32 chkDist, f32 ny);
|
||||
// void Math3D_TriChkPointParaYDeterminate(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void Math3D_TriChkPointParaYSlopedY(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
s32 Math3D_TriChkPointParaYDeterminate(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 z, f32 x, f32 detMax, f32 ny);
|
||||
s32 Math3D_TriChkPointParaYSlopedY(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 z, f32 x);
|
||||
s32 Math3D_TriChkPointParaYIntersectDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, f32 x, f32* yIntersect, f32 chkDist);
|
||||
s32 Math3D_TriChkPointParaYIntersectInsideTri(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, f32 x, f32* yIntersect, f32 chkDist);
|
||||
// void Math3D_TriChkPointParaY(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
s32 Math3D_TriChkPointParaY(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 ny, f32 z, f32 x);
|
||||
s32 Math3D_TriChkLineSegParaYIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, f32 x, f32* yIntersect, f32 y0, f32 y1);
|
||||
// void Math3D_TriChkPointParaYDist(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void Math3D_TriChkPointParaYImplNoCheckRange(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8);
|
||||
s32 Math3D_TriChkPointParaYDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 z, f32 x, f32 chkDist);
|
||||
s32 Math3D_TriChkPointParaYImplNoCheckRange(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 z, f32 x, f32 detMax, f32 chkDist, f32 ny);
|
||||
s32 Math3D_TriChkPointParaYNoRangeCheckIntersectInsideTri(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, f32 x, f32* yIntersect, f32 chkDist);
|
||||
s32 Math3D_TriChkPointParaXImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f32 z, f32 detMax, f32 chkDist, f32 ny);
|
||||
// void Math3D_TriChkPointParaXDeterminate(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
s32 Math3D_TriChkPointParaXDeterminate(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f32 z, f32 detMax, f32 nx);
|
||||
s32 Math3D_TriChkPointParaXIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 y, f32 z, f32* xIntersect);
|
||||
// void Math3D_TriChkPointParaX(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
s32 Math3D_TriChkPointParaX(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 y, f32 z);
|
||||
s32 Math3D_TriChkLineSegParaXIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 y, f32 z, f32* xIntersect, f32 x0, f32 x1);
|
||||
// void Math3D_TriChkLineSegParaXDist(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
s32 Math3D_TriChkLineSegParaXDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 y, f32 z, f32 chkDist);
|
||||
s32 Math3D_TriChkPointParaZImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 x, f32 y, f32 detMax, f32 chkDist, f32 nz);
|
||||
// void Math3D_TriChkPointParaZDeterminate(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
s32 Math3D_TriChkPointParaZDeterminate(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f32 z, f32 detMax, f32 nx);
|
||||
s32 Math3D_TriChkPointParaZIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x, f32 y, f32* zIntersect);
|
||||
// void Math3D_TriChkPointParaZ(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
s32 Math3D_TriChkPointParaZ(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 y, f32 z);
|
||||
s32 Math3D_TriChkLineSegParaZIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x, f32 y, f32* zIntersect, f32 z0, f32 z1);
|
||||
// void Math3D_TriChkLineSegParaZDist(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void Math3D_LineSegFindPlaneIntersect(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
s32 Math3D_TriChkLineSegParaZDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 x, f32 y, f32 chkDist);
|
||||
s32 Math3D_LineSegFindPlaneIntersect(f32 pointADist, f32 pointBDist, Vec3f* pointA, Vec3f* pointB, Vec3f* intersect);
|
||||
s32 Math3D_LineSegVsPlane(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersect, s32 fromFront);
|
||||
s32 Math3D_TriLineIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersect, s32 fromFront) ;
|
||||
void Math3D_TriNorm(TriNorm* tri, Vec3f* va, Vec3f* vb, Vec3f* vc);
|
||||
@@ -300,7 +300,7 @@ s32 Math3D_TriVsSphIntersect(Sphere16* sphere, TriNorm* tri, Vec3f* intersectPoi
|
||||
s32 Math3D_PointInCyl(Cylinder16* cyl, Vec3f* point);
|
||||
s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersectA, Vec3f* intersectB);
|
||||
s32 Math3D_CylTriVsIntersect(Cylinder16* cyl, TriNorm* tri, Vec3f* intersect);
|
||||
// void Math3D_CylVsTri(void);
|
||||
s32 Math3D_CylVsTri(Cylinder16* cyl, TriNorm* tri);
|
||||
s32 Math3D_SphVsSph(Sphere16* sphereA, Sphere16* sphereB);
|
||||
s32 Math3D_SphVsSphOverlap(Sphere16* sphereA, Sphere16* sphereB, f32* overlapSize);
|
||||
s32 Math3D_SphVsSphOverlapCenter(Sphere16* sphereA, Sphere16* sphereB, f32* overlapSize, f32* centerDist);
|
||||
@@ -312,7 +312,7 @@ s32 Math3D_TriVsTriIntersect(TriNorm* ta, TriNorm* tb, Vec3f* intersect);
|
||||
s32 Math3D_XZInSphere(Sphere16* sphere, f32 x, f32 z);
|
||||
s32 Math3D_XYInSphere(Sphere16* sphere, f32 x, f32 y);
|
||||
s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z);
|
||||
// void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11);
|
||||
// void func_8017FD44(void);
|
||||
s32 Math3D_CircleLineIntersections(f32 centreX, f32 centerY, f32 radius, f32 pointX, f32 pointY, f32 dirX, f32 dirY, f32* intersectAX, f32* intersectAY, f32* intersectBX, f32* intersectBY);
|
||||
void func_8017FD44(Vec3f* arg0, Vec3f* arg1, Vec3f* dst, f32 arg3);
|
||||
|
||||
#endif
|
||||
|
||||
+83
-61
@@ -1,6 +1,7 @@
|
||||
#include "z64math.h"
|
||||
#include "libc/stdbool.h"
|
||||
#include "libc/math.h"
|
||||
#include "macros.h"
|
||||
|
||||
f32 Math3D_Normalize(Vec3f* vec) {
|
||||
f32 magnitude = Math3D_Vec3fMagnitude(vec);
|
||||
@@ -51,15 +52,15 @@ s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32
|
||||
* Finds the two points on lines A and B where the lines are closest together.
|
||||
*/
|
||||
s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
|
||||
Vec3f* lineAClosestToB, Vec3f* lineBClosestToA) {
|
||||
Vec3f* lineAClosestToB, Vec3f* lineBClosestToA) {
|
||||
f32 sqMag;
|
||||
f32 scaleB;
|
||||
f32 lineAx;
|
||||
f32 lineAy;
|
||||
f32 lineAz;
|
||||
f32 lineBx;
|
||||
f32 lineBy;
|
||||
f32 lineBz;
|
||||
f32 lineAx = lineAPointB->x - lineAPointA->x;
|
||||
f32 lineAy = lineAPointB->y - lineAPointA->y;
|
||||
f32 lineAz = lineAPointB->z - lineAPointA->z;
|
||||
f32 lineBx = lineBPointB->x - lineBPointA->x;
|
||||
f32 lineBy = lineBPointB->y - lineBPointA->y;
|
||||
f32 lineBz = lineBPointB->z - lineBPointA->z;
|
||||
f32 compAAlongB;
|
||||
f32 compBAAlongB;
|
||||
Vec3f lineAPerpB;
|
||||
@@ -67,14 +68,6 @@ s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f*
|
||||
f32 tA;
|
||||
f32 tB;
|
||||
|
||||
lineAx = lineAPointB->x - lineAPointA->x;
|
||||
lineAy = lineAPointB->y - lineAPointA->y;
|
||||
lineAz = lineAPointB->z - lineAPointA->z;
|
||||
|
||||
lineBx = lineBPointB->x - lineBPointA->x;
|
||||
lineBy = lineBPointB->y - lineBPointA->y;
|
||||
lineBz = lineBPointB->z - lineBPointA->z;
|
||||
|
||||
sqMag = SQ(lineBx) + SQ(lineBy) + SQ(lineBz);
|
||||
if (IS_ZERO(sqMag)) {
|
||||
return false;
|
||||
@@ -118,8 +111,8 @@ s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f*
|
||||
* Determines the closest point on the line `line` to `pos`, by forming a line perpendicular from
|
||||
* `point` to `line` closest point is placed in `closestPoint`
|
||||
*/
|
||||
f32 Math3D_LineClosestToPoint(Linef* line, Vec3f* pos, Vec3f* closestPoint) {
|
||||
f32 dirVectorSize = Math3D_Vec3fMagnitudeSq(&line->b);
|
||||
f32 Math3D_LineClosestToPoint(InfiniteLine* line, Vec3f* pos, Vec3f* closestPoint) {
|
||||
f32 dirVectorSize = Math3D_Vec3fMagnitudeSq(&line->dir);
|
||||
f32 t;
|
||||
|
||||
if (IS_ZERO(dirVectorSize)) {
|
||||
@@ -127,11 +120,12 @@ f32 Math3D_LineClosestToPoint(Linef* line, Vec3f* pos, Vec3f* closestPoint) {
|
||||
//! @bug Missing early return
|
||||
}
|
||||
|
||||
t = (((pos->x - line->a.x) * line->b.x) + ((pos->y - line->a.y) * line->b.y) + ((pos->z - line->a.z) * line->b.z)) /
|
||||
t = (((pos->x - line->point.x) * line->dir.x) + ((pos->y - line->point.y) * line->dir.y) +
|
||||
((pos->z - line->point.z) * line->dir.z)) /
|
||||
dirVectorSize;
|
||||
closestPoint->x = (line->b.x * t) + line->a.x;
|
||||
closestPoint->y = (line->b.y * t) + line->a.y;
|
||||
closestPoint->z = (line->b.z * t) + line->a.z;
|
||||
closestPoint->x = (line->dir.x * t) + line->point.x;
|
||||
closestPoint->y = (line->dir.y * t) + line->point.y;
|
||||
closestPoint->z = (line->dir.z * t) + line->point.z;
|
||||
|
||||
return t;
|
||||
}
|
||||
@@ -186,10 +180,10 @@ s32 Math3D_PlaneVsPlaneNewLine(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeA
|
||||
// in-function static bss
|
||||
s32 Math3D_PlaneVsPlaneVsLineClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA,
|
||||
f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* point, Vec3f* closestPoint) {
|
||||
static Linef planeIntersect;
|
||||
static InfiniteLine planeIntersect;
|
||||
|
||||
if (!Math3D_PlaneVsPlaneNewLine(planeAA, planeAB, planeAC, planeADist, planeBA, planeBB, planeBC, planeBDist,
|
||||
(InfiniteLine*)&planeIntersect)) {
|
||||
&planeIntersect)) {
|
||||
return false;
|
||||
}
|
||||
Math3D_LineClosestToPoint(&planeIntersect, point, closestPoint);
|
||||
@@ -264,7 +258,7 @@ void Math3D_Vec3fReflect(Vec3f* vec, Vec3f* normal, Vec3f* reflVec) {
|
||||
}
|
||||
|
||||
s32 Math3D_PointInSquare2D(f32 upperLeftX, f32 lowerRightX, f32 upperLeftY, f32 lowerRightY, f32 x, f32 y) {
|
||||
if (x >= upperLeftX && x <= lowerRightX && y >= upperLeftY && y <= lowerRightY) {
|
||||
if ((x >= upperLeftX) && (x <= lowerRightX) && (y >= upperLeftY) && (y <= lowerRightY)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -394,8 +388,7 @@ s32 func_8017A304(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2, f32 arg3, f32 arg4, f32
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Math3D_SphCubeVsTriCube
|
||||
s32 func_8017A438(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4) {
|
||||
s32 Math3D_SphCubeVsTriCube(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4) {
|
||||
f32 phi_f0;
|
||||
f32 phi_f2;
|
||||
|
||||
@@ -895,8 +888,8 @@ s32 Math3D_LineVsCubeShort(Vec3s* min, Vec3s* max, Vec3s* a, Vec3s* b) {
|
||||
#endif
|
||||
|
||||
void Math3D_RotateXZPlane(Vec3f* pointOnPlane, s16 angle, f32* a, f32* c, f32* d) {
|
||||
*a = Math_SinS(angle) * 32767.0f;
|
||||
*c = Math_CosS(angle) * 32767.0f;
|
||||
*a = Math_SinS(angle) * 0x7FFF;
|
||||
*c = Math_CosS(angle) * 0x7FFF;
|
||||
*d = -((*a * pointOnPlane->x) + (*c * pointOnPlane->z));
|
||||
}
|
||||
|
||||
@@ -1010,10 +1003,12 @@ s32 Math3D_TriChkPointParaYIntersectDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx
|
||||
if (IS_ZERO(ny)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaYImpl(v0, v1, v2, z, x, 300.0f, chkDist, ny)) {
|
||||
*yIntersect = (f32)((((-nx * x) - (nz * z)) - originDist) / ny);
|
||||
*yIntersect = (((-nx * x) - (nz * z)) - originDist) / ny;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1022,10 +1017,12 @@ s32 Math3D_TriChkPointParaYIntersectInsideTri(Vec3f* v0, Vec3f* v1, Vec3f* v2, f
|
||||
if (IS_ZERO(ny)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaYImpl(v0, v1, v2, z, x, 0.0f, chkDist, ny)) {
|
||||
*yIntersect = (f32)((((-nx * x) - (nz * z)) - originDist) / ny);
|
||||
*yIntersect = (((-nx * x) - (nz * z)) - originDist) / ny;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1033,9 +1030,11 @@ s32 Math3D_TriChkPointParaY(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 ny, f32 z, f32
|
||||
if (IS_ZERO(ny)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaYImpl(v0, v1, v2, z, x, 300.0f, 1.0f, ny)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1060,20 +1059,24 @@ s32 Math3D_TriChkLineSegParaYIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx,
|
||||
if (((pointADist > 0.0f) && (pointBDist > 0.0f)) || ((pointADist < 0.0f) && (pointBDist < 0.0f))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaYImpl(v0, v1, v2, z, x, 300.0f, 1.0f, ny)) {
|
||||
*yIntersect = (((-nx * x) - (nz * z)) - originDist) / ny;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Math3D_TriChkPointParaYDist_(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 z, f32 x, f32 chkDist) {
|
||||
s32 Math3D_TriChkPointParaYDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 z, f32 x, f32 chkDist) {
|
||||
if (IS_ZERO(plane->normal.y)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaYImpl(v0, v1, v2, z, x, 0.0f, chkDist, plane->normal.y)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1097,7 +1100,7 @@ s32 Math3D_TriChkPointParaYImplNoCheckRange(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32
|
||||
if (((detMax >= (detv0v1 = ((v0->z - z) * (v1->x - x)) - ((v0->x - x) * (v1->z - z)))) &&
|
||||
(detMax >= (detv1v2 = ((v1->z - z) * (v2->x - x)) - ((v1->x - x) * (v2->z - z)))) &&
|
||||
(detMax >= (detv2v0 = ((v2->z - z) * (v0->x - x)) - ((v2->x - x) * (v0->z - z)))))) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if (((-detMax <= (detv0v1 = ((v0->z - z) * (v1->x - x)) - ((v0->x - x) * (v1->z - z)))) &&
|
||||
(-detMax <= (detv1v2 = ((v1->z - z) * (v2->x - x)) - ((v1->x - x) * (v2->z - z)))) &&
|
||||
@@ -1108,16 +1111,17 @@ s32 Math3D_TriChkPointParaYImplNoCheckRange(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32
|
||||
if (fabsf(ny) > 0.5f && chkDistSq > 0.0f) {
|
||||
// Do a check on each face of the triangle, if the point is within `chkDist` units return true.
|
||||
if ((func_8017DA24(z, x, v0, v1, &distToEdgeSq) != 0) && (distToEdgeSq < chkDistSq)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if ((func_8017DA24(z, x, v1, v2, &distToEdgeSq) != 0) && (distToEdgeSq < chkDistSq)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if ((func_8017DA24(z, x, v2, v0, &distToEdgeSq) != 0) && (distToEdgeSq < chkDistSq)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Math3D_TriChkPointParaYNoRangeCheckIntersectInsideTri(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz,
|
||||
@@ -1125,10 +1129,12 @@ s32 Math3D_TriChkPointParaYNoRangeCheckIntersectInsideTri(Vec3f* v0, Vec3f* v1,
|
||||
if (IS_ZERO(ny)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaYImplNoCheckRange(v0, v1, v2, z, x, 0.0f, chkDist, ny)) {
|
||||
*yIntersect = (f32)((((-nx * x) - (nz * z)) - originDist) / ny);
|
||||
*yIntersect = (((-nx * x) - (nz * z)) - originDist) / ny;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1156,7 +1162,7 @@ s32 Math3D_TriChkPointParaXImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f32 z, f
|
||||
if (((detMax >= (detv0v1 = ((v0->y - y) * (v1->z - z)) - ((v0->z - z) * (v1->y - y)))) &&
|
||||
(detMax >= (detv1v2 = ((v1->y - y) * (v2->z - z)) - ((v1->z - z) * (v2->y - y)))) &&
|
||||
(detMax >= (detv2v0 = ((v2->y - y) * (v0->z - z)) - ((v2->z - z) * (v0->y - y)))))) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if (((-detMax <= (detv0v1 = ((v0->y - y) * (v1->z - z)) - ((v0->z - z) * (v1->y - y)))) &&
|
||||
(-detMax <= (detv1v2 = ((v1->y - y) * (v2->z - z)) - ((v1->z - z) * (v2->y - y)))) &&
|
||||
@@ -1164,19 +1170,19 @@ s32 Math3D_TriChkPointParaXImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f32 z, f
|
||||
return true;
|
||||
}
|
||||
|
||||
if (fabsf(ny) > 0.5f && chkDistSq > 0.0f) {
|
||||
if ((fabsf(ny) > 0.5f) && (chkDistSq > 0.0f)) {
|
||||
// Do a check on each face of the triangle, if the point is within `chkDist` units return true.
|
||||
if ((func_8017D91C(y, z, v0, v1, &distToEdgeSq) != 0) && (distToEdgeSq < chkDistSq)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if ((func_8017D91C(y, z, v1, v2, &distToEdgeSq) != 0) && (distToEdgeSq < chkDistSq)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
if ((func_8017D91C(y, z, v2, v0, &distToEdgeSq) != 0) && (distToEdgeSq < chkDistSq)) {
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Math3D_TriChkPointParaXDeterminate(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f32 z, f32 detMax, f32 nx) {
|
||||
@@ -1193,6 +1199,7 @@ s32 Math3D_TriChkPointParaXIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f3
|
||||
*xIntersect = (((-ny * y) - (nz * z)) - originDist) / nx;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1200,9 +1207,11 @@ s32 Math3D_TriChkPointParaX(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 y, f32
|
||||
if (IS_ZERO(nx)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaXImpl(v0, v1, v2, y, z, 300.0f, 1.0f, nx)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1245,9 +1254,11 @@ s32 Math3D_TriChkLineSegParaXDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane,
|
||||
if (IS_ZERO(plane->normal.x)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaXImpl(v0, v1, v2, y, z, 0.0f, chkDist, plane->normal.x)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1307,24 +1318,26 @@ s32 Math3D_TriChkPointParaZDeterminate(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f
|
||||
s32 Math3D_TriChkPointParaZIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x,
|
||||
f32 y, f32* zIntersect) {
|
||||
if (IS_ZERO(nz)) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaZImpl(v0, v1, v2, x, y, 300.0f, 1.0f, nz)) {
|
||||
*zIntersect = (((-nx * x) - (ny * y)) - originDist) / nz;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Math3D_TriChkPointParaZ(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 y, f32 z) {
|
||||
if (IS_ZERO(nx)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaZImpl(v0, v1, v2, y, z, 300.0f, 1.0f, nx)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1362,13 +1375,15 @@ s32 Math3D_TriChkLineSegParaZIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx,
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/Math3D_TriChkLineSegParaZIntersect.s")
|
||||
#endif
|
||||
|
||||
s32 Math3D_TriChkLineSegParaZDist_(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 x, f32 y, f32 chkDist) {
|
||||
s32 Math3D_TriChkLineSegParaZDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 x, f32 y, f32 chkDist) {
|
||||
if (IS_ZERO(plane->normal.z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math3D_TriChkPointParaZImpl(v0, v1, v2, x, y, 0.0f, chkDist, plane->normal.z)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1433,6 +1448,7 @@ void Math3D_TriNorm(TriNorm* tri, Vec3f* va, Vec3f* vb, Vec3f* vc) {
|
||||
tri->vtx[0] = *va;
|
||||
tri->vtx[1] = *vb;
|
||||
tri->vtx[2] = *vc;
|
||||
|
||||
Math3D_DefPlane(va, vb, vc, &tri->plane.normal.x, &tri->plane.normal.y, &tri->plane.normal.z,
|
||||
&tri->plane.originDist);
|
||||
}
|
||||
@@ -1441,6 +1457,7 @@ s32 Math3D_PointInSph(Sphere16* sphere, Vec3f* point) {
|
||||
if (Math3D_DistXYZ16toF(&sphere->center, point) < sphere->radius) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1644,7 +1661,7 @@ s32 Math3D_TriVsSphIntersect(Sphere16* sphere, TriNorm* tri, Vec3f* intersectPoi
|
||||
sphereCenter.z = sphere->center.z;
|
||||
radius = sphere->radius;
|
||||
|
||||
if (!func_8017A438(&tri->vtx[0], &tri->vtx[1], &tri->vtx[2], &sphereCenter, radius)) {
|
||||
if (!Math3D_SphCubeVsTriCube(&tri->vtx[0], &tri->vtx[1], &tri->vtx[2], &sphereCenter, radius)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1805,6 +1822,7 @@ s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, V
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This section finds the points of intersection of the infinite line containing AB with the side of the infinite
|
||||
* cylinder containing cyl. Intersection points beyond the bounds of the segment and cylinder are filtered out
|
||||
@@ -1841,6 +1859,7 @@ s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, V
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// checks for intersection points outside the bounds of the segment
|
||||
if (!sideIntB) {
|
||||
if (fracA < 0.0f || 1.0f < fracA) {
|
||||
@@ -1859,6 +1878,7 @@ s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, V
|
||||
sideIntB = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// checks for intersection points outside the bounds of the cylinder
|
||||
if ((sideIntA != 0) &&
|
||||
((fracA * ptAToPtB.y + cylToPtA.y) < 0.0f || cyl->height < (fracA * ptAToPtB.y + cylToPtA.y))) {
|
||||
@@ -1871,6 +1891,7 @@ s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, V
|
||||
if (sideIntA == 0 && sideIntB == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Adds intersection points to intPts and sets side A and side B flags
|
||||
if (sideIntA != 0 && sideIntB != 0) {
|
||||
intPts[2].x = (fracA * ptAToPtB.x + cylToPtA.x) + cyl->pos.x;
|
||||
@@ -1896,7 +1917,7 @@ s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, V
|
||||
/**
|
||||
* Places the found intersection points into intersectA and intersectB. IntersectA is always closer to point A
|
||||
*/
|
||||
for (count = 0, i = 0; i < 4; i++) {
|
||||
for (count = 0, i = 0; i < ARRAY_COUNT(intPts); i++) {
|
||||
if (intFlags & (1 << i)) {
|
||||
if (count == 0) {
|
||||
*intersectA = intPts[i];
|
||||
@@ -2072,7 +2093,7 @@ s32 Math3D_SphVsCylOverlapCenterDist(Sphere16* sph, Cylinder16* cyl, f32* overla
|
||||
f32 sphBottom;
|
||||
f32 sphTop;
|
||||
|
||||
if (sph->radius <= 0 || cyl->radius <= 0) {
|
||||
if ((sph->radius <= 0) || (cyl->radius <= 0)) {
|
||||
// either radius is 0
|
||||
return false;
|
||||
}
|
||||
@@ -2225,7 +2246,6 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Math3D_CircleLineIntersections?
|
||||
/**
|
||||
* @brief Computes the intersection points, if any, of the circle of radius radius, center (centerX, centerY) with the
|
||||
* line through the point (pointX, pointY) in direction (dirX, dirY).
|
||||
@@ -2243,8 +2263,8 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) {
|
||||
* @param[out] intersectBY y coordinate of second intersection
|
||||
* @return number of intersections(ish)
|
||||
*/
|
||||
s32 func_8017FB1C(f32 centreX, f32 centerY, f32 radius, f32 pointX, f32 pointY, f32 dirX, f32 dirY, f32* intersectAX,
|
||||
f32* intersectAY, f32* intersectBX, f32* intersectBY) {
|
||||
s32 Math3D_CircleLineIntersections(f32 centreX, f32 centerY, f32 radius, f32 pointX, f32 pointY, f32 dirX, f32 dirY,
|
||||
f32* intersectAX, f32* intersectAY, f32* intersectBX, f32* intersectBY) {
|
||||
f32 a = SQ(dirX) + SQ(dirY); // t^2 coefficient, |dir|^2
|
||||
f32 diffX = pointX - centreX;
|
||||
f32 diffY = pointY - centerY;
|
||||
@@ -2301,13 +2321,15 @@ void func_8017FD44(Vec3f* arg0, Vec3f* arg1, Vec3f* dst, f32 arg3) {
|
||||
s16 sp2A;
|
||||
f32 sp24;
|
||||
|
||||
if (!(arg3 < -1.0f) || !(arg3 > 1.0f)) {
|
||||
sp2C.x = (arg0->x + arg1->x) * 0.5f;
|
||||
sp2C.z = (arg0->z + arg1->z) * 0.5f;
|
||||
sp24 = sqrtf(SQ(sp2C.x - arg0->x) + SQ(sp2C.z - arg0->z));
|
||||
dst->y = (arg1->y - arg0->y) * arg3 + arg0->y;
|
||||
sp2A = Math_Vec3f_Yaw(&sp2C, arg0);
|
||||
dst->x = Math_SinS((s16)(32767.0f * arg3) + sp2A) * sp24 + sp2C.x;
|
||||
dst->z = Math_CosS((s16)(32767.0f * arg3) + sp2A) * sp24 + sp2C.z;
|
||||
if ((arg3 < -1.0f) && (arg3 > 1.0f)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sp2C.x = (arg0->x + arg1->x) / 2.0f;
|
||||
sp2C.z = (arg0->z + arg1->z) / 2.0f;
|
||||
sp24 = sqrtf(SQ(sp2C.x - arg0->x) + SQ(sp2C.z - arg0->z));
|
||||
dst->y = (arg1->y - arg0->y) * arg3 + arg0->y;
|
||||
sp2A = Math_Vec3f_Yaw(&sp2C, arg0);
|
||||
dst->x = Math_SinS(TRUNCF_BINANG(0x7FFF * arg3) + sp2A) * sp24 + sp2C.x;
|
||||
dst->z = Math_CosS(TRUNCF_BINANG(0x7FFF * arg3) + sp2A) * sp24 + sp2C.z;
|
||||
}
|
||||
|
||||
@@ -363,8 +363,8 @@ s32 CollisionPoly_CheckYIntersect(CollisionPoly* poly, Vec3s* vtxList, f32 x, f3
|
||||
nx = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
ny = COLPOLY_GET_NORMAL(poly->normal.y);
|
||||
nz = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
return Math3D_TriChkPointParaYNoRangeCheckIntersectInsideTri(&D_801EDA18[0], &D_801EDA18[1], &D_801EDA18[2], nx, ny, nz,
|
||||
poly->dist, z, x, yIntersect, checkDist);
|
||||
return Math3D_TriChkPointParaYNoRangeCheckIntersectInsideTri(&D_801EDA18[0], &D_801EDA18[1], &D_801EDA18[2], nx, ny,
|
||||
nz, poly->dist, z, x, yIntersect, checkDist);
|
||||
}
|
||||
|
||||
s32 CollisionPoly_CheckYIntersectApprox2(CollisionPoly* poly, Vec3s* vtxList, f32 x, f32 z, f32* yIntersect) {
|
||||
@@ -439,7 +439,7 @@ s32 CollisionPoly_LineVsPoly(BgLineVsPolyTest* a0) {
|
||||
a0->planeIntersect->x, 0.0f, a0->checkDist, sPlane.normal.y)) ||
|
||||
((fabsf(sPlane.normal.z) > 0.5f) &&
|
||||
Math3D_TriChkPointParaZImpl(&sPolyVerts[0], &sPolyVerts[1], &sPolyVerts[2], a0->planeIntersect->x,
|
||||
a0->planeIntersect->y, 0.0f, a0->checkDist, sPlane.normal.z))) {
|
||||
a0->planeIntersect->y, 0.0f, a0->checkDist, sPlane.normal.z))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+6
-8
@@ -1848,14 +1848,12 @@ void Camera_CalcDefaultSwing(Camera* camera, VecGeo* arg1, VecGeo* arg2, f32 arg
|
||||
dummy:;
|
||||
swing->unk_64 = 0;
|
||||
} else if ((sp88 = Math3D_PlaneF(swing->eyeAtColChk.norm.x, swing->eyeAtColChk.norm.y,
|
||||
swing->eyeAtColChk.norm.z, swing->eyeAtColChk.poly->dist,
|
||||
at)) > 0.0f) {
|
||||
swing->eyeAtColChk.norm.z, swing->eyeAtColChk.poly->dist, at)) > 0.0f) {
|
||||
swing->unk_64 = 0;
|
||||
} else if ((sp88 = OLib_Vec3fDist(eye, &swing->eyeAtColChk.pos)) < 10.0f) {
|
||||
swing->unk_64 = 0;
|
||||
} else if ((sp88 = Math3D_PlaneF(swing->atEyeColChk.norm.x, swing->atEyeColChk.norm.y,
|
||||
swing->atEyeColChk.norm.z, swing->atEyeColChk.poly->dist,
|
||||
eye)) > 0.0f) {
|
||||
swing->atEyeColChk.norm.z, swing->atEyeColChk.poly->dist, eye)) > 0.0f) {
|
||||
swing->unk_64 = 0;
|
||||
} else if (swing->atEyeColChk.norm.y > 0.50f) {
|
||||
swing->unk_64 = 0;
|
||||
@@ -5565,8 +5563,8 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
switch (camera->animState) {
|
||||
case 0:
|
||||
bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamOrActorCsCamFuncData(camera, camera->bgCamIndex);
|
||||
Camera_Vec3sToVec3f(&rwData->unk_1C.a, &bgCamFuncData->pos);
|
||||
camera->eye = camera->eyeNext = rwData->unk_1C.a;
|
||||
Camera_Vec3sToVec3f(&rwData->unk_1C.point, &bgCamFuncData->pos);
|
||||
camera->eye = camera->eyeNext = rwData->unk_1C.point;
|
||||
rwData->unk_34 = bgCamFuncData->rot;
|
||||
|
||||
temp_v1 = bgCamFuncData->fov;
|
||||
@@ -5597,7 +5595,7 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
}
|
||||
rwData->unk_3A = camera->focalActor->world.rot.y;
|
||||
rwData->unk_3E = 0;
|
||||
camera->eye = camera->eyeNext = rwData->unk_1C.a;
|
||||
camera->eye = camera->eyeNext = rwData->unk_1C.point;
|
||||
Camera_UnsetStateFlag(camera, CAM_STATE_2);
|
||||
camera->animState++;
|
||||
// fallthrough
|
||||
@@ -5605,7 +5603,7 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
sp84.r = OLib_Vec3fDist(&sp8C, &camera->eye);
|
||||
sp84.yaw = rwData->unk_34.y;
|
||||
sp84.pitch = -rwData->unk_34.x;
|
||||
OLib_VecGeoToVec3f(&rwData->unk_1C.b, &sp84);
|
||||
OLib_VecGeoToVec3f(&rwData->unk_1C.dir, &sp84);
|
||||
Math3D_LineClosestToPoint(&rwData->unk_1C, &focalActorPosRot->pos, &rwData->unk_0C);
|
||||
camera->at = rwData->unk_0C;
|
||||
|
||||
|
||||
@@ -1733,8 +1733,8 @@ void CollisionCheck_AC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* co
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Math3D_SphVsSphOverlapCenter(&atElem->dim.worldSphere, &acElem->dim.worldSphere,
|
||||
&overlapSize, ¢erDist) != 0) {
|
||||
if (Math3D_SphVsSphOverlapCenter(&atElem->dim.worldSphere, &acElem->dim.worldSphere, &overlapSize,
|
||||
¢erDist) != 0) {
|
||||
f32 acToHit;
|
||||
Vec3f hitPos;
|
||||
Vec3f atPos;
|
||||
@@ -1784,8 +1784,7 @@ void CollisionCheck_AC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCt
|
||||
if (CollisionCheck_NoSharedFlags(&atElem->info, &ac->info)) {
|
||||
continue;
|
||||
}
|
||||
if (Math3D_SphVsCylOverlapCenterDist(&atElem->dim.worldSphere, &ac->dim, &overlapSize,
|
||||
¢erDist)) {
|
||||
if (Math3D_SphVsCylOverlapCenterDist(&atElem->dim.worldSphere, &ac->dim, &overlapSize, ¢erDist)) {
|
||||
Vec3f hitPos;
|
||||
Vec3f atPos;
|
||||
Vec3f acPos;
|
||||
@@ -1909,8 +1908,8 @@ void CollisionCheck_AC_JntSphVsSphere(PlayState* play, CollisionCheckContext* co
|
||||
if (CollisionCheck_NoSharedFlags(&sphElem->info, &ac->info)) {
|
||||
continue;
|
||||
}
|
||||
if (Math3D_SphVsSphOverlapCenter(&sphElem->dim.worldSphere, &ac->dim.worldSphere,
|
||||
&overlapSize, ¢erDist) != 0) {
|
||||
if (Math3D_SphVsSphOverlapCenter(&sphElem->dim.worldSphere, &ac->dim.worldSphere, &overlapSize,
|
||||
¢erDist) != 0) {
|
||||
f32 acToHit;
|
||||
Vec3f hitPos;
|
||||
Vec3f atPos;
|
||||
@@ -1954,8 +1953,7 @@ void CollisionCheck_AC_CylVsJntSph(PlayState* play, CollisionCheckContext* colCt
|
||||
if (CollisionCheck_NoSharedFlags(&at->info, &sphElem->info)) {
|
||||
continue;
|
||||
}
|
||||
if (Math3D_SphVsCylOverlapCenterDist(&sphElem->dim.worldSphere, &at->dim, &overlapSize,
|
||||
¢erDist) != 0) {
|
||||
if (Math3D_SphVsCylOverlapCenterDist(&sphElem->dim.worldSphere, &at->dim, &overlapSize, ¢erDist) != 0) {
|
||||
Vec3f hitPos;
|
||||
Vec3f atPos;
|
||||
Vec3f acPos;
|
||||
@@ -2560,7 +2558,7 @@ void CollisionCheck_AC_SphereVsJntSph(PlayState* play, CollisionCheckContext* co
|
||||
}
|
||||
|
||||
if (Math3D_SphVsSphOverlapCenter(&at->dim.worldSphere, &acElem->dim.worldSphere, &overlapSize,
|
||||
¢erDist) != 0) {
|
||||
¢erDist) != 0) {
|
||||
f32 acToHit;
|
||||
Vec3f hitPos;
|
||||
Vec3f atPos;
|
||||
@@ -2710,8 +2708,7 @@ void CollisionCheck_AC_SphereVsSphere(PlayState* play, CollisionCheckContext* co
|
||||
return;
|
||||
}
|
||||
|
||||
if (Math3D_SphVsSphOverlapCenter(&at->dim.worldSphere, &ac->dim.worldSphere, &overlapSize,
|
||||
¢erDist) != 0) {
|
||||
if (Math3D_SphVsSphOverlapCenter(&at->dim.worldSphere, &ac->dim.worldSphere, &overlapSize, ¢erDist) != 0) {
|
||||
f32 acToHit;
|
||||
Vec3f hitPos;
|
||||
Vec3f atPos;
|
||||
@@ -3043,8 +3040,7 @@ void CollisionCheck_OC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* co
|
||||
if (!(rightElem->info.ocElemFlags & OCELEM_ON)) {
|
||||
continue;
|
||||
}
|
||||
if (Math3D_SphVsSphOverlap(&leftElem->dim.worldSphere, &rightElem->dim.worldSphere,
|
||||
&overlap) != 0) {
|
||||
if (Math3D_SphVsSphOverlap(&leftElem->dim.worldSphere, &rightElem->dim.worldSphere, &overlap) != 0) {
|
||||
Vec3f leftPos;
|
||||
Vec3f rightPos;
|
||||
|
||||
|
||||
@@ -258,21 +258,21 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
|
||||
|
||||
if (!(this->unk_164 & 0x1000)) {
|
||||
if (Math3D_PointInSquare2D(D_808F9BAC[0], D_808F9BAC[1], D_808F9BAC[2], D_808F9BAC[3],
|
||||
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
|
||||
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x1000;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(this->unk_164 & 0x2000) && (this->unk_164 & 0x1000)) {
|
||||
if (Math3D_PointInSquare2D(D_808F9BBC[0], D_808F9BBC[1], D_808F9BBC[2], D_808F9BBC[3],
|
||||
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
|
||||
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x2000;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(this->unk_164 & 0x4000) && (this->unk_164 & 0x2000)) {
|
||||
if (Math3D_PointInSquare2D(D_808F9BCC[0], D_808F9BCC[1], D_808F9BCC[2], D_808F9BCC[3],
|
||||
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
|
||||
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x4000;
|
||||
}
|
||||
}
|
||||
@@ -291,21 +291,21 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
|
||||
|
||||
if (!(this->unk_164 & 0x80000)) {
|
||||
if (Math3D_PointInSquare2D(D_808F9BAC[0], D_808F9BAC[1], D_808F9BAC[2], D_808F9BAC[3],
|
||||
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
|
||||
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x80000;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(this->unk_164 & 0x100000) && (this->unk_164 & 0x80000)) {
|
||||
if (Math3D_PointInSquare2D(D_808F9BBC[0], D_808F9BBC[1], D_808F9BBC[2], D_808F9BBC[3],
|
||||
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
|
||||
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x100000;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(this->unk_164 & 0x200000) && (this->unk_164 & 0x100000)) {
|
||||
if (Math3D_PointInSquare2D(D_808F9BCC[0], D_808F9BCC[1], D_808F9BCC[2], D_808F9BCC[3],
|
||||
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
|
||||
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x200000;
|
||||
}
|
||||
}
|
||||
@@ -323,19 +323,19 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
|
||||
}
|
||||
|
||||
if (!(this->unk_164 & 0x20) && Math3D_PointInSquare2D(D_808F9BAC[0], D_808F9BAC[1], D_808F9BAC[2], D_808F9BAC[3],
|
||||
horse->actor.world.pos.x, horse->actor.world.pos.z)) {
|
||||
horse->actor.world.pos.x, horse->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x20;
|
||||
}
|
||||
|
||||
if (!(this->unk_164 & 0x40) && (this->unk_164 & 0x20) &&
|
||||
Math3D_PointInSquare2D(D_808F9BBC[0], D_808F9BBC[1], D_808F9BBC[2], D_808F9BBC[3], horse->actor.world.pos.x,
|
||||
horse->actor.world.pos.z)) {
|
||||
horse->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x40;
|
||||
}
|
||||
|
||||
if (!(this->unk_164 & 0x80) && (this->unk_164 & 0x40) &&
|
||||
Math3D_PointInSquare2D(D_808F9BCC[0], D_808F9BCC[1], D_808F9BCC[2], D_808F9BCC[3], horse->actor.world.pos.x,
|
||||
horse->actor.world.pos.z)) {
|
||||
horse->actor.world.pos.z)) {
|
||||
this->unk_164 |= 0x80;
|
||||
}
|
||||
|
||||
|
||||
@@ -602,14 +602,12 @@ void func_80A69ADC(Actor* thisx) {
|
||||
s32 pad2;
|
||||
|
||||
if (this->unk_358 < 1.0f) {
|
||||
sp44 = Math3D_PlaneF(
|
||||
this->unk_310.x, this->unk_310.y, this->unk_310.z,
|
||||
func_80A69AA8(this->unk_310.x, this->unk_310.y, this->unk_310.z, &this->actor.world.pos),
|
||||
&bean->dyna.actor.world.pos);
|
||||
sp40 = Math3D_PlaneF(
|
||||
this->unk_328.x, this->unk_328.y, this->unk_328.z,
|
||||
func_80A69AA8(this->unk_328.x, this->unk_328.y, this->unk_328.z, &this->actor.world.pos),
|
||||
&bean->dyna.actor.world.pos);
|
||||
sp44 = Math3D_PlaneF(this->unk_310.x, this->unk_310.y, this->unk_310.z,
|
||||
func_80A69AA8(this->unk_310.x, this->unk_310.y, this->unk_310.z, &this->actor.world.pos),
|
||||
&bean->dyna.actor.world.pos);
|
||||
sp40 = Math3D_PlaneF(this->unk_328.x, this->unk_328.y, this->unk_328.z,
|
||||
func_80A69AA8(this->unk_328.x, this->unk_328.y, this->unk_328.z, &this->actor.world.pos),
|
||||
&bean->dyna.actor.world.pos);
|
||||
sp3C = Math3D_Dist1D(sp44, sp40);
|
||||
|
||||
if (fabsf(sp3C) > 0.1f) {
|
||||
@@ -648,14 +646,12 @@ void func_80A69D3C(EnMushi2* this) {
|
||||
f32 sp38;
|
||||
|
||||
if ((this->unk_34C != NULL) && (this->unk_358 > 0.999f)) {
|
||||
sp40 = Math3D_PlaneF(
|
||||
this->unk_310.x, this->unk_310.y, this->unk_310.z,
|
||||
func_80A69AA8(this->unk_310.x, this->unk_310.y, this->unk_310.z, &this->actor.world.pos),
|
||||
&this->unk_34C->dyna.actor.world.pos);
|
||||
sp3C = Math3D_PlaneF(
|
||||
this->unk_328.x, this->unk_328.y, this->unk_328.z,
|
||||
func_80A69AA8(this->unk_328.x, this->unk_328.y, this->unk_328.z, &this->actor.world.pos),
|
||||
&this->unk_34C->dyna.actor.world.pos);
|
||||
sp40 = Math3D_PlaneF(this->unk_310.x, this->unk_310.y, this->unk_310.z,
|
||||
func_80A69AA8(this->unk_310.x, this->unk_310.y, this->unk_310.z, &this->actor.world.pos),
|
||||
&this->unk_34C->dyna.actor.world.pos);
|
||||
sp3C = Math3D_PlaneF(this->unk_328.x, this->unk_328.y, this->unk_328.z,
|
||||
func_80A69AA8(this->unk_328.x, this->unk_328.y, this->unk_328.z, &this->actor.world.pos),
|
||||
&this->unk_34C->dyna.actor.world.pos);
|
||||
sp38 = Math3D_Dist1DSq(sp40, sp3C);
|
||||
|
||||
if (fabsf(sp38) > 0.010000001f) {
|
||||
|
||||
@@ -483,8 +483,8 @@ s32 func_80B78764(ObjUm* this, PlayState* play, EnHorse* bandit1, EnHorse* bandi
|
||||
func_80B781DC(this, bandit1, bandit2, play);
|
||||
}
|
||||
|
||||
Math3D_LineSplitRatio(&bandit1->unk_540, &this->unk_360[bandit1->unk_550], 1.0f - ((f32)bandit1->unk_55C / bandit1->unk_560),
|
||||
&sp30);
|
||||
Math3D_LineSplitRatio(&bandit1->unk_540, &this->unk_360[bandit1->unk_550],
|
||||
1.0f - ((f32)bandit1->unk_55C / bandit1->unk_560), &sp30);
|
||||
bandit1->banditPosition = sp30;
|
||||
bandit1->unk_588 = this->dyna.actor.shape.rot.y;
|
||||
|
||||
|
||||
@@ -3271,7 +3271,7 @@
|
||||
0x8017A09C:("func_8017A09C",),
|
||||
0x8017A1D0:("func_8017A1D0",),
|
||||
0x8017A304:("func_8017A304",),
|
||||
0x8017A438:("func_8017A438",),
|
||||
0x8017A438:("Math3D_SphCubeVsTriCube",),
|
||||
0x8017A5F8:("Math3D_Dist1DSq",),
|
||||
0x8017A610:("Math3D_Dist1D",),
|
||||
0x8017A634:("Math3D_Dist2DSq",),
|
||||
@@ -3347,7 +3347,7 @@
|
||||
0x8017F9C0:("Math3D_XZInSphere",),
|
||||
0x8017FA34:("Math3D_XYInSphere",),
|
||||
0x8017FAA8:("Math3D_YZInSphere",),
|
||||
0x8017FB1C:("func_8017FB1C",),
|
||||
0x8017FB1C:("Math3D_CircleLineIntersections",),
|
||||
0x8017FD44:("func_8017FD44",),
|
||||
0x8017FEB0:("Math_GetAtan2Tbl",),
|
||||
0x8017FEE4:("Math_Atan2S",),
|
||||
|
||||
@@ -521,6 +521,7 @@ wordReplace = {
|
||||
"Math3D_Parallel": "Math3D_Cos",
|
||||
"Math3D_AngleBetweenVectors": "Math3D_CosOut",
|
||||
"func_80179A44": "Math3D_LineClosestToPoint",
|
||||
"func_8017A438": "Math3D_SphCubeVsTriCube",
|
||||
"Math3D_XZLengthSquared": "Math3D_Dist1DSq",
|
||||
"Math3D_XZLength": "Math3D_Dist1D",
|
||||
"Math3D_XZDistanceSquared": "Math3D_Dist2DSq",
|
||||
|
||||
@@ -2785,7 +2785,7 @@ asm/non_matchings/code/sys_math3d/Math3D_PointInSquare2D.s,Math3D_PointInSquare2
|
||||
asm/non_matchings/code/sys_math3d/func_8017A09C.s,func_8017A09C,0x8017A09C,0x4D
|
||||
asm/non_matchings/code/sys_math3d/func_8017A1D0.s,func_8017A1D0,0x8017A1D0,0x4D
|
||||
asm/non_matchings/code/sys_math3d/func_8017A304.s,func_8017A304,0x8017A304,0x4D
|
||||
asm/non_matchings/code/sys_math3d/func_8017A438.s,func_8017A438,0x8017A438,0x70
|
||||
asm/non_matchings/code/sys_math3d/Math3D_SphCubeVsTriCube.s,Math3D_SphCubeVsTriCube,0x8017A438,0x70
|
||||
asm/non_matchings/code/sys_math3d/Math3D_Dist1DSq.s,Math3D_Dist1DSq,0x8017A5F8,0x6
|
||||
asm/non_matchings/code/sys_math3d/Math3D_Dist1D.s,Math3D_Dist1D,0x8017A610,0x9
|
||||
asm/non_matchings/code/sys_math3d/Math3D_Dist2DSq.s,Math3D_Dist2DSq,0x8017A634,0x11
|
||||
@@ -2861,7 +2861,7 @@ asm/non_matchings/code/sys_math3d/Math3D_TriVsTriIntersect.s,Math3D_TriVsTriInte
|
||||
asm/non_matchings/code/sys_math3d/Math3D_XZInSphere.s,Math3D_XZInSphere,0x8017F9C0,0x1D
|
||||
asm/non_matchings/code/sys_math3d/Math3D_XYInSphere.s,Math3D_XYInSphere,0x8017FA34,0x1D
|
||||
asm/non_matchings/code/sys_math3d/Math3D_YZInSphere.s,Math3D_YZInSphere,0x8017FAA8,0x1D
|
||||
asm/non_matchings/code/sys_math3d/func_8017FB1C.s,func_8017FB1C,0x8017FB1C,0x8A
|
||||
asm/non_matchings/code/sys_math3d/Math3D_CircleLineIntersections.s,Math3D_CircleLineIntersections,0x8017FB1C,0x8A
|
||||
asm/non_matchings/code/sys_math3d/func_8017FD44.s,func_8017FD44,0x8017FD44,0x5B
|
||||
asm/non_matchings/code/sys_math_atan/Math_GetAtan2Tbl.s,Math_GetAtan2Tbl,0x8017FEB0,0xD
|
||||
asm/non_matchings/code/sys_math_atan/Math_Atan2S.s,Math_Atan2S,0x8017FEE4,0x7A
|
||||
|
||||
|
Reference in New Issue
Block a user