DM: Fix compilation on GCC

This commit is contained in:
Strangerke 2016-06-23 23:12:39 +02:00 committed by Bendegúz Nagy
parent fab0510936
commit 45461a4908
9 changed files with 28 additions and 27 deletions

View file

@ -432,7 +432,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
kChampionAttributeActionHand))) { kChampionAttributeActionHand))) {
return; return;
} }
bool isInventoryChamp = (indexToOrdinal(champIndex) == invMan._inventoryChampionOrdinal); bool isInventoryChamp = (_vm->indexToOrdinal(champIndex) == invMan._inventoryChampionOrdinal);
dispMan._useByteBoxCoordinates = false; dispMan._useByteBoxCoordinates = false;
if (champAttributes & kChampionAttributeStatusBox) { if (champAttributes & kChampionAttributeStatusBox) {
box._y1 = 0; box._y1 = 0;
@ -537,7 +537,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
{ // block so goto won't skip AL_0_championIconIndex initialization { // block so goto won't skip AL_0_championIconIndex initialization
int16 AL_0_championIconIndex = championIconIndex(champ->_cell, _vm->_dungeonMan->_currMap._partyDir); 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.clearScreenBox(gChampionColor[champIndex], gBoxChampionIcons[AL_0_championIconIndex]);
dispMan.blitToScreen(dispMan.getBitmap(kChampionIcons), 80, championIconIndex(champ->_dir, _vm->_dungeonMan->_currMap._partyDir) * 19, 0, dispMan.blitToScreen(dispMan.getBitmap(kChampionIcons), 80, championIconIndex(champ->_dir, _vm->_dungeonMan->_currMap._partyDir) * 19, 0,
gBoxChampionIcons[AL_0_championIconIndex], kColorDarkestGray); gBoxChampionIcons[AL_0_championIconIndex], kColorDarkestGray);
@ -590,11 +590,11 @@ void ChampionMan::drawHealthStaminaManaValues(Champion* champ) {
void ChampionMan::drawSlot(uint16 champIndex, ChampionSlot slotIndex) { void ChampionMan::drawSlot(uint16 champIndex, ChampionSlot slotIndex) {
int16 nativeBitmapIndex = -1; int16 nativeBitmapIndex = -1;
Champion *champ = &_champions[champIndex]; Champion *champ = &_champions[champIndex];
bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == indexToOrdinal(champIndex)); bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex));
uint16 slotBoxIndex; uint16 slotBoxIndex;
if (!isInventoryChamp) { /* If drawing a slot for a champion other than the champion whose inventory is open */ 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; return;
} }
slotBoxIndex = (champIndex << 1) + slotIndex; 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; nativeBitmapIndex = kSlotBoxActingHandIndice;
} }

View file

@ -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 } // End of namespace DM

View file

@ -127,6 +127,8 @@ public:
explicit DMEngine(OSystem *syst); explicit DMEngine(OSystem *syst);
~DMEngine(); ~DMEngine();
int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
virtual Common::Error run(); // @ main virtual Common::Error run(); // @ main
private: private:

View file

@ -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}, {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}}; {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) { void DungeonMan::mapCoordsAfterRelMovement(direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY) {
posX += _dirIntoStepCountEast[dir] * stepsForward; posX += _dirIntoStepCountEast[dir] * stepsForward;
posY += _dirIntoStepCountNorth[dir] * stepsForward; posY += _dirIntoStepCountNorth[dir] * stepsForward;
@ -863,7 +859,7 @@ T0172010_ClosedFakeWall:
Sensor sensor(getThingData(thing)); Sensor sensor(getThingData(thing));
aspectArray[sideIndex + 1] = sensor.getOrnOrdinal(); aspectArray[sideIndex + 1] = sensor.getOrnOrdinal();
if (sensor.getType() == kSensorWallChampionPortrait) { 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) { if (isFakeWall || mapX < 0 || mapX >= _currMap._width || mapY < 0 || mapY >= _currMap._height) {
for (uint16 i = kRightWallOrnOrdAspect; i <= kLeftWallOrnOrdAspect; ++i) { for (uint16 i = kRightWallOrnOrdAspect; i <= kLeftWallOrnOrdAspect; ++i) {
if (isWallOrnAnAlcove(ordinalToIndex(aspectArray[i]))) if (isWallOrnAnAlcove(_vm->ordinalToIndex(aspectArray[i])))
aspectArray[i] = 0; 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 + (3000 + (_currMap._index << 6) + _currMap._width + _currMap._height) * 11
+ _fileHeader._ornamentRandomSeed) >> 2) % modulo; + _fileHeader._ornamentRandomSeed) >> 2) % modulo;
if (allowed && index < count) if (allowed && index < count)
return indexToOrdinal(index); return _vm->indexToOrdinal(index);
return 0; return 0;
} }

View file

