diff options
Diffstat (limited to 'saga')
-rw-r--r-- | saga/script.h | 6 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 4 | ||||
-rw-r--r-- | saga/sthread.cpp | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/saga/script.h b/saga/script.h index 65dd100ecf..50dc69f739 100644 --- a/saga/script.h +++ b/saga/script.h @@ -278,7 +278,11 @@ private: private: typedef int (Script::*ScriptFunctionType)(SCRIPTFUNC_PARAMS); - const ScriptFunctionType *_scriptFunctionsList; + struct ScriptFunctionDescription { + ScriptFunctionType scriptFunction; + const char *scriptFunctionName; + }; + const ScriptFunctionDescription *_scriptFunctionsList; void setupScriptFuncList(void); int SDebugPrintInstr(SCRIPT_THREAD *thread); diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 5d87049945..c636a6ce0f 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -41,10 +41,10 @@ namespace Saga { -#define OPCODE(x) &Script::x +#define OPCODE(x) {&Script::x, #x} void Script::setupScriptFuncList(void) { - static const ScriptFunctionType scriptFunctionsList[SCRIPT_FUNCTION_MAX] = { + static const ScriptFunctionDescription scriptFunctionsList[SCRIPT_FUNCTION_MAX] = { OPCODE(SF_putString), OPCODE(sfWait), OPCODE(SF_takeObject), diff --git a/saga/sthread.cpp b/saga/sthread.cpp index 34d4af07ae..dfaffed4ab 100644 --- a/saga/sthread.cpp +++ b/saga/sthread.cpp @@ -391,14 +391,14 @@ int Script::SThreadRun(SCRIPT_THREAD *thread, int instr_limit) { argumentsCount = scriptS.readByte(); functionNumber = scriptS.readUint16LE(); - debug(9, "opCCall* 0x%X", functionNumber); if (functionNumber >= SCRIPT_FUNCTION_MAX) { _vm->_console->DebugPrintf(S_ERROR_PREFIX "Invalid script function number: (%X)\n", functionNumber); thread->flags |= kTFlagAborted; break; } - scriptFunction = _scriptFunctionsList[functionNumber]; + debug(9, "opCCall* Calling 0x%X %s", functionNumber, _scriptFunctionsList[functionNumber].scriptFunctionName); + scriptFunction = _scriptFunctionsList[functionNumber].scriptFunction; scriptFunctionReturnValue = (this->*scriptFunction)(thread, argumentsCount); if (scriptFunctionReturnValue != SUCCESS) { _vm->_console->DebugPrintf(S_WARN_PREFIX "%X: Script function %d failed.\n", thread->i_offset, scriptFunctionReturnValue); |