Skip to content

Commit

Permalink
PEGASUS: Add the new demo theora videos
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Apr 17, 2013
1 parent a41457e commit 5727b09
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions engines/pegasus/pegasus.cpp
Expand Up @@ -37,6 +37,7 @@
#include "base/plugins.h"
#include "base/version.h"
#include "gui/saveload.h"
#include "video/theora_decoder.h"
#include "video/qt_decoder.h"

#include "pegasus/console.h"
Expand Down Expand Up @@ -1362,8 +1363,14 @@ bool PegasusEngine::playMovieScaled(Video::VideoDecoder *video, uint16 x, uint16
if (video->needsUpdate()) {
const Graphics::Surface *frame = video->decodeNextFrame();

if (frame)
drawScaledFrame(frame, x, y);
if (frame) {
if (frame->w <= 320 && frame->h <= 240) {
drawScaledFrame(frame, x, y);
} else {
_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
_system->updateScreen();
}
}
}

Input input;
Expand All @@ -1387,6 +1394,18 @@ void PegasusEngine::die(const DeathReason reason) {
}

void PegasusEngine::doDeath() {
#ifdef USE_THEORADEC
// The updated demo has a new Theora video for the closing
if (isDemo() && _deathReason == kPlayerWonGame) {
Video::TheoraDecoder decoder;

if (decoder.loadFile("Images/Demo TSA/DemoClosing.ogg")) {
decoder.start();
playMovieScaled(&decoder, 0, 0);
}
}
#endif

_gfx->doFadeOutSync();
throwAwayEverything();
useMenu(new DeathMenu(_deathReason));
Expand Down Expand Up @@ -1591,6 +1610,16 @@ void PegasusEngine::startNewGame() {
GameState.setPrehistoricSeenFlyer2(false);
GameState.setPrehistoricSeenBridgeZoom(false);
GameState.setPrehistoricBreakerThrown(false);

#ifdef USE_THEORADEC
// The updated demo has a new Theora video for the closing
Video::TheoraDecoder decoder;

if (decoder.loadFile("Images/Demo TSA/DemoOpening.ogg")) {
decoder.start();
playMovieScaled(&decoder, 0, 0);
}
#endif
} else {
jumpToNewEnvironment(kCaldoriaID, kCaldoria00, kEast);
}
Expand Down

0 comments on commit 5727b09

Please sign in to comment.