Skip to content

Commit

Permalink
ADL: Add pic offsetting
Browse files Browse the repository at this point in the history
  • Loading branch information
waltervn committed Jun 6, 2016
1 parent a653fa2 commit 6fd580f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions engines/adl/graphics.h
Expand Up @@ -68,6 +68,7 @@ class Graphics_v2 : public GraphicsMan {
void fill(Common::SeekableReadStream &pic);

byte _color;
Common::Point _offset;
};

} // End of namespace Adl
Expand Down
7 changes: 7 additions & 0 deletions engines/adl/graphics_v2.cpp
Expand Up @@ -30,6 +30,8 @@

namespace Adl {

// FIXME: Add clipping

#define NUM_PATTERNS 22
#define PATTERN_LEN 4
static const byte fillPatterns[NUM_PATTERNS][PATTERN_LEN] = {
Expand Down Expand Up @@ -78,8 +80,10 @@ static const byte fillPatterns[NUM_PATTERNS][PATTERN_LEN] = {
#define READ_POINT(p) \
do { \
READ_BYTE(p.x); \
p.x += _offset.x; \
p.x <<= 1; \
READ_BYTE(p.y); \
p.y += _offset.y; \
} while (0)

void Graphics_v2::clear() {
Expand All @@ -99,6 +103,7 @@ void Graphics_v2::drawCorners(Common::SeekableReadStream &pic, bool yFirst) {
int16 n;

READ_BYTE(n);
n += _offset.x;

_display.putPixel(p, _color);

Expand All @@ -108,6 +113,7 @@ void Graphics_v2::drawCorners(Common::SeekableReadStream &pic, bool yFirst) {

doYStep:
READ_BYTE(n);
n += _offset.y;

_display.putPixel(p, _color);
drawLine(p, Common::Point(p.x, n), _color);
Expand Down Expand Up @@ -236,6 +242,7 @@ void Graphics_v2::fill(Common::SeekableReadStream &pic) {

void Graphics_v2::drawPic(Common::SeekableReadStream &pic, const Common::Point &pos, byte color) {
_color = color;
_offset = pos;

while (true) {
byte opcode = pic.readByte();
Expand Down

0 comments on commit 6fd580f

Please sign in to comment.