Ticket #8333: bs-rebuild.diff

File bs-rebuild.diff, 4.8 KB (added by eriktorbjorn, 20 years ago)

Patch against a February 28 CVS branch snapshot

  • sword1/animation.cpp

    diff -ur ScummVM-0.6.0-cvs20040228/sword1/animation.cpp ScummVM-0.6.0-cvs20040228+hack/sword1/animation.cpp
    old new  
    233233
    234234NewGuiColor *AnimationState::lookup = 0;
    235235
     236void AnimationState::invalidateLookup() {
     237        // The screen has changed; the lookup table may be obsolete
     238        // TODO: Add heuristic to determine if the table really needs to be
     239        // rebuilt.
     240        free(lookup);
     241        lookup = 0;
     242        buildLookup();
     243}
     244
    236245void AnimationState::buildLookup() {
    237246        if (lookup)
    238247                return;
     
    390399#ifndef BACKEND_8BIT
    391400                        _sys->update_screen();
    392401#endif
    393                         // FIXME: check for ESC and abbort animation be just returning from the function
     402                        // FIXME: check for ESC and abort animation be just returning from the function
    394403                        OSystem::Event event;
    395404                        while (_sys->poll_event(&event)) {
    396                                 if ((event.event_code == OSystem::EVENT_KEYDOWN) &&
    397                                     (event.kbd.keycode == 27)) {
    398                                         delete anim;
    399                                         return;
    400                                 }
    401                                 if (event.event_code == OSystem::EVENT_QUIT)
     405                                switch (event.event_code) {
     406#ifndef BACKEND_8BIT
     407                                case OSystem::EVENT_SCREEN_CHANGED:
     408                                        anim->invalidateLookup();
     409                                        break;
     410#endif
     411                                case OSystem::EVENT_KEYDOWN:
     412                                        if (event.kbd.keycode == 27) {
     413                                                delete anim;
     414                                                return;
     415                                        }
     416                                        break;
     417                                case OSystem::EVENT_QUIT:
    402418                                        _sys->quit();
     419                                        break;
     420                                default:
     421                                        break;
     422                                }
    403423                        }
    404424                }
    405425        }
  • sword1/animation.h

    diff -ur ScummVM-0.6.0-cvs20040228/sword1/animation.h ScummVM-0.6.0-cvs20040228+hack/sword1/animation.h
    old new  
    123123        bool init(const char *name);
    124124        bool decodeFrame();
    125125
     126#ifndef BACKEND_8BIT
     127        void invalidateLookup(void);
     128#endif
     129
    126130private:
    127131
    128132#ifdef BACKEND_8BIT
  • sword2/driver/animation.cpp

    diff -ur ScummVM-0.6.0-cvs20040228/sword2/driver/animation.cpp ScummVM-0.6.0-cvs20040228+hack/sword2/driver/animation.cpp
    old new  
    240240
    241241NewGuiColor *AnimationState::lookup = 0;
    242242
     243void AnimationState::invalidateLookup() {
     244        // TODO: Add heuristic to check if rebuilding the lookup table is
     245        // actually necessary. If the screen format remains the same, then the
     246        // current lookup table should be fine.
     247        free(lookup);
     248        lookup = 0;
     249        buildLookup();
     250}
     251
    243252void AnimationState::buildLookup() {
    244253        if (lookup)
    245254                return;
     
    515524        if (i == ARRAYSIZE(_movies))
    516525                warning("Unknown movie, '%s'", filename);
    517526
    518         while (anim->decodeFrame()) {
     527        while (!skipCutscene && anim->decodeFrame()) {
    519528                if (text && text[textCounter]) {
    520529                        if (frameCounter == text[textCounter]->startFrame) {
    521530                                openTextObject(text[textCounter]);
     
    545554                if (frameCounter == leadOutFrame && musicOut)
    546555                        _vm->_sound->playFx(0, musicOut, 0, 0, RDSE_FXLEADOUT);
    547556
    548 #ifdef BACKEND_8BIT
    549                 _vm->_graphics->updateDisplay(true);
    550 #else
     557#ifndef BACKEND_8BIT
    551558                anim->updateDisplay();
    552                 _vm->_graphics->updateDisplay(false);
    553559#endif
    554560
    555                 KeyboardEvent ke;
     561                _vm->_system->update_screen();
    556562
    557                 if ((_vm->_input->readKey(&ke) == RD_OK && ke.keycode == 27) || _vm->_quit) {
    558                         _vm->_mixer->stopHandle(handle);
    559                         skipCutscene = true;
    560                         break;
     563                OSystem::Event event;
     564                while (_vm->_system->poll_event(&event)) {
     565                        switch (event.event_code) {
     566#ifndef BACKEND_8BIT
     567                        case OSystem::EVENT_SCREEN_CHANGED:
     568                                anim->invalidateLookup();
     569                                break;
     570#endif
     571                        case OSystem::EVENT_KEYDOWN:
     572                                if (event.kbd.keycode == 27)
     573                                        skipCutscene = true;
     574                                break;
     575                        case OSystem::EVENT_QUIT:
     576                                _vm->closeGame();
     577                                skipCutscene = true;
     578                                break;
     579                        default:
     580                                break;
     581                        }
    561582                }
    562 
    563583        }
    564584
    565585        if (!skipCutscene) {
    566586                // Sleep for one frame so that the last frame is displayed.
    567587                _vm->_system->delay_msecs(1000 / 12);
    568         }
     588        } else
     589                _vm->_mixer->stopHandle(handle);
    569590
    570591#ifndef BACKEND_8BIT
    571592        // Most movies fade to black on their own, but not all of them. Since
     
    590611#ifndef BACKEND_8BIT
    591612        anim->updateDisplay();
    592613#else
    593         _vm->_graphics->updateDisplay(true);
     614        _vm->_graphics->updateDisplay();
    594615#endif
    595616
    596617        // Wait for the voice to stop playing. This is to make sure
  • sword2/driver/animation.h

    diff -ur ScummVM-0.6.0-cvs20040228/sword2/driver/animation.h ScummVM-0.6.0-cvs20040228+hack/sword2/driver/animation.h
    old new  
    121121        void drawTextObject(SpriteInfo *s, uint8 *src);
    122122        void clearDisplay();
    123123        void updateDisplay(void);
     124        void invalidateLookup();
    124125#endif
    125126
    126127private: