diff options
-rw-r--r-- | engines/dm/champion.cpp | 128 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 128 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 80 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 48 | ||||
-rw-r--r-- | engines/dm/group.cpp | 70 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 30 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 46 | ||||
-rw-r--r-- | engines/dm/objectman.cpp | 12 | ||||
-rw-r--r-- | engines/dm/text.cpp | 4 | ||||
-rw-r--r-- | engines/dm/timeline.cpp | 80 |
10 files changed, 313 insertions, 313 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index f79c60c01e..cd59e2e049 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -1083,7 +1083,7 @@ void ChampionMan::f316_deleteScent(uint16 scentIndex) { }
void ChampionMan::f317_addScentStrength(int16 mapX, int16 mapY, int32 cycleCount) {
- int16 scentIndex = _vm->_championMan->_g407_party._scentCount;
+ int16 scentIndex = _g407_party._scentCount;
if (scentIndex) {
bool mergeFl = getFlag(cycleCount, k0x8000_mergeCycles);
if (mergeFl)
@@ -1094,7 +1094,7 @@ void ChampionMan::f317_addScentStrength(int16 mapX, int16 mapY, int32 cycleCount newScent.setMapY(mapY); /* BUG0_00 Useless code */
newScent.setMapIndex(_vm->_dungeonMan->_g272_currMapIndex); /* BUG0_00 Useless code */
- Scent *curScent = _vm->_championMan->_g407_party._scents; /* BUG0_00 Useless code */
+ Scent *curScent = _g407_party._scents; /* BUG0_00 Useless code */
bool cycleCountDefined = false;
while (scentIndex--) {
if (&*curScent++ == &newScent) {
@@ -1135,7 +1135,7 @@ void ChampionMan::f297_putObjectInLeaderHand(Thing thing, bool setMousePointer) }
int16 ChampionMan::f310_getMovementTicks(Champion *champ) {
- uint16 maximumLoad = _vm->_championMan->f309_getMaximumLoad(champ);
+ uint16 maximumLoad = f309_getMaximumLoad(champ);
uint16 curLoad = champ->_load;
uint16 woundTicks;
int16 ticks;
@@ -1166,7 +1166,7 @@ int16 ChampionMan::f310_getMovementTicks(Champion *champ) { }
bool ChampionMan::f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex, uint16 ammunitionSlotIndex) {
- Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
+ Champion *curChampion = &_gK71_champions[champIndex];
Thing curThing = curChampion->_slots[weaponSlotIndex];
if (curThing.getType() != k5_WeaponThingType)
return false;
@@ -1188,15 +1188,15 @@ bool ChampionMan::f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint1 }
void ChampionMan::f293_drawAllChampionStates() {
- for (int16 i = k0_ChampionFirst; i < _vm->_championMan->_g305_partyChampionCount; i++)
- _vm->_championMan->f292_drawChampionState((ChampionIndex)i);
+ for (int16 i = k0_ChampionFirst; i < _g305_partyChampionCount; i++)
+ f292_drawChampionState((ChampionIndex)i);
}
void ChampionMan::f283_viAltarRebirth(uint16 champIndex) {
- Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
- if (_vm->_championMan->f285_getIndexInCell(curChampion->_cell) != kM1_ChampionNone) {
+ Champion *curChampion = &_gK71_champions[champIndex];
+ if (f285_getIndexInCell(curChampion->_cell) != kM1_ChampionNone) {
uint16 numCell = k0_CellNorthWest;
- while (_vm->_championMan->f285_getIndexInCell(numCell) != kM1_ChampionNone)
+ while (f285_getIndexInCell(numCell) != kM1_ChampionNone)
numCell++;
curChampion->_cell = (ViewCell)numCell;
@@ -1205,10 +1205,10 @@ void ChampionMan::f283_viAltarRebirth(uint16 champIndex) { uint16 maximumHealth = curChampion->_maxHealth;
curChampion->_maxHealth = MAX(25, maximumHealth - (maximumHealth >> 6) - 1);
curChampion->_currHealth = curChampion->_maxHealth >> 1;
- _vm->_menuMan->f393_drawSpellAreaControls(_vm->_championMan->_g514_magicCasterChampionIndex);
+ _vm->_menuMan->f393_drawSpellAreaControls(_g514_magicCasterChampionIndex);
curChampion->_dir = _vm->_dungeonMan->_g308_partyDir;
setFlag(curChampion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon);
- _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex);
+ f292_drawChampionState((ChampionIndex)champIndex);
}
void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex) {
@@ -1260,7 +1260,7 @@ void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex) }
bool ChampionMan::f327_isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount) {
- Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
+ Champion *curChampion = &_gK71_champions[champIndex];
if (curChampion->_currMana < requiredManaAmount)
return false;
@@ -1284,8 +1284,8 @@ void ChampionMan::f326_championShootProjectile(Champion* champ, Thing thing, int }
void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() {
- Champion *championPtr = _vm->_championMan->_gK71_champions;
- for (uint16 championIndex = k0_ChampionFirst; championIndex < _vm->_championMan->_g305_partyChampionCount; championIndex++, championPtr++) {
+ Champion *championPtr = _gK71_champions;
+ for (uint16 championIndex = k0_ChampionFirst; championIndex < _g305_partyChampionCount; championIndex++, championPtr++) {
int16 pendingWounds = _g410_championPendingWounds[championIndex];
setFlag(championPtr->_wounds, pendingWounds);
_g410_championPendingWounds[championIndex] = 0;
@@ -1300,7 +1300,7 @@ void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { curHealth -= pendingDamage;
if (curHealth <= 0) {
- _vm->_championMan->f319_championKill(championIndex);
+ f319_championKill(championIndex);
} else {
championPtr->_currHealth = curHealth;
setFlag(championPtr->_attributes, k0x0100_ChampionAttributeStatistics);
@@ -1344,7 +1344,7 @@ void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { textPosY = 5;
}
- _vm->_textMan->f53_printToLogicalScreen(textPosX, textPosY, k15_ColorWhite, k8_ColorRed, _vm->_championMan->f288_getStringFromInteger(pendingDamage, false, 3).c_str());
+ _vm->_textMan->f53_printToLogicalScreen(textPosX, textPosY, k15_ColorWhite, k8_ColorRed, f288_getStringFromInteger(pendingDamage, false, 3).c_str());
int16 eventIndex = championPtr->_hideDamageReceivedIndex;
if (eventIndex == -1) {
@@ -1358,22 +1358,22 @@ void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { M33_setMapAndTime(curEvent->_mapTime, _vm->_dungeonMan->_g309_partyMapIndex, _vm->_g313_gameTime + 5);
_vm->_timeline->f236_fixChronology(_vm->_timeline->f235_getIndex(eventIndex));
}
- _vm->_championMan->f292_drawChampionState((ChampionIndex)championIndex);
+ f292_drawChampionState((ChampionIndex)championIndex);
_vm->_eventMan->f77_hideMouse();
}
}
}
void ChampionMan::f319_championKill(uint16 champIndex) {
- Champion *curChampion = &_vm->_championMan->_gK71_champions[champIndex];
+ Champion *curChampion = &_gK71_champions[champIndex];
curChampion->_currHealth = 0;
setFlag(curChampion->_attributes, k0x1000_ChampionAttributeStatusBox);
if (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) {
if (_vm->_g331_pressingEye) {
_vm->_g331_pressingEye = false;
_vm->_eventMan->_g597_ignoreMouseMovements = false;
- if (!_vm->_championMan->_g415_leaderEmptyHanded) {
- _vm->_objectMan->f34_drawLeaderObjectName(_vm->_championMan->_g414_leaderHandObject);
+ if (!_g415_leaderEmptyHanded) {
+ _vm->_objectMan->f34_drawLeaderObjectName(_g414_leaderHandObject);
}
_vm->_eventMan->_g587_hideMousePointerRequestCount = 1;
_vm->_eventMan->f77_hideMouse();
@@ -1400,7 +1400,7 @@ void ChampionMan::f319_championKill(uint16 champIndex) { curChampion->_symbols[0] = '\0';
curChampion->_dir = _vm->_dungeonMan->_g308_partyDir;
curChampion->_maximumDamageReceived = 0;
- uint16 curChampionIconIndex = _vm->_championMan->M26_championIconIndex(curCell, _vm->_dungeonMan->_g308_partyDir);
+ uint16 curChampionIconIndex = M26_championIconIndex(curCell, _vm->_dungeonMan->_g308_partyDir);
if (_vm->M0_indexToOrdinal(curChampionIconIndex) == _vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap) {
_vm->_eventMan->_g598_mousePointerBitmapUpdated = true;
_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(kM1_ChampionNone);
@@ -1412,26 +1412,26 @@ void ChampionMan::f319_championKill(uint16 champIndex) { _vm->_displayMan->_g578_useByteBoxCoordinates = false;
_vm->_displayMan->D24_fillScreenBox(g54_BoxChampionIcons[curChampionIconIndex << 2], k0_ColorBlack);
- _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex);
+ f292_drawChampionState((ChampionIndex)champIndex);
int16 aliveChampionIndex;
- for (aliveChampionIndex = k0_ChampionFirst, curChampion = _vm->_championMan->_gK71_champions; aliveChampionIndex < _vm->_championMan->_g305_partyChampionCount; aliveChampionIndex++, curChampion++) {
+ for (aliveChampionIndex = k0_ChampionFirst, curChampion = _gK71_champions; aliveChampionIndex < _g305_partyChampionCount; aliveChampionIndex++, curChampion++) {
if (curChampion->_currHealth)
break;
}
- if (aliveChampionIndex == _vm->_championMan->_g305_partyChampionCount) { /* BUG0_43 The game does not end if the last living champion in the party is killed while looking at a candidate champion in a portrait. The condition to end the game when the whole party is killed is not true because the code considers the candidate champion as alive (in the loop above) */
- _vm->_championMan->_g303_partyDead = true;
+ if (aliveChampionIndex == _g305_partyChampionCount) { /* BUG0_43 The game does not end if the last living champion in the party is killed while looking at a candidate champion in a portrait. The condition to end the game when the whole party is killed is not true because the code considers the candidate champion as alive (in the loop above) */
+ _g303_partyDead = true;
return;
}
- if (champIndex == _vm->_championMan->_g411_leaderIndex)
+ if (champIndex == _g411_leaderIndex)
_vm->_eventMan->f368_commandSetLeader((ChampionIndex)aliveChampionIndex);
- if (champIndex == _vm->_championMan->_g514_magicCasterChampionIndex)
+ if (champIndex == _g514_magicCasterChampionIndex)
_vm->_menuMan->f394_setMagicCasterAndDrawSpellArea(aliveChampionIndex);
else
- _vm->_menuMan->f393_drawSpellAreaControls(_vm->_championMan->_g514_magicCasterChampionIndex);
+ _vm->_menuMan->f393_drawSpellAreaControls(_g514_magicCasterChampionIndex);
}
void ChampionMan::f318_dropAllObjects(uint16 champIndex) {
@@ -1468,7 +1468,7 @@ void ChampionMan::f318_dropAllObjects(uint16 champIndex) { k1_ChampionSlotActionHand
};
- uint16 curCell = _vm->_championMan->_gK71_champions[champIndex]._cell;
+ uint16 curCell = _gK71_champions[champIndex]._cell;
for (uint16 slotIndex = k0_ChampionSlotReadyHand; slotIndex < k30_ChampionSlotChest_1; slotIndex++) {
Thing curThing = f300_getObjectRemovedFromSlot(champIndex, slotDropOrder[slotIndex]);
if (curThing != Thing::_none)
@@ -1485,11 +1485,11 @@ void ChampionMan::f323_unpoison(int16 champIndex) { if ((eventPtr->_type == k75_TMEventTypePoisonChampion) && (eventPtr->_priority == champIndex))
_vm->_timeline->f237_deleteEvent(eventIndex);
}
- _vm->_championMan->_gK71_champions[champIndex]._poisonEventCount = 0;
+ _gK71_champions[champIndex]._poisonEventCount = 0;
}
void ChampionMan::f331_applyTimeEffects() {
- if (!_vm->_championMan->_g305_partyChampionCount)
+ if (!_g305_partyChampionCount)
return;
Scent checkScent;
@@ -1497,10 +1497,10 @@ void ChampionMan::f331_applyTimeEffects() { checkScent.setMapY(_vm->_dungeonMan->_g307_partyMapY);
checkScent.setMapIndex(_vm->_dungeonMan->_g309_partyMapIndex);
- for (byte loopScentIndex = 0; loopScentIndex + 1 < _vm->_championMan->_g407_party._scentCount; loopScentIndex++) {
- if (&_vm->_championMan->_g407_party._scents[loopScentIndex] != &checkScent) {
- _vm->_championMan->_g407_party._scentStrengths[loopScentIndex] = MAX(0, _vm->_championMan->_g407_party._scentStrengths[loopScentIndex] - 1);
- if (!_vm->_championMan->_g407_party._scentStrengths[loopScentIndex] && !loopScentIndex) {
+ for (byte loopScentIndex = 0; loopScentIndex + 1 < _g407_party._scentCount; loopScentIndex++) {
+ if (&_g407_party._scents[loopScentIndex] != &checkScent) {
+ _g407_party._scentStrengths[loopScentIndex] = MAX(0, _g407_party._scentStrengths[loopScentIndex] - 1);
+ if (!_g407_party._scentStrengths[loopScentIndex] && !loopScentIndex) {
f316_deleteScent(0);
continue;
}
@@ -1509,14 +1509,14 @@ void ChampionMan::f331_applyTimeEffects() { uint16 gameTime = _vm->_g313_gameTime & 0xFFFF;
uint16 timeCriteria = (((gameTime & 0x0080) + ((gameTime & 0x0100) >> 2)) + ((gameTime & 0x0040) << 2)) >> 2;
- Champion *championPtr = _vm->_championMan->_gK71_champions;
- for (uint16 championIndex = k0_ChampionFirst; championIndex < _vm->_championMan->_g305_partyChampionCount; championIndex++, championPtr++) {
- if (championPtr->_currHealth && (_vm->M0_indexToOrdinal(championIndex) != _vm->_championMan->_g299_candidateChampionOrdinal)) {
- uint16 wizardSkillLevel = _vm->_championMan->f303_getSkillLevel(championIndex, k3_ChampionSkillWizard) + _vm->_championMan->f303_getSkillLevel(championIndex, k2_ChampionSkillPriest);
+ Champion *championPtr = _gK71_champions;
+ for (uint16 championIndex = k0_ChampionFirst; championIndex < _g305_partyChampionCount; championIndex++, championPtr++) {
+ if (championPtr->_currHealth && (_vm->M0_indexToOrdinal(championIndex) != _g299_candidateChampionOrdinal)) {
+ uint16 wizardSkillLevel = f303_getSkillLevel(championIndex, k3_ChampionSkillWizard) + f303_getSkillLevel(championIndex, k2_ChampionSkillPriest);
if ((championPtr->_currMana < championPtr->_maxMana)
&& (timeCriteria < championPtr->_statistics[k3_ChampionStatWisdom][k1_ChampionStatCurrent] + wizardSkillLevel)) {
int16 manaGain = championPtr->_maxMana / 40;
- if (_vm->_championMan->_g300_partyIsSleeping)
+ if (_g300_partyIsSleeping)
manaGain <<= 1;
manaGain++;
@@ -1536,7 +1536,7 @@ void ChampionMan::f331_applyTimeEffects() { int16 staminaLoss = 0;
int16 staminaAmount = f26_getBoundedValue(1, (championPtr->_maxStamina >> 8) - 1, 6);
- if (_vm->_championMan->_g300_partyIsSleeping)
+ if (_g300_partyIsSleeping)
staminaAmount <<= 1;
int32 compDelay = _vm->_g313_gameTime - _vm->_projexpl->_g362_lastPartyMovementTime;
@@ -1579,7 +1579,7 @@ void ChampionMan::f331_applyTimeEffects() { if ((championPtr->_currHealth < championPtr->_maxHealth) && (championPtr->_currStamina >= (championPtr->_maxStamina >> 2)) && (timeCriteria < (championPtr->_statistics[k4_ChampionStatVitality][k1_ChampionStatCurrent] + 12))) {
int16 healthGain = (championPtr->_maxHealth >> 7) + 1;
- if (_vm->_championMan->_g300_partyIsSleeping)
+ if (_g300_partyIsSleeping)
healthGain <<= 1;
if (_vm->_objectMan->f33_getIconIndex(championPtr->_slots[k10_ChampionSlotNeck]) == k121_IconIndiceJunkEkkhardCross)
@@ -1587,7 +1587,7 @@ void ChampionMan::f331_applyTimeEffects() { championPtr->_currHealth += MIN(healthGain, (int16)(championPtr->_maxHealth - championPtr->_currHealth));
}
- if (!((int)_vm->_g313_gameTime & (_vm->_championMan->_g300_partyIsSleeping ? 63 : 255))) {
+ if (!((int)_vm->_g313_gameTime & (_g300_partyIsSleeping ? 63 : 255))) {
for (uint16 i = k0_ChampionStatLuck; i <= k6_ChampionStatAntifire; i++) {
byte *curStatistic = championPtr->_statistics[i];
uint16 statisticMaximum = curStatistic[k0_ChampionStatMaximum];
@@ -1597,7 +1597,7 @@ void ChampionMan::f331_applyTimeEffects() { curStatistic[k1_ChampionStatCurrent] -= curStatistic[k1_ChampionStatCurrent] / statisticMaximum;
}
}
- if (!_vm->_championMan->_g300_partyIsSleeping && (championPtr->_dir != _vm->_dungeonMan->_g308_partyDir) && (_vm->_projexpl->_g361_lastCreatureAttackTime + 60 < _vm->_g313_gameTime)) {
+ if (!_g300_partyIsSleeping && (championPtr->_dir != _vm->_dungeonMan->_g308_partyDir) && (_vm->_projexpl->_g361_lastCreatureAttackTime + 60 < _vm->_g313_gameTime)) {
championPtr->_dir = _vm->_dungeonMan->_g308_partyDir;
championPtr->_maximumDamageReceived = 0;
setFlag(championPtr->_attributes, k0x0400_ChampionAttributeIcon);
@@ -1780,24 +1780,24 @@ void ChampionMan::f278_resetDataToStartGame() { }
void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) {
- if (!_vm->_championMan->_g415_leaderEmptyHanded)
+ if (!_g415_leaderEmptyHanded)
return;
- if (_vm->_championMan->_g305_partyChampionCount == 4)
+ if (_g305_partyChampionCount == 4)
return;
- uint16 previousPartyChampionCount = _vm->_championMan->_g305_partyChampionCount;
- Champion *championPtr = &_vm->_championMan->_gK71_champions[previousPartyChampionCount];
+ uint16 previousPartyChampionCount = _g305_partyChampionCount;
+ Champion *championPtr = &_gK71_champions[previousPartyChampionCount];
championPtr->resetToZero();
// Strangerke - TODO: Check if the new code is possible to run on the older version (example: the portraits could be missing in the data)
_vm->_displayMan->_g578_useByteBoxCoordinates = true;
- _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), championPtr->_portrait, gBoxChampionPortrait, _vm->_championMan->M27_getChampionPortraitX(championPortraitIndex), _vm->_championMan->M28_getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kM1_ColorNoTransparency);
+ _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), championPtr->_portrait, gBoxChampionPortrait, M27_getChampionPortraitX(championPortraitIndex), M28_getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kM1_ColorNoTransparency);
championPtr->_actionIndex = k255_ChampionActionNone;
championPtr->_enableActionEventIndex = -1;
championPtr->_hideDamageReceivedIndex = -1;
championPtr->_dir = _vm->_dungeonMan->_g308_partyDir;
uint16 viewCell = k0_ViewCellFronLeft;
- while (_vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(viewCell + _vm->_dungeonMan->_g308_partyDir)) != kM1_ChampionNone)
+ while (f285_getIndexInCell(M21_normalizeModulo4(viewCell + _vm->_dungeonMan->_g308_partyDir)) != kM1_ChampionNone)
viewCell++;
championPtr->_cell = (ViewCell)M21_normalizeModulo4(viewCell + _vm->_dungeonMan->_g308_partyDir);
@@ -1838,16 +1838,16 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) setFlag(championPtr->_attributes, k0x0010_ChampionAttributeMale);
decodedStringPtr++;
- championPtr->_currHealth = championPtr->_maxHealth = _vm->_championMan->f279_getDecodedValue(decodedStringPtr, 4);
+ championPtr->_currHealth = championPtr->_maxHealth = f279_getDecodedValue(decodedStringPtr, 4);
decodedStringPtr += 4;
- championPtr->_currStamina = championPtr->_maxStamina = _vm->_championMan->f279_getDecodedValue(decodedStringPtr, 4);
+ championPtr->_currStamina = championPtr->_maxStamina = f279_getDecodedValue(decodedStringPtr, 4);
decodedStringPtr += 4;
- championPtr->_currMana = championPtr->_maxMana = _vm->_championMan->f279_getDecodedValue(decodedStringPtr, 4);
+ championPtr->_currMana = championPtr->_maxMana = f279_getDecodedValue(decodedStringPtr, 4);
decodedStringPtr += 4;
decodedStringPtr++;
for (int16 statIdx = k0_ChampionStatLuck; statIdx <= k6_ChampionStatAntifire; statIdx++) {
championPtr->_statistics[statIdx][k2_ChampionStatMinimum] = 30;
- championPtr->_statistics[statIdx][k1_ChampionStatCurrent] = championPtr->_statistics[statIdx][k0_ChampionStatMaximum] = _vm->_championMan->f279_getDecodedValue(decodedStringPtr, 2);
+ championPtr->_statistics[statIdx][k1_ChampionStatCurrent] = championPtr->_statistics[statIdx][k0_ChampionStatMaximum] = f279_getDecodedValue(decodedStringPtr, 2);
decodedStringPtr += 2;
}
championPtr->_statistics[k0_ChampionStatLuck][k2_ChampionStatMinimum] = 10;
@@ -1865,13 +1865,13 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) championPtr->_skills[skillIdx]._experience = baseSkillExperience;
}
- _vm->_championMan->_g299_candidateChampionOrdinal = previousPartyChampionCount + 1;
- if (++_vm->_championMan->_g305_partyChampionCount == 1) {
+ _g299_candidateChampionOrdinal = previousPartyChampionCount + 1;
+ if (++_g305_partyChampionCount == 1) {
_vm->_eventMan->f368_commandSetLeader(k0_ChampionFirst);
_vm->_menuMan->_g508_refreshActionArea = true;
} else {
_vm->_menuMan->f388_clearActingChampion();
- _vm->_menuMan->f386_drawActionIcon((ChampionIndex)(_vm->_championMan->_g305_partyChampionCount - 1));
+ _vm->_menuMan->f386_drawActionIcon((ChampionIndex)(_g305_partyChampionCount - 1));
}
int16 curMapX = _vm->_dungeonMan->_g306_partyMapX;
@@ -1942,7 +1942,7 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) else
curSlotIndex = slotIdx++;
}
- _vm->_championMan->f301_addObjectInSlot((ChampionIndex)previousPartyChampionCount, curThing, (ChampionSlot)curSlotIndex);
+ f301_addObjectInSlot((ChampionIndex)previousPartyChampionCount, curThing, (ChampionSlot)curSlotIndex);
}
curThing = _vm->_dungeonMan->f159_getNextThing(curThing);
}
@@ -1952,7 +1952,7 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) void ChampionMan::f287_drawChampionBarGraphs(ChampionIndex champIndex) {
int16 barGraphHeights[3];
- Champion *champ = &_vm->_championMan->_gK71_champions[champIndex];
+ Champion *champ = &_gK71_champions[champIndex];
int16 barGraphIdx = 0;
if (champ->_currHealth > 0) {
int32 barGraphHeight = (((int32)champ->_currHealth << 10) * 25) / champ->_maxHealth;
@@ -2162,7 +2162,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { uint16 championIconIndex = M26_championIconIndex(curChampion->_cell, _vm->_dungeonMan->_g308_partyDir);
if (getFlag(championAttributes, k0x0400_ChampionAttributeIcon) && (_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap != _vm->M0_indexToOrdinal(championIconIndex))) {
_vm->_displayMan->D24_fillScreenBox(g54_BoxChampionIcons[championIconIndex], g46_ChampionColor[champIndex]);
- _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, g54_BoxChampionIcons[championIconIndex], _vm->_championMan->M26_championIconIndex(curChampion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
+ _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, g54_BoxChampionIcons[championIconIndex], M26_championIconIndex(curChampion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
}
if (getFlag(championAttributes, k0x0800_ChampionAttributePanel) && isInventoryChampion) {
if (_vm->_g333_pressingMouth)
@@ -2333,8 +2333,8 @@ void ChampionMan::f281_renameChampion(Champion* champ) { renamedChampionString[curCharacterIndex] = '\0';
bool found = false;
- for (uint16 idx = k0_ChampionFirst; idx < _vm->_championMan->_g305_partyChampionCount - 1; idx++) {
- if (!strcmp(_vm->_championMan->_gK71_champions[idx]._name, renamedChampionString)) {
+ for (uint16 idx = k0_ChampionFirst; idx < _g305_partyChampionCount - 1; idx++) {
+ if (!strcmp(_gK71_champions[idx]._name, renamedChampionString)) {
// If an existing champion already has the specified name for the new champion
found = true;
break;
@@ -2439,13 +2439,13 @@ void ChampionMan::f281_renameChampion(Champion* champ) { }
uint16 ChampionMan::f303_getSkillLevel(int16 champIndex, uint16 skillIndex) {
- if (_vm->_championMan->_g300_partyIsSleeping)
+ if (_g300_partyIsSleeping)
return 1;
bool ignoreTmpExp = getFlag(skillIndex, k0x8000_IgnoreTemporaryExperience);
bool ignoreObjModifiers = getFlag(skillIndex, k0x4000_IgnoreObjectModifiers);
clearFlag(skillIndex, k0x8000_IgnoreTemporaryExperience | k0x4000_IgnoreObjectModifiers);
- Champion *champ = &_vm->_championMan->_gK71_champions[champIndex];
+ Champion *champ = &_gK71_champions[champIndex];
Skill *skill = &champ->_skills[skillIndex];
int32 exp = skill->_experience;
if (!ignoreTmpExp)
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 4e27eb581a..55cfcdda26 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -770,27 +770,27 @@ void DungeonMan::f174_setCurrentMapAndPartyMap(uint16 mapIndex) { Square DungeonMan::f151_getSquare(int16 mapX, int16 mapY) { - bool isMapYInBounds = (mapY >= 0) && (mapY < _vm->_dungeonMan->_g274_currMapHeight); - bool isMapXInBounds = (mapX >= 0) && (mapX < _vm->_dungeonMan->_g273_currMapWidth); + bool isMapYInBounds = (mapY >= 0) && (mapY < _g274_currMapHeight); + bool isMapXInBounds = (mapX >= 0) && (mapX < _g273_currMapWidth); if (isMapXInBounds && isMapYInBounds) - return Square(_vm->_dungeonMan->_g271_currMapData[mapX][mapY]); + return Square(_g271_currMapData[mapX][mapY]); if (isMapYInBounds) { - SquareType squareType = Square(_vm->_dungeonMan->_g271_currMapData[0][mapY]).getType(); + SquareType squareType = Square(_g271_currMapData[0][mapY]).getType(); if (((mapX == -1) && (squareType == k1_CorridorElemType)) || (squareType == k2_ElementTypePit)) return Square(k0_ElementTypeWall, k0x0004_WallEastRandOrnAllowed); - squareType = Square(_vm->_dungeonMan->_g271_currMapData[_vm->_dungeonMan->_g273_currMapWidth - 1][mapY]).getType(); - if (((mapX == _vm->_dungeonMan->_g273_currMapWidth) && (squareType == k1_CorridorElemType)) || (squareType == k2_ElementTypePit)) + squareType = Square(_g271_currMapData[_g273_currMapWidth - 1][mapY]).getType(); + if (((mapX == _g273_currMapWidth) && (squareType == k1_CorridorElemType)) || (squareType == k2_ElementTypePit)) return Square(k0_ElementTypeWall, k0x0001_WallWestRandOrnAllowed); } else if (isMapXInBounds) { - SquareType squareType = Square(_vm->_dungeonMan->_g271_currMapData[mapX][0]).getType(); + SquareType squareType = Square(_g271_currMapData[mapX][0]).getType(); if (((mapY == -1) && (squareType == k1_CorridorElemType)) || (squareType == k2_ElementTypePit)) return Square(k0_ElementTypeWall, k0x0002_WallSouthRandOrnAllowed); - squareType = Square(_vm->_dungeonMan->_g271_currMapData[mapX][_vm->_dungeonMan->_g274_currMapHeight - 1]).getType(); - if (((mapY == _vm->_dungeonMan->_g274_currMapHeight) && (squareType == k1_CorridorElemType)) || (squareType == k2_ElementTypePit)) + squareType = Square(_g271_currMapData[mapX][_g274_currMapHeight - 1]).getType(); + if (((mapY == _g274_currMapHeight) && (squareType == k1_CorridorElemType)) || (squareType == k2_ElementTypePit)) return Square(k0_ElementTypeWall, k0x0008_WallNorthRandOrnAllowed); } return Square(k0_ElementTypeWall, 0); @@ -802,12 +802,12 @@ Square DungeonMan::f152_getRelSquare(Direction dir, int16 stepsForward, int16 st } int16 DungeonMan::f160_getSquareFirstThingIndex(int16 mapX, int16 mapY) { - unsigned char *curSquare = _vm->_dungeonMan->_g271_currMapData[mapX]; - if ((mapX < 0) || (mapX >= _vm->_dungeonMan->_g273_currMapWidth) || (mapY < 0) || (mapY >= _vm->_dungeonMan->_g274_currMapHeight) || !getFlag(curSquare[mapY], k0x0010_ThingListPresent)) + unsigned char *curSquare = _g271_currMapData[mapX]; + if ((mapX < 0) || (mapX >= _g273_currMapWidth) || (mapY < 0) || (mapY >= _g274_currMapHeight) || !getFlag(curSquare[mapY], k0x0010_ThingListPresent)) return -1; int16 curMapY = 0; - uint16 thingIndex = _vm->_dungeonMan->_g270_currMapColCumulativeSquareFirstThingCount[mapX]; + uint16 thingIndex = _g270_currMapColCumulativeSquareFirstThingCount[mapX]; while (curMapY++ != mapY) { if (getFlag(*curSquare++, k0x0010_ThingListPresent)) thingIndex++; @@ -964,20 +964,20 @@ T0172010_ClosedFakeWall: void DungeonMan::f171_setSquareAspectOrnOrdinals(uint16 *aspectArray, bool leftAllowed, bool frontAllowed, bool rightAllowed, int16 dir, int16 mapX, int16 mapY, bool isFakeWall) { - int16 randomWallOrnamentCount = _vm->_dungeonMan->_g269_currMap->_randWallOrnCount; - aspectArray[k2_RightWallOrnOrdAspect] = _vm->_dungeonMan->f170_getRandomOrnOrdinal(leftAllowed, randomWallOrnamentCount, mapX, ++mapY * (M21_normalizeModulo4(++dir) + 1), 30); - aspectArray[k3_FrontWallOrnOrdAspect] = _vm->_dungeonMan->f170_getRandomOrnOrdinal(frontAllowed, randomWallOrnamentCount, mapX, mapY * (M21_normalizeModulo4(++dir) + 1), 30); - aspectArray[k4_LeftWallOrnOrdAspect] = _vm->_dungeonMan->f170_getRandomOrnOrdinal(rightAllowed, randomWallOrnamentCount, mapX, mapY-- * (M21_normalizeModulo4(++dir) + 1), 30); - if (isFakeWall || (mapX < 0) || (mapX >= _vm->_dungeonMan->_g273_currMapWidth) || (mapY < 0) || (mapY >= _vm->_dungeonMan->_g274_currMapHeight)) { /* If square is a fake wall or is out of map bounds */ + int16 randomWallOrnamentCount = _g269_currMap->_randWallOrnCount; + aspectArray[k2_RightWallOrnOrdAspect] = f170_getRandomOrnOrdinal(leftAllowed, randomWallOrnamentCount, mapX, ++mapY * (M21_normalizeModulo4(++dir) + 1), 30); + aspectArray[k3_FrontWallOrnOrdAspect] = f170_getRandomOrnOrdinal(frontAllowed, randomWallOrnamentCount, mapX, mapY * (M21_normalizeModulo4(++dir) + 1), 30); + aspectArray[k4_LeftWallOrnOrdAspect] = f170_getRandomOrnOrdinal(rightAllowed, randomWallOrnamentCount, mapX, mapY-- * (M21_normalizeModulo4(++dir) + 1), 30); + if (isFakeWall || (mapX < 0) || (mapX >= _g273_currMapWidth) || (mapY < 0) || (mapY >= _g274_currMapHeight)) { /* If square is a fake wall or is out of map bounds */ for (int16 sideIndex = k2_RightWallOrnOrdAspect; sideIndex <= k4_LeftWallOrnOrdAspect; sideIndex++) { /* Loop to remove any random ornament that is an alcove */ - if (_vm->_dungeonMan->f149_isWallOrnAnAlcove(_vm->M1_ordinalToIndex(aspectArray[sideIndex]))) + if (f149_isWallOrnAnAlcove(_vm->M1_ordinalToIndex(aspectArray[sideIndex]))) aspectArray[sideIndex] = 0; } } } int16 DungeonMan::f170_getRandomOrnOrdinal(bool allowed, int16 count, int16 mapX, int16 mapY, int16 modulo) { - int16 randomOrnamentIndex = f169_getRandomOrnamentIndex((int16)2000 + (mapX << 5) + mapY, (int16)3000 + (_vm->_dungeonMan->_g272_currMapIndex << (int16)6) + _vm->_dungeonMan->_g273_currMapWidth + _vm->_dungeonMan->_g274_currMapHeight, modulo); + int16 randomOrnamentIndex = f169_getRandomOrnamentIndex((int16)2000 + (mapX << 5) + mapY, (int16)3000 + (_g272_currMapIndex << (int16)6) + _g273_currMapWidth + _g274_currMapHeight, modulo); if (allowed && (randomOrnamentIndex < count)) return _vm->M0_indexToOrdinal(randomOrnamentIndex); @@ -1155,7 +1155,7 @@ void DungeonMan::f168_decodeText(char *destString, Thing thing, TextType type) { } Thing DungeonMan::f166_getUnusedThing(uint16 thingType) { - int16 thingCount = _vm->_dungeonMan->_g278_dungeonFileHeader._thingCounts[getFlag(thingType, k0x7FFF_thingType)]; + int16 thingCount = _g278_dungeonFileHeader._thingCounts[getFlag(thingType, k0x7FFF_thingType)]; if (thingType == (k0x8000_championBones | k10_JunkThingType)) { thingType = k10_JunkThingType; } else if (thingType == k10_JunkThingType) @@ -1163,7 +1163,7 @@ Thing DungeonMan::f166_getUnusedThing(uint16 thingType) { int16 thingIdx = thingCount; int16 thingDataByteCount = g235_ThingDataWordCount[thingType] >> 1; - Thing *thingPtr = (Thing *)_vm->_dungeonMan->_g284_thingData[thingType]; + Thing *thingPtr = (Thing *)_g284_thingData[thingType]; Thing curThing; for (;;) { /*_Infinite loop_*/ @@ -1178,7 +1178,7 @@ Thing DungeonMan::f166_getUnusedThing(uint16 thingType) { if (curThing == Thing::_none) return Thing::_none; - thingPtr = (Thing *)_vm->_dungeonMan->f156_getThingData(curThing); + thingPtr = (Thing *)f156_getThingData(curThing); break; } } @@ -1393,39 +1393,39 @@ Thing DungeonMan::f165_getDiscardThing(uint16 thingType) { if (thingType == k15_ExplosionThingType) return Thing::_none; - int16 currentMapIdx = _vm->_dungeonMan->_g272_currMapIndex; + int16 currentMapIdx = _g272_currMapIndex; uint16 mapIndex = lastDiscardedThingMapIndex[thingType]; - if ((mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (++mapIndex >= _vm->_dungeonMan->_g278_dungeonFileHeader._mapCount)) + if ((mapIndex == _g309_partyMapIndex) && (++mapIndex >= _g278_dungeonFileHeader._mapCount)) mapIndex = 0; uint16 discardThingMapIndex = mapIndex; for (;;) { /*_Infinite loop_*/ - uint16 mapWidth = _vm->_dungeonMan->_g277_dungeonMaps[mapIndex]._width; - uint16 mapHeight = _vm->_dungeonMan->_g277_dungeonMaps[mapIndex]._height; - byte *currSquare = _vm->_dungeonMan->_g279_dungeonMapData[mapIndex][0]; - Thing *squareFirstThing = &_vm->_dungeonMan->_g283_squareFirstThings[_vm->_dungeonMan->_g280_dungeonColumnsCumulativeSquareThingCount[_vm->_dungeonMan->_g281_dungeonMapsFirstColumnIndex[mapIndex]]]; + uint16 mapWidth = _g277_dungeonMaps[mapIndex]._width; + uint16 mapHeight = _g277_dungeonMaps[mapIndex]._height; + byte *currSquare = _g279_dungeonMapData[mapIndex][0]; + Thing *squareFirstThing = &_g283_squareFirstThings[_g280_dungeonColumnsCumulativeSquareThingCount[_g281_dungeonMapsFirstColumnIndex[mapIndex]]]; for (int16 currMapX = 0; currMapX <= mapWidth; currMapX++) { for (int16 currMapY = 0; currMapY <= mapHeight; currMapY++) { if (getFlag(*currSquare++, k0x0010_ThingListPresent)) { Thing squareThing = *squareFirstThing++; - if ((mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && ((currMapX - _vm->_dungeonMan->_g306_partyMapX + 5) <= 10) && ((currMapY - _vm->_dungeonMan->_g307_partyMapY + 5) <= 10)) /* If square is too close to the party */ + if ((mapIndex == _g309_partyMapIndex) && ((currMapX - _g306_partyMapX + 5) <= 10) && ((currMapY - _g307_partyMapY + 5) <= 10)) /* If square is too close to the party */ continue; do { ThingType squareThingType = squareThing.getType(); if (squareThingType == k3_SensorThingType) { - Thing *squareThingData = (Thing*)_vm->_dungeonMan->f156_getThingData(squareThing); + Thing *squareThingData = (Thing*)f156_getThingData(squareThing); if (((Sensor*)squareThingData)->getType()) /* If sensor is not disabled */ break; } else if (squareThingType == thingType) { - Thing *squareThingData = (Thing*)_vm->_dungeonMan->f156_getThingData(squareThing); + Thing *squareThingData = (Thing*)f156_getThingData(squareThing); switch (thingType) { case k4_GroupThingType: if (((Group*)squareThingData)->getDoNotDiscard()) continue; case k14_ProjectileThingType: - _vm->_dungeonMan->f173_setCurrentMap(mapIndex); + f173_setCurrentMap(mapIndex); if (thingType == k4_GroupThingType) { _vm->_groupMan->f188_dropGroupPossessions(currMapX, currMapY, squareThing, kM1_soundModeDoNotPlaySound); _vm->_groupMan->f189_delete(currMapX, currMapY); @@ -1439,77 +1439,77 @@ Thing DungeonMan::f165_getDiscardThing(uint16 thingType) { if (((Armour*)squareThingData)->getDoNotDiscard()) continue; - _vm->_dungeonMan->f173_setCurrentMap(mapIndex); + f173_setCurrentMap(mapIndex); _vm->_moveSens->f267_getMoveResult(squareThing, currMapX, currMapY, kM1_MapXNotOnASquare, 0); break; case k5_WeaponThingType: if (((Weapon*)squareThingData)->getDoNotDiscard()) continue; - _vm->_dungeonMan->f173_setCurrentMap(mapIndex); + f173_setCurrentMap(mapIndex); _vm->_moveSens->f267_getMoveResult(squareThing, currMapX, currMapY, kM1_MapXNotOnASquare, 0); break; case k10_JunkThingType: if (((Junk*)squareThingData)->getDoNotDiscard()) continue; - _vm->_dungeonMan->f173_setCurrentMap(mapIndex); + f173_setCurrentMap(mapIndex); _vm->_moveSens->f267_getMoveResult(squareThing, currMapX, currMapY, kM1_MapXNotOnASquare, 0); break; case k8_PotionThingType: if (((Potion*)squareThingData)->getDoNotDiscard()) continue; - _vm->_dungeonMan->f173_setCurrentMap(mapIndex); + f173_setCurrentMap(mapIndex); _vm->_moveSens->f267_getMoveResult(squareThing, currMapX, currMapY, kM1_MapXNotOnASquare, 0); break; } - _vm->_dungeonMan->f173_setCurrentMap(currentMapIdx); + f173_setCurrentMap(currentMapIdx); lastDiscardedThingMapIndex[thingType] = mapIndex; return Thing(squareThing.getTypeAndIndex()); } - } while ((squareThing = _vm->_dungeonMan->f159_getNextThing(squareThing)) != Thing::_endOfList); + } while ((squareThing = f159_getNextThing(squareThing)) != Thing::_endOfList); } } } - if ((mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) || (_vm->_dungeonMan->_g278_dungeonFileHeader._mapCount <= 1)) { + if ((mapIndex == _g309_partyMapIndex) || (_g278_dungeonFileHeader._mapCount <= 1)) { lastDiscardedThingMapIndex[thingType] = mapIndex; return Thing::_none; } do { - if (++mapIndex >= _vm->_dungeonMan->_g278_dungeonFileHeader._mapCount) + if (++mapIndex >= _g278_dungeonFileHeader._mapCount) mapIndex = 0; - } while (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex); + } while (mapIndex == _g309_partyMapIndex); if (mapIndex == discardThingMapIndex) - mapIndex = _vm->_dungeonMan->_g309_partyMapIndex; + mapIndex = _g309_partyMapIndex; } } uint16 DungeonMan::f144_getCreatureAttributes(Thing thing) { - Group *currGroup = (Group *)_vm->_dungeonMan->f156_getThingData(thing); + Group *currGroup = (Group *)f156_getThingData(thing); return g243_CreatureInfo[currGroup->_type]._attributes; } void DungeonMan::f146_setGroupCells(Group* group, uint16 cells, uint16 mapIndex) { - if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) + if (mapIndex == _g309_partyMapIndex) _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._cells = cells; else group->_cells = cells; } void DungeonMan::f148_setGroupDirections(Group* group, int16 dir, uint16 mapIndex) { - if (mapIndex == _vm->_dungeonMan->_g309_partyMapIndex) + if (mapIndex == _g309_partyMapIndex) _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._directions = (Direction)dir; else group->setDir(M21_normalizeModulo4(dir)); } bool DungeonMan::f139_isCreatureAllowedOnMap(Thing thing, uint16 mapIndex) { - int16 creatureType = ((Group*)_vm->_dungeonMan->f156_getThingData(thing))->_type; - Map *map = &_vm->_dungeonMan->_g277_dungeonMaps[mapIndex]; - byte *allowedCreatureType = _vm->_dungeonMan->_g279_dungeonMapData[mapIndex][map->_width] + map->_height + 1; + int16 creatureType = ((Group*)f156_getThingData(thing))->_type; + Map *map = &_g277_dungeonMaps[mapIndex]; + byte *allowedCreatureType = _g279_dungeonMapData[mapIndex][map->_width] + map->_height + 1; for (int16 L0234_i_Counter = map->_creatureTypeCount; L0234_i_Counter > 0; L0234_i_Counter--) { if (*allowedCreatureType++ == creatureType) return true; @@ -1537,17 +1537,17 @@ void DungeonMan::f164_unlinkThingFromList(Thing thingToUnlink, Thing thingInList thingToUnlink = Thing(tmp); if (mapX >= 0) { - L0274_ps_Generic = (Thing*)_vm->_dungeonMan->f156_getThingData(thingToUnlink); - AL0275_pT_Thing = &_vm->_dungeonMan->_g283_squareFirstThings[L0271_ui_SquareFirstThingIndex = _vm->_dungeonMan->f160_getSquareFirstThingIndex(mapX, mapY)]; /* BUG0_01 Coding error without consequence. The engine does not check that there are things at the specified square coordinates. _vm->_dungeonMan->f160_getSquareFirstThingIndex would return -1 for an empty square. No consequence as the function is never called with the coordinates of an empty square (except in the case of BUG0_59) */ + L0274_ps_Generic = (Thing*)f156_getThingData(thingToUnlink); + AL0275_pT_Thing = &_g283_squareFirstThings[L0271_ui_SquareFirstThingIndex = f160_getSquareFirstThingIndex(mapX, mapY)]; /* BUG0_01 Coding error without consequence. The engine does not check that there are things at the specified square coordinates. f160_getSquareFirstThingIndex would return -1 for an empty square. No consequence as the function is never called with the coordinates of an empty square (except in the case of BUG0_59) */ if ((*L0274_ps_Generic == Thing::_endOfList) && (((Thing*)AL0275_pT_Thing)->getTypeAndIndex() == thingToUnlink.toUint16())) { /* If the thing to unlink is the last thing on the square */ - clearFlag(_vm->_dungeonMan->_g271_currMapData[mapX][mapY], k0x0010_ThingListPresent); - AL0272_ui_SquareFirstThingIndex = _vm->_dungeonMan->_g278_dungeonFileHeader._squareFirstThingCount - 1; + clearFlag(_g271_currMapData[mapX][mapY], k0x0010_ThingListPresent); + AL0272_ui_SquareFirstThingIndex = _g278_dungeonFileHeader._squareFirstThingCount - 1; for (uint16 i = 0; i < AL0272_ui_SquareFirstThingIndex - L0271_ui_SquareFirstThingIndex; ++i) AL0275_pT_Thing[i] = AL0275_pT_Thing[i + 1]; - _vm->_dungeonMan->_g283_squareFirstThings[AL0272_ui_SquareFirstThingIndex] = Thing::_none; - AL0275_pui_CumulativeFirstThingCount = (Thing*)_vm->_dungeonMan->_g270_currMapColCumulativeSquareFirstThingCount + mapX + 1; - AL0272_ui_Column = _vm->_dungeonMan->_g282_dungeonColumCount - (_vm->_dungeonMan->_g281_dungeonMapsFirstColumnIndex[_vm->_dungeonMan->_g272_currMapIndex] + mapX) - 1; + _g283_squareFirstThings[AL0272_ui_SquareFirstThingIndex] = Thing::_none; + AL0275_pui_CumulativeFirstThingCount = (Thing*)_g270_currMapColCumulativeSquareFirstThingCount + mapX + 1; + AL0272_ui_Column = _g282_dungeonColumCount - (_g281_dungeonMapsFirstColumnIndex[_g272_currMapIndex] + mapX) - 1; while (AL0272_ui_Column--) { /* For each column starting from and after the column containing the square where the thing is unlinked */ (*(uint16*)AL0275_pui_CumulativeFirstThingCount++)--; /* Decrement the cumulative first thing count */ } @@ -1561,17 +1561,17 @@ void DungeonMan::f164_unlinkThingFromList(Thing thingToUnlink, Thing thingInList } thingInList = *AL0275_pT_Thing; } - L0273_T_Thing = _vm->_dungeonMan->f159_getNextThing(thingInList); + L0273_T_Thing = f159_getNextThing(thingInList); while (L0273_T_Thing.getTypeAndIndex() != thingToUnlink.toUint16()) { if ((L0273_T_Thing == Thing::_endOfList) || (L0273_T_Thing == Thing::_none)) { *L0274_ps_Generic = Thing::_endOfList; return; } - L0273_T_Thing = _vm->_dungeonMan->f159_getNextThing(thingInList = L0273_T_Thing); + L0273_T_Thing = f159_getNextThing(thingInList = L0273_T_Thing); } - L0274_ps_Generic = (Thing*)_vm->_dungeonMan->f156_getThingData(thingInList); - *L0274_ps_Generic = _vm->_dungeonMan->f159_getNextThing(L0273_T_Thing); - L0274_ps_Generic = (Thing*)_vm->_dungeonMan->f156_getThingData(thingToUnlink); + L0274_ps_Generic = (Thing*)f156_getThingData(thingInList); + *L0274_ps_Generic = f159_getNextThing(L0273_T_Thing); + L0274_ps_Generic = (Thing*)f156_getThingData(thingToUnlink); *L0274_ps_Generic = Thing::_endOfList; } @@ -1580,14 +1580,14 @@ int16 DungeonMan::f155_getStairsExitDirection(int16 mapX, int16 mapY) { bool L0257_B_NorthSouthOrientedStairs; - if (L0257_B_NorthSouthOrientedStairs = !getFlag(_vm->_dungeonMan->f151_getSquare(mapX, mapY).toByte(), k0x0008_StairsNorthSouthOrient)) { + if (L0257_B_NorthSouthOrientedStairs = !getFlag(f151_getSquare(mapX, mapY).toByte(), k0x0008_StairsNorthSouthOrient)) { mapX = mapX + _vm->_dirIntoStepCountEast[kDirEast]; mapY = mapY + _vm->_dirIntoStepCountNorth[kDirEast]; } else { mapX = mapX + _vm->_dirIntoStepCountEast[kDirNorth]; mapY = mapY + _vm->_dirIntoStepCountNorth[kDirNorth]; } - return ((((L0256_i_SquareType = Square(_vm->_dungeonMan->f151_getSquare(mapX, mapY)).getType()) == k0_ElementTypeWall) || (L0256_i_SquareType == k3_ElementTypeStairs)) << 1) + L0257_B_NorthSouthOrientedStairs; + return ((((L0256_i_SquareType = Square(f151_getSquare(mapX, mapY)).getType()) == k0_ElementTypeWall) || (L0256_i_SquareType == k3_ElementTypeStairs)) << 1) + L0257_B_NorthSouthOrientedStairs; } @@ -1634,7 +1634,7 @@ Thing DungeonMan::f167_getObjForProjectileLaucherOrObjGen(uint16 iconIndex) { if ((L0295_T_Thing = f166_getUnusedThing(L0294_i_ThingType)) == Thing::_none) { return Thing::_none; } - L0296_ps_Junk = (Junk*)_vm->_dungeonMan->f156_getThingData(L0295_T_Thing); + L0296_ps_Junk = (Junk*)f156_getThingData(L0295_T_Thing); L0296_ps_Junk->setType(L0293_i_Type); /* Also works for WEAPON in cases other than Boulder */ if ((iconIndex == k4_IconIndiceWeaponTorchUnlit) && ((Weapon*)L0296_ps_Junk)->isLit()) { /* BUG0_65 Torches created by object generator or projectile launcher sensors have no charges. Charges are only defined if the Torch is lit which is not possible at the time it is created */ ((Weapon*)L0296_ps_Junk)->setChargeCount(15); @@ -1644,7 +1644,7 @@ Thing DungeonMan::f167_getObjForProjectileLaucherOrObjGen(uint16 iconIndex) { int16 DungeonMan::f169_getRandomOrnamentIndex(uint16 val1, uint16 val2, int16 modulo) { return ((((((val1 * 31417) & 0xFFFF) >> 1) + ((val2 * 11) & 0xFFFF) - + _vm->_dungeonMan->_g278_dungeonFileHeader._ornamentRandomSeed) & 0xFFFF) >> 2) % modulo; /* Pseudorandom number generator */ + + _g278_dungeonFileHeader._ornamentRandomSeed) & 0xFFFF) >> 2) % modulo; /* Pseudorandom number generator */ } } diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 82c8050070..00e11ef02d 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -426,9 +426,9 @@ void EventManager::f68_setPointerToObject(byte* bitmap) { void EventManager::f71_mouseDropChampionIcon() { _gK100_preventBuildPointerScreenArea = true; - uint16 L0058_ui_ChampionIconIndex = _vm->M1_ordinalToIndex(_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap); - _vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(kM1_ChampionNone); - _vm->_eventMan->_g598_mousePointerBitmapUpdated = true; + uint16 L0058_ui_ChampionIconIndex = _vm->M1_ordinalToIndex(_g599_useChampionIconOrdinalAsMousePointerBitmap); + _g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(kM1_ChampionNone); + _g598_mousePointerBitmapUpdated = true; bool L0057_B_UseByteBoxCoordinatesBackup = _vm->_displayMan->_g578_useByteBoxCoordinates; _vm->_displayMan->f21_blitToScreen(_g613_mousePointerOriginalColorsChampionIcon, &g54_BoxChampionIcons[L0058_ui_ChampionIconIndex << 2], 16, k12_ColorDarkestGray, 18); _vm->_displayMan->_g578_useByteBoxCoordinates = L0057_B_UseByteBoxCoordinatesBackup; @@ -443,7 +443,7 @@ void EventManager::f73_buildpointerScreenArea(int16 mousePosX, int16 mousePosY) // return; _gK100_preventBuildPointerScreenArea = true; - if (_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap) { + if (_g599_useChampionIconOrdinalAsMousePointerBitmap) { if ((mousePosY > 28) || (mousePosX < 274)) { _gK104_mousePointerType = k4_pointerTypeAutoselect; f71_mouseDropChampionIcon(); @@ -491,8 +491,8 @@ void EventManager::f73_buildpointerScreenArea(int16 mousePosX, int16 mousePosY) if (_gK104_mousePointerType == k4_pointerTypeAutoselect) { _gK104_mousePointerType = (_g600_useObjectAsMousePointerBitmap) ? k1_pointerTypeObjectIcon : (_g601_useHandAsMousePointerBitmap) ? k3_pointerTypeHand : k0_pointerTypeArrow; } - if (_vm->_eventMan->_g598_mousePointerBitmapUpdated || (_gK104_mousePointerType != _gK105_previousMousePointerType)) { - _vm->_eventMan->_g598_mousePointerBitmapUpdated = false; + if (_g598_mousePointerBitmapUpdated || (_gK104_mousePointerType != _gK105_previousMousePointerType)) { + _g598_mousePointerBitmapUpdated = false; switch (_gK104_mousePointerType) { case k0_pointerTypeArrow: setMousePointerFromSpriteData(g42_bitmapArrowPointer); @@ -657,30 +657,30 @@ void EventManager::f380_processCommandQueue() { static MouseInput* G0484_ps_SecondaryMouseInputBackup; - _vm->_eventMan->_g435_isCommandQueueLocked = true; + _g435_isCommandQueueLocked = true; if (_commandQueue.empty()) { /* If the command queue is empty */ - _vm->_eventMan->_g435_isCommandQueueLocked = false; - _vm->_eventMan->f360_processPendingClick(); + _g435_isCommandQueueLocked = false; + f360_processPendingClick(); return; } Command cmd = _commandQueue.pop(); cmdType = cmd._type; if ((cmdType >= k3_CommandMoveForward) && (cmdType <= k6_CommandMoveLeft) && (_vm->_g310_disabledMovementTicks || (_vm->_g311_projectileDisableMovementTicks && (_vm->_g312_lastProjectileDisabledMovementDirection == (M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + cmdType - k3_CommandMoveForward)))))) { /* If movement is disabled */ - _vm->_eventMan->_g435_isCommandQueueLocked = false; - _vm->_eventMan->f360_processPendingClick(); + _g435_isCommandQueueLocked = false; + f360_processPendingClick(); return; } L1161_i_CommandX = cmd._pos.x; L1162_i_CommandY = cmd._pos.y; - _vm->_eventMan->_g435_isCommandQueueLocked = false; - _vm->_eventMan->f360_processPendingClick(); + _g435_isCommandQueueLocked = false; + f360_processPendingClick(); if ((cmdType == k2_CommandTurnRight) || (cmdType == k1_CommandTurnLeft)) { - _vm->_eventMan->f365_commandTurnParty(cmdType); + f365_commandTurnParty(cmdType); return; } if ((cmdType >= k3_CommandMoveForward) && (cmdType <= k6_CommandMoveLeft)) { - _vm->_eventMan->f366_commandMoveParty(cmdType); + f366_commandMoveParty(cmdType); return; } if ((cmdType >= k12_CommandClickInChampion_0_StatusBox) && (cmdType <= k15_CommandClickInChampion_3_StatusBox)) { @@ -732,11 +732,11 @@ void EventManager::f380_processCommandQueue() { return; } if (cmdType == k80_CommandClickInDungeonView) { - _vm->_eventMan->f377_commandProcessType80ClickInDungeonView(L1161_i_CommandX, L1162_i_CommandY); + f377_commandProcessType80ClickInDungeonView(L1161_i_CommandX, L1162_i_CommandY); return; } if (cmdType == k81_CommandClickInPanel) { - _vm->_eventMan->f378_commandProcess81ClickInPanel(L1161_i_CommandX, L1162_i_CommandY); + f378_commandProcess81ClickInPanel(L1161_i_CommandX, L1162_i_CommandY); return; } @@ -754,8 +754,8 @@ void EventManager::f380_processCommandQueue() { f379_drawSleepScreen(); _vm->_displayMan->f97_drawViewport(k2_viewportAsBeforeSleepOrFreezeGame); _vm->_g318_waitForInputMaxVerticalBlankCount = 0; - _vm->_eventMan->_g441_primaryMouseInput = g450_PrimaryMouseInput_PartySleeping; - _vm->_eventMan->_g442_secondaryMouseInput = 0; + _g441_primaryMouseInput = g450_PrimaryMouseInput_PartySleeping; + _g442_secondaryMouseInput = 0; _g443_primaryKeyboardInput = g460_primaryKeyboardInput_partySleeping; _g444_secondaryKeyboardInput = nullptr; f357_discardAllInput(); @@ -780,12 +780,12 @@ void EventManager::f380_processCommandQueue() { _vm->_textMan->f40_printTextToBitmap(_vm->_displayMan->_g296_bitmapViewport, k112_byteWidthViewport, 81, 69, k4_ColorCyan, k0_ColorBlack, "GAME FROZEN", k136_heightViewport); _vm->_displayMan->f97_drawViewport(k2_viewportAsBeforeSleepOrFreezeGame); - G0483_ps_PrimaryMouseInputBackup = _vm->_eventMan->_g441_primaryMouseInput; - G0484_ps_SecondaryMouseInputBackup = _vm->_eventMan->_g442_secondaryMouseInput; + G0483_ps_PrimaryMouseInputBackup = _g441_primaryMouseInput; + G0484_ps_SecondaryMouseInputBackup = _g442_secondaryMouseInput; G0481_ps_PrimaryKeyboardInputBackup = _g443_primaryKeyboardInput; G0482_ps_SecondaryKeyboardInputBackup = _g444_secondaryKeyboardInput; - _vm->_eventMan->_g441_primaryMouseInput = g451_PrimaryMouseInput_FrozenGame; - _vm->_eventMan->_g442_secondaryMouseInput = 0; + _g441_primaryMouseInput = g451_PrimaryMouseInput_FrozenGame; + _g442_secondaryMouseInput = 0; _g443_primaryKeyboardInput = g461_primaryKeyboardInput_frozenGame; _g444_secondaryKeyboardInput = nullptr; f357_discardAllInput(); @@ -794,8 +794,8 @@ void EventManager::f380_processCommandQueue() { if (cmdType == k148_CommandUnfreezeGame) { _vm->_g301_gameTimeTicking = true; _vm->_menuMan->f457_drawEnabledMenus(); - _vm->_eventMan->_g441_primaryMouseInput = G0483_ps_PrimaryMouseInputBackup; - _vm->_eventMan->_g442_secondaryMouseInput = G0484_ps_SecondaryMouseInputBackup; + _g441_primaryMouseInput = G0483_ps_PrimaryMouseInputBackup; + _g442_secondaryMouseInput = G0484_ps_SecondaryMouseInputBackup; _g443_primaryKeyboardInput = G0481_ps_PrimaryKeyboardInputBackup; _g444_secondaryKeyboardInput = G0482_ps_SecondaryKeyboardInputBackup; f357_discardAllInput(); @@ -1162,7 +1162,7 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat dispMan.D24_fillScreenBox(box, k0_ColorBlack); dispMan.D24_fillScreenBox(g54_BoxChampionIcons[champMan.M26_championIconIndex(champ->_cell, dunMan._g308_partyDir) * 2], k0_ColorBlack); _vm->_menuMan->f457_drawEnabledMenus(); - _vm->_eventMan->f78_showMouse(); + f78_showMouse(); return; } @@ -1213,7 +1213,7 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat invMan.f355_toggleInventory(k4_ChampionCloseInventory); _vm->_menuMan->f457_drawEnabledMenus(); - _vm->_eventMan->f67_setMousePointerToNormal((_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) ? k0_pointerArrow : k1_pointerHand); + f67_setMousePointerToNormal((_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) ? k0_pointerArrow : k1_pointerHand); } void EventManager::f378_commandProcess81ClickInPanel(int16 x, int16 y) { @@ -1339,11 +1339,11 @@ void EventManager::f367_commandProcessTypes12to27_clickInChampionStatusBox(uint1 uint16 L1126_ui_Command; if (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) { - _vm->_eventMan->f368_commandSetLeader((ChampionIndex)champIndex); + f368_commandSetLeader((ChampionIndex)champIndex); } else { - L1126_ui_Command = _vm->_eventMan->f358_getCommandTypeFromMouseInput(g455_MouseInput_ChampionNamesHands, Common::Point(posX, posY), k1_LeftMouseButton); + L1126_ui_Command = f358_getCommandTypeFromMouseInput(g455_MouseInput_ChampionNamesHands, Common::Point(posX, posY), k1_LeftMouseButton); if ((L1126_ui_Command >= k16_CommandSetLeaderChampion_0) && (L1126_ui_Command <= k19_CommandSetLeaderChampion_3)) { - _vm->_eventMan->f368_commandSetLeader((ChampionIndex)(L1126_ui_Command - k16_CommandSetLeaderChampion_0)); + f368_commandSetLeader((ChampionIndex)(L1126_ui_Command - k16_CommandSetLeaderChampion_0)); } else { if ((L1126_ui_Command >= k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand) && (L1126_ui_Command <= k27_CommandClickOnSlotBoxChampion_3_StatusBoxActionHand)) { _vm->_championMan->f302_processCommands28to65_clickOnSlotBox(L1126_ui_Command - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand); @@ -1358,13 +1358,13 @@ void EventManager::f70_mouseProcessCommands125To128_clickOnChampionIcon(uint16 c static byte G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow[16] = {0, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 0, 120, 120, 120}; _gK100_preventBuildPointerScreenArea = true; - if (!_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap) { + if (!_g599_useChampionIconOrdinalAsMousePointerBitmap) { if (_vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(champIconIndex + _vm->_dungeonMan->_g308_partyDir)) == kM1_ChampionNone) { _gK100_preventBuildPointerScreenArea = false; return; } - _vm->_eventMan->_g598_mousePointerBitmapUpdated = true; - _vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = true; + _g598_mousePointerBitmapUpdated = true; + _g599_useChampionIconOrdinalAsMousePointerBitmap = true; _vm->_displayMan->_g578_useByteBoxCoordinates = false; byte *L0056_puc_Bitmap = _gK190_mousePointerTempBuffer; memset(L0056_puc_Bitmap, 0, 32 * 18); @@ -1377,11 +1377,11 @@ void EventManager::f70_mouseProcessCommands125To128_clickOnChampionIcon(uint16 c _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->_g348_bitmapScreen, _g613_mousePointerOriginalColorsChampionIcon, G0622_s_Box_MousePointer_ChampionIcon, L0055_pi_ChampionIconBox->_x1, L0055_pi_ChampionIconBox->_y1, k160_byteWidthScreen, k16_byteWidth, k0_ColorBlack, 200, 18); _vm->_displayMan->D24_fillScreenBox(*L0055_pi_ChampionIconBox, k0_ColorBlack); - _vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(champIconIndex); + _g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(champIconIndex); } else { - _vm->_eventMan->_g598_mousePointerBitmapUpdated = true; - uint16 L0052_ui_ChampionIconIndex = _vm->M1_ordinalToIndex(_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap); - _vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(kM1_ChampionNone); + _g598_mousePointerBitmapUpdated = true; + uint16 L0052_ui_ChampionIconIndex = _vm->M1_ordinalToIndex(_g599_useChampionIconOrdinalAsMousePointerBitmap); + _g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(kM1_ChampionNone); int16 L0054_i_ChampionIndex = _vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(L0052_ui_ChampionIconIndex + _vm->_dungeonMan->_g308_partyDir)); if (L0052_ui_ChampionIconIndex == champIconIndex) { setFlag(_vm->_championMan->_gK71_champions[L0054_i_ChampionIndex]._attributes, k0x0400_ChampionAttributeIcon); @@ -1469,7 +1469,7 @@ void EventManager::f370_commandProcessType100_clickInSpellArea(uint16 posX, uint } return; } - L1132_i_Command = _vm->_eventMan->f358_getCommandTypeFromMouseInput(g454_MouseInput_SpellArea, Common::Point(posX, posY), k1_LeftMouseButton); + L1132_i_Command = f358_getCommandTypeFromMouseInput(g454_MouseInput_SpellArea, Common::Point(posX, posY), k1_LeftMouseButton); if (L1132_i_Command != k0_CommandNone) { f369_commandProcessTypes101To108_clickInSpellSymbolsArea((CommandType)L1132_i_Command); } @@ -1515,7 +1515,7 @@ void EventManager::f371_commandProcessType111To115_ClickInActionArea(int16 posX, if (_vm->_championMan->_g506_actingChampionOrdinal) { - L1134_ui_Command = _vm->_eventMan->f358_getCommandTypeFromMouseInput(g452_MouseInput_ActionAreaNames, Common::Point(posX, posY), k1_LeftMouseButton); + L1134_ui_Command = f358_getCommandTypeFromMouseInput(g452_MouseInput_ActionAreaNames, Common::Point(posX, posY), k1_LeftMouseButton); if (L1134_ui_Command != k0_CommandNone) { if (L1134_ui_Command == k112_CommandClickInActionAreaPass) { warning(false, "MISSING CODE: F0362_COMMAND_HighlightBoxEnable"); @@ -1537,7 +1537,7 @@ void EventManager::f371_commandProcessType111To115_ClickInActionArea(int16 posX, } } else { if (_vm->_menuMan->_g509_actionAreaContainsIcons) { - L1134_ui_Command = _vm->_eventMan->f358_getCommandTypeFromMouseInput(g453_MouseInput_ActionAreaIcons, Common::Point(posX, posY), k1_LeftMouseButton); + L1134_ui_Command = f358_getCommandTypeFromMouseInput(g453_MouseInput_ActionAreaIcons, Common::Point(posX, posY), k1_LeftMouseButton); if (L1134_ui_Command != k0_CommandNone) { if ((L1134_ui_Command = L1134_ui_Command - k116_CommandClickInActionAreaChampion_0_Action) < _vm->_championMan->_g305_partyChampionCount) { _vm->_menuMan->f389_processCommands116To119_setActingChampion(L1134_ui_Command); diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 74d11cfb0c..90f89a387e 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -1434,9 +1434,9 @@ void DisplayMan::f112_drawCeilingPit(int16 nativeBitmapIndex, Frame* frame, int1 int16 AL0117_i_Square = _vm->_dungeonMan->_g279_dungeonMapData[AL0117_i_MapIndex][mapX][mapY]; if ((Square(AL0117_i_Square).getType() == k2_ElementTypePit) && getFlag(AL0117_i_Square, k0x0008_PitOpen)) { if (flipHorizontal) { - _vm->_displayMan->f105_drawFloorPitOrStairsBitmapFlippedHorizontally(nativeBitmapIndex, *frame); + f105_drawFloorPitOrStairsBitmapFlippedHorizontally(nativeBitmapIndex, *frame); } else { - _vm->_displayMan->f104_drawFloorPitOrStairsBitmap(nativeBitmapIndex, *frame); + f104_drawFloorPitOrStairsBitmap(nativeBitmapIndex, *frame); } } } @@ -1693,34 +1693,34 @@ void DisplayMan::f119_drawSquareD2L(Direction dir, int16 posX, int16 posY) { switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { - _vm->_displayMan->f104_drawFloorPitOrStairsBitmap(_vm->_displayMan->_g677_stairsNativeBitmapIndex_Up_Front_D2L, g113_FrameStairsUpFront_D2L); + f104_drawFloorPitOrStairsBitmap(_g677_stairsNativeBitmapIndex_Up_Front_D2L, g113_FrameStairsUpFront_D2L); } else { - _vm->_displayMan->f104_drawFloorPitOrStairsBitmap(_vm->_displayMan->_g684_stairsNativeBitmapIndex_Down_Front_D2L, g124_FrameStairsDownFront_D2L); + f104_drawFloorPitOrStairsBitmap(_g684_stairsNativeBitmapIndex_Down_Front_D2L, g124_FrameStairsDownFront_D2L); } goto T0119018; case k0_ElementTypeWall: - _vm->_displayMan->f100_drawWallSetBitmap(_vm->_displayMan->_g699_bitmapWallSet_Wall_D2LCR, g163_FrameWalls[k4_ViewSquare_D2L]); - _vm->_displayMan->f107_isDrawnWallOrnAnAlcove(squareAspect[k2_RightWallOrnOrdAspect], k5_ViewWall_D2L_RIGHT); - if (_vm->_displayMan->f107_isDrawnWallOrnAnAlcove(squareAspect[k3_FrontWallOrnOrdAspect], k7_ViewWall_D2L_FRONT)) { + f100_drawWallSetBitmap(_g699_bitmapWallSet_Wall_D2LCR, g163_FrameWalls[k4_ViewSquare_D2L]); + f107_isDrawnWallOrnAnAlcove(squareAspect[k2_RightWallOrnOrdAspect], k5_ViewWall_D2L_RIGHT); + if (f107_isDrawnWallOrnAnAlcove(squareAspect[k3_FrontWallOrnOrdAspect], k7_ViewWall_D2L_FRONT)) { order = k0x0000_CellOrder_Alcove; goto T0119020; } return; case k18_ElementTypeStairsSide: - _vm->_displayMan->f104_drawFloorPitOrStairsBitmap(_vm->_displayMan->_g689_stairsNativeBitmapIndex_Side_D2L, g132_FrameStairsSide_D2L); + f104_drawFloorPitOrStairsBitmap(_g689_stairsNativeBitmapIndex_Side_D2L, g132_FrameStairsSide_D2L); case k16_DoorSideElemType: order = k0x0342_CellOrder_BackRight_FrontLeft_FrontRight; goto T0119019; case k17_DoorFrontElemType: f108_drawFloorOrnament(squareAspect[k4_FloorOrnOrdAspect], k3_viewFloor_D2L); - _vm->_displayMan->f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k4_ViewSquare_D2L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); - _vm->_displayMan->f100_drawWallSetBitmap(_vm->_displayMan->_g703_bitmapWallSet_DoorFrameTop_D2LCR, g173_Frame_DoorFrameTop_D2L); + f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k4_ViewSquare_D2L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight); + f100_drawWallSetBitmap(_g703_bitmapWallSet_DoorFrameTop_D2LCR, g173_Frame_DoorFrameTop_D2L); f111_drawDoor(squareAspect[k3_DoorThingIndexAspect], squareAspect[k2_DoorStateAspect], _g694_doorNativeBitmapIndex_Front_D2LCR, M75_bitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &g182_doorFrame_D2L); order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight; goto T0119020; case k2_ElementTypePit: - _vm->_displayMan->f104_drawFloorPitOrStairsBitmap(squareAspect[k2_PitInvisibleAspect] ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, + f104_drawFloorPitOrStairsBitmap(squareAspect[k2_PitInvisibleAspect] ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, g143_FrameFloorPit_D2L); case k5_ElementTypeTeleporter: case k1_CorridorElemType: @@ -1730,10 +1730,10 @@ T0119019: f108_drawFloorOrnament(squareAspect[k4_FloorOrnOrdAspect], k3_viewFloor_D2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */ T0119020: f112_drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &g152_FrameFloorPit_D2L, posX, posY, false); - _vm->_displayMan->f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k4_ViewSquare_D2L, order); + f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k4_ViewSquare_D2L, order); } if ((squareAspect[k0_ElemAspect] == k5_ElementTypeTeleporter) && squareAspect[k2_TeleporterVisibleAspect]) { - _vm->_displayMan->f113_drawField(&g188_FieldAspects[k4_ViewSquare_D2L], g163_FrameWalls[k4_ViewSquare_D2L]._box); + f113_drawField(&g188_FieldAspects[k4_ViewSquare_D2L], g163_FrameWalls[k4_ViewSquare_D2L]._box); } } @@ -1760,34 +1760,34 @@ void DisplayMan::f120_drawSquareD2R(Direction dir, int16 posX, int16 posY) { switch (squareAspect[k0_ElemAspect]) { case k19_ElementTypeStaisFront: if (squareAspect[k2_StairsUpAspect]) { - _vm->_displayMan->f105_drawFloorPitOrStairsBitmapFlippedHorizontally(_vm->_displayMan->_g677_stairsNativeBitmapIndex_Up_Front_D2L, g115_FrameStairsUpFront_D2R); + f105_drawFloorPitOrStairsBitmapFlippedHorizontally(_g677_stairsNativeBitmapIndex_Up_Front_D2L, g115_FrameStairsUpFront_D2R); } else { - _vm->_displayMan->f105_drawFloorPitOrStairsBitmapFlippedHorizontally(_vm->_displayMan->_g684_stairsNativeBitmapIndex_Down_Front_D2L, g126_FrameStairsDownFront_D2R); + f105_drawFloorPitOrStairsBitmapFlippedHorizontally(_g684_stairsNativeBitmapIndex_Down_Front_D2L, g126_FrameStairsDownFront_D2R); } goto T0120027; case k0_ElementTypeWall: - _vm->_displayMan->f100_drawWallSetBitmap(_vm->_displayMan->_g699_bitmapWallSet_Wall_D2LCR, g163_FrameWalls[k5_ViewSquare_D2R]); - _vm->_displayMan->f107_isDrawnWallOrnAnAlcove(squareAspect[k4_LeftWallOrnOrdAspect], k6_ViewWall_D2R_LEFT); - if (_vm->_displayMan->f107_isDrawnWallOrnAnAlcove(squareAspect[k3_FrontWallOrnOrdAspect], k9_ViewWall_D2R_FRONT)) { + f100_drawWallSetBitmap(_g699_bitmapWallSet_Wall_D2LCR, g163_FrameWalls[k5_ViewSquare_D2R]); + f107_isDrawnWallOrnAnAlcove(squareAspect[k4_LeftWallOrnOrdAspect], k6_ViewWall_D2R_LEFT); + if (f107_isDrawnWallOrnAnAlcove(squareAspect[k3_FrontWallOrnOrdAspect], k9_ViewWall_D2R_FRONT)) { order = k0x0000_CellOrder_Alcove; goto T0120029; } return; case k18_ElementTypeStairsSide: - _vm->_displayMan->f105_drawFloorPitOrStairsBitmapFlippedHorizontally(_vm->_displayMan->_g689_stairsNativeBitmapIndex_Side_D2L, g133_FrameStairsSide_D2R); + f105_drawFloorPitOrStairsBitmapFlippedHorizontally(_g689_stairsNativeBitmapIndex_Side_D2L, g133_FrameStairsSide_D2R); case k16_DoorSideElemType: order = k0x0431_CellOrder_BackLeft_FrontRight_FrontLeft; goto T0120028; case k17_DoorFrontElemType: f108_drawFloorOrnament(squareAspect[k4_FloorOrnOrdAspect], k5_ViewSquare_D2R); - _vm->_displayMan->f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k5_ViewSquare_D2R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft); - _vm->_displayMan->f100_drawWallSetBitmap(_vm->_displayMan->_g703_bitmapWallSet_DoorFrameTop_D2LCR, g175_Frame_DoorFrameTop_D2R); + f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k5_ViewSquare_D2R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft); + f100_drawWallSetBitmap(_g703_bitmapWallSet_DoorFrameTop_D2LCR, g175_Frame_DoorFrameTop_D2R); f111_drawDoor(squareAspect[k3_DoorThingIndexAspect], squareAspect[k2_DoorStateAspect], _g694_doorNativeBitmapIndex_Front_D2LCR, M75_bitmapByteCount(64, 61), k1_ViewDoorOrnament_D2LCR, &g184_doorFrame_D2R); order = k0x0439_CellOrder_DoorPass2_FrontRight_FrontLeft; goto T0120029; case k2_ElementTypePit: - _vm->_displayMan->f105_drawFloorPitOrStairsBitmapFlippedHorizontally(squareAspect[k2_PitInvisibleAspect] + f105_drawFloorPitOrStairsBitmapFlippedHorizontally(squareAspect[k2_PitInvisibleAspect] ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, g145_FrameFloorPit_D2R); case k5_ElementTypeTeleporter: case k1_CorridorElemType: @@ -1798,10 +1798,10 @@ T0120028: f108_drawFloorOrnament(squareAspect[k4_FloorOrnOrdAspect], k5_viewFloor_D2R); f112_drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &g154_FrameFloorPit_D2R, posX, posY, true); T0120029: - _vm->_displayMan->f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k5_ViewSquare_D2R, order); + f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k5_ViewSquare_D2R, order); } if ((squareAspect[k0_ElemAspect] == k5_ElementTypeTeleporter) && squareAspect[k2_TeleporterVisibleAspect]) { - _vm->_displayMan->f113_drawField(&g188_FieldAspects[k5_ViewSquare_D2R], g163_FrameWalls[k5_ViewSquare_D2R]._box); + f113_drawField(&g188_FieldAspects[k5_ViewSquare_D2R], g163_FrameWalls[k5_ViewSquare_D2R]._box); } } diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index 1d8fc18d2f..2172d87a3f 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -129,9 +129,9 @@ void GroupMan::f188_dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThin uint16 L0368_ui_CreatureType = L0367_ps_Group->_type; if ((mode >= k0_soundModePlayImmediately) && getFlag(g243_CreatureInfo[L0368_ui_CreatureType]._attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) { int16 L0369_i_CreatureIndex = L0367_ps_Group->getCount(); - uint16 L0370_ui_GroupCells = _vm->_groupMan->f145_getGroupCells(L0367_ps_Group, _vm->_dungeonMan->_g272_currMapIndex); + uint16 L0370_ui_GroupCells = f145_getGroupCells(L0367_ps_Group, _vm->_dungeonMan->_g272_currMapIndex); do { - _vm->_groupMan->f186_dropCreatureFixedPossessions(L0368_ui_CreatureType, mapX, mapY, (L0370_ui_GroupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : _vm->_groupMan->M50_getCreatureValue(L0370_ui_GroupCells, L0369_i_CreatureIndex), mode); + f186_dropCreatureFixedPossessions(L0368_ui_CreatureType, mapX, mapY, (L0370_ui_GroupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : M50_getCreatureValue(L0370_ui_GroupCells, L0369_i_CreatureIndex), mode); } while (L0369_i_CreatureIndex--); } Thing L0365_T_CurrentThing = L0367_ps_Group->_slot; @@ -393,16 +393,16 @@ int16 GroupMan::f190_groupGetDamageCreatureOutcome(Group *group, uint16 creature if (getFlag(L0376_ps_CreatureInfo->_attributes, k0x2000_MaskCreatureInfo_archenemy)) /* Lord Chaos cannot be damaged */ goto T0190024; if (group->_health[creatureIndex] <= damage) { - L0381_ui_GroupCells = _vm->_groupMan->f145_getGroupCells(group, _vm->_dungeonMan->_g272_currMapIndex); - L0384_ui_Cell = (L0381_ui_GroupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : _vm->_groupMan->M50_getCreatureValue(L0381_ui_GroupCells, creatureIndex); + L0381_ui_GroupCells = f145_getGroupCells(group, _vm->_dungeonMan->_g272_currMapIndex); + L0384_ui_Cell = (L0381_ui_GroupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : M50_getCreatureValue(L0381_ui_GroupCells, creatureIndex); if (!(L0379_ui_CreatureCount = group->getCount())) { /* If there is a single creature in the group */ if (notMoving) { - f188_dropGroupPossessions(mapX, mapY, _vm->_groupMan->f175_groupGetThing(mapX, mapY), k2_soundModePlayOneTickLater); + f188_dropGroupPossessions(mapX, mapY, f175_groupGetThing(mapX, mapY), k2_soundModePlayOneTickLater); f189_delete(mapX, mapY); } AL0375_ui_Outcome = k2_outcomeKilledAllCreaturesInGroup; } else { /* If there are several creatures in the group */ - L0382_ui_GroupDirections = _vm->_groupMan->f147_getGroupDirections(group, _vm->_dungeonMan->_g272_currMapIndex); + L0382_ui_GroupDirections = f147_getGroupDirections(group, _vm->_dungeonMan->_g272_currMapIndex); if (getFlag(L0376_ps_CreatureInfo->_attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) { if (notMoving) { f186_dropCreatureFixedPossessions(AL0380_ui_CreatureType, mapX, mapY, L0384_ui_Cell, k2_soundModePlayOneTickLater); @@ -411,7 +411,7 @@ int16 GroupMan::f190_groupGetDamageCreatureOutcome(Group *group, uint16 creature } } if (L0383_B_CurrentMapIsPartyMap = (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex)) { - L0378_ps_ActiveGroup = &_vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]; + L0378_ps_ActiveGroup = &_g375_activeGroups[group->getActiveGroupIndex()]; } if (group->getBehaviour() == k6_behavior_ATTACK) { L0377_ps_Event = _vm->_timeline->_g370_events; @@ -445,8 +445,8 @@ int16 GroupMan::f190_groupGetDamageCreatureOutcome(Group *group, uint16 creature for (AL0375_ui_NextCreatureIndex = AL0374_ui_CreatureIndex = creatureIndex; AL0374_ui_CreatureIndex < L0379_ui_CreatureCount; AL0374_ui_CreatureIndex++) { AL0375_ui_NextCreatureIndex++; group->_health[AL0374_ui_CreatureIndex] = group->_health[AL0375_ui_NextCreatureIndex]; - L0382_ui_GroupDirections = f178_getGroupValueUpdatedWithCreatureValue(L0382_ui_GroupDirections, AL0374_ui_CreatureIndex, _vm->_groupMan->M50_getCreatureValue(L0382_ui_GroupDirections, AL0375_ui_NextCreatureIndex)); - L0381_ui_GroupCells = f178_getGroupValueUpdatedWithCreatureValue(L0381_ui_GroupCells, AL0374_ui_CreatureIndex, _vm->_groupMan->M50_getCreatureValue(L0381_ui_GroupCells, AL0375_ui_NextCreatureIndex)); + L0382_ui_GroupDirections = f178_getGroupValueUpdatedWithCreatureValue(L0382_ui_GroupDirections, AL0374_ui_CreatureIndex, M50_getCreatureValue(L0382_ui_GroupDirections, AL0375_ui_NextCreatureIndex)); + L0381_ui_GroupCells = f178_getGroupValueUpdatedWithCreatureValue(L0381_ui_GroupCells, AL0374_ui_CreatureIndex, M50_getCreatureValue(L0381_ui_GroupCells, AL0375_ui_NextCreatureIndex)); if (L0383_B_CurrentMapIsPartyMap) { L0378_ps_ActiveGroup->_aspect[AL0374_ui_CreatureIndex] = L0378_ps_ActiveGroup->_aspect[AL0375_ui_NextCreatureIndex]; } @@ -481,7 +481,7 @@ void GroupMan::f189_delete(int16 mapX, int16 mapY) { Group *L0373_ps_Group; - if ((L0372_T_GroupThing = _vm->_groupMan->f175_groupGetThing(mapX, mapY)) == Thing::_endOfList) { + if ((L0372_T_GroupThing = f175_groupGetThing(mapX, mapY)) == Thing::_endOfList) { return; } L0373_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0372_T_GroupThing); @@ -490,7 +490,7 @@ void GroupMan::f189_delete(int16 mapX, int16 mapY) { _vm->_moveSens->f267_getMoveResult(L0372_T_GroupThing, mapX, mapY, kM1_MapXNotOnASquare, 0); L0373_ps_Group->_nextThing = Thing::_none; if (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) { - _vm->_groupMan->_g375_activeGroups[L0373_ps_Group->getActiveGroupIndex()]._groupThingIndex = -1; + _g375_activeGroups[L0373_ps_Group->getActiveGroupIndex()]._groupThingIndex = -1; _g377_currActiveGroupCount--; } f181_groupDeleteEvents(mapX, mapY); @@ -609,7 +609,7 @@ void GroupMan::f209_processEvents29to41(int16 eventMapX, int16 eventMapY, int16 if ((_vm->_dungeonMan->_g272_currMapIndex != _vm->_dungeonMan->_g309_partyMapIndex) && ((AL0446_i_EventType = eventType) != k37_TMEventTypeUpdateBehaviourGroup) && (AL0446_i_EventType != k32_TMEventTypeUpdateAspectGroup) && (AL0446_i_EventType != k38_TMEventTypeUpdateBehaviour_0) && (AL0446_i_EventType != k33_TMEventTypeUpdateAspectCreature_0)) goto T0209139_Return; /* If there is no creature at the location specified in the event then the event is ignored */ - if ((L0449_T_GroupThing = _vm->_groupMan->f175_groupGetThing(eventMapX, eventMapY)) == Thing::_endOfList) { + if ((L0449_T_GroupThing = f175_groupGetThing(eventMapX, eventMapY)) == Thing::_endOfList) { goto T0209139_Return; } L0444_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0449_T_GroupThing); @@ -646,7 +646,7 @@ T0209005_AddEventAndReturn: _g386_fluxCageCount = 0; _g385_fluxCages[0] = 0; } - L0445_ps_ActiveGroup = &_vm->_groupMan->_g375_activeGroups[L0444_ps_Group->getActiveGroupIndex()]; + L0445_ps_ActiveGroup = &_g375_activeGroups[L0444_ps_Group->getActiveGroupIndex()]; if ((L0462_i_TicksSinceLastMove = (unsigned char)_vm->_g313_gameTime - L0445_ps_ActiveGroup->_lastMoveTime) < 0) { L0462_i_TicksSinceLastMove += 256; } @@ -751,7 +751,7 @@ T0209044_SetBehavior6_Attack: L0444_ps_Group->setBehaviour(k6_behavior_ATTACK); AL0446_i_Direction = _g382_currGroupPrimaryDirToParty; for (AL0447_i_CreatureIndex = L0460_ui_CreatureCount; AL0447_i_CreatureIndex >= 0; AL0447_i_CreatureIndex--) { - if ((_vm->_groupMan->M50_getCreatureValue(L0445_ps_ActiveGroup->_directions, AL0447_i_CreatureIndex) != AL0446_i_Direction) && + if ((M50_getCreatureValue(L0445_ps_ActiveGroup->_directions, AL0447_i_CreatureIndex) != AL0446_i_Direction) && ((!AL0447_i_CreatureIndex) || (!_vm->getRandomNumber(2)))) { f205_setDirection(L0445_ps_ActiveGroup, AL0446_i_Direction, AL0447_i_CreatureIndex, L0460_ui_CreatureCount && (L0459_i_CreatureSize == k1_MaskCreatureSizeHalf)); M32_setTime(L0465_s_NextEvent._mapTime, _vm->_g313_gameTime + _vm->getRandomNumber(4) + 2); /* Random delay represents the time for the creature to turn */ @@ -976,7 +976,7 @@ T0209096_SetBehavior0_Wander: /* If the creature can see the party and is looking in the party direction or can attack in all direction */ if (L0452_i_DistanceToVisibleParty && (getFlag(L0448_s_CreatureInfo._attributes, k0x0004_MaskCreatureInfo_sideAttack) || - _vm->_groupMan->M50_getCreatureValue(L0445_ps_ActiveGroup->_directions, AL0447_i_CreatureIndex) == L0454_i_PrimaryDirectionToOrFromParty)) { + M50_getCreatureValue(L0445_ps_ActiveGroup->_directions, AL0447_i_CreatureIndex) == L0454_i_PrimaryDirectionToOrFromParty)) { /* If the creature is in range to attack the party and random test succeeds */ if ((L0452_i_DistanceToVisibleParty <= (AL0446_i_Range = L0448_s_CreatureInfo.M56_getAttackRange())) && (!AL0450_i_DistanceXToParty || !AL0451_i_DistanceYToParty) && @@ -985,7 +985,7 @@ T0209096_SetBehavior0_Wander: (!getFlag(AL0446_i_CreatureAttributes = L0448_s_CreatureInfo._attributes, k0x0008_MaskCreatureInfo_preferBackRow) || !_vm->getRandomNumber(4) || !getFlag(AL0446_i_CreatureAttributes, k0x0010_MaskCreatureInfo_attackAnyChamp)) && (L0459_i_CreatureSize == k0_MaskCreatureSizeQuarter) && (L0445_ps_ActiveGroup->_cells != k255_CreatureTypeSingleCenteredCreature) && - ((AL0446_i_Cell = _vm->_groupMan->M50_getCreatureValue(L0445_ps_ActiveGroup->_cells, AL0447_i_CreatureIndex)) != L0454_i_PrimaryDirectionToOrFromParty) && + ((AL0446_i_Cell = M50_getCreatureValue(L0445_ps_ActiveGroup->_cells, AL0447_i_CreatureIndex)) != L0454_i_PrimaryDirectionToOrFromParty) && (AL0446_i_Cell != returnNextVal(L0454_i_PrimaryDirectionToOrFromParty))) { /* If the creature cannot cast spells (range = 1) and is not on a cell where it can attack the party directly and is a quarter square sized creature not in the center of the square then the creature moves to another cell and attack does not occur immediately */ if (!L0460_ui_CreatureCount && _vm->getRandomNumber(2)) { L0445_ps_ActiveGroup->_cells = k255_CreatureTypeSingleCenteredCreature; @@ -995,8 +995,8 @@ T0209096_SetBehavior0_Wander: } else { AL0446_i_Cell++; } - if (!_vm->_groupMan->f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = M21_normalizeModulo4(AL0446_i_Cell)) || - (_vm->getRandomNumber(2) && !_vm->_groupMan->f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = returnOppositeDir((Direction)AL0446_i_Cell)))) { /* If the selected cell (or the opposite cell) is not already occupied by a creature */ + if (!f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = M21_normalizeModulo4(AL0446_i_Cell)) || + (_vm->getRandomNumber(2) && !f176_getCreatureOrdinalInCell(L0444_ps_Group, AL0446_i_Cell = returnOppositeDir((Direction)AL0446_i_Cell)))) { /* If the selected cell (or the opposite cell) is not already occupied by a creature */ if (_vm->_projexpl->f218_projectileGetImpactCount(kM1_CreatureElemType, eventMapX, eventMapY, L0445_ps_ActiveGroup->_cells) && (_vm->_projexpl->_g364_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* BUG0_70 A projectile impact on a creature may be ignored. The function F0218_PROJECTILE_GetImpactCount to detect projectile impacts when a quarter square sized creature moves inside a group (to another cell on the same square) may fail if there are several creatures in the group because the function expects a single cell index for its last parameter. The function should be called once for each cell where there is a creature */ goto T0209139_Return; if (_vm->_projexpl->_g364_creatureDamageOutcome != k1_outcomeKilledSomeCreaturesInGroup) { @@ -1116,7 +1116,7 @@ bool GroupMan::f202_isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, i return false; } } - return (_g388_groupMovementBlockedByGroupThing = _vm->_groupMan->f175_groupGetThing(L0428_i_MapX, L0429_i_MapY)) == Thing::_endOfList; + return (_g388_groupMovementBlockedByGroupThing = f175_groupGetThing(L0428_i_MapX, L0429_i_MapY)) == Thing::_endOfList; } int16 GroupMan::f226_getDistanceBetweenSquares(int16 srcMapX, int16 srcMapY, int16 destMapX, int16 destMapY) { @@ -1141,7 +1141,7 @@ int16 GroupMan::f200_groupGetDistanceToVisibleParty(Group *group, int16 creature } if (getFlag(L0424_ps_CreatureInfo->_attributes, k0x0004_MaskCreatureInfo_sideAttack)) /* If creature can see in all directions */ goto T0200011; - L0423_ui_GroupDirections = _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._directions; + L0423_ui_GroupDirections = _g375_activeGroups[group->getActiveGroupIndex()]._directions; if (creatureIndex < 0) { /* Negative index means test if each creature in the group can see the party in their respective direction */ L0421_i_CreatureViewDirectionCount = 0; for (creatureIndex = group->getCount(); creatureIndex >= 0; creatureIndex--) { @@ -1156,7 +1156,7 @@ T0200006: ; } } else { /* Positive index means test only if the specified creature in the group can see the party in its direction */ - L0425_ai_CreatureViewDirections[0] = _vm->_groupMan->M50_getCreatureValue(L0423_ui_GroupDirections, creatureIndex); + L0425_ai_CreatureViewDirections[0] = M50_getCreatureValue(L0423_ui_GroupDirections, creatureIndex); L0421_i_CreatureViewDirectionCount = 1; } while (L0421_i_CreatureViewDirectionCount--) { @@ -1323,7 +1323,7 @@ void GroupMan::f205_setDirection(ActiveGroup *activeGroup, int16 dir, int16 crea if (twoHalfSquareSizedCreatures && (_vm->_g313_gameTime == G0395_l_TwoHalfSquareSizedCreaturesGroupLastDirectionSetTime) && (activeGroup == G0396_ps_TwoHalfSquareSizedCreaturesGroupLastDirectionSetActiveGroup)) { return; } - if (M21_normalizeModulo4(_vm->_groupMan->M50_getCreatureValue(L0435_ui_GroupDirections = activeGroup->_directions, creatureIndex) - dir) == 2) { /* If current and new direction are opposites then change direction only one step at a time */ + if (M21_normalizeModulo4(M50_getCreatureValue(L0435_ui_GroupDirections = activeGroup->_directions, creatureIndex) - dir) == 2) { /* If current and new direction are opposites then change direction only one step at a time */ L0435_ui_GroupDirections = f178_getGroupValueUpdatedWithCreatureValue(L0435_ui_GroupDirections, creatureIndex, dir = returnNextVal((_vm->getRandomNumber(65536) & 0x0002) + dir)); } else { L0435_ui_GroupDirections = f178_getGroupValueUpdatedWithCreatureValue(L0435_ui_GroupDirections, creatureIndex, dir); @@ -1433,13 +1433,13 @@ bool GroupMan::f207_isCreatureAttacking(Group *group, int16 mapX, int16 mapY, ui #define AL0440_i_AttackSoundOrdinal L0440_i_Multiple _vm->_projexpl->_g361_lastCreatureAttackTime = _vm->_g313_gameTime; - ActiveGroup L0443_s_ActiveGroup = _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]; + ActiveGroup L0443_s_ActiveGroup = _g375_activeGroups[group->getActiveGroupIndex()]; CreatureInfo *L0441_ps_CreatureInfo = &g243_CreatureInfo[AL0437_ui_CreatureType = group->_type]; uint16 L0438_ui_PrimaryDirectionToParty = _g382_currGroupPrimaryDirToParty; if ((AL0439_i_GroupCells = L0443_s_ActiveGroup._cells) == k255_CreatureTypeSingleCenteredCreature) { AL0439_i_TargetCell = _vm->getRandomNumber(2); } else { - AL0439_i_TargetCell = ((_vm->_groupMan->M50_getCreatureValue(AL0439_i_GroupCells, creatureIndex) + 5 - L0438_ui_PrimaryDirectionToParty) & 0x0002) >> 1; + AL0439_i_TargetCell = ((M50_getCreatureValue(AL0439_i_GroupCells, creatureIndex) + 5 - L0438_ui_PrimaryDirectionToParty) & 0x0002) >> 1; } AL0439_i_TargetCell += L0438_ui_PrimaryDirectionToParty; AL0439_i_TargetCell &= 0x0003; @@ -1575,7 +1575,7 @@ void GroupMan::f193_stealFromChampion(Group *group, uint16 championIndex) { L0391_i_Percentage -= 20; } if (!_vm->getRandomNumber(8) || (L0396_B_ObjectStolen && _vm->getRandomNumber(2))) { - _vm->_groupMan->_g375_activeGroups[group->getActiveGroupIndex()]._delayFleeingFromTarget = _vm->getRandomNumber(64) + 20; + _g375_activeGroups[group->getActiveGroupIndex()]._delayFleeingFromTarget = _vm->getRandomNumber(64) + 20; group->setBehaviour(k5_behavior_FLEE); } } @@ -1668,7 +1668,7 @@ void GroupMan::f180_startWanedring(int16 mapX, int16 mapY) { TimelineEvent L0333_s_Event; - L0332_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(_vm->_groupMan->f175_groupGetThing(mapX, mapY)); + L0332_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(f175_groupGetThing(mapX, mapY)); if (L0332_ps_Group->getBehaviour() >= k4_behavior_USELESS) { L0332_ps_Group->setBehaviour(k0_behavior_WANDER); } @@ -1688,10 +1688,10 @@ void GroupMan::f183_addActiveGroup(Thing thing, int16 mapX, int16 mapY) { int16 L0344_i_ActiveGroupIndex; - L0341_ps_ActiveGroup = _vm->_groupMan->_g375_activeGroups; + L0341_ps_ActiveGroup = _g375_activeGroups; L0344_i_ActiveGroupIndex = 0; while (L0341_ps_ActiveGroup->_groupThingIndex >= 0) { - if (++L0344_i_ActiveGroupIndex >= _vm->_groupMan->_g376_maxActiveGroupCount) { + if (++L0344_i_ActiveGroupIndex >= _g376_maxActiveGroupCount) { return; } L0341_ps_ActiveGroup++; @@ -1721,10 +1721,10 @@ void GroupMan::f184_removeActiveGroup(uint16 activeGroupIndex) { Group *L0348_ps_Group; - if ((activeGroupIndex > _vm->_groupMan->_g376_maxActiveGroupCount) || (_vm->_groupMan->_g375_activeGroups[activeGroupIndex]._groupThingIndex < 0)) { + if ((activeGroupIndex > _g376_maxActiveGroupCount) || (_g375_activeGroups[activeGroupIndex]._groupThingIndex < 0)) { return; } - L0347_ps_ActiveGroup = &_vm->_groupMan->_g375_activeGroups[activeGroupIndex]; + L0347_ps_ActiveGroup = &_g375_activeGroups[activeGroupIndex]; L0348_ps_Group = &((Group *)_vm->_dungeonMan->_g284_thingData[k4_GroupThingType])[L0347_ps_ActiveGroup->_groupThingIndex]; _g377_currActiveGroupCount--; L0348_ps_Group->_cells = L0347_ps_ActiveGroup->_cells; @@ -1737,7 +1737,7 @@ void GroupMan::f184_removeActiveGroup(uint16 activeGroupIndex) { void GroupMan::f194_removeAllActiveGroups() { for (int16 L0397_ui_ActiveGroupIndex = 0; _g377_currActiveGroupCount > 0; L0397_ui_ActiveGroupIndex++) { - if (_vm->_groupMan->_g375_activeGroups[L0397_ui_ActiveGroupIndex]._groupThingIndex >= 0) { + if (_g375_activeGroups[L0397_ui_ActiveGroupIndex]._groupThingIndex >= 0) { f184_removeActiveGroup(L0397_ui_ActiveGroupIndex); } } @@ -1780,7 +1780,7 @@ Thing GroupMan::f185_groupGetGenerated(int16 creatureType, int16 healthMultiplie bool L0355_B_SeveralCreaturesInGroup; - if (((_g377_currActiveGroupCount >= (_vm->_groupMan->_g376_maxActiveGroupCount - 5)) && (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex)) || ((L0349_T_GroupThing = _vm->_dungeonMan->f166_getUnusedThing(k4_GroupThingType)) == Thing::_none)) { + if (((_g377_currActiveGroupCount >= (_g376_maxActiveGroupCount - 5)) && (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex)) || ((L0349_T_GroupThing = _vm->_dungeonMan->f166_getUnusedThing(k4_GroupThingType)) == Thing::_none)) { return Thing::_none; } L0353_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0349_T_GroupThing); @@ -1828,14 +1828,14 @@ int16 GroupMan::f177_getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, i signed char L0325_auc_OrderedCellsToAttack[4]; - if ((L0323_T_GroupThing = _vm->_groupMan->f175_groupGetThing(groupX, groupY)) == Thing::_endOfList) { + if ((L0323_T_GroupThing = f175_groupGetThing(groupX, groupY)) == Thing::_endOfList) { return 0; } L0324_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0323_T_GroupThing); f229_setOrderedCellsToAttack(L0325_auc_OrderedCellsToAttack, groupX, groupY, partyX, partyY, champCell); L0321_ui_Counter = 0; for (;;) { /*_Infinite loop_*/ - if (L0322_i_CreatureOrdinal = _vm->_groupMan->f176_getCreatureOrdinalInCell(L0324_ps_Group, L0325_auc_OrderedCellsToAttack[L0321_ui_Counter])) { + if (L0322_i_CreatureOrdinal = f176_getCreatureOrdinalInCell(L0324_ps_Group, L0325_auc_OrderedCellsToAttack[L0321_ui_Counter])) { return L0322_i_CreatureOrdinal; } L0321_ui_Counter++; @@ -1979,7 +1979,7 @@ uint16 GroupMan::f222_isLordChaosOnSquare(int16 mapX, int16 mapY) { Thing L0542_T_Thing; Group* L0543_ps_Group; - if ((L0542_T_Thing = _vm->_groupMan->f175_groupGetThing(mapX, mapY)) == Thing::_endOfList) { + if ((L0542_T_Thing = f175_groupGetThing(mapX, mapY)) == Thing::_endOfList) { return 0; } L0543_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0542_T_Thing); diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index da59e7003f..019ef5ec85 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -86,14 +86,14 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { return; } _vm->_g321_stopWaitingForPlayerInput = true; - AL1102_ui_InventoryChampionOrdinal = _vm->_inventoryMan->_g432_inventoryChampionOrdinal; + AL1102_ui_InventoryChampionOrdinal = _g432_inventoryChampionOrdinal; if (_vm->M0_indexToOrdinal(championIndex) == AL1102_ui_InventoryChampionOrdinal) { championIndex = k4_ChampionCloseInventory; } _vm->_eventMan->f78_showMouse(); if (AL1102_ui_InventoryChampionOrdinal) { - _vm->_inventoryMan->_g432_inventoryChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); - _vm->_inventoryMan->f334_closeChest(); + _g432_inventoryChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); + f334_closeChest(); L1103_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->M1_ordinalToIndex(AL1102_ui_InventoryChampionOrdinal)]; if (L1103_ps_Champion->_currHealth && !_vm->_championMan->_g299_candidateChampionOrdinal) { setFlag(L1103_ps_Champion->_attributes, k0x1000_ChampionAttributeStatusBox); @@ -115,7 +115,7 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { } } _vm->_displayMan->_g578_useByteBoxCoordinates = false; - _vm->_inventoryMan->_g432_inventoryChampionOrdinal = _vm->M0_indexToOrdinal(championIndex); + _g432_inventoryChampionOrdinal = _vm->M0_indexToOrdinal(championIndex); if (!AL1102_ui_InventoryChampionOrdinal) { warning(false, "MISSING CODE: F0136_VIDEO_ShadeScreenBox"); } @@ -694,8 +694,8 @@ void InventoryMan::f351_drawChampionSkillsAndStatistics() { static char* G0431_apc_StatisticNames[7] = {"L", "STRENGTH", "DEXTERITY", "WISDOM", "VITALITY", "ANTI-MAGIC", "ANTI-FIRE"}; - _vm->_inventoryMan->f334_closeChest(); - L1094_ps_Champion = &_vm->_championMan->_gK71_champions[L1093_ui_ChampionIndex = _vm->M1_ordinalToIndex(_vm->_inventoryMan->_g432_inventoryChampionOrdinal)]; + f334_closeChest(); + L1094_ps_Champion = &_vm->_championMan->_gK71_champions[L1093_ui_ChampionIndex = _vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)]; _vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k20_PanelEmptyIndice), g32_BoxPanel, k72_byteWidth, k8_ColorRed, 73); L1091_i_Y = 58; for (AL1090_ui_SkillIndex = k0_ChampionSkillFighter; AL1090_ui_SkillIndex <= k3_ChampionSkillWizard; AL1090_ui_SkillIndex++) { @@ -731,7 +731,7 @@ void InventoryMan::f351_drawChampionSkillsAndStatistics() { } void InventoryMan::f350_drawStopPressingMouth() { - _vm->_inventoryMan->f347_drawPanel(); + f347_drawPanel(); _vm->_displayMan->f97_drawViewport(k0_viewportNotDungeonView); warning(false, "Ignored code: G0587_i_HideMousePointerRequestCount"); _vm->_eventMan->f77_hideMouse(); @@ -740,8 +740,8 @@ void InventoryMan::f350_drawStopPressingMouth() { void InventoryMan::f353_drawStopPressingEye() { Thing L1100_T_LeaderHandObject; - _vm->_inventoryMan->f332_drawIconToViewport(k202_IconIndiceEyeNotLooking, 12, 13); - _vm->_inventoryMan->f347_drawPanel(); + f332_drawIconToViewport(k202_IconIndiceEyeNotLooking, 12, 13); + f347_drawPanel(); _vm->_displayMan->f97_drawViewport(k0_viewportNotDungeonView); if ((L1100_T_LeaderHandObject = _vm->_championMan->_g414_leaderHandObject) != Thing::_none) { _vm->_objectMan->f34_drawLeaderObjectName(L1100_T_LeaderHandObject); @@ -781,7 +781,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { if (_vm->_championMan->_g415_leaderEmptyHanded) { - if (_vm->_inventoryMan->_g424_panelContent == k0_PanelContentFoodWaterPoisoned) { + if (_g424_panelContent == k0_PanelContentFoodWaterPoisoned) { return; } _vm->_eventMan->_g597_ignoreMouseMovements = true; @@ -793,7 +793,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { } else { _vm->_eventMan->f78_showMouse(); _vm->_eventMan->_g587_hideMousePointerRequestCount = 1; - _vm->_inventoryMan->f345_drawPanelFoodWaterPoisoned(); + f345_drawPanelFoodWaterPoisoned(); _vm->_displayMan->f97_drawViewport(k0_viewportNotDungeonView); } return; @@ -807,7 +807,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { L1079_ui_IconIndex = _vm->_objectMan->f33_getIconIndex(L1078_T_Thing); AL1088_ui_ThingType = L1078_T_Thing.getType(); L1089_ui_Weight = _vm->_dungeonMan->f140_getObjectWeight(L1078_T_Thing); - L1083_ps_Champion = &_vm->_championMan->_gK71_champions[L1080_ui_ChampionIndex = _vm->M1_ordinalToIndex(_vm->_inventoryMan->_g432_inventoryChampionOrdinal)]; + L1083_ps_Champion = &_vm->_championMan->_gK71_champions[L1080_ui_ChampionIndex = _vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)]; L1082_ps_Junk = (Junk*)_vm->_dungeonMan->f156_getThingData(L1078_T_Thing); if ((L1079_ui_IconIndex >= k8_IconIndiceJunkWater) && (L1079_ui_IconIndex <= k9_IconIndiceJunkWaterSkin)) { if (!(L1082_ps_Junk->getChargeCount())) { @@ -915,7 +915,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { } _vm->f064_SOUND_RequestPlay_CPSD(k08_soundSWALLOW, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k0_soundModePlayImmediately); setFlag(L1083_ps_Champion->_attributes, k0x0100_ChampionAttributeStatistics); - if (_vm->_inventoryMan->_g424_panelContent == k0_PanelContentFoodWaterPoisoned) { + if (_g424_panelContent == k0_PanelContentFoodWaterPoisoned) { setFlag(L1083_ps_Champion->_attributes, k0x0800_ChampionAttributePanel); } _vm->_championMan->f292_drawChampionState((ChampionIndex)L1080_ui_ChampionIndex); @@ -954,12 +954,12 @@ void InventoryMan::f352_processCommand71_clickOnEye() { _vm->_eventMan->f357_discardAllInput(); _vm->_eventMan->f78_showMouse(); _vm->f22_delay(8); - _vm->_inventoryMan->f332_drawIconToViewport(k203_IconIndiceEyeLooking, 12, 13); + f332_drawIconToViewport(k203_IconIndiceEyeLooking, 12, 13); if (_vm->_championMan->_g415_leaderEmptyHanded) { f351_drawChampionSkillsAndStatistics(); } else { _vm->_objectMan->f35_clearLeaderObjectName(); - _vm->_inventoryMan->f342_drawPanelObject(_vm->_championMan->_g414_leaderHandObject, true); + f342_drawPanelObject(_vm->_championMan->_g414_leaderHandObject, true); } _vm->_displayMan->f97_drawViewport(k0_viewportNotDungeonView); diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index b6db53d6a6..7ac96ebea5 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -415,12 +415,12 @@ void MenuMan::f394_setMagicCasterAndDrawSpellArea(int16 champIndex) { return;
}
L1213_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex = (ChampionIndex)champIndex];
- _vm->_menuMan->f392_buildSpellAreaLine(k2_SpellAreaAvailableSymbols);
+ f392_buildSpellAreaLine(k2_SpellAreaAvailableSymbols);
_vm->_eventMan->f78_showMouse();
- _vm->_menuMan->f393_drawSpellAreaControls((ChampionIndex)champIndex);
- _vm->_displayMan->f21_blitToScreen(_vm->_menuMan->_gK72_bitmapSpellAreaLine, &gK75_BoxSpellAreaLine2, k48_byteWidth, kM1_ColorNoTransparency, 12);
- _vm->_menuMan->f392_buildSpellAreaLine(k3_SpellAreaChampionSymbols);
- _vm->_displayMan->f21_blitToScreen(_vm->_menuMan->_gK72_bitmapSpellAreaLine, &gK76_BoxSpellAreaLine3, k48_byteWidth, kM1_ColorNoTransparency, 12);
+ f393_drawSpellAreaControls((ChampionIndex)champIndex);
+ _vm->_displayMan->f21_blitToScreen(_gK72_bitmapSpellAreaLine, &gK75_BoxSpellAreaLine2, k48_byteWidth, kM1_ColorNoTransparency, 12);
+ f392_buildSpellAreaLine(k3_SpellAreaChampionSymbols);
+ _vm->_displayMan->f21_blitToScreen(_gK72_bitmapSpellAreaLine, &gK76_BoxSpellAreaLine3, k48_byteWidth, kM1_ColorNoTransparency, 12);
_vm->_eventMan->f77_hideMouse();
}
@@ -436,17 +436,17 @@ void MenuMan::f457_drawEnabledMenus() { } else {
AL1462_i_MagicCasterChampionIndex = _vm->_championMan->_g514_magicCasterChampionIndex;
_vm->_championMan->_g514_magicCasterChampionIndex = kM1_ChampionNone; /* Force next function to draw the spell area */
- _vm->_menuMan->f394_setMagicCasterAndDrawSpellArea(AL1462_i_MagicCasterChampionIndex);
+ f394_setMagicCasterAndDrawSpellArea(AL1462_i_MagicCasterChampionIndex);
if (!_vm->_championMan->_g506_actingChampionOrdinal) {
- _vm->_menuMan->_g509_actionAreaContainsIcons = true;
+ _g509_actionAreaContainsIcons = true;
}
- _vm->_menuMan->f387_drawActionArea();
+ f387_drawActionArea();
if (AL1462_i_InventoryChampionOrdinal = _vm->_inventoryMan->_g432_inventoryChampionOrdinal) {
_vm->_inventoryMan->_g432_inventoryChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone);
_vm->_inventoryMan->f355_toggleInventory((ChampionIndex)_vm->M1_ordinalToIndex(AL1462_i_InventoryChampionOrdinal));
} else {
_vm->_displayMan->f98_drawFloorAndCeiling();
- _vm->_menuMan->f395_drawMovementArrows();
+ f395_drawMovementArrows();
}
_vm->_eventMan->f69_setMousePointer();
}
@@ -862,7 +862,7 @@ bool MenuMan::f391_didClickTriggerAction(int16 actionListIndex) { Champion* L1199_ps_Champion;
- if (!_vm->_championMan->_g506_actingChampionOrdinal || (actionListIndex != -1 && (_vm->_menuMan->_g713_actionList._actionIndices[actionListIndex] == k255_ChampionActionNone)))
+ if (!_vm->_championMan->_g506_actingChampionOrdinal || (actionListIndex != -1 && (_g713_actionList._actionIndices[actionListIndex] == k255_ChampionActionNone)))
return false;
L1199_ps_Champion = &_vm->_championMan->_gK71_champions[L1196_ui_ChampionIndex = _vm->M1_ordinalToIndex(_vm->_championMan->_g506_actingChampionOrdinal)];
@@ -871,14 +871,14 @@ bool MenuMan::f391_didClickTriggerAction(int16 actionListIndex) { // L1198_B_ClickTriggeredAction is set to -1 since booleans are stored in int16 in the original
L1198_B_ClickTriggeredAction = true;
} else {
- L1197_ui_ActionIndex = _vm->_menuMan->_g713_actionList._actionIndices[actionListIndex];
+ L1197_ui_ActionIndex = _g713_actionList._actionIndices[actionListIndex];
L1199_ps_Champion->_actionDefense += g495_actionDefense[L1197_ui_ActionIndex]; /* BUG0_54 The defense modifier of an action is permanent.
Each action has an associated defense modifier value and a number of ticks while the champion cannot perform another action because the action icon is grayed out. If an action has a non zero defense modifier and a zero value for the number of ticks then the defense modifier is applied but it is never removed. This causes no issue in the original games because there are no actions in this case but it may occur in a version where data is customized. This statement should only be executed if the value for the action in G0491_auc_Graphic560_ActionDisabledTicks is not 0 otherwise the action is not disabled at the end of F0407_MENUS_IsActionPerformed and thus not enabled later in F0253_TIMELINE_ProcessEvent11Part1_EnableChampionAction where the defense modifier is also removed */
setFlag(L1199_ps_Champion->_attributes, k0x0100_ChampionAttributeStatistics);
L1198_B_ClickTriggeredAction = f407_isActionPerformed(L1196_ui_ChampionIndex, L1197_ui_ActionIndex);
L1199_ps_Champion->_actionIndex = (ChampionAction)L1197_ui_ActionIndex;
}
- _vm->_menuMan->f388_clearActingChampion();
+ f388_clearActingChampion();
return L1198_B_ClickTriggeredAction;
}
@@ -1155,7 +1155,7 @@ T0407014: if ((AL1246_i_ActionHandWeaponClass >= k32_WeaponClassFirstSling) && (AL1246_i_ActionHandWeaponClass <= k47_WeaponClassLastSling)) {
if (AL1250_i_ReadyHandWeaponClass != k11_WeaponClassSlingAmmunition) {
T0407032:
- _vm->_menuMan->_g513_actionDamage = kM2_damageNoAmmunition;
+ _g513_actionDamage = kM2_damageNoAmmunition;
L1255_i_ActionExperienceGain = 0;
AL1245_B_ActionPerformed = false;
break;
@@ -1441,7 +1441,7 @@ bool MenuMan::f402_isMeleeActionPerformed(int16 champIndex, Champion* champ, int AL1237_ui_CellDelta = 1;
T0402005: /* Check if there is another champion in front */
if (_vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(AL1236_ui_ChampionCell + AL1237_ui_CellDelta)) != kM1_ChampionNone) {
- _vm->_menuMan->_g513_actionDamage = kM1_damageCantReach;
+ _g513_actionDamage = kM1_damageCantReach;
goto T0402010;
}
}
@@ -1452,7 +1452,7 @@ T0402005: /* Check if there is another champion in front */ if ((_vm->_objectMan->f33_getIconIndex(champ->_slots[k1_ChampionSlotActionHand]) == k40_IconIndiceWeaponVorpalBlade) || (actionIndex == k24_ChampionActionDisrupt)) {
setFlag(AL1237_ui_ActionHitProbability, k0x8000_hitNonMaterialCreatures);
}
- _vm->_menuMan->_g513_actionDamage = _vm->_groupMan->f231_getMeleeActionDamage(champ, champIndex, (Group*)_vm->_dungeonMan->f156_getThingData(_g517_actionTargetGroupThing), _vm->M1_ordinalToIndex(L1238_i_CreatureOrdinal), targetMapX, targetMapY, AL1237_ui_ActionHitProbability, AL1236_ui_ActionDamageFactor, skillIndex);
+ _g513_actionDamage = _vm->_groupMan->f231_getMeleeActionDamage(champ, champIndex, (Group*)_vm->_dungeonMan->f156_getThingData(_g517_actionTargetGroupThing), _vm->M1_ordinalToIndex(L1238_i_CreatureOrdinal), targetMapX, targetMapY, AL1237_ui_ActionHitProbability, AL1236_ui_ActionDamageFactor, skillIndex);
return true;
}
T0402010:
@@ -1612,11 +1612,11 @@ void MenuMan::f389_processCommands116To119_setActingChampion(uint16 champIndex) L1191_ps_ActionSet = &G0489_as_Graphic560_ActionSets[L1188_ui_ActionSetIndex];
_vm->_championMan->_g506_actingChampionOrdinal = _vm->M0_indexToOrdinal(champIndex);
f383_setActionList(L1191_ps_ActionSet);
- _vm->_menuMan->_g509_actionAreaContainsIcons = false;
+ _g509_actionAreaContainsIcons = false;
setFlag(L1190_ps_Champion->_attributes, k0x8000_ChampionAttributeActionHand);
_vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex);
- _vm->_menuMan->f387_drawActionArea();
- _vm->_menuMan->f387_drawActionArea();
+ f387_drawActionArea();
+ f387_drawActionArea();
}
void MenuMan::f383_setActionList(ActionSet* actionSet) {
@@ -1628,8 +1628,8 @@ void MenuMan::f383_setActionList(ActionSet* actionSet) { uint16 L1171_ui_ActionIndex;
uint16 L1172_ui_MinimumSkillLevel;
- _vm->_menuMan->_g713_actionList._actionIndices[0] = (ChampionAction)actionSet->_actionIndices[0];
- _vm->_menuMan->_g713_actionList._minimumSkillLevel[0] = 1;
+ _g713_actionList._actionIndices[0] = (ChampionAction)actionSet->_actionIndices[0];
+ _g713_actionList._minimumSkillLevel[0] = 1;
L1170_ui_NextAvailableActionListIndex = 1;
for (L1169_ui_ActionListIndex = 1; L1169_ui_ActionListIndex < 3; L1169_ui_ActionListIndex++) {
if ((L1171_ui_ActionIndex = actionSet->_actionIndices[L1169_ui_ActionListIndex]) == k255_ChampionActionNone)
@@ -1638,14 +1638,14 @@ void MenuMan::f383_setActionList(ActionSet* actionSet) { continue;
clearFlag(L1172_ui_MinimumSkillLevel, k0x0080_actionRequiresCharge);
if (_vm->_championMan->f303_getSkillLevel(_vm->M1_ordinalToIndex(_vm->_championMan->_g506_actingChampionOrdinal), g496_ActionSkillIndex[L1171_ui_ActionIndex]) >= L1172_ui_MinimumSkillLevel) {
- _vm->_menuMan->_g713_actionList._actionIndices[L1170_ui_NextAvailableActionListIndex] = (ChampionAction)L1171_ui_ActionIndex;
- _vm->_menuMan->_g713_actionList._minimumSkillLevel[L1170_ui_NextAvailableActionListIndex] = L1172_ui_MinimumSkillLevel;
+ _g713_actionList._actionIndices[L1170_ui_NextAvailableActionListIndex] = (ChampionAction)L1171_ui_ActionIndex;
+ _g713_actionList._minimumSkillLevel[L1170_ui_NextAvailableActionListIndex] = L1172_ui_MinimumSkillLevel;
L1170_ui_NextAvailableActionListIndex++;
}
}
_g507_actionCount = L1170_ui_NextAvailableActionListIndex;
for (L1169_ui_ActionListIndex = L1170_ui_NextAvailableActionListIndex; L1169_ui_ActionListIndex < 3; L1169_ui_ActionListIndex++) {
- _vm->_menuMan->_g713_actionList._actionIndices[L1169_ui_ActionListIndex] = k255_ChampionActionNone;
+ _g713_actionList._actionIndices[L1169_ui_ActionListIndex] = k255_ChampionActionNone;
}
}
diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 192e66192c..0c00e20f01 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -138,7 +138,7 @@ IconIndice ObjectMan::f32_getObjectType(Thing thing) { byte g29_ChargeCountToTorchType[16] = {0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3}; // @ G0029_auc_Graphic562_ChargeCountToTorchType IconIndice ObjectMan::f33_getIconIndex(Thing thing) { - int16 L0005_i_IconIndex = _vm->_objectMan->f32_getObjectType(thing); + int16 L0005_i_IconIndex = f32_getObjectType(thing); if (L0005_i_IconIndex != kM1_IconIndiceNone) { if (((L0005_i_IconIndex < k32_IconIndiceWeaponDagger) && (L0005_i_IconIndex >= k0_IconIndiceJunkCompassNorth)) || ((L0005_i_IconIndex >= k148_IconIndicePotionMaPotionMonPotion) && (L0005_i_IconIndex <= k163_IconIndicePotionWaterFlask)) || @@ -208,7 +208,7 @@ void ObjectMan::f38_drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { byte* L0020_puc_Bitmap_Destination; int16 L1569_i_Width; - L0017_ps_SlotBox = &_vm->_objectMan->_g30_slotBoxes[slotBoxIndex]; + L0017_ps_SlotBox = &_g30_slotBoxes[slotBoxIndex]; if ((L0017_ps_SlotBox->_iconIndex = iconIndex) == kM1_IconIndiceNone) { return; } @@ -237,15 +237,15 @@ void ObjectMan::f38_drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { void ObjectMan::f34_drawLeaderObjectName(Thing thing) { char* objectName = nullptr; - int16 L0007_i_IconIndex = _vm->_objectMan->f33_getIconIndex(thing); + int16 L0007_i_IconIndex = f33_getIconIndex(thing); if (L0007_i_IconIndex == k147_IconIndiceJunkChampionBones) { Junk *junk = (Junk*)_vm->_dungeonMan->f156_getThingData(thing); char champBonesName[16]; strcpy(champBonesName, _vm->_championMan->_gK71_champions[junk->getChargeCount()]._name); - strcat(champBonesName, _vm->_objectMan->_g352_objectNames[L0007_i_IconIndex]); + strcat(champBonesName, _g352_objectNames[L0007_i_IconIndex]); objectName = champBonesName; } else { - objectName = _vm->_objectMan->_g352_objectNames[L0007_i_IconIndex]; + objectName = _g352_objectNames[L0007_i_IconIndex]; } _vm->_textMan->f41_printWithTrailingSpaces(_vm->_displayMan->_g348_bitmapScreen, k160_byteWidthScreen, 233, 37, k4_ColorCyan, k0_ColorBlack, objectName, k14_ObjectNameMaximumLength, k200_heightScreen); } @@ -265,7 +265,7 @@ void ObjectMan::f37_drawIconToScreen(int16 iconIndex, int16 posX, int16 posY) { L0014_s_Box._x2 = (L0014_s_Box._x1 = posX) + 15; L0014_s_Box._y2 = (L0014_s_Box._y1 = posY) + 15; - _vm->_objectMan->f36_extractIconFromBitmap(iconIndex, L0013_puc_Bitmap_Icon); + f36_extractIconFromBitmap(iconIndex, L0013_puc_Bitmap_Icon); _vm->_displayMan->f21_blitToScreen(L0013_puc_Bitmap_Icon, &L0014_s_Box, k8_byteWidth, kM1_ColorNoTransparency, 16); } } diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp index d55ebca232..51d203dac8 100644 --- a/engines/dm/text.cpp +++ b/engines/dm/text.cpp @@ -157,7 +157,7 @@ void TextMan::f46_messageAreaPrintString(Color color, const char* string) { L0030_i_StringLength = strlen(string); warning(false, "MISSING CODE: F0561_SCROLLER_IsTextScrolling"); if (true) { // there is a test here with F0561_SCROLLER_IsTextScrolling - _vm->_textMan->f53_printToLogicalScreen(_g359_messageAreaCursorColumn * 6, (_g358_messageAreaCursorRow * 7 - 6) + 177, color, k0_ColorBlack, string); + f53_printToLogicalScreen(_g359_messageAreaCursorColumn * 6, (_g358_messageAreaCursorRow * 7 - 6) + 177, color, k0_ColorBlack, string); } else { f40_printTextToBitmap(_g356_bitmapMessageAreaNewRow, k160_byteWidthScreen, _g359_messageAreaCursorColumn * 6, 5, color, k0_ColorBlack, string, 7); warning(false, "MISSING CODE: F0561_SCROLLER_IsTextScrolling"); @@ -223,6 +223,6 @@ void TextMan::f443_endgamePrintString(int16 x, int16 y, Color textColor, char* t } L1407_pc_Character++; } - _vm->_textMan->f53_printToLogicalScreen(x, y, textColor, k12_ColorDarkestGray, L1408_ac_ModifiedString); + f53_printToLogicalScreen(x, y, textColor, k12_ColorDarkestGray, L1408_ac_ModifiedString); } } diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index e2b3f5fbc5..6e5f4827da 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -114,19 +114,19 @@ void Timeline::f237_deleteEvent(uint16 eventIndex) { uint16 L0587_ui_EventCount; - _vm->_timeline->_g370_events[eventIndex]._type = k0_TMEventTypeNone; - if (eventIndex < _vm->_timeline->_g373_firstUnusedEventIndex) { - _vm->_timeline->_g373_firstUnusedEventIndex = eventIndex; + _g370_events[eventIndex]._type = k0_TMEventTypeNone; + if (eventIndex < _g373_firstUnusedEventIndex) { + _g373_firstUnusedEventIndex = eventIndex; } - _vm->_timeline->_g372_eventCount--; - if ((L0587_ui_EventCount = _vm->_timeline->_g372_eventCount) == 0) { + _g372_eventCount--; + if ((L0587_ui_EventCount = _g372_eventCount) == 0) { return; } L0586_ui_TimelineIndex = f235_getIndex(eventIndex); if (L0586_ui_TimelineIndex == L0587_ui_EventCount) { return; } - _vm->_timeline->_g371_timeline[L0586_ui_TimelineIndex] = _vm->_timeline->_g371_timeline[L0587_ui_EventCount]; + _g371_timeline[L0586_ui_TimelineIndex] = _g371_timeline[L0587_ui_EventCount]; f236_fixChronology(L0586_ui_TimelineIndex); } @@ -138,16 +138,16 @@ void Timeline::f236_fixChronology(uint16 timelineIndex) { bool L0585_B_ChronologyFixed; - if ((L0583_ui_EventCount = _vm->_timeline->_g372_eventCount) == 1) { + if ((L0583_ui_EventCount = _g372_eventCount) == 1) { return; } - L0584_ps_Event = &_vm->_timeline->_g370_events[L0582_ui_EventIndex = _vm->_timeline->_g371_timeline[timelineIndex]]; + L0584_ps_Event = &_g370_events[L0582_ui_EventIndex = _g371_timeline[timelineIndex]]; L0585_B_ChronologyFixed = false; while (timelineIndex > 0) { /* Check if the event should be moved earlier in the timeline */ L0581_ui_TimelineIndex = (timelineIndex - 1) >> 1; - if (f234_isEventABeforeB(L0584_ps_Event, &_vm->_timeline->_g370_events[_vm->_timeline->_g371_timeline[L0581_ui_TimelineIndex]])) { - _vm->_timeline->_g371_timeline[timelineIndex] = _vm->_timeline->_g371_timeline[L0581_ui_TimelineIndex]; + if (f234_isEventABeforeB(L0584_ps_Event, &_g370_events[_g371_timeline[L0581_ui_TimelineIndex]])) { + _g371_timeline[timelineIndex] = _g371_timeline[L0581_ui_TimelineIndex]; timelineIndex = L0581_ui_TimelineIndex; L0585_B_ChronologyFixed = true; } else { @@ -159,18 +159,18 @@ void Timeline::f236_fixChronology(uint16 timelineIndex) { L0583_ui_EventCount = ((L0583_ui_EventCount - 1) - 1) >> 1; while (timelineIndex <= L0583_ui_EventCount) { /* Check if the event should be moved later in the timeline */ L0581_ui_TimelineIndex = (timelineIndex << 1) + 1; - if (((L0581_ui_TimelineIndex + 1) < _vm->_timeline->_g372_eventCount) && (f234_isEventABeforeB(&_vm->_timeline->_g370_events[_vm->_timeline->_g371_timeline[L0581_ui_TimelineIndex + 1]], &_vm->_timeline->_g370_events[_vm->_timeline->_g371_timeline[L0581_ui_TimelineIndex]]))) { + if (((L0581_ui_TimelineIndex + 1) < _g372_eventCount) && (f234_isEventABeforeB(&_g370_events[_g371_timeline[L0581_ui_TimelineIndex + 1]], &_g370_events[_g371_timeline[L0581_ui_TimelineIndex]]))) { L0581_ui_TimelineIndex++; } - if (f234_isEventABeforeB(&_vm->_timeline->_g370_events[_vm->_timeline->_g371_timeline[L0581_ui_TimelineIndex]], L0584_ps_Event)) { - _vm->_timeline->_g371_timeline[timelineIndex] = _vm->_timeline->_g371_timeline[L0581_ui_TimelineIndex]; + if (f234_isEventABeforeB(&_g370_events[_g371_timeline[L0581_ui_TimelineIndex]], L0584_ps_Event)) { + _g371_timeline[timelineIndex] = _g371_timeline[L0581_ui_TimelineIndex]; timelineIndex = L0581_ui_TimelineIndex; } else { break; } } T0236011: - _vm->_timeline->_g371_timeline[timelineIndex] = L0582_ui_EventIndex; + _g371_timeline[timelineIndex] = L0582_ui_EventIndex; } bool Timeline::f234_isEventABeforeB(TimelineEvent* eventA, TimelineEvent* eventB) { @@ -186,11 +186,11 @@ uint16 Timeline::f235_getIndex(uint16 eventIndex) { uint16* L0580_pui_TimelineEntry; - for (L0579_ui_TimelineIndex = 0, L0580_pui_TimelineEntry = _vm->_timeline->_g371_timeline; L0579_ui_TimelineIndex < _vm->_timeline->_g369_eventMaxCount; L0579_ui_TimelineIndex++) { + for (L0579_ui_TimelineIndex = 0, L0580_pui_TimelineEntry = _g371_timeline; L0579_ui_TimelineIndex < _g369_eventMaxCount; L0579_ui_TimelineIndex++) { if (*L0580_pui_TimelineEntry++ == eventIndex) break; } - if (L0579_ui_TimelineIndex >= _vm->_timeline->_g369_eventMaxCount) { /* BUG0_00 Useless code. The function is always called with event indices that are in the timeline */ + if (L0579_ui_TimelineIndex >= _g369_eventMaxCount) { /* BUG0_00 Useless code. The function is always called with event indices that are in the timeline */ L0579_ui_TimelineIndex = 0; /* BUG0_01 Coding error without consequence. Wrong return value. If the specified event index is not found in the timeline the function returns 0 which is the same value that is returned if the event index is found in the first timeline entry. No consequence because this code is never executed */ } return L0579_ui_TimelineIndex; @@ -202,11 +202,11 @@ uint16 Timeline::f238_addEventGetEventIndex(TimelineEvent* event) { TimelineEvent* L0591_ps_Event; - if (_vm->_timeline->_g372_eventCount == _vm->_timeline->_g369_eventMaxCount) { + if (_g372_eventCount == _g369_eventMaxCount) { _vm->f19_displayErrorAndStop(45); } if ((event->_type >= k5_TMEventTypeCorridor) && (event->_type <= k10_TMEventTypeDoor)) { - for (L0588_ui_EventIndex = 0, L0591_ps_Event = _vm->_timeline->_g370_events; L0588_ui_EventIndex < _vm->_timeline->_g369_eventMaxCount; L0588_ui_EventIndex++, L0591_ps_Event++) { + for (L0588_ui_EventIndex = 0, L0591_ps_Event = _g370_events; L0588_ui_EventIndex < _g369_eventMaxCount; L0588_ui_EventIndex++, L0591_ps_Event++) { if ((L0591_ps_Event->_type >= k5_TMEventTypeCorridor) && (L0591_ps_Event->_type <= k10_TMEventTypeDoor)) { if ((event->_mapTime == L0591_ps_Event->_mapTime) && (event->getMapXY() == L0591_ps_Event->getMapXY()) && ((L0591_ps_Event->_type != k6_TMEventTypeWall) || (L0591_ps_Event->_C.A._cell == event->_C.A._cell))) { L0591_ps_Event->_C.A._effect = event->_C.A._effect; @@ -225,7 +225,7 @@ uint16 Timeline::f238_addEventGetEventIndex(TimelineEvent* event) { } } else { if (event->_type == k1_TMEventTypeDoorAnimation) { - for (L0588_ui_EventIndex = 0, L0591_ps_Event = _vm->_timeline->_g370_events; L0588_ui_EventIndex < _vm->_timeline->_g369_eventMaxCount; L0588_ui_EventIndex++, L0591_ps_Event++) { + for (L0588_ui_EventIndex = 0, L0591_ps_Event = _g370_events; L0588_ui_EventIndex < _g369_eventMaxCount; L0588_ui_EventIndex++, L0591_ps_Event++) { if ((event->_mapTime == L0591_ps_Event->_mapTime) && (event->getMapXY() == L0591_ps_Event->getMapXY())) { if (L0591_ps_Event->_type == k10_TMEventTypeDoor) { if (L0591_ps_Event->_C.A._effect == k2_SensorEffToggle) { @@ -241,7 +241,7 @@ uint16 Timeline::f238_addEventGetEventIndex(TimelineEvent* event) { } } else { if (event->_type == k2_TMEventTypeDoorDestruction) { - for (L0588_ui_EventIndex = 0, L0591_ps_Event = _vm->_timeline->_g370_events; L0588_ui_EventIndex < _vm->_timeline->_g369_eventMaxCount; L0588_ui_EventIndex++, L0591_ps_Event++) { + for (L0588_ui_EventIndex = 0, L0591_ps_Event = _g370_events; L0588_ui_EventIndex < _g369_eventMaxCount; L0588_ui_EventIndex++, L0591_ps_Event++) { if ((event->getMapXY() == L0591_ps_Event->getMapXY()) && (M29_map(event->_mapTime) == M29_map(L0591_ps_Event->_mapTime))) { if ((L0591_ps_Event->_type == k1_TMEventTypeDoorAnimation) || (L0591_ps_Event->_type == k10_TMEventTypeDoor)) { f237_deleteEvent(L0588_ui_EventIndex); @@ -251,14 +251,14 @@ uint16 Timeline::f238_addEventGetEventIndex(TimelineEvent* event) { } } } - _vm->_timeline->_g370_events[L0590_ui_NewEventIndex = _vm->_timeline->_g373_firstUnusedEventIndex] = *event; /* Copy the event data (Megamax C can assign structures) */ + _g370_events[L0590_ui_NewEventIndex = _g373_firstUnusedEventIndex] = *event; /* Copy the event data (Megamax C can assign structures) */ do { - if (_vm->_timeline->_g373_firstUnusedEventIndex == _vm->_timeline->_g369_eventMaxCount) + if (_g373_firstUnusedEventIndex == _g369_eventMaxCount) break; - _vm->_timeline->_g373_firstUnusedEventIndex++; - } while ((_vm->_timeline->_g370_events[_vm->_timeline->_g373_firstUnusedEventIndex])._type != k0_TMEventTypeNone); - _vm->_timeline->_g371_timeline[_vm->_timeline->_g372_eventCount] = L0590_ui_NewEventIndex; - f236_fixChronology(_vm->_timeline->_g372_eventCount++); + _g373_firstUnusedEventIndex++; + } while ((_g370_events[_g373_firstUnusedEventIndex])._type != k0_TMEventTypeNone); + _g371_timeline[_g372_eventCount] = L0590_ui_NewEventIndex; + f236_fixChronology(_g372_eventCount++); return L0590_ui_NewEventIndex; } @@ -380,13 +380,13 @@ T0261053: } bool Timeline::f240_isFirstEventExpiered() { - return (_vm->_timeline->_g372_eventCount && (M30_time(_vm->_timeline->_g370_events[_vm->_timeline->_g371_timeline[0]]._mapTime) <= _vm->_g313_gameTime)); + return (_g372_eventCount && (M30_time(_g370_events[_g371_timeline[0]]._mapTime) <= _vm->_g313_gameTime)); } void Timeline::f239_timelineExtractFirstEvent(TimelineEvent* event) { uint16 L0592_ui_EventIndex; - *event = _vm->_timeline->_g370_events[L0592_ui_EventIndex = _vm->_timeline->_g371_timeline[0]]; + *event = _g370_events[L0592_ui_EventIndex = _g371_timeline[0]]; f237_deleteEvent(L0592_ui_EventIndex); } @@ -424,7 +424,7 @@ void Timeline::f241_timelineProcessEvent1_doorAnimation(TimelineEvent* event) { } } event->_mapTime++; - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); return; } if (((L0599_T_GroupThing = _vm->_groupMan->f175_groupGetThing(L0593_ui_MapX, L0594_ui_MapY)) != Thing::_endOfList) && !getFlag(L0600_ui_CreatureAttributes = _vm->_dungeonMan->f144_getCreatureAttributes(L0599_T_GroupThing), k0x0040_MaskCreatureInfo_nonMaterial)) { @@ -436,7 +436,7 @@ void Timeline::f241_timelineProcessEvent1_doorAnimation(TimelineEvent* event) { L0597_puc_Square->setDoorState(L0596_i_DoorState); _vm->f064_SOUND_RequestPlay_CPSD(k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, L0593_ui_MapX, L0594_ui_MapY, k1_soundModePlayIfPrioritized); event->_mapTime++; - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); return; } } @@ -457,7 +457,7 @@ void Timeline::f241_timelineProcessEvent1_doorAnimation(TimelineEvent* event) { return; } } - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); T0241020_Return: ; } @@ -478,11 +478,11 @@ void Timeline::f242_timelineProcessEvent7_squareFakewall(TimelineEvent* event) { if (L0605_i_Effect == k1_SensorEffClear) { if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0603_ui_MapX == _vm->_dungeonMan->_g306_partyMapX) && (L0604_ui_MapY == _vm->_dungeonMan->_g307_partyMapY)) { event->_mapTime++; - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); } else { if (((L0606_T_Thing = _vm->_groupMan->f175_groupGetThing(L0603_ui_MapX, L0604_ui_MapY)) != Thing::_endOfList) && !getFlag(_vm->_dungeonMan->f144_getCreatureAttributes(L0606_T_Thing), k0x0040_MaskCreatureInfo_nonMaterial)) { event->_mapTime++; - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); } else { clearFlag(*L0607_puc_Square, k0x0004_FakeWallOpen); } @@ -520,7 +520,7 @@ void Timeline::f244_timelineProcessEvent10_squareDoor(TimelineEvent* event) { } } event->_type = k1_TMEventTypeDoorAnimation; - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); } void Timeline::f251_timelineProcessEvent9_squarePit(TimelineEvent* event) { @@ -578,7 +578,7 @@ void Timeline::f249_moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) { } if (AL0644_ui_ThingType == k14_ProjectileThingType) { L0646_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(L0645_T_Thing); - L0647_ps_Event = &_vm->_timeline->_g370_events[L0646_ps_Projectile->_eventIndex]; + L0647_ps_Event = &_g370_events[L0646_ps_Projectile->_eventIndex]; L0647_ps_Event->_C._projectile.setMapX(_vm->_moveSens->_g397_moveResultMapX); L0647_ps_Event->_C._projectile.setMapY(_vm->_moveSens->_g398_moveResultMapY); L0647_ps_Event->_C._projectile.setDir((Direction)_vm->_moveSens->_g400_moveResultDir); @@ -586,7 +586,7 @@ void Timeline::f249_moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) { M31_setMap(L0647_ps_Event->_mapTime, _vm->_moveSens->_g399_moveResultMapIndex); } else { if (AL0644_ui_ThingType == k15_ExplosionThingType) { - for (AL0644_ui_EventIndex = 0, L0647_ps_Event = _vm->_timeline->_g370_events; AL0644_ui_EventIndex < _vm->_timeline->_g369_eventMaxCount; L0647_ps_Event++, AL0644_ui_EventIndex++) { + for (AL0644_ui_EventIndex = 0, L0647_ps_Event = _g370_events; AL0644_ui_EventIndex < _g369_eventMaxCount; L0647_ps_Event++, AL0644_ui_EventIndex++) { if ((L0647_ps_Event->_type == k25_TMEventTypeExplosion) && (L0647_ps_Event->_C._slot == L0645_T_Thing.toUint16())) { /* BUG0_23 A Fluxcage explosion remains on a square forever. If you open a pit or teleporter on a square where there is a Fluxcage explosion, the Fluxcage explosion is moved but the associated event is not updated (because Fluxcage explosions do not use k25_TMEventTypeExplosion but rather k24_TMEventTypeRemoveFluxcage) causing the Fluxcage explosion to remain in the dungeon forever on its destination square. When the k24_TMEventTypeRemoveFluxcage expires the explosion thing is not removed, but it is marked as unused. Consequently, any objects placed on the Fluxcage square after it was moved but before it expires become orphans upon expiration. After expiration, any object placed on the fluxcage square is cloned when picked up */ L0647_ps_Event->_B._location._mapX = _vm->_moveSens->_g397_moveResultMapX; L0647_ps_Event->_B._location._mapY = _vm->_moveSens->_g398_moveResultMapY; @@ -854,7 +854,7 @@ void Timeline::f245_timlineProcessEvent5_squareCorridor(TimelineEvent* event) { L0619_s_Event._B._location._mapX = L0616_ui_MapX; L0619_s_Event._B._location._mapY = L0617_ui_MapY; L0619_s_Event._B._location._mapY = L0617_ui_MapY; - _vm->_timeline->f238_addEventGetEventIndex(&L0619_s_Event); + f238_addEventGetEventIndex(&L0619_s_Event); } } } @@ -904,7 +904,7 @@ T0252001: } } event->_mapTime += 5; - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); } } @@ -1027,7 +1027,7 @@ void Timeline::f257_timelineProcessEvent70_light(TimelineEvent* event) { L0676_s_Event._B._lightPower = L0673_i_WeakerLightPower; M33_setMapAndTime(L0676_s_Event._mapTime, _vm->_dungeonMan->_g309_partyMapIndex, _vm->_g313_gameTime + 4); L0676_s_Event._priority = 0; - _vm->_timeline->f238_addEventGetEventIndex(&L0676_s_Event); + f238_addEventGetEventIndex(&L0676_s_Event); } } @@ -1063,7 +1063,7 @@ void Timeline::f255_timelineProcessEvent13_ViAltarRebirth(TimelineEvent* event) T0255002: L0670_ui_Step--; event->_C.A._effect = L0670_ui_Step; - _vm->_timeline->f238_addEventGetEventIndex(event); + f238_addEventGetEventIndex(event); break; case 1: L0667_T_Thing = _vm->_dungeonMan->f161_getSquareFirstThing(L0664_i_MapX, L0665_i_MapY); |