Fixed a regression in my last commit where some sprites were not clipped correctly

svn-id: r35318
This commit is contained in:
Filippos Karapetis 2008-12-12 20:10:00 +00:00
parent 052e83cd24
commit dcca0c9f66
4 changed files with 12 additions and 12 deletions

View File

@ -406,7 +406,7 @@ void IsoMap::drawSprite(SpriteList &spriteList, int spriteNumber, const Location
_tileClip.top = CLIP<int>(spritePointer.y, 0, _vm->_scene->getHeight());
_tileClip.bottom = CLIP<int>(spritePointer.y + height, 0, _vm->_scene->getHeight());
_vm->_sprite->drawClip(spritePointer, width, height, spriteBuffer);
_vm->_sprite->drawClip(spritePointer, width, height, spriteBuffer, true);
drawTiles(&location);
}

View File

@ -207,7 +207,7 @@ void Puzzle::drawCurrentPiece() {
_vm->_actor->getSpriteParams(puzzle, frameNumber, spriteList);
_vm->_sprite->draw(*spriteList, _puzzlePiece,
Point(_pieceInfo[_puzzlePiece].curX, _pieceInfo[_puzzlePiece].curY), 256);
Point(_pieceInfo[_puzzlePiece].curX, _pieceInfo[_puzzlePiece].curY), 256, true);
}
void Puzzle::movePiece(Point mousePt) {

View File

@ -212,10 +212,10 @@ void Sprite::getScaledSpriteBuffer(SpriteList &spriteList, int spriteNumber, int
}
}
void Sprite::drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer) {
void Sprite::drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer, bool clipToScene) {
int clipWidth;
int clipHeight;
Common::Rect clipRect(_vm->getDisplayClip());
Common::Rect clipRect = clipToScene ? _vm->_scene->getSceneClip() : _vm->getDisplayClip();
int i, j, jo, io;
byte *bufRowPointer;
@ -263,7 +263,7 @@ void Sprite::drawClip(const Point &spritePointer, int width, int height, const b
_vm->_render->addDirtyRect(Common::Rect(x1, y1, x2, y2));
}
void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale, bool clipToScene) {
const byte *spriteBuffer = NULL;
int width = 0;
int height = 0;
@ -276,10 +276,10 @@ void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Point &scree
spritePointer.x = screenCoord.x + xAlign;
spritePointer.y = screenCoord.y + yAlign;
drawClip(spritePointer, width, height, spriteBuffer);
drawClip(spritePointer, width, height, spriteBuffer, clipToScene);
}
void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale) {
void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale, bool clipToScene) {
const byte *spriteBuffer = NULL;
int width = 0;
int height = 0;
@ -300,7 +300,7 @@ void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screen
}
spritePointer.x = screenRect.left + xAlign + spw;
spritePointer.y = screenRect.top + yAlign + sph;
drawClip(spritePointer, width, height, spriteBuffer);
drawClip(spritePointer, width, height, spriteBuffer, clipToScene);
}
bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint) {
@ -370,7 +370,7 @@ void Sprite::drawOccluded(SpriteList &spriteList, int spriteNumber, const Point
clipData.sourceRect.right = width;
clipData.sourceRect.bottom = height;
clipData.destRect = _vm->getDisplayClip();
clipData.destRect = _vm->_scene->getSceneClip();
if (!clipData.calcClip()) {
return;

View File

@ -77,12 +77,12 @@ public:
void drawOccluded(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth);
// draw scaled sprite using background scene mask
void draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale);
void draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale, bool clipToScene = false);
// main function
void drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer);
void drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer, bool clipToScene = false);
void draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale);
void draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale, bool clipToScene = false);
void loadList(int resourceId, SpriteList &spriteList); // load or append spriteList
bool hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint);