diff -ur residual-cvs20050812/engine.cpp residual-cvs20050812+smush/engine.cpp
old
|
new
|
|
135 | 135 | unsigned int frameCounter = 0; |
136 | 136 | unsigned int timeAccum = 0; |
137 | 137 | unsigned int frameTimeCollection = 0; |
| 138 | int prevSmushFrame = 0; |
138 | 139 | char fps[8] = ""; |
139 | 140 | _savegameLoadRequest = false; |
140 | 141 | _savegameSaveRequest = false; |
… |
… |
|
230 | 231 | // Run asynchronous tasks |
231 | 232 | lua_runtasks(); |
232 | 233 | |
| 234 | bool doFlip = true; |
| 235 | |
233 | 236 | if (_mode == ENGINE_MODE_SMUSH) { |
234 | 237 | if (g_smush->isPlaying()) { |
235 | 238 | _movieTime = g_smush->getMovieTime(); |
… |
… |
|
237 | 240 | g_driver->prepareSmushFrame(g_smush->getWidth(), g_smush->getHeight(), g_smush->getDstPtr()); |
238 | 241 | g_smush->clearUpdateNeeded(); |
239 | 242 | } |
240 | | if (g_smush->getFrame() > 0) { |
241 | | g_driver->drawSmushFrame(g_smush->getX(), g_smush->getY()); |
242 | | if (SHOWFPS_GLOBAL) |
243 | | g_driver->drawEmergString(550, 25, fps, Color(255, 255, 255)); |
| 243 | int frame = g_smush->getFrame(); |
| 244 | if (frame > 0) { |
| 245 | if (frame != prevSmushFrame) { |
| 246 | prevSmushFrame = g_smush->getFrame(); |
| 247 | g_driver->drawSmushFrame(g_smush->getX(), g_smush->getY()); |
| 248 | if (SHOWFPS_GLOBAL) |
| 249 | g_driver->drawEmergString(550, 25, fps, Color(255, 255, 255)); |
| 250 | } else |
| 251 | doFlip = false; |
244 | 252 | } |
245 | 253 | } |
246 | 254 | } else if (_mode == ENGINE_MODE_NORMAL) { |
| 255 | prevSmushFrame = 0; |
247 | 256 | g_driver->clearScreen(); |
248 | 257 | |
249 | 258 | // Update actor costumes & sets |
… |
… |
|
326 | 335 | // Draw Primitives |
327 | 336 | for (PrimitiveListType::iterator i = _primitiveObjects.begin(); i != _primitiveObjects.end(); i++) { |
328 | 337 | (*i)->draw(); |
| 338 | doFlip = true; |
329 | 339 | } |
330 | 340 | |
331 | 341 | // Draw text |
332 | 342 | for (TextListType::iterator i = _textObjects.begin(); i != _textObjects.end(); i++) { |
333 | 343 | (*i)->draw(); |
| 344 | doFlip = true; |
334 | 345 | } |
335 | 346 | |
336 | 347 | g_imuse->flushTracks(); |
337 | 348 | g_imuse->refreshScripts(); |
338 | 349 | |
339 | | g_driver->flipBuffer(); |
| 350 | if (doFlip) |
| 351 | g_driver->flipBuffer(); |
340 | 352 | |
341 | 353 | // don't kill CPU |
342 | 354 | SDL_Delay(1); |
… |
… |
|
360 | 372 | setMovieTime(_movieTime); |
361 | 373 | lua_endblock(); |
362 | 374 | |
363 | | if (SHOWFPS_GLOBAL) { |
| 375 | if (SHOWFPS_GLOBAL && doFlip) { |
364 | 376 | frameCounter++; |
365 | 377 | timeAccum += _frameTime; |
366 | 378 | if (timeAccum > 1000) { |