aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Iskrich2016-05-31 20:49:05 +0300
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitfb6e06231c20bec264e8c54be4dfb662b9d08fd7 (patch)
treeb15c899bb9eb12041eeb256075995b65b578ef6f
parent6299055098cf09e174344c43d421b935f5a50a6b (diff)
downloadscummvm-rg350-fb6e06231c20bec264e8c54be4dfb662b9d08fd7.tar.gz
scummvm-rg350-fb6e06231c20bec264e8c54be4dfb662b9d08fd7.tar.bz2
scummvm-rg350-fb6e06231c20bec264e8c54be4dfb662b9d08fd7.zip
DIRECTOR: Move sprite display to ManagedSurface
-rw-r--r--engines/director/dib.cpp3
-rw-r--r--engines/director/score.cpp18
-rw-r--r--engines/director/score.h6
3 files changed, 17 insertions, 10 deletions
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 6053d55a77..4e2a21dd38 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -77,9 +77,6 @@ void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
}
bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
-
-
-
uint32 headerSize = stream.readUint32LE();
if (headerSize != 40)
return false;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 477d8501e1..e9210376ab 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -31,10 +31,14 @@
#include "graphics/palette.h"
#include "common/events.h"
#include "engines/util.h"
+#include "graphics/managed_surface.h"
namespace Director {
Score::Score(Common::SeekableReadStream &stream, Archive &movie) {
+
+ _surface = new Graphics::ManagedSurface;
+
_movieArchive = &movie;
uint32 size = stream.readUint32BE();
size -= 4;
@@ -169,7 +173,7 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
void Score::play() {
initGraphics(800, 600, true);
-
+ _surface->create(800, 600);
_currentFrame = 0;
_stopPlay = false;
_nextFrameTime = 0;
@@ -185,7 +189,7 @@ void Score::display() {
if (g_system->getMillis() < _nextFrameTime)
return;
- _frames[_currentFrame]->display(*_movieArchive);
+ _frames[_currentFrame]->display(*_movieArchive, *_surface, _movieRect);
_currentFrame++;
byte tempo = _frames[_currentFrame]->_tempo;
if (tempo) {
@@ -394,8 +398,8 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
}
-void Frame::display(Archive &_movie) {
-
+void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect moviRect) {
+ surface.clear();
DIBDecoder palette;
Common::SeekableReadStream *pal = _movie.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
palette.loadPalette(*pal);
@@ -407,6 +411,7 @@ void Frame::display(Archive &_movie) {
//TODO check cast type
uint32 imgId = 1024 + _sprites[i]->_castId;
img.loadStream(*_movie.getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left;
@@ -416,6 +421,7 @@ void Frame::display(Archive &_movie) {
int y = _sprites[i]->_startPoint.y - regY + rectTop;
int height = _sprites[i]->_height;
int width = _sprites[i]->_width;
+
if (x < 0) {
width += x;
x = 0;
@@ -424,7 +430,9 @@ void Frame::display(Archive &_movie) {
height += y;
y = 0;
}
- g_system->copyRectToScreen(img.getSurface()->getPixels(), img.getSurface()->pitch, x, y, height, width);
+ Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
+ surface.blitFrom(*img.getSurface());
+ g_system->copyRectToScreen(surface.getPixels(), surface.pitch, drawRect.left, drawRect.top, drawRect.height(), drawRect.width());
}
}
}
diff --git a/engines/director/score.h b/engines/director/score.h
index d3293da95b..f15afa0b82 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -24,6 +24,7 @@
#include "common/stream.h"
#include "common/array.h"
#include "director/resource.h"
+#include "graphics/managed_surface.h"
namespace Director {
@@ -79,7 +80,7 @@ enum inkType {
kInkTypeNotTrans,
kInkTypeNotReverse,
kInkTypeNotGhost,
- kIntTypeMatte,
+ kInkTypeMatte,
kInkTypeMask,
//10-31 Not used (Lingo in a Nutshell)
kInkTypeBlend = 32,
@@ -157,7 +158,7 @@ public:
~Frame();
Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void display(Archive &_movie);
+ void display(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect moviRect);
private:
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
@@ -208,6 +209,7 @@ private:
uint16 _castArrayEnd;
Common::Rect _movieRect;
Archive *_movieArchive;
+ Graphics::ManagedSurface *_surface;
};
} //End of namespace Director