ASYLUM: Added video player. The game introduction is played now

git-svn-id: http://asylumengine.googlecode.com/svn/trunk@42 0bfb4aae-4ea4-11de-8d8d-752d95cf3e3c
This commit is contained in:
Filippos Karapetis
2021-05-17 15:35:07 +02:00
committed by Eugene Sandulenko
parent 33bf78171a
commit bbf75e1cd4
6 changed files with 124 additions and 2 deletions
+5 -1
View File
@@ -26,6 +26,7 @@
#include "asylum/asylum.h"
#include "asylum/screen.h"
#include "asylum/resources/video.h"
namespace Asylum {
@@ -42,6 +43,7 @@ AsylumEngine::~AsylumEngine() {
//Common::clearAllDebugChannels();
delete _screen;
delete _resMgr;
delete _video;
}
Common::Error AsylumEngine::run() {
@@ -58,6 +60,7 @@ Common::Error AsylumEngine::init() {
_screen = new Screen(_system);
_resMgr = new ResourceManager;
_video = new Video(this);
// initializing game
// TODO: save dialogue key codes into sntrm_k.txt (need to figure out why they use such thing)
@@ -66,13 +69,14 @@ Common::Error AsylumEngine::init() {
// TODO: setup cinematics (address 0041A880) (probably we won't need it)
// TODO: init unknown game stuffs (address 0040F430)
// TODO: load smaker intro movie (0)->(mov000.smk)
// TODO: if savegame exists on folder, than start NewGame()
return Common::kNoError;
}
Common::Error AsylumEngine::go() {
// Play intro movie
_video->playVideo("mov000.smk");
showMainMenu();
+2
View File
@@ -30,6 +30,7 @@ namespace Asylum {
class Screen;
class Menu;
class Video;
class AsylumEngine: public Engine {
public:
@@ -49,6 +50,7 @@ private:
ResourceManager *_resMgr;
Screen *_screen;
Video *_video;
void showMainMenu();
+8
View File
@@ -208,6 +208,14 @@
RelativePath="..\..\engines\asylum\resources\resource.h"
>
</File>
<File
RelativePath="..\..\engines\asylum\resources\video.cpp"
>
</File>
<File
RelativePath="..\..\engines\asylum\resources\video.h"
>
</File>
</Filter>
<File
RelativePath="..\..\engines\asylum\asylum.cpp"
+2 -1
View File
@@ -9,7 +9,8 @@ MODULE_OBJS := \
bundles/graphicbundle.o \
bundles/palettebundle.o \
resources/resource.o \
resources/graphic.o
resources/graphic.o \
resources/movie.o
# This module can be built as a plugin
ifeq ($(ENABLE_ASYLUM), DYNAMIC_PLUGIN)
+54
View File
@@ -0,0 +1,54 @@
/* 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 "asylum/resources/video.h"
namespace Asylum {
Video::Video(AsylumEngine *vm) : _vm(vm) {
Common::Event stopEvent;
_stopEvents.clear();
stopEvent.type = Common::EVENT_KEYDOWN;
stopEvent.kbd = Common::KEYCODE_ESCAPE;
_stopEvents.push_back(stopEvent);
_smkDecoder = new Graphics::SmackerDecoder(_vm->_mixer);
_player = new Graphics::VideoPlayer(_smkDecoder);
}
Video::~Video() {
delete _player;
delete _smkDecoder;
}
bool Video::playVideo(const char *filename) {
bool result = _smkDecoder->loadFile(filename);
// TODO: hide mouse
if (result)
_player->playVideo(_stopEvents);
_smkDecoder->closeFile();
// TODO: show mouse
return result;
}
} // end of namespace Asylum
+53
View File
@@ -0,0 +1,53 @@
/* 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 ASYLUM_VIDEO_H_
#define ASYLUM_VIDEO_H_
#include "sound/mixer.h"
#include "graphics/surface.h"
#include "graphics/video/smk_decoder.h"
#include "common/events.h"
#include "common/system.h"
#include "common/list.h"
#include "asylum/asylum.h"
namespace Asylum {
class Video {
public:
Video(AsylumEngine *vm);
virtual ~Video();
bool playVideo(const char *filename);
private:
Common::List<Common::Event> _stopEvents;
Graphics::SmackerDecoder *_smkDecoder;
Graphics::VideoPlayer *_player;
AsylumEngine *_vm;
}; // end of class Video
} // end of namespace Asylum
#endif