diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/script.cpp | 39 | ||||
-rw-r--r-- | engines/draci/script.h | 3 |
2 files changed, 39 insertions, 3 deletions
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index ad601f093d..a7bb8bda09 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -67,9 +67,9 @@ void Script::setupCommandList() { { 13, 1, "FadePalette", 3, { 1, 1, 1 }, NULL }, { 13, 2, "FadePalettePlay", 3, { 1, 1, 1 }, NULL }, { 14, 1, "NewRoom", 2, { 3, 1 }, NULL }, - { 15, 1, "ExecInit", 1, { 3 }, NULL }, - { 15, 2, "ExecLook", 1, { 3 }, NULL }, - { 15, 3, "ExecUse", 1, { 3 }, NULL }, + { 15, 1, "ExecInit", 1, { 3 }, &Script::execInit }, + { 15, 2, "ExecLook", 1, { 3 }, &Script::execLook }, + { 15, 3, "ExecUse", 1, { 3 }, &Script::execUse }, { 16, 1, "RepaintInventory", 0, { 0 }, NULL }, { 16, 2, "ExitInventory", 0, { 0 }, NULL }, { 17, 1, "ExitMap", 0, { 0 }, NULL }, @@ -369,6 +369,39 @@ void Script::objStat(Common::Queue<int> ¶ms) { } } +void Script::execInit(Common::Queue<int> ¶ms) { + if (_vm->_game->getLoopStatus() == kStatusInventory) { + return; + } + + int objID = params.pop() - 1; + + GameObject *obj = _vm->_game->getObject(objID); + run(obj->_program, obj->_init); +} + +void Script::execLook(Common::Queue<int> ¶ms) { + if (_vm->_game->getLoopStatus() == kStatusInventory) { + return; + } + + int objID = params.pop() - 1; + + GameObject *obj = _vm->_game->getObject(objID); + run(obj->_program, obj->_look); +} + +void Script::execUse(Common::Queue<int> ¶ms) { + if (_vm->_game->getLoopStatus() == kStatusInventory) { + return; + } + + int objID = params.pop() - 1; + + GameObject *obj = _vm->_game->getObject(objID); + run(obj->_program, obj->_use); +} + /** * @brief Evaluates mathematical expressions * @param reader Stream reader set to the beginning of the expression diff --git a/engines/draci/script.h b/engines/draci/script.h index 4e1943ed8f..11a1c6f3a8 100644 --- a/engines/draci/script.h +++ b/engines/draci/script.h @@ -108,6 +108,9 @@ private: void release(Common::Queue<int> ¶ms); void objStat(Common::Queue<int> ¶ms); void objStatOn(Common::Queue<int> ¶ms); + void execInit(Common::Queue<int> ¶ms); + void execLook(Common::Queue<int> ¶ms); + void execUse(Common::Queue<int> ¶ms); int operAnd(int op1, int op2); int operOr(int op1, int op2); |