Ticket #2883: smush.diff

File smush.diff, 4.5 KB (added by eriktorbjorn, 17 years ago)

Patch against current SVN

  • engines/scumm/intern.h

     
    589589         */
    590590        bool _smushVideoShouldFinish;
    591591
    592         /** This flag is a hack to allow the pause dialog to pause SMUSH playback, too. */
    593         bool _smushPaused;
    594 
    595592        bool _smushActive;
    596593
    597594        Insane *_insane;
  • engines/scumm/scumm.cpp

     
    773773
    774774        _smushFrameRate = 0;
    775775        _smushVideoShouldFinish = false;
    776         _smushPaused = false;
    777776        _smushActive = false;
    778777        _insaneRunning = false;
    779778        _smixer = NULL;
     
    20982097
    20992098#ifndef DISABLE_SCUMM_7_8
    21002099int ScummEngine_v7::runDialog(Dialog &dialog) {
    2101         bool oldSmushPaused = _smushPaused;
    2102         _smushPaused = true;
    2103 
     2100        _splayer->pause();
    21042101        int result = ScummEngine::runDialog(dialog);
    2105 
    2106         _smushPaused = oldSmushPaused;
    2107 
     2102        _splayer->unpause();
    21082103        return result;
    21092104}
    21102105#endif
  • engines/scumm/smush/smush_player.cpp

     
    2727#include "common/config-manager.h"
    2828#include "common/file.h"
    2929#include "common/system.h"
    30 #include "common/timer.h"
    3130#include "common/util.h"
    3231
    3332#include "graphics/cursorman.h"
     
    221220        return sr;
    222221}
    223222
    224 void SmushPlayer::timerCallback(void *refCon) {
    225         SmushPlayer *sp = (SmushPlayer *)refCon;
    226         sp->parseNextFrame();
     223void SmushPlayer::timerCallback() {
     224        parseNextFrame();
    227225#ifdef _WIN32_WCE
    228         sp->_inTimer = true;
    229         sp->_inTimerCount++;
     226        _inTimer = true;
     227        _inTimerCount++;
    230228#endif
    231229#ifdef __SYMBIAN32__
    232230        if (sp->_closeOnTextTick) {
     
    269267        _skipPalette = false;
    270268        _IACTstream = NULL;
    271269        _smixer = _vm->_smixer;
     270        _paused = false;
     271        _pauseStartTime = 0;
     272        _pauseTime = 0;
    272273#ifdef _WIN32_WCE
    273274        _inTimer = false;
    274275        _inTimerCount = 0;
     
    309310        _vm->_mixer->stopHandle(_IACTchannel);
    310311        _vm->_smixer->stop();
    311312
    312         _vm->_timer->installTimerProc(&timerCallback, 1000000 / _speed, this);
    313 
    314313        _initDone = true;
    315314}
    316315
     
    324323                User::After(15624);
    325324        }
    326325#endif
    327         _vm->_timer->removeTimerProc(&timerCallback);
    328326
    329327        _vm->_smushVideoShouldFinish = true;
    330328
     
    10771075
    10781076        Chunk *sub;
    10791077
    1080         if (_vm->_smushPaused)
    1081                 return;
    1082 
    10831078        if (_seekPos >= 0) {
    10841079                if (_smixer)
    10851080                        _smixer->stop();
     
    12761271#endif
    12771272}
    12781273
     1274void SmushPlayer::pause() {
     1275        if (!_paused) {
     1276                _paused = true;
     1277                _pauseStartTime = _vm->_system->getMillis();
     1278        }
     1279}
     1280
     1281void SmushPlayer::unpause() {
     1282        if (_paused) {
     1283                _paused = false;
     1284                _pauseTime += (_vm->_system->getMillis() - _pauseStartTime);
     1285                _pauseStartTime = 0;
     1286        }
     1287}
     1288
    12791289void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 startFrame) {
    12801290
    12811291        // Verify the specified file exists
     
    13041314        setupAnim(filename);
    13051315        init(speed);
    13061316
     1317        uint32 startTime = _vm->_system->getMillis();
     1318
     1319        _pauseTime = 0;
     1320        uint frameNo = 0;
     1321
    13071322        for (;;) {
     1323                uint32 now = _vm->_system->getMillis() - _pauseTime;
     1324                uint32 elapsed = now - startTime;
     1325
     1326                // TODO: Sync to elapsed sound playing time, if possible.
     1327                // TODO: Frame skipping. (Decode, but don't update screen.)
     1328
     1329                if (elapsed >= startTime + (frameNo * 1000) / _speed) {
     1330                        timerCallback();
     1331                }
     1332
    13081333                if (_warpNeeded) {
    13091334                        _vm->_system->warpMouse(_warpX, _warpY);
    13101335                        _warpNeeded = false;
     
    13471372                        _inTimer = false;
    13481373                        _inTimerCount = 0;
    13491374#endif
     1375                        frameNo++;
    13501376                }
    13511377                if (_endOfFile)
    13521378                        break;
  • engines/scumm/smush/smush_player.h

     
    9898        SmushPlayer(ScummEngine_v7 *scumm);
    9999        ~SmushPlayer();
    100100
     101        void pause();
     102        void unpause();
     103
    101104        void play(const char *filename, int32 speed, int32 offset = 0, int32 startFrame = 0);
    102105        void release();
    103106        void warpMouse(int x, int y, int buttons);
     
    107110        int _width, _height;
    108111
    109112        int _origPitch, _origNumStrips;
     113        bool _paused;
     114        uint32 _pauseStartTime;
     115        uint32 _pauseTime;
    110116
    111117        void insanity(bool);
    112118        void setPalette(const byte *palette);
     
    140146        void handleDeltaPalette(Chunk &);
    141147        void readPalette(byte *, Chunk &);
    142148
    143         static void timerCallback(void *ptr);
     149        void timerCallback();
    144150};
    145151
    146152} // End of namespace Scumm