diff options
author | Gregory Montoir | 2003-10-18 17:12:50 +0000 |
---|---|---|
committer | Gregory Montoir | 2003-10-18 17:12:50 +0000 |
commit | eadf6356d385e3be0c8fa793007fe9e4b13da3b4 (patch) | |
tree | 2aa908d73fd69d1f33ecd8ae01c417166403eaed | |
parent | 673b211fdadd3c10dc31b013edab2a207aeaab68 (diff) | |
download | scummvm-rg350-eadf6356d385e3be0c8fa793007fe9e4b13da3b4.tar.gz scummvm-rg350-eadf6356d385e3be0c8fa793007fe9e4b13da3b4.tar.bz2 scummvm-rg350-eadf6356d385e3be0c8fa793007fe9e4b13da3b4.zip |
fix bob clipping errors
svn-id: r10899
-rw-r--r-- | queen/graphics.cpp | 6 | ||||
-rw-r--r-- | queen/graphics.h | 6 | ||||
-rw-r--r-- | queen/structs.h | 18 |
3 files changed, 15 insertions, 15 deletions
diff --git a/queen/graphics.cpp b/queen/graphics.cpp index c6958fa7c8..95660cecce 100644 --- a/queen/graphics.cpp +++ b/queen/graphics.cpp @@ -170,7 +170,7 @@ void Graphics::bobAnimNormal(uint32 bobnum, uint16 firstFrame, uint16 lastFrame, } -void Graphics::bobMove(uint32 bobnum, uint16 endx, uint16 endy, int16 speed) { +void Graphics::bobMove(uint32 bobnum, int16 endx, int16 endy, int16 speed) { debug(9, "Graphics::bobMove(%d, %d, %d, %d)", bobnum, endx, endy, speed); @@ -296,7 +296,7 @@ void BobSlot::animOneStep() { } -void Graphics::bobDraw(uint32 bobnum, uint16 x, uint16 y, uint16 scale, bool xflip, const Box& box) { +void Graphics::bobDraw(uint32 bobnum, int16 x, int16 y, uint16 scale, bool xflip, const Box& box) { uint16 w, h; @@ -366,7 +366,7 @@ void Graphics::bobDrawInventoryItem(uint32 bobnum, uint16 x, uint16 y) { } -void Graphics::bobPaste(uint32 bobnum, uint16 x, uint16 y) { +void Graphics::bobPaste(uint32 bobnum, int16 x, int16 y) { BobFrame *pbf = &_frames[bobnum]; _display->blit(RB_BACKDROP, x, y, pbf->data, pbf->width, pbf->height, pbf->width, false, true); diff --git a/queen/graphics.h b/queen/graphics.h index e58c751119..ece8571910 100644 --- a/queen/graphics.h +++ b/queen/graphics.h @@ -125,10 +125,10 @@ public: void bobSetupControl(); void bobAnimString(uint32 bobnum, const AnimFrame *buf); // stringanim() void bobAnimNormal(uint32 bobnum, uint16 firstFrame, uint16 lastFrame, uint16 speed, bool rebound, bool xflip); // makeanim() - void bobMove(uint32 bobnum, uint16 endx, uint16 endy, int16 speed); // movebob() - void bobDraw(uint32 bobnum, uint16 x, uint16 y, uint16 scale, bool xflip, const Box& box); // bob() + void bobMove(uint32 bobnum, int16 endx, int16 endy, int16 speed); // movebob() + void bobDraw(uint32 bobnum, int16 x, int16 y, uint16 scale, bool xflip, const Box& box); // bob() void bobDrawInventoryItem(uint32 bobnum, uint16 x, uint16 y); // invbob() - void bobPaste(uint32 bobnum, uint16 x, uint16 y); // bobpaste() + void bobPaste(uint32 bobnum, int16 x, int16 y); // bobpaste() void bobShrink(const BobFrame* pbf, uint16 percentage); // shrinkbob() void bobClear(uint32 bobnum); // clearbob() void bobSortAll(); // sortbobs() diff --git a/queen/structs.h b/queen/structs.h index 1d0234d14f..1c3d38605a 100644 --- a/queen/structs.h +++ b/queen/structs.h @@ -26,28 +26,28 @@ namespace Queen { struct Box { - uint16 x1, y1, x2, y2; + int16 x1, y1, x2, y2; void readFrom(byte *&ptr) { - x1 = READ_BE_UINT16(ptr); ptr += 2; - y1 = READ_BE_UINT16(ptr); ptr += 2; - x2 = READ_BE_UINT16(ptr); ptr += 2; - y2 = READ_BE_UINT16(ptr); ptr += 2; + x1 = (int16)READ_BE_UINT16(ptr); ptr += 2; + y1 = (int16)READ_BE_UINT16(ptr); ptr += 2; + x2 = (int16)READ_BE_UINT16(ptr); ptr += 2; + y2 = (int16)READ_BE_UINT16(ptr); ptr += 2; } int16 xDiff() const { - return (int16)(x2 - x1); + return x2 - x1; } int16 yDiff() const { - return (int16)(y2 - y1); + return y2 - y1; } - bool intersects(uint16 x, uint16 y, uint16 w, uint16 h) const { + bool intersects(int16 x, int16 y, uint16 w, uint16 h) const { return (x + w > x1) && (y + h > y1) && (x <= x2) && (y <= y2); } - bool contains(uint16 x, uint16 y) const { + bool contains(int16 x, int16 y) const { return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2); } }; |