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: Allow movies to be extended to true widescreen mode #700

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
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
- External textures: Reuse already loaded textures on fallback to palette 0 ( https://github.com/julianxhokaxhiu/FFNx/pull/692 )
- Rendering: Add bilinear filtering option `enable_bilinear` ( https://github.com/julianxhokaxhiu/FFNx/pull/692 )

## FF7
- Widescreen: Added feature to extend movies in true widescreen mode ( https://github.com/julianxhokaxhiu/FFNx/pull/700 )

## FF8

- Audio: Add ambient layer support for Fields and Battles
Expand Down
1 change: 1 addition & 0 deletions src/ff7/field/background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ namespace ff7::field
float half_width = 160 + std::min(53, cameraRangeSize / 2 - 160);

point->x += widescreen.getHorizontalOffset();
point->y += widescreen.getVerticalOffset();

if (point->x > camera_range.right - half_width)
point->x = camera_range.right - half_width;
Expand Down
3 changes: 2 additions & 1 deletion src/ff7/widescreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ enum WIDESCREEN_MODE
WM_DISABLED,
WM_EXTEND_ONLY,
WM_ZOOM,
WM_EXTEND_WIDE
WM_EXTEND_WIDE,
WM_FILL
};

struct Keyframe
Expand Down
28 changes: 24 additions & 4 deletions src/gl/gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "../log.h"
#include "../matrix.h"

#include "../ff7/widescreen.h"

struct matrix d3dviewport_matrix = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
Expand All @@ -60,6 +62,24 @@ void gl_draw_movie_quad_common(uint32_t width, uint32_t height)

if (!ff8 && !ff7_field_center) movieOffsetY = 0.0f;

float movie_quad_x = 0.0f;
float movie_quad_y = movieOffsetY;
float movie_quad_height = movieHeight + movieOffsetY;
float movie_quad_width = movieWidth;
if (!ff8)
{
if (widescreen.getMovieMode() == WM_FILL)
{
movie_quad_x = wide_viewport_x;
movie_quad_y = 0.0f;
movie_quad_height = movieHeight + 2 * movieOffsetY;
movie_quad_width = wide_game_width;
} else if (widescreen.getMovieMode() == WM_EXTEND_ONLY)
{
movie_quad_x = wide_viewport_x;
}
}

/* y0 y2
x0 +-----+ x2
| /|
Expand All @@ -72,17 +92,17 @@ void gl_draw_movie_quad_common(uint32_t width, uint32_t height)
*/

// 0
float x0 = 0.0f;
float y0 = movieOffsetY;
float x0 = movie_quad_x;
float y0 = movie_quad_y;
float u0 = 0.0f;
float v0 = 0.0f;
// 1
float x1 = x0;
float y1 = movieHeight + movieOffsetY;
float y1 = movie_quad_height;
float u1 = u0;
float v1 = 1.0f;
// 2
float x2 = movieWidth;
float x2 = x0 + movie_quad_width;
float y2 = y0;
float u2 = 1.0f;
float v2 = v0;
Expand Down