From 361722d459b1afff6b12ba722420e86703b06dea Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 27 Aug 2016 23:10:13 +0200 Subject: DM: More renaming in DungeonMan, move some arrays --- engines/dm/champion.cpp | 8 +-- engines/dm/console.cpp | 2 +- engines/dm/dm.cpp | 5 +- engines/dm/dm.h | 1 - engines/dm/dmglobals.cpp | 7 --- engines/dm/dungeonman.cpp | 139 ++++++++++++++++++++++++---------------------- engines/dm/dungeonman.h | 16 ++---- engines/dm/gfx.cpp | 6 +- engines/dm/group.cpp | 29 +++++----- engines/dm/inventory.cpp | 11 ++-- engines/dm/loadsave.cpp | 2 +- engines/dm/menus.cpp | 8 +-- engines/dm/movesens.cpp | 2 +- engines/dm/objectman.cpp | 2 +- engines/dm/projexpl.cpp | 8 +-- engines/dm/timeline.cpp | 6 +- 16 files changed, 125 insertions(+), 127 deletions(-) (limited to 'engines/dm') diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 95f5bfa123..271af524e6 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -852,7 +852,7 @@ int16 ChampionMan::getWoundDefense(int16 champIndex, uint16 woundIndex) { Thing curThing = curChampion->_slots[slotIndex]; if (curThing.getType() == k6_ArmourThingType) { ArmourInfo *armorInfo = (ArmourInfo *)_vm->_dungeonMan->getThingData(curThing); - armorInfo = &_vm->_dungeonMan->_armourInfo[((Armour *)armorInfo)->getType()]; + armorInfo = &_vm->_dungeonMan->_armourInfos[((Armour *)armorInfo)->getType()]; if (getFlag(armorInfo->_attributes, k0x0080_ArmourAttributeIsAShield)) armorShieldDefense += ((getStrength(champIndex, slotIndex) + _vm->_dungeonMan->getArmourDefense(armorInfo, useSharpDefense)) * woundDefenseFactor[woundIndex]) >> ((slotIndex == woundIndex) ? 4 : 5); } @@ -867,7 +867,7 @@ int16 ChampionMan::getWoundDefense(int16 champIndex, uint16 woundIndex) { Thing curThing = curChampion->_slots[woundIndex]; if (curThing.getType() == k6_ArmourThingType) { ArmourInfo *armourInfo = (ArmourInfo *)_vm->_dungeonMan->getThingData(curThing); - woundDefense += _vm->_dungeonMan->getArmourDefense(&_vm->_dungeonMan->_armourInfo[((Armour *)armourInfo)->getType()], useSharpDefense); + woundDefense += _vm->_dungeonMan->getArmourDefense(&_vm->_dungeonMan->_armourInfos[((Armour *)armourInfo)->getType()], useSharpDefense); } } @@ -1319,7 +1319,7 @@ void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) { if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none)) return; - if ((leaderHandObject != Thing::_none) && (!(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(leaderHandObject)]._allowedSlots & _slotMasks[slotIndex]))) + if ((leaderHandObject != Thing::_none) && (!(_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(leaderHandObject)]._allowedSlots & _slotMasks[slotIndex]))) return; _vm->_eventMan->showMouse(); @@ -1964,7 +1964,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { while (curThing != Thing::_endOfList) { ThingType thingType = curThing.getType(); if ((thingType > k3_SensorThingType) && (curThing.getCell() == championObjectsCell)) { - int16 objectAllowedSlots = _vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(curThing)]._allowedSlots; + int16 objectAllowedSlots = _vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(curThing)]._allowedSlots; uint16 curSlotIndex = k0_ChampionSlotReadyHand; switch (thingType) { case k6_ArmourThingType: { diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp index c5ebd140af..a8157003d6 100644 --- a/engines/dm/console.cpp +++ b/engines/dm/console.cpp @@ -250,7 +250,7 @@ bool Console::Cmd_gimme(int argc, const char** argv) { for (int16 thingType = 0; thingType < 16; ++thingType) { // 16 number of item types uint16 *thingDataArray = _vm->_dungeonMan->_thingData[thingType]; - uint16 thingTypeSize = g235_ThingDataWordCount[thingType]; + uint16 thingTypeSize = _vm->_dungeonMan->_thingDataWordCount[thingType]; uint16 thingCount = _vm->_dungeonMan->_dungeonFileHeader._thingCounts[thingType]; Thing dummyThing(0); diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index d7720180b7..0bb227a06f 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -1038,5 +1038,8 @@ void DMEngine::fuseSequenceUpdate() { The ending animation when Lord Chaos is fused plays too quickly because the execution speed is not limited */ } -Common::Language DMEngine::getGameLanguage() { return _gameVersion->_desc.language; } +Common::Language DMEngine::getGameLanguage() { + return _gameVersion->_desc.language; +} + } // End of namespace DM diff --git a/engines/dm/dm.h b/engines/dm/dm.h index a99eeb5afc..083dfad1c3 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -253,7 +253,6 @@ public: uint16 getRandomNumber(uint32 max) { return _rnd->getRandomNumber(max - 1); } int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL - void displayErrorAndStop(int16 errorIndex); // @ F0019_MAIN_DisplayErrorAndStop virtual Common::Error run(); // @ main void saveGame(); // @ F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF LoadgameResponse loadgame(int16 slot); // @ F0435_STARTEND_LoadGame_CPSF diff --git a/engines/dm/dmglobals.cpp b/engines/dm/dmglobals.cpp index b55c4052ba..02e819dff4 100644 --- a/engines/dm/dmglobals.cpp +++ b/engines/dm/dmglobals.cpp @@ -39,7 +39,6 @@ #include "movesens.h" #include "string.h" - namespace DM { void DMEngine::initConstants() { @@ -56,10 +55,4 @@ void DMEngine::initConstants() { _dirIntoStepCountNorth[3] = 0; // South } -void DMEngine::displayErrorAndStop(int16 errorIndex) { - debug("Stuff hit the fun: %d", errorIndex); - Common::Event event; - while (_system->getEventManager()->pollEvent(event) || true) - ; -} } // End of namespace DM diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 3fb452a516..eff761a825 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -35,41 +35,8 @@ #include "movesens.h" #include "projexpl.h" - namespace DM { -CreatureInfo g243_CreatureInfo[k27_CreatureTypeCount] = { // @ G0243_as_Graphic559_CreatureInfo - /* { CreatureAspectIndex, AttackSoundOrdinal, Attributes, GraphicInfo, - MovementTicks, AttackTicks, Defense, BaseHealth, Attack, PoisonAttack, - Dexterity, Ranges, Properties, Resistances, AnimationTicks, WoundProbabilities, AttackType } */ - {0, 4, 0x0482, 0x623D, 8, 20, 55, 150, 150, 240, 55, 0x1153, 0x299B, 0x0876, 0x0254, 0xFD40, 4}, - {1, 0, 0x0480, 0xA625, 15, 32, 20, 110, 80, 15, 20, 0x3132, 0x33A9, 0x0E42, 0x0384, 0xFC41, 3}, - {2, 6, 0x0510, 0x6198, 3, 5, 50, 10, 10, 0, 110, 0x1376, 0x710A, 0x0235, 0x0222, 0xFD20, 0}, - {3, 0, 0x04B4, 0xB225, 10, 21, 30, 40, 58, 0, 80, 0x320A, 0x96AA, 0x0B3C, 0x0113, 0xF910, 5}, - {4, 1, 0x0701, 0xA3B8, 9, 8, 45, 101, 90, 0, 65, 0x1554, 0x58FF, 0x0A34, 0x0143, 0xFE93, 4}, - {5, 0, 0x0581, 0x539D, 20, 18, 100, 60, 30, 0, 30, 0x1232, 0x4338, 0x0583, 0x0265, 0xFFD6, 3}, - {6, 3, 0x070C, 0x0020, 120, 10, 5, 165, 5, 0, 5, 0x1111, 0x10F1, 0x0764, 0x02F2, 0xFC84, 6}, - {7, 7, 0x0300, 0x0220, 185, 15, 170, 50, 40, 5, 10, 0x1463, 0x25C4, 0x06E3, 0x01F4, 0xFD93, 4}, /* Atari ST: AttackSoundOrdinal = 0 */ - {8, 2, 0x1864, 0x5225, 11, 16, 15, 30, 55, 0, 80, 0x1423, 0x4664, 0x0FC8, 0x0116, 0xFB30, 6}, - {9, 10, 0x0282, 0x71B8, 21, 14, 240, 120, 219, 0, 35, 0x1023, 0x3BFF, 0x0FF7, 0x04F3, 0xF920, 3}, /* Atari ST: AttackSoundOrdinal = 7 */ - {10, 2, 0x1480, 0x11B8, 17, 12, 25, 33, 20, 0, 40, 0x1224, 0x5497, 0x0F15, 0x0483, 0xFB20, 3}, - {11, 0, 0x18C6, 0x0225, 255, 8, 45, 80, 105, 0, 60, 0x1314, 0x55A5, 0x0FF9, 0x0114, 0xFD95, 1}, - {12, 11, 0x1280, 0x6038, 7, 7, 22, 20, 22, 0, 80, 0x1013, 0x6596, 0x0F63, 0x0132, 0xFA30, 4}, /* Atari ST: AttackSoundOrdinal = 8 */ - {13, 9, 0x14A2, 0xB23D, 5, 10, 42, 39, 90, 100, 88, 0x1343, 0x5734, 0x0638, 0x0112, 0xFA30, 4}, /* Atari ST: AttackSoundOrdinal = 0 */ - {14, 0, 0x05B8, 0x1638, 10, 20, 47, 44, 75, 0, 90, 0x4335, 0xD952, 0x035B, 0x0664, 0xFD60, 5}, - {15, 5, 0x0381, 0x523D, 18, 19, 72, 70, 45, 35, 35, 0x1AA1, 0x15AB, 0x0B93, 0x0253, 0xFFC5, 4}, - {16, 10, 0x0680, 0xA038, 13, 8, 28, 20, 25, 0, 41, 0x1343, 0x2148, 0x0321, 0x0332, 0xFC30, 3}, /* Atari ST: AttackSoundOrdinal = 7 */ - {17, 0, 0x04A0, 0xF23D, 1, 16, 180, 8, 28, 20, 150, 0x1432, 0x19FD, 0x0004, 0x0112, 0xF710, 4}, - {18, 11, 0x0280, 0xA3BD, 14, 6, 140, 60, 105, 0, 70, 0x1005, 0x7AFF, 0x0FFA, 0x0143, 0xFA30, 4}, /* Atari ST: AttackSoundOrdinal = 8 */ - {19, 0, 0x0060, 0xE23D, 5, 18, 15, 33, 61, 0, 65, 0x3258, 0xAC77, 0x0F56, 0x0117, 0xFC40, 5}, - {20, 8, 0x10DE, 0x0225, 25, 25, 75, 144, 66, 0, 50, 0x1381, 0x7679, 0x0EA7, 0x0345, 0xFD93, 3}, /* Atari ST: AttackSoundOrdinal = 0 */ - {21, 3, 0x0082, 0xA3BD, 7, 15, 33, 77, 130, 0, 60, 0x1592, 0x696A, 0x0859, 0x0224, 0xFC30, 4}, - {22, 0, 0x1480, 0x53BD, 10, 14, 68, 100, 100, 0, 75, 0x4344, 0xBDF9, 0x0A5D, 0x0124, 0xF920, 3}, - {23, 0, 0x38AA, 0x0038, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}, - {24, 1, 0x068A, 0x97BD, 13, 28, 110, 255, 255, 0, 70, 0x3645, 0xBF7C, 0x06CD, 0x0445, 0xFC30, 4}, /* Atari ST Version 1.0 1987-12-08 1987-12-11: Ranges = 0x2645 */ - {25, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}, - {26, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}}; - void DungeonMan::mapCoordsAfterRelMovement(Direction dir, int16 stepsForward, int16 stepsRight, int16 &posX, int16 &posY) { posX += _vm->_dirIntoStepCountEast[dir] * stepsForward; posY += _vm->_dirIntoStepCountNorth[dir] * stepsForward; @@ -78,7 +45,7 @@ void DungeonMan::mapCoordsAfterRelMovement(Direction dir, int16 stepsForward, in posY += _vm->_dirIntoStepCountNorth[dir] * stepsRight; } -void DungeonMan::setupArrays() { +void DungeonMan::setupConstants() { ObjectInfo objectInfo[180] = { // @ G0237_as_Graphic559_ObjectInfo /* { Type, ObjectAspectIndex, ActionSetIndex, AllowedSlots } */ ObjectInfo(30, 1, 0, 0x0500), /* COMPASS Pouch/Chest */ @@ -374,14 +341,72 @@ void DungeonMan::setupArrays() { WeaponInfo(36, 255, 100, 50, 0x20FF) /* THE FIRESTAFF */ }; + CreatureInfo creatureInfo[k27_CreatureTypeCount] = { // @ G0243_as_Graphic559_CreatureInfo + /* { CreatureAspectIndex, AttackSoundOrdinal, Attributes, GraphicInfo, + MovementTicks, AttackTicks, Defense, BaseHealth, Attack, PoisonAttack, + Dexterity, Ranges, Properties, Resistances, AnimationTicks, WoundProbabilities, AttackType } */ + {0, 4, 0x0482, 0x623D, 8, 20, 55, 150, 150, 240, 55, 0x1153, 0x299B, 0x0876, 0x0254, 0xFD40, 4}, + {1, 0, 0x0480, 0xA625, 15, 32, 20, 110, 80, 15, 20, 0x3132, 0x33A9, 0x0E42, 0x0384, 0xFC41, 3}, + {2, 6, 0x0510, 0x6198, 3, 5, 50, 10, 10, 0, 110, 0x1376, 0x710A, 0x0235, 0x0222, 0xFD20, 0}, + {3, 0, 0x04B4, 0xB225, 10, 21, 30, 40, 58, 0, 80, 0x320A, 0x96AA, 0x0B3C, 0x0113, 0xF910, 5}, + {4, 1, 0x0701, 0xA3B8, 9, 8, 45, 101, 90, 0, 65, 0x1554, 0x58FF, 0x0A34, 0x0143, 0xFE93, 4}, + {5, 0, 0x0581, 0x539D, 20, 18, 100, 60, 30, 0, 30, 0x1232, 0x4338, 0x0583, 0x0265, 0xFFD6, 3}, + {6, 3, 0x070C, 0x0020, 120, 10, 5, 165, 5, 0, 5, 0x1111, 0x10F1, 0x0764, 0x02F2, 0xFC84, 6}, + {7, 7, 0x0300, 0x0220, 185, 15, 170, 50, 40, 5, 10, 0x1463, 0x25C4, 0x06E3, 0x01F4, 0xFD93, 4}, /* Atari ST: AttackSoundOrdinal = 0 */ + {8, 2, 0x1864, 0x5225, 11, 16, 15, 30, 55, 0, 80, 0x1423, 0x4664, 0x0FC8, 0x0116, 0xFB30, 6}, + {9, 10, 0x0282, 0x71B8, 21, 14, 240, 120, 219, 0, 35, 0x1023, 0x3BFF, 0x0FF7, 0x04F3, 0xF920, 3}, /* Atari ST: AttackSoundOrdinal = 7 */ + {10, 2, 0x1480, 0x11B8, 17, 12, 25, 33, 20, 0, 40, 0x1224, 0x5497, 0x0F15, 0x0483, 0xFB20, 3}, + {11, 0, 0x18C6, 0x0225, 255, 8, 45, 80, 105, 0, 60, 0x1314, 0x55A5, 0x0FF9, 0x0114, 0xFD95, 1}, + {12, 11, 0x1280, 0x6038, 7, 7, 22, 20, 22, 0, 80, 0x1013, 0x6596, 0x0F63, 0x0132, 0xFA30, 4}, /* Atari ST: AttackSoundOrdinal = 8 */ + {13, 9, 0x14A2, 0xB23D, 5, 10, 42, 39, 90, 100, 88, 0x1343, 0x5734, 0x0638, 0x0112, 0xFA30, 4}, /* Atari ST: AttackSoundOrdinal = 0 */ + {14, 0, 0x05B8, 0x1638, 10, 20, 47, 44, 75, 0, 90, 0x4335, 0xD952, 0x035B, 0x0664, 0xFD60, 5}, + {15, 5, 0x0381, 0x523D, 18, 19, 72, 70, 45, 35, 35, 0x1AA1, 0x15AB, 0x0B93, 0x0253, 0xFFC5, 4}, + {16, 10, 0x0680, 0xA038, 13, 8, 28, 20, 25, 0, 41, 0x1343, 0x2148, 0x0321, 0x0332, 0xFC30, 3}, /* Atari ST: AttackSoundOrdinal = 7 */ + {17, 0, 0x04A0, 0xF23D, 1, 16, 180, 8, 28, 20, 150, 0x1432, 0x19FD, 0x0004, 0x0112, 0xF710, 4}, + {18, 11, 0x0280, 0xA3BD, 14, 6, 140, 60, 105, 0, 70, 0x1005, 0x7AFF, 0x0FFA, 0x0143, 0xFA30, 4}, /* Atari ST: AttackSoundOrdinal = 8 */ + {19, 0, 0x0060, 0xE23D, 5, 18, 15, 33, 61, 0, 65, 0x3258, 0xAC77, 0x0F56, 0x0117, 0xFC40, 5}, + {20, 8, 0x10DE, 0x0225, 25, 25, 75, 144, 66, 0, 50, 0x1381, 0x7679, 0x0EA7, 0x0345, 0xFD93, 3}, /* Atari ST: AttackSoundOrdinal = 0 */ + {21, 3, 0x0082, 0xA3BD, 7, 15, 33, 77, 130, 0, 60, 0x1592, 0x696A, 0x0859, 0x0224, 0xFC30, 4}, + {22, 0, 0x1480, 0x53BD, 10, 14, 68, 100, 100, 0, 75, 0x4344, 0xBDF9, 0x0A5D, 0x0124, 0xF920, 3}, + {23, 0, 0x38AA, 0x0038, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}, + {24, 1, 0x068A, 0x97BD, 13, 28, 110, 255, 255, 0, 70, 0x3645, 0xBF7C, 0x06CD, 0x0445, 0xFC30, 4}, /* Atari ST Version 1.0 1987-12-08 1987-12-11: Ranges = 0x2645 */ + {25, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5}, + {26, 0, 0x38AA, 0x0000, 12, 22, 255, 180, 210, 0, 130, 0x6369, 0xFF37, 0x0FBF, 0x0564, 0xFB52, 5} + }; + // this is the number of uint16s the data has to be stored, not the length of the data in dungeon.dat! + byte thingDataWordCount[16] = { // @ G0235_auc_Graphic559_ThingDataByteCount + 2, /* Door */ + 3, /* Teleporter */ + 2, /* Text String */ + 4, /* Sensor */ + 9, /* Group */ + 2, /* Weapon */ + 2, /* Armour */ + 2, /* Scroll */ + 2, /* Potion */ + 4, /* Container */ + 2, /* Junk */ + 0, /* Unused */ + 0, /* Unused */ + 0, /* Unused */ + 5, /* Projectile */ + 2 /* Explosion */ + }; + for (int i = 0; i < 180; i++) - _objectInfo[i] = objectInfo[i]; + _objectInfos[i] = objectInfo[i]; for (int i = 0; i < 58; i++) - _armourInfo[i] = armourInfo[i]; + _armourInfos[i] = armourInfo[i]; for (int i = 0; i < 46; i++) - _weaponInfo[i] = weaponInfo[i]; + _weaponInfos[i] = weaponInfo[i]; + + for (int i = 0; i < k27_CreatureTypeCount; i++) + _creatureInfos[i] = creatureInfo[i]; + + for (int i = 0; i < 16; i++) + _thingDataWordCount[i] = thingDataWordCount[i]; } @@ -423,7 +448,7 @@ DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine) { for (uint16 i = 0; i < 2; ++i) _currMapDoorInfo[i].resetToZero(); - setupArrays(); + setupConstants(); } DungeonMan::~DungeonMan() { @@ -501,26 +526,6 @@ void DungeonMan::decompressDungeonFile() { f.close(); } -// this is the number of uint16s the data has to be stored, not the length of the data in dungeon.dat! -byte g235_ThingDataWordCount[16] = { // @ G0235_auc_Graphic559_ThingDataByteCount - 2, /* Door */ - 3, /* Teleporter */ - 2, /* Text String */ - 4, /* Sensor */ - 9, /* Group */ - 2, /* Weapon */ - 2, /* Armour */ - 2, /* Scroll */ - 2, /* Potion */ - 4, /* Container */ - 2, /* Junk */ - 0, /* Unused */ - 0, /* Unused */ - 0, /* Unused */ - 5, /* Projectile */ - 2 /* Explosion */ -}; - const Thing Thing::_none(0); // @ C0xFFFF_THING_NONE const Thing Thing::_endOfList(0xFFFE); // @ C0xFFFE_THING_ENDOFLIST const Thing Thing::_firstExplosion(0xFF80); // @ C0xFF80_THING_FIRST_EXPLOSION @@ -680,7 +685,7 @@ void DungeonMan::loadDungeonFile(Common::InSaveFile *file) { if (_vm->_newGameFl) _dungeonFileHeader._thingCounts[thingType] = MIN((thingType == k15_ExplosionThingType) ? 768 : 1024, thingCount + additionalThingCounts[thingType]); - uint16 thingStoreWordCount = g235_ThingDataWordCount[thingType]; + uint16 thingStoreWordCount = _thingDataWordCount[thingType]; if (thingStoreWordCount == 0) continue; @@ -1017,7 +1022,7 @@ bool DungeonMan::isWallOrnAnAlcove(int16 wallOrnIndex) { } uint16 *DungeonMan::getThingData(Thing thing) { - return _thingData[thing.getType()] + thing.getIndex() * g235_ThingDataWordCount[thing.getType()]; + return _thingData[thing.getType()] + thing.getIndex() * _thingDataWordCount[thing.getType()]; } uint16* DungeonMan::getSquareFirstThingData(int16 mapX, int16 mapY) { @@ -1110,7 +1115,7 @@ void DungeonMan::decodeText(char *destString, Thing thing, TextType type) { {0, 0, 0, 0, 0, 0, 0, 0} }; - TextString textString(_thingData[k2_TextstringType] + thing.getIndex() * g235_ThingDataWordCount[k2_TextstringType]); + TextString textString(_thingData[k2_TextstringType] + thing.getIndex() * _thingDataWordCount[k2_TextstringType]); if ((textString.isVisible()) || (type & k0x8000_DecodeEvenIfInvisible)) { type = (TextType)(type & ~k0x8000_DecodeEvenIfInvisible); char sepChar; @@ -1181,7 +1186,7 @@ Thing DungeonMan::getUnusedThing(uint16 thingType) { thingCount -= 3; /* Always keep 3 unused JUNK things for the bones of dead champions */ int16 thingIdx = thingCount; - int16 thingDataByteCount = g235_ThingDataWordCount[thingType] >> 1; + int16 thingDataByteCount = _thingDataWordCount[thingType] >> 1; Thing *thingPtr = (Thing *)_thingData[thingType]; Thing curThing; @@ -1243,10 +1248,10 @@ uint16 DungeonMan::getObjectWeight(Thing thing) { switch (thing.getType()) { case k5_WeaponThingType: - weight = _weaponInfo[((Weapon *)junk)->getType()]._weight; + weight = _weaponInfos[((Weapon *)junk)->getType()]._weight; break; case k6_ArmourThingType: - weight = _armourInfo[((Armour *)junk)->getType()]._weight; + weight = _armourInfos[((Armour *)junk)->getType()]._weight; break; case k10_JunkThingType: weight = junkInfo[junk->getType()]; @@ -1342,7 +1347,7 @@ void DungeonMan::linkThingToList(Thing thingToLink, Thing thingInList, int16 map WeaponInfo* DungeonMan::getWeaponInfo(Thing thing) { Weapon* weapon = (Weapon*)getThingData(thing); - return &_weaponInfo[weapon->getType()]; + return &_weaponInfos[weapon->getType()]; } int16 DungeonMan::getProjectileAspect(Thing thing) { @@ -1365,7 +1370,7 @@ int16 DungeonMan::getProjectileAspect(Thing thing) { return -projAspOrd; } - return _objectInfo[getObjectInfoIndex(thing)]._objectAspectIndex; + return _objectInfos[getObjectInfoIndex(thing)]._objectAspectIndex; } int16 DungeonMan::getLocationAfterLevelChange(int16 mapIndex, int16 levelDelta, int16* mapX, int16* mapY) { @@ -1510,7 +1515,7 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) { uint16 DungeonMan::getCreatureAttributes(Thing thing) { Group *currGroup = (Group *)getThingData(thing); - return g243_CreatureInfo[currGroup->_type]._attributes; + return _creatureInfos[currGroup->_type]._attributes; } void DungeonMan::setGroupCells(Group* group, uint16 cells, uint16 mapIndex) { diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 1f52614b21..ac85b28be0 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -31,7 +31,6 @@ #include "dm.h" #include "gfx.h" - namespace DM { /* Object info */ @@ -207,9 +206,6 @@ public: uint16 getAttackRange() { return (_ranges >> 12) & 0xF; } }; // @ CREATURE_INFO - -extern CreatureInfo g243_CreatureInfo[k27_CreatureTypeCount]; // @ G0243_as_Graphic559_CreatureInfo - class Door { Thing _nextThing; uint16 _attributes; @@ -637,8 +633,6 @@ public: class Group; -extern byte g235_ThingDataWordCount[16]; - class DungeonMan { DMEngine *_vm; @@ -732,11 +726,13 @@ public: Thing _pileTopObject[5]; // @ G0292_aT_PileTopObject DoorInfo _currMapDoorInfo[2]; // @ G0275_as_CurrentMapDoorInfo - ObjectInfo _objectInfo[180]; // @ G0237_as_Graphic559_ObjectInfo - ArmourInfo _armourInfo[58]; // @ G0239_as_Graphic559_ArmourInfo - WeaponInfo _weaponInfo[46]; // @ G0238_as_Graphic559_WeaponInfo + ObjectInfo _objectInfos[180]; // @ G0237_as_Graphic559_ObjectInfo + ArmourInfo _armourInfos[58]; // @ G0239_as_Graphic559_ArmourInfo + WeaponInfo _weaponInfos[46]; // @ G0238_as_Graphic559_WeaponInfo + CreatureInfo _creatureInfos[k27_CreatureTypeCount]; // @ G0243_as_Graphic559_CreatureInfo + byte _thingDataWordCount[16]; // @ G0235_auc_Graphic559_ThingDataByteCount - void setupArrays(); + void setupConstants(); }; } diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index d4023056e2..296ee96cf1 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -576,7 +576,7 @@ void DisplayMan::initializeGraphicData() { for (int16 creatureIndex = 0; creatureIndex < k27_CreatureTypeCount; creatureIndex++) { creatureAsp = &_creatureAspects219[creatureIndex]; - int16 creatureGraphicInfo = g243_CreatureInfo[creatureIndex]._graphicInfo; + int16 creatureGraphicInfo = _vm->_dungeonMan->_creatureInfos[creatureIndex]._graphicInfo; creatureAsp->_firstDerivedBitmapIndex = derivedBitmapIndex; int16 creatureFrontBitmapD3PixelCount = getScaledBitmapByteCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k16_Scale_D3); @@ -3110,7 +3110,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir } if ((viewSquareIndex >= k0_ViewSquare_D3C) && (viewSquareIndex <= k9_ViewSquare_D0C) && (thingParam.getCell() == cellYellowBear)) { /* Square where objects are visible and object is located on cell being processed */ - objectAspect = &(_objectAspects209[_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(thingParam)]._objectAspectIndex]); + objectAspect = &(_objectAspects209[_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(thingParam)]._objectAspectIndex]); AL_4_nativeBitmapIndex = k360_FirstObjectGraphicIndice + objectAspect->_firstNativeBitmapRelativeIndex; useAlcoveObjectImage = (L0135_B_DrawAlcoveObjects && getFlag(objectAspect->_graphicInfo, k0x0010_ObjectAlcoveMask) && !viewLane); if (useAlcoveObjectImage) @@ -3235,7 +3235,7 @@ T0115015_DrawProjectileAsObject: if (group == nullptr) { /* If all creature data and info has not already been gathered */ group = (Group*)_vm->_dungeonMan->getThingData(groupThing); activeGroup = &_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]; - CreatureInfo *creatureInfo = &g243_CreatureInfo[group->_type]; + CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type]; creatureAspectStruct = &_creatureAspects219[creatureInfo->_creatureAspectIndex]; creatureSize = getFlag(creatureInfo->_attributes, k0x0003_MaskCreatureInfo_size); creatureGraphicInfoGreen = creatureInfo->_graphicInfo; diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index 677fd704ad..519a62e564 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -106,7 +106,7 @@ int16 GroupMan::getCreatureOrdinalInCell(Group *group, uint16 cell) { int retval = 0; byte creatureIndex = group->getCount(); - if (getFlag(g243_CreatureInfo[group->_type]._attributes, k0x0003_MaskCreatureInfo_size) == k1_MaskCreatureSizeHalf) { + if (getFlag(_vm->_dungeonMan->_creatureInfos[group->_type]._attributes, k0x0003_MaskCreatureInfo_size) == k1_MaskCreatureSizeHalf) { if ((getGroupDirections(group, currMapIndex) & 1) == (cell & 1)) cell = returnPrevVal(cell); @@ -136,7 +136,7 @@ uint16 GroupMan::getCreatureValue(uint16 groupVal, uint16 creatureIndex) { void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, int16 mode) { Group *group = (Group *)_vm->_dungeonMan->getThingData(groupThing); uint16 creatureType = group->_type; - if ((mode >= k0_soundModePlayImmediately) && getFlag(g243_CreatureInfo[creatureType]._attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) { + if ((mode >= k0_soundModePlayImmediately) && getFlag(_vm->_dungeonMan->_creatureInfos[creatureType]._attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) { int16 creatureIndex = group->getCount(); uint16 groupCells = getGroupCells(group, _vm->_dungeonMan->_currMapIndex); do { @@ -417,7 +417,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex uint16 L0384_ui_Cell; - L0376_ps_CreatureInfo = &g243_CreatureInfo[AL0380_ui_CreatureType = group->_type]; + L0376_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[AL0380_ui_CreatureType = group->_type]; if (getFlag(L0376_ps_CreatureInfo->_attributes, k0x2000_MaskCreatureInfo_archenemy)) /* Lord Chaos cannot be damaged */ goto T0190024; if (group->_health[creatureIndex] <= damage) { @@ -582,8 +582,7 @@ int16 GroupMan::getDamageAllCreaturesOutcome(Group *group, int16 mapX, int16 map int16 GroupMan::groupGetResistanceAdjustedPoisonAttack(uint16 creatreType, int16 poisonAttack) { int16 L0390_i_PoisonResistance; - - if (!poisonAttack || ((L0390_i_PoisonResistance = g243_CreatureInfo[creatreType].getPoisonResistance()) == k15_immuneToPoison)) { + if (!poisonAttack || ((L0390_i_PoisonResistance = _vm->_dungeonMan->_creatureInfos[creatreType].getPoisonResistance()) == k15_immuneToPoison)) { return 0; } return ((poisonAttack + _vm->getRandomNumber(4)) << 3) / ++L0390_i_PoisonResistance; @@ -642,7 +641,7 @@ void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, int16 event goto T0209139_Return; } L0444_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0449_T_GroupThing); - L0448_s_CreatureInfo = g243_CreatureInfo[L0444_ps_Group->_type]; + L0448_s_CreatureInfo = _vm->_dungeonMan->_creatureInfos[L0444_ps_Group->_type]; /* Update the event */ setMapAndTime(L0465_s_NextEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime); L0465_s_NextEvent._priority = 255 - L0448_s_CreatureInfo._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */ @@ -1179,7 +1178,7 @@ int16 GroupMan::groupGetDistanceToVisibleParty(Group *group, int16 creatureIndex int16 L0425_ai_CreatureViewDirections[4]; /* List of directions to test */ - L0424_ps_CreatureInfo = &g243_CreatureInfo[group->_type]; + L0424_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type]; if (_vm->_championMan->_party._event71Count_Invisibility && !getFlag(L0424_ps_CreatureInfo->_attributes, k0x0800_MaskCreatureInfo_seeInvisible)) { return 0; } @@ -1289,7 +1288,7 @@ int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 crea uint16 L1635_ui_SoundIndex; L0329_ps_Group = &(((Group *)_vm->_dungeonMan->_thingData[k4_GroupThingType])[activeGroup->_groupThingIndex]); - L0327_ui_CreatureGraphicInfo = g243_CreatureInfo[L0331_ui_CreatureType = L0329_ps_Group->_type]._graphicInfo; + L0327_ui_CreatureGraphicInfo = _vm->_dungeonMan->_creatureInfos[L0331_ui_CreatureType = L0329_ps_Group->_type]._graphicInfo; L0330_B_ProcessGroup = (creatureIndex < 0); if (L0330_B_ProcessGroup) /* If the creature index is negative then all creatures in the group are processed */ creatureIndex = L0329_ps_Group->getCount(); @@ -1351,7 +1350,7 @@ int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 crea } activeGroup->_aspect[creatureIndex] = AL0326_ui_Aspect; } while (L0330_B_ProcessGroup && (creatureIndex--)); - AL0326_ui_AnimationTicks = g243_CreatureInfo[L0329_ps_Group->_type]._animationTicks; + AL0326_ui_AnimationTicks = _vm->_dungeonMan->_creatureInfos[L0329_ps_Group->_type]._animationTicks; return _vm->_gameTime + (isAttacking ? ((AL0326_ui_AnimationTicks >> 8) & 0xF) : ((AL0326_ui_AnimationTicks >> 4) & 0xF)) + _vm->getRandomNumber(2); } @@ -1473,7 +1472,7 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16 _vm->_projexpl->_lastCreatureAttackTime = _vm->_gameTime; ActiveGroup L0443_s_ActiveGroup = _activeGroups[group->getActiveGroupIndex()]; - CreatureInfo *L0441_ps_CreatureInfo = &g243_CreatureInfo[AL0437_ui_CreatureType = group->_type]; + CreatureInfo *L0441_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[AL0437_ui_CreatureType = group->_type]; uint16 L0438_ui_PrimaryDirectionToParty = _currGroupPrimaryDirToParty; if ((AL0439_i_GroupCells = L0443_s_ActiveGroup._cells) == k255_CreatureTypeSingleCenteredCreature) { AL0439_i_TargetCell = _vm->getRandomNumber(2); @@ -1650,7 +1649,7 @@ int16 GroupMan::getChampionDamage(Group *group, uint16 champIndex) { _vm->_championMan->wakeUp(); } L0563_i_DoubledMapDifficulty = _vm->_dungeonMan->_currMap->_difficulty << 1; - L0564_s_CreatureInfo = g243_CreatureInfo[group->_type]; + L0564_s_CreatureInfo = _vm->_dungeonMan->_creatureInfos[group->_type]; _vm->_championMan->addSkillExperience(champIndex, k7_ChampionSkillParry, L0564_s_CreatureInfo.getExperience()); if (_vm->_championMan->_partyIsSleeping || (((_vm->_championMan->getDexterity(L0562_ps_Champion) < (_vm->getRandomNumber(32) + L0564_s_CreatureInfo._dexterity + L0563_i_DoubledMapDifficulty - 16)) || !_vm->getRandomNumber(4)) && !_vm->_championMan->isLucky(L0562_ps_Champion, 60))) { if ((AL0559_ui_WoundTest = _vm->getRandomNumber(65536)) & 0x0070) { @@ -1719,7 +1718,7 @@ void GroupMan::startWanedring(int16 mapX, int16 mapY) { } setMapAndTime(L0333_s_Event._mapTime, _vm->_dungeonMan->_currMapIndex, (_vm->_gameTime + 1)); L0333_s_Event._type = k37_TMEventTypeUpdateBehaviourGroup; - L0333_s_Event._priority = 255 - g243_CreatureInfo[L0332_ps_Group->_type]._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */ + L0333_s_Event._priority = 255 - _vm->_dungeonMan->_creatureInfos[L0332_ps_Group->_type]._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */ L0333_s_Event._C._ticks = 0; L0333_s_Event._B._location._mapX = mapX; L0333_s_Event._B._location._mapY = mapY; @@ -1744,7 +1743,7 @@ void GroupMan::addActiveGroup(Thing thing, int16 mapX, int16 mapY) { _currActiveGroupCount++; L0340_ps_Group = (Group *)(_vm->_dungeonMan->_thingData[k4_GroupThingType] + - g235_ThingDataWordCount[k4_GroupThingType] * (L0341_ps_ActiveGroup->_groupThingIndex = (thing).getIndex())); + _vm->_dungeonMan->_thingDataWordCount[k4_GroupThingType] * (L0341_ps_ActiveGroup->_groupThingIndex = (thing).getIndex())); L0341_ps_ActiveGroup->_cells = L0340_ps_Group->_cells; L0340_ps_Group->getActiveGroupIndex() = L0344_i_ActiveGroupIndex; @@ -1837,7 +1836,7 @@ Thing GroupMan::groupGetGenerated(int16 creatureType, int16 healthMultiplier, ui else L0352_ui_GroupCells = k255_CreatureTypeSingleCenteredCreature; - L0354_ps_CreatureInfo = &g243_CreatureInfo[L0353_ps_Group->_type = creatureType]; + L0354_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L0353_ps_Group->_type = creatureType]; L0350_ui_BaseHealth = L0354_ps_CreatureInfo->_baseHealth; do { L0353_ps_Group->_health[creatureCount] = (L0350_ui_BaseHealth * healthMultiplier) + _vm->getRandomNumber((L0350_ui_BaseHealth >> 2) + 1); @@ -1904,7 +1903,7 @@ int16 GroupMan::getMeleeActionDamage(Champion* champ, int16 champIndex, Group* g return 0; } L0567_i_DoubledMapDifficulty = _vm->_dungeonMan->_currMap->_difficulty << 1; - L0572_ps_CreatureInfo = &g243_CreatureInfo[group->_type]; + L0572_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type]; L0571_i_ActionHandObjectIconIndex = _vm->_objectMan->getIconIndex(champ->_slots[k1_ChampionSlotActionHand]); L0570_B_ActionHitsNonMaterialCreatures = getFlag(actionHitProbability, k0x8000_hitNonMaterialCreatures); if (L0570_B_ActionHitsNonMaterialCreatures) diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index be1e976b20..ab8cf8ba0f 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -582,7 +582,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) { case k8_PotionThingType: { potentialAttribMask = k0x0001_DescriptionMaskConsumable; Potion *potion = (Potion *)rawThingPtr; - actualAttribMask = _vm->_dungeonMan->_objectInfo[k2_ObjectInfoIndexFirstPotion + potion->getType()].getAllowedSlots(); + actualAttribMask = _vm->_dungeonMan->_objectInfos[k2_ObjectInfoIndexFirstPotion + potion->getType()].getAllowedSlots(); break; } case k10_JunkThingType: { @@ -638,7 +638,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) { } else { Junk *junk = (Junk *)rawThingPtr; potentialAttribMask = k0x0001_DescriptionMaskConsumable; - actualAttribMask = _vm->_dungeonMan->_objectInfo[k127_ObjectInfoIndexFirstJunk + junk->getType()].getAllowedSlots(); + actualAttribMask = _vm->_dungeonMan->_objectInfos[k127_ObjectInfoIndexFirstJunk + junk->getType()].getAllowedSlots(); } break; } @@ -947,13 +947,16 @@ void InventoryMan::clickOnMouth() { if (_vm->_championMan->_candidateChampionOrdinal) { return; } - if (!getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(L1078_T_Thing = _vm->_championMan->_leaderHandObject)]._allowedSlots, k0x0001_ObjectAllowedSlotMouth)) { + + L1078_T_Thing = _vm->_championMan->_leaderHandObject; + if (!getFlag(_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(L1078_T_Thing)]._allowedSlots, k0x0001_ObjectAllowedSlotMouth)) { return; } L1079_ui_IconIndex = _vm->_objectMan->getIconIndex(L1078_T_Thing); AL1088_ui_ThingType = L1078_T_Thing.getType(); L1089_ui_Weight = _vm->_dungeonMan->getObjectWeight(L1078_T_Thing); - L1083_ps_Champion = &_vm->_championMan->_champions[L1080_ui_ChampionIndex = _vm->ordinalToIndex(_inventoryChampionOrdinal)]; + L1080_ui_ChampionIndex = _vm->ordinalToIndex(_inventoryChampionOrdinal); + L1083_ps_Champion = &_vm->_championMan->_champions[L1080_ui_ChampionIndex]; L1082_ps_Junk = (Junk*)_vm->_dungeonMan->getThingData(L1078_T_Thing); if ((L1079_ui_IconIndex >= k8_IconIndiceJunkWater) && (L1079_ui_IconIndex <= k9_IconIndiceJunkWaterSkin)) { if (!(L1082_ps_Junk->getChargeCount())) { diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp index 302d7ef01f..0fde80581a 100644 --- a/engines/dm/loadsave.cpp +++ b/engines/dm/loadsave.cpp @@ -391,7 +391,7 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip // save _g284_thingData for (uint16 thingIndex = 0; thingIndex < 16; ++thingIndex) - for (uint16 i = 0; i < g235_ThingDataWordCount[thingIndex] * _dungeonMan->_dungeonFileHeader._thingCounts[thingIndex]; ++i) + for (uint16 i = 0; i < _dungeonMan->_thingDataWordCount[thingIndex] * _dungeonMan->_dungeonFileHeader._thingCounts[thingIndex]; ++i) file->writeUint16BE(_dungeonMan->_thingData[thingIndex][i]); // save _g276_dungeonRawMapData diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index a8217ddafb..fe6cc297d3 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -157,7 +157,7 @@ void MenuMan::drawActionIcon(ChampionIndex championIndex) { IconIndice iconIndex; if (thing == Thing::_none) { iconIndex = k201_IconIndiceActionEmptyHand; - } else if (_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(thing)]._actionSetIndex) { + } else if (_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(thing)]._actionSetIndex) { iconIndex = _vm->_objectMan->getIconIndex(thing); } else { dm.fillBitmap(bitmapIcon, k4_ColorCyan, 16, 16); @@ -1168,7 +1168,7 @@ T0407014: case k32_ChampionActionShoot: if (Thing(L1247_ps_Champion->_slots[k0_ChampionSlotReadyHand]).getType() != k5_WeaponThingType) goto T0407032; - L1256_ps_WeaponInfoActionHand = &_vm->_dungeonMan->_weaponInfo[L1248_ps_Weapon->getType()]; + L1256_ps_WeaponInfoActionHand = &_vm->_dungeonMan->_weaponInfos[L1248_ps_Weapon->getType()]; L1257_ps_WeaponInfoReadyHand = _vm->_dungeonMan->getWeaponInfo(L1247_ps_Champion->_slots[k0_ChampionSlotReadyHand]); AL1246_i_ActionHandWeaponClass = L1256_ps_WeaponInfoActionHand->_class; AL1250_i_ReadyHandWeaponClass = L1257_ps_WeaponInfoReadyHand->_class; @@ -1536,7 +1536,7 @@ bool MenuMan::isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, in } L1229_i_FrightAmount += _vm->_championMan->getSkillLevel(champIndex, k14_ChampionSkillInfluence); L1233_ps_Group = (Group*)_vm->_dungeonMan->getThingData(_actionTargetGroupThing); - L1234_ps_CreatureInfo = &g243_CreatureInfo[L1233_ps_Group->_type]; + L1234_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L1233_ps_Group->_type]; if (((L1230_ui_FearResistance = L1234_ps_CreatureInfo->getFearResistance()) > _vm->getRandomNumber(L1229_i_FrightAmount)) || (L1230_ui_FearResistance == k15_immuneToFear)) { L1231_ui_Experience >>= 1; } else { @@ -1645,7 +1645,7 @@ void MenuMan::processCommands116To119_setActingChampion(uint16 champIndex) { } if ((L1189_T_Thing = L1190_ps_Champion->_slots[k1_ChampionSlotActionHand]) == Thing::_none) { L1188_ui_ActionSetIndex = 2; /* Actions Punch, Kick and War Cry */ - } else if ((L1188_ui_ActionSetIndex = _vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(L1189_T_Thing)]._actionSetIndex) == 0) { + } else if ((L1188_ui_ActionSetIndex = _vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(L1189_T_Thing)]._actionSetIndex) == 0) { return; } L1191_ps_ActionSet = &G0489_as_Graphic560_ActionSets[L1188_ui_ActionSetIndex]; diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index 58a4f649c3..5d7d7e1a8f 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -716,7 +716,7 @@ int16 MovesensMan::getTeleporterRotatedGroupResult(Teleporter* teleporter, Thing L0687_ui_UpdatedGroupCells = _vm->_groupMan->getGroupCells(L0686_ps_Group, mapIndex); if (L0687_ui_UpdatedGroupCells != k255_CreatureTypeSingleCenteredCreature) { L0690_ui_GroupCells = L0687_ui_UpdatedGroupCells; - L0691_i_CreatureSize = getFlag(g243_CreatureInfo[L0686_ps_Group->_type]._attributes, k0x0003_MaskCreatureInfo_size); + L0691_i_CreatureSize = getFlag(_vm->_dungeonMan->_creatureInfos[L0686_ps_Group->_type]._attributes, k0x0003_MaskCreatureInfo_size); L0692_i_RelativeRotation = normalizeModulo4(4 + L0685_ui_UpdatedGroupDirections - L0684_ui_GroupDirections); for (L0688_i_CreatureIndex = 0; L0688_i_CreatureIndex <= L0686_ps_Group->getCount(); L0688_i_CreatureIndex++) { L0685_ui_UpdatedGroupDirections = _vm->_groupMan->getGroupValueUpdatedWithCreatureValue(L0685_ui_UpdatedGroupDirections, L0688_i_CreatureIndex, L0689_B_AbsoluteRotation ? L0683_i_Rotation : normalizeModulo4(L0684_ui_GroupDirections + L0683_i_Rotation)); diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 75865fb74c..c191fa5225 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -130,7 +130,7 @@ IconIndice ObjectMan::getObjectType(Thing thing) { int16 objectInfoIndex = _vm->_dungeonMan->getObjectInfoIndex(thing); if (objectInfoIndex != -1) { - objectInfoIndex = _vm->_dungeonMan->_objectInfo[objectInfoIndex]._type; + objectInfoIndex = _vm->_dungeonMan->_objectInfos[objectInfoIndex]._type; } return (IconIndice)objectInfoIndex; } diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index bcaca84d01..99fda6706d 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -162,7 +162,7 @@ T0217004: ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && - getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + getFlag(_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || ((AL0487_i_IconIndex = _vm->_objectMan->getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) @@ -184,7 +184,7 @@ T0217004: return false; } L0512_ui_CreatureIndex--; - L0493_ps_CreatureInfo = &g243_CreatureInfo[L0511_ui_CreatureType = L0491_ps_Group->_type]; + L0493_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L0511_ui_CreatureType = L0491_ps_Group->_type]; if ((L0486_T_ProjectileAssociatedThing == Thing::_explFireBall) && (L0511_ui_CreatureType == k11_CreatureTypeBlackFlame)) { L0496_pui_CreatureHealth = &L0491_ps_Group->_health[L0512_ui_CreatureIndex]; *L0496_pui_CreatureHealth = MIN(1000, *L0496_pui_CreatureHealth + getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing)); @@ -352,7 +352,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, } else { if ((L0473_T_Thing = _vm->_groupMan->groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0473_T_Thing); - CreatureInfo *L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; + CreatureInfo *L0471_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L0472_ps_Group->_type]; int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->getFireResistance(); if (L0469_i_CreatureFireResistance != k15_immuneToFire) { if (getFlag(L0471_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { @@ -536,7 +536,7 @@ void ProjExpl::processEvent25(TimelineEvent* event) { L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_partyMapY); if ((L0535_T_GroupThing = _vm->_groupMan->groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) { L0533_ps_Group = (Group*)_vm->_dungeonMan->getThingData(L0535_T_GroupThing); - L0534_ps_CreatureInfo = &g243_CreatureInfo[AL0537_ui_CreatureType = L0533_ps_Group->_type]; + L0534_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[AL0537_ui_CreatureType = L0533_ps_Group->_type]; } if ((L0536_T_ExplosionThing = Thing(Thing::_firstExplosion.toUint16() + L0532_ps_Explosion->getType())) == Thing::_explPoisonCloud) { L0530_i_Attack = MAX(1, MIN(L0532_ps_Explosion->getAttack() >> 5, 4) + _vm->getRandomNumber(2)); /* Value between 1 and 5 */ diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index 1089855d17..98987dc635 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -203,9 +203,9 @@ uint16 Timeline::addEventGetEventIndex(TimelineEvent* event) { TimelineEvent* L0591_ps_Event; - if (_eventCount == _eventMaxCount) { - _vm->displayErrorAndStop(45); - } + if (_eventCount == _eventMaxCount) + error("Too many events"); + if ((event->_type >= k5_TMEventTypeCorridor) && (event->_type <= k10_TMEventTypeDoor)) { for (L0588_ui_EventIndex = 0, L0591_ps_Event = _events; L0588_ui_EventIndex < _eventMaxCount; L0588_ui_EventIndex++, L0591_ps_Event++) { if ((L0591_ps_Event->_type >= k5_TMEventTypeCorridor) && (L0591_ps_Event->_type <= k10_TMEventTypeDoor)) { -- cgit v1.2.3