mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-05 10:27:31 -04:00
sys_math3d.c Decompiled and Mostly Documented (#1450)
* Use matched sys_math3d functions by Tharo Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * kinda match some unattempted functions * move sys_math3d function declarations to z64math.h * Rename some simple functions * Take matched Math3D_LineVsLineClosestTwoPoints from OoT * minor fixes to make stuff actually equivalent * func_8017FB1C * format * minor cleanup * Math3D_PointOnDirectedLine * func_8017FB1C documentation Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> * Remove actorfixer * fix merge * Apply renames * more cleanup * bss cleanup * match Math3D_CylVsLineSeg * WIP * OK * small cleanup * Remove macros.h from sys_math3d * Small cleanup * Some more small clean up * cleanup and docs * cleanup * PR Review * cleanup * fix merge * fix merge * merge main * fix bss * bss * fix * PR Review * bss fix * Merge main * Fix bss * Fix merge * Add zero vecs to sys_math3d * Format * namefixer run --------- Co-authored-by: angie <angheloalf95@gmail.com> Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
+11
-13
@@ -1240,7 +1240,7 @@ s32 func_800CD44C(Camera* camera, VecGeo* diffGeo, CameraCollision* camEyeCollis
|
||||
// different bgIds for at->eye[Next] and eye[Next]->at
|
||||
ret = 3;
|
||||
} else {
|
||||
cosEyeAt = Math3D_Parallel(&camEyeCollision->norm, &camAtCollision->norm);
|
||||
cosEyeAt = Math3D_Cos(&camEyeCollision->norm, &camAtCollision->norm);
|
||||
if (cosEyeAt < -0.5f) {
|
||||
ret = 6;
|
||||
} else if ((cosEyeAt > 0.5f) || (checkEye & 2)) {
|
||||
@@ -1822,20 +1822,18 @@ void Camera_CalcDefaultSwing(Camera* camera, VecGeo* arg1, VecGeo* arg2, f32 arg
|
||||
if (swing->unk_64 == 1) {
|
||||
if (arg3 < (sp88 = OLib_Vec3fDist(at, &swing->collisionClosePoint))) {
|
||||
swing->unk_64 = 0;
|
||||
} else if ((sp88 = Math3D_SignedDistanceFromPlane(swing->eyeAtColChk.norm.x, swing->eyeAtColChk.norm.y,
|
||||
swing->eyeAtColChk.norm.z, swing->eyeAtColChk.poly->dist,
|
||||
at)) > 0.0f) {
|
||||
} 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->unk_64 = 0;
|
||||
} else if ((sp88 = OLib_Vec3fDist(eye, &swing->eyeAtColChk.pos)) < 10.0f) {
|
||||
swing->unk_64 = 0;
|
||||
} else if ((sp88 = Math3D_SignedDistanceFromPlane(swing->atEyeColChk.norm.x, swing->atEyeColChk.norm.y,
|
||||
swing->atEyeColChk.norm.z, swing->atEyeColChk.poly->dist,
|
||||
eye)) > 0.0f) {
|
||||
} 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->unk_64 = 0;
|
||||
} else if (swing->atEyeColChk.norm.y > 0.50f) {
|
||||
swing->unk_64 = 0;
|
||||
} else {
|
||||
Math3D_AngleBetweenVectors(&camera->unk_0F0, &swing->eyeAtColChk.norm, &sp88);
|
||||
Math3D_CosOut(&camera->unk_0F0, &swing->eyeAtColChk.norm, &sp88);
|
||||
if (sp88 > 0.0f) {
|
||||
swing->unk_64 = 0;
|
||||
}
|
||||
@@ -5415,8 +5413,8 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
switch (camera->animState) {
|
||||
case 0:
|
||||
bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamOrActorCsCamFuncData(camera, camera->bgCamIndex);
|
||||
rwData->unk_1C = Camera_Vec3sToVec3f(&bgCamFuncData->pos);
|
||||
camera->eye = camera->eyeNext = rwData->unk_1C;
|
||||
rwData->unk_1C.point = Camera_Vec3sToVec3f(&bgCamFuncData->pos);
|
||||
camera->eye = camera->eyeNext = rwData->unk_1C.point;
|
||||
rwData->unk_34 = bgCamFuncData->rot;
|
||||
|
||||
temp_v1 = bgCamFuncData->fov;
|
||||
@@ -5447,7 +5445,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;
|
||||
camera->eye = camera->eyeNext = rwData->unk_1C.point;
|
||||
Camera_UnsetStateFlag(camera, CAM_STATE_2);
|
||||
camera->animState++;
|
||||
// fallthrough
|
||||
@@ -5455,8 +5453,8 @@ s32 Camera_Unique0(Camera* camera) {
|
||||
sp84.r = OLib_Vec3fDist(&sp8C, &camera->eye);
|
||||
sp84.yaw = rwData->unk_34.y;
|
||||
sp84.pitch = -rwData->unk_34.x;
|
||||
rwData->unk_28 = OLib_VecGeoToVec3f(&sp84);
|
||||
func_80179A44(&rwData->unk_1C, focalActorPosRot, &rwData->unk_0C);
|
||||
rwData->unk_1C.dir = OLib_VecGeoToVec3f(&sp84);
|
||||
Math3D_LineClosestToPoint(&rwData->unk_1C, &focalActorPosRot->pos, &rwData->unk_0C);
|
||||
camera->at = rwData->unk_0C;
|
||||
|
||||
if (player->stateFlags1 & PLAYER_STATE1_20000000) {
|
||||
|
||||
Reference in New Issue
Block a user