diff options
author | Dmitry Iskrich | 2016-06-01 17:38:09 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | f8583622848e1d3d451871ad944645b38714b3ce (patch) | |
tree | 11d7d8297d6db5a82393eeebf0290d3fd69657e7 /engines | |
parent | 961adeee7f0ff24f435a3db91e7298c98accaac5 (diff) | |
download | scummvm-rg350-f8583622848e1d3d451871ad944645b38714b3ce.tar.gz scummvm-rg350-f8583622848e1d3d451871ad944645b38714b3ce.tar.bz2 scummvm-rg350-f8583622848e1d3d451871ad944645b38714b3ce.zip |
DIRECTOR: Move score loading resource to constructor
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/director.cpp | 10 | ||||
-rw-r--r-- | engines/director/score.cpp | 13 | ||||
-rw-r--r-- | engines/director/score.h | 10 |
3 files changed, 17 insertions, 16 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index bd08adfb2f..a044f23cc4 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -70,15 +70,7 @@ Common::Error DirectorEngine::run() { _mainArchive = new RIFFArchive(); _mainArchive->openFile("bookshelf_example.mmm"); - Common::SeekableReadStream *scr = _mainArchive->getResource(MKTAG('V','W','S','C'), 1024); - Score score(*scr, *_mainArchive); - - Common::SeekableReadStream *conf = _mainArchive->getResource(MKTAG('V','W','C','F'), 1024); - score.loadConfig(*conf); - - Common::SeekableReadStream *records = _mainArchive->getResource(MKTAG('V','W','C','R'), 1024); - score.loadCastData(*records); - + Score score(*_mainArchive); score.play(); if (getPlatform() == Common::kPlatformWindows) diff --git a/engines/director/score.cpp b/engines/director/score.cpp index abeb894145..ed4d11ffe5 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -35,11 +35,20 @@ namespace Director { -Score::Score(Common::SeekableReadStream &stream, Archive &movie) { +Score::Score(Archive &movie) { _surface = new Graphics::ManagedSurface; - _movieArchive = &movie; + assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024)); + assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024)); + assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024)); + + loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024)); + loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024)); + loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024)); +} + +void Score::loadFrames(Common::SeekableReadStream &stream) { uint32 size = stream.readUint32BE(); size -= 4; uint16 channelSize; diff --git a/engines/director/score.h b/engines/director/score.h index 0656ed1d6b..ba10f2df7e 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -184,17 +184,17 @@ public: class Score { public: - Score(Common::SeekableReadStream &stream, Archive &movie); - void readVersion(uint32 rid); - void loadConfig(Common::SeekableReadStream &stream); - void loadCastData(Common::SeekableReadStream &stream); + Score(Archive &movie); static Common::Rect readRect(Common::SeekableReadStream &stream); void play(); private: void processEvents(); void display(); - + void readVersion(uint32 rid); + void loadConfig(Common::SeekableReadStream &stream); + void loadCastData(Common::SeekableReadStream &stream); + void loadFrames(Common::SeekableReadStream &stream); public: Common::Array<Frame *> _frames; Common::HashMap<int, Cast *> _casts; |