mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-26 07:38:45 -04:00
Camera Preparation (#644)
* Copy progress from z_camera * cleanup functions.h * Oops * Revert `SUB16` and `ADD16` back to original names * PR Suggestions * PR Suggestions * Fix merge with master
This commit is contained in:
@@ -130,7 +130,7 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/func_8017D220.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/func_8017D2FC.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/Math3D_LineSegVsPlane.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/func_8017D404.s")
|
||||
|
||||
|
||||
+3
-3
@@ -1279,7 +1279,7 @@ f32 Actor_HeightDiff(Actor* actor1, Actor* actor2) {
|
||||
* Sets the current and new inputs.
|
||||
*/
|
||||
void func_800B6F20(GlobalContext* globalCtx, Input* input, f32 magnitude, s16 baseYaw) {
|
||||
s16 relativeYaw = baseYaw - func_800DFC68(GET_ACTIVE_CAM(globalCtx));
|
||||
s16 relativeYaw = baseYaw - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx));
|
||||
|
||||
input->cur.stick_x = -Math_SinS(relativeYaw) * magnitude;
|
||||
input->rel.stick_x = input->cur.stick_x;
|
||||
@@ -1341,7 +1341,7 @@ void Actor_SetCameraHorseSetting(GlobalContext* globalCtx, Player* player) {
|
||||
EnHorse* rideActor = (EnHorse*)player->rideActor;
|
||||
|
||||
if ((rideActor != NULL) && !(rideActor->unk_1EC & 0x10)) {
|
||||
func_800DFAC8(Play_GetCamera(globalCtx, MAIN_CAM), 4);
|
||||
func_800DFAC8(Play_GetCamera(globalCtx, CAM_ID_MAIN), 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3329,7 +3329,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC
|
||||
|
||||
if ((player != NULL) && (actor == player->unk_730)) {
|
||||
func_80123DA4(player);
|
||||
Camera_ChangeMode(Play_GetCamera(globalCtx, Play_GetActiveCameraIndex(globalCtx)), 0);
|
||||
Camera_ChangeMode(Play_GetCamera(globalCtx, Play_GetActiveCamId(globalCtx)), 0);
|
||||
}
|
||||
|
||||
if (actor == actorCtx->targetContext.arrowPointedActor) {
|
||||
|
||||
@@ -4047,7 +4047,7 @@ u16 func_800C9728(CollisionContext* colCtx, u32 camId, s32 bgId) {
|
||||
return 0;
|
||||
}
|
||||
camData = colHeader->cameraDataList;
|
||||
result = camData[camId].cameraSType;
|
||||
result = camData[camId].setting;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4088,7 +4088,7 @@ u16 func_800C97F8(CollisionContext* colCtx, u32 camId, s32 bgId) {
|
||||
if (camData == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return camData[camId].unk_02;
|
||||
return camData[camId].numData;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4114,7 +4114,7 @@ u16 func_800C9844(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* CamData get camPosData
|
||||
* CamData get data
|
||||
*/
|
||||
Vec3s* func_800C98CC(CollisionContext* colCtx, s32 camId, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
@@ -4127,11 +4127,11 @@ Vec3s* func_800C98CC(CollisionContext* colCtx, s32 camId, s32 bgId) {
|
||||
if (cameraDataList == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return Lib_SegmentedToVirtual(cameraDataList[camId].camPosData);
|
||||
return Lib_SegmentedToVirtual(cameraDataList[camId].data);
|
||||
}
|
||||
|
||||
/**
|
||||
* SurfaceType Get camPosData
|
||||
* SurfaceType Get data
|
||||
*/
|
||||
Vec3s* SurfaceType_GetCamPosData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
|
||||
CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId);
|
||||
@@ -4573,7 +4573,7 @@ u16 WaterBox_GetCameraSetting(CollisionContext* colCtx, WaterBox* waterBox, s32
|
||||
return result;
|
||||
}
|
||||
|
||||
result = camData[camId].cameraSType;
|
||||
result = camData[camId].setting;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -320,19 +320,19 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFAC8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFB14.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_ChangeDataIdx.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC1C.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC40.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC68.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetInputDirYaw.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC90.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFCB4.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetCamDirPitch.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFCDC.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetCamDirYaw.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFD04.s")
|
||||
|
||||
@@ -364,10 +364,10 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E0238.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E02AC.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_SetToTrackActor.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E0308.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_SetTargetActor.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E031C.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetWaterYPos.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E0348.s")
|
||||
|
||||
@@ -255,9 +255,12 @@ void EffectSS_DrawAllParticles(GlobalContext* globalCtx) {
|
||||
|
||||
for (i = 0; i < sEffectSsInfo.size; i++) {
|
||||
if (sEffectSsInfo.data_table[i].life > -1) {
|
||||
if ((sEffectSsInfo.data_table[i].pos.x > 32000.0f) || (sEffectSsInfo.data_table[i].pos.x < -32000.0f) ||
|
||||
(sEffectSsInfo.data_table[i].pos.y > 32000.0f) || (sEffectSsInfo.data_table[i].pos.y < -32000.0f) ||
|
||||
(sEffectSsInfo.data_table[i].pos.z > 32000.0f) || (sEffectSsInfo.data_table[i].pos.z < -32000.0f)) {
|
||||
if ((sEffectSsInfo.data_table[i].pos.x > BGCHECK_Y_MAX) ||
|
||||
(sEffectSsInfo.data_table[i].pos.x < BGCHECK_Y_MIN) ||
|
||||
(sEffectSsInfo.data_table[i].pos.y > BGCHECK_Y_MAX) ||
|
||||
(sEffectSsInfo.data_table[i].pos.y < BGCHECK_Y_MIN) ||
|
||||
(sEffectSsInfo.data_table[i].pos.z > BGCHECK_Y_MAX) ||
|
||||
(sEffectSsInfo.data_table[i].pos.z < BGCHECK_Y_MIN)) {
|
||||
EffectSS_Delete(&sEffectSsInfo.data_table[i]);
|
||||
} else {
|
||||
EffectSS_DrawParticle(globalCtx, i);
|
||||
|
||||
@@ -157,7 +157,7 @@ void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire) {
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, lightParams->envColor.r, lightParams->envColor.g, lightParams->envColor.b, 0);
|
||||
|
||||
vec.x = 0;
|
||||
vec.y = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
|
||||
vec.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000;
|
||||
vec.z = 0;
|
||||
Matrix_SetStateRotationAndTranslation(fire->position.x, fire->position.y, fire->position.z, &vec);
|
||||
Matrix_Scale(fire->xScale, fire->yScale, 1.0f, MTXMODE_APPLY);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx);
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* de
|
||||
f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b) {
|
||||
Vec3f diff;
|
||||
Math_Vec3f_Diff(b, a, &diff);
|
||||
return sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z));
|
||||
return sqrtf(SQXYZ(diff));
|
||||
}
|
||||
|
||||
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest) {
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ Vec3f* OLib_Vec3fDistNormalize(Vec3f* dest, Vec3f* a, Vec3f* b) {
|
||||
v1.y = b->y - a->y;
|
||||
v1.z = b->z - a->z;
|
||||
|
||||
dist = OLib_ClampMinDist(sqrtf(SQ(v1.x) + SQ(v1.y) + SQ(v1.z)), 0.01f);
|
||||
dist = OLib_ClampMinDist(sqrtf(SQXYZ(v1)), 0.01f);
|
||||
|
||||
v2.x = v1.x / dist;
|
||||
v2.y = v1.y / dist;
|
||||
|
||||
+13
-13
@@ -74,41 +74,41 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169474.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801694DC.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CreateSubCamera.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetActiveCameraIndex.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetActiveCamId.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169590.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeStatus.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169600.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearCamera.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169668.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearAllSubCameras.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCamera.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEye.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016981C.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEyeUp.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169940.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetFov.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169988.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetRoll.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801699D4.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CopyCamera.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169A50.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169AC0.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeSetting.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169AFC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BC4.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraGetUID.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BF8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169C64.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataSetting.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169C84.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/convert_scene_number_among_shared_scenes.s")
|
||||
|
||||
|
||||
+3
-3
@@ -137,7 +137,7 @@ QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) {
|
||||
|
||||
__osMemset(req, 0, sizeof(QuakeRequest));
|
||||
req->camera = camera;
|
||||
req->cameraPtrsIdx = camera->thisIdx;
|
||||
req->camId = camera->camId;
|
||||
req->callbackIdx = callbackIdx;
|
||||
req->isShakePerpendicular = true;
|
||||
req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
|
||||
@@ -326,10 +326,10 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
|
||||
for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
|
||||
req = &sQuakeRequest[idx];
|
||||
if (req->callbackIdx != 0) {
|
||||
if (globalCtx->cameraPtrs[req->cameraPtrsIdx] == NULL) {
|
||||
if (globalCtx->cameraPtrs[req->camId] == NULL) {
|
||||
Quake_Remove(req);
|
||||
} else {
|
||||
eq = (camera->thisIdx != req->camera->thisIdx);
|
||||
eq = (camera->camId != req->camera->camId);
|
||||
absSpeedDiv = ABS(req->speed) / (f32)0x8000;
|
||||
if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
|
||||
Quake_Remove(req);
|
||||
|
||||
+3
-3
@@ -179,7 +179,7 @@ void Scene_HeaderCmdActorList(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
|
||||
// SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes
|
||||
void Scene_HeaderCmdActorCutsceneCamList(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
globalCtx->unk_18858 = (UNK_PTR)Lib_SegmentedToVirtual(cmd->csCameraList.segment);
|
||||
globalCtx->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment);
|
||||
}
|
||||
|
||||
// SceneTableEntry Header Command 0x03: Collision Header
|
||||
@@ -374,8 +374,8 @@ void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
|
||||
// SceneTableEntry Header Command 0x12: Skybox Disables
|
||||
void Scene_HeaderCmdSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
globalCtx->envCtx.unk_15 = cmd->skyboxDisables.unk4;
|
||||
globalCtx->envCtx.unk_16 = cmd->skyboxDisables.unk5;
|
||||
globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4;
|
||||
globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5;
|
||||
}
|
||||
|
||||
// SceneTableEntry Header Command 0x10: Time Settings
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* File: z_shrink_window.c
|
||||
* Description: Draws black top/bottom/side borders on the viewing window (e.g. Z-targeting, talking to NPC)
|
||||
*/
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
ShrinkWindowContext gShrinkWindowContext;
|
||||
|
||||
+3
-5
@@ -114,21 +114,19 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
|
||||
s16 y;
|
||||
f32 distance;
|
||||
CollisionPoly* poly;
|
||||
Camera* camera;
|
||||
Camera* camera = GET_ACTIVE_CAM(globalCtx);
|
||||
Actor* actors[2];
|
||||
s32 ret = 0;
|
||||
s32 bgId;
|
||||
|
||||
camera = GET_ACTIVE_CAM(globalCtx);
|
||||
|
||||
distance = OLib_Vec3fDist(pos, &camera->eye);
|
||||
if ((distance < distanceMin) || (distanceMax < distance)) {
|
||||
func_8013A41C(0x3F);
|
||||
ret = 0x3F;
|
||||
}
|
||||
|
||||
x = func_8013A504(func_800DFCB4(camera) + rot->x);
|
||||
y = func_8013A504(func_800DFCDC(camera) - (s16)(rot->y - 0x7FFF));
|
||||
x = func_8013A504(Camera_GetCamDirPitch(camera) + rot->x);
|
||||
y = func_8013A504(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF));
|
||||
if ((0 < angleError) && ((angleError < x) || (angleError < y))) {
|
||||
func_8013A41C(0x3E);
|
||||
ret |= 0x3E;
|
||||
|
||||
Reference in New Issue
Block a user