Skip to content

Commit

Permalink
DM: Rename members of InventoryMan
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and Bendegúz Nagy committed Aug 26, 2016
1 parent 5c81e4f commit 5b05f3c
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 206 deletions.
62 changes: 31 additions & 31 deletions engines/dm/champion.cpp
Expand Up @@ -457,7 +457,7 @@ void ChampionMan::drawChangedObjectIcons() {
ObjectMan &objMan = *_vm->_objectMan;
MenuMan &menuMan = *_vm->_menuMan;

uint16 invChampOrdinal = invMan._g432_inventoryChampionOrdinal;
uint16 invChampOrdinal = invMan._inventoryChampionOrdinal;
if (_candidateChampionOrdinal && !invChampOrdinal)
return;

Expand Down Expand Up @@ -503,8 +503,8 @@ void ChampionMan::drawChangedObjectIcons() {
}
}

if (invMan._g424_panelContent == k4_PanelContentChest) {
thing = invMan._g425_chestSlots;
if (invMan._panelContent == k4_PanelContentChest) {
thing = invMan._chestSlots;
for (int16 slotIndex = 0; slotIndex < 8; ++slotIndex, thing++) {
drawViewport |= (hasObjectIconInSlotBoxChanged(slotIndex + k38_SlotBoxChestFirstSlot, *thing) ? 1 : 0);
}
Expand Down Expand Up @@ -532,15 +532,15 @@ void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, Champio
Champion *champ = &_champions[champIndex];

if (slotIndex >= k30_ChampionSlotChest_1) {
invMan._g425_chestSlots[slotIndex - k30_ChampionSlotChest_1] = thing;
invMan._chestSlots[slotIndex - k30_ChampionSlotChest_1] = thing;
} else {
champ->setSlot(slotIndex, thing);
}

champ->_load += dunMan.getObjectWeight(thing);
champ->setAttributeFlag(k0x0200_ChampionAttributeLoad, true);
IconIndice iconIndex = objMan.f33_getIconIndex(thing);
bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == invMan._g432_inventoryChampionOrdinal);
bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == invMan._inventoryChampionOrdinal);
applyModifiersToStatistics(champ, slotIndex, iconIndex, 1, thing);
uint16 *rawObjPtr = dunMan.getThingData(thing);

Expand All @@ -558,7 +558,7 @@ void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, Champio

if (iconIndex == k4_IconIndiceWeaponTorchUnlit) {
((Weapon *)rawObjPtr)->setLit(true);
_vm->_inventoryMan->f337_setDungeonViewPalette();
_vm->_inventoryMan->setDungeonViewPalette();
drawChangedObjectIcons();
} else if (isInventoryChampion && (slotIndex == k1_ChampionSlotActionHand) &&
((iconIndex == k144_IconIndiceContainerChestClosed) || ((iconIndex >= k30_IconIndiceScrollOpen) && (iconIndex <= k31_IconIndiceScrollClosed)))) {
Expand All @@ -568,7 +568,7 @@ void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, Champio
if ((iconIndex >= k12_IconIndiceJunkIllumuletUnequipped) && (iconIndex <= k13_IconIndiceJunkIllumuletEquipped)) {
((Junk *)rawObjPtr)->setChargeCount(1);
_party._magicalLightAmount += _lightPowerToLightAmount[2];
_vm->_inventoryMan->f337_setDungeonViewPalette();
_vm->_inventoryMan->setDungeonViewPalette();
iconIndex = (IconIndice)(iconIndex + 1);
} else if ((iconIndex >= k10_IconIndiceJunkJewelSymalUnequipped) && (iconIndex <= k11_IconIndiceJunkJewelSymalEquipped)) {
((Junk *)rawObjPtr)->setChargeCount(1);
Expand Down Expand Up @@ -665,8 +665,8 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex)
Thing curThing;

if (slotIndex >= k30_ChampionSlotChest_1) {
curThing = _vm->_inventoryMan->_g425_chestSlots[slotIndex - k30_ChampionSlotChest_1];
_vm->_inventoryMan->_g425_chestSlots[slotIndex - k30_ChampionSlotChest_1] = Thing::_none;
curThing = _vm->_inventoryMan->_chestSlots[slotIndex - k30_ChampionSlotChest_1];
_vm->_inventoryMan->_chestSlots[slotIndex - k30_ChampionSlotChest_1] = Thing::_none;
} else {
curThing = curChampion->_slots[slotIndex];
curChampion->_slots[slotIndex] = Thing::_none;
Expand All @@ -675,7 +675,7 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex)
if (curThing == Thing::_none)
return Thing::_none;

bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal);
bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal);
int16 curIconIndex = _vm->_objectMan->f33_getIconIndex(curThing);
// Remove object modifiers
applyModifiersToStatistics(curChampion, slotIndex, curIconIndex, -1, curThing);
Expand All @@ -685,7 +685,7 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex)
if ((curIconIndex >= k12_IconIndiceJunkIllumuletUnequipped) && (curIconIndex <= k13_IconIndiceJunkIllumuletEquipped)) {
((Junk *)curWeapon)->setChargeCount(0);
_party._magicalLightAmount -= _lightPowerToLightAmount[2];
_vm->_inventoryMan->f337_setDungeonViewPalette();
_vm->_inventoryMan->setDungeonViewPalette();
} else if ((curIconIndex >= k10_IconIndiceJunkJewelSymalUnequipped) && (curIconIndex <= k11_IconIndiceJunkJewelSymalEquipped)) {
((Junk *)curWeapon)->setChargeCount(0);
}
Expand All @@ -709,14 +709,14 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex)

