aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lab/engine.cpp16
-rw-r--r--engines/lab/lab.cpp2
-rw-r--r--engines/lab/lab.h1
-rw-r--r--engines/lab/labsets.cpp2
4 files changed, 19 insertions, 2 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 1823fe6fa5..19948270fb 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -309,6 +309,20 @@ bool LabEngine::setUpScreens() {
return true;
}
+void LabEngine::freeScreens() {
+ for (uint16 i = 0; i < 20; i++)
+ delete _moveImages[i];
+
+ if (getPlatform() == Common::kPlatformWindows) {
+ for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++)
+ delete _invImages[imgIdx];
+ } else {
+ for (uint16 imgIdx = 0; imgIdx < 6; imgIdx++)
+ delete _invImages[imgIdx];
+ }
+}
+
+
/******************************************************************************/
/* Permanently flips the imagery of a gadget. */
/******************************************************************************/
@@ -1302,6 +1316,8 @@ void LabEngine::go() {
freeRoomBuffer();
freeBuffer();
+ freeScreens();
+
_music->freeMusic();
}
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 1c95746857..ba5efecd2c 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -94,7 +94,7 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
for (int i = 0; i < 20; i++)
_moveImages[20] = nullptr;
-
+
for (int i = 0; i < 10; i++)
_invImages[10] = nullptr;
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 6135f5e9d7..d49481548e 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -190,6 +190,7 @@ private:
// engine.cpp
bool setUpScreens();
+ void freeScreens();
void perFlipGadget(uint16 gadID);
bool doCloseUp(CloseDataPtr cptr);
void mainGameLoop();
diff --git a/engines/lab/labsets.cpp b/engines/lab/labsets.cpp
index 2ab9abfe4a..21c495d246 100644
--- a/engines/lab/labsets.cpp
+++ b/engines/lab/labsets.cpp
@@ -34,7 +34,7 @@
namespace Lab {
- LargeSet::LargeSet(uint16 last, LabEngine *vm) : _vm(vm) {
+LargeSet::LargeSet(uint16 last, LabEngine *vm) : _vm(vm) {
last = (((last + 15) >> 4) << 4);
_array = (uint16 *)calloc(last >> 3, 2);