diff options
author | athrxx | 2011-06-05 01:03:55 +0200 |
---|---|---|
committer | athrxx | 2011-06-05 01:37:59 +0200 |
commit | 66c982b38ce9463daad621f8129dd97e0bb1a6ce (patch) | |
tree | 61b5361f5531486aedf0e7a7331dc63262926dd4 | |
parent | b15a5c8e133eb198843714d1593b829793142374 (diff) | |
download | scummvm-rg350-66c982b38ce9463daad621f8129dd97e0bb1a6ce.tar.gz scummvm-rg350-66c982b38ce9463daad621f8129dd97e0bb1a6ce.tar.bz2 scummvm-rg350-66c982b38ce9463daad621f8129dd97e0bb1a6ce.zip |
LOL: cleanup
- fix RTL during outro/credits
- get rid of _animator
- fix wrong memset
-rw-r--r-- | engines/kyra/lol.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/lol.h | 1 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 31 | ||||
-rw-r--r-- | engines/kyra/sequences_lol.cpp | 67 |
4 files changed, 54 insertions, 55 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 9b0ae173d5..3a8a332840 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -42,7 +42,6 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy _gui = 0; _txt = 0; _tim = 0; - _animator = 0; switch (_flags.lang) { case Common::EN_ANY: @@ -576,7 +575,6 @@ Common::Error LoLEngine::go() { _tim = new TIMInterpreter_LoL(this, _screen, _system); assert(_tim); - _animator = _tim->animator(); if (shouldQuit()) return Common::kNoError; @@ -1811,11 +1809,13 @@ void LoLEngine::createTransparencyTables() { } void LoLEngine::updateSequenceBackgroundAnimations() { - if (_updateFlags & 8 || !_animator) + if (_updateFlags & 8 || !_tim) + return; + if (!_tim->animator()) return; for (int i = 0; i < 6; i++) - _animator->update(i); + _tim->animator()->update(i); } void LoLEngine::loadTalkFile(int index) { @@ -2720,7 +2720,7 @@ int LoLEngine::processMagicMistOfDoom(int charNum, int spellLevel) { _screen->copyPage(12, 0); updateDrawPage2(); - this->snd_playQueuedEffects(); + snd_playQueuedEffects(); return 1; } diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index 28e7fd80d1..943bb7f8d5 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -315,7 +315,6 @@ private: GUI_LoL *_gui; TIMInterpreter *_tim; - TimAnimator *_animator; Common::Error init(); Common::Error go(); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 2261ef8389..a875e67a68 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -524,7 +524,7 @@ int LoLEngine::olol_initAnimStruct(EMCState *script) { int LoLEngine::olol_playAnimationPart(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_playAnimationPart(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); - _animator->playPart(stackPos(0), stackPos(1), stackPos(2), stackPos(3)); + _tim->animator()->playPart(stackPos(0), stackPos(1), stackPos(2), stackPos(3)); return 1; } @@ -593,13 +593,13 @@ int LoLEngine::olol_clearDialogueField(EMCState *script) { int LoLEngine::olol_setupBackgroundAnimationPart(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setupBackgroundAnimationPart(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9)); - _animator->setupPart(stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9)); + _tim->animator()->setupPart(stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9)); return 0; } int LoLEngine::olol_startBackgroundAnimation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_startBackgroundAnimation(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); - _animator->start(stackPos(0), stackPos(1)); + _tim->animator()->start(stackPos(0), stackPos(1)); return 1; } @@ -629,7 +629,7 @@ int LoLEngine::olol_loadBitmap(EMCState *script) { int LoLEngine::olol_stopBackgroundAnimation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_stopBackgroundAnimation(%p) (%d)", (const void *)script, stackPos(0)); - _animator->stop(stackPos(0)); + _tim->animator()->stop(stackPos(0)); return 1; } @@ -1440,7 +1440,10 @@ int LoLEngine::olol_playEndSequence(EMCState *script){ _screen->getPalette(1).clear(); showOutro(c, (_monsterDifficulty == 2)); - quitGame(); + // Don't call quitGame() on a RTL request (because this would + // make the next game launched from the launcher quit instantly. + if (!shouldQuit()) + quitGame(); return 0; } @@ -1983,7 +1986,7 @@ int LoLEngine::olol_removeInventoryItem(EMCState *script) { int LoLEngine::olol_getAnimationLastPart(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getAnimationLastPart(%p) (%d)", (const void *)script, stackPos(0)); - return _animator->resetLastPart(stackPos(0)); + return _tim->animator()->resetLastPart(stackPos(0)); } int LoLEngine::olol_assignSpecialGuiShape(EMCState *script) { @@ -2406,16 +2409,16 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) { const int y2 = param[3]; const int factor = MAX<int>(0, (int16)param[4]); - const int x1 = _animator->getAnimX(animIndex); - const int y1 = _animator->getAnimY(animIndex); - const Movie *wsa = _animator->getWsaCPtr(animIndex); + const int x1 = _tim->animator()->getAnimX(animIndex); + const int y1 = _tim->animator()->getAnimY(animIndex); + const Movie *wsa = _tim->animator()->getWsaCPtr(animIndex); int w1 = wsa->width(); int h1 = wsa->height(); int w2 = (w1 * factor) / 100; int h2 = (h1 * factor) / 100; - _animator->displayFrame(animIndex, 2, frame); + _tim->animator()->displayFrame(animIndex, 2, frame); _screen->wsaFrameAnimationStep(x1, y1, x2, y2, w1, h1, w2, h2, 2, _flags.isDemo && _flags.platform != Common::kPlatformPC98 ? 0 : 8, 0); if (!_flags.isDemo && _flags.platform != Common::kPlatformPC98) _screen->checkedPageUpdate(8, 4); @@ -2584,13 +2587,13 @@ int LoLEngine::tlol_playSoundEffect(const TIM *tim, const uint16 *param) { int LoLEngine::tlol_startBackgroundAnimation(const TIM *tim, const uint16 *param) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_startBackgroundAnimation(%p, %p) (%d, %d)", (const void *)tim, (const void *)param, param[0], param[1]); - _animator->start(param[0], param[1]); + _tim->animator()->start(param[0], param[1]); return 1; } int LoLEngine::tlol_stopBackgroundAnimation(const TIM *tim, const uint16 *param) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_stopBackgroundAnimation(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]); - _animator->stop(param[0]); + _tim->animator()->stop(param[0]); return 1; } @@ -2674,12 +2677,12 @@ int LoLEngine::tlol_displayAnimFrame(const TIM *tim, const uint16 *param) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_displayAnimFrame(%p, %p) (%d, %d)", (const void *)tim, (const void *)param, param[0], param[1]); const int animIndex = tim->wsa[param[0]].anim - 1; - const Movie *wsa = _animator->getWsaCPtr(animIndex); + const Movie *wsa = _tim->animator()->getWsaCPtr(animIndex); if (param[1] == 0xFFFF) { _screen->copyRegion(0, 0, 0, 0, 320, 200, 0, 2, Screen::CR_NO_P_CHECK); } else { - _animator->displayFrame(animIndex, 2, param[1], 0); + _tim->animator()->displayFrame(animIndex, 2, param[1], 0); _screen->copyRegion(wsa->xAdd(), wsa->yAdd(), wsa->xAdd(), wsa->yAdd(), wsa->width(), wsa->height(), 2, 0); } diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index d11403ad9f..9a47016f2b 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -202,8 +202,7 @@ void LoLEngine::setupPrologueData(bool load) { void LoLEngine::showIntro() { _tim = new TIMInterpreter(this, _screen, _system); assert(_tim); - _animator = _tim->animator(); - + if (_flags.platform == Common::kPlatformPC98) showStarcraftLogo(); @@ -262,7 +261,6 @@ void LoLEngine::showIntro() { delete _tim; _tim = 0; - _animator = 0; _screen->fadePalette(_screen->getPalette(1), 30, 0); } @@ -270,7 +268,6 @@ void LoLEngine::showIntro() { int LoLEngine::chooseCharacter() { _tim = new TIMInterpreter(this, _screen, _system); assert(_tim); - _animator = _tim->animator(); _tim->setLangData("LOLINTRO.DIP"); @@ -387,7 +384,6 @@ int LoLEngine::chooseCharacter() { delete _tim; _tim = 0; - _animator = 0; return _charSelection; } @@ -1061,7 +1057,6 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) { setupEpilogueData(true); TIMInterpreter *timBackUp = _tim; _tim = new TIMInterpreter(this, _screen, _system); - _animator = _tim->animator(); _screen->getPalette(0).clear(); _screen->setScreenPalette(_screen->getPalette(0)); @@ -1117,47 +1112,49 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) { _screen->fadeToBlack(30); - showCredits(); + if (!shouldQuit()) + showCredits(); _eventList.clear(); + + if (!shouldQuit()) { + switch (character) { + case 0: + _screen->loadBitmap("KIERAN.CPS", 3, 3, &_screen->getPalette(0)); + break; - switch (character) { - case 0: - _screen->loadBitmap("KIERAN.CPS", 3, 3, &_screen->getPalette(0)); - break; - - case 1: - _screen->loadBitmap("AK'SHEL.CPS", 3, 3, &_screen->getPalette(0)); - break; + case 1: + _screen->loadBitmap("AK'SHEL.CPS", 3, 3, &_screen->getPalette(0)); + break; - case 2: - _screen->loadBitmap("MICHAEL.CPS", 3, 3, &_screen->getPalette(0)); - break; + case 2: + _screen->loadBitmap("MICHAEL.CPS", 3, 3, &_screen->getPalette(0)); + break; - case 3: - _screen->loadBitmap("CONRAD.CPS", 3, 3, &_screen->getPalette(0)); - break; + case 3: + _screen->loadBitmap("CONRAD.CPS", 3, 3, &_screen->getPalette(0)); + break; - default: - _screen->clearPage(3); - _screen->getPalette(0).clear(); - } + default: + _screen->clearPage(3); + _screen->getPalette(0).clear(); + } - _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK); - if (maxDifficulty && !_flags.use16ColorMode) - _tim->displayText(0x8000, 0, 0xDC); - _screen->updateScreen(); - _screen->fadePalette(_screen->getPalette(0), 30, 0); + _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK); + if (maxDifficulty && !_flags.use16ColorMode) + _tim->displayText(0x8000, 0, 0xDC); + _screen->updateScreen(); + _screen->fadePalette(_screen->getPalette(0), 30, 0); - while (!checkInput(0) && !shouldQuit()) - delay(_tickLength); + while (!checkInput(0) && !shouldQuit()) + delay(_tickLength); - _screen->fadeToBlack(30); + _screen->fadeToBlack(30); + } _tim->clearLangData(); delete _tim; _tim = timBackUp; - _animator = 0; setupEpilogueData(false); } @@ -1245,7 +1242,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) { int curShapeFile = 0; uint8 *shapes[12]; - memset(&shapes, 0, sizeof(shapes)); + memset(shapes, 0, sizeof(shapes)); loadOutroShapes(curShapeFile++, shapes); uint8 *monsterPal = 0; |