From 339dfcb2cc9fde227abc15ad9b298f7b16194785 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 Jan 2015 15:14:57 -0500 Subject: XEEN: Restrict drawing in windows to drawing within their bounds --- engines/xeen/screen.cpp | 11 +++-------- engines/xeen/sprites.cpp | 7 ++++--- engines/xeen/sprites.h | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/xeen/screen.cpp b/engines/xeen/screen.cpp index 42182cc7fe..16e4955cde 100644 --- a/engines/xeen/screen.cpp +++ b/engines/xeen/screen.cpp @@ -38,7 +38,7 @@ Window::Window(XeenEngine *vm, const Common::Rect &bounds, int a, int border, _vm(vm), _enabled(false), _a(a), _border(border), _xLo(xLo), _ycL(ycL), _xHi(xHi), _ycH(ycH) { setBounds(bounds); - create(_vm->_screen, Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + create(_vm->_screen, bounds); } void Window::setBounds(const Common::Rect &r) { @@ -167,17 +167,12 @@ void Window::writeString(const Common::String &s) { } void Window::drawList(DrawStruct *items, int count) { - Screen &screen = *_vm->_screen; - for (int i = 0; i < count; ++i, ++items) { if (items->_frame == -1 || items->_scale == -1 || items->_sprites == nullptr) continue; - - Common::Rect bounds = _innerBounds; - bounds.translate(items->_x, items->_y); - + // TODO: There are two sprite calls in this method. Figure out why - items->_sprites->draw(screen, items->_frame, + items->_sprites->draw(*this, items->_frame, Common::Point(items->_x, items->_y), items->_flags, items->_scale); } } diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp index 62074ed565..5adc0e53e2 100644 --- a/engines/xeen/sprites.cpp +++ b/engines/xeen/sprites.cpp @@ -104,9 +104,10 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi bool flipped = (flags & SPRFLAG_HORIZ_FLIPPED) != 0; int xInc = flipped ? -1 : 1; - if (dest.w < (xOffset + width) || dest.h < (yOffset + height)) - dest.create(xOffset + width, yOffset + height); - + if (flags & SPRFLAG_RESIZE) { + if (dest.w < (xOffset + width) || dest.h < (yOffset + height)) + dest.create(xOffset + width, yOffset + height); + } // The pattern steps used in the pattern command const int patternSteps[] = { 0, 1, 1, 1, 2, 2, 3, 3, 0, -1, -1, -1, -2, -2, -3, -3 }; diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h index d1a801e6ca..15a3b7ca87 100644 --- a/engines/xeen/sprites.h +++ b/engines/xeen/sprites.h @@ -34,7 +34,7 @@ namespace Xeen { class XeenEngine; enum SpriteFlags { SPRFLAG_2000 = 0x2000, SPRFLAG_4000 = 0x4000, - SPRFLAG_HORIZ_FLIPPED = 0x8000 }; + SPRFLAG_HORIZ_FLIPPED = 0x8000, SPRFLAG_RESIZE = 0x10000 }; class SpriteResource { private: -- cgit v1.2.3