if ((curIconIndex >= k4_IconIndiceWeaponTorchUnlit) && (curIconIndex <= k7_IconIndiceWeaponTorchLit)) {
curWeapon->setLit(false);
_vm->_inventoryMan->f337_setDungeonViewPalette();
_vm->_inventoryMan->setDungeonViewPalette();
drawChangedObjectIcons();
}

if (isInventoryChampion && (slotIndex == k1_ChampionSlotActionHand)) {
switch (curIconIndex) {
case k144_IconIndiceContainerChestClosed:
_vm->_inventoryMan->f334_closeChest();
_vm->_inventoryMan->closeChest();
// No break on purpose
case k30_IconIndiceScrollOpen:
case k31_IconIndiceScrollClosed:
Expand Down Expand Up @@ -1108,7 +1108,7 @@ void ChampionMan::championPoison(int16 champIndex, uint16 attack) {
Champion *curChampion = &_champions[champIndex];
addPendingDamageAndWounds_getDamage(champIndex, MAX(1, attack >> 6), k0x0000_ChampionWoundNone, k0_attackType_NORMAL);
setFlag(curChampion->_attributes, k0x0100_ChampionAttributeStatistics);
if ((_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) && (_vm->_inventoryMan->_g424_panelContent == k0_PanelContentFoodWaterPoisoned)) {
if ((_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) && (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) {
setFlag(curChampion->_attributes, k0x0800_ChampionAttributePanel);
}

Expand Down Expand Up @@ -1299,19 +1299,19 @@ void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) {
return;

champIndex = slotBoxIndex >> 1;
if ((champIndex >= _partyChampionCount) || (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) || !_champions[champIndex]._currHealth)
if ((champIndex >= _partyChampionCount) || (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) || !_champions[champIndex]._currHealth)
return;

slotIndex = getHandSlotIndex(slotBoxIndex);
} else {
champIndex = _vm->ordinalToIndex(_vm->_inventoryMan->_g432_inventoryChampionOrdinal);
champIndex = _vm->ordinalToIndex(_vm->_inventoryMan->_inventoryChampionOrdinal);
slotIndex = slotBoxIndex - k8_SlotBoxInventoryFirstSlot;
}

Thing leaderHandObject = _leaderHandObject;
Thing slotThing;
if (slotIndex >= k30_ChampionSlotChest_1) {
slotThing = _vm->_inventoryMan->_g425_chestSlots[slotIndex - k30_ChampionSlotChest_1];
slotThing = _vm->_inventoryMan->_chestSlots[slotIndex - k30_ChampionSlotChest_1];
} else {
slotThing = _champions[champIndex]._slots[slotIndex];
}
Expand Down Expand Up @@ -1397,7 +1397,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
blitBox._y1 = 0;
_vm->_eventMan->showMouse();

if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) {
if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) {
blitBox._y2 = 28;
blitBox._x1 = textPosX + 7;
blitBox._x2 = blitBox._x1 + 31; /* Box is over the champion portrait in the status box */
Expand Down Expand Up @@ -1450,7 +1450,7 @@ void ChampionMan::championKill(uint16 champIndex) {
Champion *curChampion = &_champions[champIndex];
curChampion->_currHealth = 0;
setFlag(curChampion->_attributes, k0x1000_ChampionAttributeStatusBox);
if (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) {
if (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) {
if (_vm->_pressingEye) {
_vm->_pressingEye = false;
_vm->_eventMan->_ignoreMouseMovements = false;
Expand All @@ -1465,7 +1465,7 @@ void ChampionMan::championKill(uint16 champIndex) {
_vm->_eventMan->_hideMousePointerRequestCount = 1;
_vm->_eventMan->hideMouse();
}
_vm->_inventoryMan->f355_toggleInventory(k4_ChampionCloseInventory);
_vm->_inventoryMan->toggleInventory(k4_ChampionCloseInventory);
}
dropAllObjects(champIndex);
Thing unusedThing = _vm->_dungeonMan->getUnusedThing(k0x8000_championBones | k10_JunkThingType);
Expand Down Expand Up @@ -1684,8 +1684,8 @@ void ChampionMan::applyTimeEffects() {
setFlag(championPtr->_attributes, k0x0400_ChampionAttributeIcon);
}
setFlag(championPtr->_attributes, k0x0100_ChampionAttributeStatistics);
if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) {
if (_vm->_pressingMouth || _vm->_pressingEye || (_vm->_inventoryMan->_g424_panelContent == k0_PanelContentFoodWaterPoisoned)) {
if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) {
if (_vm->_pressingMouth || _vm->_pressingEye || (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) {
setFlag(championPtr->_attributes, k0x0800_ChampionAttributePanel);
}
}
Expand Down Expand Up @@ -2027,7 +2027,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
}
curThing = _vm->_dungeonMan->getNextThing(curThing);
}
_vm->_inventoryMan->f355_toggleInventory((ChampionIndex)previousPartyChampionCount);
_vm->_inventoryMan->toggleInventory((ChampionIndex)previousPartyChampionCount);
_vm->_menuMan->f456_drawDisabledMenu();;
}

Expand Down Expand Up @@ -2119,7 +2119,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
if (!getFlag(championAttributes, k0x0080_ChampionAttributeNameTitle | k0x0100_ChampionAttributeStatistics | k0x0200_ChampionAttributeLoad | k0x0400_ChampionAttributeIcon | k0x0800_ChampionAttributePanel | k0x1000_ChampionAttributeStatusBox | k0x2000_ChampionAttributeWounds | k0x4000_ChampionAttributeViewport | k0x8000_ChampionAttributeActionHand))
return;

bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal);
bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal);
_vm->_displayMan->_useByteBoxCoordinates = false;
_vm->_eventMan->showMouse();
if (getFlag(championAttributes, k0x1000_ChampionAttributeStatusBox)) {
Expand Down Expand Up @@ -2148,7 +2148,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
_vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndices[borderCount]), &box, k40_byteWidth, k10_ColorFlesh, 29);

if (isInventoryChampion) {
_vm->_inventoryMan->f354_drawStatusBoxPortrait(champIndex);
_vm->_inventoryMan->drawStatusBoxPortrait(champIndex);
setFlag(championAttributes, k0x0100_ChampionAttributeStatistics);
} else
setFlag(championAttributes, k0x0080_ChampionAttributeNameTitle | k0x0100_ChampionAttributeStatistics | k0x2000_ChampionAttributeWounds | k0x8000_ChampionAttributeActionHand);
Expand Down Expand Up @@ -2262,12 +2262,12 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
}
if (getFlag(championAttributes, k0x0800_ChampionAttributePanel) && isInventoryChampion) {
if (_vm->_pressingMouth)
_vm->_inventoryMan->f345_drawPanelFoodWaterPoisoned();
_vm->_inventoryMan->drawPanelFoodWaterPoisoned();
else if (_vm->_pressingEye) {
if (_leaderEmptyHanded)
_vm->_inventoryMan->f351_drawChampionSkillsAndStatistics();
_vm->_inventoryMan->drawChampionSkillsAndStatistics();
} else
_vm->_inventoryMan->f347_drawPanel();
_vm->_inventoryMan->drawPanel();

setFlag(championAttributes, k0x4000_ChampionAttributeViewport);
}
Expand Down Expand Up @@ -2297,7 +2297,7 @@ void ChampionMan::drawHealthStaminaManaValues(Champion* champ) {
void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) {
int16 nativeBitmapIndex = -1;
Champion *champ = &_champions[champIndex];
bool isInventoryChamp = (_vm->_inventoryMan->_g432_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex));
bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex));

