Skip to content

Commit

Permalink
XEEN: Add horizontal placement fix for scaled sprites
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Feb 23, 2015
1 parent 3e05d90 commit 2d2fc3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion engines/xeen/sprites.cpp
Expand Up @@ -115,7 +115,7 @@ void SpriteResource::clear() {
/**
* Draws a frame using data at a specific offset in the sprite resource
*/
void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Point &destPos,
void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Point &pt,
const Common::Rect &bounds, int flags, int scale) {
// Get cell header
Common::MemoryReadStream f(_data, _filesize);
Expand All @@ -133,6 +133,9 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
return;
setupScaling(newScale, xOffset + width, yOffset + height);

Common::Point destPos = pt;
destPos.x += (xOffset + width - _scaledWidth) / 2;

bool flipped = (flags & SPRFLAG_HORIZ_FLIPPED) != 0;
int xInc = flipped ? -1 : 1;

Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/sprites.h
Expand Up @@ -53,7 +53,7 @@ class SpriteResource {
void draw(XSurface &dest, int frame, const Common::Point &destPos,
const Common::Rect &bounds, int flags = 0, int scale = 0);

void drawOffset(XSurface &dest, uint16 offset, const Common::Point &destPos,
void drawOffset(XSurface &dest, uint16 offset, const Common::Point &pt,
const Common::Rect &bounds, int flags, int scale);

void setupScaling(int scale, int frameWidth, int frameHeight);
Expand Down

0 comments on commit 2d2fc3f

Please sign in to comment.