aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-10 11:36:04 -0400
committerPaul Gilbert2016-07-15 19:27:40 -0400
commitfd954a8e0b41370ae68f3b409295676de207313d (patch)
tree4a31e192231af9e4fa6eba44072e1e70ad7b98ab /engines
parent6c56d5aa11db1401bc0a2277776ec43128174bc2 (diff)
downloadscummvm-rg350-fd954a8e0b41370ae68f3b409295676de207313d.tar.gz
scummvm-rg350-fd954a8e0b41370ae68f3b409295676de207313d.tar.bz2
scummvm-rg350-fd954a8e0b41370ae68f3b409295676de207313d.zip
TITANIC: Added OSVideoSurface flipVertically
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/core/game_object.cpp4
-rw-r--r--engines/titanic/core/game_object.h5
-rw-r--r--engines/titanic/support/avi_surface.cpp21
-rw-r--r--engines/titanic/support/video_surface.cpp34
-rw-r--r--engines/titanic/support/video_surface.h31
5 files changed, 78 insertions, 17 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 78b91c3375..eeb765e40f 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -927,9 +927,9 @@ void CGameObject::dec54() {
getGameManager()->dec54();
}
-void CGameObject::surface39(int v1, int v2) {
+void CGameObject::setMovieFrameRate(double rate) {
if (_surface)
- _surface->proc39(v1, v2);
+ _surface->setMovieFrameRate(rate);
}
void CGameObject::setTextBorder(const CString &str, int border, int borderRight) {
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 58ae4c6123..b74c35f524 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -437,7 +437,10 @@ protected:
*/
void quitGame();
- void surface39(int v1, int v2);
+ /**
+ * Set the frame rate for the currently loaded movie
+ */
+ void setMovieFrameRate(double rate);
/**
* Set up the text borders for the object
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index a416bc3d69..e371ccb812 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -27,23 +27,24 @@
namespace Titanic {
AVISurface::AVISurface(const CResourceKey &key) {
+ _videoSurface = nullptr;
+ _field4 = 0;
+ _field8 = 0;
+ _currentPos = 0;
+ _priorFrame = 0;
+ _streamCount = 0;
+ _frameInfo = nullptr;
- // TODO
-/*
-Video::AVIDecoder *decoder = new Video::AVIDecoder();
-decoder->ignoreSecondaryVideoTracks();
-_video = decoder;
-_field14 = 1;
-
-if (!_video->loadFile(name.getString()))
-error("Could not open video - %s", name.getString().c_str());
-*/
+ _decoder = new Video::AVIDecoder();
+ if (!_decoder->loadFile(key.getString()))
+ error("Could not open video - %s", key.getString().c_str());
}
AVISurface::~AVISurface() {
if (_videoSurface)
_videoSurface->_blitStyleFlag = false;
delete _frameInfo;
+ delete _decoder;
}
bool AVISurface::play(uint flags, CGameObject *obj) {
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index fc7db30391..546c2c475b 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -461,14 +461,40 @@ void OSVideoSurface::addMovieEvent(int frameNumber, CGameObject *obj) {
_movie->addEvent(frameNumber, obj);
}
-void OSVideoSurface::proc39(int v1, int v2) {
- warning("OSVideoSurface::proc39");
+void OSVideoSurface::setMovieFrameRate(double rate) {
+ if (_movie)
+ _movie->setFrameRate(rate);
}
const CMovieRangeInfoList *OSVideoSurface::getMovieRangeInfo() const {
return _movie ? _movie->getMovieRangeInfo() : nullptr;
}
+void OSVideoSurface::flipVertically(bool needsLock) {
+ if (!loadIfReady() || !_blitStyleFlag)
+ return;
+
+ if (needsLock)
+ lock();
+
+ byte lineBuffer[SCREEN_WIDTH * 2];
+ int pitch = getBpp() * getWidth();
+ assert(pitch < (SCREEN_WIDTH * 2));
+
+ for (int yp = 0; yp < (_rawSurface->h / 2); ++yp) {
+ byte *line1P = (byte *)_rawSurface->getBasePtr(0, yp);
+ byte *line2P = (byte *)_rawSurface->getBasePtr(0, _rawSurface->h - yp - 1);
+
+ Common::copy(line1P, line1P + pitch, lineBuffer);
+ Common::copy(line2P, line2P + pitch, line1P);
+ Common::copy(lineBuffer, lineBuffer + pitch, line1P);
+ }
+
+ _blitStyleFlag = false;
+ if (needsLock)
+ unlock();
+}
+
bool OSVideoSurface::loadIfReady() {
_videoSurfaceNum = _videoSurfaceCounter;
@@ -511,6 +537,10 @@ void OSVideoSurface::transPixelate() {
unlock();
}
+void *OSVideoSurface::dupMovieFrameInfo() const {
+ return _movie ? _movie->duplicateFrameInfo() : nullptr;
+}
+
int OSVideoSurface::freeSurface() {
if (!_ddSurface)
return 0;
diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h
index 3521be6336..c8cfb78cd4 100644
--- a/engines/titanic/support/video_surface.h
+++ b/engines/titanic/support/video_surface.h
@@ -224,7 +224,10 @@ public:
*/
virtual void addMovieEvent(int eventId, CGameObject *obj) = 0;
- virtual void proc39(int v1, int v2) = 0;
+ /**
+ * Set the movie frame rate
+ */
+ virtual void setMovieFrameRate(double rate) = 0;
/**
* Return any movie range info associated with the surface's movie
@@ -232,6 +235,11 @@ public:
virtual const CMovieRangeInfoList *getMovieRangeInfo() const = 0;
/**
+ *
+ */
+ virtual void flipVertically(bool needsLock = true) = 0;
+
+ /**
* Loads the surface's resource if there's one pending
*/
virtual bool loadIfReady() = 0;
@@ -250,6 +258,11 @@ public:
virtual bool proc45();
/**
+ * Duplicates movie frame info
+ */
+ virtual void *dupMovieFrameInfo() const = 0;
+
+ /**
* Frees the underlying surface
*/
virtual int freeSurface() { return 0; }
@@ -452,7 +465,10 @@ public:
*/
virtual void addMovieEvent(int frameNumber, CGameObject *obj);
- virtual void proc39(int v1, int v2);
+ /**
+ * Set the movie frame rate
+ */
+ virtual void setMovieFrameRate(double rate);
/**
* Return any movie range info associated with the surface's movie
@@ -460,6 +476,11 @@ public:
virtual const CMovieRangeInfoList *getMovieRangeInfo() const;
/**
+ *
+ */
+ virtual void flipVertically(bool needsLock = true);
+
+ /**
* Loads the surface's resource if there's one pending
*/
virtual bool loadIfReady();
@@ -476,6 +497,12 @@ public:
virtual void transPixelate();
/**
+ * Duplicates movie frame info
+ */
+ virtual void *dupMovieFrameInfo() const;
+
+
+ /**
* Frees the underlying surface
*/
virtual int freeSurface();