Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

FF7: Preserve world camera state when changing game modes #651

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## FF7

- Renderer: Fixed fog being incorrectly applied to Emerald Weapon battle ( https://github.com/julianxhokaxhiu/FFNx/pull/648 )
- Renderer: Preserve world camera state when changing game modes ( https://github.com/julianxhokaxhiu/FFNx/pull/651 )

## FF8

Expand Down
14 changes: 9 additions & 5 deletions src/ff7/world/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,20 @@ namespace ff7::world
float targetRotationX = -ff7_externals.world_get_camera_rotation_x_74F916() * 360.0f / 4096.0f;
//ff7_externals.world_get_camera_rotation_x_74F916();

static float zoomTarget = 10000.0f;
static float zoomTarget = 10000.0f;
static int cameraStatusCounter = 0;
float maxZoomDist = camera.getMaxZoomDist();

if(world_map_type != SNOWSTORM &&
*ff7_externals.world_is_control_enabled_DE6B5C &&
ff7_externals.world_get_unknown_flag_75335C())
if(world_map_type != SNOWSTORM && ff7_externals.world_get_unknown_flag_75335C())
{
targetRotationX = camera.targetRotation.x;
zoomTarget = std::min(maxZoomDist, std::max(camera.minZoomDist, zoomTarget - camera.getZoomSpeed()));
} else zoomTarget = 10000.0f;
cameraStatusCounter = 0;
} else
{
if (cameraStatusCounter > 0) zoomTarget = 10000.0f;
cameraStatusCounter++;
}

const float t = 0.1f * movement_multiplier;
camera.rotationOffset.x = (1.0f - t) * camera.rotationOffset.x + t * targetRotationX;
Expand Down