diff options
author | Martin Kiewitz | 2010-02-06 19:35:51 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-02-06 19:35:51 +0000 |
commit | 4cae2b13e2acbd81e4b726f1e409c5615eda7967 (patch) | |
tree | b6eeaaf0887ef616347a059a0d9ebd9526e30a5e /engines | |
parent | cf1b03f694740203901924ea66d004d26e461e0b (diff) | |
download | scummvm-rg350-4cae2b13e2acbd81e4b726f1e409c5615eda7967.tar.gz scummvm-rg350-4cae2b13e2acbd81e4b726f1e409c5615eda7967.tar.bz2 scummvm-rg350-4cae2b13e2acbd81e4b726f1e409c5615eda7967.zip |
SCI: added plane coordinate adjustment code for sci32 when drawing pictures, put everything into GfxCoordAdjuster
svn-id: r47939
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/coordadjuster.cpp | 14 | ||||
-rw-r--r-- | engines/sci/graphics/coordadjuster.h | 9 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 8 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.h | 3 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/paint32.cpp | 7 | ||||
-rw-r--r-- | engines/sci/graphics/paint32.h | 3 | ||||
-rw-r--r-- | engines/sci/graphics/picture.cpp | 25 | ||||
-rw-r--r-- | engines/sci/graphics/picture.h | 3 |
10 files changed, 51 insertions, 27 deletions
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp index 48f6d0161c..4e914fa9cc 100644 --- a/engines/sci/graphics/coordadjuster.cpp +++ b/engines/sci/graphics/coordadjuster.cpp @@ -78,6 +78,12 @@ void GfxCoordAdjuster16::moveCursor(Common::Point &pos) { pos.x = CLIP<int16>(pos.x, _ports->_picWind->rect.left, _ports->_picWind->rect.right - 1); } +Common::Rect GfxCoordAdjuster16::pictureGetDisplayArea() { + Common::Rect displayArea(_ports->getPort()->rect.right, _ports->getPort()->rect.bottom); + displayArea.moveTo(_ports->getPort()->left, _ports->getPort()->top); + return displayArea; +}; + #ifdef ENABLE_SCI32 GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan) : _segMan(segMan) { @@ -108,6 +114,14 @@ Common::Rect GfxCoordAdjuster32::onControl(Common::Rect rect) { adjustedRect.translate(0, 10); return adjustedRect; } + +void GfxCoordAdjuster32::pictureSetDisplayArea(Common::Rect displayArea) { + _pictureDisplayArea = displayArea; +} + +Common::Rect GfxCoordAdjuster32::pictureGetDisplayArea() { + return _pictureDisplayArea; +}; #endif } // End of namespace Sci diff --git a/engines/sci/graphics/coordadjuster.h b/engines/sci/graphics/coordadjuster.h index e1fed1a539..1aa79f25f3 100644 --- a/engines/sci/graphics/coordadjuster.h +++ b/engines/sci/graphics/coordadjuster.h @@ -49,6 +49,8 @@ public: virtual Common::Rect onControl(Common::Rect rect) { return rect; }; virtual void setCursorPos(Common::Point &pos) { }; virtual void moveCursor(Common::Point &pos) { }; + + virtual Common::Rect pictureGetDisplayArea() { return Common::Rect(0, 0); }; private: }; @@ -63,6 +65,8 @@ public: Common::Rect onControl(Common::Rect rect); void setCursorPos(Common::Point &pos); void moveCursor(Common::Point &pos); + + Common::Rect pictureGetDisplayArea(); private: GfxPorts *_ports; @@ -80,9 +84,14 @@ public: void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG); Common::Rect onControl(Common::Rect rect); + + void pictureSetDisplayArea(Common::Rect displayArea); + Common::Rect pictureGetDisplayArea(); private: SegManager *_segMan; + + Common::Rect _pictureDisplayArea; }; #endif diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index f6202ec10b..4f4b0a9aea 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -32,6 +32,7 @@ #include "sci/engine/selector.h" #include "sci/engine/vm.h" #include "sci/graphics/cache.h" +#include "sci/graphics/coordadjuster.h" #include "sci/graphics/font.h" #include "sci/graphics/view.h" #include "sci/graphics/screen.h" @@ -41,9 +42,10 @@ namespace Sci { -GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32) +GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32) : _segMan(segMan), _resMan(resMan), _cache(cache), _screen(screen), _palette(palette), _paint32(paint32) { + _coordAdjuster = (GfxCoordAdjuster32 *)coordAdjuster; _highPlanePri = 0; } @@ -148,8 +150,10 @@ void GfxFrameout::kernelFrameout() { planePictureNr = GET_SEL32V(_segMan, planeObject, SELECTOR(picture)); if ((planePictureNr != 0xFFFF) && (planePictureNr != 0xFFFE)) { - planePicture = new GfxPicture(_resMan, 0, _screen, _palette, planePictureNr, false); + planePicture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, planePictureNr, false); planePictureCels = planePicture->getSci32celCount(); + + _coordAdjuster->pictureSetDisplayArea(planeRect); } // Fill our itemlist for this plane diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index 24db870b60..36c02af278 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -50,7 +50,7 @@ class GfxPaint32; */ class GfxFrameout { public: - GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32); + GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32); ~GfxFrameout(); void kernelAddPlane(reg_t object); @@ -64,6 +64,7 @@ public: private: SegManager *_segMan; ResourceManager *_resMan; + GfxCoordAdjuster32 *_coordAdjuster; GfxCache *_cache; GfxPalette *_palette; GfxScreen *_screen; diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index 705ed1b9f4..b1a44e62bc 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -54,9 +54,9 @@ SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, G _cursor->init(_coordAdjuster, _s->_event); _compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen, _coordAdjuster); _s->_gfxCompare = _compare; - _paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _cache, _screen, _palette); + _paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _coordAdjuster, _cache, _screen, _palette); _s->_gfxPaint = _paint32; - _frameout = new GfxFrameout(_s->_segMan, _s->resMan, _cache, _screen, _palette, _paint32); + _frameout = new GfxFrameout(_s->_segMan, _s->resMan, _coordAdjuster, _cache, _screen, _palette, _paint32); _s->_gfxFrameout = _frameout; } diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index 7261ad1dd8..1b44498674 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -64,7 +64,7 @@ void GfxPaint16::setEGAdrawingVisualize(bool state) { } void GfxPaint16::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId) { - GfxPicture *picture = new GfxPicture(_resMan, _ports, _screen, _palette, pictureId, _EGAdrawingVisualize); + GfxPicture *picture = new GfxPicture(_resMan, _coordAdjuster, _ports, _screen, _palette, pictureId, _EGAdrawingVisualize); // do we add to a picture? if not -> clear screen with white if (!addToFlag) diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp index 8d15970063..c0811298bb 100644 --- a/engines/sci/graphics/paint32.cpp +++ b/engines/sci/graphics/paint32.cpp @@ -30,6 +30,7 @@ #include "sci/sci.h" #include "sci/engine/state.h" #include "sci/engine/selector.h" +#include "sci/graphics/coordadjuster.h" #include "sci/graphics/cache.h" #include "sci/graphics/paint32.h" #include "sci/graphics/font.h" @@ -40,8 +41,8 @@ namespace Sci { -GfxPaint32::GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxPalette *palette) - : _resMan(resMan), _segMan(segMan), _kernel(kernel), _cache(cache), _screen(screen), _palette(palette) { +GfxPaint32::GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette) + : _resMan(resMan), _segMan(segMan), _kernel(kernel), _coordAdjuster(coordAdjuster), _cache(cache), _screen(screen), _palette(palette) { } GfxPaint32::~GfxPaint32() { @@ -57,7 +58,7 @@ void GfxPaint32::fillRect(Common::Rect rect, byte color) { } void GfxPaint32::kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { - GfxPicture *picture = new GfxPicture(_resMan, 0, _screen, _palette, pictureId, false); + GfxPicture *picture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, pictureId, false); picture->draw(animationNr, mirroredFlag, addToFlag, EGApaletteNo); delete picture; diff --git a/engines/sci/graphics/paint32.h b/engines/sci/graphics/paint32.h index 86b3f53ea4..f4d6340361 100644 --- a/engines/sci/graphics/paint32.h +++ b/engines/sci/graphics/paint32.h @@ -40,7 +40,7 @@ class GfxPorts; */ class GfxPaint32 : public GfxPaint { public: - GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxPalette *palette); + GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette); ~GfxPaint32(); void fillRect(Common::Rect rect, byte color); @@ -53,6 +53,7 @@ private: ResourceManager *_resMan; SegManager *_segMan; Kernel *_kernel; + GfxCoordAdjuster *_coordAdjuster; GfxCache *_cache; GfxScreen *_screen; GfxPalette *_palette; diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index ac96746e1b..eba41baa63 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -28,13 +28,14 @@ #include "sci/engine/state.h" #include "sci/graphics/screen.h" #include "sci/graphics/palette.h" +#include "sci/graphics/coordadjuster.h" #include "sci/graphics/ports.h" #include "sci/graphics/picture.h" namespace Sci { -GfxPicture::GfxPicture(ResourceManager *resMan, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize) - : _resMan(resMan), _ports(ports), _screen(screen), _palette(palette), _resourceId(resourceId), _EGAdrawingVisualize(EGAdrawingVisualize) { +GfxPicture::GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize) + : _resMan(resMan), _coordAdjuster(coordAdjuster), _ports(ports), _screen(screen), _palette(palette), _resourceId(resourceId), _EGAdrawingVisualize(EGAdrawingVisualize) { assert(resourceId != -1); initData(resourceId); } @@ -280,20 +281,12 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos memcpy(celBitmap, rlePtr, pixelCount); } - if (_ports) { - // Set initial vertical coordinate by using current port - y = callerY + _ports->getPort()->top; - lastY = MIN<int16>(height + y, _ports->getPort()->rect.bottom + _ports->getPort()->top); - leftX = callerX + _ports->getPort()->left; - rightX = MIN<int16>(width + leftX, _ports->getPort()->rect.right + _ports->getPort()->left); - } else { - y = callerY + 10; // TODO: Implement plane support for SCI32 - lastY = y + height; - if (lastY > _screen->getHeight()) - lastY = _screen->getHeight(); - leftX = callerX; - rightX = leftX + width; - } + Common::Rect displayArea = _coordAdjuster->pictureGetDisplayArea(); + + y = callerY + displayArea.top; + lastY = MIN<int16>(height + y, displayArea.bottom); + leftX = callerX + displayArea.left; + rightX = MIN<int16>(width + leftX, displayArea.right); // Change clearcolor to white, if we dont add to an existing picture. That way we will paint everything on screen // but white and that wont matter because the screen is supposed to be already white. It seems that most (if not all) diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h index 92c30262d2..3374c33b52 100644 --- a/engines/sci/graphics/picture.h +++ b/engines/sci/graphics/picture.h @@ -42,7 +42,7 @@ class GfxPalette; */ class GfxPicture { public: - GfxPicture(ResourceManager *resMan, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false); + GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false); ~GfxPicture(); GuiResourceId getResourceId(); @@ -73,6 +73,7 @@ private: void vectorPatternTexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture); ResourceManager *_resMan; + GfxCoordAdjuster *_coordAdjuster; GfxPorts *_ports; GfxScreen *_screen; GfxPalette *_palette; |