diff options
-rw-r--r-- | scumm/script_v6.cpp | 13 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 12 | ||||
-rw-r--r-- | scumm/scumm.h | 4 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 142 |
4 files changed, 86 insertions, 85 deletions
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 9fcb93c3ab..5d9d5524b2 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -30,8 +30,7 @@ #include "sound.h" #include "verbs.h" #include <time.h> -#include "smush/player.h" -#include "smush/scumm_renderer.h" +#include "smush/smush_player.h" #include "sound/mididrv.h" @@ -2337,11 +2336,8 @@ void Scumm_v6::o6_kernelSetFunctions() { debug(1, "INSANE Arg: %d", args[1]); - ScummRenderer *sr = new ScummRenderer(this, speed); - SmushPlayer *sp = new SmushPlayer(sr); - - if (_noSubtitles) - sp->hide("subtitles"); + SmushPlayer *sp = new SmushPlayer(this, speed, !_noSubtitles); + // INSANE mode 0: SMUSH movie playback if (args[1] == 0) { sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath()); @@ -2378,7 +2374,7 @@ void Scumm_v6::o6_kernelSetFunctions() { putState(235, 1); // Cheat and activate Ramp writeVar(142 | 0x8000, 1); // Cheat and activate auto-booster (fan) } -// sp->play("minefite.san", getGameDataPath()); +// smush->play("minefite.san", getGameDataPath()); break; } case 4: @@ -2403,7 +2399,6 @@ void Scumm_v6::o6_kernelSetFunctions() { sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath()); } delete sp; - delete sr; } break; case 7: diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 0a17e29b1c..fb7a004681 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -27,8 +27,7 @@ #include "sound.h" #include "verbs.h" -#include "smush/player.h" -#include "smush/scumm_renderer.h" +#include "smush/smush_player.h" #include <time.h> @@ -1334,16 +1333,9 @@ void Scumm_v8::o8_startVideo() { warning("o8_startVideo(%s/%s)", getGameDataPath(), (char*)_scriptPointer); - ScummRenderer * sr = new ScummRenderer(this, 83333); - SmushPlayer * sp = new SmushPlayer(sr); - - if (_noSubtitles) - sp->hide("subtitles"); - + SmushPlayer *sp = new SmushPlayer(this, 83333, !_noSubtitles); sp->play((char*)_scriptPointer, getGameDataPath()); - delete sp; - delete sr; _scriptPointer += len + 1; } diff --git a/scumm/scumm.h b/scumm/scumm.h index 3b035ed391..7d35b3c8e2 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -257,7 +257,7 @@ struct langIndexNode { class Scumm : public Engine { friend class ScummDebugger; - friend class ScummRenderer; // FIXME - this is mostly for the destructor + friend class SmushPlayer; void errorString(const char *buf_input, char *buf_output); public: /* Put often used variables at the top. @@ -321,6 +321,7 @@ public: int scummLoop(int delta); // Event handling + void parseEvents(); void waitForTimer(int msec_delay); void processKbd(); int checkKeyHit(); @@ -341,6 +342,7 @@ public: int _smushFrameRate; bool _insaneState; bool _videoFinished; + bool _smushPlay; void pauseGame(bool user); void shutDown(int i); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index d718e7f29e..4b153be25b 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1147,12 +1147,18 @@ int Scumm::runDialog(Dialog *dialog) { bool old_soundsPaused = _sound->_soundsPaused; _sound->pauseSounds(true); + // Pause playing smush movie + _smushPlay = false; + // Open & run the dialog int result = dialog->runModal(); // Restore old cursor updateCursor(); + // Restore playing smush movie + _smushPlay = true; + // Resume sound output _sound->pauseSounds(old_soundsPaused); @@ -1496,89 +1502,95 @@ void Scumm::errorString(const char *buf1, char *buf2) { } void Scumm::waitForTimer(int msec_delay) { - OSystem::Event event; uint32 start_time; - if (_fastMode&2) + if (_fastMode & 2) msec_delay = 0; - else if (_fastMode&1) + else if (_fastMode & 1) msec_delay = 10; start_time = _system->get_msecs(); - for(;;) { - while (_system->poll_event(&event)) { - - switch(event.event_code) { - case OSystem::EVENT_KEYDOWN: - if (event.kbd.keycode >= '0' && event.kbd.keycode<='9' - && (event.kbd.flags == OSystem::KBD_ALT || - event.kbd.flags == OSystem::KBD_CTRL)) { - _saveLoadSlot = event.kbd.keycode - '0'; - - // don't overwrite autosave (slot 0) - if (_saveLoadSlot == 0) - _saveLoadSlot = 10; - - sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot); - _saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2; - _saveLoadCompatible = false; - } else if (event.kbd.flags==OSystem::KBD_CTRL) { - if (event.kbd.keycode=='f') - _fastMode ^= 1; - else if (event.kbd.keycode=='g') - _fastMode ^= 2; - else if ((event.kbd.keycode=='d') && (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0))) - g_debugger.attach(this); - else if (event.kbd.keycode=='s') - resourceStats(); - else - _keyPressed = event.kbd.ascii; // Normal key press, pass on to the game. - } else if (event.kbd.flags & OSystem::KBD_ALT) { - // The result must be 273 for Alt-W - // because that's what MI2 looks for in - // its "instant win" cheat. - _keyPressed = event.kbd.keycode + 154; - } else + for (;;) { + parseEvents(); + + _sound->updateCD(); // Loop CD Audio if needed + if (_system->get_msecs() >= start_time + msec_delay) + break; + _system->delay_msecs(10); + } +} + +void Scumm::parseEvents() { + OSystem::Event event; + + while (_system->poll_event(&event)) { + + switch(event.event_code) { + case OSystem::EVENT_KEYDOWN: + if (event.kbd.keycode >= '0' && event.kbd.keycode<='9' + && (event.kbd.flags == OSystem::KBD_ALT || + event.kbd.flags == OSystem::KBD_CTRL)) { + _saveLoadSlot = event.kbd.keycode - '0'; + + // don't overwrite autosave (slot 0) + if (_saveLoadSlot == 0) + _saveLoadSlot = 10; + + sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot); + _saveLoadFlag = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2; + _saveLoadCompatible = false; + } else if (event.kbd.flags==OSystem::KBD_CTRL) { + if (event.kbd.keycode == 'f') + _fastMode ^= 1; + else if (event.kbd.keycode == 'g') + _fastMode ^= 2; + else if ((event.kbd.keycode == 'd') && (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0))) + g_debugger.attach(this); + else if (event.kbd.keycode == 's') + resourceStats(); + else _keyPressed = event.kbd.ascii; // Normal key press, pass on to the game. - break; + } else if (event.kbd.flags & OSystem::KBD_ALT) { + // The result must be 273 for Alt-W + // because that's what MI2 looks for in + // its "instant win" cheat. + _keyPressed = event.kbd.keycode + 154; + } else + _keyPressed = event.kbd.ascii; // Normal key press, pass on to the game. + break; - case OSystem::EVENT_MOUSEMOVE: - mouse.x = event.mouse.x; - mouse.y = event.mouse.y; - _system->set_mouse_pos(event.mouse.x, event.mouse.y); - _system->update_screen(); - break; + case OSystem::EVENT_MOUSEMOVE: + mouse.x = event.mouse.x; + mouse.y = event.mouse.y; + _system->set_mouse_pos(event.mouse.x, event.mouse.y); + _system->update_screen(); + break; - case OSystem::EVENT_LBUTTONDOWN: - _leftBtnPressed |= msClicked|msDown; + case OSystem::EVENT_LBUTTONDOWN: + _leftBtnPressed |= msClicked|msDown; #ifdef _WIN32_WCE - mouse.x = event.mouse.x; - mouse.y = event.mouse.y; + mouse.x = event.mouse.x; + mouse.y = event.mouse.y; #endif - break; + break; - case OSystem::EVENT_RBUTTONDOWN: - _rightBtnPressed |= msClicked|msDown; + case OSystem::EVENT_RBUTTONDOWN: + _rightBtnPressed |= msClicked|msDown; #ifdef _WIN32_WCE - mouse.x = event.mouse.x; - mouse.y = event.mouse.y; + mouse.x = event.mouse.x; + mouse.y = event.mouse.y; #endif - break; + break; - case OSystem::EVENT_LBUTTONUP: - _leftBtnPressed &= ~msDown; - break; + case OSystem::EVENT_LBUTTONUP: + _leftBtnPressed &= ~msDown; + break; - case OSystem::EVENT_RBUTTONUP: - _rightBtnPressed &= ~msDown; - break; - } - } - _sound->updateCD(); // Loop CD Audio if needed - if (_system->get_msecs() >= start_time + msec_delay) + case OSystem::EVENT_RBUTTONUP: + _rightBtnPressed &= ~msDown; break; - _system->delay_msecs(10); + } } } |