diff options
-rw-r--r-- | engines/kyra/lol.cpp | 55 | ||||
-rw-r--r-- | engines/kyra/lol.h | 2 | ||||
-rw-r--r-- | engines/kyra/scene_lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/sprites_lol.cpp | 6 |
4 files changed, 60 insertions, 5 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 0ff8470ce3..32870f9c70 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -3294,6 +3294,61 @@ void LoLEngine::restoreSwampPalette() { } void LoLEngine::launchMagicViper() { + _partyAwake = true; + + int d = 0; + for (uint16 b = _currentBlock; d < 3; d++) { + uint16 o = _levelBlockProperties[b].assignedObjects; + if (o & 0x8000) + break; + b = calcNewBlockPosition(b, _currentDirection); + if (_wllWallFlags[_levelBlockProperties[b].walls[_currentDirection ^ 2]] & 7) + break; + } + + _screen->copyPage(0, 12); + snd_playSoundEffect(148, -1); + + WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen); + int numFrames = mov->open("viper.wsa", 1, 0); + if (!mov->opened()) + error("Viper: Unable to load viper.wsa"); + + static const uint8 viperAnimData[] = { 15, 25, 20, 10, 25, 20, 5, 25, 20, 0, 25, 20 }; + const uint8 *v = &viperAnimData[d * 3]; + int frm = v[0]; + + for (bool running = true; running;) { + uint32 etime = _system->getMillis() + 5 * _tickLength; + _screen->copyPage(12, 2); + + if (frm == v[2]) + snd_playSoundEffect(172, -1); + + mov->displayFrame(frm++ % numFrames, 2, 112, 0, 0x5000, _trueLightTable1, _trueLightTable2); + _screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); + delayUntil(etime); + + if (frm > v[1]) + running = false; + } + + mov->close(); + delete mov; + + _screen->copyPage(12, 0); + _screen->copyPage(12, 2); + + int t = _rnd.getRandomNumberRng(1, 4); + + for (int i = 0; i < 4; i++) { + if (!(_characters[i].flags & 1)) { + t = t % 4; + continue; + } + inflictDamage(t, _currentLevel + 10, 0x8000, 2, 0x86); + } } void LoLEngine::breakIceWall(uint8 *pal1, uint8 *pal2) { diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 4f4ae4a3c8..84b6386ccd 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -1211,7 +1211,7 @@ private: void removeDrawObjectFromBlock(LevelBlockProperty *l, int id); void assignMonsterToBlock(uint16 *assignedBlockObjects, int id); void giveItemToMonster(MonsterInPlay *monster, uint16 item); - int checkBlockBeforeObjectPlacement(int x, int y, int objectWidth, int testFlag, int wallFlag); + int checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 objectWidth, uint16 testFlag, uint16 wallFlag); int checkBlockForWallsAndSufficientSpace(int block, int x, int y, int objectWidth, int testFlag, int wallFlag); int calcMonsterSkillLevel(int id, int a); int checkBlockOccupiedByParty(int x, int y, int testFlag); diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 4917ce8b96..5cec86d9f3 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -700,7 +700,7 @@ uint16 LoLEngine::calcNewBlockPosition(uint16 curBlock, uint16 direction) { } uint16 LoLEngine::calcBlockIndex(uint16 x, uint16 y) { - return ((y & 0xff00) >> 3) | (x >> 8); + return (((y & 0xff00) >> 3) | (x >> 8)) & 0x3ff; } void LoLEngine::calcCoordinates(uint16 &x, uint16 &y, int block, uint16 xOffs, uint16 yOffs) { diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index a936c4340d..df1e062ae2 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -384,10 +384,10 @@ void LoLEngine::assignMonsterToBlock(uint16 *assignedBlockObjects, int id) { *assignedBlockObjects = id; } -int LoLEngine::checkBlockBeforeObjectPlacement(int x, int y, int objectWidth, int testFlag, int wallFlag) { +int LoLEngine::checkBlockBeforeObjectPlacement(uint16 x, uint16 y, uint16 objectWidth, uint16 testFlag, uint16 wallFlag) { _objectLastDirection = 0; - int x2 = 0; - int y2 = 0; + uint16 x2 = 0; + uint16 y2 = 0; int xOffs = 0; int yOffs = 0; int flag = 0; |