From bcd7c1d763e9ad8e5455808bcb7a6d5614035914 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Mon, 27 Jun 2016 19:40:13 +0200 Subject: DM: Fix possible bug in MenuMan::setMagicCasterAndDrawSpellArea --- engines/dm/menus.cpp | 59 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'engines') diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 47c35b926d..dfbe5b564e 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -45,7 +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); +Box gBoxSpellArea = Box(224, 319, 77, 121); MenuMan::MenuMan(DMEngine *vm) : _vm(vm) { _refreshActionArea = false; @@ -315,7 +315,7 @@ void MenuMan::buildSpellAreaLine(int16 spellAreaBitmapLine) { dispMan._useByteBoxCoordinates = false; dispMan.blitToBitmap(dispMan.getBitmap(kMenuSpellAreLinesIndice), 96, 0, 12, _bitmapSpellAreaLine, 96, gBoxSpellAreaLine, kColorNoTransparency); int16 x = 1; - char c = 96 + (6 * champ._symbolStep); + byte c = 96 + (6 * champ._symbolStep); char spellSymbolString[2] = {'\0', '\0'}; for (uint16 symbolIndex = 0; symbolIndex < 6; symbolIndex++) { spellSymbolString[0] = c++; @@ -324,8 +324,8 @@ void MenuMan::buildSpellAreaLine(int16 spellAreaBitmapLine) { } else if (spellAreaBitmapLine == kSpellAreaChampionSymbols) { dispMan._useByteBoxCoordinates = false; dispMan.blitToBitmap(dispMan.getBitmap(kMenuSpellAreLinesIndice), 96, 0, 24, _bitmapSpellAreaLine, 96, gBoxSpellAreaLine, kColorNoTransparency); - int16 x = 8; char spellSymbolString[2] = {'\0', '\0'}; + int16 x = 8; for (uint16 symbolIndex = 0; symbolIndex < 4; symbolIndex++) { if ((spellSymbolString[0] = champ._symbols[symbolIndex]) == '\0') break; @@ -334,35 +334,34 @@ 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; - } +void MenuMan::setMagicCasterAndDrawSpellArea(int16 champIndex) { + ChampionMan &champMan = *_vm->_championMan; + DisplayMan &dispMan = *_vm->_displayMan; - champMan._magicCasterChampionIndex = champIndex; - buildSpellAreaLine(kSpellAreaAvailableSymbols); + if ((champIndex == champMan._magicCasterChampionIndex) + || ((champIndex != kChampionNone) && !champMan._champions[champIndex]._currHealth)) + return; + if (champMan._magicCasterChampionIndex == kChampionNone) { 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); + 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 = (ChampionIndex)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"); +} } -- cgit v1.2.3