diff --git a/src/game_movie.cc b/src/game_movie.cc index 188e717..e17226d 100644 --- a/src/game_movie.cc +++ b/src/game_movie.cc @@ -18,6 +18,9 @@ #include #include +#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; diff --git a/src/movie.cc b/src/movie.cc index 2cb3990..5b283f2 100644 --- a/src/movie.cc +++ b/src/movie.cc @@ -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) {