EMI: use enableSubtitles parameter of StartMovie lua function

This commit is contained in:
Christian Krause 2013-12-27 23:59:28 +01:00
parent 9b1b336a7b
commit ff930b84de
3 changed files with 15 additions and 3 deletions

View File

@ -155,16 +155,25 @@ void Lua_V2::GetCPUSpeed() {
// the only real difference from L1 is the lack of looping
void Lua_V2::StartMovie() {
lua_Object name = lua_getparam(1);
lua_Object subtitlesObj = lua_getparam(2);
if (!lua_isstring(name)) {
lua_pushnil();
return;
}
Lua_V1::CleanBuffer();
bool showSubtitles = false;
if (lua_isnumber(subtitlesObj)) {
if ((int)lua_getnumber(subtitlesObj)) {
showSubtitles = true;
}
}
GrimEngine::EngineMode prevEngineMode = g_grim->getMode();
g_grim->setMode(GrimEngine::SmushMode);
g_grim->setMovieSubtitle(NULL);
bool result = g_movie->play(lua_getstring(name), false, 0, 0);
bool result = g_movie->play(lua_getstring(name), false, 0, 0, true, showSubtitles);
if (!result)
g_grim->setMode(prevEngineMode);
pushbool(result);

View File

@ -41,6 +41,7 @@ MoviePlayer::MoviePlayer() {
_videoLooping = false;
_videoPause = true;
_updateNeeded = false;
_showSubtitles = true;
_movieTime = 0;
_frame = -1;
_x = 0;
@ -149,13 +150,14 @@ void MoviePlayer::deinit() {
_videoFinished = true;
}
bool MoviePlayer::play(const Common::String &filename, bool looping, int x, int y, bool start) {
bool MoviePlayer::play(const Common::String &filename, bool looping, int x, int y, bool start, bool showSubtitles) {
Common::StackLock lock(_frameMutex);
deinit();
_x = x;
_y = y;
_fname = filename;
_videoLooping = looping;
_showSubtitles = showSubtitles;
if (!loadFile(_fname))
return false;

View File

@ -41,6 +41,7 @@ protected:
Graphics::Surface *_externalSurface;
int32 _frame;
bool _updateNeeded;
bool _showSubtitles;
float _movieTime;
int _channels;
int _freq;
@ -66,7 +67,7 @@ public:
* @see init
* @see stop
*/
virtual bool play(const Common::String &filename, bool looping, int x, int y, bool start = true);
virtual bool play(const Common::String &filename, bool looping, int x, int y, bool start = true, bool showSubtitles = false);
virtual void stop();
virtual void pause(bool p);
virtual bool isPlaying() { return !_videoFinished; }