From 705e906698505e8a547ef46c8a2fc65e3f48a49b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Aug 2016 10:36:28 +0200 Subject: DM: Some renaming, move some globals to class member --- engines/dm/champion.cpp | 8 +- engines/dm/dungeonman.cpp | 249 ++++++++++++++++++++++++---------------------- engines/dm/dungeonman.h | 11 +- engines/dm/gfx.cpp | 2 +- engines/dm/inventory.cpp | 6 +- engines/dm/menus.cpp | 8 +- engines/dm/objectman.cpp | 2 +- engines/dm/projexpl.cpp | 2 +- 8 files changed, 149 insertions(+), 139 deletions(-) diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index caf61ef629..79840fa1c4 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -815,7 +815,7 @@ int16 ChampionMan::f313_getWoundDefense(int16 champIndex, uint16 woundIndex) { Thing curThing = curChampion->_slots[slotIndex]; if (curThing.getType() == k6_ArmourThingType) { ArmourInfo *armorInfo = (ArmourInfo *)_vm->_dungeonMan->f156_getThingData(curThing); - armorInfo = &g239_ArmourInfo[((Armour *)armorInfo)->getType()]; + armorInfo = &_vm->_dungeonMan->_armourInfo[((Armour *)armorInfo)->getType()]; if (getFlag(armorInfo->_attributes, k0x0080_ArmourAttributeIsAShield)) armorShieldDefense += ((f312_getStrength(champIndex, slotIndex) + _vm->_dungeonMan->f143_getArmourDefense(armorInfo, useSharpDefense)) * woundDefenseFactor[woundIndex]) >> ((slotIndex == woundIndex) ? 4 : 5); } @@ -830,7 +830,7 @@ int16 ChampionMan::f313_getWoundDefense(int16 champIndex, uint16 woundIndex) { Thing curThing = curChampion->_slots[woundIndex]; if (curThing.getType() == k6_ArmourThingType) { ArmourInfo *armourInfo = (ArmourInfo *)_vm->_dungeonMan->f156_getThingData(curThing); - woundDefense += _vm->_dungeonMan->f143_getArmourDefense(&g239_ArmourInfo[((Armour *)armourInfo)->getType()], useSharpDefense); + woundDefense += _vm->_dungeonMan->f143_getArmourDefense(&_vm->_dungeonMan->_armourInfo[((Armour *)armourInfo)->getType()], useSharpDefense); } } @@ -1282,7 +1282,7 @@ void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex) if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none)) return; - if ((leaderHandObject != Thing::_none) && (!(_vm->_dungeonMan->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(leaderHandObject)]._allowedSlots & gSlotMasks[slotIndex]))) + if ((leaderHandObject != Thing::_none) && (!(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(leaderHandObject)]._allowedSlots & gSlotMasks[slotIndex]))) return; _vm->_eventMan->f78_showMouse(); @@ -1928,7 +1928,7 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) while (curThing != Thing::_endOfList) { ThingType thingType = curThing.getType(); if ((thingType > k3_SensorThingType) && (curThing.getCell() == championObjectsCell)) { - int16 objectAllowedSlots = _vm->_dungeonMan->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(curThing)]._allowedSlots; + int16 objectAllowedSlots = _vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(curThing)]._allowedSlots; uint16 curSlotIndex; switch (thingType) { case k6_ArmourThingType: { diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index b0516ba38b..8a17ce6fd5 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -38,120 +38,10 @@ namespace DM { -ArmourInfo g239_ArmourInfo[58] = { // G0239_as_Graphic559_ArmourInfo -/* { Weight, Defense, Attributes, Unreferenced } */ - ArmourInfo(3, 5, 0x01), /* CAPE */ - ArmourInfo(4, 10, 0x01), /* CLOAK OF NIGHT */ - ArmourInfo(3, 4, 0x01), /* BARBARIAN HIDE */ - ArmourInfo(6, 5, 0x02), /* SANDALS */ - ArmourInfo(16, 25, 0x04), /* LEATHER BOOTS */ - ArmourInfo(4, 5, 0x00), /* ROBE */ - ArmourInfo(4, 5, 0x00), /* ROBE */ - ArmourInfo(3, 7, 0x01), /* FINE ROBE */ - ArmourInfo(3, 7, 0x01), /* FINE ROBE */ - ArmourInfo(4, 6, 0x01), /* KIRTLE */ - ArmourInfo(2, 4, 0x00), /* SILK SHIRT */ - ArmourInfo(4, 5, 0x01), /* TABARD */ - ArmourInfo(5, 7, 0x01), /* GUNNA */ - ArmourInfo(3, 11, 0x02), /* ELVEN DOUBLET */ - ArmourInfo(3, 13, 0x02), /* ELVEN HUKE */ - ArmourInfo(4, 13, 0x02), /* ELVEN BOOTS */ - ArmourInfo(6, 17, 0x03), /* LEATHER JERKIN */ - ArmourInfo(8, 20, 0x03), /* LEATHER PANTS */ - ArmourInfo(14, 20, 0x03), /* SUEDE BOOTS */ - ArmourInfo(6, 12, 0x02), /* BLUE PANTS */ - ArmourInfo(5, 9, 0x01), /* TUNIC */ - ArmourInfo(5, 8, 0x01), /* GHI */ - ArmourInfo(5, 9, 0x01), /* GHI TROUSERS */ - ArmourInfo(4, 1, 0x04), /* CALISTA */ - ArmourInfo(6, 5, 0x04), /* CROWN OF NERRA */ - ArmourInfo(11, 12, 0x05), /* BEZERKER HELM */ - ArmourInfo(14, 17, 0x05), /* HELMET */ - ArmourInfo(15, 20, 0x05), /* BASINET */ - ArmourInfo(11, 22, 0x85), /* BUCKLER */ - ArmourInfo(10, 16, 0x82), /* HIDE SHIELD */ - ArmourInfo(14, 20, 0x83), /* WOODEN SHIELD */ - ArmourInfo(21, 35, 0x84), /* SMALL SHIELD */ - ArmourInfo(65, 35, 0x05), /* MAIL AKETON */ - ArmourInfo(53, 35, 0x05), /* LEG MAIL */ - ArmourInfo(52, 70, 0x07), /* MITHRAL AKETON */ - ArmourInfo(41, 55, 0x07), /* MITHRAL MAIL */ - ArmourInfo(16, 25, 0x06), /* CASQUE 'N COIF */ - ArmourInfo(16, 30, 0x06), /* HOSEN */ - ArmourInfo(19, 40, 0x07), /* ARMET */ - ArmourInfo(120, 65, 0x04), /* TORSO PLATE */ - ArmourInfo(80, 56, 0x04), /* LEG PLATE */ - ArmourInfo(28, 37, 0x05), /* FOOT PLATE */ - ArmourInfo(34, 56, 0x84), /* LARGE SHIELD */ - ArmourInfo(17, 62, 0x05), /* HELM OF LYTE */ - ArmourInfo(108, 125, 0x04), /* PLATE OF LYTE */ - ArmourInfo(72, 90, 0x04), /* POLEYN OF LYTE */ - ArmourInfo(24, 50, 0x05), /* GREAVE OF LYTE */ - ArmourInfo(30, 85, 0x84), /* SHIELD OF LYTE */ - ArmourInfo(35, 76, 0x04), /* HELM OF DARC */ - ArmourInfo(141, 160, 0x04), /* PLATE OF DARC */ - ArmourInfo(90, 101, 0x04), /* POLEYN OF DARC */ - ArmourInfo(31, 60, 0x05), /* GREAVE OF DARC */ - ArmourInfo(40, 100, 0x84), /* SHIELD OF DARC */ - ArmourInfo(14, 54, 0x06), /* DEXHELM */ - ArmourInfo(57, 60, 0x07), /* FLAMEBAIN */ - ArmourInfo(81, 88, 0x04), /* POWERTOWERS */ - ArmourInfo(3, 16, 0x02), /* BOOTS OF SPEED */ - ArmourInfo(2, 3, 0x03)}; /* HALTER */ - -WeaponInfo g238_WeaponInfo[46] = { // @ G0238_as_Graphic559_WeaponInfo - /* { Weight, Class, Strength, KineticEnergy, Attributes } */ - WeaponInfo(1, 130, 2, 0, 0x2000), /* EYE OF TIME */ - WeaponInfo(1, 131, 2, 0, 0x2000), /* STORMRING */ - WeaponInfo(11, 0, 8, 2, 0x2000), /* TORCH */ - WeaponInfo(12, 112, 10, 80, 0x2028), /* FLAMITT */ - WeaponInfo(9, 129, 16, 7, 0x2000), /* STAFF OF CLAWS */ - WeaponInfo(30, 113, 49, 110, 0x0942), /* BOLT BLADE */ - WeaponInfo(47, 0, 55, 20, 0x0900), /* FURY */ - WeaponInfo(24, 255, 25, 10, 0x20FF), /* THE FIRESTAFF */ - WeaponInfo(5, 2, 10, 19, 0x0200), /* DAGGER */ - WeaponInfo(33, 0, 30, 8, 0x0900), /* FALCHION */ - WeaponInfo(32, 0, 34, 10, 0x0900), /* SWORD */ - WeaponInfo(26, 0, 38, 10, 0x0900), /* RAPIER */ - WeaponInfo(35, 0, 42, 11, 0x0900), /* SABRE */ - WeaponInfo(36, 0, 46, 12, 0x0900), /* SAMURAI SWORD */ - WeaponInfo(33, 0, 50, 14, 0x0900), /* DELTA */ - WeaponInfo(37, 0, 62, 14, 0x0900), /* DIAMOND EDGE */ - WeaponInfo(30, 0, 48, 13, 0x0000), /* VORPAL BLADE */ - WeaponInfo(39, 0, 58, 15, 0x0900), /* THE INQUISITOR */ - WeaponInfo(43, 2, 49, 33, 0x0300), /* AXE */ - WeaponInfo(65, 2, 70, 44, 0x0300), /* HARDCLEAVE */ - WeaponInfo(31, 0, 32, 10, 0x2000), /* MACE */ - WeaponInfo(41, 0, 42, 13, 0x2000), /* MACE OF ORDER */ - WeaponInfo(50, 0, 60, 15, 0x2000), /* MORNINGSTAR */ - WeaponInfo(36, 0, 19, 10, 0x2700), /* CLUB */ - WeaponInfo(110, 0, 44, 22, 0x2600), /* STONE CLUB */ - WeaponInfo(10, 20, 1, 50, 0x2032), /* BOW */ - WeaponInfo(28, 30, 1, 180, 0x2078), /* CROSSBOW */ - WeaponInfo(2, 10, 2, 10, 0x0100), /* ARROW */ - WeaponInfo(2, 10, 2, 28, 0x0500), /* SLAYER */ - WeaponInfo(19, 39, 5, 20, 0x2032), /* SLING */ - WeaponInfo(10, 11, 6, 18, 0x2000), /* ROCK */ - WeaponInfo(3, 12, 7, 23, 0x0800), /* POISON DART */ - WeaponInfo(1, 1, 3, 19, 0x0A00), /* THROWING STAR */ - WeaponInfo(8, 0, 4, 4, 0x2000), /* STICK */ - WeaponInfo(26, 129, 12, 4, 0x2000), /* STAFF */ - WeaponInfo(1, 130, 0, 0, 0x2000), /* WAND */ - WeaponInfo(2, 140, 1, 20, 0x2000), /* TEOWAND */ - WeaponInfo(35, 128, 18, 6, 0x2000), /* YEW STAFF */ - WeaponInfo(29, 159, 0, 4, 0x2000), /* STAFF OF MANAR */ - WeaponInfo(21, 131, 0, 3, 0x2000), /* SNAKE STAFF */ - WeaponInfo(33, 136, 0, 7, 0x2000), /* THE CONDUIT */ - WeaponInfo(8, 132, 3, 1, 0x2000), /* DRAGON SPIT */ - WeaponInfo(18, 131, 9, 4, 0x2000), /* SCEPTRE OF LYF */ - WeaponInfo(8, 192, 1, 1, 0x2000), /* HORN OF FEAR */ - WeaponInfo(30, 26, 1, 220, 0x207D), /* SPEEDBOW */ - WeaponInfo(36, 255, 100, 50, 0x20FF)}; /* THE FIRESTAFF */ - 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 } */ + /* { 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}, @@ -370,10 +260,129 @@ void DungeonMan::setupArrays() { ObjectInfo(192, 77, 0, 0x0500), /* IRON KEY Pouch/Chest */ ObjectInfo(193, 78, 0, 0x0500), /* KEY OF B Pouch/Chest */ ObjectInfo(197, 74, 0, 0x0000), /* SOLID KEY */ - ObjectInfo(198, 41, 0, 0x0400)}; /* SQUARE KEY Chest */ + ObjectInfo(198, 41, 0, 0x0400) /* SQUARE KEY Chest */ + }; + ArmourInfo armourInfo[58] = { // G0239_as_Graphic559_ArmourInfo + /* { Weight, Defense, Attributes, Unreferenced } */ + ArmourInfo(3, 5, 0x01), /* CAPE */ + ArmourInfo(4, 10, 0x01), /* CLOAK OF NIGHT */ + ArmourInfo(3, 4, 0x01), /* BARBARIAN HIDE */ + ArmourInfo(6, 5, 0x02), /* SANDALS */ + ArmourInfo(16, 25, 0x04), /* LEATHER BOOTS */ + ArmourInfo(4, 5, 0x00), /* ROBE */ + ArmourInfo(4, 5, 0x00), /* ROBE */ + ArmourInfo(3, 7, 0x01), /* FINE ROBE */ + ArmourInfo(3, 7, 0x01), /* FINE ROBE */ + ArmourInfo(4, 6, 0x01), /* KIRTLE */ + ArmourInfo(2, 4, 0x00), /* SILK SHIRT */ + ArmourInfo(4, 5, 0x01), /* TABARD */ + ArmourInfo(5, 7, 0x01), /* GUNNA */ + ArmourInfo(3, 11, 0x02), /* ELVEN DOUBLET */ + ArmourInfo(3, 13, 0x02), /* ELVEN HUKE */ + ArmourInfo(4, 13, 0x02), /* ELVEN BOOTS */ + ArmourInfo(6, 17, 0x03), /* LEATHER JERKIN */ + ArmourInfo(8, 20, 0x03), /* LEATHER PANTS */ + ArmourInfo(14, 20, 0x03), /* SUEDE BOOTS */ + ArmourInfo(6, 12, 0x02), /* BLUE PANTS */ + ArmourInfo(5, 9, 0x01), /* TUNIC */ + ArmourInfo(5, 8, 0x01), /* GHI */ + ArmourInfo(5, 9, 0x01), /* GHI TROUSERS */ + ArmourInfo(4, 1, 0x04), /* CALISTA */ + ArmourInfo(6, 5, 0x04), /* CROWN OF NERRA */ + ArmourInfo(11, 12, 0x05), /* BEZERKER HELM */ + ArmourInfo(14, 17, 0x05), /* HELMET */ + ArmourInfo(15, 20, 0x05), /* BASINET */ + ArmourInfo(11, 22, 0x85), /* BUCKLER */ + ArmourInfo(10, 16, 0x82), /* HIDE SHIELD */ + ArmourInfo(14, 20, 0x83), /* WOODEN SHIELD */ + ArmourInfo(21, 35, 0x84), /* SMALL SHIELD */ + ArmourInfo(65, 35, 0x05), /* MAIL AKETON */ + ArmourInfo(53, 35, 0x05), /* LEG MAIL */ + ArmourInfo(52, 70, 0x07), /* MITHRAL AKETON */ + ArmourInfo(41, 55, 0x07), /* MITHRAL MAIL */ + ArmourInfo(16, 25, 0x06), /* CASQUE 'N COIF */ + ArmourInfo(16, 30, 0x06), /* HOSEN */ + ArmourInfo(19, 40, 0x07), /* ARMET */ + ArmourInfo(120, 65, 0x04), /* TORSO PLATE */ + ArmourInfo(80, 56, 0x04), /* LEG PLATE */ + ArmourInfo(28, 37, 0x05), /* FOOT PLATE */ + ArmourInfo(34, 56, 0x84), /* LARGE SHIELD */ + ArmourInfo(17, 62, 0x05), /* HELM OF LYTE */ + ArmourInfo(108, 125, 0x04), /* PLATE OF LYTE */ + ArmourInfo(72, 90, 0x04), /* POLEYN OF LYTE */ + ArmourInfo(24, 50, 0x05), /* GREAVE OF LYTE */ + ArmourInfo(30, 85, 0x84), /* SHIELD OF LYTE */ + ArmourInfo(35, 76, 0x04), /* HELM OF DARC */ + ArmourInfo(141, 160, 0x04), /* PLATE OF DARC */ + ArmourInfo(90, 101, 0x04), /* POLEYN OF DARC */ + ArmourInfo(31, 60, 0x05), /* GREAVE OF DARC */ + ArmourInfo(40, 100, 0x84), /* SHIELD OF DARC */ + ArmourInfo(14, 54, 0x06), /* DEXHELM */ + ArmourInfo(57, 60, 0x07), /* FLAMEBAIN */ + ArmourInfo(81, 88, 0x04), /* POWERTOWERS */ + ArmourInfo(3, 16, 0x02), /* BOOTS OF SPEED */ + ArmourInfo(2, 3, 0x03) /* HALTER */ + }; + + WeaponInfo weaponInfo[46] = { // @ G0238_as_Graphic559_WeaponInfo + /* { Weight, Class, Strength, KineticEnergy, Attributes } */ + WeaponInfo(1, 130, 2, 0, 0x2000), /* EYE OF TIME */ + WeaponInfo(1, 131, 2, 0, 0x2000), /* STORMRING */ + WeaponInfo(11, 0, 8, 2, 0x2000), /* TORCH */ + WeaponInfo(12, 112, 10, 80, 0x2028), /* FLAMITT */ + WeaponInfo(9, 129, 16, 7, 0x2000), /* STAFF OF CLAWS */ + WeaponInfo(30, 113, 49, 110, 0x0942), /* BOLT BLADE */ + WeaponInfo(47, 0, 55, 20, 0x0900), /* FURY */ + WeaponInfo(24, 255, 25, 10, 0x20FF), /* THE FIRESTAFF */ + WeaponInfo(5, 2, 10, 19, 0x0200), /* DAGGER */ + WeaponInfo(33, 0, 30, 8, 0x0900), /* FALCHION */ + WeaponInfo(32, 0, 34, 10, 0x0900), /* SWORD */ + WeaponInfo(26, 0, 38, 10, 0x0900), /* RAPIER */ + WeaponInfo(35, 0, 42, 11, 0x0900), /* SABRE */ + WeaponInfo(36, 0, 46, 12, 0x0900), /* SAMURAI SWORD */ + WeaponInfo(33, 0, 50, 14, 0x0900), /* DELTA */ + WeaponInfo(37, 0, 62, 14, 0x0900), /* DIAMOND EDGE */ + WeaponInfo(30, 0, 48, 13, 0x0000), /* VORPAL BLADE */ + WeaponInfo(39, 0, 58, 15, 0x0900), /* THE INQUISITOR */ + WeaponInfo(43, 2, 49, 33, 0x0300), /* AXE */ + WeaponInfo(65, 2, 70, 44, 0x0300), /* HARDCLEAVE */ + WeaponInfo(31, 0, 32, 10, 0x2000), /* MACE */ + WeaponInfo(41, 0, 42, 13, 0x2000), /* MACE OF ORDER */ + WeaponInfo(50, 0, 60, 15, 0x2000), /* MORNINGSTAR */ + WeaponInfo(36, 0, 19, 10, 0x2700), /* CLUB */ + WeaponInfo(110, 0, 44, 22, 0x2600), /* STONE CLUB */ + WeaponInfo(10, 20, 1, 50, 0x2032), /* BOW */ + WeaponInfo(28, 30, 1, 180, 0x2078), /* CROSSBOW */ + WeaponInfo(2, 10, 2, 10, 0x0100), /* ARROW */ + WeaponInfo(2, 10, 2, 28, 0x0500), /* SLAYER */ + WeaponInfo(19, 39, 5, 20, 0x2032), /* SLING */ + WeaponInfo(10, 11, 6, 18, 0x2000), /* ROCK */ + WeaponInfo(3, 12, 7, 23, 0x0800), /* POISON DART */ + WeaponInfo(1, 1, 3, 19, 0x0A00), /* THROWING STAR */ + WeaponInfo(8, 0, 4, 4, 0x2000), /* STICK */ + WeaponInfo(26, 129, 12, 4, 0x2000), /* STAFF */ + WeaponInfo(1, 130, 0, 0, 0x2000), /* WAND */ + WeaponInfo(2, 140, 1, 20, 0x2000), /* TEOWAND */ + WeaponInfo(35, 128, 18, 6, 0x2000), /* YEW STAFF */ + WeaponInfo(29, 159, 0, 4, 0x2000), /* STAFF OF MANAR */ + WeaponInfo(21, 131, 0, 3, 0x2000), /* SNAKE STAFF */ + WeaponInfo(33, 136, 0, 7, 0x2000), /* THE CONDUIT */ + WeaponInfo(8, 132, 3, 1, 0x2000), /* DRAGON SPIT */ + WeaponInfo(18, 131, 9, 4, 0x2000), /* SCEPTRE OF LYF */ + WeaponInfo(8, 192, 1, 1, 0x2000), /* HORN OF FEAR */ + WeaponInfo(30, 26, 1, 220, 0x207D), /* SPEEDBOW */ + WeaponInfo(36, 255, 100, 50, 0x20FF) /* THE FIRESTAFF */ + }; + + for (int i = 0; i < 180; i++) + _objectInfo[i] = objectInfo[i]; + + for (int i = 0; i < 58; i++) + _armourInfo[i] = armourInfo[i]; + + for (int i = 0; i < 46; i++) + _weaponInfo[i] = weaponInfo[i]; - for (int i = 0; i < 180; i++) - g237_ObjectInfo[i] = objectInfo[i]; } DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine) { @@ -1234,10 +1243,10 @@ uint16 DungeonMan::f140_getObjectWeight(Thing thing) { switch (thing.getType()) { case k5_WeaponThingType: - weight = g238_WeaponInfo[((Weapon *)junk)->getType()]._weight; + weight = _weaponInfo[((Weapon *)junk)->getType()]._weight; break; case k6_ArmourThingType: - weight = g239_ArmourInfo[((Armour *)junk)->getType()]._weight; + weight = _armourInfo[((Armour *)junk)->getType()]._weight; break; case k10_JunkThingType: weight = junkInfo[junk->getType()]; @@ -1331,7 +1340,7 @@ void DungeonMan::f163_linkThingToList(Thing thingToLink, Thing thingInList, int1 WeaponInfo* DungeonMan::f158_getWeaponInfo(Thing thing) { Weapon* weapon = (Weapon*)f156_getThingData(thing); - return &g238_WeaponInfo[weapon->getType()]; + return &_weaponInfo[weapon->getType()]; } int16 DungeonMan::f142_getProjectileAspect(Thing thing) { @@ -1354,7 +1363,7 @@ int16 DungeonMan::f142_getProjectileAspect(Thing thing) { return -projAspOrd; } - return g237_ObjectInfo[f141_getObjectInfoIndex(thing)]._objectAspectIndex; + return _objectInfo[f141_getObjectInfoIndex(thing)]._objectAspectIndex; } int16 DungeonMan::f154_getLocationAfterLevelChange(int16 mapIndex, int16 levelDelta, int16* mapX, int16* mapY) { diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index e738723f7c..269dcdf9f9 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -106,15 +106,15 @@ public: uint16 _weight; uint16 _defense; uint16 _attributes; + ArmourInfo(uint16 weight, uint16 defense, uint16 attributes) :_weight(weight), _defense(defense), _attributes(attributes) {} + ArmourInfo() :_weight(0), _defense(0), _attributes(0) {} uint16 getAttribute(ArmourAttribute attribute) { return _attributes & attribute; } void setAttribute(ArmourAttribute attribute) { _attributes |= attribute; } }; // @ ARMOUR_INFO -extern ArmourInfo g239_ArmourInfo[58]; // G0239_as_Graphic559_ArmourInfo - #define kM1_WeaponClassNone -1 /* Class 0: SWING weapons */ #define k0_WeaponClassSwingWeapon 0 // @ C000_CLASS_SWING_WEAPON @@ -143,13 +143,12 @@ private: public: WeaponInfo(uint16 weight, uint16 wClass, uint16 strength, uint16 kineticEnergy, uint16 attributes) : _weight(weight), _class(wClass), _strength(strength), _kineticEnergy(kineticEnergy), _attributes(attributes) {} + WeaponInfo() : _weight(0), _class(0), _strength(0), _kineticEnergy(0), _attributes(0) {} uint16 getShootAttack() { return _attributes & 0xFF; } // @ M65_SHOOT_ATTACK uint16 getProjectileAspectOrdinal() { return (_attributes >> 8) & 0x1F; } // @ M66_PROJECTILE_ASPECT_ORDINAL }; // @ WEAPON_INFO -extern WeaponInfo g238_WeaponInfo[46]; // @ G0238_as_Graphic559_WeaponInfo; - enum TextType { /* Used for text on walls */ k0_TextTypeInscription = 0, // @ C0_TEXT_TYPE_INSCRIPTION @@ -747,7 +746,9 @@ public: Thing _g292_pileTopObject[5]; // @ G0292_aT_PileTopObject DoorInfo _g275_currMapDoorInfo[2]; // @ G0275_as_CurrentMapDoorInfo - ObjectInfo g237_ObjectInfo[180]; // @ G0237_as_Graphic559_ObjectInfo + ObjectInfo _objectInfo[180]; // @ G0237_as_Graphic559_ObjectInfo + ArmourInfo _armourInfo[58]; // @ G0239_as_Graphic559_ArmourInfo + WeaponInfo _weaponInfo[46]; // @ G0238_as_Graphic559_WeaponInfo void setupArrays(); }; diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index c17eabe7be..73621cacdf 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -3102,7 +3102,7 @@ void DisplayMan::f115_cthulhu(Thing thingParam, Direction directionParam, int16 } 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->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(thingParam)]._objectAspectIndex]); + objectAspect = &(_objectAspects209[_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(thingParam)]._objectAspectIndex]); AL_4_nativeBitmapIndex = k360_FirstObjectGraphicIndice + objectAspect->_firstNativeBitmapRelativeIndex; if (useAlcoveObjectImage = (L0135_B_DrawAlcoveObjects && getFlag(objectAspect->_graphicInfo, k0x0010_ObjectAlcoveMask) && !viewLane)) AL_4_nativeBitmapIndex++; diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 5552da493e..a19a71a370 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -587,7 +587,7 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) { case k8_PotionThingType: { potentialAttribMask = k0x0001_DescriptionMaskConsumable; Potion *potion = (Potion *)rawThingPtr; - actualAttribMask = _vm->_dungeonMan->g237_ObjectInfo[k2_ObjectInfoIndexFirstPotion + potion->getType()].getAllowedSlots(); + actualAttribMask = _vm->_dungeonMan->_objectInfo[k2_ObjectInfoIndexFirstPotion + potion->getType()].getAllowedSlots(); break; } case k10_JunkThingType: { @@ -630,7 +630,7 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) { f335_drawPanelObjectDescriptionString(str); } else { potentialAttribMask = k0x0001_DescriptionMaskConsumable; - actualAttribMask = _vm->_dungeonMan->g237_ObjectInfo[k127_ObjectInfoIndexFirstJunk + junk->getType()].getAllowedSlots(); + actualAttribMask = _vm->_dungeonMan->_objectInfo[k127_ObjectInfoIndexFirstJunk + junk->getType()].getAllowedSlots(); } break; } @@ -937,7 +937,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { if (_vm->_championMan->_g299_candidateChampionOrdinal) { return; } - if (!getFlag(_vm->_dungeonMan->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L1078_T_Thing = _vm->_championMan->_g414_leaderHandObject)]._allowedSlots, k0x0001_ObjectAllowedSlotMouth)) { + if (!getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L1078_T_Thing = _vm->_championMan->_g414_leaderHandObject)]._allowedSlots, k0x0001_ObjectAllowedSlotMouth)) { return; } L1079_ui_IconIndex = _vm->_objectMan->f33_getIconIndex(L1078_T_Thing); diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index afd6eb2a65..d17286fbf4 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -153,7 +153,7 @@ void MenuMan::f386_drawActionIcon(ChampionIndex championIndex) { IconIndice iconIndex; if (thing == Thing::_none) { iconIndex = k201_IconIndiceActionEmptyHand; - } else if (_vm->_dungeonMan->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(thing)]._actionSetIndex) { + } else if (_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(thing)]._actionSetIndex) { iconIndex = _vm->_objectMan->f33_getIconIndex(thing); } else { dm.f134_fillBitmap(bitmapIcon, k4_ColorCyan, 16, 16); @@ -1038,7 +1038,7 @@ bool MenuMan::f407_isActionPerformed(uint16 champIndex, int16 actionIndex) { int16 L1245_i_Multiple; #define AL1245_T_ExplosionThing L1245_i_Multiple #define AL1245_B_ActionPerformed L1245_i_Multiple - int16 L1246_i_Multiple; + int16 L1246_i_Multiple = 0; #define AL1246_i_RequiredManaAmount L1246_i_Multiple #define AL1246_i_ActionHandWeaponClass L1246_i_Multiple #define AL1246_i_StepEnergy L1246_i_Multiple @@ -1156,7 +1156,7 @@ T0407014: case k32_ChampionActionShoot: if (Thing(L1247_ps_Champion->_slots[k0_ChampionSlotReadyHand]).getType() != k5_WeaponThingType) goto T0407032; - L1256_ps_WeaponInfoActionHand = &g238_WeaponInfo[L1248_ps_Weapon->getType()]; + L1256_ps_WeaponInfoActionHand = &_vm->_dungeonMan->_weaponInfo[L1248_ps_Weapon->getType()]; L1257_ps_WeaponInfoReadyHand = _vm->_dungeonMan->f158_getWeaponInfo(L1247_ps_Champion->_slots[k0_ChampionSlotReadyHand]); AL1246_i_ActionHandWeaponClass = L1256_ps_WeaponInfoActionHand->_class; AL1250_i_ReadyHandWeaponClass = L1257_ps_WeaponInfoReadyHand->_class; @@ -1627,7 +1627,7 @@ void MenuMan::f389_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->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L1189_T_Thing)]._actionSetIndex) == 0) { + } else if ((L1188_ui_ActionSetIndex = _vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L1189_T_Thing)]._actionSetIndex) == 0) { return; } L1191_ps_ActionSet = &G0489_as_Graphic560_ActionSets[L1188_ui_ActionSetIndex]; diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 3c731d8eb3..debf94811a 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -130,7 +130,7 @@ IconIndice ObjectMan::f32_getObjectType(Thing thing) { int16 objectInfoIndex = _vm->_dungeonMan->f141_getObjectInfoIndex(thing); if (objectInfoIndex != -1) { - objectInfoIndex = _vm->_dungeonMan->g237_ObjectInfo[objectInfoIndex]._type; + objectInfoIndex = _vm->_dungeonMan->_objectInfo[objectInfoIndex]._type; } return (IconIndice)objectInfoIndex; } diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 5e21cbd94f..95e3165907 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -159,7 +159,7 @@ T0217004: ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && - getFlag(_vm->_dungeonMan->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || ((AL0487_i_IconIndex = _vm->_objectMan->f33_getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) -- cgit v1.2.3