diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/script.cpp | 9 | ||||
-rw-r--r-- | engines/hopkins/sound.cpp | 16 | ||||
-rw-r--r-- | engines/hopkins/sound.h | 6 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 212 | ||||
-rw-r--r-- | engines/hopkins/talk.h | 2 |
5 files changed, 121 insertions, 124 deletions
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp index 477f44b3a9..aa478f2d6d 100644 --- a/engines/hopkins/script.cpp +++ b/engines/hopkins/script.cpp @@ -2390,14 +2390,13 @@ int ScriptManager::handleOpcode(byte *dataP) { _vm->_globals.ZONEP[(int16)READ_LE_UINT16(dataP + 5)].field12 = (int16)READ_LE_UINT16(dataP + 7); opcodeType = 1; } else if (dataP[2] == 'J' && dataP[3] == 'U' && dataP[4] == 'M') { - int v59 = (int16)READ_LE_UINT16(dataP + 7); - _vm->_objectsManager.NVZONE = (int16)READ_LE_UINT16(dataP + 5); - _vm->_objectsManager.NVVERBE = v59; + _vm->_objectsManager._jumpZone = (int16)READ_LE_UINT16(dataP + 5); + _vm->_objectsManager._jumpVerb = (int16)READ_LE_UINT16(dataP + 7); opcodeType = 6; } else if (dataP[2] == 'S' && dataP[3] == 'O' && dataP[4] == 'U') { - int v60 = (int16)READ_LE_UINT16(dataP + 5); + int soundNum = (int16)READ_LE_UINT16(dataP + 5); - Common::String file = Common::String::format("SOUND%d.WAV", v60); + Common::String file = Common::String::format("SOUND%d.WAV", soundNum); _vm->_soundManager.playSound(file); opcodeType = 1; } else if (dataP[2] == 'V' && dataP[3] == 'O' && dataP[4] == 'F') { diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 4da7bdac15..9f0212c9aa 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -569,7 +569,7 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) { if (!_musicOffFl && _musicVolume > 2) _musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0); - PLAY_VOICE_SDL(); + playVoice(); // Loop for playing voice breakFlag = 0; @@ -698,13 +698,11 @@ void SoundManager::stopVoice(int voiceIndex) { Voice[voiceIndex]._status = 0; int wavIndex = Voice[voiceIndex]._wavIndex; if (Swav[wavIndex]._active) { - if (Swav[wavIndex].freeSample) + if (Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); } } - Voice[voiceIndex].fieldC = 0; Voice[voiceIndex]._status = 0; - Voice[voiceIndex].field14 = 0; } void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength) { @@ -714,13 +712,13 @@ void SoundManager::SDL_LVOICE(Common::String filename, size_t filePosition, size Swav[20]._active = true; } -void SoundManager::PLAY_VOICE_SDL() { +void SoundManager::playVoice() { if (!Swav[20]._active) error("Bad handle"); if (!Voice[2]._status) { int wavIndex = Voice[2]._wavIndex; - if (Swav[wavIndex]._active && Swav[wavIndex].freeSample) + if (Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); } @@ -761,7 +759,7 @@ void SoundManager::LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename SDL_LoadVoice(filename, 0, 0, Swav[wavIndex]); Swav[wavIndex]._active = true; - Swav[wavIndex].freeSample = freeSample; + Swav[wavIndex]._freeSampleFl = freeSample; } void SoundManager::LOAD_NWAV(const Common::String &file, int wavIndex) { @@ -790,12 +788,10 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) { if (!Swav[wavIndex]._active) warning("Bad handle"); - if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex].freeSample) + if (Voice[voiceIndex]._status == 1 && Swav[wavIndex]._active && Swav[wavIndex]._freeSampleFl) DEL_SAMPLE_SDL(wavIndex); - Voice[voiceIndex].fieldC = 0; Voice[voiceIndex]._status = 1; - Voice[voiceIndex].field14 = 4; Voice[voiceIndex]._wavIndex = wavIndex; int volume = (voiceIndex == 2) ? _voiceVolume * 255 / 16 : _soundVolume * 255 / 16; diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index c6563209c9..fecd05aaeb 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -35,8 +35,6 @@ class VoiceItem { public: int _status; int _wavIndex; - int fieldC; - int field14; }; class SwavItem { @@ -44,7 +42,7 @@ public: bool _active; Audio::RewindableAudioStream *_audioStream; Audio::SoundHandle _soundHandle; - bool freeSample; + bool _freeSampleFl; }; class MusicItem { @@ -70,7 +68,7 @@ private: int VOICE_STAT(int voiceIndex); void stopVoice(int voiceIndex); void SDL_LVOICE(Common::String filename, size_t filePosition, size_t entryLength); - void PLAY_VOICE_SDL(); + void playVoice(); bool DEL_SAMPLE_SDL(int wavIndex); bool SDL_LoadVoice(const Common::String &filename, size_t fileOffset, size_t entryLength, SwavItem &item); void LOAD_SAMPLE2_SDL(int wavIndex, const Common::String &filename, bool freeSample); diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp index e5b1b08774..158a644b84 100644 --- a/engines/hopkins/talk.cpp +++ b/engines/hopkins/talk.cpp @@ -802,9 +802,7 @@ bool TalkManager::searchCharacterAnim(int idx, const byte *bufPerso, int a3, int return result; } -void TalkManager::REPONSE(int a1, int a2) { - byte v2; - byte v3; +void TalkManager::REPONSE(int zone, int verb) { byte *v5; byte *v6; uint16 v7; @@ -818,15 +816,15 @@ void TalkManager::REPONSE(int a1, int a2) { bool loopCond; byte *ptr; - v2 = a1; - v3 = a2; + byte zoneObj = zone; + byte verbObj = verb; LABEL_2: v15 = false; if (_vm->_globals.COUCOU != g_PTRNUL) { v5 = _vm->_globals.COUCOU; for (;;) { if (v5[0] == 'C' && v5[1] == 'O' && v5[2] == 'D') { - if (v5[3] == v2 && v5[4] == v3) + if (v5[3] == zoneObj && v5[4] == verbObj) v15 = true; } if (v5[0] == 'F' && v5[1] == 'I' && v5[2] == 'N') @@ -876,21 +874,26 @@ LABEL_2: return; if (v10 == 2) + // GOTO v13 = _vm->_scriptManager.handleGoto(ptr + 20 * v13); else if (v10 == 3) + // IF v13 = _vm->_scriptManager.handleIf(ptr, v13); if (v13 == -1) error("Invalid IFF function"); if (v10 == 1 || v10 == 4) + // Already handled opcode or END IF ++v13; else if (!v10 || v10 == 5) + // EXIT loopCond = true; else if (v10 == 6) { + // JUMP _vm->_globals.freeMemory(ptr); - v2 = _vm->_objectsManager.NVZONE; - v3 = _vm->_objectsManager.NVVERBE; + zoneObj = _vm->_objectsManager._jumpZone; + verbObj = _vm->_objectsManager._jumpVerb; goto LABEL_2; } } while (!loopCond); @@ -904,103 +907,104 @@ LABEL_2: void TalkManager::REPONSE2(int a1, int a2) { int indx = 0; - if (a2 == 5 && _vm->_globals._saveData->data[svField3] == 4) { - if (a1 == 22 || a1 == 23) { - _vm->_objectsManager.setFlipSprite(0, false); - _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); - if (a1 == 22) { - _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); - _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); - } else { // a1 == 23 - _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(4)); - _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(4)); - } - _vm->_objectsManager.stopBobAnimation(3); - _vm->_objectsManager.stopBobAnimation(4); - _vm->_objectsManager.setBobAnimation(6); - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); - do - _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(6) < 12); - _vm->_objectsManager.stopBobAnimation(6); - _vm->_objectsManager.setBobAnimation(8); - - switch (_vm->_globals._screenId) { - case 35: - indx = 201; - break; - case 36: - indx = 203; - break; - case 37: - indx = 205; - break; - case 38: - indx = 207; - break; - case 39: - indx = 209; - break; - case 40: - indx = 211; - break; - case 41: - indx = 213; - break; - } - _vm->_globals._saveData->data[indx] = 2; - _vm->_objectsManager.disableZone(22); - _vm->_objectsManager.disableZone(23); - } else if (a1 == 20 || a1 == 21) { - _vm->_objectsManager.setFlipSprite(0, true); - _vm->_objectsManager.setSpriteIndex(0, 62); - _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); - if (a1 == 20) { - _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); - _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); - } else { // a1 == 21 - _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(2)); - _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(2)); - } - _vm->_objectsManager.stopBobAnimation(1); - _vm->_objectsManager.stopBobAnimation(2); - _vm->_objectsManager.setBobAnimation(5); - _vm->_soundManager.PLAY_SAMPLE2(1); - _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); - do - _vm->_eventsManager.VBL(); - while (_vm->_objectsManager.BOBPOSI(5) < 12); - _vm->_objectsManager.stopBobAnimation(5); - _vm->_objectsManager.setBobAnimation(7); - switch (_vm->_globals._screenId) { - case 35: - indx = 200; - break; - case 36: - indx = 202; - break; - case 37: - indx = 204; - break; - case 38: - indx = 206; - break; - case 39: - indx = 208; - break; - case 40: - indx = 210; - break; - case 41: - indx = 212; - break; - } - _vm->_globals._saveData->data[indx] = 2; - _vm->_objectsManager.disableZone(21); - _vm->_objectsManager.disableZone(20); + if (a2 != 5 || _vm->_globals._saveData->data[svField3] != 4) + return; + + if (a1 == 22 || a1 == 23) { + _vm->_objectsManager.setFlipSprite(0, false); + _vm->_objectsManager.setSpriteIndex(0, 62); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 0); + if (a1 == 22) { + _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(3)); + _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(3)); + } else { // a1 == 23 + _vm->_objectsManager.lockAnimX(6, _vm->_objectsManager.getBobPosX(4)); + _vm->_objectsManager.lockAnimX(8, _vm->_objectsManager.getBobPosX(4)); + } + _vm->_objectsManager.stopBobAnimation(3); + _vm->_objectsManager.stopBobAnimation(4); + _vm->_objectsManager.setBobAnimation(6); + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(6) < 12); + _vm->_objectsManager.stopBobAnimation(6); + _vm->_objectsManager.setBobAnimation(8); + + switch (_vm->_globals._screenId) { + case 35: + indx = 201; + break; + case 36: + indx = 203; + break; + case 37: + indx = 205; + break; + case 38: + indx = 207; + break; + case 39: + indx = 209; + break; + case 40: + indx = 211; + break; + case 41: + indx = 213; + break; + } + _vm->_globals._saveData->data[indx] = 2; + _vm->_objectsManager.disableZone(22); + _vm->_objectsManager.disableZone(23); + } else if (a1 == 20 || a1 == 21) { + _vm->_objectsManager.setFlipSprite(0, true); + _vm->_objectsManager.setSpriteIndex(0, 62); + _vm->_objectsManager.SPACTION(_vm->_globals._forestSprite, "2,3,4,5,6,7,8,9,10,11,12,-1,", 0, 0, 4, 1); + if (a1 == 20) { + _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(1)); + _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(1)); + } else { // a1 == 21 + _vm->_objectsManager.lockAnimX(5, _vm->_objectsManager.getBobPosX(2)); + _vm->_objectsManager.lockAnimX(7, _vm->_objectsManager.getBobPosX(2)); + } + _vm->_objectsManager.stopBobAnimation(1); + _vm->_objectsManager.stopBobAnimation(2); + _vm->_objectsManager.setBobAnimation(5); + _vm->_soundManager.PLAY_SAMPLE2(1); + _vm->_objectsManager.SPACTION1(_vm->_globals._forestSprite, "13,14,15,14,13,12,13,14,15,16,-1,", 0, 0, 4); + do + _vm->_eventsManager.VBL(); + while (_vm->_objectsManager.BOBPOSI(5) < 12); + _vm->_objectsManager.stopBobAnimation(5); + _vm->_objectsManager.setBobAnimation(7); + switch (_vm->_globals._screenId) { + case 35: + indx = 200; + break; + case 36: + indx = 202; + break; + case 37: + indx = 204; + break; + case 38: + indx = 206; + break; + case 39: + indx = 208; + break; + case 40: + indx = 210; + break; + case 41: + indx = 212; + break; } + _vm->_globals._saveData->data[indx] = 2; + _vm->_objectsManager.disableZone(21); + _vm->_objectsManager.disableZone(20); } } diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h index ca17f09c3c..090c804cbf 100644 --- a/engines/hopkins/talk.h +++ b/engines/hopkins/talk.h @@ -65,7 +65,7 @@ public: void initCharacterAnim(); void clearCharacterAnim(); bool searchCharacterAnim(int idx, const byte *bufPerso, int a3, int a4); - void REPONSE(int a1, int a2); + void REPONSE(int zone, int verb); void REPONSE2(int a1, int a2); void OBJET_VIVANT(const Common::String &a2); }; |