Revert some camera "optimisations"

This commit is contained in:
Fazana
2021-10-03 14:56:16 +01:00
parent 6dde1e9026
commit 6052ed8cdf
3 changed files with 222 additions and 92 deletions

View File

@@ -55,7 +55,7 @@ s32 intro_lakitu_set_pos_and_focus(struct Object *obj, struct CutsceneSplinePoin
void bhv_intro_lakitu_loop(void) {
Vec3f offset, fromPoint, toPoint;
s16 yawToCam;
s16 yawToCam;
switch (gCurrentObject->oAction) {
case 0:
@@ -94,10 +94,18 @@ void bhv_intro_lakitu_loop(void) {
cur_obj_play_sound_2(SOUND_ACTION_INTRO_UNK45E);
break;
#endif
case 73: gCurrentObject->oAnimState++; break;
case 74: gCurrentObject->oAnimState--; break;
case 82: gCurrentObject->oAnimState++; break;
case 84: gCurrentObject->oAnimState--; break;
case 73:
gCurrentObject->oAnimState += 1;
break;
case 74:
gCurrentObject->oAnimState -= 1;
break;
case 82:
gCurrentObject->oAnimState += 1;
break;
case 84:
gCurrentObject->oAnimState -= 1;
break;
}
#ifdef VERSION_EU
if (gCurrentObject->oTimer == 446)
@@ -155,14 +163,14 @@ void bhv_intro_lakitu_loop(void) {
#else
#define TIMER 98
#endif
if (gCurrentObject->oTimer == TIMER) {
obj_mark_for_deletion(gCurrentObject);
obj_mark_for_deletion(gCurrentObject->oIntroLakituCloud);
}
#ifndef VERSION_JP
if (gCurrentObject->oTimer == 14) {
if (gCurrentObject->oTimer == 14)
cur_obj_play_sound_2(SOUND_ACTION_INTRO_UNK45F);
}
#endif
break;
case 100:
@@ -180,11 +188,13 @@ void bhv_intro_lakitu_loop(void) {
case 101:
vec3f_copy(toPoint, &gCurrentObject->oPosVec);
if (gCurrentObject->oTimer > 60) {
gCurrentObject->oForwardVel = approach_f32_asymptotic(gCurrentObject->oForwardVel, -10.f, 0.05f);
gCurrentObject->oForwardVel =
approach_f32_asymptotic(gCurrentObject->oForwardVel, -10.f, 0.05f);
gCurrentObject->oMoveAngleYaw += 0x78;
gCurrentObject->oMoveAnglePitch += 0x40;
vec3f_get_yaw(toPoint, gCamera->pos, &yawToCam);
gCurrentObject->oFaceAngleYaw = camera_approach_s16_symmetric(gCurrentObject->oFaceAngleYaw, yawToCam, 0x200);
gCurrentObject->oFaceAngleYaw = camera_approach_s16_symmetric(
gCurrentObject->oFaceAngleYaw, (s16) calculate_yaw(toPoint, gCamera->pos),
0x200);
}
if (gCurrentObject->oTimer > 105) {
gCurrentObject->oAction++;

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
* @see camera.c
*/
#define ABS2(x) ((x) >= 0.f ? (x) : -(x))
#define LEVEL_AREA_INDEX(levelNum, areaNum) (((levelNum) << 4) + (areaNum))
/**
@@ -703,6 +704,12 @@ void random_vec3s(Vec3s dst, s16 xRange, s16 yRange, s16 zRange);
s32 clamp_positions_and_find_yaw(Vec3f pos, Vec3f origin, f32 xMax, f32 xMin, f32 zMax, f32 zMin);
s32 is_range_behind_surface(Vec3f from, Vec3f to, struct Surface *surf, s16 range, s16 surfType);
void scale_along_line(Vec3f dest, Vec3f from, Vec3f to, f32 scale);
s16 calculate_pitch(Vec3f from, Vec3f to);
s16 calculate_yaw(Vec3f from, Vec3f to);
void calculate_angles(Vec3f from, Vec3f to, s16 *pitch, s16 *yaw);
f32 calc_abs_dist(Vec3f a, Vec3f b);
f32 calc_abs_dist_squared(Vec3f a, Vec3f b);
f32 calc_hor_dist(Vec3f a, Vec3f b);
void rotate_in_xz(Vec3f dst, Vec3f src, s16 yaw);
void rotate_in_yz(Vec3f dst, Vec3f src, s16 pitch);
void set_camera_pitch_shake(s16 mag, s16 decay, s16 inc);