diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/game.cpp | 28 | ||||
-rw-r--r-- | engines/gob/game.h | 2 | ||||
-rw-r--r-- | engines/gob/game_v1.cpp | 2 | ||||
-rw-r--r-- | engines/gob/game_v2.cpp | 4 | ||||
-rw-r--r-- | engines/gob/gob.cpp | 4 | ||||
-rw-r--r-- | engines/gob/gob.h | 1 | ||||
-rw-r--r-- | engines/gob/goblin.cpp | 39 | ||||
-rw-r--r-- | engines/gob/goblin.h | 2 | ||||
-rw-r--r-- | engines/gob/goblin_v1.cpp | 2 | ||||
-rw-r--r-- | engines/gob/init.cpp | 4 | ||||
-rw-r--r-- | engines/gob/inter.cpp | 5 | ||||
-rw-r--r-- | engines/gob/inter_v1.cpp | 6 | ||||
-rw-r--r-- | engines/gob/inter_v2.cpp | 10 | ||||
-rw-r--r-- | engines/gob/map_v1.cpp | 23 | ||||
-rw-r--r-- | engines/gob/mult.cpp | 2 | ||||
-rw-r--r-- | engines/gob/mult.h | 2 | ||||
-rw-r--r-- | engines/gob/mult_v1.cpp | 5 | ||||
-rw-r--r-- | engines/gob/mult_v2.cpp | 38 | ||||
-rw-r--r-- | engines/gob/music.cpp | 20 | ||||
-rw-r--r-- | engines/gob/music.h | 1 | ||||
-rw-r--r-- | engines/gob/util.cpp | 3 | ||||
-rw-r--r-- | engines/gob/video.cpp | 7 |
22 files changed, 179 insertions, 31 deletions
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 5bf3c289e4..39c9fd537c 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -132,6 +132,28 @@ Game::Game(GobEngine *vm) : _vm(vm) { _dword_2F2B6 = 0; } +Game::~Game() { + if (_imdFile) { + if (_imdFile->palette) + delete[] _imdFile->palette; + if (_imdFile->surfDesc && + (_imdFile->surfDesc != _vm->_draw->_spritesArray[20]) && + (_imdFile->surfDesc != _vm->_draw->_spritesArray[21])) + _vm->_video->freeSurfDesc(_imdFile->surfDesc); + if (_imdFile->framesPos) + delete[] _imdFile->framesPos; + if (_imdFile->frameCoords) + delete[] _imdFile->frameCoords; + delete _imdFile; + } + if (_imdFrameData) + delete[] _imdFrameData; + if (_imdVidBuffer) + delete[] _imdVidBuffer; + if (_word_2FC80) + delete[] _word_2FC80; +} + char *Game::loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight) { int16 commonHandle; int16 itemsCount; @@ -376,7 +398,7 @@ void Game::freeSoundSlot(int16 slot) { if (slot == -1) slot = _vm->_parse->parseValExpr(); - if (_soundSamples[slot] == 0) + if ((slot < 0) || (slot >= 60) || (_soundSamples[slot] == 0)) return; char* data = _soundSamples[slot]->data; @@ -1221,7 +1243,7 @@ void Game::collisionsBlock(void) { WRITE_VAR(16, 0); _activeCollResId = 0; } - while (_activeCollResId == 0 && !_vm->_inter->_terminate); + while (_activeCollResId == 0 && !_vm->_inter->_terminate && !_vm->_quitRequested); if (((uint16)_activeCollResId & ~0x8000) == collResId) { _collStackPos = 0; @@ -2216,6 +2238,8 @@ void Game::playImd(int16 frame, int16 arg_2, int16 arg_4, int16 arg_6, int16 arg // To allow quitting, etc. during IMDs _vm->_util->processInput(); + if (_vm->_quitRequested) + return; if (byte_31344 != 2) { if (var_4 & 0x800) { diff --git a/engines/gob/game.h b/engines/gob/game.h index f272ece7d3..2ce6d0af0c 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -179,7 +179,7 @@ public: byte *_word_2FC80; Game(GobEngine *vm); - virtual ~Game() {}; + virtual ~Game(); char *loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight); char *loadTotResource(int16 id); diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 8b97027d2d..c4b20b44e6 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -72,7 +72,7 @@ void Game_v1::playTot(int16 skipPlay) { strcpy(savedTotName, _curTotFile); if (skipPlay == 0) { - while (1) { + while (!_vm->_quitRequested) { for (i = 0; i < 4; i++) { _vm->_draw->_fontToSprite[i].sprite = -1; _vm->_draw->_fontToSprite[i].base = -1; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 337b629b33..20a4e75abe 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -72,7 +72,7 @@ void Game_v2::playTot(int16 skipPlay) { strcpy(savedTotName, _curTotFile); if (skipPlay == 0) { - while (1) { + while (!_vm->_quitRequested) { for (i = 0; i < 4; i++) { _vm->_draw->_fontToSprite[i].sprite = -1; _vm->_draw->_fontToSprite[i].base = -1; @@ -422,7 +422,7 @@ int16 Game_v2::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, timeKey = _vm->_util->getTimeKey(); while (1) { - if (_vm->_inter->_terminate) { + if (_vm->_inter->_terminate || _vm->_quitRequested) { if (handleMouse) _vm->_draw->blitCursor(); return 0; diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 61d64d6442..fb983a6749 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -141,6 +141,7 @@ GobEngine::GobEngine(OSystem * syst, uint32 features, Common::Language lang) _features = features; _language = lang; _copyProtection = ConfMan.getBool("copy_protection"); + _quitRequested = false; Common::addSpecialDebugLevel(DEBUG_FUNCOP, "FuncOpcodes", "Script FuncOpcodes debug level"); Common::addSpecialDebugLevel(DEBUG_DRAWOP, "DrawOpcodes", "Script DrawOpcodes debug level"); @@ -173,7 +174,6 @@ GobEngine::~GobEngine() { delete _scenery; delete _gtimer; delete _util; - delete _inter; delete _music; } @@ -188,7 +188,7 @@ int GobEngine::go() { } void GobEngine::shutdown() { - _system->quit(); + _quitRequested = true; } int GobEngine::init() { diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 80e45551e2..ca84d2bed3 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -98,6 +98,7 @@ public: int32 _features; Common::Language _language; bool _copyProtection; + bool _quitRequested; Game *_game; Snd *_snd; diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index 1e1c700f81..9c7a337369 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -161,6 +161,45 @@ Goblin::Goblin(GobEngine *vm) : _vm(vm) { _dword_2F9B2 = 0; } +Goblin::~Goblin() { + int i, state, col; + + if (_objList) + _vm->_util->deleteList(_objList); + + for (i = 0; i < 4; i++) { + if (_goblins[i]) { + if (_goblins[i]->stateMach) { + for (state = 0; state < (i == 3 ? 70 : 40); state++) + for (col = 0; col < 6; col++) + if (_goblins[i]->stateMach[state][col]) + delete _goblins[i]->stateMach[state][col]; + delete _goblins[i]->stateMach; + } + delete _goblins[i]; + } + } + for (i = 0; i < 20; i++) { + if (_objects[i]) { + if (_objects[i]->stateMach) { + for (state = 0; state < 40; state++) + for (col = 0; col < 6; col++) + if (_objects[i]->stateMach[state][col]) + delete _objects[i]->stateMach[state][col]; + delete _objects[i]->stateMach; + } + delete _objects[i]; + } + } + + for (i = 0; i < 16; i++) + if (_soundData[i]) { + if (_soundData[i]->data) + delete[] _soundData[i]->data; + delete _soundData[i]; + } +} + char Goblin::rotateState(int16 from, int16 to) { return _rotStates[from / 2][to / 2]; } diff --git a/engines/gob/goblin.h b/engines/gob/goblin.h index 7e506e4214..68e19d9018 100644 --- a/engines/gob/goblin.h +++ b/engines/gob/goblin.h @@ -226,7 +226,7 @@ public: virtual void initiateMove(int16 index) = 0; Goblin(GobEngine *vm); - virtual ~Goblin() {}; + virtual ~Goblin(); protected: int16 _rotStates[4][4]; diff --git a/engines/gob/goblin_v1.cpp b/engines/gob/goblin_v1.cpp index d7623604e9..387af3a7df 100644 --- a/engines/gob/goblin_v1.cpp +++ b/engines/gob/goblin_v1.cpp @@ -143,7 +143,7 @@ void Goblin_v1::initiateMove(int16 index) { _vm->_map->findNearestToGob(0); _vm->_map->optimizePoints(0, 0, 0); - _pathExistence = _vm->_map->checkDirectPath(0, _vm->_map->_curGoblinX, _vm->_map->_curGoblinY, + _pathExistence = _vm->_map->checkDirectPath(-1, _vm->_map->_curGoblinX, _vm->_map->_curGoblinY, _pressedMapX, _pressedMapY); if (_pathExistence == 3) { diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index c411a2430f..8f0311b1fc 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -81,12 +81,10 @@ void Init::cleanup(void) { _vm->_dataio->closeDataFile(); if (_vm->_global->_sprAllocated != 0) - error("cleanup: Error! Allocated sprites left: %d", - _vm->_global->_sprAllocated); + warning("cleanup: Allocated sprites left: %d", _vm->_global->_sprAllocated); _vm->_snd->stopSound(0); _vm->_util->keyboard_release(); - g_system->quit(); } void Init::initGame(char *totName) { diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index 9ef90718eb..b5f3d9bfa4 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -168,6 +168,9 @@ void Inter::funcBlock(int16 retFlag) { if (executeFuncOpcode(cmd2, cmd, cmdCount, counter, retFlag)) return; + if (_vm->_quitRequested) + break; + if (_breakFlag) { if (retFlag != 2) break; @@ -263,7 +266,7 @@ void Inter::checkSwitchTable(char **ppExec) { void Inter::callSub(int16 retFlag) { int16 block; - while (_vm->_global->_inter_execPtr != 0 && (char *)_vm->_global->_inter_execPtr != _vm->_game->_totFileData) { + while (!_vm->_quitRequested && _vm->_global->_inter_execPtr != 0 && (char *)_vm->_global->_inter_execPtr != _vm->_game->_totFileData) { block = *_vm->_global->_inter_execPtr; if (block == 1) { funcBlock(retFlag); diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 96e91b6559..45ed7f8814 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1421,7 +1421,7 @@ bool Inter_v1::o1_repeatUntil(char &cmdCount, int16 &counter, int16 &retFlag) { funcBlock(1); _vm->_global->_inter_execPtr = blockPtr + size + 1; flag = evalBoolResult(); - } while (flag == 0 && !_breakFlag && !_terminate); + } while (flag == 0 && !_breakFlag && !_terminate && !_vm->_quitRequested); _nestLevel[0]--; @@ -1457,7 +1457,7 @@ bool Inter_v1::o1_whileDo(char &cmdCount, int16 &counter, int16 &retFlag) { _vm->_global->_inter_execPtr += size; } - if (_breakFlag || _terminate) { + if (_breakFlag || _terminate || _vm->_quitRequested) { _vm->_global->_inter_execPtr = blockPtr; _vm->_global->_inter_execPtr += size; break; @@ -1525,7 +1525,9 @@ void Inter_v1::o1_initMult(void) { if (_vm->_mult->_objects == 0) { _vm->_mult->_renderData = new int16[_vm->_mult->_objCount * 9]; + memset(_vm->_mult->_renderData, 0, _vm->_mult->_objCount * 9 * sizeof(int16)); _vm->_mult->_objects = new Mult::Mult_Object[_vm->_mult->_objCount]; + memset(_vm->_mult->_objects, 0, _vm->_mult->_objCount * sizeof(Mult::Mult_Object)); for (i = 0; i < _vm->_mult->_objCount; i++) { _vm->_mult->_objects[i].pPosX = (int32 *)(_vm->_global->_inter_variables + i * 4 + (posXVar / 4) * 4); diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 3757d59c70..c7f5692b54 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -865,7 +865,7 @@ int16 Inter_v2::loadSound(int16 search) { _vm->_game->_soundSamples[slot] = _vm->_game->loadSND(sndfile, 3); } else { strcat(sndfile, ".ADL"); - // TODO: This is very ugly + // TODO: This is very ugly (and doesn't work with Snd::freeSoundDesc()) _vm->_game->_soundSamples[slot] = (Snd::SoundDesc *) _vm->_dataio->getData(sndfile); } _vm->_game->_soundTypes[slot] = 2; @@ -899,7 +899,7 @@ int16 Inter_v2::loadSound(int16 search) { if (!isADL) _vm->_game->loadSound(slot, extData); else - // TODO: This is very ugly + // TODO: This is very ugly (and doesn't work with Snd::freeSoundDesc()) _vm->_game->_soundSamples[slot] = (Snd::SoundDesc *) extData; } } else { // loc_9A13 @@ -907,7 +907,7 @@ int16 Inter_v2::loadSound(int16 search) { if (!isADL) _vm->_game->loadSound(slot, extData); else - // TODO: This is very ugly + // TODO: This is very ugly (and doesn't work with Snd::freeSoundDesc()) _vm->_game->_soundSamples[slot] = (Snd::SoundDesc *) extData; } } @@ -1466,11 +1466,15 @@ void Inter_v2::o2_initMult(void) { if (_vm->_mult->_objects == 0) { _vm->_mult->_renderData2 = new Mult::Mult_Object*[_vm->_mult->_objCount]; + memset(_vm->_mult->_renderData2, 0, _vm->_mult->_objCount * sizeof(Mult::Mult_Object*)); _vm->_mult->_renderData = new int16[_vm->_mult->_objCount * 9]; + memset(_vm->_mult->_renderData, 0, _vm->_mult->_objCount * 9 * sizeof(int16)); if (_vm->_inter->_terminate) return; _vm->_mult->_orderArray = new int8[_vm->_mult->_objCount]; + memset(_vm->_mult->_orderArray, 0, _vm->_mult->_objCount * sizeof(int8)); _vm->_mult->_objects = new Mult::Mult_Object[_vm->_mult->_objCount]; + memset(_vm->_mult->_objects, 0, _vm->_mult->_objCount * sizeof(Mult::Mult_Object)); for (i = 0; i < _vm->_mult->_objCount; i++) { _vm->_mult->_objects[i].pPosX = (int32 *)(_vm->_global->_inter_variables + i * 4 + (posXVar / 4) * 4); diff --git a/engines/gob/map_v1.cpp b/engines/gob/map_v1.cpp index 7b0da03f51..8adc7e1a16 100644 --- a/engines/gob/map_v1.cpp +++ b/engines/gob/map_v1.cpp @@ -61,7 +61,20 @@ Map_v1::Map_v1(GobEngine *vm) : Map(vm) { } Map_v1::~Map_v1() { - delete[] _passMap; + int i; + + _mapWidth = 26; + _mapHeight = 28; + + if (_passMap) + delete[] _passMap; + if (_itemsMap) { + for (i = 0; i < _mapHeight; i++) + delete[] _itemsMap[i]; + delete[] _itemsMap; + } + if (_wayPoints) + delete[] _wayPoints; } void Map_v1::loadMapObjects(char *avjFile) { @@ -157,10 +170,14 @@ void Map_v1::loadMapObjects(char *avjFile) { _vm->_goblin->_goblins[i]->state = READ_LE_UINT16(savedPtr2); savedPtr2 += 2; - if (i == 3) + if (i == 3) { _vm->_goblin->_goblins[i]->stateMach = new Goblin::Gob_StateLine[70]; - else + memset(_vm->_goblin->_goblins[i]->stateMach, 0, 70 * sizeof(Goblin::Gob_StateLine)); + } + else { _vm->_goblin->_goblins[i]->stateMach = new Goblin::Gob_StateLine[40]; + memset(_vm->_goblin->_goblins[i]->stateMach, 0, 40 * sizeof(Goblin::Gob_StateLine)); + } uint32* tempstatedata = new uint32[40*6]; for (state = 0; state < 40; ++state) { diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp index 93233bc35c..1e161d78bc 100644 --- a/engines/gob/mult.cpp +++ b/engines/gob/mult.cpp @@ -145,9 +145,11 @@ void Mult::freeMult(void) { delete[] _objects; delete[] _renderData; + delete[] _orderArray; _objects = 0; _renderData = 0; + _orderArray = 0; _vm->_anim->_animSurf = 0; } diff --git a/engines/gob/mult.h b/engines/gob/mult.h index 9afa65b447..2012aaddda 100644 --- a/engines/gob/mult.h +++ b/engines/gob/mult.h @@ -323,7 +323,7 @@ public: Mult_Data *_multDatas[8]; Mult_v2(GobEngine *vm); - virtual ~Mult_v2() {}; + virtual ~Mult_v2(); virtual void setMultData(uint16 multindex); virtual void multSub(uint16 multindex); diff --git a/engines/gob/mult_v1.cpp b/engines/gob/mult_v1.cpp index f0dc7410ef..7ceeee1787 100644 --- a/engines/gob/mult_v1.cpp +++ b/engines/gob/mult_v1.cpp @@ -244,12 +244,15 @@ void Mult_v1::playMult(int16 startFrame, int16 endFrame, char checkEscape, _objCount = 4; _objects = new Mult_Object[_objCount]; + memset(_objects, 0, _objCount * sizeof(Mult_Object)); _renderData = new int16[9 * _objCount]; + memset(_renderData, 0, _objCount * 9 * sizeof(int16)); _animArrayX = new int32[_objCount]; _animArrayY = new int32[_objCount]; _animArrayData = new Mult_AnimData[_objCount]; + memset(_animArrayData, 0, _objCount * sizeof(Mult_AnimData)); for (_counter = 0; _counter < _objCount; _counter++) { multObj = &_objects[_counter]; @@ -319,7 +322,7 @@ void Mult_v1::playMult(int16 startFrame, int16 endFrame, char checkEscape, _frame++; _vm->_util->waitEndFrame(); - } while (stop == 0 && stopNoClear == 0); + } while (stop == 0 && stopNoClear == 0 && !_vm->_quitRequested); if (stopNoClear == 0) { if (_animDataAllocated) { diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index 79269a1100..e199df4a95 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -44,6 +44,21 @@ Mult_v2::Mult_v2(GobEngine *vm) : Mult_v1(vm) { for (i = 0; i < 8; i++) _multDatas[i] = 0; } +Mult_v2::~Mult_v2() { + int i; + + freeMultKeys(); + for (i = 0; i < 8; i++) { + _multData2 = _multDatas[i]; + freeMultKeys(); + } + + if (_orderArray) + delete[] _orderArray; + if (_renderData2) + delete[] _renderData2; +} + void Mult_v2::loadMult(int16 resId) { int16 i, j; int8 index; @@ -57,6 +72,7 @@ void Mult_v2::loadMult(int16 resId) { index = (resId & 0x8000) ? *_vm->_global->_inter_execPtr++ : 0; _multData2 = new Mult_Data; + memset(_multData2, 0, sizeof(Mult_Data)); // ---. for (i = 0; i < 4; i++) { @@ -372,11 +388,24 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, _vm->_anim->_areaHeight = 200; _objCount = 4; + if (_objects) + delete[] _objects; + if (_orderArray) + delete[] _orderArray; + if (_renderData) + delete[] _renderData; + if (_renderData2) + delete[] _renderData2; + _objects = new Mult_Object[_objCount]; + memset(_objects, 0, _objCount * sizeof(Mult_Object)); _orderArray = new int8[_objCount]; + memset(_orderArray, 0, _objCount * sizeof(int8)); _renderData = new int16[9 * _objCount]; + memset(_renderData, 0, _objCount * 9 * sizeof(int16)); _renderData2 = new Mult_Object*[_objCount]; + memset(_renderData2, 0, _objCount * sizeof(Mult_Object*)); _animArrayX = new int32[_objCount]; _animArrayY = new int32[_objCount]; @@ -485,7 +514,7 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, _frame++; _vm->_util->waitEndFrame(); - } while (stop == 0 && stopNoClear == 0); + } while (stop == 0 && stopNoClear == 0 && !_vm->_quitRequested); if (stopNoClear == 0) { if (_animDataAllocated) { @@ -504,6 +533,9 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, delete[] _animArrayData; _animArrayData = 0; + delete[] _orderArray; + _orderArray = 0; + if (_vm->_anim->_animSurf) _vm->_video->freeSurfDesc(_vm->_anim->_animSurf); _vm->_anim->_animSurf = 0; @@ -1348,6 +1380,10 @@ void Mult_v2::freeMultKeys(void) { _animDataAllocated = 0; } + for (i = 0; i < 8; i++) + if (_multDatas[i] == _multData2) + _multDatas[i] = 0; + delete _multData2; _multData2 = 0; } diff --git a/engines/gob/music.cpp b/engines/gob/music.cpp index a65aaeb0d1..71108cc968 100644 --- a/engines/gob/music.cpp +++ b/engines/gob/music.cpp @@ -72,6 +72,8 @@ const unsigned char Music::_volRegNums[] = { }; Music::Music(GobEngine *vm) : _vm(vm) { + int i; + _data = 0; _playPos = 0; _dataSize = 0; @@ -81,15 +83,20 @@ Music::Music(GobEngine *vm) : _vm(vm) { _first = true; _ended = false; _playing = false; + _needFree = false; _repCount = -1; _samplesTillPoll = 0; + for (i = 0; i < 16; i ++) + _pollNotes[i] = 0; + setFreqs(); } Music::~Music(void) { - if (_data); - delete _data; + OPLDestroy(_opl); + if (_data && _needFree) + delete[] _data; _vm->_mixer->setupPremix(0); } @@ -439,6 +446,7 @@ bool Music::loadMusic(const char *filename) { if (!song.isOpen()) return false; + _needFree = true; _dataSize = song.size(); _data = new byte[_dataSize]; song.read(_data, _dataSize); @@ -452,7 +460,7 @@ bool Music::loadMusic(const char *filename) { } void Music::loadFromMemory(byte *data) { - _playing = false; + unloadMusic(); _repCount = 0; _dataSize = (uint32) -1; @@ -466,8 +474,10 @@ void Music::loadFromMemory(byte *data) { void Music::unloadMusic(void) { _playing = false; - if (_data) - delete _data; + if (_data && _needFree) + delete[] _data; + + _needFree = false; } } // End of namespace Gob diff --git a/engines/gob/music.h b/engines/gob/music.h index 0079c8f8a2..2f792f67ac 100644 --- a/engines/gob/music.h +++ b/engines/gob/music.h @@ -83,6 +83,7 @@ protected: bool _playing; bool _first; bool _ended; + bool _needFree; Common::Mutex _mutex; GobEngine *_vm; diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index f0caaf04a1..35c17bb9cf 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -26,6 +26,7 @@ #include "gob/util.h" #include "gob/draw.h" #include "gob/game.h" +#include "gob/inter.h" namespace Gob { @@ -162,7 +163,7 @@ void Util::processInput() { case OSystem::EVENT_KEYUP: break; case OSystem::EVENT_QUIT: - g_system->quit(); + _vm->_quitRequested = true; break; default: break; diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 0dc7055471..79a5ba7244 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -37,9 +37,13 @@ namespace Gob { Video::Video(GobEngine *vm) : _vm(vm) { _extraMode = false; + _videoDriver = 0; } char Video::initDriver(int16 vidMode) { + if (_videoDriver) + return 1; + warning("STUB: Video::initDriver"); // FIXME: Finish all this stuff :) @@ -81,6 +85,9 @@ int32 Video::getRectSize(int16 width, int16 height, int16 flag, int16 mode) { } void Video::freeSurfDesc(SurfaceDesc * surfDesc) { + if (surfDesc == 0) + return; + delete[] surfDesc->vidPtr; // GOB2: surfDesc != _vm->_draw->_frontSurface (since _frontSurface is set // to _pPrimarySurfDesc in Game::prepareStart(), is there a difference?) |