diff options
author | Eugene Sandulenko | 2005-07-30 14:41:25 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-07-30 14:41:25 +0000 |
commit | 372a483ceba36eb21453e83d8dfd9303c706da99 (patch) | |
tree | 399cd38ce93915f796f1e60b86c38c9dca11838c | |
parent | ba107e37995cc03a922c2196d72e85d7cef088ba (diff) | |
download | scummvm-rg350-372a483ceba36eb21453e83d8dfd9303c706da99.tar.gz scummvm-rg350-372a483ceba36eb21453e83d8dfd9303c706da99.tar.bz2 scummvm-rg350-372a483ceba36eb21453e83d8dfd9303c706da99.zip |
Thread-related IHNM differences.
svn-id: r18602
-rw-r--r-- | saga/saga.cpp | 2 | ||||
-rw-r--r-- | saga/saga.h | 3 | ||||
-rw-r--r-- | saga/script.h | 4 | ||||
-rw-r--r-- | saga/sthread.cpp | 26 |
4 files changed, 29 insertions, 6 deletions
diff --git a/saga/saga.cpp b/saga/saga.cpp index e79f9c18b3..8c85f22830 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -143,6 +143,8 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst) _sound = NULL; _puzzle = NULL; + _frameCount = 0; + // The Linux version of Inherit the Earth puts all data files in an // 'itedata' sub-directory, except for voices.rsc diff --git a/saga/saga.h b/saga/saga.h index bb4f4cfdfa..74f962876d 100644 --- a/saga/saga.h +++ b/saga/saga.h @@ -639,6 +639,9 @@ public: Common::Rect _displayClip; public: + int32 _frameCount; + +public: bool initGame(void); // RSCFILE_CONTEXT *getFileContext(uint16 type, int param); // bool isBigEndianFile(const char *filename); diff --git a/saga/script.h b/saga/script.h index 4e175d1900..91d1898e7c 100644 --- a/saga/script.h +++ b/saga/script.h @@ -104,7 +104,8 @@ enum ThreadWaitTypes { kWaitTypeRequest = 6, // a request is up kWaitTypePause = 7, kWaitTypePlacard = 8, - kWaitTypeStatusTextInput = 9 + kWaitTypeStatusTextInput = 9, + kWaitTypeWaitFrames = 10 // IHNM. waiting for a frame count }; enum OpCodes { @@ -262,6 +263,7 @@ public: uint16 _instructionOffset; // Instruction offset + int32 _frameWait; public: byte *baseAddress(byte addrMode) { diff --git a/saga/sthread.cpp b/saga/sthread.cpp index 15af37012c..bfa3c2cb81 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -117,13 +117,19 @@ void Script::executeThreads(uint msec) { if (thread->_flags & kTFlagFinished) setPointerVerb(); - threadIterator = _threadList.erase(threadIterator); + if (_vm->getGameType() == GType_IHNM) { + thread->_flags &= ~kTFlagFinished; + thread->_flags |= kTFlagAborted; + } else { + threadIterator = _threadList.erase(threadIterator); + } continue; } if (thread->_flags & kTFlagWaiting) { - if (thread->_waitType == kWaitTypeDelay) { + switch (thread->_waitType) { + case kWaitTypeDelay: if (thread->_sleepTime < msec) { thread->_sleepTime = 0; } else { @@ -132,14 +138,22 @@ void Script::executeThreads(uint msec) { if (thread->_sleepTime == 0) thread->_flags &= ~kTFlagWaiting; - } else { - if (thread->_waitType == kWaitTypeWalk) { + break; + + case kWaitTypeWalk: + { ActorData *actor; actor = (ActorData *)thread->_threadObj; if (actor->currentAction == kActionWait) { thread->_flags &= ~kTFlagWaiting; } } + break; + + case kWaitTypeWaitFrames: // IHNM + if (thread->_frameWait < _vm->_frameCount) + thread->_flags &= ~kTFlagWaiting; + break; } } @@ -169,7 +183,9 @@ void Script::abortAllThreads(void) { } void Script::completeThread(void) { - for (int i = 0; i < 40 && !_threadList.isEmpty() ; i++) + int limit = (_vm->getGameType() == GType_IHNM) ? 100 : 40; + + for (int i = 0; i < limit && !_threadList.isEmpty() ; i++) executeThreads(0); } |