Fix movie positioning

See #3
This commit is contained in:
Alexander Batalov 2022-05-21 23:04:08 +03:00
parent 86d8a92ce0
commit 1267b8ddfb
2 changed files with 21 additions and 2 deletions

View File

@ -18,6 +18,9 @@
#include <stdio.h>
#include <string.h>
#define GAME_MOVIE_WINDOW_WIDTH 640
#define GAME_MOVIE_WINDOW_HEIGHT 480
// 0x50352A
const float flt_50352A = 0.032258064f;
@ -171,7 +174,14 @@ int gameMoviePlay(int movie, int flags)
gGameMovieFaded = true;
}
int win = windowCreate(0, 0, 640, 480, 0, WINDOW_FLAG_0x10);
int gameMovieWindowX = (screenGetWidth() - GAME_MOVIE_WINDOW_WIDTH) / 2;
int gameMovieWindowY = (screenGetHeight() - GAME_MOVIE_WINDOW_HEIGHT) / 2;
int win = windowCreate(gameMovieWindowX,
gameMovieWindowY,
GAME_MOVIE_WINDOW_WIDTH,
GAME_MOVIE_WINDOW_HEIGHT,
0,
WINDOW_FLAG_0x10);
if (win == -1) {
gGameMovieIsPlaying = false;
return -1;

View File

@ -216,6 +216,15 @@ void movieDirectImpl(LPDIRECTDRAWSURFACE a1, int a2, int a3, int a4, int a5, int
_lastMovieBW = a2;
_lastMovieH = destRect.bottom - destRect.top;
// The code above assumes `gMovieWindowRect` is always at (0,0) which is not
// the case in HRP. For blitting purposes we have to adjust it relative to
// the actual origin. We do it here because the variables above need to stay
// in movie window coordinate space (for proper subtitles positioning).
destRect.left += gMovieWindowRect.left;
destRect.top += gMovieWindowRect.top;
destRect.right += gMovieWindowRect.left;
destRect.bottom += gMovieWindowRect.top;
HRESULT hr;
do {
if (_movieCaptureFrameFunc != NULL) {
@ -515,7 +524,7 @@ File* movieOpen(char* filePath)
// 0x487380
void movieLoadSubtitles(char* filePath)
{
_subtitleW = _windowGetXres();
_subtitleW = windowGetWidth(gMovieWindow);
_subtitleH = fontGetLineHeight() + 4;
if (gMovieBuildSubtitleFilePathProc != NULL) {