diff options
author | Paul Gilbert | 2015-01-28 08:46:34 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-28 08:46:34 -0500 |
commit | 8a324eb755cfa07cccfe2c1513522801863643c8 (patch) | |
tree | 2852cf86504aca4a488eaa68611693c7897abb64 | |
parent | a755ce6e9215006bbafbcb28f46c30a03b464a4d (diff) | |
download | scummvm-rg350-8a324eb755cfa07cccfe2c1513522801863643c8.tar.gz scummvm-rg350-8a324eb755cfa07cccfe2c1513522801863643c8.tar.bz2 scummvm-rg350-8a324eb755cfa07cccfe2c1513522801863643c8.zip |
XEEN: Implemented drawTownAnim
-rw-r--r-- | engines/xeen/dialogs_whowill.cpp | 3 | ||||
-rw-r--r-- | engines/xeen/dialogs_yesno.cpp | 3 | ||||
-rw-r--r-- | engines/xeen/interface_map.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/interface_map.h | 2 | ||||
-rw-r--r-- | engines/xeen/sound.h | 2 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 136 | ||||
-rw-r--r-- | engines/xeen/town.h | 3 |
7 files changed, 142 insertions, 11 deletions
diff --git a/engines/xeen/dialogs_whowill.cpp b/engines/xeen/dialogs_whowill.cpp index 042214a3dc..fb845a6d9a 100644 --- a/engines/xeen/dialogs_whowill.cpp +++ b/engines/xeen/dialogs_whowill.cpp @@ -41,6 +41,7 @@ int WhoWill::execute(int message, int action, bool type) { Party &party = *_vm->_party; Screen &screen = *_vm->_screen; Scripts &scripts = *_vm->_scripts; + Town &town = *_vm->_town; int numFrames; if (party._partyCount <= 1) @@ -65,7 +66,7 @@ int WhoWill::execute(int message, int action, bool type) { events.updateGameCounter(); if (screen._windows[11]._enabled) { - intf.drawTownAnim(0); + town.drawTownAnim(0); screen._windows[36].frame(); numFrames = 3; } else { diff --git a/engines/xeen/dialogs_yesno.cpp b/engines/xeen/dialogs_yesno.cpp index 07de5a582f..1c0c3a7fe2 100644 --- a/engines/xeen/dialogs_yesno.cpp +++ b/engines/xeen/dialogs_yesno.cpp @@ -39,6 +39,7 @@ bool YesNo::execute(bool type, int v2) { Interface &intf = *_vm->_interface; Map &map = *_vm->_map; Party &party = *_vm->_party; + Town &town = *_vm->_town; SpriteResource confirmSprites; int numFrames; bool result = false; @@ -67,7 +68,7 @@ bool YesNo::execute(bool type, int v2) { intf.draw3d(true); numFrames = 1; } else { - intf.drawTownAnim(v2); + town.drawTownAnim(v2); numFrames = 3; } diff --git a/engines/xeen/interface_map.cpp b/engines/xeen/interface_map.cpp index f90d3e369a..77a5f928c7 100644 --- a/engines/xeen/interface_map.cpp +++ b/engines/xeen/interface_map.cpp @@ -4964,8 +4964,4 @@ void InterfaceMap::drawMiniMap() { party._wizardEyeActive = eyeActive; } -void InterfaceMap::drawTownAnim(bool v) { - warning("TODO"); -} - } // End of namespace Xeen diff --git a/engines/xeen/interface_map.h b/engines/xeen/interface_map.h index 153abba223..fb448e1f29 100644 --- a/engines/xeen/interface_map.h +++ b/engines/xeen/interface_map.h @@ -165,8 +165,6 @@ public: void drawOutdoors(); - void drawTownAnim(bool v); - void assembleBorder(); }; diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index b6f1948726..7e7df9caea 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -45,6 +45,8 @@ public: void playSample(const Common::SeekableReadStream *stream, int v2 = 1) {} + bool playSample(int v1, int v2) { return false; } + void playFX(int id) {} }; diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index af93d0016c..328301a73b 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -51,6 +51,7 @@ Town::Town(XeenEngine *vm) : _vm(vm) { _uncurseCost = 0; _flag1 = false; _nextExperienceLevel = 0; + _drawCtr1 = _drawCtr2 = 0; } void Town::loadStrings(const Common::String &name) { @@ -231,7 +232,7 @@ int Town::townAction(int actionId) { screen._windows[0].update(); intf.highlightChar(0); - intf.drawTownAnim(1); + drawTownAnim(1); if (actionId == 0) intf._overallFrame = 2; @@ -290,7 +291,6 @@ int Town::townAction(int actionId) { int Town::townWait() { EventsManager &events = *_vm->_events; - Interface &intf = *_vm->_interface; _buttonValue = 0; while (!_vm->shouldQuit() && !_buttonValue) { @@ -300,7 +300,7 @@ int Town::townWait() { checkEvents(_vm); } if (!_buttonValue) - intf.drawTownAnim(!_vm->_screen->_windows[11]._enabled); + drawTownAnim(!_vm->_screen->_windows[11]._enabled); } return _buttonValue; @@ -1118,6 +1118,136 @@ int Town::subtract(int mode, uint amount, int whereId, ErrorWaitType wait) { return true; } +void Town::drawTownAnim(bool flag) { + Interface &intf = *_vm->_interface; + Screen &screen = *_vm->_screen; + SoundManager &sound = *_vm->_sound; + bool isDarkCc = _vm->_files->_isDarkCc; + + if (_townActionId == 1) { + if (sound.playSample(1, 0)) { + if (isDarkCc) { + _townSprites[_townCurrent / 8].draw(screen, _townCurrent % 8, _townPos); + _townSprites[2].draw(screen, _vm->getRandomNumber(11) == 1 ? 9 : 10, + Common::Point(34, 33)); + _townSprites[2].draw(screen, _vm->getRandomNumber(5) + 3, + Common::Point(34, 54)); + } + } else { + _townSprites[_townCurrent / 8].draw(screen, _townCurrent % 8, _townPos); + if (isDarkCc) { + _townSprites[2].draw(screen, _vm->getRandomNumber(11) == 1 ? 9 : 10, + Common::Point(34, 33)); + } + } + } else { + if (!isDarkCc || _townActionId != 5) { + if (!_townSprites[_townCurrent / 8].empty()) + _townSprites[_townCurrent / 8].draw(screen, _townCurrent % 8, _townPos); + } + } + + switch (_townActionId) { + case 0: + if (sound.playSample(1, 0) || (isDarkCc && intf._overallFrame)) { + if (isDarkCc) { + if (sound.playSample(1, 0) || intf._overallFrame == 1) { + _townSprites[4].draw(screen, _vm->getRandomNumber(13, 18), + Common::Point(8, 30)); + } else if (intf._overallFrame > 1) { + _townSprites[4].draw(screen, 13 - intf._overallFrame++, + Common::Point(8, 30)); + if (intf._overallFrame > 14) + intf._overallFrame = 0; + } + } else { + _townSprites[2].draw(screen, _vm->getRandomNumber(7, 11), Common::Point(8, 8)); + } + } + break; + + case 2: + if (sound.playSample(1, 0)) { + if (isDarkCc) { + if (intf._overallFrame) { + intf._overallFrame ^= 1; + _townSprites[6].draw(screen, intf._overallFrame, Common::Point(8, 106)); + } else { + _townSprites[6].draw(screen, _vm->getRandomNumber(3), Common::Point(16, 48)); + } + } + } + break; + + case 3: + if (sound.playSample(1, 0) && isDarkCc) { + _townSprites[4].draw(screen, _vm->getRandomNumber(7), Common::Point(153, 49)); + } + break; + case 4: + if (sound.playSample(1, 0)) { + _townSprites[3].draw(screen, _vm->getRandomNumber(2, 4), Common::Point(8, 8)); + + } + break; + + case 5: + if (sound.playSample(1, 0)) { + if (isDarkCc) { + _townSprites[_townCurrent / 8].draw(screen, _townCurrent % 8, _townPos); + } + } else { + if (isDarkCc) { + _townSprites[0].draw(screen, ++intf._overallFrame % 8, Common::Point(8, 8)); + _townSprites[5].draw(screen, _vm->getRandomNumber(5), Common::Point(61, 74)); + } else { + _townSprites[1].draw(screen, _vm->getRandomNumber(8, 12), Common::Point(8, 8)); + } + } + } + + if (flag) { + intf._face1UIFrame = 0; + intf._face2UIFrame = 0; + intf._dangerSenseUIFrame = 0; + intf._spotDoorsUIFrame = 0; + intf._batUIFrame = 0; + + intf.assembleBorder(); + } + + if (screen._windows[11]._enabled) { + _drawCtr1 = (_drawCtr1 + 1) % 2; + if (!_drawCtr1 || !_drawCtr2) { + _townCurrent = 0; + _drawCtr2 = 0; + } else { + _townCurrent = _vm->getRandomNumber(3); + } + } else { + _townCurrent = (_townCurrent + 1) % _townMaxId; + } + + if (isDarkCc) { + if (_townActionId == 1 && (_townCurrent == 4 || _townCurrent == 13)) + sound.playFX(45); + + if (_townActionId == 5 && _townCurrent == 23) { + File f("spit1.voc"); + sound.playSample(&f, 0); + } + } else { + if (_townMaxId == 32 || _townCurrent == 0) + _townCurrent = 17; + if (_townMaxId == 26 || _townCurrent == 0) + _townCurrent = 20; + if (_townActionId == 1 && (_townCurrent == 3 || _townCurrent == 9)) + sound.playFX(45); + } + + screen._windows[3].update(); +} + Character *Town::showItems(Character *c, int v2) { error("TODO: showItems"); } diff --git a/engines/xeen/town.h b/engines/xeen/town.h index 88031cab8e..e28d03cf5c 100644 --- a/engines/xeen/town.h +++ b/engines/xeen/town.h @@ -60,6 +60,7 @@ private: int _currentCharLevel; bool _flag1; uint _nextExperienceLevel; + int _drawCtr1, _drawCtr2; void loadStrings(const Common::String &name); @@ -106,6 +107,8 @@ public: Town(XeenEngine *vm); int townAction(int actionId); + + void drawTownAnim(bool flag); }; } // End of namespace Xeen |