diff options
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/combat.cpp | 19 | ||||
-rw-r--r-- | engines/xeen/combat.h | 14 | ||||
-rw-r--r-- | engines/xeen/interface.cpp | 1 | ||||
-rw-r--r-- | engines/xeen/spells.cpp | 78 |
4 files changed, 65 insertions, 47 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index f60ed38e55..618b556b6b 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -69,7 +69,10 @@ static const int ATTACK_TYPE_FX[23] = { 4, 5, 4, 9, 27, 29, 44, 51, 53, 61, 71 }; -static const int MONSTER_SHOOT_POW[7] = { 12, 14, 0, 4, 8, 10, 13 }; +static const PowType MONSTER_SHOOT_POW[7] = { + POW_MAGIC_ARROW, POW_SPARKLES, POW_FIREBALL, + POW_MEGAVOLTS, POW_COLD_RAY, POW_SPRAY, POW_ENERGY_BLAST +}; static const int COMBAT_SHOOTING[4] = { 1, 1, 2, 3 }; @@ -540,7 +543,7 @@ void Combat::monstersAttack() { Map &map = *_vm->_map; Party &party = *_vm->_party; Sound &sound = *_vm->_sound; - int powNum = -1; + PowType powNum = POW_INVALID; MonsterStruct *monsterData = nullptr; OutdoorDrawList &outdoorList = intf._outdoorList; IndoorDrawList &indoorList = intf._indoorList; @@ -549,12 +552,12 @@ void Combat::monstersAttack() { if (_gmonHit[idx] != -1) { monsterData = &map._monsterData[_gmonHit[idx]]; powNum = MONSTER_SHOOT_POW[monsterData->_attackType]; - if (powNum != 12) + if (powNum != POW_MAGIC_ARROW) break; } } - _powSprites.load(Common::String::format("pow%d.icn", powNum)); + _powSprites.load(Common::String::format("pow%d.icn", (int)powNum)); sound.playFX(ATTACK_TYPE_FX[monsterData->_attackType]); for (int charNum = 0; charNum < MAX_PARTY_COUNT; ++charNum) { @@ -1799,7 +1802,7 @@ void Combat::giveExperience(int experience) { } } -void Combat::multiAttack(int powNum) { +void Combat::rangedAttack(PowType powNum) { Interface &intf = *_vm->_interface; Map &map = *_vm->_map; Party &party = *_vm->_party; @@ -1809,7 +1812,7 @@ void Combat::multiAttack(int powNum) { _damageType = DT_POISON; _shootType = ST_1; Common::fill(&_shooting[0], &_shooting[6], 1); - } else if (powNum == 11) { + } else if (powNum == POW_ARROW) { _shootType = ST_1; bool flag = false; @@ -1838,7 +1841,7 @@ void Combat::multiAttack(int powNum) { } intf._charsShooting = true; - _powSprites.load(Common::String::format("pow%d.icn", powNum)); + _powSprites.load(Common::String::format("pow%d.icn", (int)powNum)); int monsterIndex = _monsterIndex; int monster2Attack = _monster2Attack; bool attackedFlag = false; @@ -2060,7 +2063,7 @@ done: void Combat::shootRangedWeapon() { _rangeType = RT_ALL; _damageType = DT_PHYSICAL; - multiAttack(11); + rangedAttack(POW_ARROW); } } // End of namespace Xeen diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h index 8a7c676018..3a79a2ea22 100644 --- a/engines/xeen/combat.h +++ b/engines/xeen/combat.h @@ -68,6 +68,15 @@ enum CombatMode { COMBATMODE_0 = 0, COMBATMODE_1 = 1, COMBATMODE_2 = 2 }; +enum PowType { + POW_INVALID = -1, POW_FIREBALL = 0, POW_INCINERATE = 1, + POW_FIERY_FLAIL = 2, POW_LIGHTNING = 3, POW_MEGAVOLTS = 4, + POW_SPARKS = 5, POW_STOPPER = 6, POW_MAGIC_ORB = 7, + POW_COLD_RAY = 8, POW_FROST_WAVE = 9, POW_SPRAY = 10, + POW_ARROW = 11, POW_MAGIC_ARROW = 12, POW_ENERGY_BLAST = 13, + POW_SPARKLES = 14, POW_DEADLY_SWARM = 15 +}; + class XeenEngine; class Character; class XeenItem; @@ -208,7 +217,10 @@ public: int stopAttack(const Common::Point &diffPt); - void multiAttack(int powNum); + /** + * Called to do ranged attacks, both with bows or using a spell + */ + void rangedAttack(PowType powNum); /** * Fires off a ranged attack at all oncoming monsters diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 689a797cce..230bafc695 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -1247,6 +1247,7 @@ void Interface::draw3d(bool updateFlag, bool skipDelay) { Screen &screen = *_vm->_screen; Scripts &scripts = *_vm->_scripts; + events.updateGameCounter(); if (screen._windows[11]._enabled) return; diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp index b3471df96c..ff737d9e77 100644 --- a/engines/xeen/spells.cpp +++ b/engines/xeen/spells.cpp @@ -250,7 +250,7 @@ void Spells::acidSpray() { combat._damageType = DT_POISON; combat._rangeType = RT_ALL; sound.playFX(17); - combat.multiAttack(10); + combat.rangedAttack(POW_SPRAY); } void Spells::awaken() { @@ -277,7 +277,7 @@ void Spells::beastMaster() { combat._damageType = DT_BEASTMASTER; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(7); + combat.rangedAttack(POW_MAGIC_ORB); } void Spells::bless() { @@ -302,7 +302,7 @@ void Spells::coldRay() { combat._damageType = DT_COLD; combat._rangeType = RT_ALL; sound.playFX(15); - combat.multiAttack(8); + combat.rangedAttack(POW_COLD_RAY); } void Spells::createFood() { @@ -378,7 +378,7 @@ void Spells::dancingSword() { combat._damageType = DT_PHYSICAL; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(14); + combat.rangedAttack(POW_SPARKLES); } void Spells::dayOfProtection() { @@ -422,7 +422,7 @@ void Spells::deadlySwarm() { combat._damageType = DT_PHYSICAL; combat._rangeType = RT_GROUP; sound.playFX(13); - combat.multiAttack(15); + combat.rangedAttack(POW_DEADLY_SWARM); } void Spells::detectMonster() { @@ -505,20 +505,22 @@ void Spells::dragonSleep() { combat._damageType = DT_DRAGONSLEEP; combat._rangeType = RT_SINGLE; sound.playFX(18); - combat.multiAttack(7); + combat.rangedAttack(POW_MAGIC_ORB); } void Spells::elementalStorm() { Combat &combat = *_vm->_combat; Sound &sound = *_vm->_sound; static const int STORM_FX_LIST[4] = { 13, 14, 15, 17 }; - static const int STORM_MA_LIST[4] = { 0, 5, 9, 10 }; + static const PowType STORM_MA_LIST[4] = { + POW_FIREBALL, POW_SPARKS, POW_FROST_WAVE, POW_SPRAY + }; combat._monsterDamage = 150; combat._damageType = (DamageType)_vm->getRandomNumber(DT_FIRE, DT_POISON); combat._rangeType = RT_ALL; sound.playFX(STORM_FX_LIST[combat._damageType]); - combat.multiAttack(STORM_MA_LIST[combat._damageType]); + combat.rangedAttack(STORM_MA_LIST[combat._damageType]); } void Spells::enchantItem() { @@ -541,7 +543,7 @@ void Spells::energyBlast() { combat._damageType = DT_ENERGY; combat._rangeType = RT_SINGLE; sound.playFX(16); - combat.multiAttack(13); + combat.rangedAttack(POW_ENERGY_BLAST); } void Spells::etherialize() { @@ -570,7 +572,7 @@ void Spells::fantasticFreeze() { combat._damageType = DT_COLD; combat._rangeType = RT_GROUP; sound.playFX(15); - combat.multiAttack(8); + combat.rangedAttack(POW_COLD_RAY); } void Spells::fieryFlail() { @@ -581,7 +583,7 @@ void Spells::fieryFlail() { combat._damageType = DT_FIRE; combat._rangeType = RT_SINGLE; sound.playFX(13); - combat.multiAttack(2); + combat.rangedAttack(POW_FIERY_FLAIL); } void Spells::fingerOfDeath() { @@ -592,7 +594,7 @@ void Spells::fingerOfDeath() { combat._damageType = DT_FINGEROFDEATH; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(14); + combat.rangedAttack(POW_SPARKLES); } void Spells::fireball() { @@ -603,7 +605,7 @@ void Spells::fireball() { combat._damageType = DT_FIRE; combat._rangeType = RT_GROUP; sound.playFX(13); - combat.multiAttack(0); + combat.rangedAttack(POW_FIREBALL); } void Spells::firstAid() { @@ -629,7 +631,7 @@ void Spells::flyingFist() { combat._damageType = DT_PHYSICAL; combat._rangeType = RT_SINGLE; sound.playFX(18); - combat.multiAttack(14); + combat.rangedAttack(POW_SPARKLES); } void Spells::frostbite() { @@ -640,7 +642,7 @@ void Spells::frostbite() { combat._damageType = DT_COLD; combat._rangeType = RT_SINGLE; sound.playFX(8); - combat.multiAttack(8); + combat.rangedAttack(POW_COLD_RAY); } void Spells::golemStopper() { @@ -651,7 +653,7 @@ void Spells::golemStopper() { combat._damageType = DT_GOLEMSTOPPER; combat._rangeType = RT_SINGLE; sound.playFX(16); - combat.multiAttack(6); + combat.rangedAttack(POW_STOPPER); } void Spells::heroism() { @@ -680,7 +682,7 @@ void Spells::holyWord() { combat._damageType = DT_HOLYWORD; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(13); + combat.rangedAttack(POW_ENERGY_BLAST); } void Spells::hypnotize() { @@ -691,7 +693,7 @@ void Spells::hypnotize() { combat._damageType = DT_HYPNOTIZE; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(7); + combat.rangedAttack(POW_MAGIC_ORB); } void Spells::identifyMonster() { @@ -713,7 +715,7 @@ void Spells::implosion() { combat._damageType = DT_ENERGY; combat._rangeType = RT_SINGLE; sound.playFX(18); - combat.multiAttack(6); + combat.rangedAttack(POW_STOPPER); } void Spells::incinerate() { @@ -724,7 +726,7 @@ void Spells::incinerate() { combat._damageType = DT_FIRE; combat._rangeType = RT_SINGLE; sound.playFX(22); - combat.multiAttack(1); + combat.rangedAttack(POW_INCINERATE); } void Spells::inferno() { @@ -735,7 +737,7 @@ void Spells::inferno() { combat._damageType = DT_FIRE; combat._rangeType = RT_GROUP; sound.playFX(13); - combat.multiAttack(1); + combat.rangedAttack(POW_INCINERATE); } void Spells::insectSpray() { @@ -746,7 +748,7 @@ void Spells::insectSpray() { combat._damageType = DT_INSECT_SPRAY; combat._rangeType = RT_GROUP; sound.playFX(17); - combat.multiAttack(10); + combat.rangedAttack(POW_SPRAY); } void Spells::itemToGold() { @@ -825,7 +827,7 @@ void Spells::lightningBolt() { combat._damageType = DT_ELECTRICAL; combat._rangeType = RT_GROUP; sound.playFX(14); - combat.multiAttack(3); + combat.rangedAttack(POW_LIGHTNING); } void Spells::lloydsBeacon() { @@ -842,7 +844,7 @@ void Spells::magicArrow() { combat._monsterDamage = 0; combat._damageType = DT_MAGIC_ARROW; combat._rangeType = RT_SINGLE; - combat.multiAttack(11); + combat.rangedAttack(POW_ARROW); } void Spells::massDistortion() { @@ -853,7 +855,7 @@ void Spells::massDistortion() { combat._damageType = DT_MASS_DISTORTION; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(6); + combat.rangedAttack(POW_STOPPER); } void Spells::megaVolts() { @@ -864,7 +866,7 @@ void Spells::megaVolts() { combat._damageType = DT_ELECTRICAL; combat._rangeType = RT_GROUP; sound.playFX(14); - combat.multiAttack(4); + combat.rangedAttack(POW_MEGAVOLTS); } void Spells::moonRay() { @@ -877,7 +879,7 @@ void Spells::moonRay() { combat._damageType = DT_ENERGY; combat._rangeType = RT_ALL; sound.playFX(16); - combat.multiAttack(13); + combat.rangedAttack(POW_ENERGY_BLAST); for (uint idx = 0; idx < party._activeParty.size(); ++idx) { sound.playFX(30); @@ -910,7 +912,7 @@ void Spells::pain() { combat._damageType = DT_PHYSICAL; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(14); + combat.rangedAttack(POW_SPARKLES); } void Spells::poisonVolley() { @@ -921,7 +923,7 @@ void Spells::poisonVolley() { combat._damageType = DT_POISON_VOLLEY; combat._rangeType = RT_ALL; sound.playFX(49); - combat.multiAttack(11); + combat.rangedAttack(POW_ARROW); } void Spells::powerCure() { @@ -956,7 +958,7 @@ void Spells::prismaticLight() { combat._damageType = (DamageType)_vm->getRandomNumber(DT_PHYSICAL, DT_ENERGY); combat._rangeType = RT_ALL; sound.playFX(18); - combat.multiAttack(14); + combat.rangedAttack(POW_SPARKLES); } void Spells::protectionFromElements() { @@ -1074,7 +1076,7 @@ void Spells::shrapMetal() { combat._damageType = DT_PHYSICAL; combat._rangeType = RT_GROUP; sound.playFX(16); - combat.multiAttack(15); + combat.rangedAttack(POW_DEADLY_SWARM); } void Spells::sleep() { @@ -1085,7 +1087,7 @@ void Spells::sleep() { combat._damageType = DT_SLEEP; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(7); + combat.rangedAttack(POW_MAGIC_ORB); } void Spells::sparks() { @@ -1096,7 +1098,7 @@ void Spells::sparks() { combat._damageType = DT_ELECTRICAL; combat._rangeType = RT_GROUP; sound.playFX(14); - combat.multiAttack(5); + combat.rangedAttack(POW_SPARKS); } void Spells::starBurst() { @@ -1107,7 +1109,7 @@ void Spells::starBurst() { combat._damageType = DT_FIRE; combat._rangeType = RT_ALL; sound.playFX(13); - combat.multiAttack(15); + combat.rangedAttack(POW_DEADLY_SWARM); } void Spells::stoneToFlesh() { @@ -1132,7 +1134,7 @@ void Spells::sunRay() { combat._damageType = DT_ENERGY; combat._rangeType = RT_ALL; sound.playFX(16); - combat.multiAttack(13); + combat.rangedAttack(POW_ENERGY_BLAST); } void Spells::superShelter() { @@ -1284,7 +1286,7 @@ void Spells::toxicCloud() { combat._damageType = DT_POISON; combat._rangeType = RT_GROUP; sound.playFX(17); - combat.multiAttack(10); + combat.rangedAttack(POW_SPRAY); } void Spells::turnUndead() { @@ -1295,7 +1297,7 @@ void Spells::turnUndead() { combat._damageType = DT_UNDEAD; combat._rangeType = RT_GROUP; sound.playFX(18); - combat.multiAttack(13); + combat.rangedAttack(POW_ENERGY_BLAST); } void Spells::walkOnWater() { @@ -1323,7 +1325,7 @@ void Spells::frostbite2() { combat._damageType = DT_COLD; combat._rangeType = RT_SINGLE; sound.playFX(15); - combat.multiAttack(9); + combat.rangedAttack(POW_FROST_WAVE); } } // End of namespace Xeen |