Cleanup, and follow code formatting convention (indentation) for switch statements

svn-id: r35754
This commit is contained in:
Filippos Karapetis 2009-01-06 15:47:58 +00:00
parent ef78bbdf0d
commit c5c4ab97c9

View file

@ -44,12 +44,12 @@ class MoviePlayerSMK : Graphics::SMKPlayer {
protected: protected:
virtual void setPalette(byte *pal); virtual void setPalette(byte *pal);
public: public:
MoviePlayerSMK(SagaEngine *vm): _vm(vm), SMKPlayer(vm->_mixer) { MoviePlayerSMK(SagaEngine *vm): _vm(vm), SMKPlayer(vm->_mixer),
_eventMan = _vm->_system->getEventManager(); _eventMan(vm->_system->getEventManager()) {
} }
~MoviePlayerSMK(void) { } ~MoviePlayerSMK(void) { }
bool playVideo(const char *filename); void playVideo(const char *filename);
private: private:
void processFrame(); void processFrame();
void processEvents(); void processEvents();
@ -88,10 +88,14 @@ void MoviePlayerSMK::processEvents() {
} }
} }
bool MoviePlayerSMK::playVideo(const char *filename) { void MoviePlayerSMK::playVideo(const char *filename) {
_skipVideo = false; _skipVideo = false;
if (!loadFile(filename)) debug(0, "Playing video %s", filename);
return false;
if (!loadFile(filename)) {
warning("Failed to load video file %s", filename);
return;
}
while (getCurFrame() < getFrameCount() && !_skipVideo && !_vm->shouldQuit()) { while (getCurFrame() < getFrameCount() && !_skipVideo && !_vm->shouldQuit()) {
processEvents(); processEvents();
@ -99,11 +103,10 @@ bool MoviePlayerSMK::playVideo(const char *filename) {
} }
closeFile(); closeFile();
return true;
} }
void MoviePlayerSMK::processFrame() { void MoviePlayerSMK::processFrame() {
uint32 startTime = 0;
decodeNextFrame(); decodeNextFrame();
Graphics::Surface *screen = _vm->_system->lockScreen(); Graphics::Surface *screen = _vm->_system->lockScreen();
@ -123,28 +126,21 @@ void MoviePlayerSMK::processFrame() {
// Update the screen // Update the screen
_vm->_system->updateScreen(); _vm->_system->updateScreen();
startTime = _vm->_system->getMillis();
// Wait before showing the next frame // Wait before showing the next frame
_vm->_system->delayMillis(waitTime); while (_vm->_system->getMillis() < startTime + waitTime && !_skipVideo && !_vm->shouldQuit()) {
processEvents();
_vm->_system->delayMillis(10);
}
} }
int Scene::FTA2StartProc() { int Scene::FTA2StartProc() {
MoviePlayerSMK *smkPlayer = new MoviePlayerSMK(_vm);
_vm->_gfx->showCursor(false); _vm->_gfx->showCursor(false);
// Show Ignite logo MoviePlayerSMK *smkPlayer = new MoviePlayerSMK(_vm);
debug(0, "Playing video trimark.smk"); smkPlayer->playVideo("trimark.smk"); // Show Ignite logo
if (!smkPlayer->playVideo("trimark.smk")) { smkPlayer->playVideo("intro.smk"); // Play introduction
warning("Failed to load video file trimark.smk");
}
// Play introduction
debug(0, "Playing video intro.smk");
if (!smkPlayer->playVideo("intro.smk")) {
warning("Failed to load video file intro.smk");
}
// Cleanup
delete smkPlayer; delete smkPlayer;
// HACK: Forcibly quit here // HACK: Forcibly quit here
@ -176,17 +172,11 @@ int Scene::FTA2EndProc(FTA2Endings whichEnding) {
error("Unknown FTA2 ending"); error("Unknown FTA2 ending");
} }
MoviePlayerSMK *smkPlayer = new MoviePlayerSMK(_vm);
_vm->_gfx->showCursor(false); _vm->_gfx->showCursor(false);
// Play ending // Play ending
debug(0, "Playing video %s", videoName); MoviePlayerSMK *smkPlayer = new MoviePlayerSMK(_vm);
if (!smkPlayer->playVideo(videoName)) { smkPlayer->playVideo(videoName);
warning("Failed to load video file %s", videoName);
}
// Cleanup
delete smkPlayer; delete smkPlayer;
return SUCCESS; return SUCCESS;