From 2e42c2d11d27ae51431a7c287fab061fca38e23c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 30 Jan 2011 20:34:47 +0000 Subject: SWORD25: Some translations, and a bugfix. Disabled a hack. Translated some comments, and pushed the indirect rendering define to the header file, so that the engine won't try and update the screen with direct movie rendering. Also, the thumbnail hack has been disabled, as it doesn't really work (at least not for me: all the thumbnails are gray) svn-id: r55663 --- engines/sword25/fmv/movieplayer.cpp | 15 +++++---------- engines/sword25/fmv/movieplayer.h | 2 ++ engines/sword25/gfx/graphicengine.cpp | 13 +++++++++++-- 3 files changed, 18 insertions(+), 12 deletions(-) (limited to 'engines/sword25') diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index 06e697b991..3b4d3a74b9 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -40,8 +40,6 @@ #include "sword25/package/packagemanager.h" #include "sword25/sfx/soundengine.h" -#define INDIRECTRENDERING 1 - namespace Sword25 { #define FLT_EPSILON 1.192092896e-07F /* smallest such that 1.0+FLT_EPSILON != 1.0 */ @@ -63,17 +61,16 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) { Common::SeekableReadStream *in = Kernel::getInstance()->getPackage()->getStream(filename); _decoder.load(in); - // Ausgabebitmap erstellen GraphicEngine *pGfx = Kernel::getInstance()->getGfx(); -#if INDIRECTRENDERING +#ifdef THEORA_INDIRECT_RENDERING _outputBitmap = pGfx->getMainPanel()->addDynamicBitmap(_decoder.getWidth(), _decoder.getHeight()); if (!_outputBitmap.isValid()) { error("Output bitmap for movie playback could not be created."); return false; } - // Skalierung des Ausgabebitmaps berechnen, so dass es möglichst viel Bildschirmfläche einnimmt. + // Compute the scaling of the output bitmap, so that it takes up the most space float screenToVideoWidth = (float)pGfx->getDisplayWidth() / (float)_outputBitmap->getWidth(); float screenToVideoHeight = (float)pGfx->getDisplayHeight() / (float)_outputBitmap->getHeight(); float scaleFactor = MIN(screenToVideoWidth, screenToVideoHeight); @@ -82,11 +79,9 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) { scaleFactor = 1.0f; _outputBitmap->setScaleFactor(scaleFactor); - - // Z-Wert setzen _outputBitmap->setZ(z); - // Ausgabebitmap auf dem Bildschirm zentrieren + // Center bitmap on screen _outputBitmap->setX((pGfx->getDisplayWidth() - _outputBitmap->getWidth()) / 2); _outputBitmap->setY((pGfx->getDisplayHeight() - _outputBitmap->getHeight()) / 2); #else @@ -128,7 +123,7 @@ void MoviePlayer::update() { // Transfer the next frame assert(s->bytesPerPixel == 4); -#if INDIRECTRENDERING +#ifdef THEORA_INDIRECT_RENDERING byte *frameData = (byte *)s->getBasePtr(0, 0); _outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch); #else @@ -204,7 +199,7 @@ void MoviePlayer::update() { } bool MoviePlayer::isMovieLoaded() { - return true; + return false; } bool MoviePlayer::isPaused() { diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h index 350407cea5..df0792c8a8 100644 --- a/engines/sword25/fmv/movieplayer.h +++ b/engines/sword25/fmv/movieplayer.h @@ -45,6 +45,8 @@ #include "sword25/fmv/theora_decoder.h" #endif +#define THEORA_INDIRECT_RENDERING + namespace Sword25 { class MoviePlayer : public Service { diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index cf97534d6c..5fefcec420 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -51,6 +51,8 @@ #include "sword25/gfx/graphicengine.h" +#include "sword25/fmv/movieplayer.h" + #include "sword25/util/lua/lua.h" #include "sword25/util/lua/lauxlib.h" enum { @@ -140,10 +142,16 @@ bool GraphicEngine::startFrame(bool updateAll) { } bool GraphicEngine::endFrame() { - // Scene zeichnen +#ifndef THEORA_INDIRECT_RENDERING + if (Kernel::getInstance()->getFMV()->isMovieLoaded()) + return true; +#endif + _renderObjectManagerPtr->render(); - // FIXME: The frame buffer surface is only used as the base for creating thumbnails when saving the + // FIXME: The following hack doesn't really work (all the thumbnails are empty) +#if 0 + // HACK: The frame buffer surface is only used as the base for creating thumbnails when saving the // game, since the _backSurface is blanked. Currently I'm doing a slightly hacky check and only // copying the back surface if line 50 (the first line after the interface area) is non-blank if (READ_LE_UINT32((byte *)_backSurface.pixels + (_backSurface.pitch * 50)) & 0xffffff) { @@ -151,6 +159,7 @@ bool GraphicEngine::endFrame() { Common::copy((byte *)_backSurface.pixels, (byte *)_backSurface.pixels + (_backSurface.pitch * _backSurface.h), (byte *)_frameBuffer.pixels); } +#endif g_system->updateScreen(); -- cgit v1.2.3