mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
ce4ab34def
* battle documentation * mostly startup stuff * battle file names * minor reorg * actor rendering * few extras * file renames and camera unks * py fix * fio cleanup * sounds progress --------- Co-authored-by: HailSanta <Hail2Santa@gmail.com>
73 lines
2.8 KiB
C
73 lines
2.8 KiB
C
#include "common.h"
|
|
|
|
void update_camera_mode_unused(Camera* camera) {
|
|
PlayerStatus* playerStatus = &gPlayerStatus;
|
|
f32 sinBoom;
|
|
f32 cosBoom;
|
|
f32 deltaX;
|
|
f32 deltaY;
|
|
f32 deltaZ;
|
|
f32 deltaX2;
|
|
f32 deltaY2;
|
|
f32 deltaZ2;
|
|
f32 boomYaw;
|
|
|
|
if (camera->needsInit || camera->isChangingMap) {
|
|
camera->needsInit = FALSE;
|
|
camera->isChangingMap = FALSE;
|
|
camera->auxPitch = 0;
|
|
camera->auxBoomLength = 100;
|
|
camera->lookAt_dist = 100;
|
|
camera->auxBoomPitch = 0;
|
|
camera->auxBoomYaw = 0;
|
|
camera->lookAt_obj.x = camera->lookAt_obj_target.x;
|
|
camera->lookAt_obj.y = camera->lookAt_obj_target.y;
|
|
camera->lookAt_obj.z = camera->lookAt_obj_target.z;
|
|
}
|
|
|
|
if (!(playerStatus->flags & (PS_FLAG_FALLING | PS_FLAG_JUMPING))) {
|
|
camera->lookAt_obj_target.y = playerStatus->pos.y + 60.0f;
|
|
}
|
|
camera->lookAt_obj_target.x = playerStatus->pos.x;
|
|
camera->lookAt_obj_target.z = playerStatus->pos.z + 400.0f;
|
|
|
|
if (camera->auxPitch == 0) {
|
|
camera->lookAt_obj.x = camera->lookAt_obj_target.x;
|
|
camera->lookAt_obj.y = camera->lookAt_obj_target.y;
|
|
camera->lookAt_obj.z = camera->lookAt_obj_target.z;
|
|
camera->trueRot.x = camera->auxBoomYaw;
|
|
camera->curBoomYaw = camera->auxBoomPitch;
|
|
camera->curBoomLength = camera->auxBoomLength;
|
|
camera->vfov = (10000 / camera->lookAt_dist) / 4;
|
|
boomYaw = DEG_TO_RAD(camera->curBoomYaw);
|
|
sinBoom = sin_rad(boomYaw);
|
|
cosBoom = cos_rad(boomYaw);
|
|
deltaX = 0.0f;
|
|
deltaY = 0.0f;
|
|
deltaZ = camera->curBoomLength;
|
|
deltaX2 = deltaX;
|
|
deltaY2 = deltaY;
|
|
boomYaw = deltaX = -deltaY2;
|
|
deltaZ2 = deltaZ;
|
|
deltaX = deltaX2;
|
|
deltaY = cosBoom * deltaY2 + deltaZ2 * sinBoom;
|
|
deltaZ = sinBoom * boomYaw + deltaZ2 * cosBoom;
|
|
boomYaw = DEG_TO_RAD(camera->trueRot.x);
|
|
sinBoom = sin_rad(boomYaw);
|
|
cosBoom = cos_rad(boomYaw);
|
|
deltaZ2 = cosBoom * deltaX - deltaZ * sinBoom;
|
|
deltaX2 = cosBoom * deltaX - deltaZ * sinBoom;
|
|
deltaY2 = deltaY;
|
|
deltaZ2 = sinBoom * deltaX + deltaZ * cosBoom;
|
|
camera->lookAt_eye.x = camera->lookAt_obj.x + deltaX2;
|
|
camera->lookAt_eye.y = camera->lookAt_obj.y + deltaY2;
|
|
camera->lookAt_eye.z = camera->lookAt_obj.z + deltaZ2;
|
|
}
|
|
camera->curYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z);
|
|
deltaX = camera->lookAt_obj.x - camera->lookAt_eye.x;
|
|
deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y;
|
|
deltaZ = camera->lookAt_obj.z - camera->lookAt_eye.z;
|
|
camera->curBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ);
|
|
camera->curPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ)));
|
|
}
|