aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2008-05-04 02:26:25 +0000
committerSven Hesse2008-05-04 02:26:25 +0000
commitdfc7a242f55d78fc8a551fcef735f8b5b8e61235 (patch)
tree6a411f5643b151c0588735dafe25587e105d6241
parent001adf1bb3dd354a9f383f261a8595300f218e8a (diff)
downloadscummvm-rg350-dfc7a242f55d78fc8a551fcef735f8b5b8e61235.tar.gz
scummvm-rg350-dfc7a242f55d78fc8a551fcef735f8b5b8e61235.tar.bz2
scummvm-rg350-dfc7a242f55d78fc8a551fcef735f8b5b8e61235.zip
Properly close the object videos when the objects are destroyed
svn-id: r31856
-rw-r--r--engines/gob/inter_v2.cpp3
-rw-r--r--engines/gob/mult.cpp11
-rw-r--r--engines/gob/mult.h2
-rw-r--r--engines/gob/mult_v1.cpp2
4 files changed, 18 insertions, 0 deletions
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index 62b2f26c7b..be510df08a 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -880,6 +880,9 @@ void Inter_v2::o2_initMult() {
if (_vm->_mult->_objects && (oldObjCount != _vm->_mult->_objCount)) {
warning("Initializing new objects without having "
"cleaned up the old ones at first");
+
+ _vm->_mult->clearObjectVideos();
+
delete[] _vm->_mult->_objects;
delete[] _vm->_mult->_renderObjs;
delete[] _vm->_mult->_orderArray;
diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp
index 924cc9a4a7..70b6d33136 100644
--- a/engines/gob/mult.cpp
+++ b/engines/gob/mult.cpp
@@ -36,6 +36,7 @@
#include "gob/scenery.h"
#include "gob/sound.h"
#include "gob/video.h"
+#include "gob/videoplayer.h"
namespace Gob {
@@ -120,6 +121,8 @@ void Mult::freeAll(void) {
}
void Mult::freeMult() {
+ clearObjectVideos();
+
delete[] _objects;
delete[] _renderData;
delete[] _renderObjs;
@@ -198,6 +201,8 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape,
if (!stopNoClear) {
if (_animDataAllocated) {
+ clearObjectVideos();
+
delete[] _objects;
delete[] _renderData;
delete[] _renderObjs;
@@ -424,4 +429,10 @@ void Mult::doSoundAnim(bool &stop, int16 frame) {
}
}
+void Mult::clearObjectVideos() {
+ for (int i = 0; i < _objCount; i++)
+ if (_objects[i].videoSlot > 0)
+ _vm->_vidPlayer->slotClose(_objects[i].videoSlot - 1);
+}
+
} // End of namespace Gob
diff --git a/engines/gob/mult.h b/engines/gob/mult.h
index ccc87849df..c283191ec8 100644
--- a/engines/gob/mult.h
+++ b/engines/gob/mult.h
@@ -245,6 +245,8 @@ public:
void playMult(int16 startFrame, int16 endFrame, char checkEscape,
char handleMouse);
+ void clearObjectVideos();
+
virtual void loadMult(int16 resId) = 0;
virtual void freeMultKeys() = 0;
virtual bool hasMultData(uint16 multIndex) = 0;
diff --git a/engines/gob/mult_v1.cpp b/engines/gob/mult_v1.cpp
index 4a5a817449..78071f1dd8 100644
--- a/engines/gob/mult_v1.cpp
+++ b/engines/gob/mult_v1.cpp
@@ -215,6 +215,8 @@ void Mult_v1::freeMultKeys() {
delete[] _multData->sndKeys;
if (_animDataAllocated) {
+ clearObjectVideos();
+
delete[] _objects;
delete[] _renderData;
delete[] _animArrayX;