aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/agi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi/agi.cpp')
-rw-r--r--engines/agi/agi.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 0eefbab04d..4bebf97e95 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -504,6 +504,7 @@ AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(sys
_noSaveLoadAllowed = false;
_rnd = new Common::RandomSource("agi");
+ _sound = 0;
initFeatures();
initVersion();
@@ -511,6 +512,11 @@ AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(sys
AgiBase::~AgiBase() {
delete _rnd;
+
+ if (_sound) {
+ _sound->deinitSound();
+ delete _sound;
+ }
}
AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) {
@@ -536,6 +542,8 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
memset(&_debug, 0, sizeof(struct AgiDebug));
memset(&_mouse, 0, sizeof(struct Mouse));
+ _game._vm = this;
+
_game.clockEnabled = false;
_game.state = STATE_INIT;
@@ -571,7 +579,7 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
_game.controllerOccured[i] = false;
setupOpcodes();
- _curLogic = NULL;
+ _game._curLogic = NULL;
_timerHack = 0;
}
@@ -680,8 +688,6 @@ AgiEngine::~AgiEngine() {
agiDeinit();
delete _loader;
- _sound->deinitSound();
- delete _sound;
_gfx->deinitVideo();
delete _sprites;
delete _picture;