diff options
author | Peter Kohaut | 2018-11-21 23:16:15 +0100 |
---|---|---|
committer | Peter Kohaut | 2018-11-24 08:39:03 +0100 |
commit | 824ecc0aad325c54f34c8fb7f64cf4df71c53090 (patch) | |
tree | 109abb14609bacaac2c0b1b2ed42e67a8cd2c5ec /engines/bladerunner/overlays.cpp | |
parent | 44b68a0aeb92d6dc6b6d1b3260ec5f82c529b9f0 (diff) | |
download | scummvm-rg350-824ecc0aad325c54f34c8fb7f64cf4df71c53090.tar.gz scummvm-rg350-824ecc0aad325c54f34c8fb7f64cf4df71c53090.tar.bz2 scummvm-rg350-824ecc0aad325c54f34c8fb7f64cf4df71c53090.zip |
BLADERUNNER: Preliminary saving & loading support
Saving and loading is accessible via ScummVM dialogs.
No in-game UI support yet.
It is possible to load saves from original game via debugger console.
ScummVM saves have additional header and are incompatibile with original
game.
Diffstat (limited to 'engines/bladerunner/overlays.cpp')
-rw-r--r-- | engines/bladerunner/overlays.cpp | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/engines/bladerunner/overlays.cpp b/engines/bladerunner/overlays.cpp index 65ba83f15d..5bbac87c36 100644 --- a/engines/bladerunner/overlays.cpp +++ b/engines/bladerunner/overlays.cpp @@ -69,14 +69,15 @@ int Overlays::play(const Common::String &name, int loopId, bool loopForever, boo _videos[index].loaded = true; _videos[index].name = name; _videos[index].hash = hash; - _videos[index].vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceFront); + _videos[index].loopId = loopId; + _videos[index].loopForever = loopForever; + _videos[index].vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceFront, Common::String::format("%s.VQA", name.c_str())); // repeat forever _videos[index].vqaPlayer->setBeginAndEndFrame(0, 0, -1, kLoopSetModeJustStart, nullptr, nullptr); } - Common::String resourceName = Common::String::format("%s.VQA", name.c_str()); - _videos[index].vqaPlayer->open(resourceName); + _videos[index].vqaPlayer->open(); _videos[index].vqaPlayer->setLoop( loopId, loopForever ? -1 : 0, @@ -86,6 +87,29 @@ int Overlays::play(const Common::String &name, int loopId, bool loopForever, boo return index; } +void Overlays::resume(bool isLoadingGame) { + + for (int i = 0; i < kOverlayVideos; ++i) { + if (_videos[i].loaded && isLoadingGame) { + _videos[i].vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceFront, Common::String::format("%s.VQA", _videos[i].name.c_str())); + if (!_videos[i].vqaPlayer) { + resetSingle(i); + continue; + } + + _videos[i].vqaPlayer->open(); + _videos[i].vqaPlayer->setLoop( + _videos[i].loopId, + _videos[i].loopForever ? -1 : 0, + kLoopSetModeImmediate, + nullptr, nullptr); + + _videos[i].vqaPlayer->seekToFrame(_videos[i].frame); + _videos[i].vqaPlayer->update(true); + } + } +} + void Overlays::remove(const Common::String &name) { int index = findByHash(MIXArchive::getHash(name)); if (index >= 0) { @@ -104,8 +128,8 @@ void Overlays::removeAll() { void Overlays::tick() { for (int i = 0; i < kOverlayVideos; ++i) { if (_videos[i].loaded) { - int frame = _videos[i].vqaPlayer->update(true); - if (frame < 0) { + _videos[i].frame = _videos[i].vqaPlayer->update(true); + if (_videos[i].frame < 0) { resetSingle(i); } } @@ -138,7 +162,7 @@ void Overlays::resetSingle(int i) { } _videos[i].loaded = false; _videos[i].hash = 0; - _videos[i].field2 = -1; + _videos[i].frame = -1; _videos[i].name.clear(); } @@ -155,9 +179,9 @@ void Overlays::save(SaveFileWriteStream &f) { f.writeInt(0); // vqaPlayer pointer f.writeStringSz(ov.name, 13); f.writeSint32LE(ov.hash); - f.writeInt(ov.field0); - f.writeInt(ov.field1); - f.writeInt(ov.field2); + f.writeInt(ov.loopId); + f.writeBool(ov.loopForever); + f.writeInt(ov.frame); } } @@ -171,9 +195,9 @@ void Overlays::load(SaveFileReadStream &f) { ov.vqaPlayer = nullptr; ov.name = f.readStringSz(13); ov.hash = f.readSint32LE(); - ov.field0 = f.readInt(); - ov.field1 = f.readInt(); - ov.field2 = f.readInt(); + ov.loopId = f.readInt(); + ov.loopForever = f.readBool(); + ov.frame = f.readInt(); } } |