aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2004-12-06 20:42:11 +0000
committerGregory Montoir2004-12-06 20:42:11 +0000
commit3fb09f9b1c36bba22b3248b37a04eb8a311d4ba0 (patch)
treeb2f7961ab326c21a04512766d0bf5a66d1f18402 /queen
parent24bc673b8b31bebf5b34d408a02e9d74afb560a0 (diff)
downloadscummvm-rg350-3fb09f9b1c36bba22b3248b37a04eb8a311d4ba0.tar.gz
scummvm-rg350-3fb09f9b1c36bba22b3248b37a04eb8a311d4ba0.tar.bz2
scummvm-rg350-3fb09f9b1c36bba22b3248b37a04eb8a311d4ba0.zip
Cutaway code also handles some talking stuff... Updated this part too, to fix 'bug' #1034715
svn-id: r15996
Diffstat (limited to 'queen')
-rw-r--r--queen/cutaway.cpp46
-rw-r--r--queen/talk.cpp6
2 files changed, 22 insertions, 30 deletions
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index fb52ddfd78..e27c3d63b7 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -1165,30 +1165,12 @@ void Cutaway::updateGameState() {
} // for()
}
-static char *right(char *str, int count) {
- // This function does _not_ use static data (the implementation in talk.c does!)
- int length = strlen(str);
- if (count > length)
- return str;
- else
- return str + length - count;
-}
-
void Cutaway::talk(char *nextFilename) {
- // Lines 2119-2131 in cutaway.c
-
- if (0 == scumm_stricmp(right(_talkFile, 4), ".dog")) {
+ const char *p = strrchr(_talkFile, '.');
+ if (p && 0 == scumm_stricmp(p, ".dog")) {
nextFilename[0] = '\0';
-
- int personInRoom;
-
- if (_talkTo > 0)
- personInRoom = _talkTo - _vm->logic()->roomData(_vm->logic()->currentRoom());
- else {
- warning("_talkTo is 0!");
- personInRoom = 0; // XXX is this correct?
- }
-
+ assert(_talkTo > 0);
+ int personInRoom = _talkTo - _vm->logic()->roomData(_vm->logic()->currentRoom());
_vm->logic()->startDialogue(_talkFile, personInRoom, nextFilename);
}
}
@@ -1269,14 +1251,9 @@ void Cutaway::handleText(
_vm->display()->clearTexts(0, 150);
}
- int i;
- for (i = 0; i < spaces; i++) {
+ while (1) {
_vm->update();
- if (OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) {
- // XXX: see if speaking is finished
- }
-
if (_vm->input()->cutawayQuit())
return;
@@ -1284,9 +1261,20 @@ void Cutaway::handleText(
_vm->input()->clearKeyVerb();
break;
}
+
+ if ((OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) && _vm->sound()->speechOn()) {
+ if (!_vm->sound()->isSpeechActive()) {
+ break;
+ }
+ } else {
+ --spaces;
+ if (spaces <= 0) {
+ break;
+ }
+ }
}
- _vm->display()->clearTexts(0,198);
+ _vm->display()->clearTexts(0, 198);
_vm->update();
}
diff --git a/queen/talk.cpp b/queen/talk.cpp
index 13fd1924d7..fe412eafde 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -792,7 +792,7 @@ void Talk::speakSegment(
segment[length] = '\0';
char voiceFileName[MAX_STRING_SIZE];
- snprintf(voiceFileName, sizeof(voiceFileName), "%s%1x", voiceFilePrefix, index + 1);
+ sprintf(voiceFileName, "%s%1x", voiceFilePrefix, index + 1);
// FIXME - it seems the french talkie version has a useless voice file ;
// the c30e_102 file is very similar to c30e_101, so there is no need to
@@ -1044,6 +1044,10 @@ void Talk::getString(const byte *ptr, uint16 &offset, char *str, int maxLength,
str[length] = '\0';
}
offset = (offset + length + (align - 1)) & ~(align - 1);
+ } else {
+ if (str) {
+ str[0] = '\0';
+ }
}
}