Ticket #2883: smush2.diff
File smush2.diff, 4.5 KB (added by , 17 years ago) |
---|
-
engines/scumm/intern.h
589 589 */ 590 590 bool _smushVideoShouldFinish; 591 591 592 /** This flag is a hack to allow the pause dialog to pause SMUSH playback, too. */593 bool _smushPaused;594 595 592 bool _smushActive; 596 593 597 594 Insane *_insane; -
engines/scumm/scumm.cpp
773 773 774 774 _smushFrameRate = 0; 775 775 _smushVideoShouldFinish = false; 776 _smushPaused = false;777 776 _smushActive = false; 778 777 _insaneRunning = false; 779 778 _smixer = NULL; … … 2098 2097 2099 2098 #ifndef DISABLE_SCUMM_7_8 2100 2099 int ScummEngine_v7::runDialog(Dialog &dialog) { 2101 bool oldSmushPaused = _smushPaused; 2102 _smushPaused = true; 2103 2100 _splayer->pause(); 2104 2101 int result = ScummEngine::runDialog(dialog); 2105 2106 _smushPaused = oldSmushPaused; 2107 2102 _splayer->unpause(); 2108 2103 return result; 2109 2104 } 2110 2105 #endif -
engines/scumm/smush/smush_player.cpp
27 27 #include "common/config-manager.h" 28 28 #include "common/file.h" 29 29 #include "common/system.h" 30 #include "common/timer.h"31 30 #include "common/util.h" 32 31 33 32 #include "graphics/cursorman.h" … … 220 219 return sr; 221 220 } 222 221 223 void SmushPlayer::timerCallback(void *refCon) { 224 SmushPlayer *sp = (SmushPlayer *)refCon; 225 sp->parseNextFrame(); 222 void SmushPlayer::timerCallback() { 223 parseNextFrame(); 226 224 #ifdef _WIN32_WCE 227 sp->_inTimer = true;228 sp->_inTimerCount++;225 _inTimer = true; 226 _inTimerCount++; 229 227 #endif 230 228 #ifdef __SYMBIAN32__ 231 229 if (sp->_closeOnTextTick) { … … 267 265 _skipPalette = false; 268 266 _IACTstream = NULL; 269 267 _smixer = _vm->_smixer; 268 _paused = false; 269 _pauseStartTime = 0; 270 _pauseTime = 0; 270 271 #ifdef _WIN32_WCE 271 272 _inTimer = false; 272 273 _inTimerCount = 0; … … 307 308 _vm->_mixer->stopHandle(_IACTchannel); 308 309 _vm->_smixer->stop(); 309 310 310 _vm->_timer->installTimerProc(&timerCallback, 1000000 / _speed, this);311 312 311 _initDone = true; 313 312 } 314 313 … … 322 321 User::After(15624); 323 322 } 324 323 #endif 325 _vm->_timer->removeTimerProc(&timerCallback);326 324 327 325 _vm->_smushVideoShouldFinish = true; 328 326 … … 1075 1073 1076 1074 Chunk *sub; 1077 1075 1078 if (_vm->_smushPaused)1079 return;1080 1081 1076 if (_seekPos >= 0) { 1082 1077 if (_smixer) 1083 1078 _smixer->stop(); … … 1274 1269 #endif 1275 1270 } 1276 1271 1272 void SmushPlayer::pause() { 1273 if (!_paused) { 1274 _paused = true; 1275 _pauseStartTime = _vm->_system->getMillis(); 1276 } 1277 } 1278 1279 void SmushPlayer::unpause() { 1280 if (_paused) { 1281 _paused = false; 1282 _pauseTime += (_vm->_system->getMillis() - _pauseStartTime); 1283 _pauseStartTime = 0; 1284 } 1285 } 1286 1277 1287 void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 startFrame) { 1278 1279 1288 // Verify the specified file exists 1280 1289 ScummFile f; 1281 1290 _vm->openFile(f, filename); … … 1302 1311 setupAnim(filename); 1303 1312 init(speed); 1304 1313 1314 uint32 startTime = _vm->_system->getMillis(); 1315 1316 _pauseTime = 0; 1317 uint frameNo = 0; 1318 1305 1319 for (;;) { 1320 uint32 now = _vm->_system->getMillis() - _pauseTime; 1321 uint32 elapsed = now - startTime; 1322 1323 // TODO: Sync to elapsed sound playing time, if possible. 1324 // TODO: Frame skipping. (Decode, but don't update screen.) 1325 1326 if (elapsed >= (frameNo * 1000) / _speed) { 1327 timerCallback(); 1328 } 1329 1306 1330 if (_warpNeeded) { 1307 1331 _vm->_system->warpMouse(_warpX, _warpY); 1308 1332 _warpNeeded = false; … … 1345 1369 _inTimer = false; 1346 1370 _inTimerCount = 0; 1347 1371 #endif 1372 frameNo++; 1348 1373 } 1349 1374 if (_endOfFile) 1350 1375 break; -
engines/scumm/smush/smush_player.h
97 97 SmushPlayer(ScummEngine_v7 *scumm); 98 98 ~SmushPlayer(); 99 99 100 void pause(); 101 void unpause(); 102 100 103 void play(const char *filename, int32 speed, int32 offset = 0, int32 startFrame = 0); 101 104 void release(); 102 105 void warpMouse(int x, int y, int buttons); … … 106 109 int _width, _height; 107 110 108 111 int _origPitch, _origNumStrips; 112 bool _paused; 113 uint32 _pauseStartTime; 114 uint32 _pauseTime; 109 115 110 116 void insanity(bool); 111 117 void setPalette(const byte *palette); … … 139 145 void handleDeltaPalette(Chunk &); 140 146 void readPalette(byte *, Chunk &); 141 147 142 static void timerCallback(void *ptr);148 void timerCallback(); 143 149 }; 144 150 145 151 } // End of namespace Scumm