From b820a36d3a94e9510e313144378b789efe954fe4 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Fri, 24 Jun 2016 02:08:26 +0200 Subject: DM: Add F0378_COMMAND_ProcessType81_ClickInPanel --- engines/dm/eventman.cpp | 38 ++++++++++++++++++++++++++------------ engines/dm/eventman.h | 1 + engines/dm/inventory.cpp | 2 +- 3 files changed, 28 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index ca094210ec..689d9fd551 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -420,20 +420,11 @@ void EventManager::processCommandQueue() { } if (cmd._type == kCommandClickInDungeonView) { - /*warning("DUMMY CODE, all of this"); - DungeonMan &dunMan = *_vm->_dungeonMan; - CurrMapData &currMap = dunMan._currMap; - uint16 mapX = currMap._partyPosX; - uint16 mapY = currMap._partyPosY; - mapX += gDirIntoStepCountEast[currMap._partyDir]; - mapY += gDirIntoStepCountNorth[currMap._partyDir]; - Thing squareFirstThing = dunMan.getSquareFirstThing(mapX, mapY); - Sensor sensor(dunMan.getThingData(squareFirstThing)); - if (sensor.getType() == kSensorWallChampionPortrait) { - _vm->_championMan->addCandidateChampionToParty(sensor.getData()); - }*/ commandProcessType80ClickInDungeonView(commandX, commandY); } + if (cmd._type == kCommandClickInPanel) { + commandProcess81ClickInPanel(commandX, commandY); + } // MISSING CODE: the rest of the function } @@ -696,4 +687,27 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane warning("MISSING CODE: F0067_MOUSE_SetPointerToNormal"); } +void EventManager::commandProcess81ClickInPanel(int16 x, int16 y) { + ChampionMan &champMan = *_vm->_championMan; + InventoryMan &invMan = *_vm->_inventoryMan; + + CommandType commandType; + switch (invMan._panelContent) { + case kPanelContentChest: + if (champMan._leaderIndex == kChampionNone) // if no leader + return; + commandType = getCommandTypeFromMouseInput(gMouseInput_PanelChest, Common::Point(x, y), kLeftMouseButton); + if (commandType != kCommandNone) + warning("MISSING CODE: F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox"); + break; + case kPanelContentResurrectReincarnate: + if (!champMan._leaderEmptyHanded) + break; + commandType = getCommandTypeFromMouseInput(gMouseInput_PanelChest, Common::Point(x, y), kLeftMouseButton); + if (commandType != kCommandNone) + commandProcessCommands160To162ClickInResurrectReincarnatePanel(commandType); + break; + } +} + }; // end of namespace DM diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h index fa4728741d..ca9587716c 100644 --- a/engines/dm/eventman.h +++ b/engines/dm/eventman.h @@ -250,6 +250,7 @@ public: void commandProcessType80ClickInDungeonViewTouchFrontWall(); // @ F0372_COMMAND_ProcessType80_ClickInDungeonView_TouchFrontWall void commandProcessType80ClickInDungeonView(int16 posX, int16 posY); // @ F0377_COMMAND_ProcessType80_ClickInDungeonView void commandProcessCommands160To162ClickInResurrectReincarnatePanel(CommandType commandType); // @ F0282_CHAMPION_ProcessCommands160To162_ClickInResurrectReincarnatePanel + void commandProcess81ClickInPanel(int16 x, int16 y); // @ F0378_COMMAND_ProcessType81_ClickInPanel }; } diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 2fd4f4157c..550c4c85c6 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -53,7 +53,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) { EventManager &em = *_vm->_eventMan; DisplayMan &dm = *_vm->_displayMan; - if ((championIndex == kChampionCloseInventory) && !cm._champions[championIndex]._currHealth) + if ((championIndex != kChampionCloseInventory) && !cm._champions[championIndex]._currHealth) return; if (_vm->_pressingEye || _vm->_pressingMouth) return; -- cgit v1.2.3