aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/saga/animation.cpp1
-rw-r--r--engines/saga/font.cpp2
-rw-r--r--engines/saga/interface.cpp14
-rw-r--r--engines/saga/interface.h6
-rw-r--r--engines/saga/introproc_ihnm.cpp2
-rw-r--r--engines/saga/rscfile.cpp2
-rw-r--r--engines/saga/saga.cpp8
-rw-r--r--engines/saga/saga.h2
-rw-r--r--engines/saga/script.cpp1
-rw-r--r--engines/saga/sprite.cpp3
10 files changed, 37 insertions, 4 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index 3a1e510529..9fffb0f8bf 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -55,6 +55,7 @@ Anim::Anim(SagaEngine *vm) : _vm(vm) {
Anim::~Anim(void) {
reset();
+ freeCutawayList();
}
void Anim::loadCutawayList(const byte *resourcePointer, size_t resourceLength) {
diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp
index e936117894..7789949393 100644
--- a/engines/saga/font.cpp
+++ b/engines/saga/font.cpp
@@ -63,6 +63,8 @@ Font::~Font(void) {
free(_fonts[i]);
}
+
+ free(_fonts);
}
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 7380570a99..1d048baaad 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -334,7 +334,21 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
Interface::~Interface(void) {
free(_inventory);
+ free(_mainPanel.image);
+ free(_conversePanel.image);
+ free(_optionPanel.image);
+ free(_quitPanel.image);
+ free(_loadPanel.image);
+ free(_savePanel.image);
+
_mainPanel.sprites.freeMem();
+ _conversePanel.sprites.freeMem();
+ _optionPanel.sprites.freeMem();
+ _quitPanel.sprites.freeMem();
+ _loadPanel.sprites.freeMem();
+ _savePanel.sprites.freeMem();
+ _protectPanel.sprites.freeMem();
+
_defPortraits.freeMem();
_scenePortraits.freeMem();
}
diff --git a/engines/saga/interface.h b/engines/saga/interface.h
index 2091c9f071..2e124c2d10 100644
--- a/engines/saga/interface.h
+++ b/engines/saga/interface.h
@@ -112,7 +112,11 @@ struct InterfacePanel {
buttonsCount = 0;
buttons = NULL;
}
-
+/*
+ ~InterfacePanel() {
+ sprites.freeMem();
+ }
+*/
PanelButton *getButton(int index) {
if ((index >= 0) && (index < buttonsCount)) {
return &buttons[index];
diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp
index 5f1d0157d5..6614f4098f 100644
--- a/engines/saga/introproc_ihnm.cpp
+++ b/engines/saga/introproc_ihnm.cpp
@@ -132,6 +132,8 @@ void Scene::IHNMLoadCutaways() {
// Load the cutaways for the title screens
_vm->_anim->loadCutawayList(resourcePointer, resourceLength);
+
+ free(resourcePointer);
}
bool Scene::checkKey() {
diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp
index b7d4f4f1bd..e150caeca5 100644
--- a/engines/saga/rscfile.cpp
+++ b/engines/saga/rscfile.cpp
@@ -769,6 +769,7 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) {
_vm->_sprite->_mainSprites.freeMem();
_vm->_sprite->loadList(_metaResource.mainSpritesID, _vm->_sprite->_mainSprites);
+
_vm->_actor->loadObjList(_metaResource.objectCount, _metaResource.objectsResourceID);
_vm->_resource->loadResource(resourceContext, _metaResource.cutawayListResourceID, resourcePointer, resourceLength);
@@ -806,6 +807,7 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) {
// The IHNM demo has a fixed music track and doesn't load a song table
_vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1);
_vm->_music->play(3, MUSIC_LOOP);
+ free(resourcePointer);
}
int voiceLUTResourceID = 0;
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 40eb32b276..fafbd02cec 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -79,6 +79,7 @@ SagaEngine::SagaEngine(OSystem *syst, const SAGAGameDescription *gameDesc)
_scene = NULL;
_isoMap = NULL;
_gfx = NULL;
+ _driver = NULL;
_console = NULL;
_render = NULL;
_music = NULL;
@@ -133,6 +134,7 @@ SagaEngine::~SagaEngine() {
delete _render;
delete _music;
delete _sound;
+ delete _driver;
delete _gfx;
delete _console;
@@ -188,11 +190,11 @@ int SagaEngine::init() {
bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
bool adlib = (midiDriver == MD_ADLIB);
- MidiDriver *driver = MidiDriver::createMidi(midiDriver);
+ _driver = MidiDriver::createMidi(midiDriver);
if (native_mt32)
- driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
+ _driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
- _music = new Music(this, _mixer, driver, _musicVolume);
+ _music = new Music(this, _mixer, _driver, _musicVolume);
_music->setNativeMT32(native_mt32);
_music->setAdlib(adlib);
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 4a5fae7ddb..6b6eb6b3fb 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -29,6 +29,7 @@
#include "engines/engine.h"
#include "common/stream.h"
+#include "sound/mididrv.h"
#include "saga/gfx.h"
#include "saga/list.h"
@@ -531,6 +532,7 @@ public:
SndRes *_sndRes;
Sound *_sound;
Music *_music;
+ MidiDriver *_driver;
Anim *_anim;
Render *_render;
IsoMap *_isoMap;
diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp
index 7664af314f..088be34c72 100644
--- a/engines/saga/script.cpp
+++ b/engines/saga/script.cpp
@@ -150,6 +150,7 @@ Script::~Script() {
debug(8, "Shutting down scripting subsystem.");
_mainStrings.freeMem();
+ _globalVoiceLUT.freeMem();
freeModules();
free(_modules);
diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp
index e9d002819c..be4f2a423d 100644
--- a/engines/saga/sprite.cpp
+++ b/engines/saga/sprite.cpp
@@ -74,6 +74,9 @@ Sprite::Sprite(SagaEngine *vm) : _vm(vm) {
Sprite::~Sprite(void) {
debug(8, "Shutting down sprite subsystem...");
_mainSprites.freeMem();
+ _inventorySprites.freeMem();
+ _arrowSprites.freeMem();
+ _saveReminderSprites.freeMem();
free(_decodeBuf);
}