Skip to content

Commit

Permalink
ACCESS: Standardise plotting methods and added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 22, 2014
1 parent 8d1d1f6 commit 41df773
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 51 deletions.
2 changes: 1 addition & 1 deletion engines/access/access.cpp
Expand Up @@ -318,7 +318,7 @@ void AccessEngine::plotList1() {
if (ie._flags & 2) {
_buffer2.plotB(frame, Common::Point(bounds.left, bounds.top));
} else {
_buffer2.plotFrame(frame, Common::Point(bounds.left, bounds.top));
_buffer2.plotF(frame, Common::Point(bounds.left, bounds.top));
}
}
}
Expand Down
63 changes: 17 additions & 46 deletions engines/access/asurface.cpp
Expand Up @@ -203,50 +203,10 @@ void ASurface::plotImage(SpriteResource *sprite, int frameNum, const Common::Poi
_lastBoundsW = r.width();
_lastBoundsH = r.height();

plotFrame(frame, pt);
plotF(frame, pt);
}
}

void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt) {
frame->copyTo(this, pt);
// g_system->copyRectToScreen((byte *)getPixels(), 320, 0, 0, 320, 200);
// g_system->updateScreen();


/*
byte *destP = (byte *)getBasePtr(pt.x, _scrollY + pt.y);
byte *srcP = frame->_data;
int8 leftVal1 = 18;
int8 leftVal2 = -8;
if (_leftSkip) {
++leftVal2;
leftVal1 = -12;
}
int8 rightVal = (_rightSkip) ? -7 : -8;
// Skip over any lines of the frame
for (int yp = 0; yp < _topSkip; ++yp) {
srcP += *(srcP + 1) + 2;
}
byte *srcLineP = srcP;
byte *destLineP = destP;
for (int yp = 0; yp < frame->h; ++yp, srcP = srcLineP, destP = destLineP) {
// Get length of line
int v = *srcP++;
int len = *srcP++;
srcLineP = srcP + len;
destLineP = destP + this->pitch;
// Draw the line of the frame
if (v != 0 || len != 0) {
warning("TODO: Line draw");
}
}
*/
}

void ASurface::copyTo(ASurface *dest, const Common::Point &destPos) {
for (int yp = 0; yp < h; ++yp) {
byte *srcP = (byte *)getBasePtr(0, yp);
Expand Down Expand Up @@ -305,22 +265,33 @@ void ASurface::copyTo(ASurface *dest, const Common::Rect &bounds) {
}
}

void ASurface::sPlotB(SpriteFrame *frame, const Common::Rect &bounds) {

void ASurface::plotF(SpriteFrame *frame, const Common::Point &pt) {
frame->copyTo(this, pt);
}

void ASurface::plotB(SpriteFrame *frame, const Common::Point &pt) {
ASurface flippedFrame;
frame->flipHorizontal(flippedFrame);
flippedFrame.copyTo(this, bounds);
flippedFrame.copyTo(this, pt);
}

void ASurface::sPlotF(SpriteFrame *frame, const Common::Rect &bounds) {
frame->copyTo(this, bounds);
}

void ASurface::plotB(SpriteFrame *frame, const Common::Point &pt) {
frame->copyTo(this, pt);
void ASurface::sPlotB(SpriteFrame *frame, const Common::Rect &bounds) {
ASurface flippedFrame;
frame->flipHorizontal(flippedFrame);
flippedFrame.copyTo(this, bounds);
}

void ASurface::copyBlock(ASurface *src, const Common::Rect &bounds) {
copyRectToSurface(*src, bounds.left, bounds.top, bounds);
Common::Rect r = bounds;
r.clip(Common::Rect(0, 0, this->w, this->h));

if (r.isValidRect())
copyRectToSurface(*src, r.left, r.top, r);
}

void ASurface::saveBlock(const Common::Rect &bounds) {
Expand Down
14 changes: 10 additions & 4 deletions engines/access/asurface.h
Expand Up @@ -53,8 +53,6 @@ class ASurface : public Graphics::Surface {
static int _lColor;

static void init();
public:
virtual void plotFrame(SpriteFrame *frame, const Common::Point &pt);
public:
virtual ~ASurface();

Expand All @@ -69,15 +67,23 @@ class ASurface : public Graphics::Surface {
void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt);

/**
* Scaled draw frame
* Scaled draw frame in forward orientation
*/
void sPlotF(SpriteFrame *frame, const Common::Rect &bounds);

/**
* Scaled flipped horizontal draw frame
* Scaled draw frame in backwards orientation
*/
void sPlotB(SpriteFrame *frame, const Common::Rect &bounds);

/**
* Draw an image full-size in forward orientation
*/
void plotF(SpriteFrame *frame, const Common::Point &pt);

/**
* Draw an image full-size in backwards orientation
*/
void plotB(SpriteFrame *frame, const Common::Point &pt);

void copyBlock(ASurface *src, const Common::Rect &bounds);
Expand Down

0 comments on commit 41df773

Please sign in to comment.