diff options
author | Strangerke | 2016-09-25 07:42:35 +0200 |
---|---|---|
committer | Strangerke | 2016-09-25 07:44:04 +0200 |
commit | 51bef09e4a541ae4ff0a9cf020b5f663e828187e (patch) | |
tree | 1605c0b07765f469f1bd980a61c2607aac31fcd0 /engines/dm | |
parent | cce771c0e1c018edc6c047322f58614425192ee6 (diff) | |
download | scummvm-rg350-51bef09e4a541ae4ff0a9cf020b5f663e828187e.tar.gz scummvm-rg350-51bef09e4a541ae4ff0a9cf020b5f663e828187e.tar.bz2 scummvm-rg350-51bef09e4a541ae4ff0a9cf020b5f663e828187e.zip |
DM: reduce dereferencing some more
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/champion.cpp | 217 | ||||
-rw-r--r-- | engines/dm/dialog.cpp | 145 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 24 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 76 | ||||
-rw-r--r-- | engines/dm/movesens.cpp | 3 |
5 files changed, 267 insertions, 198 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 1fe6e8749b..f95b775aa5 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -263,11 +263,13 @@ int16 ChampionMan::getDecodedValue(char *string, uint16 characterCount) { } void ChampionMan::drawHealthOrStaminaOrManaValue(int16 posY, int16 currVal, int16 maxVal) { + TextMan &txtMan = *_vm->_textMan; + Common::String tmp = getStringFromInteger(currVal, true, 3); - _vm->_textMan->printToViewport(55, posY, kDMColorLightestGray, tmp.c_str()); - _vm->_textMan->printToViewport(73, posY, kDMColorLightestGray, "/"); + txtMan.printToViewport(55, posY, kDMColorLightestGray, tmp.c_str()); + txtMan.printToViewport(73, posY, kDMColorLightestGray, "/"); tmp = getStringFromInteger(maxVal, true, 3); - _vm->_textMan->printToViewport(79, posY, kDMColorLightestGray, tmp.c_str()); + txtMan.printToViewport(79, posY, kDMColorLightestGray, tmp.c_str()); } uint16 ChampionMan::getHandSlotIndex(uint16 slotBoxIndex) { @@ -898,16 +900,18 @@ uint16 ChampionMan::getStatisticAdjustedAttack(Champion *champ, uint16 statIndex } void ChampionMan::wakeUp() { + EventManager &evtMan = *_vm->_eventMan; + _vm->_stopWaitingForPlayerInput = true; _partyIsSleeping = false; _vm->_waitForInputMaxVerticalBlankCount = 10; _vm->delay(10); _vm->_displayMan->drawFloorAndCeiling(); - _vm->_eventMan->_primaryMouseInput = _vm->_eventMan->_primaryMouseInputInterface; - _vm->_eventMan->_secondaryMouseInput = _vm->_eventMan->_secondaryMouseInputMovement; - _vm->_eventMan->_primaryKeyboardInput = _vm->_eventMan->_primaryKeyboardInputInterface; - _vm->_eventMan->_secondaryKeyboardInput = _vm->_eventMan->_secondaryKeyboardInputMovement; - _vm->_eventMan->discardAllInput(); + evtMan._primaryMouseInput = evtMan._primaryMouseInputInterface; + evtMan._secondaryMouseInput = evtMan._secondaryMouseInputMovement; + evtMan._primaryKeyboardInput = evtMan._primaryKeyboardInputInterface; + evtMan._secondaryKeyboardInput = evtMan._secondaryKeyboardInputMovement; + evtMan.discardAllInput(); _vm->_menuMan->drawEnabledMenus(); } @@ -948,6 +952,8 @@ void ChampionMan::disableAction(uint16 champIndex, uint16 ticks) { void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint16 exp) { DungeonMan &dungeon = *_vm->_dungeonMan; + TextMan &txtMan = *_vm->_textMan; + if ((skillIndex >= kDMSkillSwing) && (skillIndex <= kDMSkillShoot) && (_vm->_projexpl->_lastCreatureAttackTime < _vm->_gameTime - 150)) exp >>= 1; @@ -1032,24 +1038,36 @@ void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint1 setFlag(curChampion->_attributes, kDMAttributeStatistics); drawChampionState((ChampionIndex)champIndex); - _vm->_textMan->printLineFeed(); + txtMan.printLineFeed(); Color curChampionColor = _championColor[champIndex]; - _vm->_textMan->printMessage(curChampionColor, curChampion->_name); + txtMan.printMessage(curChampionColor, curChampion->_name); switch (_vm->getGameLanguage()) { // localized default: - case Common::EN_ANY: _vm->_textMan->printMessage(curChampionColor, " JUST GAINED A "); break; - case Common::DE_DEU: _vm->_textMan->printMessage(curChampionColor, " HAT SOEBEN STUFE"); break; - case Common::FR_FRA: _vm->_textMan->printMessage(curChampionColor, " VIENT DE DEVENIR "); break; + case Common::EN_ANY: + txtMan.printMessage(curChampionColor, " JUST GAINED A "); + break; + case Common::DE_DEU: + txtMan.printMessage(curChampionColor, " HAT SOEBEN STUFE"); + break; + case Common::FR_FRA: + txtMan.printMessage(curChampionColor, " VIENT DE DEVENIR "); + break; } - _vm->_textMan->printMessage(curChampionColor, _baseSkillName[baseSkillIndex]); + txtMan.printMessage(curChampionColor, _baseSkillName[baseSkillIndex]); switch (_vm->getGameLanguage()) { // localized default: - case Common::EN_ANY: _vm->_textMan->printMessage(curChampionColor, "!"); break; - case Common::DE_DEU: _vm->_textMan->printMessage(curChampionColor, " LEVEL!"); break; - case Common::FR_FRA: _vm->_textMan->printMessage(curChampionColor, " ERREICHT!"); break; + case Common::EN_ANY: + txtMan.printMessage(curChampionColor, "!"); + break; + case Common::DE_DEU: + txtMan.printMessage(curChampionColor, " LEVEL!"); + break; + case Common::FR_FRA: + txtMan.printMessage(curChampionColor, " ERREICHT!"); + break; } } } @@ -1200,17 +1218,19 @@ void ChampionMan::putObjectInLeaderHand(Thing thing, bool setMousePointer) { if (thing == Thing::_none) return; + EventManager &evtMan = *_vm->_eventMan; + _leaderEmptyHanded = false; _vm->_objectMan->extractIconFromBitmap(_leaderHandObjectIconIndex = _vm->_objectMan->getIconIndex(_leaderHandObject = thing), _vm->_objectMan->_objectIconForMousePointer); - _vm->_eventMan->showMouse(); + evtMan.showMouse(); _vm->_objectMan->drawLeaderObjectName(thing); if (setMousePointer) _vm->_setMousePointerToObjectInMainLoop = true; else - _vm->_eventMan->setPointerToObject(_vm->_objectMan->_objectIconForMousePointer); + evtMan.setPointerToObject(_vm->_objectMan->_objectIconForMousePointer); - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); if (_leaderIndex != kDMChampionNone) { _champions[_leaderIndex]._load += _vm->_dungeonMan->getObjectWeight(thing); setFlag(_champions[_leaderIndex]._attributes, kDMAttributeLoad); @@ -1329,7 +1349,8 @@ void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) { if ((leaderHandObject != Thing::_none) && (!(dungeon._objectInfos[dungeon.getObjectInfoIndex(leaderHandObject)]._allowedSlots & _slotMasks[slotIndex]))) return; - _vm->_eventMan->showMouse(); + EventManager &evtMan = *_vm->_eventMan; + evtMan.showMouse(); if (leaderHandObject != Thing::_none) getObjectRemovedFromLeaderHand(); @@ -1342,7 +1363,7 @@ void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) { addObjectInSlot((ChampionIndex)champIndex, leaderHandObject, (ChampionSlot)slotIndex); drawChampionState((ChampionIndex)champIndex); - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); } bool ChampionMan::isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount) { @@ -1372,6 +1393,9 @@ void ChampionMan::championShootProjectile(Champion *champ, Thing thing, int16 ki void ChampionMan::applyAndDrawPendingDamageAndWounds() { Champion *championPtr = _champions; + EventManager &evtMan = *_vm->_eventMan; + TextMan &txtMan = *_vm->_textMan; + for (uint16 championIndex = kDMChampionFirst; championIndex < _partyChampionCount; championIndex++, championPtr++) { int16 pendingWounds = _championPendingWounds[championIndex]; setFlag(championPtr->_wounds, pendingWounds); @@ -1402,7 +1426,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() { Box blitBox; blitBox._rect.top = 0; - _vm->_eventMan->showMouse(); + evtMan.showMouse(); if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) { blitBox._rect.bottom = 28; @@ -1433,7 +1457,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() { textPosY = 5; } - _vm->_textMan->printToLogicalScreen(textPosX, textPosY, kDMColorWhite, kDMColorRed, getStringFromInteger(pendingDamage, false, 3).c_str()); + txtMan.printToLogicalScreen(textPosX, textPosY, kDMColorWhite, kDMColorRed, getStringFromInteger(pendingDamage, false, 3).c_str()); int16 eventIndex = championPtr->_hideDamageReceivedIndex; if (eventIndex == -1) { @@ -1448,7 +1472,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() { _vm->_timeline->fixChronology(_vm->_timeline->getIndex(eventIndex)); } drawChampionState((ChampionIndex)championIndex); - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); } } } @@ -1456,23 +1480,24 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() { void ChampionMan::championKill(uint16 champIndex) { DungeonMan &dungeon = *_vm->_dungeonMan; Champion *curChampion = &_champions[champIndex]; + EventManager &evtMan = *_vm->_eventMan; curChampion->_currHealth = 0; setFlag(curChampion->_attributes, kDMAttributeStatusBox); if (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) { if (_vm->_pressingEye) { _vm->_pressingEye = false; - _vm->_eventMan->_ignoreMouseMovements = false; + evtMan._ignoreMouseMovements = false; if (!_leaderEmptyHanded) { _vm->_objectMan->drawLeaderObjectName(_leaderHandObject); } - _vm->_eventMan->_hideMousePointerRequestCount = 1; - _vm->_eventMan->hideMouse(); + evtMan._hideMousePointerRequestCount = 1; + evtMan.hideMouse(); } else if (_vm->_pressingMouth) { _vm->_pressingMouth = false; - _vm->_eventMan->_ignoreMouseMovements = false; - _vm->_eventMan->_hideMousePointerRequestCount = 1; - _vm->_eventMan->hideMouse(); + evtMan._ignoreMouseMovements = false; + evtMan._hideMousePointerRequestCount = 1; + evtMan.hideMouse(); } _vm->_inventoryMan->toggleInventory(kDMChampionCloseInventory); } @@ -1492,9 +1517,9 @@ void ChampionMan::championKill(uint16 champIndex) { curChampion->_dir = dungeon._partyDir; curChampion->_maximumDamageReceived = 0; uint16 curChampionIconIndex = getChampionIconIndex(curCell, dungeon._partyDir); - if (_vm->indexToOrdinal(curChampionIconIndex) == _vm->_eventMan->_useChampionIconOrdinalAsMousePointerBitmap) { - _vm->_eventMan->_mousePointerBitmapUpdated = true; - _vm->_eventMan->_useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(kDMChampionNone); + if (_vm->indexToOrdinal(curChampionIconIndex) == evtMan._useChampionIconOrdinalAsMousePointerBitmap) { + evtMan._mousePointerBitmapUpdated = true; + evtMan._useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(kDMChampionNone); } if (curChampion->_poisonEventCount) @@ -1516,7 +1541,7 @@ void ChampionMan::championKill(uint16 champIndex) { } if (champIndex == _leaderIndex) - _vm->_eventMan->commandSetLeader(aliveChampionIndex); + evtMan.commandSetLeader(aliveChampionIndex); if (champIndex == _magicCasterChampionIndex) _vm->_menuMan->setMagicCasterAndDrawSpellArea(aliveChampionIndex); @@ -1841,10 +1866,12 @@ ChampionIndex ChampionMan::getIndexInCell(int16 cell) { void ChampionMan::resetDataToStartGame() { if (_vm->_gameMode == kDMModeLoadSavedGame) { Thing handThing = _leaderHandObject; + EventManager &evtMan = *_vm->_eventMan; + if (handThing == Thing::_none) { _leaderEmptyHanded = true; _leaderHandObjectIconIndex = kDMIconIndiceNone; - _vm->_eventMan->setMousePointer(); + evtMan.setMousePointer(); } else putObjectInLeaderHand(handThing, true); /* This call will add the weight of the leader hand object to the Load of the leader a first time */ @@ -1858,7 +1885,7 @@ void ChampionMan::resetDataToStartGame() { ChampionIndex championIndex = _leaderIndex; if (championIndex != kDMChampionNone) { _leaderIndex = kDMChampionNone; - _vm->_eventMan->commandSetLeader(championIndex); + evtMan.commandSetLeader(championIndex); } championIndex = _magicCasterChampionIndex; @@ -2047,8 +2074,10 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { } void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) { - int16 barGraphHeights[3]; Champion *champ = &_champions[champIndex]; + EventManager &evtMan = *_vm->_eventMan; + + int16 barGraphHeights[3]; int16 barGraphIdx = 0; if (champ->_currHealth > 0) { int32 barGraphHeight = (((int32)champ->_currHealth << 10) * 25) / champ->_maxHealth; @@ -2072,7 +2101,7 @@ void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) { } else { barGraphHeights[barGraphIdx] = 0; } - _vm->_eventMan->showMouse(); + evtMan.showMouse(); // Strangerke - TO CHECK: if portraits, maybe the old (assembly) code is required for older versions Box box; @@ -2095,7 +2124,7 @@ void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) { box._rect.left += 7; box._rect.right += 7; } - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); } @@ -2130,13 +2159,16 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { int16 championStatusBoxX = champIndex * kDMChampionStatusBoxSpacing; Champion *curChampion = &_champions[champIndex]; + EventManager &evtMan = *_vm->_eventMan; + TextMan &txtMan = *_vm->_textMan; + uint16 championAttributes = curChampion->_attributes; if (!getFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand)) return; bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal); _vm->_displayMan->_useByteBoxCoordinates = false; - _vm->_eventMan->showMouse(); + evtMan.showMouse(); if (getFlag(championAttributes, kDMAttributeStatusBox)) { Box box; box._rect.top = 0; @@ -2169,17 +2201,17 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { setFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeWounds | kDMAttributeActionHand); } else { _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxStatusBoxDeadChampion), &box, k40_byteWidth, kDMColorNoTransparency, 29); - _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, kDMColorLightestGray, kDMColorDarkGary, curChampion->_name); + txtMan.printToLogicalScreen(championStatusBoxX + 1, 5, kDMColorLightestGray, kDMColorDarkGary, curChampion->_name); _vm->_menuMan->drawActionIcon(champIndex); clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand); - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); return; } } if (!(curChampion->_currHealth)) { clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand); - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); return; } @@ -2187,13 +2219,13 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { Color nameColor = (champIndex == _leaderIndex) ? kDMColorGold : kDMColorLightestGray; if (isInventoryChampion) { char *championName = curChampion->_name; - _vm->_textMan->printToViewport(3, 7, nameColor, championName); + txtMan.printToViewport(3, 7, nameColor, championName); int16 championTitleX = 6 * strlen(championName) + 3; char titleFirstCharacter = curChampion->_title[0]; if ((titleFirstCharacter != ',') && (titleFirstCharacter != ';') && (titleFirstCharacter != '-')) championTitleX += 6; - _vm->_textMan->printToViewport(championTitleX, 7, nameColor, curChampion->_title); + txtMan.printToViewport(championTitleX, 7, nameColor, curChampion->_title); setFlag(championAttributes, kDMAttributeViewport); } else { Box box; @@ -2202,7 +2234,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { box._rect.left = championStatusBoxX; box._rect.right = box._rect.left + 42; _vm->_displayMan->fillScreenBox(box, kDMColorDarkGary); - _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, kDMColorDarkGary, curChampion->_name); + txtMan.printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, kDMColorDarkGary, curChampion->_name); } } if (getFlag(championAttributes, kDMAttributeStatistics)) { @@ -2246,9 +2278,15 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { switch (_vm->getGameLanguage()) { // localized default: - case Common::EN_ANY: _vm->_textMan->printToViewport(104, 132, loadColor, "LOAD "); break; - case Common::DE_DEU: _vm->_textMan->printToViewport(104, 132, loadColor, "LAST "); break; - case Common::FR_FRA: _vm->_textMan->printToViewport(104, 132, loadColor, "CHARGE "); break; + case Common::EN_ANY: + txtMan.printToViewport(104, 132, loadColor, "LOAD "); + break; + case Common::DE_DEU: + txtMan.printToViewport(104, 132, loadColor, "LAST "); + break; + case Common::FR_FRA: + txtMan.printToViewport(104, 132, loadColor, "CHARGE "); + break; } maxLoad = curChampion->_load / 10; @@ -2267,12 +2305,12 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { maxLoad = (getMaximumLoad(curChampion) + 5) / 10; strcat(_vm->_stringBuildBuffer, getStringFromInteger(maxLoad, true, 3).c_str()); strcat(_vm->_stringBuildBuffer, " KG"); - _vm->_textMan->printToViewport(148, 132, loadColor, _vm->_stringBuildBuffer); + txtMan.printToViewport(148, 132, loadColor, _vm->_stringBuildBuffer); setFlag(championAttributes, kDMAttributeViewport); } DungeonMan &dungeon = *_vm->_dungeonMan; uint16 championIconIndex = getChampionIconIndex(curChampion->_cell, dungeon._partyDir); - if (getFlag(championAttributes, kDMAttributeIcon) && (_vm->_eventMan->_useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(championIconIndex))) { + if (getFlag(championAttributes, kDMAttributeIcon) && (evtMan._useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(championIconIndex))) { _vm->_displayMan->fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]); _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxChampionIcons), _vm->_displayMan->_bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, dungeon._partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, kDMColorDarkestGray, 14, k200_heightScreen); } @@ -2297,7 +2335,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { _vm->_displayMan->drawViewport(k0_viewportNotDungeonView); clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand); - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); } uint16 ChampionMan::getChampionIconIndex(int16 val, Direction dir) { @@ -2311,8 +2349,10 @@ void ChampionMan::drawHealthStaminaManaValues(Champion *champ) { } void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) { - int16 nativeBitmapIndex = -1; Champion *champ = &_champions[champIndex]; + EventManager &evtMan = *_vm->_eventMan; + + int16 nativeBitmapIndex = -1; bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex)); uint16 slotBoxIndex; @@ -2338,7 +2378,7 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) { box._rect.bottom = box._rect.top + 17; if (!isInventoryChamp) - _vm->_eventMan->hideMouse(); + evtMan.hideMouse(); int16 iconIndex; if (thing == Thing::_none) { @@ -2387,16 +2427,19 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) { _vm->_objectMan->drawIconInSlotBox(slotBoxIndex, iconIndex); if (!isInventoryChamp) - _vm->_eventMan->showMouse(); + evtMan.showMouse(); } void ChampionMan::renameChampion(Champion *champ) { -#define k1_RENAME_CHAMPION_NAME 1 -#define k2_RENAME_CHAMPION_TITLE 2 +#define kDMRenameChampionName 1 +#define kDMRenameChampionTitle 2 static const char underscoreCharacterString[2] = "_"; static char renameChampionInputCharacterString[2] = " "; static const char reincarnateSpecialCharacters[6] = {',', '.', ';', ':', ' '}; + EventManager &evtMan = *_vm->_eventMan; + TextMan &txtMan = *_vm->_textMan; + Box displayBox; displayBox._rect.top = 3; displayBox._rect.bottom = 8; @@ -2405,32 +2448,32 @@ void ChampionMan::renameChampion(Champion *champ) { _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, displayBox, kDMColorDarkestGray, k112_byteWidthViewport, k136_heightViewport); _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelRenameChampion), _vm->_inventoryMan->_boxPanel, k72_byteWidth, kDMColorCyan, 73); - _vm->_textMan->printToViewport(177, 58, kDMColorLightestGray, "_______"); - _vm->_textMan->printToViewport(105, 76, kDMColorLightestGray, "___________________"); - _vm->_eventMan->showMouse(); + txtMan.printToViewport(177, 58, kDMColorLightestGray, "_______"); + txtMan.printToViewport(105, 76, kDMColorLightestGray, "___________________"); + evtMan.showMouse(); _vm->_displayMan->drawViewport(k0_viewportNotDungeonView); - _vm->_eventMan->setMousePointerToNormal(k0_pointerArrow); - _vm->_eventMan->hideMouse(); + evtMan.setMousePointerToNormal(k0_pointerArrow); + evtMan.hideMouse(); uint16 curCharacterIndex = 0; champ->_name[curCharacterIndex] = '\0'; champ->_title[0] = '\0'; - int16 renamedChampionStringMode = k1_RENAME_CHAMPION_NAME; + int16 renamedChampionStringMode = kDMRenameChampionName; char *renamedChampionString = champ->_name; int16 textPosX = 177; int16 textPosY = 91; for (;;) { /*_Infinite loop_*/ - bool championTitleIsFull = ((renamedChampionStringMode == k2_RENAME_CHAMPION_TITLE) && (curCharacterIndex == 19)); + bool championTitleIsFull = ((renamedChampionStringMode == kDMRenameChampionTitle) && (curCharacterIndex == 19)); if (!championTitleIsFull) { - _vm->_eventMan->showMouse(); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorGold, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen); - _vm->_eventMan->hideMouse(); + evtMan.showMouse(); + txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorGold, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen); + evtMan.hideMouse(); } int16 curCharacter = 256; while (curCharacter == 256) { Common::Event event; - Common::EventType eventType = _vm->_eventMan->processInput(&event, &event); + Common::EventType eventType = evtMan.processInput(&event, &event); _vm->_displayMan->updateScreen(); if (_vm->_engineShouldQuit) return; @@ -2440,8 +2483,8 @@ void ChampionMan::renameChampion(Champion *champ) { if (eventType == Common::EVENT_LBUTTONDOWN) { // If left mouse button status has changed - Common::Point mousePos = _vm->_eventMan->getMousePos(); - if ((renamedChampionStringMode == k2_RENAME_CHAMPION_TITLE || (curCharacterIndex > 0)) && (mousePos.x >= 197) && (mousePos.x <= 215) && (mousePos.y >= 147) && (mousePos.y <= 155)) { /* Coordinates of 'OK' button */ + Common::Point mousePos = evtMan.getMousePos(); + if ((renamedChampionStringMode == kDMRenameChampionTitle || (curCharacterIndex > 0)) && (mousePos.x >= 197) && (mousePos.x <= 215) && (mousePos.y >= 147) && (mousePos.y <= 155)) { /* Coordinates of 'OK' button */ int16 characterIndexBackup = curCharacterIndex; char championNameBackupString[8]; renamedChampionString = champ->_name; @@ -2462,7 +2505,7 @@ void ChampionMan::renameChampion(Champion *champ) { if (!found) return; - if (renamedChampionStringMode == k2_RENAME_CHAMPION_TITLE) + if (renamedChampionStringMode == kDMRenameChampionTitle) renamedChampionString = champ->_title; strcpy(renamedChampionString = champ->_name, championNameBackupString); @@ -2507,14 +2550,14 @@ void ChampionMan::renameChampion(Champion *champ) { if ((curCharacter != ' ') || curCharacterIndex != 0) { if (!championTitleIsFull) { renameChampionInputCharacterString[0] = curCharacter; - _vm->_eventMan->showMouse(); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, renameChampionInputCharacterString, k200_heightScreen); - _vm->_eventMan->hideMouse(); + evtMan.showMouse(); + txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, renameChampionInputCharacterString, k200_heightScreen); + evtMan.hideMouse(); renamedChampionString[curCharacterIndex++] = curCharacter; renamedChampionString[curCharacterIndex] = '\0'; textPosX += 6; - if ((renamedChampionStringMode == k1_RENAME_CHAMPION_NAME) && (curCharacterIndex == 7)) { - renamedChampionStringMode = k2_RENAME_CHAMPION_TITLE; + if ((renamedChampionStringMode == kDMRenameChampionName) && (curCharacterIndex == 7)) { + renamedChampionStringMode = kDMRenameChampionTitle; renamedChampionString = champ->_title; textPosX = 105; textPosY = 109; @@ -2523,29 +2566,29 @@ void ChampionMan::renameChampion(Champion *champ) { } } } else if (curCharacter == '\r') { // Carriage return - if ((renamedChampionStringMode == k1_RENAME_CHAMPION_NAME) && (curCharacterIndex > 0)) { - _vm->_eventMan->showMouse(); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen); - _vm->_eventMan->hideMouse(); - renamedChampionStringMode = k2_RENAME_CHAMPION_TITLE; + if ((renamedChampionStringMode == kDMRenameChampionName) && (curCharacterIndex > 0)) { + evtMan.showMouse(); + txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen); + evtMan.hideMouse(); + renamedChampionStringMode = kDMRenameChampionTitle; renamedChampionString = champ->_title; textPosX = 105; textPosY = 109; curCharacterIndex = 0; } } else if (curCharacter == '\b') { // Backspace - if ((renamedChampionStringMode == k1_RENAME_CHAMPION_NAME) && (curCharacterIndex == 0)) + if ((renamedChampionStringMode == kDMRenameChampionName) && (curCharacterIndex == 0)) continue; if (!championTitleIsFull) { - _vm->_eventMan->showMouse(); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen); - _vm->_eventMan->hideMouse(); + evtMan.showMouse(); + txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen); + evtMan.hideMouse(); } if (curCharacterIndex == 0) { renamedChampionString = champ->_name; curCharacterIndex = strlen(renamedChampionString) - 1; - renamedChampionStringMode = k1_RENAME_CHAMPION_NAME; + renamedChampionStringMode = kDMRenameChampionName; textPosX = 177 + (curCharacterIndex * 6); textPosY = 91; } else { diff --git a/engines/dm/dialog.cpp b/engines/dm/dialog.cpp index 3fbab203d3..8d16deae9d 100644 --- a/engines/dm/dialog.cpp +++ b/engines/dm/dialog.cpp @@ -43,10 +43,14 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic static Box dialog2ChoicesPatch = Box(102, 122, 89, 125); static Box dialog4ChoicesPatch = Box(102, 122, 62, 97); - _vm->_displayMan->loadIntoBitmap(kDMGraphicIdxDialogBox, _vm->_displayMan->_bitmapViewport); + EventManager &evtMan = *_vm->_eventMan; + DisplayMan &displMan = *_vm->_displayMan; + TextMan &txtMan = *_vm->_textMan; + + displMan.loadIntoBitmap(kDMGraphicIdxDialogBox, displMan._bitmapViewport); //Strangerke: the version should be replaced by a ScummVM/RogueVM (?) string // TODO: replace with ScummVM version string - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 192, 7, kDMColorLightGray, kDMColorDarkGary, "V2.2", k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, 192, 7, kDMColorLightGray, kDMColorDarkGary, "V2.2", k136_heightViewport); int16 choiceCount = 1; if (choice2) choiceCount++; @@ -58,31 +62,31 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic choiceCount++; if (fading) - _vm->_displayMan->startEndFadeToPalette(_vm->_displayMan->_blankBuffer); + displMan.startEndFadeToPalette(displMan._blankBuffer); if (clearScreen) - _vm->_displayMan->fillScreen(kDMColorBlack); + displMan.fillScreen(kDMColorBlack); - _vm->_displayMan->_useByteBoxCoordinates = false; + displMan._useByteBoxCoordinates = false; if (choiceCount == 1) { - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox1, 0, 64, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox2, 0, 39, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox3, 0, 14, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice1, 112, 114); + displMan.blitToBitmap(displMan._bitmapViewport, displMan._bitmapViewport, constBox1, 0, 64, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); + displMan.blitToBitmap(displMan._bitmapViewport, displMan._bitmapViewport, constBox2, 0, 39, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); + displMan.blitToBitmap(displMan._bitmapViewport, displMan._bitmapViewport, constBox3, 0, 14, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); + printCenteredChoice(displMan._bitmapViewport, choice1, 112, 114); } else if (choiceCount == 2) { - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, dialog2ChoicesPatch, 102, 52, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice1, 112, 77); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice2, 112, 114); + displMan.blitToBitmap(displMan._bitmapViewport, displMan._bitmapViewport, dialog2ChoicesPatch, 102, 52, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); + printCenteredChoice(displMan._bitmapViewport, choice1, 112, 77); + printCenteredChoice(displMan._bitmapViewport, choice2, 112, 114); } else if (choiceCount == 3) { - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice1, 112, 77); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice2, 59, 114); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice3, 166, 114); + printCenteredChoice(displMan._bitmapViewport, choice1, 112, 77); + printCenteredChoice(displMan._bitmapViewport, choice2, 59, 114); + printCenteredChoice(displMan._bitmapViewport, choice3, 166, 114); } else if (choiceCount == 4) { - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, dialog4ChoicesPatch, 102, 99, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice1, 59, 77); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice2, 166, 77); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice3, 59, 114); - printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice4, 166, 114); + displMan.blitToBitmap(displMan._bitmapViewport, displMan._bitmapViewport, dialog4ChoicesPatch, 102, 99, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport); + printCenteredChoice(displMan._bitmapViewport, choice1, 59, 77); + printCenteredChoice(displMan._bitmapViewport, choice2, 166, 77); + printCenteredChoice(displMan._bitmapViewport, choice3, 59, 114); + printCenteredChoice(displMan._bitmapViewport, choice4, 166, 114); } int16 textPosX; @@ -93,14 +97,14 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic if (isMessageOnTwoLines(msg1, L1312_ac_StringPart1, L1313_ac_StringPart2)) { textPosY = 21; textPosX = 113 - ((strlen(L1312_ac_StringPart1) * 6) >> 1); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, L1312_ac_StringPart1, k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, L1312_ac_StringPart1, k136_heightViewport); textPosY += 8; textPosX = 113 - ((strlen(L1313_ac_StringPart2) * 6) >> 1); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, L1313_ac_StringPart2, k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, L1313_ac_StringPart2, k136_heightViewport); textPosY += 8; } else { textPosX = 113 - ((strlen(msg1) * 6) >> 1); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, msg1, k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, msg1, k136_heightViewport); textPosY += 8; } } @@ -109,30 +113,30 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic char L1313_ac_StringPart2[70]; if (isMessageOnTwoLines(msg2, L1312_ac_StringPart1, L1313_ac_StringPart2)) { textPosX = 113 - ((strlen(L1312_ac_StringPart1) * 6) >> 1); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, L1312_ac_StringPart1, k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, L1312_ac_StringPart1, k136_heightViewport); textPosY += 8; textPosX = 113 - ((strlen(L1313_ac_StringPart2) * 6) >> 1); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, L1313_ac_StringPart2, k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, L1313_ac_StringPart2, k136_heightViewport); } else { textPosX = 113 - ((strlen(msg2) * 6) >> 1); - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, msg2, k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, msg2, k136_heightViewport); } } if (screenDialog) { Box displayBox(47, 270, 33, 168); - _vm->_eventMan->showMouse(); - _vm->_displayMan->blitToScreen(_vm->_displayMan->_bitmapViewport, &displayBox, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport); - _vm->_eventMan->hideMouse(); + evtMan.showMouse(); + displMan.blitToScreen(displMan._bitmapViewport, &displayBox, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport); + evtMan.hideMouse(); } else { - _vm->_displayMan->drawViewport(k0_viewportNotDungeonView); + displMan.drawViewport(k0_viewportNotDungeonView); _vm->delay(1); } if (fading) - _vm->_displayMan->startEndFadeToPalette(_vm->_displayMan->_paletteTopAndBottomScreen); + displMan.startEndFadeToPalette(displMan._paletteTopAndBottomScreen); - _vm->_displayMan->_drawFloorAndCeilingRequested = true; - _vm->_displayMan->updateScreen(); + displMan._drawFloorAndCeilingRequested = true; + displMan.updateScreen(); } void DialogMan::printCenteredChoice(byte *bitmap, const char *str, int16 posX, int16 posY) { @@ -158,96 +162,99 @@ bool DialogMan::isMessageOnTwoLines(const char *str, char *part1, char *part2) { } int16 DialogMan::getChoice(uint16 choiceCount, uint16 dialogSetIndex, int16 driveType, int16 automaticChoiceIfFlopyInDrive) { - _vm->_eventMan->hideMouse(); - MouseInput *primaryMouseInputBackup = _vm->_eventMan->_primaryMouseInput; - MouseInput *secondaryMouseInputBackup = _vm->_eventMan->_secondaryMouseInput; - KeyboardInput *primaryKeyboardInputBackup = _vm->_eventMan->_primaryKeyboardInput; - KeyboardInput *secondaryKeyboardInputBackup = _vm->_eventMan->_secondaryKeyboardInput; - _vm->_eventMan->_secondaryMouseInput = nullptr; - _vm->_eventMan->_primaryKeyboardInput = nullptr; - _vm->_eventMan->_secondaryKeyboardInput = nullptr; - _vm->_eventMan->_primaryMouseInput = _vm->_eventMan->_primaryMouseInputDialogSets[dialogSetIndex][choiceCount - 1]; - _vm->_eventMan->discardAllInput(); + EventManager &evtMan = *_vm->_eventMan; + DisplayMan &displMan = *_vm->_displayMan; + + evtMan.hideMouse(); + MouseInput *primaryMouseInputBackup = evtMan._primaryMouseInput; + MouseInput *secondaryMouseInputBackup = evtMan._secondaryMouseInput; + KeyboardInput *primaryKeyboardInputBackup = evtMan._primaryKeyboardInput; + KeyboardInput *secondaryKeyboardInputBackup = evtMan._secondaryKeyboardInput; + evtMan._secondaryMouseInput = nullptr; + evtMan._primaryKeyboardInput = nullptr; + evtMan._secondaryKeyboardInput = nullptr; + evtMan._primaryMouseInput = evtMan._primaryMouseInputDialogSets[dialogSetIndex][choiceCount - 1]; + evtMan.discardAllInput(); _selectedDialogChoice = 99; do { Common::Event key; - Common::EventType eventType = _vm->_eventMan->processInput(&key); - _vm->_eventMan->processCommandQueue(); + Common::EventType eventType = evtMan.processInput(&key); + evtMan.processCommandQueue(); _vm->delay(1); - _vm->_displayMan->updateScreen(); + displMan.updateScreen(); if ((_selectedDialogChoice == 99) && (choiceCount == 1) && (eventType != Common::EVENT_INVALID) && key.kbd.keycode == Common::KEYCODE_RETURN) { /* If a choice has not been made yet with the mouse and the dialog has only one possible choice and carriage return was pressed on the keyboard */ _selectedDialogChoice = kDMDialogChoice1; } } while (_selectedDialogChoice == 99); - _vm->_displayMan->_useByteBoxCoordinates = false; - Box boxA = _vm->_eventMan->_primaryMouseInput[_selectedDialogChoice - 1]._hitbox; + displMan._useByteBoxCoordinates = false; + Box boxA = evtMan._primaryMouseInput[_selectedDialogChoice - 1]._hitbox; boxA._rect.left -= 3; boxA._rect.right += 3; boxA._rect.top -= 3; boxA._rect.bottom += 4; - _vm->_eventMan->showMouse(); - _vm->_displayMan->_drawFloorAndCeilingRequested = true; + evtMan.showMouse(); + displMan._drawFloorAndCeilingRequested = true; Box boxB(0, 0, boxA._rect.right - boxA._rect.left + 3, boxA._rect.bottom - boxA._rect.top + 3); - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _vm->_displayMan->_bitmapViewport, + displMan.blitToBitmap(displMan._bitmapScreen, displMan._bitmapViewport, boxB, boxA._rect.left, boxA._rect.top, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 200, 25); _vm->delay(1); boxB = boxA; boxB._rect.bottom = boxB._rect.top; - _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); + displMan.fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; boxB._rect.right = boxB._rect.left; boxB._rect.bottom--; - _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); + displMan.fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; boxB._rect.bottom--; boxB._rect.top = boxB._rect.bottom; boxB._rect.left -= 2; - _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); + displMan.fillScreenBox(boxB, kDMColorBlack); boxB = boxA; boxB._rect.left = boxB._rect.right; - _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); + displMan.fillScreenBox(boxB, kDMColorBlack); _vm->delay(2); boxB = boxA; boxB._rect.top++; boxB._rect.bottom = boxB._rect.top; boxB._rect.right -= 2; - _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); + displMan.fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; boxB._rect.left++; boxB._rect.right = boxB._rect.left; boxB._rect.bottom--; - _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); + displMan.fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; boxB._rect.right--; boxB._rect.left = boxB._rect.right; - _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); + displMan.fillScreenBox(boxB, kDMColorBlack); boxB = boxA; boxB._rect.top = boxB._rect.bottom = boxB._rect.bottom - 2; boxB._rect.left++; - _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); + displMan.fillScreenBox(boxB, kDMColorBlack); boxB = boxA; boxB._rect.top = boxB._rect.bottom = boxB._rect.bottom + 2; boxB._rect.left--; boxB._rect.right += 2; - _vm->_displayMan->fillScreenBox(boxB, kDMColorLightestGray); + displMan.fillScreenBox(boxB, kDMColorLightestGray); boxB = boxA; boxB._rect.left = boxB._rect.right = boxB._rect.right + 3; boxB._rect.bottom += 2; - _vm->_displayMan->fillScreenBox(boxB, kDMColorLightestGray); + displMan.fillScreenBox(boxB, kDMColorLightestGray); _vm->delay(2); boxA._rect.right += 3; boxA._rect.bottom += 3; - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapScreen, + displMan.blitToBitmap(displMan._bitmapViewport, displMan._bitmapScreen, boxA, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 25, k200_heightScreen); - _vm->_eventMan->hideMouse(); - _vm->_eventMan->_primaryMouseInput = primaryMouseInputBackup; - _vm->_eventMan->_secondaryMouseInput = secondaryMouseInputBackup; - _vm->_eventMan->_primaryKeyboardInput = primaryKeyboardInputBackup; - _vm->_eventMan->_secondaryKeyboardInput = secondaryKeyboardInputBackup; - _vm->_eventMan->discardAllInput(); - _vm->_eventMan->showMouse(); + evtMan.hideMouse(); + evtMan._primaryMouseInput = primaryMouseInputBackup; + evtMan._secondaryMouseInput = secondaryMouseInputBackup; + evtMan._primaryKeyboardInput = primaryKeyboardInputBackup; + evtMan._secondaryKeyboardInput = secondaryKeyboardInputBackup; + evtMan.discardAllInput(); + evtMan.showMouse(); return _selectedDialogChoice; } } diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 2886c6c66b..bdc565b7a5 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -786,23 +786,24 @@ void DungeonMan::setCurrentMap(uint16 mapIndex) { } void DungeonMan::setCurrentMapAndPartyMap(uint16 mapIndex) { - setCurrentMap(_partyMapIndex = mapIndex); + DisplayMan &displMan = *_vm->_displayMan; + setCurrentMap(_partyMapIndex = mapIndex); byte *metaMapData = _currMapData[_currMapWidth - 1] + _currMapHeight; - _vm->_displayMan->_currMapAllowedCreatureTypes = metaMapData; + displMan._currMapAllowedCreatureTypes = metaMapData; metaMapData += _currMap->_creatureTypeCount; - memcpy(_vm->_displayMan->_currMapWallOrnIndices, metaMapData, _currMap->_wallOrnCount); + memcpy(displMan._currMapWallOrnIndices, metaMapData, _currMap->_wallOrnCount); metaMapData += _currMap->_wallOrnCount; - memcpy(_vm->_displayMan->_currMapFloorOrnIndices, metaMapData, _currMap->_floorOrnCount); + memcpy(displMan._currMapFloorOrnIndices, metaMapData, _currMap->_floorOrnCount); metaMapData += _currMap->_floorOrnCount; - memcpy(_vm->_displayMan->_currMapDoorOrnIndices, metaMapData, _currMap->_doorOrnCount); + memcpy(displMan._currMapDoorOrnIndices, metaMapData, _currMap->_doorOrnCount); _currMapInscriptionWallOrnIndex = _currMap->_wallOrnCount; - _vm->_displayMan->_currMapWallOrnIndices[_currMapInscriptionWallOrnIndex] = k0_WallOrnInscription; + displMan._currMapWallOrnIndices[_currMapInscriptionWallOrnIndex] = k0_WallOrnInscription; } @@ -865,6 +866,8 @@ void DungeonMan::setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, #define AL0307_uc_FootprintsAllowed L0307_uc_Multiple #define AL0307_uc_ScentOrdinal L0307_uc_Multiple + DisplayMan &displMan = *_vm->_displayMan; + for (uint16 i = 0; i < 5; ++i) aspectArray[i] = 0; @@ -902,7 +905,7 @@ void DungeonMan::setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, default: assert(false); } - _vm->_displayMan->_championPortraitOrdinal = 0; + displMan._championPortraitOrdinal = 0; squareIsFakeWall = false; T0172010_ClosedFakeWall: setSquareAspectOrnOrdinals(aspectArray, leftRandomWallOrnamentAllowed, frontRandomWallOrnamentAllowed, rightRandomWallOrnamentAllowed, dir, mapX, mapY, squareIsFakeWall); @@ -914,12 +917,12 @@ T0172010_ClosedFakeWall: if (curThingType == kDMstringTypeText) { if (((TextString *)curSensor)->isVisible()) { aspectArray[AL0310_i_SideIndex + 1] = _currMapInscriptionWallOrnIndex + 1; - _vm->_displayMan->_inscriptionThing = curThing; /* BUG0_76 The same text is drawn on multiple sides of a wall square. The engine stores only a single text to draw on a wall in a global variable. Even if different texts are placed on different sides of the wall, the same text is drawn on each affected side */ + displMan._inscriptionThing = curThing; /* BUG0_76 The same text is drawn on multiple sides of a wall square. The engine stores only a single text to draw on a wall in a global variable. Even if different texts are placed on different sides of the wall, the same text is drawn on each affected side */ } } else { aspectArray[AL0310_i_SideIndex + 1] = curSensor->getAttrOrnOrdinal(); if (curSensor->getType() == kDMSensorWallChampionPortrait) { - _vm->_displayMan->_championPortraitOrdinal = _vm->indexToOrdinal(curSensor->getData()); + displMan._championPortraitOrdinal = _vm->indexToOrdinal(curSensor->getData()); } } } @@ -1027,8 +1030,9 @@ int16 DungeonMan::getRandomOrnOrdinal(bool allowed, int16 count, int16 mapX, int bool DungeonMan::isWallOrnAnAlcove(int16 wallOrnIndex) { if (wallOrnIndex >= 0) { + DisplayMan &displMan = *_vm->_displayMan; for (uint16 i = 0; i < k3_AlcoveOrnCount; ++i) { - if (_vm->_displayMan->_currMapAlcoveOrnIndices[i] == wallOrnIndex) + if (displMan._currMapAlcoveOrnIndices[i] == wallOrnIndex) return true; } } diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 2fc0e5e0ab..1cd2c048c5 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -449,31 +449,35 @@ void EventManager::setPointerToObject(byte *bitmap) { static Box boxMousePointerObjectShadow(2, 17, 2, 17); // @ G0619_s_Box_MousePointer_ObjectShadow static Box boxMousePointerObject(0, 15, 0, 15); // @ G0620_s_Box_MousePointer_Object + DisplayMan &displMan = *_vm->_displayMan; + _preventBuildPointerScreenArea = true; _useObjectAsMousePointerBitmap = true; _useHandAsMousePointerBitmap = false; _mousePointerBitmapUpdated = true; - _vm->_displayMan->_useByteBoxCoordinates = true; + displMan._useByteBoxCoordinates = true; byte *L0051_puc_Bitmap = _mousePointerOriginalColorsObject; memset(L0051_puc_Bitmap, 0, 32 * 18); - _vm->_displayMan->blitToBitmapShrinkWithPalChange(bitmap, _mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousepointerOjbectIconShadow); - _vm->_displayMan->blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kDMColorNoTransparency, 16, 18); - _vm->_displayMan->blitToBitmapShrinkWithPalChange(bitmap, _mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousePointerIcon); - _vm->_displayMan->blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, kDMColorBlack, 16, 18); + displMan.blitToBitmapShrinkWithPalChange(bitmap, _mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousepointerOjbectIconShadow); + displMan.blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kDMColorNoTransparency, 16, 18); + displMan.blitToBitmapShrinkWithPalChange(bitmap, _mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousePointerIcon); + displMan.blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, kDMColorBlack, 16, 18); _preventBuildPointerScreenArea = false; buildpointerScreenArea(_mousePos.x, _mousePos.y); } void EventManager::mouseDropChampionIcon() { + DisplayMan &displMan = *_vm->_displayMan; + _preventBuildPointerScreenArea = true; uint16 championIconIndex = _vm->ordinalToIndex(_useChampionIconOrdinalAsMousePointerBitmap); _useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(kDMChampionNone); _mousePointerBitmapUpdated = true; - bool useByteBoxCoordinatesBackup = _vm->_displayMan->_useByteBoxCoordinates; - _vm->_displayMan->blitToScreen(_mousePointerOriginalColorsChampionIcon, &_vm->_championMan->_boxChampionIcons[championIconIndex << 2], 16, kDMColorDarkestGray, 18); - _vm->_displayMan->_useByteBoxCoordinates = useByteBoxCoordinatesBackup; + bool useByteBoxCoordinatesBackup = displMan._useByteBoxCoordinates; + displMan.blitToScreen(_mousePointerOriginalColorsChampionIcon, &_vm->_championMan->_boxChampionIcons[championIconIndex << 2], 16, kDMColorDarkestGray, 18); + displMan._useByteBoxCoordinates = useByteBoxCoordinatesBackup; _preventBuildPointerScreenArea = false; } @@ -719,6 +723,9 @@ void EventManager::processCommandQueue() { static MouseInput *primaryMouseInputBackup; static MouseInput *secondaryMouseInputBackup; + DisplayMan &displMan = *_vm->_displayMan; + TextMan &txtMan = *_vm->_textMan; + _isCommandQueueLocked = true; if (_commandQueue.empty()) { /* If the command queue is empty */ _isCommandQueueLocked = false; @@ -836,7 +843,7 @@ void EventManager::processCommandQueue() { _vm->_menuMan->drawDisabledMenu(); _vm->_championMan->_partyIsSleeping = true; drawSleepScreen(); - _vm->_displayMan->drawViewport(k2_viewportAsBeforeSleepOrFreezeGame); + displMan.drawViewport(k2_viewportAsBeforeSleepOrFreezeGame); _vm->_waitForInputMaxVerticalBlankCount = 0; _primaryMouseInput = _primaryMouseInputPartySleeping; _secondaryMouseInput = 0; @@ -862,24 +869,24 @@ void EventManager::processCommandQueue() { if (cmdType == kDMCommandFreezeGame) { _vm->_gameTimeTicking = false; _vm->_menuMan->drawDisabledMenu(); - _vm->_displayMan->fillBitmap(_vm->_displayMan->_bitmapViewport, kDMColorBlack, 112, 136); + displMan.fillBitmap(displMan._bitmapViewport, kDMColorBlack, 112, 136); switch (_vm->getGameLanguage()) { // localized default: case Common::EN_ANY: - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 81, 69, kDMColorCyan, kDMColorBlack, + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, 81, 69, kDMColorCyan, kDMColorBlack, "GAME FROZEN", k136_heightViewport); break; case Common::DE_DEU: - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 66, 69, kDMColorCyan, kDMColorBlack, + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, 66, 69, kDMColorCyan, kDMColorBlack, "SPIEL ANGEHALTEN", k136_heightViewport); break; case Common::FR_FRA: - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 84, 69, kDMColorCyan, kDMColorBlack, + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, 84, 69, kDMColorCyan, kDMColorBlack, "JEU BLOQUE", k136_heightViewport); break; } - _vm->_displayMan->drawViewport(k2_viewportAsBeforeSleepOrFreezeGame); + displMan.drawViewport(k2_viewportAsBeforeSleepOrFreezeGame); primaryMouseInputBackup = _primaryMouseInput; secondaryMouseInputBackup = _secondaryMouseInput; primaryKeyboardInputBackup = _primaryKeyboardInput; @@ -1244,6 +1251,7 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane InventoryMan &invMan = *_vm->_inventoryMan; DisplayMan &dispMan = *_vm->_displayMan; DungeonMan &dunMan = *_vm->_dungeonMan; + TextMan &txtMan = *_vm->_textMan; uint16 championIndex = champMan._partyChampionCount - 1; Champion *champ = &champMan._champions[championIndex]; @@ -1306,20 +1314,20 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane } else _vm->_menuMan->drawSpellAreaControls(champMan._magicCasterChampionIndex); - _vm->_textMan->printLineFeed(); + txtMan.printLineFeed(); Color champColor = _vm->_championMan->_championColor[championIndex]; - _vm->_textMan->printMessage(champColor, champ->_name); + txtMan.printMessage(champColor, champ->_name); switch (_vm->getGameLanguage()) { // localized default: case Common::EN_ANY: - _vm->_textMan->printMessage(champColor, (commandType == kDMCommandClickInPanelResurrect) ? " RESURRECTED." : " REINCARNATED."); + txtMan.printMessage(champColor, (commandType == kDMCommandClickInPanelResurrect) ? " RESURRECTED." : " REINCARNATED."); break; case Common::DE_DEU: - _vm->_textMan->printMessage(champColor, (commandType == kDMCommandClickInPanelResurrect) ? " VOM TODE ERWECKT." : " REINKARNIERT."); + txtMan.printMessage(champColor, (commandType == kDMCommandClickInPanelResurrect) ? " VOM TODE ERWECKT." : " REINKARNIERT."); break; case Common::FR_FRA: - _vm->_textMan->printMessage(champColor, (commandType == kDMCommandClickInPanelResurrect) ? " RESSUSCITE." : " REINCARNE."); + txtMan.printMessage(champColor, (commandType == kDMCommandClickInPanelResurrect) ? " RESSUSCITE." : " REINCARNE."); break; } @@ -1339,7 +1347,7 @@ void EventManager::commandProcess81ClickInPanel(int16 x, int16 y) { return; commandType = getCommandTypeFromMouseInput(_mouseInputPanelChest, Common::Point(x, y), kDMMouseButtonLeft); if (commandType != kDMCommandNone) - _vm->_championMan->clickOnSlotBox(commandType - kDMCommandClickOnSlotBoxChampion0StatusBoxReadyHand); + champMan.clickOnSlotBox(commandType - kDMCommandClickOnSlotBoxChampion0StatusBoxReadyHand); break; case kDMPanelContentResurrectReincarnate: if (!champMan._leaderEmptyHanded) @@ -1417,17 +1425,20 @@ bool EventManager::hasPendingClick(Common::Point& point, MouseButton button) { } void EventManager::drawSleepScreen() { - _vm->_displayMan->fillBitmap(_vm->_displayMan->_bitmapViewport, kDMColorBlack, 112, 136); + DisplayMan &displMan = *_vm->_displayMan; + TextMan &txtMan = *_vm->_textMan; + + displMan.fillBitmap(displMan._bitmapViewport, kDMColorBlack, 112, 136); switch (_vm->getGameLanguage()) { // localized default: case Common::EN_ANY: - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 93, 69, kDMColorCyan, kDMColorBlack, "WAKE UP", k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, 93, 69, kDMColorCyan, kDMColorBlack, "WAKE UP", k136_heightViewport); break; case Common::DE_DEU: - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 96, 69, kDMColorCyan, kDMColorBlack, "WECKEN", k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, 96, 69, kDMColorCyan, kDMColorBlack, "WECKEN", k136_heightViewport); break; case Common::FR_FRA: - _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 72, 69, kDMColorCyan, kDMColorBlack, "REVEILLEZ-VOUS", k136_heightViewport); + txtMan.printTextToBitmap(displMan._bitmapViewport, k112_byteWidthViewport, 72, 69, kDMColorCyan, kDMColorBlack, "REVEILLEZ-VOUS", k136_heightViewport); break; } } @@ -1466,6 +1477,8 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ static Box championIconBox = Box(0, 18, 0, 13); static byte mousePointerIconShadowBox[16] = {0, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 0, 120, 120, 120}; + DisplayMan &displMan = *_vm->_displayMan; + _preventBuildPointerScreenArea = true; if (!_useChampionIconOrdinalAsMousePointerBitmap) { if (_vm->_championMan->getIndexInCell(_vm->normalizeModulo4(champIconIndex + _vm->_dungeonMan->_partyDir)) == kDMChampionNone) { @@ -1474,15 +1487,15 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ } _mousePointerBitmapUpdated = true; _useChampionIconOrdinalAsMousePointerBitmap = true; - _vm->_displayMan->_useByteBoxCoordinates = false; + displMan._useByteBoxCoordinates = false; byte *tmpBitmap = _mousePointerTempBuffer; memset(tmpBitmap, 0, 32 * 18); Box *curChampionIconBox = &_vm->_championMan->_boxChampionIcons[champIconIndex]; - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, tmpBitmap, championIconShadowBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); - _vm->_displayMan->blitToBitmapShrinkWithPalChange(tmpBitmap, _mousePointerOriginalColorsChampionIcon, 32, 18, 32, 18, mousePointerIconShadowBox); - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _mousePointerOriginalColorsChampionIcon, championIconBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); - _vm->_displayMan->fillScreenBox(*curChampionIconBox, kDMColorBlack); + displMan.blitToBitmap(displMan._bitmapScreen, tmpBitmap, championIconShadowBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); + displMan.blitToBitmapShrinkWithPalChange(tmpBitmap, _mousePointerOriginalColorsChampionIcon, 32, 18, 32, 18, mousePointerIconShadowBox); + displMan.blitToBitmap(displMan._bitmapScreen, _mousePointerOriginalColorsChampionIcon, championIconBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); + displMan.fillScreenBox(*curChampionIconBox, kDMColorBlack); _useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(champIconIndex); } else { _mousePointerBitmapUpdated = true; @@ -1499,7 +1512,7 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ setFlag(_vm->_championMan->_champions[championIndex]._attributes, kDMAttributeIcon); _vm->_championMan->drawChampionState((ChampionIndex)championIndex); } else - _vm->_displayMan->fillScreenBox(_vm->_championMan->_boxChampionIcons[championIconIndex], kDMColorBlack); + displMan.fillScreenBox(_vm->_championMan->_boxChampionIcons[championIconIndex], kDMColorBlack); _vm->_championMan->_champions[championCellIndex]._cell = (ViewCell)_vm->normalizeModulo4(champIconIndex + _vm->_dungeonMan->_partyDir); setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, kDMAttributeIcon); @@ -1639,6 +1652,7 @@ void EventManager::resetPressingEyeOrMouth() { void EventManager::waitForMouseOrKeyActivity() { discardAllInput(); Common::Event event; + DisplayMan &displMan = *_vm->_displayMan; while (true) { if (g_system->getEventManager()->pollEvent(event)) { switch (event.type) { @@ -1653,7 +1667,7 @@ void EventManager::waitForMouseOrKeyActivity() { } } _vm->delay(1); - _vm->_displayMan->updateScreen(); + displMan.updateScreen(); } } diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index 6e07ad49f6..eeafc4d951 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -701,6 +701,7 @@ Thing MovesensMan::getTeleporterRotatedProjectileThing(Teleporter *teleporter, T void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing thing, bool partySquare, bool addThing) { DungeonMan &dungeon = *_vm->_dungeonMan; + TextMan &txtMan = *_vm->_textMan; int16 thingType; IconIndice objectType; @@ -734,7 +735,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing squareContainsGroup = true; else if ((curThingType == kDMstringTypeText) && (thingType == kDMThingTypeParty) && addThing && !partySquare) { dungeon.decodeText(_vm->_stringBuildBuffer, curThing, kDMTextTypeMessage); - _vm->_textMan->printMessage(kDMColorWhite, _vm->_stringBuildBuffer); + txtMan.printMessage(kDMColorWhite, _vm->_stringBuildBuffer); } else if ((curThingType > kDMThingTypeGroup) && (curThingType < kDMThingTypeProjectile)) { squareContainsObject = true; squareContainsThingOfSameType |= (_vm->_objectMan->getObjectType(curThing) == objectType); |