uint16 slotBoxIndex;
if (!isInventoryChamp) {
Expand All @@ -2310,7 +2310,7 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) {

Thing thing;
if (slotIndex >= k30_ChampionSlotChest_1)
thing = _vm->_inventoryMan->_g425_chestSlots[slotIndex - k30_ChampionSlotChest_1];
thing = _vm->_inventoryMan->_chestSlots[slotIndex - k30_ChampionSlotChest_1];
else
thing = champ->getSlot((ChampionSlot)slotIndex);

Expand Down Expand Up @@ -2388,7 +2388,7 @@ void ChampionMan::renameChampion(Champion* champ) {
displayBox._x2 = displayBox._x1 + 167;

_vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, displayBox, k12_ColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
_vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k27_PanelRenameChampionIndice), _vm->_inventoryMan->g32_BoxPanel, k72_byteWidth, k4_ColorCyan, 73);
_vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k27_PanelRenameChampionIndice), _vm->_inventoryMan->_boxPanel, k72_byteWidth, k4_ColorCyan, 73);
_vm->_textMan->f52_printToViewport(177, 58, k13_ColorLightestGray, "_______");
_vm->_textMan->f52_printToViewport(105, 76, k13_ColorLightestGray, "___________________");
_vm->_eventMan->showMouse();
Expand Down
18 changes: 9 additions & 9 deletions engines/dm/dm.cpp
Expand Up @@ -369,7 +369,7 @@ void DMEngine::processNewPartyMap(uint16 mapIndex) {
_dungeonMan->setCurrentMapAndPartyMap(mapIndex);
_displayMan->loadCurrentMapGraphics();
_groupMan->addAllActiveGroups();
_inventoryMan->f337_setDungeonViewPalette();
_inventoryMan->setDungeonViewPalette();
}

