Ticket #8334: BS_cutscene_frameskip.diff

File BS_cutscene_frameskip.diff, 4.6 KB (added by SF/arisme, 20 years ago)

Patch based on 02/30 branch

  • sword1/animation.h

    RCS file: /cvsroot/scummvm/scummvm/sword1/animation.h,v
    retrieving revision 1.5.2.1
    diff -u -r1.5.2.1 animation.h
     
    7777        OSystem *_sys;
    7878
    7979        uint framenum;
     80        uint frameskipped;
    8081        uint32 ticks;
    8182
    8283#ifdef USE_MPEG2
  • sword1/animation.cpp

    RCS file: /cvsroot/scummvm/scummvm/sword1/animation.cpp,v
    retrieving revision 1.10.2.4
    diff -u -r1.10.2.4 animation.cpp
     
    134134
    135135        info = mpeg2_info(decoder);
    136136        framenum = 0;
     137        frameskipped = 0;
    137138        ticks = _sys->get_msecs();
    138139
    139140        /* Play audio - TODO: Sync with video?*/
     
    324325
    325326#ifdef BACKEND_8BIT
    326327                                if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
    327                                     ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
     328                                    ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
     329                                        if (frameskipped > 10) {
     330                                                warning("force frame %i redraw", framenum);
     331                                                frameskipped = 0;
     332                                        }
    328333                                        _scr->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
    329334
    330335                                        if (bgSoundStream) {
    (this hunk was shorter than expected)  
    336341                                                        _sys->delay_msecs(10);
    337342                                        }
    338343
    339                                 } else
     344                                } else {
    340345                                        warning("dropped frame %i", framenum);
     346                                        frameskipped++;
     347                                }
    341348
    342349                                buildLookup(palnum + 1, lutcalcnum);
    343350
    344351#else
    345352
    346                                 if ((bgSoundStream == NULL) || ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
     353                                if ((bgSoundStream == NULL) || ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
     354                                        if (frameskipped > 10) {
     355                                                warning("force frame %i redraw", framenum);
     356                                                frameskipped = 0;
     357                                        }
    347358                                        plotYUV(lookup, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
    348359
    349360                                        if (bgSoundStream) {
     
    355367                                                        _sys->delay_msecs(10);
    356368                                        }
    357369
    358                                 } else
     370                                } else {
    359371                                        warning("dropped frame %i", framenum);
     372                                        frameskipped++;
     373                                }
    360374
    361375#endif
    362376
  • sword2/driver/animation.h

    RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.h,v
    retrieving revision 1.18.2.2
    diff -u -r1.18.2.2 animation.h
     
    7171        Sword2Engine *_vm;
    7272
    7373        uint framenum;
     74        uint frameskipped;
    7475        int ticks;
    7576
    7677#ifdef USE_MPEG2
  • sword2/driver/animation.cpp

    RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.cpp,v
    retrieving revision 1.21.2.5
    diff -u -r1.21.2.5 animation.cpp
     
    140140
    141141        info = mpeg2_info(decoder);
    142142        framenum = 0;
     143        frameskipped = 0;
    143144        ticks = _vm->_system->get_msecs();
    144145
    145146        // Play audio
     
    368369
    369370#ifdef BACKEND_8BIT
    370371                                if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
    371                                         ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
    372 
     372                                        ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {
     373                                        if (frameskipped > 10) {
     374                                                warning("force frame %i redraw", framenum);
     375                                                frameskipped = 0;
     376                                        }
    373377                                        _vm->_graphics->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
    374378
    375379                                        if (bgSoundStream) {
     
    382386
    383387                                        _vm->_graphics->setNeedFullRedraw();
    384388
    385                                 } else
     389                                } else {
    386390                                        warning("dropped frame %i", framenum);
     391                                        frameskipped++;
     392                                }
    387393
    388394                                buildLookup(palnum + 1, lutcalcnum);
    389395
    390396#else
    391397
    392398                                if ((bgSoundStream == NULL) ||
    393                                         ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) {
    394 
     399                                        ((_vm->_mixer->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1) || frameskipped > 10) {                                     
     400                                        if (frameskipped > 10) {
     401                                                warning("force frame %i redraw", framenum);
     402                                                frameskipped = 0;
     403                                        }
    395404                                        plotYUV(lookup, sequence_i->width, sequence_i->height, info->display_fbuf->buf);
    396405
    397406                                        if (bgSoundStream) {
     
    402411                                                _vm->sleepUntil(ticks);
    403412                                        }
    404413
    405                                 } else
     414                                } else {
    406415                                        warning("dropped frame %i", framenum);
     416                                        frameskipped++;
     417                                }
    407418
    408419#endif
    409420