diff options
author | Paweł Kołodziejski | 2004-03-27 17:03:42 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-03-27 17:03:42 +0000 |
commit | f6d131f6c67c5f047c71a35fcd30e979dac2462d (patch) | |
tree | f3b09dd31cdfd74e90c52373a8f313c8c33de068 | |
parent | 9b9ebb3a91af2056bf30875caeca5d784e26e618 (diff) | |
download | scummvm-rg350-f6d131f6c67c5f047c71a35fcd30e979dac2462d.tar.gz scummvm-rg350-f6d131f6c67c5f047c71a35fcd30e979dac2462d.tar.bz2 scummvm-rg350-f6d131f6c67c5f047c71a35fcd30e979dac2462d.zip |
some changes to imuse digital
svn-id: r13387
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 17 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse.h | 8 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_music.cpp | 48 |
3 files changed, 33 insertions, 40 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index 4cc351f575..d73def8485 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -46,20 +46,16 @@ IMuseDigital::IMuseDigital(ScummEngine *scumm) _mutex = g_system->createMutex(); _pause = false; _sound = new ImuseDigiSndMgr(_vm); + resetState(); _vm->_timer->installTimerProc(timer_handler, 1000000 / 25, this); - - _curMusicState = 0; - _curMusicSeq = 0; - _curMusicCue = 0; - memset(_attributesSeq, 0, sizeof(_attributesSeq)); - memset(_attributesState, 0, sizeof(_attributesState)); - memset(_attributesTable, 0, sizeof(_attributesTable)); - _curSeqAtribPos = 0; } IMuseDigital::~IMuseDigital() { stopAllSounds(true); - _vm->_timer->removeTimerProc(timer_handler); + { + Common::StackLock lock(_mutex, g_system, "IMuseDigital::~IMuseDigital()"); + _vm->_timer->removeTimerProc(timer_handler); + } delete _sound; g_system->deleteMutex(_mutex); } @@ -545,8 +541,7 @@ void IMuseDigital::parseScriptCmds(int a, int b, int c, int d, int e, int f, int debug(5, "ImuseSetAttribute (%d, %d)", b, c); assert((_vm->_gameId == GID_DIG) || (_vm->_gameId == GID_FT)); if (_vm->_gameId == GID_DIG) { - assert(b >= 0 && b < 11); - _attributesTable[b] = c; + _attributes[b] = c; } break; case 0x2000: // ImuseSetMasterSFXVolume diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h index cc030bc321..16a9c92e11 100644 --- a/scumm/imuse_digi/dimuse.h +++ b/scumm/imuse_digi/dimuse.h @@ -77,9 +77,7 @@ private: ImuseDigiSndMgr *_sound; bool _pause; - int _attributesTable[12]; - int _attributesState[97]; - int _attributesSeq[91]; + int _attributes[188]; int _curSeqAtribPos; int _curMusicState; @@ -130,9 +128,7 @@ public: _curMusicState = 0; _curMusicSeq = 0; _curMusicCue = 0; - memset(_attributesSeq, 0, sizeof(_attributesSeq)); - memset(_attributesState, 0, sizeof(_attributesState)); - memset(_attributesTable, 0, sizeof(_attributesTable)); + memset(_attributes, 0, sizeof(_attributes)); _curSeqAtribPos = 0; } diff --git a/scumm/imuse_digi/dimuse_music.cpp b/scumm/imuse_digi/dimuse_music.cpp index acc31ed529..11d23a1740 100644 --- a/scumm/imuse_digi/dimuse_music.cpp +++ b/scumm/imuse_digi/dimuse_music.cpp @@ -25,6 +25,11 @@ namespace Scumm { +#define DIG_STATE_OFFSET 11 +#define DIG_SEQ_OFFSET (DIG_STATE_OFFSET + 65) +#define COMI_STATE_OFFSET 3 +#define COMI_SEQ_OFFSET (COMI_STATE_OFFSET + 94) + void IMuseDigital::setDigMusicState(int stateId) { int l, num = -1; @@ -44,18 +49,15 @@ void IMuseDigital::setDigMusicState(int stateId) { } num = l; - assert(_digStateMusicMap[num].unk1 < 11); - int val2 = _attributesTable[_digStateMusicMap[num].unk1]; + int val2 = _attributes[_digStateMusicMap[num].unk1]; if (val2 == 0) { - assert(_digStateMusicMap[num].unk3 < 11); - if (_attributesTable[_digStateMusicMap[num].unk3] != 0) { + if (_attributes[_digStateMusicMap[num].unk3] != 0) { num = _digStateMusicMap[num].unk4; } else { num = _digStateMusicMap[num].musicTableIndex; } } else { - assert(_digStateMusicMap[num].unk2 < 11); - int val = _attributesTable[_digStateMusicMap[num].unk2]; + int val = _digStateMusicMap[num].unk2; if (val == 0) { num = _digStateMusicMap[num].musicTableIndex + val2; } else { @@ -103,7 +105,7 @@ void IMuseDigital::setDigMusicSequence(int seqId) { if (_curMusicSeq == 0) { playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true); _curSeqAtribPos = 0; - _attributesSeq[num] = 1; + _attributes[DIG_SEQ_OFFSET + num] = 1; } else { if ((_digSeqMusicTable[_curMusicSeq].opcode == 4) && (_digSeqMusicTable[_curMusicSeq].opcode == 6)) { _curSeqAtribPos = num; @@ -111,13 +113,13 @@ void IMuseDigital::setDigMusicSequence(int seqId) { } else if (_digSeqMusicTable[_curMusicSeq].opcode == 6) { playDigMusic(_digSeqMusicTable[num].name, &_digSeqMusicTable[num], 0, true); _curSeqAtribPos = 0; - _attributesSeq[num] = 1; + _attributes[DIG_SEQ_OFFSET + num] = 1; } } } else { if (_curSeqAtribPos != 0) { playDigMusic(_digSeqMusicTable[_curSeqAtribPos].name, &_digSeqMusicTable[_curSeqAtribPos], 0, true); - _attributesSeq[_curSeqAtribPos] = 1; + _attributes[DIG_SEQ_OFFSET + _curSeqAtribPos] = 1; num = _curSeqAtribPos; _curSeqAtribPos = 0; } else { @@ -136,17 +138,17 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table int hookId = 0; if (songName != NULL) { - if ((_attributesSeq[38] != 0) && (_attributesSeq[41] == _attributesSeq[38])) { + if ((_attributes[DIG_SEQ_OFFSET + 38] != 0) && (_attributes[DIG_SEQ_OFFSET + 41] == _attributes[DIG_SEQ_OFFSET + 38])) { if ((atribPos == 43) || (atribPos == 44)) hookId = 3; } - if ((_attributesSeq[46] != 0) && (_attributesSeq[48] == 0)) { + if ((_attributes[DIG_SEQ_OFFSET + 46] != 0) && (_attributes[DIG_SEQ_OFFSET + 48] == 0)) { if ((atribPos == 38) || (atribPos == 39)) hookId = 3; } - if ((_attributesSeq[53] != 0)) { + if ((_attributes[DIG_SEQ_OFFSET + 53] != 0)) { if ((atribPos == 50) || (atribPos == 51)) hookId = 3; } @@ -154,14 +156,14 @@ void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table if ((atribPos != 0) && (hookId == 0)) { if (table->param != 0) atribPos = table->param; - hookId = _attributesState[atribPos]; + hookId = _attributes[DIG_STATE_OFFSET + atribPos]; if (table->hookId != 0) { if ((hookId != 0) && (table->hookId <= 1)) { - _attributesState[atribPos] = hookId + 1; + _attributes[DIG_STATE_OFFSET + atribPos] = hookId + 1; if (table->hookId < hookId + 1) - _attributesState[atribPos] = 1; + _attributes[DIG_STATE_OFFSET + atribPos] = 1; } else { - _attributesState[atribPos] = 2; + _attributes[DIG_STATE_OFFSET + atribPos] = 2; } } } @@ -244,7 +246,7 @@ void IMuseDigital::setComiMusicSequence(int seqId) { if (_curMusicSeq == 0) { playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true); _curSeqAtribPos = 0; - _attributesSeq[num] = 1; + _attributes[COMI_SEQ_OFFSET + num] = 1; } else { if ((_comiSeqMusicTable[_curMusicSeq].opcode == 4) && (_comiSeqMusicTable[_curMusicSeq].opcode == 6)) { _curSeqAtribPos = num; @@ -252,13 +254,13 @@ void IMuseDigital::setComiMusicSequence(int seqId) { } else if (_comiSeqMusicTable[_curMusicSeq].opcode == 6) { playComiMusic(_comiSeqMusicTable[num].name, &_comiSeqMusicTable[num], 0, true); _curSeqAtribPos = 0; - _attributesSeq[num] = 1; + _attributes[COMI_SEQ_OFFSET + num] = 1; } } } else { if (_curSeqAtribPos != 0) { playComiMusic(_comiSeqMusicTable[_curSeqAtribPos].name, &_comiSeqMusicTable[_curSeqAtribPos], 0, true); - _attributesSeq[_curSeqAtribPos] = 1; + _attributes[COMI_SEQ_OFFSET + _curSeqAtribPos] = 1; num = _curSeqAtribPos; _curSeqAtribPos = 0; } else { @@ -277,14 +279,14 @@ void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *tab int hookId = 0; if ((songName != NULL) && (atribPos != 0)) { - hookId = _attributesState[atribPos]; + hookId = _attributes[COMI_STATE_OFFSET + atribPos]; if (table->hookId != 0) { if ((hookId != 0) && (table->hookId <= 1)) { - _attributesState[atribPos] = hookId + 1; + _attributes[COMI_STATE_OFFSET + atribPos] = hookId + 1; if (table->hookId < hookId + 1) - _attributesState[atribPos] = 1; + _attributes[COMI_STATE_OFFSET + atribPos] = 1; } else { - _attributesState[atribPos] = 2; + _attributes[COMI_STATE_OFFSET + atribPos] = 2; } } } |