From 3e99ea96a332037a99a3b44a5cbc028124456d1e Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 26 Sep 2005 07:22:32 +0000 Subject: Implemented some trivial IHNM opcodes. I'm not sure if the _ethicsPoints[] array is large enough though. These opcodes modify what I assume to be the game state, so that information needs to be stored in the savegames. Not for ITE, though, so savegame compatibility is not broken by this. (Not deliberately, at least.) svn-id: r18885 --- saga/sfuncs.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'saga/sfuncs.cpp') diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index d969fa5005..b64be9bdc6 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -1921,23 +1921,43 @@ void Script::sfVsetTrack(SCRIPTFUNC_PARAMS) { } void Script::sfGetPoints(SCRIPTFUNC_PARAMS) { - SF_stub("sfGetPoints", thread, nArgs); + int16 index = thread->pop(); + + if (index >= 0 && index < ARRAYSIZE(_vm->_ethicsPoints)) + thread->_returnValue = _vm->_ethicsPoints[index]; + else + thread->_returnValue = 0; } void Script::sfSetGlobalFlag(SCRIPTFUNC_PARAMS) { - SF_stub("sfSetGlobalFlag", thread, nArgs); + int16 flag = thread->pop(); + + if (flag >= 0 && flag < 32) + _vm->_globalFlags |= (1 << flag); } void Script::sfClearGlobalFlag(SCRIPTFUNC_PARAMS) { - SF_stub("sfClearGlobalFlag", thread, nArgs); + int16 flag = thread->pop(); + + if (flag >= 0 && flag < 32) + _vm->_globalFlags &= ~(1 << flag); } void Script::sfTestGlobalFlag(SCRIPTFUNC_PARAMS) { - SF_stub("sfTestGlobalFlag", thread, nArgs); + int16 flag = thread->pop(); + + if (flag >= 0 && flag < 32 && _vm->_globalFlags & (1 << flag)) + thread->_returnValue = 1; + else + thread->_returnValue = 0; } void Script::sfSetPoints(SCRIPTFUNC_PARAMS) { - SF_stub("sfSetPoints", thread, nArgs); + int16 index = thread->pop(); + int16 points = thread->pop(); + + if (index >= 0 && index < ARRAYSIZE(_vm->_ethicsPoints)) + _vm->_ethicsPoints[index] = points; } void Script::sfSetSpeechBox(SCRIPTFUNC_PARAMS) { -- cgit v1.2.3