diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/prince/prince.cpp | 8 | ||||
-rw-r--r-- | engines/prince/script.cpp | 58 | ||||
-rw-r--r-- | engines/prince/script.h | 5 |
3 files changed, 15 insertions, 56 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index f7cc1c7065..bda91af137 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -32,7 +32,6 @@ #include "common/keyboard.h" #include "common/substream.h" #include "common/str.h" -#include "common/str-array.h" #include "graphics/cursorman.h" #include "graphics/surface.h" @@ -1674,7 +1673,7 @@ void PrinceEngine::leftMouseButton() { //_script->_scriptInfo.stdUse; } else { debug("selectedMob: %d", _selectedMob); - _script->scanMobItemEvents(_mobList[_selectedMob]._mask, _room->_itemUse); + _script->scanMobEvents(_mobList[_selectedMob]._mask, _room->_itemUse); } } @@ -1715,7 +1714,6 @@ void PrinceEngine::inventoryLeftMouseButton() { } else { if (_selectedMob != 0) { if (_currentPointerNumber != 2) { - //if (_selectedMob != 29) { if (_invMobList[_selectedMob - 1]._mask != 29) { _optionEnabled = 0; } else { @@ -1733,7 +1731,7 @@ void PrinceEngine::inventoryLeftMouseButton() { } //do_option if (_optionEnabled == 0) { - int invObjExamEvent = _script->scanInvObjExamEvents(_selectedMob); // test this + int invObjExamEvent = _script->scanMobEvents(_selectedMob, _script->_scriptInfo.invObjExam); if (invObjExamEvent == -1) { // do_standard printAt(0, 216, _invMobList[_selectedMob - 1]._examText.c_str(), kNormalWidth / 2, _invExamY); @@ -1753,7 +1751,7 @@ void PrinceEngine::inventoryLeftMouseButton() { } } else if (_optionEnabled == 1) { // not_examine - int invObjUse = _script->scanInvObjUseEvents(_selectedMob); // test this + int invObjUse = _script->scanMobEvents(_selectedMob, _script->_scriptInfo.invObjUse); if (invObjUse == -1) { // do_standard_use _selectedMode = 0; diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 02234adcfa..5c81ee682c 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -205,58 +205,22 @@ uint8 *Script::getRoomOffset(int locationNr) { return &_data[_scriptInfo.rooms + locationNr * 64]; } -struct RE { - int16 _mob; // number of Mob, -1 for end of list - int32 _code; // offset of code in script -}; - -int Script::scanInvObjExamEvents(int mobMask) { - RE tempRE; - int i = 0; - do { - tempRE._mob = (int)READ_UINT16(&_data[_scriptInfo.invObjExam + i * 6]); - debug("mob: %d", tempRE._mob); - tempRE._code = (int)READ_UINT32(&_data[_scriptInfo.invObjExam + i * 6 + 2]); - debug("code: %d", tempRE._code); - if (tempRE._mob == mobMask) { - return tempRE._code; - } - i++; - } while (tempRE._mob != -1); //?? || i <= 1 or without this (no items there) - return -1; // or sth else? -} - -int Script::scanInvObjUseEvents(int mobMask) { - RE tempRE; - int i = 0; - do { - tempRE._mob = (int)READ_UINT16(&_data[_scriptInfo.invObjUse + i * 6]); - debug("mob: %d", tempRE._mob); - tempRE._code = (int)READ_UINT32(&_data[_scriptInfo.invObjUse + i * 6 + 2]); - debug("code: %d", tempRE._code); - if (tempRE._mob == mobMask) { - return tempRE._code; - } - i++; - } while (tempRE._mob != -1); //?? || i <= 1 or without this (no items there) - return -1; // or sth else? -} - -int Script::scanMobItemEvents(int mobMask, int roomEventOffset) { +int Script::scanMobEvents(int mobMask, int dataEventOffset) { debug("mobMask: %d", mobMask); - RE tempRE; int i = 0; + int16 mob; + int32 code; do { - tempRE._mob = (int)READ_UINT16(&_data[roomEventOffset + i * 6]); - debug("mob: %d", tempRE._mob); - tempRE._code = (int)READ_UINT32(&_data[roomEventOffset + i * 6 + 2]); - debug("code: %d", tempRE._code); - if (tempRE._mob == mobMask) { - return tempRE._code; + mob = (int)READ_UINT16(&_data[dataEventOffset + i * 6]); + debug("mob: %d", mob); + code = (int)READ_UINT32(&_data[dataEventOffset + i * 6 + 2]); + debug("code: %d", code); + if (mob == mobMask) { + return code; } i++; - } while (tempRE._mob != -1); //?? || i <= 1 or without this (no items there) - return -1; // or sth else? + } while (mob != -1); + return -1; } void Script::installSingleBackAnim(Common::Array<BackgroundAnim> &_backanimList, int offset) { diff --git a/engines/prince/script.h b/engines/prince/script.h index e7e444de13..489647ad91 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -131,7 +131,6 @@ public: } uint32 getStartGameOffset(); - uint32 getStdUseItem(); int16 getLightX(int locationNr); int16 getLightY(int locationNr); int32 getShadowScale(int locationNr); @@ -140,9 +139,7 @@ public: void installSingleBackAnim(Common::Array<BackgroundAnim> &_backanimList, int offset); bool loadAllMasks(Common::Array<Mask> &maskList, int offset); - int scanInvObjExamEvents(int mobMask); - int scanInvObjUseEvents(int mobMask); - int scanMobItemEvents(int mobMask, int roomEventOffset); + int scanMobEvents(int mobMask, int dataEventOffset); const char *getString(uint32 offset) { return (const char *)(&_data[offset]); |