diff options
author | Paul Gilbert | 2016-08-28 15:46:10 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-28 15:46:10 -0400 |
commit | ef6253fb19822b9a2e9a1ba00418f1d33afff65f (patch) | |
tree | 367e064d6a1e2d7f233f624e8fe2e975d20722ff | |
parent | 0c199f079bc1ed62e6c13f292d569fc52eac546c (diff) | |
download | scummvm-rg350-ef6253fb19822b9a2e9a1ba00418f1d33afff65f.tar.gz scummvm-rg350-ef6253fb19822b9a2e9a1ba00418f1d33afff65f.tar.bz2 scummvm-rg350-ef6253fb19822b9a2e9a1ba00418f1d33afff65f.zip |
XEEN: gcc compilation fixes
-rw-r--r-- | engines/xeen/character.cpp | 20 | ||||
-rw-r--r-- | engines/xeen/character.h | 9 | ||||
-rw-r--r-- | engines/xeen/combat.cpp | 13 | ||||
-rw-r--r-- | engines/xeen/dialogs_items.cpp | 16 | ||||
-rw-r--r-- | engines/xeen/dialogs_party.cpp | 6 | ||||
-rw-r--r-- | engines/xeen/interface.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/party.cpp | 6 | ||||
-rw-r--r-- | engines/xeen/sound.cpp | 5 | ||||
-rw-r--r-- | engines/xeen/sound.h | 1 | ||||
-rw-r--r-- | engines/xeen/sprites.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 9 | ||||
-rw-r--r-- | engines/xeen/xsurface.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/xsurface.h | 2 |
13 files changed, 57 insertions, 38 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp index ca224ab4f1..bb7877c69a 100644 --- a/engines/xeen/character.cpp +++ b/engines/xeen/character.cpp @@ -202,7 +202,7 @@ void InventoryItems::removeItem(int itemIndex) { item._frame = 0; } -XeenEngine *InventoryItems::vm() { +XeenEngine *InventoryItems::getVm() { return Party::_vm; } @@ -297,7 +297,7 @@ void WeaponItems::equipItem(int itemIndex) { */ Common::String WeaponItems::getFullDescription(int itemIndex, int displayNum) { XeenItem &i = operator[](itemIndex); - Resources &res = *vm()->_resources; + Resources &res = *getVm()->_resources; return Common::String::format("\f%02u%s%s%s\f%02u%s%s%s", displayNum, !i._bonusFlags ? res._maeNames[i._material].c_str() : "", @@ -311,7 +311,7 @@ Common::String WeaponItems::getFullDescription(int itemIndex, int displayNum) { } void WeaponItems::enchantItem(int itemIndex, int amount) { - SoundManager &sound = *vm()->_sound; + SoundManager &sound = *getVm()->_sound; XeenItem &item = operator[](itemIndex); Character tempCharacter; @@ -463,12 +463,13 @@ void ArmorItems::equipItem(int itemIndex) { */ Common::String ArmorItems::getFullDescription(int itemIndex, int displayNum) { XeenItem &i = operator[](itemIndex); - Resources &res = *vm()->_resources; + Resources &res = *getVm()->_resources; return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum, !i._bonusFlags ? "" : res._maeNames[i._material].c_str(), (i._bonusFlags & ITEMFLAG_BROKEN) ? ITEM_BROKEN : "", (i._bonusFlags & ITEMFLAG_CURSED) ? ITEM_CURSED : "", + displayNum, ARMOR_NAMES[i._id], (i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) || !i._bonusFlags ? "\b " : "" @@ -476,7 +477,7 @@ Common::String ArmorItems::getFullDescription(int itemIndex, int displayNum) { } void ArmorItems::enchantItem(int itemIndex, int amount) { - SoundManager &sound = *vm()->_sound; + SoundManager &sound = *getVm()->_sound; XeenItem &item = operator[](itemIndex); Character tempCharacter; @@ -586,7 +587,7 @@ void AccessoryItems::equipItem(int itemIndex) { */ Common::String AccessoryItems::getFullDescription(int itemIndex, int displayNum) { XeenItem &i = operator[](itemIndex); - Resources &res = *vm()->_resources; + Resources &res = *getVm()->_resources; return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum, !i._bonusFlags ? "" : res._maeNames[i._material].c_str(), @@ -635,7 +636,7 @@ Common::String AccessoryItems::getAttributes(XeenItem &item, const Common::Strin */ Common::String MiscItems::getFullDescription(int itemIndex, int displayNum) { XeenItem &i = operator[](itemIndex); - Resources &res = *vm()->_resources; + Resources &res = *getVm()->_resources; return Common::String::format("\f%02u%s%s%s\f%02u%s%s", displayNum, !i._bonusFlags ? "" : res._maeNames[i._material].c_str(), @@ -653,7 +654,7 @@ Common::String MiscItems::getFullDescription(int itemIndex, int displayNum) { */ Common::String MiscItems::getAttributes(XeenItem &item, const Common::String &classes) { Common::String specialPower = FIELD_NONE; - Spells &spells = *vm()->_spells; + Spells &spells = *getVm()->_spells; if (item._id) { specialPower = spells._spellNames[MISC_SPELL_INDEX[item._id]]; @@ -1814,6 +1815,9 @@ int Character::makeItem(int p1, int itemIndex, int p3) { newItem._id = miscId; newItem._bonusFlags = miscBonus; break; + + default: + break; } return category; diff --git a/engines/xeen/character.h b/engines/xeen/character.h index f1243f1568..83198a1d8d 100644 --- a/engines/xeen/character.h +++ b/engines/xeen/character.h @@ -50,8 +50,7 @@ enum Race { HUMAN = 0, ELF = 1, DWARF = 2, GNOME = 3, HALF_ORC = 4 }; enum CharacterClass { CLASS_KNIGHT = 0, CLASS_PALADIN = 1, CLASS_ARCHER = 2, CLASS_CLERIC = 3, CLASS_SORCERER = 4, CLASS_ROBBER = 5, CLASS_NINJA = 6, CLASS_BARBARIAN = 7, - CLASS_DRUID = 8, CLASS_RANGER = 9, TOTAL_CLASSES = 10, - CLASS_12 = 12, CLASS_15 = 15, CLASS_16 = 16 + CLASS_DRUID = 8, CLASS_RANGER = 9, TOTAL_CLASSES = 10, CLASS_12 = 12, CLASS_15 = 15, CLASS_16 = 16 }; enum Attribute { @@ -114,13 +113,14 @@ protected: ItemCategory _category; const char *const *_names; - XeenEngine *vm(); + XeenEngine *getVm(); void equipError(int itemIndex1, ItemCategory category1, int itemIndex2, ItemCategory category2); virtual Common::String getAttributes(XeenItem &item, const Common::String &classes) = 0; public: InventoryItems(Character *character, ItemCategory category); + virtual ~InventoryItems() {} void clear(); @@ -150,6 +150,7 @@ protected: virtual Common::String getAttributes(XeenItem &item, const Common::String &classes); public: WeaponItems(Character *character) : InventoryItems(character, CATEGORY_WEAPON) {} + virtual ~WeaponItems() {} virtual void equipItem(int itemIndex); @@ -163,6 +164,7 @@ protected: virtual Common::String getAttributes(XeenItem &item, const Common::String &classes); public: ArmorItems(Character *character) : InventoryItems(character, CATEGORY_ARMOR) {} + virtual ~ArmorItems() {} virtual void equipItem(int itemIndex); @@ -187,6 +189,7 @@ protected: virtual Common::String getAttributes(XeenItem &item, const Common::String &classes); public: MiscItems(Character *character) : InventoryItems(character, CATEGORY_MISC) {} + virtual ~MiscItems() {} virtual Common::String getFullDescription(int itemIndex, int displayNum); }; diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index 1d03a5128d..13efe912de 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -422,6 +422,9 @@ void Combat::doCharDamage(Character &c, int charNum, int monsterDataIndex) { if (c._currentHp > 0) c._currentHp = 0; break; + + default: + break; } c.subtractHitPoints(damage); @@ -823,7 +826,7 @@ void Combat::doMonsterTurn(int monsterId) { if (cond >= PARALYZED && cond <= ERADICATED) continue; - bool isHated = false; + isHated = false; switch (monsterData._hatesClass) { case CLASS_KNIGHT: case CLASS_PALADIN: @@ -1277,10 +1280,10 @@ void Combat::attack(Character &c, RangeType rangeType) { damage = 0; for (uint charIndex = 0; charIndex < party._activeParty.size(); ++charIndex) { - Character &c = party._activeParty[charIndex]; + Character &ch = party._activeParty[charIndex]; if (_shooting[charIndex] && !_missedShot[charIndex]) { - if (!hitMonster(c, rangeType)) { + if (!hitMonster(ch, rangeType)) { ++_missedShot[charIndex]; } else { damage = _monsterDamage ? _monsterDamage : _weaponDamage; @@ -1337,6 +1340,8 @@ void Combat::attack(Character &c, RangeType rangeType) { case CLASS_SORCERER: divisor = 8; break; + default: + break; } int numberOfAttacks = c.getCurrentLevel() / divisor + 1; @@ -1651,6 +1656,8 @@ bool Combat::hitMonster(Character &c, RangeType rangeType) { case CLASS_SORCERER: divisor = 4; break; + default: + break; } chance += c.getCurrentLevel() / divisor; diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp index bdcdffaa84..147f934a61 100644 --- a/engines/xeen/dialogs_items.cpp +++ b/engines/xeen/dialogs_items.cpp @@ -913,8 +913,8 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite break; case ITEMMODE_BLACKSMITH: { - InventoryItems &items = _oldCharacter->_items[category]; - if (items[INV_ITEMS_TOTAL - 1]._id) { + InventoryItems &invItems = _oldCharacter->_items[category]; + if (invItems[INV_ITEMS_TOTAL - 1]._id) { // If the last slot is in use, it means the list is full ErrorScroll::show(_vm, Common::String::format(BACKPACK_IS_FULL, _oldCharacter->_name.c_str())); @@ -1021,13 +1021,13 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite if (Confirm::show(_vm, msg) && party.subtract(0, cost, 0)) { Common::String details = c._items[category].getIdentifiedDetails(itemIndex); Common::String desc = c._items[category].getFullDescription(itemIndex); - Common::String msg = Common::String::format(IDENTIFY_ITEM_MSG, + Common::String str = Common::String::format(IDENTIFY_ITEM_MSG, desc.c_str(), details.c_str()); - Window &w = screen._windows[14]; - w.open(); - w.writeString(msg); - w.update(); + Window &win = screen._windows[14]; + win.open(); + win.writeString(str); + win.update(); saveButtons(); clearButtons(); @@ -1037,7 +1037,7 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite events.clearEvents(); restoreButtons(); - w.close(); + win.close(); } break; } diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp index 544c110c82..69761bb4ec 100644 --- a/engines/xeen/dialogs_party.cpp +++ b/engines/xeen/dialogs_party.cpp @@ -240,8 +240,8 @@ void PartyDialog::execute() { // Rebuild the character list _charList.clear(); for (int idx = 0; idx < XEEN_TOTAL_CHARACTERS; ++idx) { - Character &c = party._roster[idx]; - if (!c._name.empty() && c._savedMazeId == party._priorMazeId) { + Character &ch = party._roster[idx]; + if (!ch._name.empty() && ch._savedMazeId == party._priorMazeId) { _charList.push_back(idx); } } @@ -339,7 +339,7 @@ void PartyDialog::setupFaces(int firstDisplayChar, bool updateFlag) { drawParty(updateFlag); // Set up the sprite set to use for each face - for (int posIndex = 0; posIndex < 4; ++posIndex) { + for (posIndex = 0; posIndex < 4; ++posIndex) { if ((firstDisplayChar + posIndex) >= (int)_charList.size()) _faceDrawStructs[posIndex]._sprites = nullptr; else diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index d1a1478d95..f9f1eebd10 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -1006,7 +1006,7 @@ bool Interface::checkMoveDirection(int key) { break; } } else { - int surfaceId = map.getCell(2); + surfaceId = map.getCell(2); if (surfaceId >= map.mazeData()._difficulties._wallNoPass) { party._mazeDirection = dir; sound.playFX(46); diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 9f56b98c4c..1db4a14f59 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -638,9 +638,9 @@ void Party::giveTreasure() { // Fall back on checking the entire conscious party for (charIndex = 0; charIndex < (int)_activeParty.size(); ++charIndex) { - Character &c = _activeParty[charIndex]; - if (!c._items[(ItemCategory)categoryNum].isFull() && !c.isDisabledOrDead()) { - giveTreasureToCharacter(c, (ItemCategory)categoryNum, itemNum); + Character &ch = _activeParty[charIndex]; + if (!ch._items[(ItemCategory)categoryNum].isFull() && !ch.isDisabledOrDead()) { + giveTreasureToCharacter(ch, (ItemCategory)categoryNum, itemNum); break; } } diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp index ec8b8c6387..c0a49aeb22 100644 --- a/engines/xeen/sound.cpp +++ b/engines/xeen/sound.cpp @@ -28,6 +28,11 @@ namespace Xeen { SoundManager *VOC::_sound; +VOC::VOC(const Common::String &name) { + if (!open(name)) + error("Could not open - %s", name.c_str()); +} + void VOC::init(XeenEngine *vm) { _sound = vm->_sound; } diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index 172ef9eece..bcee6f2f45 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -39,6 +39,7 @@ private: Audio::SoundHandle _soundHandle; public: VOC() {} + VOC(const Common::String &name); virtual ~VOC() { stop(); } static void init(XeenEngine *vm); diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp index 3491f6fc7b..b29fb2d053 100644 --- a/engines/xeen/sprites.cpp +++ b/engines/xeen/sprites.cpp @@ -185,7 +185,7 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi destPos.y++; } else { scaleMaskX = scaleMaskXCopy; - int xOffset = f.readByte(); + xOffset = f.readByte(); // Initialize the array to hold the temporary data for the line. We do this to make it simpler // to handle both deciding which pixels to draw in a scaled image, as well as when images diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index 9b4bfa3ab1..221f5d9978 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -704,7 +704,7 @@ Character *Town::doTavernOptions(Character *c) { case Common::KEYCODE_s: { // Sign In - int idx = isDarkCc ? (party._mazeId - 29) >> 1 : party._mazeId - 28; + idx = isDarkCc ? (party._mazeId - 29) >> 1 : party._mazeId - 28; assert(idx >= 0); party._mazePosition.x = TAVERN_EXIT_LIST[isDarkCc ? 1 : 0][_townActionId][idx][0]; party._mazePosition.y = TAVERN_EXIT_LIST[isDarkCc ? 1 : 0][_townActionId][idx][1]; @@ -717,7 +717,7 @@ Character *Town::doTavernOptions(Character *c) { party._mazeDirection = DIR_SOUTH; party._priorMazeId = party._mazeId; - for (uint idx = 0; idx < party._activeParty.size(); ++idx) { + for (idx = 0; idx < (int)party._activeParty.size(); ++idx) { party._activeParty[idx]._savedMazeId = party._mazeId; party._activeParty[idx]._xeenSide = map._loadDarkSide; } @@ -825,8 +825,8 @@ Character *Town::doTempleOptions(Character *c) { intf.drawParty(true); sound.playSample(nullptr, 0); - File f("ahh.voc"); - sound.playSample(&f, 1); + VOC voc("ahh.voc"); + voc.play(); _flag1 = true; _donation = 0; } @@ -1030,7 +1030,6 @@ void Town::depositWithdrawl(int choice) { } } - uint gold, gems; if (choice) { gold = party._bankGold; gems = party._bankGems; diff --git a/engines/xeen/xsurface.cpp b/engines/xeen/xsurface.cpp index 04a264a80c..00d333d6d8 100644 --- a/engines/xeen/xsurface.cpp +++ b/engines/xeen/xsurface.cpp @@ -40,8 +40,8 @@ XSurface::~XSurface() { free(); } -void XSurface::create(uint16 w, uint16 h) { - Graphics::Surface::create(w, h, Graphics::PixelFormat::createFormatCLUT8()); +void XSurface::create(uint16 w_, uint16 h_) { + Graphics::Surface::create(w_, h_, Graphics::PixelFormat::createFormatCLUT8()); _freeFlag = true; } diff --git a/engines/xeen/xsurface.h b/engines/xeen/xsurface.h index d8747d4372..299cc51f1d 100644 --- a/engines/xeen/xsurface.h +++ b/engines/xeen/xsurface.h @@ -40,7 +40,7 @@ public: XSurface(int w, int h); virtual ~XSurface(); - void create(uint16 w, uint16 h); + void create(uint16 w_, uint16 h_); void create(XSurface *s, const Common::Rect &bounds); |