Ticket #2883: smush.diff
File smush.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" … … 221 220 return sr; 222 221 } 223 222 224 void SmushPlayer::timerCallback(void *refCon) { 225 SmushPlayer *sp = (SmushPlayer *)refCon; 226 sp->parseNextFrame(); 223 void SmushPlayer::timerCallback() { 224 parseNextFrame(); 227 225 #ifdef _WIN32_WCE 228 sp->_inTimer = true;229 sp->_inTimerCount++;226 _inTimer = true; 227 _inTimerCount++; 230 228 #endif 231 229 #ifdef __SYMBIAN32__ 232 230 if (sp->_closeOnTextTick) { … … 269 267 _skipPalette = false; 270 268 _IACTstream = NULL; 271 269 _smixer = _vm->_smixer; 270 _paused = false; 271 _pauseStartTime = 0; 272 _pauseTime = 0; 272 273 #ifdef _WIN32_WCE 273 274 _inTimer = false; 274 275 _inTimerCount = 0; … … 309 310 _vm->_mixer->stopHandle(_IACTchannel); 310 311 _vm->_smixer->stop(); 311 312 312 _vm->_timer->installTimerProc(&timerCallback, 1000000 / _speed, this);313 314 313 _initDone = true; 315 314 } 316 315 … … 324 323 User::After(15624); 325 324 } 326 325 #endif 327 _vm->_timer->removeTimerProc(&timerCallback);328 326 329 327 _vm->_smushVideoShouldFinish = true; 330 328 … … 1077 1075 1078 1076 Chunk *sub; 1079 1077 1080 if (_vm->_smushPaused)1081 return;1082 1083 1078 if (_seekPos >= 0) { 1084 1079 if (_smixer) 1085 1080 _smixer->stop(); … … 1276 1271 #endif 1277 1272 } 1278 1273 1274 void SmushPlayer::pause() { 1275 if (!_paused) { 1276 _paused = true; 1277 _pauseStartTime = _vm->_system->getMillis(); 1278 } 1279 } 1280 1281 void SmushPlayer::unpause() { 1282 if (_paused) { 1283 _paused = false; 1284 _pauseTime += (_vm->_system->getMillis() - _pauseStartTime); 1285 _pauseStartTime = 0; 1286 } 1287 } 1288 1279 1289 void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 startFrame) { 1280 1290 1281 1291 // Verify the specified file exists … … 1304 1314 setupAnim(filename); 1305 1315 init(speed); 1306 1316 1317 uint32 startTime = _vm->_system->getMillis(); 1318 1319 _pauseTime = 0; 1320 uint frameNo = 0; 1321 1307 1322 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 1308 1333 if (_warpNeeded) { 1309 1334 _vm->_system->warpMouse(_warpX, _warpY); 1310 1335 _warpNeeded = false; … … 1347 1372 _inTimer = false; 1348 1373 _inTimerCount = 0; 1349 1374 #endif 1375 frameNo++; 1350 1376 } 1351 1377 if (_endOfFile) 1352 1378 break; -
engines/scumm/smush/smush_player.h
98 98 SmushPlayer(ScummEngine_v7 *scumm); 99 99 ~SmushPlayer(); 100 100 101 void pause(); 102 void unpause(); 103 101 104 void play(const char *filename, int32 speed, int32 offset = 0, int32 startFrame = 0); 102 105 void release(); 103 106 void warpMouse(int x, int y, int buttons); … … 107 110 int _width, _height; 108 111 109 112 int _origPitch, _origNumStrips; 113 bool _paused; 114 uint32 _pauseStartTime; 115 uint32 _pauseTime; 110 116 111 117 void insanity(bool); 112 118 void setPalette(const byte *palette); … … 140 146 void handleDeltaPalette(Chunk &); 141 147 void readPalette(byte *, Chunk &); 142 148 143 static void timerCallback(void *ptr);149 void timerCallback(); 144 150 }; 145 151 146 152 } // End of namespace Scumm