Common::Error DMEngine::run() {
Expand Down Expand Up @@ -449,7 +449,7 @@ void DMEngine::gameloop() {
break;
}

if (!_inventoryMan->_g432_inventoryChampionOrdinal && !_championMan->_partyIsSleeping) {
if (!_inventoryMan->_inventoryChampionOrdinal && !_championMan->_partyIsSleeping) {
Box box(0, 223, 0, 135);
_displayMan->fillBoxBitmap(_displayMan->_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); // (possibly dummy code)
_displayMan->drawDungeon(_dungeonMan->_partyDir, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY);
Expand All @@ -476,7 +476,7 @@ void DMEngine::gameloop() {
_gameTime++;

if (!(_gameTime & 511))
_inventoryMan->f338_decreaseTorchesLightPower();
_inventoryMan->decreaseTorchesLightPower();

if (_championMan->_party._freezeLifeTicks)
_championMan->_party._freezeLifeTicks -= 1;
Expand All @@ -501,11 +501,11 @@ void DMEngine::gameloop() {
if (_stopPressingEye) {
_pressingEye = false;
_stopPressingEye = false;
_inventoryMan->f353_drawStopPressingEye();
_inventoryMan->drawStopPressingEye();
} else if (_stopPressingMouth) {
_pressingMouth = false;
_stopPressingMouth = false;
_inventoryMan->f350_drawStopPressingMouth();
_inventoryMan->drawStopPressingMouth();
}

_eventMan->processCommandQueue();
Expand Down Expand Up @@ -679,7 +679,7 @@ void DMEngine::endGame(bool doNotDrawCreditsOnly) {
continue;

char displStr[20];
strcpy(displStr, _inventoryMan->G0428_apc_SkillLevelNames[skillLevel - 2]);
strcpy(displStr, _inventoryMan->_skillLevelNames[skillLevel - 2]);
strcat(displStr, " ");
strcat(displStr, _championMan->_baseSkillName[idx]);
_textMan->f443_endgamePrintString(105, textPosY = textPosY + 8, k13_ColorLightestGray, displStr);
Expand Down Expand Up @@ -960,12 +960,12 @@ void DMEngine::fuseSequnce() {


_gameWon = true;
if (_inventoryMan->_g432_inventoryChampionOrdinal) {
_inventoryMan->f355_toggleInventory(k4_ChampionCloseInventory);
if (_inventoryMan->_inventoryChampionOrdinal) {
_inventoryMan->toggleInventory(k4_ChampionCloseInventory);
}
_eventMan->highlightBoxDisable();
_championMan->_party._magicalLightAmount = 200;
_inventoryMan->f337_setDungeonViewPalette();
_inventoryMan->setDungeonViewPalette();
_championMan->_party._fireShieldDefense = _championMan->_party._spellShieldDefense = _championMan->_party._shieldDefense = 100;
_timeline->f260_timelineRefreshAllChampionStatusBoxes();
fuseSequenceUpdate();
Expand Down

0 comments on commit 5b05f3c

Please sign in to comment.