aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2016-06-23 23:12:39 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit45461a4908bfab95fa41ff90aba2e697b2581c96 (patch)
tree46aad99288667af3337b018b948971b542add6cd
parentfab051093691fdcf3f29662e95699bc080f5602a (diff)
downloadscummvm-rg350-45461a4908bfab95fa41ff90aba2e697b2581c96.tar.gz
scummvm-rg350-45461a4908bfab95fa41ff90aba2e697b2581c96.tar.bz2
scummvm-rg350-45461a4908bfab95fa41ff90aba2e697b2581c96.zip
DM: Fix compilation on GCC
-rw-r--r--engines/dm/champion.cpp10
-rw-r--r--engines/dm/dm.cpp8
-rw-r--r--engines/dm/dm.h2
-rw-r--r--engines/dm/dungeonman.cpp10
-rw-r--r--engines/dm/dungeonman.h5
-rw-r--r--engines/dm/eventman.cpp2
-rw-r--r--engines/dm/gfx.cpp4
-rw-r--r--engines/dm/inventory.cpp12
-rw-r--r--engines/dm/menus.cpp2
9 files changed, 28 insertions, 27 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 6f2aa4ac54..8579fb63a5 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -432,7 +432,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
kChampionAttributeActionHand))) {
return;
}
- bool isInventoryChamp = (indexToOrdinal(champIndex) == invMan._inventoryChampionOrdinal);
+ bool isInventoryChamp = (_vm->indexToOrdinal(champIndex) == invMan._inventoryChampionOrdinal);
dispMan._useByteBoxCoordinates = false;
if (champAttributes & kChampionAttributeStatusBox) {
box._y1 = 0;
@@ -537,7 +537,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
{ // block so goto won't skip AL_0_championIconIndex initialization
int16 AL_0_championIconIndex = championIconIndex(champ->_cell, _vm->_dungeonMan->_currMap._partyDir);
- if ((champAttributes & kChampionIcons) && (eventMan._useChampionIconOrdinalAsMousePointerBitmap != indexToOrdinal(AL_0_championIconIndex))) {
+ if ((champAttributes & kChampionIcons) && (eventMan._useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(AL_0_championIconIndex))) {
dispMan.clearScreenBox(gChampionColor[champIndex], gBoxChampionIcons[AL_0_championIconIndex]);
dispMan.blitToScreen(dispMan.getBitmap(kChampionIcons), 80, championIconIndex(champ->_dir, _vm->_dungeonMan->_currMap._partyDir) * 19, 0,
gBoxChampionIcons[AL_0_championIconIndex], kColorDarkestGray);
@@ -590,11 +590,11 @@ void ChampionMan::drawHealthStaminaManaValues(Champion* champ) {
void ChampionMan::drawSlot(uint16 champIndex, ChampionSlot slotIndex) {
int16 nativeBitmapIndex = -1;
Champion *champ = &_champions[champIndex];
- bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == indexToOrdinal(champIndex));
+ bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex));
uint16 slotBoxIndex;
if (!isInventoryChamp) { /* If drawing a slot for a champion other than the champion whose inventory is open */
- if ((slotIndex > kChampionSlotActionHand) || (_candidateChampionOrdinal == indexToOrdinal(champIndex))) {
+ if ((slotIndex > kChampionSlotActionHand) || (_candidateChampionOrdinal == _vm->indexToOrdinal(champIndex))) {
return;
}
slotBoxIndex = (champIndex << 1) + slotIndex;
@@ -654,7 +654,7 @@ void ChampionMan::drawSlot(uint16 champIndex, ChampionSlot slotIndex) {
}
}
- if ((slotIndex == kChampionSlotActionHand) && (indexToOrdinal(champIndex) == _actingChampionOrdinal)) {
+ if ((slotIndex == kChampionSlotActionHand) && (_vm->indexToOrdinal(champIndex) == _actingChampionOrdinal)) {
nativeBitmapIndex = kSlotBoxActingHandIndice;
}
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index fec043a253..aa4290f0a8 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -232,4 +232,12 @@ void DMEngine::gameloop() {
}
}
+int16 DMEngine::ordinalToIndex(int16 val) {
+ return val - 1;
+}
+
+int16 DMEngine::indexToOrdinal(int16 val) {
+ return val + 1;
+}
+
} // End of namespace DM
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 2c8ff1c1b9..e9ab80fff9 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -127,6 +127,8 @@ public:
explicit DMEngine(OSystem *syst);
~DMEngine();
+ int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
+ int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
virtual Common::Error run(); // @ main
private:
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index dcf2325d2a..d9480820ae 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -359,10 +359,6 @@ CreatureInfo gCreatureInfo[kCreatureTypeCount] = { // @ G0243_as_Graphic559_Crea
{25, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5},
{26, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}};
-int16 DM::ordinalToIndex(int16 val) { return val - 1; }
-int16 DM::indexToOrdinal(int16 val) { return val + 1; }
-
-
void DungeonMan::mapCoordsAfterRelMovement(direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY) {
posX += _dirIntoStepCountEast[dir] * stepsForward;
posY += _dirIntoStepCountNorth[dir] * stepsForward;
@@ -863,7 +859,7 @@ T0172010_ClosedFakeWall:
Sensor sensor(getThingData(thing));
aspectArray[sideIndex + 1] = sensor.getOrnOrdinal();
if (sensor.getType() == kSensorWallChampionPortrait) {
- _vm->_displayMan->_championPortraitOrdinal = indexToOrdinal(sensor.getData());
+ _vm->_displayMan->_championPortraitOrdinal = _vm->indexToOrdinal(sensor.getData());
}
}
}
@@ -946,7 +942,7 @@ void DungeonMan::setSquareAspectOrnOrdinals(uint16 *aspectArray, bool leftAllowe
if (isFakeWall || mapX < 0 || mapX >= _currMap._width || mapY < 0 || mapY >= _currMap._height) {
for (uint16 i = kRightWallOrnOrdAspect; i <= kLeftWallOrnOrdAspect; ++i) {
- if (isWallOrnAnAlcove(ordinalToIndex(aspectArray[i])))
+ if (isWallOrnAnAlcove(_vm->ordinalToIndex(aspectArray[i])))
aspectArray[i] = 0;
}
}
@@ -957,7 +953,7 @@ int16 DungeonMan::getRandomOrnOrdinal(bool allowed, int16 count, int16 mapX, int
+ (3000 + (_currMap._index << 6) + _currMap._width + _currMap._height) * 11
+ _fileHeader._ornamentRandomSeed) >> 2) % modulo;
if (allowed && index < count)
- return indexToOrdinal(index);
+ return _vm->indexToOrdinal(index);
return 0;
}
diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h
index df2069f937..5191ba9867 100644
--- a/engines/dm/dungeonman.h
+++ b/engines/dm/dungeonman.h
@@ -143,11 +143,6 @@ public:
extern WeaponInfo gWeaponInfo[46];
-
-int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
-int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
-
-
enum TextType {
/* Used for text on walls */
kTextTypeInscription = 0, // @ C0_TEXT_TYPE_INSCRIPTION
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index fcfc975fca..0b76af34ef 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -499,7 +499,7 @@ void EventManager::commandSetLeader(ChampionIndex champIndex) {
Champion *champion = &cm._champions[cm._leaderIndex];
champion->_dir = _vm->_dungeonMan->_currMap._partyDir;
cm._champions[champIndex]._load += _vm->_dungeonMan->getObjectWeight(cm._leaderHand);
- if (indexToOrdinal(champIndex) != cm._candidateChampionOrdinal) {
+ if (_vm->indexToOrdinal(champIndex) != cm._candidateChampionOrdinal) {
champion->setAttributeFlag(kChampionAttributeIcon, true);
champion->setAttributeFlag(kChampionAttributeNameTitle, true);
cm.drawChampionState(champIndex);
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index d9bb6af6fa..f5d58838fa 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1350,10 +1350,10 @@ void DisplayMan::loadCurrentMapGraphics() {
CreatureAspect &aspect = gCreatureAspects[_currMapAllowedCreatureTypes[creatureType]];
uint16 replColorOrdinal = aspect.getReplColour9();
if (replColorOrdinal)
- applyCreatureReplColors(9, ordinalToIndex(replColorOrdinal));
+ applyCreatureReplColors(9, _vm->ordinalToIndex(replColorOrdinal));
replColorOrdinal = aspect.getReplColour10();
if (replColorOrdinal)
- applyCreatureReplColors(10, ordinalToIndex(replColorOrdinal));
+ applyCreatureReplColors(10, _vm->ordinalToIndex(replColorOrdinal));
}
}
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 7dd1b0042f..ab57883fbf 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -59,18 +59,18 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
return;
_vm->_stopWaitingForPlayerInput = true;
int16 invChampOrdinal = _inventoryChampionOrdinal; // copy, as the original will be edited
- if (indexToOrdinal(championIndex) == invChampOrdinal) {
+ if (_vm->indexToOrdinal(championIndex) == invChampOrdinal) {
championIndex = kChmpionCloseInventory;
}
Champion *champion;
if (invChampOrdinal) {
- _inventoryChampionOrdinal = indexToOrdinal(kChampionNone);
+ _inventoryChampionOrdinal = _vm->indexToOrdinal(kChampionNone);
warning("MISSING CODE: F0334_INVENTORY_CloseChest");
- champion = &cm._champions[ordinalToIndex(invChampOrdinal)];
+ champion = &cm._champions[_vm->ordinalToIndex(invChampOrdinal)];
if (champion->_currHealth && !cm._candidateChampionOrdinal) {
champion->setAttributeFlag(kChampionAttributeStatusBox, true);
- cm.drawChampionState((ChampionIndex)ordinalToIndex(invChampOrdinal));
+ cm.drawChampionState((ChampionIndex)_vm->ordinalToIndex(invChampOrdinal));
}
if (cm._partyIsSleeping) {
return;
@@ -86,7 +86,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
}
dm._useByteBoxCoordinates = false;
- _inventoryChampionOrdinal = indexToOrdinal(championIndex);
+ _inventoryChampionOrdinal = _vm->indexToOrdinal(championIndex);
if (!invChampOrdinal) {
warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
}
@@ -185,7 +185,7 @@ void InventoryMan::drawPanel() {
return;
}
- Thing thing = cm._champions[ordinalToIndex(_inventoryChampionOrdinal)].getSlot(kChampionSlotActionHand);
+ Thing thing = cm._champions[_vm->ordinalToIndex(_inventoryChampionOrdinal)].getSlot(kChampionSlotActionHand);
_panelContent = kPanelContentFoodWaterPoisoned;
switch (thing.getType()) {
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index 7b971e53e1..f83fa6ecab 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -56,7 +56,7 @@ void MenuMan::clearActingChampion() {
cm._actingChampionOrdinal--;
cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true);
cm.drawChampionState((ChampionIndex)cm._actingChampionOrdinal);
- cm._actingChampionOrdinal = indexToOrdinal(kChampionNone);
+ cm._actingChampionOrdinal = _vm->indexToOrdinal(kChampionNone);
_shouldRefreshActionArea = true;
}
}