[Scummvm-cvs-logs] CVS: scummvm/saga scene.cpp,1.92,1.93 script.h,1.69,1.70 sthread.cpp,1.73,1.74
Andrew Kurushin
h00ligan at users.sourceforge.net
Tue Mar 29 09:55:20 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.404,2.405 script_v100he.cpp,2.101,2.102 script_v90he.cpp,2.197,2.198 sprite_he.cpp,1.109,1.110
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga sthread.cpp,1.74,1.75
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31313
Modified Files:
scene.cpp script.h sthread.cpp
Log Message:
endScene now aborts all running threads (fixing Okk stuckiness on way out of tent)
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- scene.cpp 18 Mar 2005 17:11:36 -0000 1.92
+++ scene.cpp 29 Mar 2005 17:54:52 -0000 1.93
@@ -934,9 +934,9 @@
_sceneProc(SCENE_END, &scene_info, this);
-/* if (_desc.scriptModuleNumber > 0) {
- _vm->_script->freeScript();
- }*/
+ //
+ _vm->_script->abortAllThreads();
+ _vm->_script->_skipSpeeches = false;
// Free scene background
if (_bg.loaded) {
Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- script.h 25 Mar 2005 17:48:17 -0000 1.69
+++ script.h 29 Mar 2005 17:54:53 -0000 1.70
@@ -427,6 +427,7 @@
int executeThreads(uint msec);
int SThreadDebugStep();
void completeThread(void);
+ void abortAllThreads(void);
void wakeUpActorThread(int waitType, void *threadObj);
void wakeUpThreads(int waitType);
@@ -436,7 +437,8 @@
void loadModuleBase(ModuleData &module, const byte *resourcePointer, size_t resourceLength);
void loadModuleVoiceLUT(ModuleData &module, const byte *resourcePointer, size_t resourceLength);
- void runThread(ScriptThread *thread, uint instructionLimit);
+ // runThread returns true if we should break running of other threads
+ bool runThread(ScriptThread *thread, uint instructionLimit);
void setThreadEntrypoint(ScriptThread *thread, int entrypointNumber);
public:
Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- sthread.cpp 28 Jan 2005 03:47:12 -0000 1.73
+++ sthread.cpp 29 Mar 2005 17:54:53 -0000 1.74
@@ -142,8 +142,11 @@
}
}
- if (!(thread->_flags & kTFlagWaiting))
- runThread(thread, STHREAD_TIMESLICE);
+ if (!(thread->_flags & kTFlagWaiting)) {
+ if (runThread(thread, STHREAD_TIMESLICE)) {
+ break;
+ }
+ }
++threadIterator;
}
@@ -151,6 +154,20 @@
return SUCCESS;
}
+void Script::abortAllThreads(void) {
+ ScriptThread *thread;
+ ScriptThreadList::iterator threadIterator;
+
+ threadIterator = _threadList.begin();
+
+ while (threadIterator != _threadList.end()) {
+ thread = threadIterator.operator->();
+ thread->_flags |= kTFlagAborted;
+ ++threadIterator;
+ }
+ executeThreads(0);
+}
+
void Script::completeThread(void) {
for (int i = 0; i < 40 && !_threadList.isEmpty() ; i++)
executeThreads(0);
@@ -164,7 +181,7 @@
return SUCCESS;
}
-void Script::runThread(ScriptThread *thread, uint instructionLimit) {
+bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
const char*operandName;
uint instructionCount;
uint16 savedInstructionOffset;
@@ -191,7 +208,7 @@
instructionLimit = 1;
_dbg_dostep = 0;
} else {
- return;
+ return false;
}
}
@@ -320,9 +337,9 @@
scriptFunction = _scriptFunctionsList[functionNumber].scriptFunction;
(this->*scriptFunction)(thread, argumentsCount);
- if (functionNumber == 16) { // SF_gotoScene
- instructionCount = instructionLimit; // break the loop
- break;
+ if (scriptFunction == sfScriptGotoScene) {
+ //if (functionNumber == 16) { // sfScriptGotoScene
+ return true; // cause abortAllThreads called and _this_ thread destroyed
}
if (operandChar == opCcall) {// CALL function
@@ -344,7 +361,7 @@
thread->_frameIndex = thread->pop();
if (thread->pushedSize() == 0) {
thread->_flags |= kTFlagFinished;
- break;
+ return true;
} else {
thread->_instructionOffset = thread->pop();
iparam1 = thread->pop();
@@ -583,7 +600,7 @@
if (_vm->_actor->isSpeaking()) {
thread->wait(kWaitTypeSpeech);
- return;
+ return false;
}
stringsCount = scriptS.readByte();
@@ -625,7 +642,7 @@
CASEOP(opDialogBegin)
if (_conversingThread) {
thread->wait(kWaitTypeDialogBegin);
- return;
+ return false;
}
_conversingThread = thread;
_vm->_interface->converseClear();
@@ -674,23 +691,22 @@
if (thread->_flags & (kTFlagFinished | kTFlagAborted)) {
- _vm->_console->DebugPrintf("Script finished\n");
- break;
- } else {
-
- // Set instruction offset only if a previous instruction didn't branch
- if (savedInstructionOffset == thread->_instructionOffset) {
- thread->_instructionOffset = scriptS.pos();
- } else {
- if (thread->_instructionOffset >= scriptS.size()) {
- error("Script::runThread() Out of range script execution");
- }
+ error("Wrong flags in thread");
+
+ }
- scriptS.seek(thread->_instructionOffset);
+ // Set instruction offset only if a previous instruction didn't branch
+ if (savedInstructionOffset == thread->_instructionOffset) {
+ thread->_instructionOffset = scriptS.pos();
+ } else {
+ if (thread->_instructionOffset >= scriptS.size()) {
+ error("Script::runThread() Out of range script execution");
}
- }
+ scriptS.seek(thread->_instructionOffset);
+ }
}
+ return false;
}
} // End of namespace Saga
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.404,2.405 script_v100he.cpp,2.101,2.102 script_v90he.cpp,2.197,2.198 sprite_he.cpp,1.109,1.110
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga sthread.cpp,1.74,1.75
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list