@ -143,11 +143,6 @@ public:
extern WeaponInfo gWeaponInfo[46]; extern WeaponInfo gWeaponInfo[46];
int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
enum TextType { enum TextType {
/* Used for text on walls */ /* Used for text on walls */
kTextTypeInscription = 0, // @ C0_TEXT_TYPE_INSCRIPTION kTextTypeInscription = 0, // @ C0_TEXT_TYPE_INSCRIPTION

View file

@ -499,7 +499,7 @@ void EventManager::commandSetLeader(ChampionIndex champIndex) {
Champion *champion = &cm._champions[cm._leaderIndex]; Champion *champion = &cm._champions[cm._leaderIndex];
champion->_dir = _vm->_dungeonMan->_currMap._partyDir; champion->_dir = _vm->_dungeonMan->_currMap._partyDir;
cm._champions[champIndex]._load += _vm->_dungeonMan->getObjectWeight(cm._leaderHand); 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(kChampionAttributeIcon, true);
champion->setAttributeFlag(kChampionAttributeNameTitle, true); champion->setAttributeFlag(kChampionAttributeNameTitle, true);
cm.drawChampionState(champIndex); cm.drawChampionState(champIndex);

View file

@ -1350,10 +1350,10 @@ void DisplayMan::loadCurrentMapGraphics() {
CreatureAspect &aspect = gCreatureAspects[_currMapAllowedCreatureTypes[creatureType]]; CreatureAspect &aspect = gCreatureAspects[_currMapAllowedCreatureTypes[creatureType]];
uint16 replColorOrdinal = aspect.getReplColour9(); uint16 replColorOrdinal = aspect.getReplColour9();
if (replColorOrdinal) if (replColorOrdinal)
applyCreatureReplColors(9, ordinalToIndex(replColorOrdinal)); applyCreatureReplColors(9, _vm->ordinalToIndex(replColorOrdinal));
replColorOrdinal = aspect.getReplColour10(); replColorOrdinal = aspect.getReplColour10();
if (replColorOrdinal) if (replColorOrdinal)
applyCreatureReplColors(10, ordinalToIndex(replColorOrdinal)); applyCreatureReplColors(10, _vm->ordinalToIndex(replColorOrdinal));
} }
} }

View file

@ -59,18 +59,18 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
return; return;
_vm->_stopWaitingForPlayerInput = true; _vm->_stopWaitingForPlayerInput = true;
int16 invChampOrdinal = _inventoryChampionOrdinal; // copy, as the original will be edited int16 invChampOrdinal = _inventoryChampionOrdinal; // copy, as the original will be edited
if (indexToOrdinal(championIndex) == invChampOrdinal) { if (_vm->indexToOrdinal(championIndex) == invChampOrdinal) {
championIndex = kChmpionCloseInventory; championIndex = kChmpionCloseInventory;
} }
Champion *champion; Champion *champion;
if (invChampOrdinal) { if (invChampOrdinal) {
_inventoryChampionOrdinal = indexToOrdinal(kChampionNone); _inventoryChampionOrdinal = _vm->indexToOrdinal(kChampionNone);
warning("MISSING CODE: F0334_INVENTORY_CloseChest"); warning("MISSING CODE: F0334_INVENTORY_CloseChest");
champion = &cm._champions[ordinalToIndex(invChampOrdinal)]; champion = &cm._champions[_vm->ordinalToIndex(invChampOrdinal)];
if (champion->_currHealth && !cm._candidateChampionOrdinal) { if (champion->_currHealth && !cm._candidateChampionOrdinal) {
champion->setAttributeFlag(kChampionAttributeStatusBox, true); champion->setAttributeFlag(kChampionAttributeStatusBox, true);
cm.drawChampionState((ChampionIndex)ordinalToIndex(invChampOrdinal)); cm.drawChampionState((ChampionIndex)_vm->ordinalToIndex(invChampOrdinal));
} }
if (cm._partyIsSleeping) { if (cm._partyIsSleeping) {
return; return;
@ -86,7 +86,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
} }
dm._useByteBoxCoordinates = false; dm._useByteBoxCoordinates = false;
_inventoryChampionOrdinal = indexToOrdinal(championIndex); _inventoryChampionOrdinal = _vm->indexToOrdinal(championIndex);
if (!invChampOrdinal) { if (!invChampOrdinal) {
warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
} }
@ -185,7 +185,7 @@ void InventoryMan::drawPanel() {
return; return;
} }
Thing thing = cm._champions[ordinalToIndex(_inventoryChampionOrdinal)].getSlot(kChampionSlotActionHand); Thing thing = cm._champions[_vm->ordinalToIndex(_inventoryChampionOrdinal)].getSlot(kChampionSlotActionHand);
_panelContent = kPanelContentFoodWaterPoisoned; _panelContent = kPanelContentFoodWaterPoisoned;
switch (thing.getType()) { switch (thing.getType()) {

View file

@ -56,7 +56,7 @@ void MenuMan::clearActingChampion() {
cm._actingChampionOrdinal--; cm._actingChampionOrdinal--;
cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true); cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true);
cm.drawChampionState((ChampionIndex)cm._actingChampionOrdinal); cm.drawChampionState((ChampionIndex)cm._actingChampionOrdinal);
cm._actingChampionOrdinal = indexToOrdinal(kChampionNone); cm._actingChampionOrdinal = _vm->indexToOrdinal(kChampionNone);
_shouldRefreshActionArea = true; _shouldRefreshActionArea = true;
} }
} }