diff options
author | Benjamin Haisch | 2008-05-06 11:45:23 +0000 |
---|---|---|
committer | Benjamin Haisch | 2008-05-06 11:45:23 +0000 |
commit | 9df82055f0dff7c242f889c5d776ad0cca2d5bc8 (patch) | |
tree | 5748f4f80aad87ae23478d8eea4beb7e7eef2013 /engines/made | |
parent | 397e04d0b1ff6d96502c4eca42c1ab4a31b2dbcd (diff) | |
download | scummvm-rg350-9df82055f0dff7c242f889c5d776ad0cca2d5bc8.tar.gz scummvm-rg350-9df82055f0dff7c242f889c5d776ad0cca2d5bc8.tar.bz2 scummvm-rg350-9df82055f0dff7c242f889c5d776ad0cca2d5bc8.zip |
- The Manhole: New and Enhanced is now (partially) playable
- Implemented cmd_objectp
- Changed how the script externals array is set up
- Cleanup
svn-id: r31895
Diffstat (limited to 'engines/made')
-rw-r--r-- | engines/made/database.cpp | 5 | ||||
-rw-r--r-- | engines/made/script.cpp | 60 | ||||
-rw-r--r-- | engines/made/scriptfuncs.h | 10 | ||||
-rw-r--r-- | engines/made/scriptfuncs_lgop2.cpp | 114 | ||||
-rw-r--r-- | engines/made/scriptfuncs_mhne.cpp | 124 | ||||
-rw-r--r-- | engines/made/scriptfuncs_rtz.cpp | 210 |
6 files changed, 262 insertions, 261 deletions
diff --git a/engines/made/database.cpp b/engines/made/database.cpp index a7970a2e27..ea48fdedbe 100644 --- a/engines/made/database.cpp +++ b/engines/made/database.cpp @@ -256,8 +256,9 @@ void GameDatabase::loadVersion2(Common::SeekableReadStream &sourceS) { debug(2, "textOffs = %08X; textSize = %08X; objectCount = %d; varObjectCount = %d; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d\n", textOffs, textSize, objectCount, varObjectCount, _gameStateSize, objectsOffs, objectsSize); - _gameState = new byte[_gameStateSize]; + _gameState = new byte[_gameStateSize + 2]; memset(_gameState, 0, _gameStateSize); + setVar(1, objectCount); sourceS.seek(textOffs); _gameText = new char[textSize]; @@ -271,8 +272,8 @@ void GameDatabase::loadVersion2(Common::SeekableReadStream &sourceS) { for (uint32 i = 0; i < objectCount; i++) { Object *obj = new Object(); int objSize = obj->loadVersion2(sourceS); - objSize = objSize % 2; // objects are aligned on 2-byte-boundaries, skip unused bytes + objSize = objSize % 2; sourceS.skip(objSize); _objects.push_back(obj); } diff --git a/engines/made/script.cpp b/engines/made/script.cpp index 74dc9e0d9f..86bd9f42e4 100644 --- a/engines/made/script.cpp +++ b/engines/made/script.cpp @@ -203,10 +203,10 @@ void ScriptInterpreter::runScript(int16 scriptObjectIndex) { while (!_terminated) { byte opcode = readByte(); if (opcode >= 1 && opcode <= _commandsMax) { - debug(4, "opcode = %s\n", _commands[opcode - 1].desc); + debug(4, "[%04X:%04X] opcode = %s", _runningScriptObjectIndex, _codeIp - _codeBase, _commands[opcode - 1].desc); (this->*_commands[opcode - 1].proc)(); } else { - warning("ScriptInterpreter::runScript(%d) Unknown opcode %02X\n", _runningScriptObjectIndex, opcode); + warning("ScriptInterpreter::runScript(%d) Unknown opcode %02X", _runningScriptObjectIndex, opcode); } } @@ -219,7 +219,7 @@ byte ScriptInterpreter::readByte() { int16 ScriptInterpreter::readInt16() { int16 temp = (int16)READ_LE_UINT16(_codeIp); _codeIp += 2; - debug(4, "readInt16() value = %04X\n", temp); + debug(4, "readInt16() value = %04X", temp); return temp; } @@ -330,14 +330,14 @@ void ScriptInterpreter::cmd_gt() { void ScriptInterpreter::cmd_loadConstant() { int16 value = readInt16(); - debug(4, "value = %04X (%d)\n", value, value); + debug(4, "value = %04X (%d)", value, value); _stack.setTop(value); } void ScriptInterpreter::cmd_loadVariable() { int16 variable = readInt16(); int16 value = _vm->_dat->getVar(variable); - debug(4, "variable = %d; value = %d (%04X)\n", variable, value, value); fflush(stdout); + debug(4, "variable = %d; value = %d (%04X)", variable, value, value); _stack.setTop(value); } @@ -345,7 +345,7 @@ void ScriptInterpreter::cmd_getObjectProperty() { int16 propertyId = _stack.pop(); int16 objectIndex = _stack.top(); int16 value = _vm->_dat->getObjectProperty(objectIndex, propertyId); - debug(4, "value = %04X(%d)\n", value, value); + debug(4, "value = %04X(%d)", value, value); _stack.setTop(value); } @@ -359,7 +359,7 @@ void ScriptInterpreter::cmd_setObjectProperty() { void ScriptInterpreter::cmd_set() { int16 variable = readInt16(); - debug(4, "var(%d) = %04d (%d)\n", variable, _stack.top(), _stack.top()); + debug(4, "var(%d) = %04d (%d)", variable, _stack.top(), _stack.top()); _vm->_dat->setVar(variable, _stack.top()); } @@ -367,7 +367,7 @@ void ScriptInterpreter::cmd_print() { // TODO: This opcode was used for printing debug messages Object *obj = _vm->_dat->getObject(_stack.top()); const char *text = obj->getString(); - debug(4, "%s", text); fflush(stdout); + debug(4, "%s", text); _stack.setTop(0); } @@ -386,20 +386,20 @@ void ScriptInterpreter::cmd_vref() { int16 value = 0; int16 index = _stack.pop(); int16 objectIndex = _stack.top(); - debug(4, "index = %d; objectIndex = %d\n", index, objectIndex); fflush(stdout); + debug(4, "index = %d; objectIndex = %d", index, objectIndex); if (objectIndex > 0) { Object *obj = _vm->_dat->getObject(objectIndex); value = obj->getVectorItem(index); } _stack.setTop(value); - debug(4, "--> value = %d\n", value); fflush(stdout); + debug(4, "--> value = %d", value); } void ScriptInterpreter::cmd_vset() { int16 value = _stack.pop(); int16 index = _stack.pop(); int16 objectIndex = _stack.top(); - debug(4, "index = %d; objectIndex = %d; value = %d\n", index, objectIndex, value); fflush(stdout); + debug(4, "index = %d; objectIndex = %d; value = %d", index, objectIndex, value); if (objectIndex > 0) { Object *obj = _vm->_dat->getObject(objectIndex); obj->setVectorItem(index, value); @@ -432,11 +432,11 @@ void ScriptInterpreter::cmd_return() { byte argc = _stack.pop(); _stack.free(argc); _stack.setTop(funcResult); - debug(4, "LEAVE: stackPtr = %d; _localStackPos = %d\n\n\n", _stack.getStackPos(), _localStackPos); + debug(4, "LEAVE: stackPtr = %d; _localStackPos = %d\n", _stack.getStackPos(), _localStackPos); } void ScriptInterpreter::cmd_call() { - debug(4, "\n\n\nENTER: stackPtr = %d; _localStackPos = %d\n", _stack.getStackPos(), _localStackPos); + debug(4, "\nENTER: stackPtr = %d; _localStackPos = %d", _stack.getStackPos(), _localStackPos); byte argc = readByte(); _stack.push(argc); _stack.push(_codeIp - _codeBase); @@ -444,7 +444,7 @@ void ScriptInterpreter::cmd_call() { _stack.push(kScriptStackLimit - _localStackPos); _localStackPos = _stack.getStackPos(); _runningScriptObjectIndex = _stack.peek(_localStackPos + argc + 4); - debug(4, "argc = %d; _runningScriptObjectIndex = %04X\n", argc, _runningScriptObjectIndex); fflush(stdout); + debug(4, "argc = %d; _runningScriptObjectIndex = %04X", argc, _runningScriptObjectIndex); _codeBase = _vm->_dat->getObject(_runningScriptObjectIndex)->getData(); _codeIp = _codeBase; } @@ -480,31 +480,31 @@ void ScriptInterpreter::cmd_restore() { void ScriptInterpreter::cmd_arg() { int16 argIndex = readByte(); - debug(4, "argIndex = %d; value = %04X (%d)\n", argIndex, _stack.peek(_localStackPos + 4 + argIndex), _stack.peek(_localStackPos + 4 + argIndex)); + debug(4, "argIndex = %d; value = %04X (%d)", argIndex, _stack.peek(_localStackPos + 4 + argIndex), _stack.peek(_localStackPos + 4 + argIndex)); _stack.setTop(_stack.peek(_localStackPos + 4 + argIndex)); } void ScriptInterpreter::cmd_aset() { int16 argIndex = readByte(); - debug(4, "argIndex = %d; value = %d\n", argIndex, _stack.peek(_localStackPos + 4 + argIndex)); + debug(4, "argIndex = %d; value = %d", argIndex, _stack.peek(_localStackPos + 4 + argIndex)); _stack.poke(_localStackPos + 4 + argIndex, _stack.top()); } void ScriptInterpreter::cmd_tmp() { int16 tempIndex = readByte(); - debug(4, "tempIndex = %d; value = %d\n", tempIndex, _stack.peek(_localStackPos - tempIndex - 1)); + debug(4, "tempIndex = %d; value = %d", tempIndex, _stack.peek(_localStackPos - tempIndex - 1)); _stack.setTop(_stack.peek(_localStackPos - tempIndex - 1)); } void ScriptInterpreter::cmd_tset() { int16 tempIndex = readByte(); - debug(4, "tempIndex = %d; value = %d\n", tempIndex, _stack.top()); + debug(4, "tempIndex = %d; value = %d", tempIndex, _stack.top()); _stack.poke(_localStackPos - tempIndex - 1, _stack.top()); } void ScriptInterpreter::cmd_tspace() { int16 tempCount = readByte(); - debug(4, "tempCount = %d\n", tempCount); + debug(4, "tempCount = %d", tempCount); _stack.alloc(tempCount); } @@ -513,7 +513,11 @@ void ScriptInterpreter::cmd_class() { } void ScriptInterpreter::cmd_objectp() { - warning("Unimplemented command: cmd_objectp"); + Object *obj = _vm->_dat->getObject(_stack.top()); + if (obj->isObject()) + _stack.setTop(-1); + else + _stack.setTop(0); } void ScriptInterpreter::cmd_vectorp() { @@ -535,11 +539,11 @@ void ScriptInterpreter::cmd_randomize() { void ScriptInterpreter::cmd_send() { - debug(4, "\n\n\nENTER: stackPtr = %d; _localStackPos = %d\n", _stack.getStackPos(), _localStackPos); + debug(4, "\nENTER: stackPtr = %d; _localStackPos = %d", _stack.getStackPos(), _localStackPos); byte argc = readByte(); - debug(4, "argc = %d\n", argc); + debug(4, "argc = %d", argc); _stack.push(argc); _stack.push(_codeIp - _codeBase); @@ -550,7 +554,7 @@ void ScriptInterpreter::cmd_send() { int16 propertyId = _stack.peek(_localStackPos + argc + 2); int16 objectIndex = _stack.peek(_localStackPos + argc + 4); - debug(4, "objectIndex = %d (%04X); propertyId = %d(%04X)\n", objectIndex, objectIndex, propertyId, propertyId); fflush(stdout); + debug(4, "objectIndex = %d (%04X); propertyId = %d(%04X)", objectIndex, objectIndex, propertyId, propertyId); if (objectIndex != 0) { objectIndex = _vm->_dat->getObject(objectIndex)->getClass(); @@ -558,7 +562,7 @@ void ScriptInterpreter::cmd_send() { objectIndex = _stack.peek(_localStackPos + argc + 3); } - debug(4, "--> objectIndex = %d(%04X)\n", objectIndex, objectIndex); fflush(stdout); + debug(4, "--> objectIndex = %d(%04X)", objectIndex, objectIndex); if (objectIndex != 0) { _runningScriptObjectIndex = _vm->_dat->getObjectProperty(objectIndex, propertyId); @@ -583,13 +587,13 @@ void ScriptInterpreter::cmd_extend() { byte argc = readByte(); int16 *argv = _stack.getStackPtr(); - //debug(4, "func = %d (%s); argc = %d\n", func, extendFuncNames[func], argc); - debug(4, "func = %d; argc = %d\n", func, argc); + //debug(4, "func = %d (%s); argc = %d", func, extendFuncNames[func], argc); + debug(4, "func = %d; argc = %d", func, argc); for (int i = 0; i < argc; i++) - debug(4, "argv[%02d] = %04X (%d)\n", i, argv[i], argv[i]); + debug(4, "argv[%02d] = %04X (%d)", i, argv[i], argv[i]); int16 result = _functions->callFunction(func, argc, argv); - debug(4, "result = %04X (%d)\n", result, result); + debug(4, "result = %04X (%d)", result, result); _stack.free(argc); diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h index 7e826a9f5e..77e4b12b2e 100644 --- a/engines/made/scriptfuncs.h +++ b/engines/made/scriptfuncs.h @@ -40,12 +40,16 @@ typedef Common::Functor2<int16, int16*, int16> ExternalFunc; class ScriptFunctions { public: ScriptFunctions(MadeEngine *vm) : _vm(vm) {} - virtual ~ScriptFunctions() {} + virtual ~ScriptFunctions() { + for (int i = 0; i < _externalFuncs.size(); ++i) + delete _externalFuncs[i]; + } int16 callFunction(uint16 index, int16 argc, int16 *argv) { if (index >= _externalFuncs.size()) { // TODO: ERROR! return 0; } + debug(4, "%s", _externalFuncNames[index]); return (*_externalFuncs[index])(argc, argv); } virtual void setupExternalsTable() = 0; @@ -55,13 +59,13 @@ protected: Audio::SoundHandle _voiceStreamHandle; Common::Array<const ExternalFunc*> _externalFuncs; + Common::Array<const char *> _externalFuncNames; }; class ScriptFunctionsLgop2 : public ScriptFunctions { public: ScriptFunctionsLgop2(MadeEngine *vm) : ScriptFunctions(vm) {} - ~ScriptFunctionsLgop2() {} void setupExternalsTable(); protected: @@ -122,7 +126,6 @@ protected: class ScriptFunctionsRtz : public ScriptFunctions { public: ScriptFunctionsRtz(MadeEngine *vm) : ScriptFunctions(vm) {} - ~ScriptFunctionsRtz() {} void setupExternalsTable(); protected: @@ -231,7 +234,6 @@ protected: class ScriptFunctionsMhne : public ScriptFunctions { public: ScriptFunctionsMhne(MadeEngine *vm) : ScriptFunctions(vm) {} - ~ScriptFunctionsMhne() {} void setupExternalsTable(); protected: diff --git a/engines/made/scriptfuncs_lgop2.cpp b/engines/made/scriptfuncs_lgop2.cpp index 579492a39e..2a78bd0e2c 100644 --- a/engines/made/scriptfuncs_lgop2.cpp +++ b/engines/made/scriptfuncs_lgop2.cpp @@ -43,66 +43,64 @@ namespace Made { /* ScriptFunctionsLgop2 */ typedef Common::Functor2Mem<int16, int16*, int16, ScriptFunctionsLgop2> ExternalFuncLgop2; -#define External(x) ExternalFuncLgop2(this, &ScriptFunctionsLgop2::x) +#define External(x) \ + _externalFuncs.push_back(new ExternalFuncLgop2(this, &ScriptFunctionsLgop2::x)); \ + _externalFuncNames.push_back(#x); void ScriptFunctionsLgop2::setupExternalsTable() { - static const ExternalFuncLgop2 externalsTable[] = { - External(o1_SYSTEM), - External(o1_INITGRAF), - External(o1_RESTOREGRAF), - External(o1_DRAWPIC), - External(o1_CLS), - External(o1_SHOWPAGE), - External(o1_EVENT), - External(o1_EVENTX), - External(o1_EVENTY), - External(o1_EVENTKEY), - External(o1_VISUALFX), - External(o1_PLAYSND), - External(o1_PLAYMUS), - External(o1_STOPMUS), - External(o1_ISMUS), - External(o1_TEXTPOS), - External(o1_FLASH), - External(o1_PLAYNOTE), - External(o1_STOPNOTE), - External(o1_PLAYTELE), - External(o1_STOPTELE), - External(o1_HIDECURS), - External(o1_SHOWCURS), - External(o1_MUSICBEAT), - External(o1_SCREENLOCK), - External(o1_ADDSPRITE), - External(o1_FREEANIM), - External(o1_DRAWSPRITE), - External(o1_ERASESPRITES), - External(o1_UPDATESPRITES), - External(o1_GETTIMER), - External(o1_SETTIMER), - External(o1_RESETTIMER), - External(o1_ALLOCTIMER), - External(o1_FREETIMER), - External(o1_PALETTELOCK), - External(o1_FONT), - External(o1_DRAWTEXT), - External(o1_HOMETEXT), - External(o1_TEXTRECT), - External(o1_TEXTXY), - External(o1_DROPSHADOW), - External(o1_TEXTCOLOR), - External(o1_OUTLINE), - External(o1_LOADCURSOR), - External(o1_SETGROUND), - External(o1_RESTEXT), - External(o1_ADDMASK), - External(o1_SETMASK), - External(o1_ISSND), - External(o1_STOPSND), - External(o1_PLAYVOICE) - }; - - for (int i = 0; i < ARRAYSIZE(externalsTable); ++i) - _externalFuncs.push_back(&externalsTable[i]); + External(o1_SYSTEM); + External(o1_INITGRAF); + External(o1_RESTOREGRAF); + External(o1_DRAWPIC); + External(o1_CLS); + External(o1_SHOWPAGE); + External(o1_EVENT); + External(o1_EVENTX); + External(o1_EVENTY); + External(o1_EVENTKEY); + External(o1_VISUALFX); + External(o1_PLAYSND); + External(o1_PLAYMUS); + External(o1_STOPMUS); + External(o1_ISMUS); + External(o1_TEXTPOS); + External(o1_FLASH); + External(o1_PLAYNOTE); + External(o1_STOPNOTE); + External(o1_PLAYTELE); + External(o1_STOPTELE); + External(o1_HIDECURS); + External(o1_SHOWCURS); + External(o1_MUSICBEAT); + External(o1_SCREENLOCK); + External(o1_ADDSPRITE); + External(o1_FREEANIM); + External(o1_DRAWSPRITE); + External(o1_ERASESPRITES); + External(o1_UPDATESPRITES); + External(o1_GETTIMER); + External(o1_SETTIMER); + External(o1_RESETTIMER); + External(o1_ALLOCTIMER); + External(o1_FREETIMER); + External(o1_PALETTELOCK); + External(o1_FONT); + External(o1_DRAWTEXT); + External(o1_HOMETEXT); + External(o1_TEXTRECT); + External(o1_TEXTXY); + External(o1_DROPSHADOW); + External(o1_TEXTCOLOR); + External(o1_OUTLINE); + External(o1_LOADCURSOR); + External(o1_SETGROUND); + External(o1_RESTEXT); + External(o1_ADDMASK); + External(o1_SETMASK); + External(o1_ISSND); + External(o1_STOPSND); + External(o1_PLAYVOICE); + } #undef External diff --git a/engines/made/scriptfuncs_mhne.cpp b/engines/made/scriptfuncs_mhne.cpp index 65e9c6e070..4c942edec2 100644 --- a/engines/made/scriptfuncs_mhne.cpp +++ b/engines/made/scriptfuncs_mhne.cpp @@ -43,70 +43,68 @@ namespace Made { /* ScriptFunctionsMhne */ typedef Common::Functor2Mem<int16, int16*, int16, ScriptFunctionsMhne> ExternalFuncMhne; -#define External(x) ExternalFuncMhne(this, &ScriptFunctionsMhne::x) +#define External(x) \ + _externalFuncs.push_back(new ExternalFuncMhne(this, &ScriptFunctionsMhne::x)); \ + _externalFuncNames.push_back(#x); void ScriptFunctionsMhne::setupExternalsTable() { - static const ExternalFuncMhne externalsTable[] = { - External(o1_SYSTEM), - External(o1_INITGRAF), - External(o1_RESTOREGRAF), - External(o1_DRAWPIC), - External(o1_CLS), - External(o1_SHOWPAGE), - External(o1_EVENT), - External(o1_EVENTX), - External(o1_EVENTY), - External(o1_EVENTKEY), - External(o1_VISUALFX), - External(o1_PLAYSND), - External(o1_PLAYMUS), - External(o1_STOPMUS), - External(o1_ISMUS), - External(o1_TEXTPOS), - External(o1_FLASH), - External(o1_PLAYNOTE), - External(o1_STOPNOTE), - External(o1_PLAYTELE), - External(o1_STOPTELE), - External(o1_HIDECURS), - External(o1_SHOWCURS), - External(o1_MUSICBEAT), - External(o1_SCREENLOCK), - External(o1_ADDSPRITE), - External(o1_FREEANIM), - External(o1_DRAWSPRITE), - External(o1_ERASESPRITES), - External(o1_UPDATESPRITES), - External(o1_GETTIMER), - External(o1_SETTIMER), - External(o1_RESETTIMER), - External(o1_ALLOCTIMER), - External(o1_FREETIMER), - External(o1_PALETTELOCK), - External(o1_FONT), - External(o1_DRAWTEXT), - External(o1_HOMETEXT), - External(o1_TEXTRECT), - External(o1_TEXTXY), - External(o1_DROPSHADOW), - External(o1_TEXTCOLOR), - External(o1_OUTLINE), - External(o1_LOADCURSOR), - External(o1_SETGROUND), - External(o1_RESTEXT), - External(o1_ADDMASK), - External(o1_SETMASK), - External(o1_ISSND), - External(o1_STOPSND), - External(o1_PLAYVOICE), - External(o1_CDPLAY), - External(o1_STOPCD), - External(o1_CDSTATUS), - External(o1_CDTIME), - External(o1_CDPLAYSEG), - }; - - for (int i = 0; i < ARRAYSIZE(externalsTable); ++i) - _externalFuncs.push_back(&externalsTable[i]); + + External(o1_SYSTEM); + External(o1_INITGRAF); + External(o1_RESTOREGRAF); + External(o1_DRAWPIC); + External(o1_CLS); + External(o1_SHOWPAGE); + External(o1_EVENT); + External(o1_EVENTX); + External(o1_EVENTY); + External(o1_EVENTKEY); + External(o1_VISUALFX); + External(o1_PLAYSND); + External(o1_PLAYMUS); + External(o1_STOPMUS); + External(o1_ISMUS); + External(o1_TEXTPOS); + External(o1_FLASH); + External(o1_PLAYNOTE); + External(o1_STOPNOTE); + External(o1_PLAYTELE); + External(o1_STOPTELE); + External(o1_HIDECURS); + External(o1_SHOWCURS); + External(o1_MUSICBEAT); + External(o1_SCREENLOCK); + External(o1_ADDSPRITE); + External(o1_FREEANIM); + External(o1_DRAWSPRITE); + External(o1_ERASESPRITES); + External(o1_UPDATESPRITES); + External(o1_GETTIMER); + External(o1_SETTIMER); + External(o1_RESETTIMER); + External(o1_ALLOCTIMER); + External(o1_FREETIMER); + External(o1_PALETTELOCK); + External(o1_FONT); + External(o1_DRAWTEXT); + External(o1_HOMETEXT); + External(o1_TEXTRECT); + External(o1_TEXTXY); + External(o1_DROPSHADOW); + External(o1_TEXTCOLOR); + External(o1_OUTLINE); + External(o1_LOADCURSOR); + External(o1_SETGROUND); + External(o1_RESTEXT); + External(o1_ADDMASK); + External(o1_SETMASK); + External(o1_ISSND); + External(o1_STOPSND); + External(o1_PLAYVOICE); + External(o1_CDPLAY); + External(o1_STOPCD); + External(o1_CDSTATUS); + External(o1_CDTIME); + External(o1_CDPLAYSEG); } #undef External diff --git a/engines/made/scriptfuncs_rtz.cpp b/engines/made/scriptfuncs_rtz.cpp index 1186a88de8..20f6df8918 100644 --- a/engines/made/scriptfuncs_rtz.cpp +++ b/engines/made/scriptfuncs_rtz.cpp @@ -43,113 +43,111 @@ namespace Made { /* ScriptFunctionsRtz */ typedef Common::Functor2Mem<int16, int16*, int16, ScriptFunctionsRtz> ExternalFuncRtz; -#define External(x) ExternalFuncRtz(this, &ScriptFunctionsRtz::x) +#define External(x) \ + _externalFuncs.push_back(new ExternalFuncRtz(this, &ScriptFunctionsRtz::x)); \ + _externalFuncNames.push_back(#x); void ScriptFunctionsRtz::setupExternalsTable() { - static const ExternalFuncRtz externalsTable[] = { - External(o1_SYSTEM), - External(o1_INITGRAF), - External(o1_RESTOREGRAF), - External(o1_DRAWPIC), - External(o1_CLS), - External(o1_SHOWPAGE), - External(o1_EVENT), - External(o1_EVENTX), - External(o1_EVENTY), - External(o1_EVENTKEY), - External(o1_VISUALFX), - External(o1_PLAYSND), - External(o1_PLAYMUS), - External(o1_STOPMUS), - External(o1_ISMUS), - External(o1_TEXTPOS), - External(o1_FLASH), - External(o1_PLAYNOTE), - External(o1_STOPNOTE), - External(o1_PLAYTELE), - External(o1_STOPTELE), - External(o1_HIDECURS), - External(o1_SHOWCURS), - External(o1_MUSICBEAT), - External(o1_SCREENLOCK), - External(o1_ADDSPRITE), - External(o1_FREEANIM), - External(o1_DRAWSPRITE), - External(o1_ERASESPRITES), - External(o1_UPDATESPRITES), - External(o1_GETTIMER), - External(o1_SETTIMER), - External(o1_RESETTIMER), - External(o1_ALLOCTIMER), - External(o1_FREETIMER), - External(o1_PALETTELOCK), - External(o1_FONT), - External(o1_DRAWTEXT), - External(o1_HOMETEXT), - External(o1_TEXTRECT), - External(o1_TEXTXY), - External(o1_DROPSHADOW), - External(o1_TEXTCOLOR), - External(o1_OUTLINE), - External(o1_LOADCURSOR), - External(o1_SETGROUND), - External(o1_RESTEXT), - External(o1_CLIPAREA), - External(o1_SETCLIP), - External(o1_ISSND), - External(o1_STOPSND), - External(o1_PLAYVOICE), - External(o1_CDPLAY), - External(o1_STOPCD), - External(o1_CDSTATUS), - External(o1_CDTIME), - External(o1_CDPLAYSEG), - External(o1_PRINTF), - External(o1_MONOCLS), - External(o1_SNDENERGY), - External(o1_CLEARTEXT), - External(o1_ANIMTEXT), - External(o1_TEXTWIDTH), - External(o1_PLAYMOVIE), - External(o1_LOADSND), - External(o1_LOADMUS), - External(o1_LOADPIC), - External(o1_MUSICVOL), - External(o1_RESTARTEVENTS), - External(o1_PLACESPRITE), - External(o1_PLACETEXT), - External(o1_DELETECHANNEL), - External(o1_CHANNELTYPE), - External(o1_SETSTATE), - External(o1_SETLOCATION), - External(o1_SETCONTENT), - External(o1_EXCLUDEAREA), - External(o1_SETEXCLUDE), - External(o1_GETSTATE), - External(o1_PLACEANIM), - External(o1_SETFRAME), - External(o1_GETFRAME), - External(o1_GETFRAMECOUNT), - External(o1_PICWIDTH), - External(o1_PICHEIGHT), - External(o1_SOUNDRATE), - External(o1_DRAWANIMPIC), - External(o1_LOADANIM), - External(o1_READTEXT), - External(o1_READMENU), - External(o1_DRAWMENU), - External(o1_MENUCOUNT), - External(o1_SAVEGAME), - External(o1_LOADGAME), - External(o1_GAMENAME), - External(o1_SHAKESCREEN), - External(o1_PLACEMENU), - External(o1_SETVOLUME), - External(o1_WHATSYNTH), - External(o1_SLOWSYSTEM) - }; - - for (int i = 0; i < ARRAYSIZE(externalsTable); ++i) - _externalFuncs.push_back(&externalsTable[i]); + + External(o1_SYSTEM); + External(o1_INITGRAF); + External(o1_RESTOREGRAF); + External(o1_DRAWPIC); + External(o1_CLS); + External(o1_SHOWPAGE); + External(o1_EVENT); + External(o1_EVENTX); + External(o1_EVENTY); + External(o1_EVENTKEY); + External(o1_VISUALFX); + External(o1_PLAYSND); + External(o1_PLAYMUS); + External(o1_STOPMUS); + External(o1_ISMUS); + External(o1_TEXTPOS); + External(o1_FLASH); + External(o1_PLAYNOTE); + External(o1_STOPNOTE); + External(o1_PLAYTELE); + External(o1_STOPTELE); + External(o1_HIDECURS); + External(o1_SHOWCURS); + External(o1_MUSICBEAT); + External(o1_SCREENLOCK); + External(o1_ADDSPRITE); + External(o1_FREEANIM); + External(o1_DRAWSPRITE); + External(o1_ERASESPRITES); + External(o1_UPDATESPRITES); + External(o1_GETTIMER); + External(o1_SETTIMER); + External(o1_RESETTIMER); + External(o1_ALLOCTIMER); + External(o1_FREETIMER); + External(o1_PALETTELOCK); + External(o1_FONT); + External(o1_DRAWTEXT); + External(o1_HOMETEXT); + External(o1_TEXTRECT); + External(o1_TEXTXY); + External(o1_DROPSHADOW); + External(o1_TEXTCOLOR); + External(o1_OUTLINE); + External(o1_LOADCURSOR); + External(o1_SETGROUND); + External(o1_RESTEXT); + External(o1_CLIPAREA); + External(o1_SETCLIP); + External(o1_ISSND); + External(o1_STOPSND); + External(o1_PLAYVOICE); + External(o1_CDPLAY); + External(o1_STOPCD); + External(o1_CDSTATUS); + External(o1_CDTIME); + External(o1_CDPLAYSEG); + External(o1_PRINTF); + External(o1_MONOCLS); + External(o1_SNDENERGY); + External(o1_CLEARTEXT); + External(o1_ANIMTEXT); + External(o1_TEXTWIDTH); + External(o1_PLAYMOVIE); + External(o1_LOADSND); + External(o1_LOADMUS); + External(o1_LOADPIC); + External(o1_MUSICVOL); + External(o1_RESTARTEVENTS); + External(o1_PLACESPRITE); + External(o1_PLACETEXT); + External(o1_DELETECHANNEL); + External(o1_CHANNELTYPE); + External(o1_SETSTATE); + External(o1_SETLOCATION); + External(o1_SETCONTENT); + External(o1_EXCLUDEAREA); + External(o1_SETEXCLUDE); + External(o1_GETSTATE); + External(o1_PLACEANIM); + External(o1_SETFRAME); + External(o1_GETFRAME); + External(o1_GETFRAMECOUNT); + External(o1_PICWIDTH); + External(o1_PICHEIGHT); + External(o1_SOUNDRATE); + External(o1_DRAWANIMPIC); + External(o1_LOADANIM); + External(o1_READTEXT); + External(o1_READMENU); + External(o1_DRAWMENU); + External(o1_MENUCOUNT); + External(o1_SAVEGAME); + External(o1_LOADGAME); + External(o1_GAMENAME); + External(o1_SHAKESCREEN); + External(o1_PLACEMENU); + External(o1_SETVOLUME); + External(o1_WHATSYNTH); + External(o1_SLOWSYSTEM); } #undef External |