Thread-related IHNM differences.

svn-id: r18602
This commit is contained in:
Eugene Sandulenko 2005-07-30 14:41:25 +00:00
parent ba107e3799
commit 372a483ceb
4 changed files with 29 additions and 6 deletions

View File

@ -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

View File

@ -638,6 +638,9 @@ public:
GameDisplayInfo _gameDisplayInfo;
Common::Rect _displayClip;
public:
int32 _frameCount;
public:
bool initGame(void);
// RSCFILE_CONTEXT *getFileContext(uint16 type, int param);

View File

@ -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) {

View File

@ -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);
}