Fix camera problems (#398)

Fixed the issue where the camera wasn't behaving like vanilla in vanilla sm64
Fixed the issue where the camera was just stuck while in water/flying in a romhack
This commit is contained in:
Sunk 2024-11-04 02:49:23 -05:00 committed by GitHub
parent aa12eaacce
commit 1a440f6380
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -908,20 +908,21 @@ void pan_ahead_of_player(struct Camera *c) {
}
s16 find_in_bounds_yaw_wdw_bob_thi(UNUSED Vec3f pos, UNUSED Vec3f origin, s16 yaw) {
// switch (gCurrLevelArea) {
// case AREA_WDW_MAIN:
// yaw = clamp_positions_and_find_yaw(pos, origin, 4508.f, -3739.f, 4508.f, -3739.f);
// break;
// case AREA_BOB:
// yaw = clamp_positions_and_find_yaw(pos, origin, 8000.f, -8000.f, 7050.f, -8000.f);
// break;
// case AREA_THI_HUGE:
// yaw = clamp_positions_and_find_yaw(pos, origin, 8192.f, -8192.f, 8192.f, -8192.f);
// break;
// case AREA_THI_TINY:
// yaw = clamp_positions_and_find_yaw(pos, origin, 2458.f, -2458.f, 2458.f, -2458.f);
// break;
// }
if (!gCameraUseCourseSpecificSettings) { return yaw; }
switch (gCurrLevelArea) {
case AREA_WDW_MAIN:
yaw = clamp_positions_and_find_yaw(pos, origin, 4508.f, -3739.f, 4508.f, -3739.f);
break;
case AREA_BOB:
yaw = clamp_positions_and_find_yaw(pos, origin, 8000.f, -8000.f, 7050.f, -8000.f);
break;
case AREA_THI_HUGE:
yaw = clamp_positions_and_find_yaw(pos, origin, 8192.f, -8192.f, 8192.f, -8192.f);
break;
case AREA_THI_TINY:
yaw = clamp_positions_and_find_yaw(pos, origin, 2458.f, -2458.f, 2458.f, -2458.f);
break;
}
return yaw;
}
@ -1926,14 +1927,18 @@ s32 update_behind_mario_camera(struct Camera *c, Vec3f focus, Vec3f pos) {
dist = 300.f;
}
vec3f_set_dist_and_angle(focus, pos, dist, pitch, yaw);
if (gCurrLevelArea == AREA_WDW_MAIN) {
yaw = clamp_positions_and_find_yaw(pos, focus, 4508.f, -3739.f, 4508.f, -3739.f);
}
if (gCurrLevelArea == AREA_THI_HUGE) {
yaw = clamp_positions_and_find_yaw(pos, focus, 8192.f, -8192.f, 8192.f, -8192.f);
}
if (gCurrLevelArea == AREA_THI_TINY) {
yaw = clamp_positions_and_find_yaw(pos, focus, 2458.f, -2458.f, 2458.f, -2458.f);
if (!gCameraUseCourseSpecificSettings) { return yaw; }
switch (gCurrLevelArea) {
case AREA_WDW_MAIN:
yaw = clamp_positions_and_find_yaw(pos, focus, 4508.f, -3739.f, 4508.f, -3739.f);
break;
case AREA_THI_HUGE:
yaw = clamp_positions_and_find_yaw(pos, focus, 8192.f, -8192.f, 8192.f, -8192.f);
break;
case AREA_THI_TINY:
yaw = clamp_positions_and_find_yaw(pos, focus, 2458.f, -2458.f, 2458.f, -2458.f);
break;
}
return yaw;
@ -2425,7 +2430,7 @@ s16 update_default_camera(struct Camera *c) {
c->pos[1] = ceilHeight;
}
}
if (gCurrLevelArea == AREA_WDW_TOWN) {
if (gCameraUseCourseSpecificSettings && gCurrLevelArea == AREA_WDW_TOWN) {
yaw = clamp_positions_and_find_yaw(c->pos, c->focus, 2254.f, -3789.f, 3790.f, -2253.f);
}
return yaw;