From 0af7371717f59199e2956d6643187de98235bede Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 10 Aug 2005 19:12:10 +0000 Subject: More IHNM fixes. Now it tries to start Ellen part but crashes at invalid opcode because it tries to execute string data. svn-id: r18654 --- saga/actor.cpp | 7 +++++-- saga/sthread.cpp | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'saga') diff --git a/saga/actor.cpp b/saga/actor.cpp index 70e379d157..2bd8e3f7f0 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -892,13 +892,16 @@ void Actor::updateActorsScene(int actorsEntrance) { ActorFrameRange *Actor::getActorFrameRange(uint16 actorId, int frameType) { ActorData *actor; int fourDirection; + static ActorFrameRange def = {0, 0}; actor = getActor(actorId); if (actor->_disabled) error("Actor::getActorFrameRange Wrong actorId 0x%X", actorId); - if (frameType >= actor->_framesCount) - error("Actor::getActorFrameRange Wrong frameType 0x%X (%d) actorId 0x%X", frameType, actor->_framesCount, actorId); + if (frameType >= actor->_framesCount) { + warning("Actor::getActorFrameRange Wrong frameType 0x%X (%d) actorId 0x%X", frameType, actor->_framesCount, actorId); + return &def; + } if ((actor->_facingDirection < kDirUp) || (actor->_facingDirection > kDirUpLeft)) error("Actor::getActorFrameRange Wrong direction 0x%X actorId 0x%X", actor->_facingDirection, actorId); diff --git a/saga/sthread.cpp b/saga/sthread.cpp index a61074f3ea..8cd6cb0977 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -228,17 +228,17 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) { #define CASEOP(opName) case opName: \ if (operandChar == opName) { \ operandName = #opName; \ - debug(8, operandName); \ + debug(2, operandName); \ _vm->_console->DebugPrintf("%s\n", operandName); \ } -// debug(8, "Executing thread offset: %lu (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize()); + debug(8, "Executing thread offset: %lu (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize()); operandName=""; switch (operandChar) { CASEOP(opNextBlock) // Some sort of "jump to the start of the next memory // page" instruction, I think. - thread->_instructionOffset = 1024 * ((thread->_instructionOffset / 1024) + 1); + thread->_instructionOffset = (((thread->_instructionOffset) >> 10) + 1) << 10; break; // STACK INSTRUCTIONS @@ -615,6 +615,9 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) { int16 first; const char *strings[ACTOR_SPEECH_STRING_MAX]; + if (_vm->getGameType() == GType_IHNM) + break; + if (_vm->_actor->isSpeaking()) { thread->wait(kWaitTypeSpeech); return false; -- cgit v1.2.3