From 72506aebba96dec6e709a6efc8577ebee40407f9 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Sun, 26 Jun 2016 00:39:44 +0200 Subject: DM: Add MenuMan::setMagicCasterAndDrawSpellArea --- engines/dm/eventman.cpp | 2 +- engines/dm/gfx.h | 3 ++- engines/dm/menus.cpp | 32 ++++++++++++++++++++++++++++++++ engines/dm/menus.h | 4 +++- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 9ebda0fbb0..4e5a59cb91 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -673,7 +673,7 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane if (champMan._partyChampionCount == 1) { warning("MISSING CODE: setting time, G0362_l_LastPartyMovementTime , G0313_ul_GameTime"); commandSetLeader(kChampionFirst); - warning("MISSING CODE: F0394_MENUS_SetMagicCasterAndDrawSpellArea"); + _vm->_menuMan->setMagicCasterAndDrawSpellArea(kChampionFirst); } else { _vm->_menuMan->drawSpellAreaControls(champMan._magicCasterChampionIndex); } diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 209559b827..9354b99de3 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -73,7 +73,8 @@ enum GraphicIndice { kSlotBoxActingHandIndice = 35, // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND kPanelRenameChampionIndice = 27, // @ C027_GRAPHIC_PANEL_RENAME_CHAMPION kMenuActionAreaIndice = 10, // @ C010_GRAPHIC_MENU_ACTION_AREA - kMenuSpellAreLinesIndice = 11 // @ C011_GRAPHIC_MENU_SPELL_AREA_LINES + kMenuSpellAreLinesIndice = 11, // @ C011_GRAPHIC_MENU_SPELL_AREA_LINES + kMenuSpellAreaBackground = 9 // @ C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND }; extern uint16 gPalSwoosh[16]; diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 02a6689292..47c35b926d 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -45,6 +45,7 @@ byte gPalChangesActionAreaObjectIcon[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Box gBoxSpellAreaLine = Box(0, 95, 0, 11); // @ K0074_s_Box_SpellAreaLine Box gBoxSpellAreaLine2 = Box(224, 319, 50, 61); // @ K0075_s_Box_SpellAreaLine2 Box gBoxSpellAreaLine3 = Box(224, 319, 62, 73); // @ K0076_s_Box_SpellAreaLine3 +Box gBoxSpellArea = Box(224, 319, 77, 121); MenuMan::MenuMan(DMEngine *vm) : _vm(vm) { _refreshActionArea = false; @@ -333,4 +334,35 @@ void MenuMan::buildSpellAreaLine(int16 spellAreaBitmapLine) { } } + void MenuMan::setMagicCasterAndDrawSpellArea(int16 champIndex) + { + ChampionMan &champMan = *_vm->_championMan; + DisplayMan &dispMan = *_vm->_displayMan; + + if((champIndex == champMan._magicCasterChampionIndex) + || ((champIndex != kChampionNone) && !champMan._champions[champIndex]._currHealth)) + return; + if (champMan._magicCasterChampionIndex == kChampionNone) { + warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE"); + dispMan.blitToScreen(dispMan.getBitmap(kMenuSpellAreaBackground), 96, 0, 0, gBoxSpellArea); + warning("MISSING CODE: F0078_MOUSE_ShowPointer"); + } + if (champIndex == kChampionNone) { + champMan._magicCasterChampionIndex = kChampionNone; + warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE"); + dispMan._useByteBoxCoordinates = false; + dispMan.clearScreenBox(kColorBlack, gBoxSpellArea); + warning("MISSING CODE: F0078_MOUSE_ShowPointer"); + return; + } + + champMan._magicCasterChampionIndex = champIndex; + buildSpellAreaLine(kSpellAreaAvailableSymbols); + warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE"); + drawSpellAreaControls((ChampionIndex)champIndex); + dispMan.blitToScreen(_bitmapSpellAreaLine, 96, 0, 0, gBoxSpellAreaLine2); + buildSpellAreaLine(kSpellAreaChampionSymbols); + dispMan.blitToScreen(_bitmapSpellAreaLine, 96, 0, 0, gBoxSpellAreaLine3); + warning("MISSING CODE: F0078_MOUSE_ShowPointer"); + } } diff --git a/engines/dm/menus.h b/engines/dm/menus.h index b4006e17b0..a8df73531f 100644 --- a/engines/dm/menus.h +++ b/engines/dm/menus.h @@ -33,7 +33,8 @@ namespace DM { -extern Box gBoxActionArea; +extern Box gBoxActionArea; // @ G0001_s_Graphic562_Box_ActionArea +extern Box gBoxSpellArea; // @ G0000_s_Graphic562_Box_SpellArea class ActionList { public: @@ -69,6 +70,7 @@ public: const char* getActionName(ChampionAction actionIndex); // @ F0384_MENUS_GetActionName void drawSpellAreaControls(ChampionIndex champIndex); // @ F0393_MENUS_DrawSpellAreaControls void buildSpellAreaLine(int16 spellAreaBitmapLine);// @ F0392_MENUS_BuildSpellAreaLine + void setMagicCasterAndDrawSpellArea(int16 champIndex); // @ F0394_MENUS_SetMagicCasterAndDrawSpellArea }; } -- cgit v1.2.3