aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/scriptman.cpp
diff options
context:
space:
mode:
authorjohndoe1232014-03-22 02:32:44 +0100
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commitfc4266bcadaf7c01bf558ef78a9702254803ca77 (patch)
tree7ff02c71ff2da542dbdaacbf3eae754da44ecfa2 /engines/illusions/scriptman.cpp
parent812c7fc3a83f57b9ba181c47d3699155c16ab379 (diff)
downloadscummvm-rg350-fc4266bcadaf7c01bf558ef78a9702254803ca77.tar.gz
scummvm-rg350-fc4266bcadaf7c01bf558ef78a9702254803ca77.tar.bz2
scummvm-rg350-fc4266bcadaf7c01bf558ef78a9702254803ca77.zip
ILLUSIONS: Add TalkThread
Diffstat (limited to 'engines/illusions/scriptman.cpp')
-rw-r--r--engines/illusions/scriptman.cpp49
1 files changed, 44 insertions, 5 deletions
diff --git a/engines/illusions/scriptman.cpp b/engines/illusions/scriptman.cpp
index 2ba39c7ae5..eaaeaa57a7 100644
--- a/engines/illusions/scriptman.cpp
+++ b/engines/illusions/scriptman.cpp
@@ -26,6 +26,7 @@
#include "illusions/scriptman.h"
#include "illusions/scriptthread.h"
#include "illusions/scriptopcodes.h"
+#include "illusions/talkthread.h"
#include "illusions/timerthread.h"
namespace Illusions {
@@ -128,6 +129,9 @@ ScriptMan::ScriptMan(IllusionsEngine *vm)
: _vm(vm), _pauseCtr(0), _doScriptThreadInit(false) {
_threads = new ThreadList(vm);
_scriptOpcodes = new ScriptOpcodes(vm);
+ _field8 = 1;
+ _fieldA = 0;
+ _fieldE = 240;
}
ScriptMan::~ScriptMan() {
@@ -158,8 +162,8 @@ void ScriptMan::startAnonScriptThread(int32 threadId, uint32 callingThreadId,
uint32 ScriptMan::startTempScriptThread(byte *scriptCodeIp, uint32 callingThreadId,
uint32 value8, uint32 valueC, uint32 value10) {
- debug("Starting temp script thread");
uint32 tempThreadId = newTempThreadId();
+ debug("Starting temp script thread %08X", tempThreadId);
newScriptThread(tempThreadId, callingThreadId, 0, scriptCodeIp, value8, valueC, value10);
return tempThreadId;
}
@@ -173,21 +177,56 @@ uint32 ScriptMan::startTimerThread(uint32 duration, uint32 threadId) {
}
uint32 ScriptMan::startAbortableThread(byte *scriptCodeIp1, byte *scriptCodeIp2, uint32 callingThreadId) {
- debug("Starting abortable thread");
uint32 tempThreadId = newTempThreadId();
+ debug("Starting abortable thread %08X", tempThreadId);
uint32 scriptThreadId = startTempScriptThread(scriptCodeIp1, tempThreadId, 0, 0, 0);
- AbortableThread *abortableThread = new AbortableThread(_vm, tempThreadId, callingThreadId, 0, scriptThreadId, scriptCodeIp2);
+ AbortableThread *abortableThread = new AbortableThread(_vm, tempThreadId, callingThreadId, 0,
+ scriptThreadId, scriptCodeIp2);
_threads->startThread(abortableThread);
return tempThreadId;
}
+uint32 ScriptMan::startTalkThread(int16 duration, uint32 objectId, uint32 talkId, uint32 sequenceId1,
+ uint32 sequenceId2, uint32 namedPointId, uint32 callingThreadId) {
+ debug("Starting talk thread");
+ uint32 tempThreadId = newTempThreadId();
+ // TODO endTalkThreadsNoNotify();
+ TalkThread *talkThread = new TalkThread(_vm, tempThreadId, callingThreadId, 0,
+ duration, objectId, talkId, sequenceId1, sequenceId2, namedPointId);
+ _threads->startThread(talkThread);
+ return tempThreadId;
+}
+
void ScriptMan::setCurrFontId(uint32 fontId) {
_fontId = fontId;
}
+bool ScriptMan::checkActiveTalkThreads() {
+ // TODO
+ return false;
+}
+
+uint32 ScriptMan::clipTextDuration(uint32 duration) {
+ switch (_field8) {
+ case 2:
+ if (duration == 0)
+ duration = 240;
+ break;
+ case 3:
+ if (duration < _fieldA)
+ duration = _fieldA;
+ break;
+ case 4:
+ if (duration > _fieldA)
+ duration = _fieldA;
+ break;
+ }
+ return duration;
+}
+
void ScriptMan::reset() {
- // TODO _scriptResource->_blockCounters.clear();
- // TODO _scriptResource->_properties.clear();
+ _scriptResource->_blockCounters.clear();
+ _scriptResource->_properties.clear();
// TODO script_sub_417FF0(1, 0);
}