From a319f473f6502b4acd2b7da4aa5220a965335081 Mon Sep 17 00:00:00 2001 From: lukaslw Date: Tue, 24 Jun 2014 03:57:40 +0200 Subject: PRINCE: LMB outside of inventory - update --- engines/prince/prince.cpp | 24 +++++++++++++++++++++++- engines/prince/script.cpp | 4 ++++ engines/prince/script.h | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) (limited to 'engines/prince') diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 7fefae9f5f..04901d78fa 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -1685,8 +1685,11 @@ void PrinceEngine::drawInvItems() { } void PrinceEngine::leftMouseButton() { + int option = 0; + if (_optionsFlag) { if (_optionEnabled < _optionsNumber) { + option = _optionEnabled; _optionsFlag = 0; // edi = optionsMob // ebp = optionsMobNumber @@ -1701,12 +1704,31 @@ void PrinceEngine::leftMouseButton() { // @@walkto - TODO return; } + option = 0; } //do_option // selectedMob = optionsMobNumber if (_currentPointerNumber != 2) { //skip_use_code - + int optionScriptOffset = _script->getOptionScript(_room->_walkTo, option); + int optionEvent; + if (optionScriptOffset != 0) { + optionEvent = _script->scanMobEvents(_optionsMob, optionScriptOffset); + } else { + optionEvent = -1; + } + if (optionEvent == -1) { + if (option == 0) { + //@@walkto - TODO + return; + } else { + optionEvent = _script->getOptionScript(_script->_scriptInfo.stdExamine, option - 1); + } + } + // eax <- return (int)READ_UINT16(&_data[optionEvent]); + // store_new_pc: + // storeNewPC(); + return; } else if (_selectedMode != 0) { //give_item diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index a8efe71ca8..4122b3898e 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -205,6 +205,10 @@ uint8 *Script::getRoomOffset(int locationNr) { return &_data[_scriptInfo.rooms + locationNr * 64]; } +int Script::getOptionScript(int offset, int option) { + return (int)READ_UINT16(&_data[offset + option * 4]); +} + int Script::scanMobEvents(int mobMask, int dataEventOffset) { debug("mobMask: %d", mobMask); int i = 0; diff --git a/engines/prince/script.h b/engines/prince/script.h index 4a7316c9d5..5cdf9c64ba 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -135,6 +135,7 @@ public: int16 getLightY(int locationNr); int32 getShadowScale(int locationNr); uint8 *getRoomOffset(int locationNr); + int32 getOptionScript(int offset, int option); void installBackAnims(Common::Array &_backanimList, int offset); void installSingleBackAnim(Common::Array &_backanimList, int offset); bool loadAllMasks(Common::Array &maskList, int offset); -- cgit v1.2.3