diff options
Diffstat (limited to 'engines/gob/game.cpp')
-rw-r--r-- | engines/gob/game.cpp | 51 |
1 files changed, 13 insertions, 38 deletions
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 666f46fde1..73fa820fa0 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -23,7 +23,6 @@ * */ - #include "common/endian.h" #include "gob/gob.h" @@ -35,7 +34,7 @@ #include "gob/parse.h" #include "gob/draw.h" #include "gob/mult.h" -#include "gob/music.h" +#include "gob/sound/sound.h" namespace Gob { @@ -60,9 +59,6 @@ Game::Game(GobEngine *vm) : _vm(vm) { _collStackElemSizes[i] = 0; } - _infIns = 0; - _infogrames = 0; - _curTotFile[0] = 0; _curExtFile[0] = 0; _totToLoad[0] = 0; @@ -105,10 +101,6 @@ Game::Game(GobEngine *vm) : _vm(vm) { } Game::~Game() { - delete _infIns; - - for (int i = 0; i < 60; i++) - _soundSamples[i].free(); } byte *Game::loadExtData(int16 itemId, int16 *pResWidth, @@ -295,16 +287,7 @@ void Game::freeSoundSlot(int16 slot) { if (slot == -1) slot = _vm->_parse->parseValExpr(); - if ((slot < 0) || (slot >= 60) || _soundSamples[slot].empty()) - return; - - SoundDesc &sample = _soundSamples[slot]; - - if (sample.getType() == SOUND_ADL) - if (_vm->_adlib && (_vm->_adlib->getIndex() == slot)) - _vm->_adlib->stopPlay(); - - _vm->_snd->freeSample(sample); + _vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(slot)); } void Game::evaluateScroll(int16 x, int16 y) { @@ -367,7 +350,7 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, _vm->_util->processInput(true); - if (_vm->_mult->_multData && _vm->_global->_inter_variables && + if (_vm->_mult->_multData && _vm->_inter->_variables && (VAR(58) != 0)) { if (_vm->_mult->_multData->frameStart != (int) VAR(58) - 1) _vm->_mult->_multData->frameStart++; @@ -380,7 +363,7 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, if ((_vm->_inter->_soundEndTimeKey != 0) && (_vm->_util->getTimeKey() >= _vm->_inter->_soundEndTimeKey)) { - _vm->_snd->stopSound(_vm->_inter->_soundStopVal); + _vm->_sound->blasterStop(_vm->_inter->_soundStopVal); _vm->_inter->_soundEndTimeKey = 0; } @@ -497,8 +480,7 @@ void Game::totSub(int8 flags, const char *newTotFile) { _extTableArray[_backupedCount] = _extTable; _extHandleArray[_backupedCount] = _extHandle; _imFileDataArray[_backupedCount] = _imFileData; - _variablesArray[_backupedCount] = _vm->_global->_inter_variables; - _variablesSizesArray[_backupedCount] = _vm->_global->_inter_variablesSizes; + _variablesArray[_backupedCount] = _vm->_inter->_variables; strcpy(_curTotFileArray[_backupedCount], _curTotFile); curBackupPos = _curBackupPos; @@ -508,10 +490,8 @@ void Game::totSub(int8 flags, const char *newTotFile) { _totTextData = 0; _totFileData = 0; _totResourceTable = 0; - if (flags & 1) { - _vm->_global->_inter_variables = 0; - _vm->_global->_inter_variablesSizes = 0; - } + if (flags & 1) + _vm->_inter->_variables = 0; strncpy0(_curTotFile, newTotFile, 9); strcat(_curTotFile, ".TOT"); @@ -531,9 +511,8 @@ void Game::totSub(int8 flags, const char *newTotFile) { popCollisions(); - if ((flags & 1) && _vm->_global->_inter_variables) { - delete[] _vm->_global->_inter_variables; - delete[] _vm->_global->_inter_variablesSizes; + if ((flags & 1) && _vm->_inter->_variables) { + _vm->_inter->delocateVars(); } _backupedCount--; @@ -547,8 +526,7 @@ void Game::totSub(int8 flags, const char *newTotFile) { _extTable = _extTableArray[_backupedCount]; _extHandle = _extHandleArray[_backupedCount]; _imFileData = _imFileDataArray[_backupedCount]; - _vm->_global->_inter_variables = _variablesArray[_backupedCount]; - _vm->_global->_inter_variablesSizes = _variablesSizesArray[_backupedCount]; + _vm->_inter->_variables = _variablesArray[_backupedCount]; strcpy(_curTotFile, _curTotFileArray[_backupedCount]); strcpy(_curExtFile, _curTotFile); _curExtFile[strlen(_curExtFile) - 4] = '\0'; @@ -580,8 +558,7 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { _extTableArray[_backupedCount] = _extTable; _extHandleArray[_backupedCount] = _extHandle; _imFileDataArray[_backupedCount] = _imFileData; - _variablesArray[_backupedCount] = _vm->_global->_inter_variables; - _variablesSizesArray[_backupedCount] = _vm->_global->_inter_variablesSizes; + _variablesArray[_backupedCount] = _vm->_inter->_variables; strcpy(_curTotFileArray[_backupedCount], _curTotFile); _backupedCount++; } @@ -597,8 +574,7 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { _imFileData = _imFileDataArray[_curBackupPos]; _extTable = _extTableArray[_curBackupPos]; _extHandle = _extHandleArray[_curBackupPos]; - _vm->_global->_inter_variables = _variablesArray[_curBackupPos]; - _vm->_global->_inter_variablesSizes = _variablesSizesArray[_curBackupPos]; + _vm->_inter->_variables = _variablesArray[_curBackupPos]; strcpy(_curTotFile, _curTotFileArray[_curBackupPos]); strcpy(_curExtFile, _curTotFile); _curExtFile[strlen(_curExtFile) - 4] = '\0'; @@ -625,8 +601,7 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { _extTable = _extTableArray[_curBackupPos]; _extHandle = _extHandleArray[_curBackupPos]; _imFileData = _imFileDataArray[_curBackupPos]; - _vm->_global->_inter_variables = _variablesArray[_curBackupPos]; - _vm->_global->_inter_variablesSizes = _variablesSizesArray[_curBackupPos]; + _vm->_inter->_variables = _variablesArray[_curBackupPos]; strcpy(_curTotFile, _curTotFileArray[_curBackupPos]); strcpy(_curExtFile, _curTotFile); _curExtFile[strlen(_curExtFile) - 4] = '\0'; |