aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-01-23 01:38:34 +0100
committerStrangerke2013-01-23 01:38:34 +0100
commit82ecfd537f8cb52701cc05e39457d00ce71ecb59 (patch)
tree09ac263253b3628b0c178f67b9793187fcacdd0e /engines
parent0e0337c30e3b32ae9ab487be8b20ba6a1043c6ef (diff)
downloadscummvm-rg350-82ecfd537f8cb52701cc05e39457d00ce71ecb59.tar.gz
scummvm-rg350-82ecfd537f8cb52701cc05e39457d00ce71ecb59.tar.bz2
scummvm-rg350-82ecfd537f8cb52701cc05e39457d00ce71ecb59.zip
HOPKINS: Some renaming and refactoring in globals, TalkManager and FontsManager
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/font.cpp4
-rw-r--r--engines/hopkins/font.h2
-rw-r--r--engines/hopkins/globals.cpp2
-rw-r--r--engines/hopkins/globals.h2
-rw-r--r--engines/hopkins/hopkins.cpp18
-rw-r--r--engines/hopkins/objects.cpp16
-rw-r--r--engines/hopkins/script.cpp92
-rw-r--r--engines/hopkins/sound.cpp4
-rw-r--r--engines/hopkins/talk.cpp124
-rw-r--r--engines/hopkins/talk.h4
10 files changed, 131 insertions, 137 deletions
diff --git a/engines/hopkins/font.cpp b/engines/hopkins/font.cpp
index e7d100b380..b7b9ecf3b6 100644
--- a/engines/hopkins/font.cpp
+++ b/engines/hopkins/font.cpp
@@ -110,7 +110,7 @@ void FontManager::setOptimalColor(int idx1, int idx2, int idx3, int idx4) {
/**
* Init text structure
*/
-void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int a9, int color) {
+void FontManager::initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int length, int color) {
assert(idx - 5 >= 0 && (idx - 5) <= MAX_TEXT);
TxtItem &txt = _text[idx - 5];
@@ -120,7 +120,7 @@ void FontManager::initTextBuffers(int idx, int messageId, const Common::String &
txt._pos.y = yp;
txt._messageId = messageId;
txt._textType = textType;
- txt._length = a9;
+ txt._length = length;
txt._color = color;
}
diff --git a/engines/hopkins/font.h b/engines/hopkins/font.h
index 10466ba529..3a81361de1 100644
--- a/engines/hopkins/font.h
+++ b/engines/hopkins/font.h
@@ -76,7 +76,7 @@ public:
void hideText(int idx);
void setTextColor(int idx, byte colByte);
void setOptimalColor(int idx1, int idx2, int idx3, int idx4);
- void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int a9, int color);
+ void initTextBuffers(int idx, int messageId, const Common::String &filename, int xp, int yp, int textType, int length, int color);
void box(int idx, int messageId, const Common::String &filename, int xp, int yp);
void displayTextVesa(int xp, int yp, const Common::String &message, int col);
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index af942b94d0..68692735e1 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -202,7 +202,7 @@ Globals::Globals() {
NOMARCHE = false;
_optionDialogFl = false;
_cacheFl = false;
- NOPARLE = false;
+ _introSpeechOffFl = false;
couleur_40 = 50;
// Reset indexed variables
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index 4f277de7e4..272c14be94 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -382,7 +382,7 @@ public:
int _sortedDisplayCount;
bool NOT_VERIF;
bool _cacheFl;
- bool NOPARLE;
+ bool _introSpeechOffFl;
bool PLAN_FLAG;
bool GOACTION;
int Compteur;
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index aa93289cc0..2b81867060 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -2009,9 +2009,9 @@ void HopkinsEngine::bombExplosion() {
_eventsManager.VBL();
}
- _globals.NOPARLE = true;
+ _globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO2("vire.pe2");
- _globals.NOPARLE = false;
+ _globals._introSpeechOffFl = false;
_objectsManager.setBobAnimation(7);
for (int idx = 0; idx < 100; ++idx) {
@@ -2078,9 +2078,9 @@ void HopkinsEngine::handleConflagration() {
for (int cpt = 0; cpt <= 249; cpt++)
_eventsManager.VBL();
- _globals.NOPARLE = true;
+ _globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("SVGARD1.pe2");
- _globals.NOPARLE = false;
+ _globals._introSpeechOffFl = false;
for (int cpt = 0; cpt <= 49; cpt++)
_eventsManager.VBL();
@@ -2203,7 +2203,7 @@ void HopkinsEngine::playEnding() {
_eventsManager.VBL();
while (_objectsManager.BOBPOSI(6) != 54);
- _globals.NOPARLE = true;
+ _globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("GM4.PE2");
_globals._disableInventFl = true;
_objectsManager.stopBobAnimation(6);
@@ -2221,7 +2221,7 @@ void HopkinsEngine::playEnding() {
_eventsManager.VBL();
while (_objectsManager.BOBPOSI(7) != 65);
- _globals.NOPARLE = true;
+ _globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("DUELB4.PE2");
_eventsManager.mouseOff();
_globals._disableInventFl = true;
@@ -2230,14 +2230,14 @@ void HopkinsEngine::playEnding() {
_eventsManager.VBL();
while (_objectsManager.BOBPOSI(7) != 72);
- _globals.NOPARLE = true;
+ _globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("DUELH1.PE2");
do
_eventsManager.VBL();
while (_objectsManager.BOBPOSI(7) != 81);
- _globals.NOPARLE = true;
+ _globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("DUELB5.PE2");
do
@@ -2288,7 +2288,7 @@ void HopkinsEngine::playEnding() {
_animationManager.playAnim2("BERM.ANM", 100, 24, 300);
_objectsManager.stopBobAnimation(7);
_objectsManager.setBobAnimation(8);
- _globals.NOPARLE = true;
+ _globals._introSpeechOffFl = true;
_talkManager.PARLER_PERSO("GM5.PE2");
_globals._disableInventFl = true;
diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index 44a446e9a6..fb788a7031 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.cpp
@@ -1970,16 +1970,16 @@ void ObjectsManager::PLAN_BETA() {
if (mouseButton) {
if (_vm->_globals._saveData->_data[svField170] == 1 && !_vm->_globals._saveData->_data[svField171]) {
_vm->_globals._saveData->_data[svField171] = 1;
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("APPEL1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
mouseButton = 0;
}
if (_vm->_globals._saveData->_data[svField80] == 1 && !_vm->_globals._saveData->_data[svField172]) {
_vm->_globals._saveData->_data[svField172] = 1;
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("APPEL2.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
mouseButton = 0;
_vm->_eventsManager._curMouseButton = 0;
}
@@ -3168,9 +3168,9 @@ void ObjectsManager::handleSpecialGames() {
break;
_vm->_globals._saveData->_data[svField173] = 1;
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("flicspe1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
if (_vm->_globals._censorshipFl)
break;
@@ -3279,7 +3279,7 @@ void ObjectsManager::handleSpecialGames() {
do
_vm->_eventsManager.VBL();
while (BOBPOSI(8) != 3);
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("GM3.PE2");
stopBobAnimation(8);
_vm->_globals._saveData->_data[svField333] = 1;
@@ -3803,7 +3803,7 @@ void ObjectsManager::SPECIAL_INI() {
_vm->_globals.iRegul = 1;
_vm->_globals._disableInventFl = false;
_vm->_graphicsManager._noFadingFl = true;
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("MAGE1.pe2");
_vm->_graphicsManager._noFadingFl = true;
_vm->_globals._disableInventFl = false;
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index 6bf6e5f4b0..2aa96c8145 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -881,9 +881,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
}
case 52:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("GARDE.PE2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 53:
@@ -924,11 +924,11 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 58:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("Gm1.PE2");
_vm->_globals._saveData->_data[svField176] = 1;
_vm->_globals._saveData->_data[svField270] = 2;
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 59: {
@@ -1104,9 +1104,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 84:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("CVIGIL1.PE2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 85:
@@ -1130,9 +1130,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
if (_vm->_globals._saveData->_data[svField231] == 1) {
_vm->_talkManager.PARLER_PERSO("chotess1.pe2");
} else {
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("chotesse.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
}
break;
@@ -1319,9 +1319,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 98:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("CVIGIL2.PE2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 100:
@@ -1333,22 +1333,22 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 103:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("tourist1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
_vm->_animationManager.playAnim2("T421.ANM", 100, 14, 500);
_vm->_eventsManager.VBL();
_vm->_eventsManager.VBL();
_vm->_eventsManager.VBL();
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("tourist2.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 104:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("tourist3.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 105:
@@ -1552,33 +1552,33 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 108:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("peche1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 109:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("peche2.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 110:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("peche3.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 111:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("peche4.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 112:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("teint1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 113:
@@ -1602,9 +1602,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 171: {
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("gred1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
@@ -1632,9 +1632,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 173: {
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("gbleu1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
_vm->_globals.NOT_VERIF = true;
_vm->_objectsManager.g_old_x = _vm->_objectsManager.getSpriteX(0);
_vm->_globals._oldDirection = -1;
@@ -1709,21 +1709,21 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 176:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("gred2.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 177:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("gbleu2.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 200:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("Gm2.PE2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 201:
@@ -1739,9 +1739,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 202:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("SVGARD2.PE2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 203:
@@ -1922,15 +1922,15 @@ int ScriptManager::handleOpcode(byte *dataP) {
break;
case 215:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("aviat.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 216:
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("aviat1.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
break;
case 229:
@@ -1997,9 +1997,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_eventsManager.VBL();
} while (_vm->_objectsManager.BOBPOSI(12) != 6);
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("PRMORT.pe2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
do {
if (_vm->shouldQuit())
return -1; // Exiting game
@@ -2033,9 +2033,9 @@ int ScriptManager::handleOpcode(byte *dataP) {
_vm->_eventsManager.VBL();
} while (_vm->_objectsManager.BOBPOSI(13) != 48);
- _vm->_globals.NOPARLE = true;
+ _vm->_globals._introSpeechOffFl = true;
_vm->_talkManager.PARLER_PERSO("HRADIO.PE2");
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
_vm->_graphicsManager.fadeOutLong();
_vm->_objectsManager.stopBobAnimation(13);
_vm->_graphicsManager._noFadingFl = true;
diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp
index 47b2e6827e..3ef1618d8b 100644
--- a/engines/hopkins/sound.cpp
+++ b/engines/hopkins/sound.cpp
@@ -561,6 +561,8 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) {
}
SDL_LVOICE(filename, catPos, catLen);
+
+ // Reduce music volume during speech
oldMusicVol = _musicVolume;
if (!_musicOffFl && _musicVolume > 2) {
_musicVolume = (signed int)((long double)_musicVolume - (long double)_musicVolume / 100.0 * 45.0);
@@ -588,6 +590,8 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode) {
stopVoice(2);
DEL_SAMPLE_SDL(20);
+
+ // Speech is over, set the music volume back to normal
_musicVolume = oldMusicVol;
if (!_musicOffFl && _musicVolume > 2) {
_vm->_soundManager.MODSetMusicVolume(_vm->_soundManager._musicVolume);
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index 77705d735f..7df6b21c51 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/talk.cpp
@@ -51,7 +51,6 @@ void TalkManager::setParent(HopkinsEngine *vm) {
void TalkManager::PARLER_PERSO(const Common::String &filename) {
Common::String spriteFilename;
- int answer = 0;
_vm->_fontManager.hideText(5);
_vm->_fontManager.hideText(9);
_vm->_eventsManager.VBL();
@@ -99,29 +98,30 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
_dialogueMesgId2 = _dialogueMesgId1 + 1;
_dialogueMesgId3 = _dialogueMesgId1 + 2;
_dialogueMesgId4 = _dialogueMesgId1 + 3;
- int v14 = _vm->_eventsManager._mouseCursorId;
+ int oldMouseCursorId = _vm->_eventsManager._mouseCursorId;
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(0);
- if (!_vm->_globals.NOPARLE) {
- int v5;
+ if (!_vm->_globals._introSpeechOffFl) {
+ int answer = 0;
+ int dlgAnswer;
do {
- v5 = DIALOGUE();
- if (v5 != _dialogueMesgId4)
- answer = DIALOGUE_REP(v5);
+ dlgAnswer = dialogQuestion();
+ if (dlgAnswer != _dialogueMesgId4)
+ answer = dialogAnswer(dlgAnswer);
if (answer == -1)
- v5 = _dialogueMesgId4;
+ dlgAnswer = _dialogueMesgId4;
_vm->_eventsManager.VBL();
- } while (v5 != _dialogueMesgId4);
+ } while (dlgAnswer != _dialogueMesgId4);
}
- if (_vm->_globals.NOPARLE) {
- int v6 = 1;
- int v7;
+ if (_vm->_globals._introSpeechOffFl) {
+ int idx = 1;
+ int answer;
do
- v7 = DIALOGUE_REP(v6++);
- while (v7 != -1);
+ answer = dialogAnswer(idx++);
+ while (answer != -1);
}
clearCharacterAnim();
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
_characterBuffer = _vm->_globals.freeMemory(_characterBuffer);
_characterSprite = _vm->_globals.freeMemory(_characterSprite);
_vm->_graphicsManager.NB_SCREEN(false);
@@ -130,9 +130,9 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
g_system->getSavefileManager()->removeSavefile("TEMP.SCR");
_vm->_objectsManager.PERSO_ON = false;
- _vm->_eventsManager._mouseCursorId = v14;
+ _vm->_eventsManager._mouseCursorId = oldMouseCursorId;
- _vm->_eventsManager.changeMouseCursor(v14);
+ _vm->_eventsManager.changeMouseCursor(oldMouseCursorId);
_vm->_graphicsManager.SETCOLOR3(253, 100, 100, 100);
if (_vm->getIsDemo() == false)
@@ -154,7 +154,7 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
void TalkManager::PARLER_PERSO2(const Common::String &filename) {
// TODO: The original disables the mouse cursor here
STATI = true;
- bool v7 = _vm->_globals._disableInventFl;
+ bool oldDisableInventFl = _vm->_globals._disableInventFl;
_vm->_globals._disableInventFl = true;
_characterBuffer = _vm->_fileManager.searchCat(filename, 5);
_characterSize = _vm->_globals._catalogSize;
@@ -192,23 +192,23 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) {
_vm->_eventsManager._mouseCursorId = 4;
_vm->_eventsManager.changeMouseCursor(0);
- if (!_vm->_globals.NOPARLE) {
- int v3;
+ if (!_vm->_globals._introSpeechOffFl) {
+ int answer;
do {
- v3 = DIALOGUE();
- if (v3 != _dialogueMesgId4) {
- if (DIALOGUE_REP(v3) == -1)
- v3 = _dialogueMesgId4;
+ answer = dialogQuestion();
+ if (answer != _dialogueMesgId4) {
+ if (dialogAnswer(answer) == -1)
+ answer = _dialogueMesgId4;
}
- } while (v3 != _dialogueMesgId4);
+ } while (answer != _dialogueMesgId4);
}
- if (_vm->_globals.NOPARLE) {
- int v4 = 1;
- int v5;
+ if (_vm->_globals._introSpeechOffFl) {
+ int idx = 1;
+ int answer;
do
- v5 = DIALOGUE_REP(v4++);
- while (v5 != -1);
+ answer = dialogAnswer(idx++);
+ while (answer != -1);
}
_characterBuffer = _vm->_globals.freeMemory(_characterBuffer);
@@ -218,7 +218,7 @@ void TalkManager::PARLER_PERSO2(const Common::String &filename) {
_vm->_graphicsManager.initColorTable(145, 150, _vm->_graphicsManager._palette);
_vm->_graphicsManager.setPaletteVGA256(_vm->_graphicsManager._palette);
// TODO: The original reenables the mouse cursor here
- _vm->_globals._disableInventFl = v7;
+ _vm->_globals._disableInventFl = oldDisableInventFl;
STATI = false;
}
@@ -226,7 +226,7 @@ void TalkManager::getStringFromBuffer(int srcStart, Common::String &dest, const
dest = Common::String(srcData + srcStart);
}
-int TalkManager::DIALOGUE() {
+int TalkManager::dialogQuestion() {
if (STATI) {
uint16 *bufPtr = (uint16 *)_characterBuffer + 48;
int curVal = (int16)READ_LE_UINT16(bufPtr);
@@ -264,7 +264,7 @@ int TalkManager::DIALOGUE() {
_vm->_fontManager.showText(8);
int retVal = -1;
- bool v6 = false;
+ bool loopCond = false;
do {
int mousePosY = _vm->_eventsManager.getMouseY();
if (sentence1PosY < mousePosY && mousePosY < (sentence2PosY - 1)) {
@@ -286,10 +286,10 @@ int TalkManager::DIALOGUE() {
_vm->_eventsManager.VBL();
if (_vm->_eventsManager.getMouseButton())
- v6 = true;
+ loopCond = true;
if (retVal == -1)
- v6 = false;
- } while (!_vm->shouldQuit() && !v6);
+ loopCond = false;
+ } while (!_vm->shouldQuit() && !loopCond);
_vm->_soundManager.mixVoice(retVal, 1);
_vm->_fontManager.hideText(5);
@@ -327,34 +327,24 @@ int TalkManager::DIALOGUE() {
return retVal;
}
-int TalkManager::DIALOGUE_REP(int idx) {
- int v1;
- byte *v3;
- int v6;
- int v7;
- int v21;
- int v22;
- int v23;
- int v24;
- int v25;
-
- v1 = 0;
- v3 = _characterBuffer + 110;
- for (; (int16)READ_LE_UINT16(v3) != idx; v3 = _characterBuffer + 20 * v1 + 110) {
- ++v1;
- if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < v1)
+int TalkManager::dialogAnswer(int idx) {
+ int charIdx;
+ byte *charBuf;
+ for (charBuf = _characterBuffer + 110, charIdx = 0; (int16)READ_LE_UINT16(charBuf) != idx; charBuf += 20) {
+ ++charIdx;
+ if ((int16)READ_LE_UINT16((uint16 *)_characterBuffer + 42) < charIdx)
return -1;
}
- v22 = (int16)READ_LE_UINT16((uint16 *)v3 + 1);
- v25 = (int16)READ_LE_UINT16((uint16 *)v3 + 2);
- v24 = (int16)READ_LE_UINT16((uint16 *)v3 + 3);
- v23 = (int16)READ_LE_UINT16((uint16 *)v3 + 4);
- _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)v3 + 5);
- _dialogueMesgId2 = (int16)READ_LE_UINT16((uint16 *)v3 + 6);
- _dialogueMesgId3 = (int16)READ_LE_UINT16((uint16 *)v3 + 7);
- v6 = (int16)READ_LE_UINT16((uint16 *)v3 + 8);
- v7 = (int16)READ_LE_UINT16((uint16 *)v3 + 9);
+ int mesgId = (int16)READ_LE_UINT16((uint16 *)charBuf + 1);
+ int mesgPosX = (int16)READ_LE_UINT16((uint16 *)charBuf + 2);
+ int mesgPosY = (int16)READ_LE_UINT16((uint16 *)charBuf + 3);
+ int mesgLength = (int16)READ_LE_UINT16((uint16 *)charBuf + 4);
+ _dialogueMesgId1 = (int16)READ_LE_UINT16((uint16 *)charBuf + 5);
+ _dialogueMesgId2 = (int16)READ_LE_UINT16((uint16 *)charBuf + 6);
+ _dialogueMesgId3 = (int16)READ_LE_UINT16((uint16 *)charBuf + 7);
+ int v6 = (int16)READ_LE_UINT16((uint16 *)charBuf + 8);
+ int v7 = (int16)READ_LE_UINT16((uint16 *)charBuf + 9);
if (v7)
_vm->_globals._saveData->_data[svField4] = v7;
@@ -387,10 +377,10 @@ int TalkManager::DIALOGUE_REP(int idx) {
}
if (!_vm->_soundManager._textOffFl) {
- _vm->_fontManager.initTextBuffers(9, v22, _answersFilename, v25, v24, 5, v23, 252);
+ _vm->_fontManager.initTextBuffers(9, mesgId, _answersFilename, mesgPosX, mesgPosY, 5, mesgLength, 252);
_vm->_fontManager.showText(9);
}
- if (!_vm->_soundManager.mixVoice(v22, 1)) {
+ if (!_vm->_soundManager.mixVoice(mesgId, 1)) {
_vm->_eventsManager._curMouseButton = 0;
_vm->_eventsManager._mouseButton = 0;
@@ -435,11 +425,11 @@ int TalkManager::DIALOGUE_REP(int idx) {
} else {
dialogEndTalk();
}
- v21 = 0;
+ int result = 0;
if (!_dialogueMesgId1)
- v21 = -1;
+ result = -1;
- return v21;
+ return result;
}
void TalkManager::searchCharacterPalette(int startIdx, bool dark) {
@@ -1090,7 +1080,7 @@ void TalkManager::OBJET_VIVANT(const Common::String &a2) {
dialogTalk();
clearCharacterAnim();
clearCharacterAnim();
- _vm->_globals.NOPARLE = false;
+ _vm->_globals._introSpeechOffFl = false;
_characterBuffer = _vm->_globals.freeMemory(_characterBuffer);
_characterSprite = _vm->_globals.freeMemory(_characterSprite);
_vm->_graphicsManager.NB_SCREEN(false);
diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h
index a71ddfba7b..db49e7bb02 100644
--- a/engines/hopkins/talk.h
+++ b/engines/hopkins/talk.h
@@ -52,8 +52,8 @@ public:
void PARLER_PERSO2(const Common::String &filename);
void PARLER_PERSO(const Common::String &filename);
void getStringFromBuffer(int srcStart, Common::String &dest, const char *srcData);
- int DIALOGUE();
- int DIALOGUE_REP(int idx);
+ int dialogQuestion();
+ int dialogAnswer(int idx);
void searchCharacterPalette(int startIdx, bool dark);
void dialogWait();
void dialogTalk();