From 9c544a44f22cdf15662f90d0cdffe5770a77ce4c Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Sat, 25 Jun 2016 13:31:47 +0200 Subject: DM: Add renameChampion stub, fix wrong inputArray EventManager::commandProcess81ClickInPanel --- engines/dm/champion.cpp | 31 ++++++++++++++++++++++++++++--- engines/dm/champion.h | 1 + engines/dm/dm.cpp | 4 ++-- engines/dm/eventman.cpp | 10 ++++++++-- engines/dm/eventman.h | 2 ++ engines/dm/gfx.h | 3 ++- engines/dm/inventory.cpp | 2 +- engines/dm/inventory.h | 2 ++ 8 files changed, 46 insertions(+), 9 deletions(-) (limited to 'engines/dm') diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index ef4257fff9..8b4149b464 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -38,12 +38,12 @@ namespace DM { Box gBoxMouth = Box(55, 72, 12, 29); // @ G0048_s_Graphic562_Box_Mouth Box gBoxEye = Box(11, 28, 12, 29); // @ G0049_s_Graphic562_Box_Eye -Box gBoxChampionIcons[4] = { +Box gBoxChampionIcons[4] = { Box(281, 299, 0, 13), Box(301, 319, 0, 13), Box(301, 319, 15, 28), Box(281, 299, 15, 28)}; -Color gChampionColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14}; +Color gChampionColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14}; uint16 gSlotMasks[38] = { // @ G0038_ai_Graphic562_SlotMasks /* 30 for champion inventory, 8 for chest */ @@ -312,7 +312,7 @@ T0280046: slotIndex_Green = AL_0_slotIndex_Red++; } break; - + default: break; } @@ -690,7 +690,32 @@ void ChampionMan::drawSlot(uint16 champIndex, ChampionSlot slotIndex) { } } +void ChampionMan::renameChampion(Champion* champ) { + warning("STUB METHOD: Champion::renameChampion, F0281_CHAMPION_Rename"); + + DisplayMan &dispMan = *_vm->_displayMan; + TextMan &textMan = *_vm->_textMan; + Box box; + box._y1 = 3; + box._y2 = 8 + 1; + box._x1 = 3; + box._x2 = box._x1 + 167; + + dispMan.clearScreenBox(kColorDarkestGray, box, gDungeonViewport); + dispMan.blitToScreen(dispMan.getBitmap(kPanelRenameChampionIndice), 144, 0, 0, gBoxPanel, kColorCyan, gDungeonViewport); + textMan.printToViewport(177, 58, kColorLightestGray, "_______"); + textMan.printToViewport(105, 76, kColorLightestGray, "___________________"); + Common::Point clickPos; + static Box okButtonBox(197, 215, 147, 155); // inclusive boundaries, constructor adds +1 + for (;;) { + _vm->_eventMan->processInput(); + if (_vm->_eventMan->hasPendingClick(clickPos, kLeftMouseButton) && okButtonBox.isPointInside(clickPos)) { + return; + } + dispMan.updateScreen(); + } +} } diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 1a89bc2add..d5e74a6885 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -451,6 +451,7 @@ public: uint16 championIconIndex(int16 val, direction dir); // @ M26_CHAMPION_ICON_INDEX void drawHealthStaminaManaValues(Champion *champ); // @ F0290_CHAMPION_DrawHealthStaminaManaValues void drawSlot(uint16 champIndex, ChampionSlot slotIndex); // @ F0291_CHAMPION_DrawSlot + void renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename }; diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index eab2d1474c..a3479d258a 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -225,8 +225,8 @@ void DMEngine::gameloop() { //} while (!_stopWaitingForPlayerInput || !_gameTimeTicking); if (!_inventoryMan->_inventoryChampionOrdinal && !_championMan->_partyIsSleeping) { - Box box(0, 0 + 224 + 1, 33, 33 + 126 + 1); - _displayMan->clearScreenBox(kColorBlack, box); // dummy code + Box box(0, 224, 0, 126); + _displayMan->clearScreenBox(kColorBlack, box, gDungeonViewport); // dummy code _displayMan->drawDungeon(_dungeonMan->_currMap._partyDir, _dungeonMan->_currMap._partyPosX, _dungeonMan->_currMap._partyPosY); } // DUMMY CODE: next line diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 689d9fd551..0a79b191c5 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -659,7 +659,7 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane } if (commandType == kCommandClickInPanelReincarnate) { - warning("MISSING CODE: F0281_CHAMPION_Rename"); + champMan.renameChampion(champ); champ->resetSkillsToZero(); for (uint16 i = 0; i < 12; i++) { @@ -703,11 +703,17 @@ void EventManager::commandProcess81ClickInPanel(int16 x, int16 y) { case kPanelContentResurrectReincarnate: if (!champMan._leaderEmptyHanded) break; - commandType = getCommandTypeFromMouseInput(gMouseInput_PanelChest, Common::Point(x, y), kLeftMouseButton); + commandType = getCommandTypeFromMouseInput(gMouseInput_PanelResurrectReincarnateCancel, Common::Point(x, y), kLeftMouseButton); if (commandType != kCommandNone) commandProcessCommands160To162ClickInResurrectReincarnatePanel(commandType); break; } } + bool EventManager::hasPendingClick(Common::Point& point, MouseButton button) + { + if (_pendingClickButton && button == _pendingClickButton) + point = _pendingClickPos; + return _pendingClickPresent; + } }; // end of namespace DM diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h index ca9587716c..ca60c46a7b 100644 --- a/engines/dm/eventman.h +++ b/engines/dm/eventman.h @@ -251,6 +251,8 @@ public: 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 + + bool hasPendingClick(Common::Point &point, MouseButton button); }; } diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index e73c44e697..5db354d458 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -70,7 +70,8 @@ enum GraphicIndice { kSlotBoxWoundedIndice = 34, // @ C034_GRAPHIC_SLOT_BOX_WOUNDED kChampionIcons = 28, // @ C028_GRAPHIC_CHAMPION_ICONS kFontGraphicIndice = 557, // @ C557_GRAPHIC_FONT - kSlotBoxActingHandIndice = 35 // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND + kSlotBoxActingHandIndice = 35, // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND + kPanelRenameChampionIndice = 27 // @ C027_GRAPHIC_PANEL_RENAME_CHAMPION }; extern uint16 gPalSwoosh[16]; diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 550c4c85c6..f6fe61f78f 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -37,7 +37,7 @@ namespace DM { Box gBoxFloppyZzzCross = Box(174, 218, 2, 12); // @ G0041_s_Graphic562_Box_ViewportFloppyZzzCross -Box gBoxPanel = Box(80, 223, 52, 124); // @ G0032_s_Graphic562_Box_Panel +Box gBoxPanel = Box(80, 223, 52, 124); Box gBoxFood = Box(112, 159, 60, 68); // @ G0035_s_Graphic562_Box_Food Box gBoxWater = Box(112, 159, 83, 91); // @ G0036_s_Graphic562_Box_Water Box gBoxPoisoned = Box(112, 207, 105, 119); // @ G0037_s_Graphic562_Box_Poisoned diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h index 6c34e2a0d4..f225e417bd 100644 --- a/engines/dm/inventory.h +++ b/engines/dm/inventory.h @@ -36,6 +36,8 @@ namespace DM { #define kChampionStatusBoxSpacing 69 // @ C69_CHAMPION_STATUS_BOX_SPACING +extern Box gBoxPanel; // @ G0032_s_Graphic562_Box_Panel + enum PanelContent { kPanelContentFoodWaterPoisoned = 0, // @ C00_PANEL_FOOD_WATER_POISONED kPanelContentScroll = 2, // @ C02_PANEL_SCROLL -- cgit v1.2.3