From 9f324dff86466cd6a15f1b96ada4d835755498be Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 Sep 2016 22:07:02 +0200 Subject: DM: Silence some GCC warnings --- engines/dm/champion.cpp | 6 +++--- engines/dm/eventman.cpp | 4 ++-- engines/dm/gfx.cpp | 20 ++++++++++---------- engines/dm/gfx.h | 2 +- engines/dm/menus.cpp | 8 ++++---- engines/dm/movesens.cpp | 2 +- engines/dm/projexpl.cpp | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) (limited to 'engines') diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 27dca5af38..cc7a4ed876 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -1096,9 +1096,9 @@ bool ChampionMan::isLucky(Champion *champ, uint16 percentage) { return true; unsigned char *curStat = champ->_statistics[kDMStatLuck]; - bool isLucky = (_vm->getRandomNumber(curStat[kDMStatCurrent]) > percentage); - curStat[kDMStatCurrent] = CLIP(curStat[kDMStatMinimum], curStat[kDMStatCurrent] + (isLucky ? -2 : 2), curStat[kDMStatMaximum]); - return isLucky; + bool retVal = (_vm->getRandomNumber(curStat[kDMStatCurrent]) > percentage); + curStat[kDMStatCurrent] = CLIP(curStat[kDMStatMinimum], curStat[kDMStatCurrent] + (retVal ? -2 : 2), curStat[kDMStatMaximum]); + return retVal; } void ChampionMan::championPoison(int16 champIndex, uint16 attack) { diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index d791a9e9b6..b821acf182 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -1146,8 +1146,8 @@ void EventManager::commandSetLeader(ChampionIndex champIndex) { } void EventManager::commandProcessType80ClickInDungeonViewTouchFrontWall() { - uint16 mapX = _vm->_dungeonMan->_partyMapX + _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_partyDir]; - uint16 mapY = _vm->_dungeonMan->_partyMapY + _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_partyDir]; + int16 mapX = _vm->_dungeonMan->_partyMapX + _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_partyDir]; + int16 mapY = _vm->_dungeonMan->_partyMapY + _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_partyDir]; if ((mapX >= 0) && (mapX < _vm->_dungeonMan->_currMapWidth) && (mapY >= 0) && (mapY < _vm->_dungeonMan->_currMapHeight)) diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 87c4165903..d724d19b46 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -461,7 +461,7 @@ DisplayMan::~DisplayMan() { delete _doorFrameD1C; } -uint16 DisplayMan::bitmapByteCount(uint16 pixelWidth, uint16 height) { +uint16 DisplayMan::getBitmapByteCount(uint16 pixelWidth, uint16 height) { return pixelWidth / 2 * height; } @@ -1273,7 +1273,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k1_ViewSquare_D3L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3L, doorFrameLeftD3L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD3LCR, bitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3L); + _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3L); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1357,7 +1357,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) { drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD3LCR, - bitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3R); + getBitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3R); break;; case kDMElementTypePit: if (!squareAspect[kDMSquareAspectPitInvisible]) @@ -1434,7 +1434,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) { drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k1_ViewDoorOrnament_D2LCR); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD3LCR, bitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3C); + _doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), k0_ViewDoorOrnament_D3LCR, &doorFrameD3C); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1514,7 +1514,7 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k4_ViewSquare_D2L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD2LCR, - bitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2L); + getBitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2L); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1601,7 +1601,7 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k5_ViewSquare_D2R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2R); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD2LCR, bitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2R); + _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2R); order = k0x0439_CellOrder_DoorPass2_FrontRight_FrontLeft; break; case kDMElementTypePit: @@ -1684,7 +1684,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) { drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k2_viewDoorButton_D2C); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD2LCR, bitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2C); + _doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &doorFrameD2C); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: @@ -1769,7 +1769,7 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k7_ViewSquare_D1L, k0x0028_CellOrder_DoorPass1_BackRight); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1L); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD1LCR, bitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, &doorFrameD1L); + _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, &doorFrameD1L); order = k0x0039_CellOrder_DoorPass2_FrontRight; break; case kDMElementTypePit: @@ -1853,7 +1853,7 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) { drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k8_ViewSquare_D1R, k0x0018_CellOrder_DoorPass1_BackLeft); drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1R); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD1LCR, bitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, &doorFrameD1R); + _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, &doorFrameD1R); order = k0x0049_CellOrder_DoorPass2_FrontLeft; break; case kDMElementTypePit: @@ -1938,7 +1938,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k3_viewDoorButton_D1C); drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], squareAspect[kDMSquareAspectDoorState], - _doorNativeBitmapIndexFrontD1LCR, bitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, _doorFrameD1C); + _doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), k2_ViewDoorOrnament_D1LCR, _doorFrameD1C); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; break; case kDMElementTypePit: diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index f9aa3823aa..8d2a2b1ca2 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -825,7 +825,7 @@ public: private: void initConstants(); - uint16 bitmapByteCount(uint16 pixelWidth, uint16 height); // @ M75_BITMAP_BYTE_COUNT + uint16 getBitmapByteCount(uint16 pixelWidth, uint16 height); // @ M75_BITMAP_BYTE_COUNT }; } diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index e06aae8e26..7bc6d59950 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -1518,9 +1518,9 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac } bool MenuMan::isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, int16 mapX, int16 mapY) { - bool isGroupFrightenedByAction = false; + bool retVal = false; if (_actionTargetGroupThing == Thing::_endOfList) - return isGroupFrightenedByAction; + return retVal; uint16 experience = 0; int16 frightAmount = 0; @@ -1561,11 +1561,11 @@ bool MenuMan::isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, in } targetGroup->setBehaviour(k5_behavior_FLEE); activeGroup->_delayFleeingFromTarget = ((16 - fearResistance) << 2) / creatureInfo->_movementTicks; - isGroupFrightenedByAction = true; + retVal = true; } _vm->_championMan->addSkillExperience(champIndex, kDMSkillInfluence, experience); - return isGroupFrightenedByAction; + return retVal; } void MenuMan::printMessageAfterReplacements(const char *str) { diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index 8ff604ab78..37ae1382aa 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -657,7 +657,7 @@ int16 MovesensMan::getTeleporterRotatedGroupResult(Teleporter *teleporter, Thing int16 creatureSize = getFlag(_vm->_dungeonMan->_creatureInfos[group->_type]._attributes, k0x0003_MaskCreatureInfo_size); int16 relativeRotation = _vm->normalizeModulo4(4 + updatedGroupDirections - groupDirections); for (int16 creatureIdx = 0; creatureIdx <= group->getCount(); creatureIdx++) { - updatedGroupDirections = _vm->_groupMan->getGroupValueUpdatedWithCreatureValue(updatedGroupDirections, creatureIdx, absoluteRotation ? rotation : _vm->normalizeModulo4(groupDirections + rotation)); + updatedGroupDirections = _vm->_groupMan->getGroupValueUpdatedWithCreatureValue(updatedGroupDirections, creatureIdx, absoluteRotation ? (uint16)rotation : _vm->normalizeModulo4(groupDirections + rotation)); if (creatureSize == k0_MaskCreatureSizeQuarter) { relativeRotation = absoluteRotation ? 1 : 0; if (relativeRotation) diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 73bf1ace1b..ab521446f8 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -208,7 +208,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in } if ((projectileAssociatedThing == Thing::_explLightningBolt) && !(explosionAttack >>= 1)) goto T0217044; - createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); + createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? (uint16)k255_CreatureTypeSingleCenteredCreature : cell); } else { uint16 soundIndex; if ((projectileAssociatedThing).getType() == kDMThingTypeWeapon) -- cgit v1.2.3