aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions
diff options
context:
space:
mode:
authorjohndoe1232018-05-17 06:13:30 +1000
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit4637104e6d289ab42d5eb02e0f42f48133180542 (patch)
tree5df56494f4e0508ae268565cb425689f062aa290 /engines/illusions
parentb787b06156fe22261f2a80227d48fdd2da47e0a2 (diff)
downloadscummvm-rg350-4637104e6d289ab42d5eb02e0f42f48133180542.tar.gz
scummvm-rg350-4637104e6d289ab42d5eb02e0f42f48133180542.tar.bz2
scummvm-rg350-4637104e6d289ab42d5eb02e0f42f48133180542.zip
ILLUSIONS: BBDOU: Implement missing talkthread events
(cherry picked from commit 87869cb)
Diffstat (limited to 'engines/illusions')
-rw-r--r--engines/illusions/threads/talkthread.cpp107
-rw-r--r--engines/illusions/threads/talkthread.h4
2 files changed, 111 insertions, 0 deletions
diff --git a/engines/illusions/threads/talkthread.cpp b/engines/illusions/threads/talkthread.cpp
index 74fd162aae..7c2e01276e 100644
--- a/engines/illusions/threads/talkthread.cpp
+++ b/engines/illusions/threads/talkthread.cpp
@@ -241,7 +241,114 @@ if (true) {
}
return kTSTerminate;
+}
+
+void TalkThread::onSuspend() {
+ switch (_status) {
+ case 1:
+ _voiceDurationElapsed = getDurationElapsed(_voiceStartTime, _voiceEndTime);
+ _status = 7;
+ break;
+ case 4:
+ _vm->_soundMan->stopCueingVoice();
+ _status = 7;
+ break;
+ case 6:
+ case 7:
+ if (!(_flags & 4)) {
+ _vm->_soundMan->stopVoice();
+ _flags |= 4;
+ }
+ if (!(_flags & 8)) {
+ _vm->_screenText->removeText();
+ _flags |= 8;
+ }
+ _status = 7;
+ break;
+ default:
+ _status = 7;
+ break;
+ }
+}
+
+void TalkThread::onPause() {
+ switch (_status) {
+ case 1:
+ _voiceDurationElapsed = getDurationElapsed(_voiceStartTime, _voiceEndTime);
+ break;
+ case 4:
+ _vm->_soundMan->stopCueingVoice();
+ break;
+ case 6:
+ case 7:
+ if (!(_flags & 4)) {
+ // TODO audvocPauseVoice();
+ }
+ if (!(_flags & 8)) {
+ _textDurationElapsed = getDurationElapsed(_textStartTime, _textEndTime);
+ }
+ break;
+ default:
+ break;
+ }
+}
+void TalkThread::onUnpause() {
+ switch (_status) {
+ case 1:
+ _voiceStartTime = getCurrentTime();
+ if (_voiceDuration <= _voiceDurationElapsed) {
+ _voiceDurationElapsed = 0;
+ _voiceEndTime = _voiceStartTime;
+ } else {
+ _voiceDurationElapsed = 0;
+ _voiceEndTime = _voiceStartTime + _voiceDuration - _voiceDurationElapsed;
+ }
+ break;
+ case 4:
+ if (_vm->isSoundActive()) {
+ TalkEntry *talkEntry = getTalkResourceEntry(_talkId);
+ _vm->_soundMan->cueVoice((char*)talkEntry->_voiceName);
+ }
+ break;
+ case 6:
+ if (!(_flags & 4)) {
+ // TODO audvocUnpauseVoice();
+ }
+ if (!(_flags & 8)) {
+ _textStartTime = getCurrentTime();
+ if (_textDuration <= _textDurationElapsed) {
+ _textDurationElapsed = 0;
+ _textEndTime = _textStartTime;
+ } else {
+ _textDurationElapsed = 0;
+ _textEndTime = _textStartTime + _textDuration - _textDurationElapsed;
+ }
+ }
+ break;
+ }
+}
+
+void TalkThread::onTerminated() {
+ if (_status == 4) {
+ _vm->_soundMan->stopCueingVoice();
+ } else if (_status == 6) {
+ if (!(_flags & 4)) {
+ _vm->_soundMan->stopVoice();
+ _flags |= 4;
+ }
+ if (!(_flags & 8)) {
+ _vm->_screenText->removeText();
+ _flags |= 8;
+ }
+ if (!(_flags & 2)) {
+ if (_sequenceId2) {
+ Control *control = _vm->_dict->getObjectControl(_objectId);
+ control->startSequenceActor(_sequenceId2, 2, 0);
+ }
+ _flags |= 2;
+ }
+ }
}
void TalkThread::onKill() {
diff --git a/engines/illusions/threads/talkthread.h b/engines/illusions/threads/talkthread.h
index 1d6573c890..7f8a197001 100644
--- a/engines/illusions/threads/talkthread.h
+++ b/engines/illusions/threads/talkthread.h
@@ -42,6 +42,10 @@ public:
int16 duration, uint32 objectId, uint32 talkId, uint32 sequenceId1, uint32 sequenceId2,
uint32 namedPointId);
virtual int onUpdate();
+ virtual void onSuspend();
+ virtual void onPause();
+ virtual void onUnpause();
+ virtual void onTerminated();
virtual void onKill();
virtual uint32 sendMessage(int msgNum, uint32 msgValue);
public: