[Scummvm-git-logs] scummvm master -> aa636ce0b0bc009dbead62ac26e8f2d3a0088f2a
yuv422
yuv422 at users.noreply.github.com
Wed Mar 4 11:45:01 UTC 2020
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:
aa636ce0b0 DRAGONS: Adding support for intro videos
Commit: aa636ce0b0bc009dbead62ac26e8f2d3a0088f2a
https://github.com/scummvm/scummvm/commit/aa636ce0b0bc009dbead62ac26e8f2d3a0088f2a
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-03-04T22:44:13+11:00
Commit Message:
DRAGONS: Adding support for intro videos
Changed paths:
A engines/dragons/strplayer.cpp
A engines/dragons/strplayer.h
engines/dragons/dragons.cpp
engines/dragons/dragons.h
engines/dragons/module.mk
diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index 4b203223ac..26c0510c75 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -47,6 +47,7 @@
#include "dragons/bag.h"
#include "dragons/talk.h"
#include "dragons/sound.h"
+#include "dragons/strplayer.h"
namespace Dragons {
@@ -72,6 +73,7 @@ DragonsEngine::DragonsEngine(OSystem *syst, const ADGameDescription *desc) : Eng
_credits = NULL;
_talk = NULL;
_fontManager = NULL;
+ _strPlayer = NULL;
_sceneUpdateFunction = NULL;
_vsyncUpdateFunction = NULL;
@@ -211,10 +213,16 @@ Common::Error DragonsEngine::run() {
_scene = new Scene(this, _screen, _scriptOpcodes, _actorManager, _dragonRMS, _dragonINIResource, _backgroundResourceLoader);
_sound = new SoundManager(this, _bigfileArchive, _dragonRMS);
+ _strPlayer = new StrPlayer(this, _screen);
if (ConfMan.hasKey("save_slot")) {
loadGameState(ConfMan.getInt("save_slot"));
} else {
+ _strPlayer->playVideo("crystald.str");
+ //TODO why doesn't this file load correctly? _video->playVideo("illusion.str");
+ _strPlayer->playVideo("labintro.str");
+
+ //TODO main menu here.
loadScene(0);
}
@@ -234,6 +242,7 @@ Common::Error DragonsEngine::run() {
delete _bigfileArchive;
delete _screen;
delete _sound;
+ delete _strPlayer;
debug("Ok");
return Common::kNoError;
diff --git a/engines/dragons/dragons.h b/engines/dragons/dragons.h
index 1a96b02166..f9e1cb00ff 100644
--- a/engines/dragons/dragons.h
+++ b/engines/dragons/dragons.h
@@ -121,6 +121,7 @@ class SequenceOpcodes;
class ScriptOpcodes;
class Talk;
class SoundManager;
+class StrPlayer;
struct DragonINI;
@@ -140,6 +141,7 @@ public:
Credits *_credits;
Talk *_talk;
SoundManager *_sound;
+ StrPlayer *_strPlayer;
PaletteCyclingInstruction _paletteCyclingTbl[8];
diff --git a/engines/dragons/module.mk b/engines/dragons/module.mk
index 13689b258d..5af8bbef9b 100644
--- a/engines/dragons/module.mk
+++ b/engines/dragons/module.mk
@@ -32,7 +32,8 @@ MODULE_OBJS := \
specialopcodes.o \
sound.o \
talk.o \
- vabsound.o
+ vabsound.o \
+ strplayer.o
# This module can be built as a plugin
ifeq ($(ENABLE_DRAGONS), DYNAMIC_PLUGIN)
diff --git a/engines/dragons/strplayer.cpp b/engines/dragons/strplayer.cpp
new file mode 100644
index 0000000000..5645e2f7e4
--- /dev/null
+++ b/engines/dragons/strplayer.cpp
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#include "video/psx_decoder.h"
+#include "dragons/dragons.h"
+#include "dragons/screen.h"
+#include "dragons/strplayer.h"
+
+namespace Dragons {
+
+StrPlayer::StrPlayer(DragonsEngine *vm, Screen *screen) : _vm(vm), _screen(screen) {
+ _decoder = new Video::PSXStreamDecoder(Video::PSXStreamDecoder::kCD2x);
+}
+
+void StrPlayer::playVideo(const Common::String &filename) {
+ bool skipped = false;
+ Common::Rect srcRect(0, 0, DRAGONS_SCREEN_WIDTH, DRAGONS_SCREEN_HEIGHT);
+ _decoder->loadFile(filename);
+ _decoder->start();
+
+ while (!_vm->shouldQuit() && !_decoder->endOfVideo() && !skipped) {
+ if (_decoder->needsUpdate()) {
+ const Graphics::Surface *frame = _decoder->decodeNextFrame();
+ if (frame) {
+ _screen->copyRectToSurface(*frame, 0, 0, srcRect);
+ _screen->updateScreen();
+ }
+ }
+
+ Common::Event event;
+ while (_vm->_system->getEventManager()->pollEvent(event)) {
+ if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) {
+ skipped = true;
+ }
+ }
+
+ _vm->_system->delayMillis(10);
+ }
+ _screen->clearScreen();
+ _decoder->close();
+}
+
+} // End of namespace Dragons
diff --git a/engines/dragons/strplayer.h b/engines/dragons/strplayer.h
new file mode 100644
index 0000000000..cc001c7798
--- /dev/null
+++ b/engines/dragons/strplayer.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef DRAGONS_STRPLAYER_H
+#define DRAGONS_STRPLAYER_H
+
+#include "video/psx_decoder.h"
+namespace Dragons {
+
+class DragonsEngine;
+class Screen;
+
+class StrPlayer {
+private:
+ DragonsEngine *_vm;
+ Screen *_screen;
+ Video::VideoDecoder *_decoder;
+public:
+ StrPlayer(DragonsEngine *vm, Screen *screen);
+
+ void playVideo(const Common::String &filename);
+private:
+};
+
+} // End of namespace Dragons
+
+#endif //DRAGONS_STRPLAYER_H
More information about the Scummvm-git-logs
mailing list