[Scummvm-git-logs] scummvm master -> c98001f68ee75f713b9bd564807e35e6838d4849

sev- noreply at scummvm.org
Wed Sep 28 15:11:02 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c98001f68e AGOS: FEEBLE: Add subtitles support for SMK videos


Commit: c98001f68ee75f713b9bd564807e35e6838d4849
    https://github.com/scummvm/scummvm/commit/c98001f68ee75f713b9bd564807e35e6838d4849
Author: BLooperZ (blooperz at users.noreply.github.com)
Date: 2022-09-28T17:10:58+02:00

Commit Message:
AGOS: FEEBLE: Add subtitles support for SMK videos

Changed paths:
    engines/agos/animation.cpp
    engines/agos/animation.h


diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 34ba2b869bc..34fc60bf654 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -416,6 +416,12 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
 
 	memset(baseName, 0, sizeof(baseName));
 	memcpy(baseName, name, strlen(name));
+
+	int16 h = g_system->getOverlayHeight();
+
+	_subtitles.setBBox(Common::Rect(20, h - 120, g_system->getOverlayWidth() - 20, h - 20));
+	_subtitles.setColor(0xff, 0xff, 0xff);
+	_subtitles.setFont("FreeSans.ttf");
 }
 
 bool MoviePlayerSMK::load() {
@@ -431,6 +437,9 @@ bool MoviePlayerSMK::load() {
 
 	CursorMan.showMouse(false);
 
+	Common::String subtitlesName = Common::String::format("%s.srt", baseName);
+	loadSubtitles(subtitlesName.c_str());
+
 	return true;
 }
 
@@ -457,11 +466,16 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
 }
 
 void MoviePlayerSMK::playVideo() {
-	while (!endOfVideo() && !_skipMovie && !_vm->shouldQuit())
+	while (!endOfVideo() && !_skipMovie && !_vm->shouldQuit()) {
+		_subtitles.drawSubtitle(getTime(), true);
 		handleNextFrame();
+		g_system->showOverlay();
+		g_system->clearOverlay();
+	}
 }
 
 void MoviePlayerSMK::stopVideo() {
+	g_system->hideOverlay();
 	close();
 }
 
diff --git a/engines/agos/animation.h b/engines/agos/animation.h
index 791d6287a36..0c5e75558fc 100644
--- a/engines/agos/animation.h
+++ b/engines/agos/animation.h
@@ -26,6 +26,7 @@
 
 #include "video/dxa_decoder.h"
 #include "video/smk_decoder.h"
+#include "video/subtitles.h"
 #include "audio/mixer.h"
 
 namespace AGOS {
@@ -61,11 +62,13 @@ public:
 	virtual void playVideo() = 0;
 	virtual void nextFrame() = 0;
 	virtual void stopVideo() = 0;
+	void loadSubtitles(const char *fname) { _subtitles.loadSRTFile(fname); }
 
 protected:
 	virtual void handleNextFrame();
 	virtual bool processFrame() = 0;
 	virtual void startSound() {}
+	Video::Subtitles _subtitles;
 };
 
 class MoviePlayerDXA : public MoviePlayer, Video::DXADecoder {




More information about the Scummvm-git-logs mailing list