diff options
author | Strangerke | 2013-02-04 08:06:50 +0100 |
---|---|---|
committer | Strangerke | 2013-02-04 08:07:44 +0100 |
commit | 013bbbbad43d1a0b9c230bc84aaba620dc20e374 (patch) | |
tree | 9d5b0f1504e07f046d06b7151ab7263e748c60e6 | |
parent | 2396316201685a996cf0ff43b03b0951f46472a8 (diff) | |
download | scummvm-rg350-013bbbbad43d1a0b9c230bc84aaba620dc20e374.tar.gz scummvm-rg350-013bbbbad43d1a0b9c230bc84aaba620dc20e374.tar.bz2 scummvm-rg350-013bbbbad43d1a0b9c230bc84aaba620dc20e374.zip |
HOPKINS: Start refactoring playSequence2. Remove 4 labels and the associated GOTOs
-rw-r--r-- | engines/hopkins/anim.cpp | 114 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 2 |
2 files changed, 50 insertions, 66 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index 73f3a00b50..7b8d296624 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -769,11 +769,10 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui * Play Sequence type 2 */ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3) { - bool v4; byte *screenCopy = NULL; byte *screenP; byte *v11 = NULL; - int v13; + int frameNumber; size_t nbytes; Common::File f; @@ -825,78 +824,63 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u _vm->_eventsManager._rateCounter = 0; _vm->_eventsManager._escKeyFl = false; _vm->_soundManager.loadAnimSound(); - if (_vm->_globals.iRegul != 1) - break; - while (!_vm->shouldQuit()) { - if (_vm->_eventsManager._escKeyFl) - goto LABEL_54; - _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate1) - goto LABEL_23; + if (_vm->_globals.iRegul == 1) { + do { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + } while (!_vm->shouldQuit() && !_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate1); } - if (_vm->_graphicsManager._skipVideoLockFl) - goto LABEL_54; - if (multiScreenFl) - screenCopy = _vm->_globals.freeMemory(screenCopy); - _vm->_globals.freeMemory(v11); - f.close(); - } -LABEL_23: - _vm->_eventsManager._rateCounter = 0; - v4 = false; - v13 = 0; - while (!_vm->shouldQuit()) { - _vm->_soundManager.playAnimSound(v13++); - - memset(v11, 0, 19); - if (f.read(v11, 16) != 16) - v4 = true; - - if (strncmp((const char *)v11, "IMAGE=", 6)) - v4 = true; - if (v4) - goto LABEL_44; - f.read(screenP, READ_LE_UINT32(v11 + 8)); - if (_vm->_globals.iRegul == 1) - break; -LABEL_33: + break; + } + + if (!_vm->_eventsManager._escKeyFl) { _vm->_eventsManager._rateCounter = 0; - _vm->_graphicsManager.lockScreen(); - if (multiScreenFl) { - if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); - _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - } - } else if (*screenP != kByteStop) { - _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); - } - _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.DD_VBL(); - _vm->_soundManager.checkSoundEnd(); -LABEL_44: - if (v4) { + frameNumber = 0; + while (!_vm->shouldQuit()) { + _vm->_soundManager.playAnimSound(frameNumber++); + + memset(v11, 0, 19); + if (f.read(v11, 16) != 16) + break; + + if (strncmp((const char *)v11, "IMAGE=", 6)) + break; + + f.read(screenP, READ_LE_UINT32(v11 + 8)); if (_vm->_globals.iRegul == 1) { - while (!_vm->_eventsManager._escKeyFl) { + do { _vm->_eventsManager.refreshEvents(); - _vm->_soundManager.checkSoundEnd(); - if (_vm->_eventsManager._rateCounter >= rate3) { - _vm->_eventsManager._rateCounter = 0; - break; - } + } while (!_vm->shouldQuit() && !_vm->_eventsManager._escKeyFl && _vm->_eventsManager._rateCounter < rate2); + } + + _vm->_eventsManager._rateCounter = 0; + _vm->_graphicsManager.lockScreen(); + if (multiScreenFl) { + if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_WinScan_Vbe(screenP, screenCopy); + _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } - } else { - _vm->_eventsManager._rateCounter = 0; + } else if (*screenP != kByteStop) { + _vm->_graphicsManager.Copy_Video_Vbe16a(screenP); } - goto LABEL_54; + _vm->_graphicsManager.unlockScreen(); + _vm->_graphicsManager.DD_VBL(); + _vm->_soundManager.checkSoundEnd(); } } - while (!_vm->_eventsManager._escKeyFl) { - _vm->_eventsManager.refreshEvents(); - if (_vm->_eventsManager._rateCounter >= rate2) - goto LABEL_33; + + if (_vm->_globals.iRegul == 1) { + while (!_vm->_eventsManager._escKeyFl) { + _vm->_eventsManager.refreshEvents(); + _vm->_soundManager.checkSoundEnd(); + if (_vm->_eventsManager._rateCounter < rate3) { + break; + } + } } -LABEL_54: + + _vm->_eventsManager._rateCounter = 0; + if (_vm->_graphicsManager.FADE_LINUX == 2 && !multiScreenFl) { byte *ptra = _vm->_globals.allocMemory(307200); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 5d85afa548..dcff7f2615 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -758,7 +758,7 @@ bool HopkinsEngine::runFull() { _globals._helicopterFl = false; _eventsManager.mouseOff(); // No code has been added to display the version as it's wrong - // in my copy: it mentions a Win95 version v4 using DirectDraw + // in my copy: it mentions a Win95 version v4 using DirectDraw (Strangerke) } else if (getPlatform() == Common::kPlatformWindows) { _globals._helicopterFl = false; _globals.iRegul = 1; |