diff -ur ScummVM-0.6.0-cvs20040228/sword1/animation.cpp ScummVM-0.6.0-cvs20040228+hack/sword1/animation.cpp
old
|
new
|
|
233 | 233 | |
234 | 234 | NewGuiColor *AnimationState::lookup = 0; |
235 | 235 | |
| 236 | void AnimationState::invalidateLookup() { |
| 237 | // The screen has changed; the lookup table may be obsolete |
| 238 | // TODO: Add heuristic to determine if the table really needs to be |
| 239 | // rebuilt. |
| 240 | free(lookup); |
| 241 | lookup = 0; |
| 242 | buildLookup(); |
| 243 | } |
| 244 | |
236 | 245 | void AnimationState::buildLookup() { |
237 | 246 | if (lookup) |
238 | 247 | return; |
… |
… |
|
390 | 399 | #ifndef BACKEND_8BIT |
391 | 400 | _sys->update_screen(); |
392 | 401 | #endif |
393 | | // FIXME: check for ESC and abbort animation be just returning from the function |
| 402 | // FIXME: check for ESC and abort animation be just returning from the function |
394 | 403 | OSystem::Event event; |
395 | 404 | while (_sys->poll_event(&event)) { |
396 | | if ((event.event_code == OSystem::EVENT_KEYDOWN) && |
397 | | (event.kbd.keycode == 27)) { |
398 | | delete anim; |
399 | | return; |
400 | | } |
401 | | if (event.event_code == OSystem::EVENT_QUIT) |
| 405 | switch (event.event_code) { |
| 406 | #ifndef BACKEND_8BIT |
| 407 | case OSystem::EVENT_SCREEN_CHANGED: |
| 408 | anim->invalidateLookup(); |
| 409 | break; |
| 410 | #endif |
| 411 | case OSystem::EVENT_KEYDOWN: |
| 412 | if (event.kbd.keycode == 27) { |
| 413 | delete anim; |
| 414 | return; |
| 415 | } |
| 416 | break; |
| 417 | case OSystem::EVENT_QUIT: |
402 | 418 | _sys->quit(); |
| 419 | break; |
| 420 | default: |
| 421 | break; |
| 422 | } |
403 | 423 | } |
404 | 424 | } |
405 | 425 | } |
diff -ur ScummVM-0.6.0-cvs20040228/sword1/animation.h ScummVM-0.6.0-cvs20040228+hack/sword1/animation.h
old
|
new
|
|
123 | 123 | bool init(const char *name); |
124 | 124 | bool decodeFrame(); |
125 | 125 | |
| 126 | #ifndef BACKEND_8BIT |
| 127 | void invalidateLookup(void); |
| 128 | #endif |
| 129 | |
126 | 130 | private: |
127 | 131 | |
128 | 132 | #ifdef BACKEND_8BIT |
diff -ur ScummVM-0.6.0-cvs20040228/sword2/driver/animation.cpp ScummVM-0.6.0-cvs20040228+hack/sword2/driver/animation.cpp
old
|
new
|
|
240 | 240 | |
241 | 241 | NewGuiColor *AnimationState::lookup = 0; |
242 | 242 | |
| 243 | void AnimationState::invalidateLookup() { |
| 244 | // TODO: Add heuristic to check if rebuilding the lookup table is |
| 245 | // actually necessary. If the screen format remains the same, then the |
| 246 | // current lookup table should be fine. |
| 247 | free(lookup); |
| 248 | lookup = 0; |
| 249 | buildLookup(); |
| 250 | } |
| 251 | |
243 | 252 | void AnimationState::buildLookup() { |
244 | 253 | if (lookup) |
245 | 254 | return; |
… |
… |
|
515 | 524 | if (i == ARRAYSIZE(_movies)) |
516 | 525 | warning("Unknown movie, '%s'", filename); |
517 | 526 | |
518 | | while (anim->decodeFrame()) { |
| 527 | while (!skipCutscene && anim->decodeFrame()) { |
519 | 528 | if (text && text[textCounter]) { |
520 | 529 | if (frameCounter == text[textCounter]->startFrame) { |
521 | 530 | openTextObject(text[textCounter]); |
… |
… |
|
545 | 554 | if (frameCounter == leadOutFrame && musicOut) |
546 | 555 | _vm->_sound->playFx(0, musicOut, 0, 0, RDSE_FXLEADOUT); |
547 | 556 | |
548 | | #ifdef BACKEND_8BIT |
549 | | _vm->_graphics->updateDisplay(true); |
550 | | #else |
| 557 | #ifndef BACKEND_8BIT |
551 | 558 | anim->updateDisplay(); |
552 | | _vm->_graphics->updateDisplay(false); |
553 | 559 | #endif |
554 | 560 | |
555 | | KeyboardEvent ke; |
| 561 | _vm->_system->update_screen(); |
556 | 562 | |
557 | | if ((_vm->_input->readKey(&ke) == RD_OK && ke.keycode == 27) || _vm->_quit) { |
558 | | _vm->_mixer->stopHandle(handle); |
559 | | skipCutscene = true; |
560 | | break; |
| 563 | OSystem::Event event; |
| 564 | while (_vm->_system->poll_event(&event)) { |
| 565 | switch (event.event_code) { |
| 566 | #ifndef BACKEND_8BIT |
| 567 | case OSystem::EVENT_SCREEN_CHANGED: |
| 568 | anim->invalidateLookup(); |
| 569 | break; |
| 570 | #endif |
| 571 | case OSystem::EVENT_KEYDOWN: |
| 572 | if (event.kbd.keycode == 27) |
| 573 | skipCutscene = true; |
| 574 | break; |
| 575 | case OSystem::EVENT_QUIT: |
| 576 | _vm->closeGame(); |
| 577 | skipCutscene = true; |
| 578 | break; |
| 579 | default: |
| 580 | break; |
| 581 | } |
561 | 582 | } |
562 | | |
563 | 583 | } |
564 | 584 | |
565 | 585 | if (!skipCutscene) { |
566 | 586 | // Sleep for one frame so that the last frame is displayed. |
567 | 587 | _vm->_system->delay_msecs(1000 / 12); |
568 | | } |
| 588 | } else |
| 589 | _vm->_mixer->stopHandle(handle); |
569 | 590 | |
570 | 591 | #ifndef BACKEND_8BIT |
571 | 592 | // Most movies fade to black on their own, but not all of them. Since |
… |
… |
|
590 | 611 | #ifndef BACKEND_8BIT |
591 | 612 | anim->updateDisplay(); |
592 | 613 | #else |
593 | | _vm->_graphics->updateDisplay(true); |
| 614 | _vm->_graphics->updateDisplay(); |
594 | 615 | #endif |
595 | 616 | |
596 | 617 | // Wait for the voice to stop playing. This is to make sure |
diff -ur ScummVM-0.6.0-cvs20040228/sword2/driver/animation.h ScummVM-0.6.0-cvs20040228+hack/sword2/driver/animation.h
old
|
new
|
|
121 | 121 | void drawTextObject(SpriteInfo *s, uint8 *src); |
122 | 122 | void clearDisplay(); |
123 | 123 | void updateDisplay(void); |
| 124 | void invalidateLookup(); |
124 | 125 | #endif |
125 | 126 | |
126 | 127 | private: |