diff options
author | Florian Kagerer | 2009-06-03 17:35:06 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-06-03 17:35:06 +0000 |
commit | 0efe78d0f8896e46f8829a829b54db5240da26eb (patch) | |
tree | a32bab83ab9f147c7ed0deaabf19d2cd9651cbe9 /engines | |
parent | 5206ef16a6f8f47d9e04898f4e1fa08d3204cb07 (diff) | |
download | scummvm-rg350-0efe78d0f8896e46f8829a829b54db5240da26eb.tar.gz scummvm-rg350-0efe78d0f8896e46f8829a829b54db5240da26eb.tar.bz2 scummvm-rg350-0efe78d0f8896e46f8829a829b54db5240da26eb.zip |
LOL: implemented mist of doom spell
svn-id: r41145
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/lol.cpp | 59 | ||||
-rw-r--r-- | engines/kyra/lol.h | 10 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 10 |
4 files changed, 74 insertions, 7 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 0a428e78c9..98b5abc949 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1236,6 +1236,9 @@ void LoLEngine::setCharacterMagicOrHitPoints(int charNum, int type, int points, { 0x21, 0xA2, 0xA0, 0x00, 0x4253 } }; + if (charNum > 3) + return; + LoLCharacter *c = &_characters[charNum]; if (!(c->flags & 1)) return; @@ -2491,6 +2494,38 @@ void LoLEngine::processMagicHandOfFate(int spellLevel) { } void LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) { + static const uint8 mistDamage[] = { 30, 70, 110, 200 }; + + _envSfxUseQueue = true; + inflictMagicalDamageForBlock(calcNewBlockPosition(_currentBlock, _currentDirection), charNum, mistDamage[spellLevel], 0x80); + _envSfxUseQueue = false; + + int cp = _screen->setCurPage(2); + _screen->copyPage(0, 2); + gui_drawScene(2); + _screen->copyPage(2, 12); + + snd_playSoundEffect(155, -1); + + char wsafile[13]; + snprintf(wsafile, 13, "mists%0d.wsa", spellLevel + 1); + WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen); + mov->open(wsafile, 1, 0); + if (!mov->opened()) + error("Mist: Unable to load mists.wsa"); + + snd_playSoundEffect(_mistAnimData[spellLevel].sound, -1); + playSpellAnimation(mov, _mistAnimData[spellLevel].part1First, _mistAnimData[spellLevel].part1Last, 7, 112, 0, 0, 0, 0, 0, false); + playSpellAnimation(mov, _mistAnimData[spellLevel].part2First, _mistAnimData[spellLevel].part2Last, 14, 112, 0, 0, 0, 0, 0, false); + + mov->close(); + delete mov; + + _screen->setCurPage(cp); + _screen->copyPage(12, 0); + + updateDrawPage2(); + this->snd_playQueuedEffects(); } void LoLEngine::processMagicLightning(int charNum, int spellLevel) { @@ -2833,13 +2868,13 @@ void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFra _screen->updateScreen(); } - int del = delayTimer - _system->getMillis(); + int del = (int)(delayTimer - _system->getMillis()); do { - int step = del > _tickLength ? _tickLength : del; if (!pal1 || !pal2) { - delay(step); + if (del > 0) + delay(step); del -= step; continue; } @@ -2847,7 +2882,8 @@ void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFra if (!_screen->fadePaletteStep(pal1, pal2, _system->getMillis() - startTime, _tickLength * fadeDelay) && !mov) return; - delay(step); + if (del > 0) + delay(step); del -= step; } while (del > 0); @@ -2855,7 +2891,7 @@ void LoLEngine::playSpellAnimation(WSAMovie_v2 *mov, int firstFrame, int lastFra continue; curFrame += dir; - if (curFrame == lastFrame) + if ((dir > 0 && curFrame >= lastFrame) || (dir < 0 && curFrame < lastFrame)) fin = true; } @@ -3015,6 +3051,19 @@ int LoLEngine::inflictDamage(uint16 target, int damage, uint16 attacker, int ski } } else { + if (target > 3) { + // WORKAROUND for script bug + int i = 0; + for (; i < 4; i++) { + if (_characters[i].id == target) { + target = i; + break; + } + } + if (i == 4) + return 0; + } + c = &_characters[target]; if (!(c->flags & 1) || (c->flags & 8)) return 0; diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 200aae148a..ef749e607e 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -288,6 +288,14 @@ struct FireballState { uint8 finProgress; }; +struct MistOfDoomAnimData { + uint8 part1First; + uint8 part1Last; + uint8 part2First; + uint8 part2Last; + uint8 sound; +}; + class LoLEngine : public KyraEngine_v1 { friend class GUI_LoL; friend class TextDisplayer_LoL; @@ -1368,6 +1376,8 @@ private: uint8 **_healiShapes; int _numHealiShapes; + static const MistOfDoomAnimData _mistAnimData[]; + const uint8 *_updateSpellBookCoords; int _updateSpellBookCoordsSize; const uint8 *_updateSpellBookAnimData; diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 1b06c5af5b..06158d3c98 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -1423,7 +1423,7 @@ int LoLEngine::olol_checkForCertainPartyMember(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_checkForCertainPartyMember(%p) (%d)", (const void *)script, stackPos(0)); for (int i = 0; i < 4; i++) { if (_characters[i].flags & 9 && _characters[i].id == stackPos(0)) - return true; + return 1; } return 0; } diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 8cc9ba17c2..3f41768c3c 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -3159,6 +3159,8 @@ const uint8 LoLEngine::_clock2Timers[] = { 0x51, 0x52, 0x08, 0x09, 0x0A }; +const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers); + const int8 LoLEngine::_mapCoords[12][4] = { { 0, 7, 0, -5 }, { -5, 0, 6, 0 }, { 7, 5, 7, 1 }, { 5, 6, 4, 6 }, { 0, 7, 0, -1 }, { -3, 0, 6, 0 }, @@ -3166,7 +3168,13 @@ const int8 LoLEngine::_mapCoords[12][4] = { { 3, 1, 3, 1 }, { -1, 6, -1, -8 }, { -7, -1, 5, -1 } }; -const uint8 LoLEngine::_numClock2Timers = ARRAYSIZE(LoLEngine::_clock2Timers); +const MistOfDoomAnimData LoLEngine::_mistAnimData[] = { + { 0, 7, 7, 13, 155 }, + { 0, 16, 16, 17, 155 }, + { 0, 24, 24, 24, 174 }, + { 0, 19, 19, 19, 174 }, + { 0, 16, 16, 17, 175 }, +}; const char * const LoLEngine::_outroShapeFileTable[] = { "AMAZON.SHP", "ARCHRSLG.SHP", "AVIANWRM.SHP", "BANDIT.SHP", "BOAR.SHP", "CABAL.SHP", |