papermario/src/ad90_len_2880.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
3.0 KiB
C
Raw Normal View History

Splat refactor (#257) * all non-world rodata migrated * data disasm * kinda working * updated yaml * bloop * linker header * configure 2.0 * bin * mass rename to remove code_ * pause rename * battle partner stuff * whew * more renames * more renames * more renaming * it builds! * updates * remove main prefix * one more thing * crc, yay0 * .data, .rodata, .bss * img * dead_atan2 * it buildsgit add -A * split battle/partner/6FAD10 * rm &s on sleepy_sheep syms * sha1sum ninja rule description * OK but commented out PaperMarioMapFS and PaperMarioNpcSprites * uncomment * fix mapfs * match func_8003CFB4 * . * clean up and name npc_iter_no_op * npc.c * enable cc warnings * name npc_find_near * use singular options.asset_path * smores * cc_dsl only when needed * kinda fix configure for splat refactor2 * ok! * new msg format * remove old msg format docs * slight bug fixes, splat adjustment * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "cfc140bb76" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "cfc140bb76" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * git subrepo pull (merge) --force tools/splat subrepo: subdir: "tools/splat" merged: "85349befcd" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "85349befcd" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" * Update symbol addrs * git subrepo pull tools/splat subrepo: subdir: "tools/splat" merged: "a44631e194" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "a44631e194" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596" Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 09:47:52 +02:00
#include "common.h"
void update_camera_mode_6(Camera* camera) {
2023-01-24 00:46:51 +01:00
f32 sinBoom;
f32 cosBoom;
f32 deltaX;
f32 deltaY;
f32 deltaZ;
f32 deltaX2;
f32 deltaY2;
f32 deltaZ2;
f32 boomYaw;
2023-01-24 00:46:51 +01:00
f32 new_var;
2023-01-24 00:46:51 +01:00
if (camera->unk_06 != 0 || camera->isChangingMap) {
camera->unk_06 = 0;
2023-01-24 00:46:51 +01:00
camera->isChangingMap = FALSE;
camera->auxPitch = 0;
camera->auxBoomLength = 100;
camera->lookAt_dist = 100;
camera->auxBoomPitch = 0;
camera->auxBoomYaw = 0;
camera->auxBoomZOffset = 0;
camera->targetPos.x = 0.0f;
camera->targetPos.y = 0.0f;
camera->targetPos.z = 0.0f;
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 (camera->auxPitch == 0) {
2023-01-24 00:46:51 +01:00
camera->lookAt_obj.x = camera->lookAt_obj_target.x + camera->targetPos.x;
camera->lookAt_obj.y = camera->lookAt_obj_target.y + camera->targetPos.y + camera->auxBoomZOffset * 0.00390625;
camera->lookAt_obj.z = camera->lookAt_obj_target.z + camera->targetPos.z;
camera->trueRotation.x = camera->auxBoomYaw;
camera->currentBoomYaw = camera->auxBoomPitch;
camera->currentBoomLength = camera->auxBoomLength;
2023-01-24 00:46:51 +01:00
camera->vfov = (10000 / camera->lookAt_dist) / 4;
boomYaw = DEG_TO_RAD(camera->currentBoomYaw);
2023-01-24 00:46:51 +01:00
sinBoom = sin_rad(boomYaw);
cosBoom = cos_rad(boomYaw);
deltaX = 0.0f;
deltaY = 0.0f;
deltaZ = camera->currentBoomLength;
deltaX2 = deltaX;
deltaY2 = deltaY;
boomYaw = deltaX = -deltaY2;
deltaZ2 = deltaZ;
new_var = boomYaw;
deltaX = deltaX2;
deltaY = cosBoom * deltaY2 + deltaZ2 * sinBoom;
deltaZ = sinBoom * new_var + deltaZ2 * cosBoom;
boomYaw = DEG_TO_RAD(camera->trueRotation.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->currentYaw = atan2(camera->lookAt_eye.x, camera->lookAt_eye.z, camera->lookAt_obj.x, camera->lookAt_obj.z);
2023-01-24 00:46:51 +01:00
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->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ);
camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf(SQ(deltaX) + SQ(deltaZ)));
gBattleStatus.camLookatObjPos.x = camera->lookAt_obj.x;
gBattleStatus.camLookatObjPos.y = camera->lookAt_obj.y;
gBattleStatus.camLookatObjPos.z = camera->lookAt_obj.z;
}