diff options
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 1 | ||||
-rw-r--r-- | engines/sci/graphics/compare.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/compare.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/coordadjuster.cpp | 52 | ||||
-rw-r--r-- | engines/sci/graphics/coordadjuster.h | 48 | ||||
-rw-r--r-- | engines/sci/graphics/cursor.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/cursor.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 17 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.h | 4 | ||||
-rw-r--r-- | engines/sci/graphics/picture.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/picture.h | 6 | ||||
-rw-r--r-- | engines/sci/graphics/text16.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/view.cpp | 12 | ||||
-rw-r--r-- | engines/sci/graphics/view.h | 2 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 3 | ||||
-rw-r--r-- | engines/sci/sci.h | 4 |
18 files changed, 21 insertions, 150 deletions
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 182f2cb1f7..aa9fc18b20 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -37,7 +37,6 @@ #include "sci/graphics/cache.h" #include "sci/graphics/compare.h" #include "sci/graphics/controls16.h" -#include "sci/graphics/coordadjuster.h" #include "sci/graphics/palette.h" #include "sci/graphics/paint16.h" #include "sci/graphics/picture.h" diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp index 130416ff60..36026a8134 100644 --- a/engines/sci/graphics/compare.cpp +++ b/engines/sci/graphics/compare.cpp @@ -37,7 +37,7 @@ namespace Sci { -GfxCompare::GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster *coordAdjuster) +GfxCompare::GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster16 *coordAdjuster) : _segMan(segMan), _cache(cache), _screen(screen), _coordAdjuster(coordAdjuster) { } diff --git a/engines/sci/graphics/compare.h b/engines/sci/graphics/compare.h index c7005980d0..dd65b90bea 100644 --- a/engines/sci/graphics/compare.h +++ b/engines/sci/graphics/compare.h @@ -34,7 +34,7 @@ class Screen; */ class GfxCompare { public: - GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster *coordAdjuster); + GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster16 *coordAdjuster); ~GfxCompare(); uint16 kernelOnControl(byte screenMask, const Common::Rect &rect); @@ -50,7 +50,7 @@ private: SegManager *_segMan; GfxCache *_cache; GfxScreen *_screen; - GfxCoordAdjuster *_coordAdjuster; + GfxCoordAdjuster16 *_coordAdjuster; uint16 isOnControl(uint16 screenMask, const Common::Rect &rect); diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp index 93dff10382..2f22d191d0 100644 --- a/engines/sci/graphics/coordadjuster.cpp +++ b/engines/sci/graphics/coordadjuster.cpp @@ -32,9 +32,6 @@ namespace Sci { -GfxCoordAdjuster::GfxCoordAdjuster() { -} - GfxCoordAdjuster16::GfxCoordAdjuster16(GfxPorts *ports) : _ports(ports) { } @@ -83,53 +80,4 @@ Common::Rect GfxCoordAdjuster16::pictureGetDisplayArea() { return displayArea; } -#ifdef ENABLE_SCI32 -GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan) - : _segMan(segMan) { - _scriptsRunningWidth = 0; - _scriptsRunningHeight = 0; -} - -GfxCoordAdjuster32::~GfxCoordAdjuster32() { -} - -void GfxCoordAdjuster32::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) { - uint16 planeTop = readSelectorValue(_segMan, planeObject, SELECTOR(top)); - uint16 planeLeft = readSelectorValue(_segMan, planeObject, SELECTOR(left)); - - y -= planeTop; - x -= planeLeft; -} -void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) { - uint16 planeTop = readSelectorValue(_segMan, planeObject, SELECTOR(top)); - uint16 planeLeft = readSelectorValue(_segMan, planeObject, SELECTOR(left)); - - x += planeLeft; - y += planeTop; -} - -void GfxCoordAdjuster32::setScriptsResolution(uint16 width, uint16 height) { - _scriptsRunningWidth = width; - _scriptsRunningHeight = height; -} - -void GfxCoordAdjuster32::fromDisplayToScript(int16 &y, int16 &x) { - y = ((y * _scriptsRunningHeight) / g_sci->_gfxScreen->getHeight()); - x = ((x * _scriptsRunningWidth) / g_sci->_gfxScreen->getWidth()); -} - -void GfxCoordAdjuster32::fromScriptToDisplay(int16 &y, int16 &x) { - y = ((y * g_sci->_gfxScreen->getHeight()) / _scriptsRunningHeight); - x = ((x * g_sci->_gfxScreen->getWidth()) / _scriptsRunningWidth); -} - -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 cb0227fbe4..f7ebd3ec75 100644 --- a/engines/sci/graphics/coordadjuster.h +++ b/engines/sci/graphics/coordadjuster.h @@ -35,27 +35,7 @@ class GfxPorts; * most of the time sci32 doesn't do any coordinate adjustment at all * sci16 does a lot of port adjustment on given coordinates */ -class GfxCoordAdjuster { -public: - GfxCoordAdjuster(); - virtual ~GfxCoordAdjuster() { } - - virtual void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG) { } - virtual void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG) { } - - virtual Common::Rect onControl(Common::Rect rect) { return rect; } - virtual void setCursorPos(Common::Point &pos) { } - virtual void moveCursor(Common::Point &pos) { } - - virtual void setScriptsResolution(uint16 width, uint16 height) { } - virtual void fromScriptToDisplay(int16 &y, int16 &x) { } - virtual void fromDisplayToScript(int16 &y, int16 &x) { } - - virtual Common::Rect pictureGetDisplayArea() { return Common::Rect(0, 0); } -private: -}; - -class GfxCoordAdjuster16 : public GfxCoordAdjuster { +class GfxCoordAdjuster16 { public: GfxCoordAdjuster16(GfxPorts *ports); ~GfxCoordAdjuster16(); @@ -73,32 +53,6 @@ private: GfxPorts *_ports; }; -#ifdef ENABLE_SCI32 -class GfxCoordAdjuster32 : public GfxCoordAdjuster { -public: - GfxCoordAdjuster32(SegManager *segMan); - ~GfxCoordAdjuster32(); - - void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG); - void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG); - - void setScriptsResolution(uint16 width, uint16 height); - void fromScriptToDisplay(int16 &y, int16 &x); - void fromDisplayToScript(int16 &y, int16 &x); - - void pictureSetDisplayArea(Common::Rect displayArea); - Common::Rect pictureGetDisplayArea(); - -private: - SegManager *_segMan; - - Common::Rect _pictureDisplayArea; - - uint16 _scriptsRunningWidth; - uint16 _scriptsRunningHeight; -}; -#endif - } // End of namespace Sci #endif diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index f5dd473959..c3229121c8 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -80,7 +80,7 @@ GfxCursor::~GfxCursor() { kernelClearZoomZone(); } -void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, EventManager *event) { +void GfxCursor::init(GfxCoordAdjuster16 *coordAdjuster, EventManager *event) { _coordAdjuster = coordAdjuster; _event = event; } diff --git a/engines/sci/graphics/cursor.h b/engines/sci/graphics/cursor.h index 5125469cfe..c57d9dab52 100644 --- a/engines/sci/graphics/cursor.h +++ b/engines/sci/graphics/cursor.h @@ -55,7 +55,7 @@ public: GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen); ~GfxCursor(); - void init(GfxCoordAdjuster *coordAdjuster, EventManager *event); + void init(GfxCoordAdjuster16 *coordAdjuster, EventManager *event); void kernelShow(); void kernelHide(); @@ -103,7 +103,7 @@ private: ResourceManager *_resMan; GfxScreen *_screen; GfxPalette *_palette; - GfxCoordAdjuster *_coordAdjuster; + GfxCoordAdjuster16 *_coordAdjuster; EventManager *_event; int _upscaledHires; diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 333ed764b2..e690a3eb4c 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -40,7 +40,6 @@ #include "sci/engine/selector.h" #include "sci/engine/vm.h" #include "sci/graphics/cache.h" -#include "sci/graphics/coordadjuster.h" #include "sci/graphics/compare.h" #include "sci/graphics/cursor32.h" #include "sci/graphics/font.h" @@ -58,7 +57,7 @@ namespace Sci { -GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor) : +GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor) : _isHiRes(ConfMan.getBool("enable_high_resolution_graphics")), _palette(palette), _cursor(cursor), @@ -105,20 +104,6 @@ GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAd // default script width for other games is 320x200 break; } - - // TODO: Nothing in the renderer really uses this. Currently, - // the cursor renderer does, and kLocalToGlobal/kGlobalToLocal - // do, but in the real engine (1) the cursor is handled in - // frameOut, and (2) functions do a very simple lookup of the - // plane and arithmetic with the plane's gameRect. In - // principle, CoordAdjuster could be reused for - // convertGameRectToPlaneRect, but it is not super clear yet - // what the benefit would be to do that. - _coordAdjuster = (GfxCoordAdjuster32 *)coordAdjuster; - - // TODO: Script resolution is hard-coded per game; - // also this must be set or else the engine will crash - _coordAdjuster->setScriptsResolution(_currentBuffer.scriptWidth, _currentBuffer.scriptHeight); } GfxFrameout::~GfxFrameout() { diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index 92e38fa70f..05e9e4e638 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -31,7 +31,6 @@ typedef Common::Array<DrawList> ScreenItemListList; typedef Common::Array<RectList> EraseListList; class GfxCursor32; -class GfxCoordAdjuster32; class GfxTransitions32; struct PlaneShowStyle; @@ -42,13 +41,12 @@ struct PlaneShowStyle; class GfxFrameout { private: GfxCursor32 *_cursor; - GfxCoordAdjuster32 *_coordAdjuster; GfxPalette32 *_palette; ResourceManager *_resMan; SegManager *_segMan; public: - GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor); + GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor); ~GfxFrameout(); bool _isHiRes; diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index 6004e9ce7a..91817d4060 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -41,7 +41,7 @@ namespace Sci { -GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio) +GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster16 *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio) : _resMan(resMan), _segMan(segMan), _cache(cache), _ports(ports), _coordAdjuster(coordAdjuster), _screen(screen), _palette(palette), _transitions(transitions), _audio(audio), _EGAdrawingVisualize(false) { diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h index 317388b2df..6fc9cbbdfc 100644 --- a/engines/sci/graphics/paint16.h +++ b/engines/sci/graphics/paint16.h @@ -36,7 +36,7 @@ class GfxView; */ class GfxPaint16 { public: - GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio); + GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster16 *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio); ~GfxPaint16(); void init(GfxAnimate *animate, GfxText16 *text16); @@ -91,7 +91,7 @@ private: GfxAnimate *_animate; GfxCache *_cache; GfxPorts *_ports; - GfxCoordAdjuster *_coordAdjuster; + GfxCoordAdjuster16 *_coordAdjuster; GfxScreen *_screen; GfxPalette *_palette; GfxText16 *_text16; diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index 2eab391afd..0025b24476 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -35,7 +35,7 @@ namespace Sci { //#define DEBUG_PICTURE_DRAW -GfxPicture::GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize) +GfxPicture::GfxPicture(ResourceManager *resMan, GfxCoordAdjuster16 *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); diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h index 942fa0f107..1be1ae3004 100644 --- a/engines/sci/graphics/picture.h +++ b/engines/sci/graphics/picture.h @@ -38,7 +38,7 @@ enum { class GfxPorts; class GfxScreen; class GfxPalette; -class GfxCoordAdjuster; +class GfxCoordAdjuster16; class ResourceManager; class Resource; @@ -48,7 +48,7 @@ class Resource; */ class GfxPicture { public: - GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false); + GfxPicture(ResourceManager *resMan, GfxCoordAdjuster16 *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false); ~GfxPicture(); GuiResourceId getResourceId(); @@ -84,7 +84,7 @@ private: void vectorPatternTexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture); ResourceManager *_resMan; - GfxCoordAdjuster *_coordAdjuster; + GfxCoordAdjuster16 *_coordAdjuster; GfxPorts *_ports; GfxScreen *_screen; GfxPalette *_palette; diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index b0f2c52791..cb6e614657 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -633,7 +633,7 @@ reg_t GfxText16::allocAndFillReferenceRectArray() { if (rectCount) { reg_t rectArray; byte *rectArrayPtr = g_sci->getEngineState()->_segMan->allocDynmem(4 * 2 * (rectCount + 1), "text code reference rects", &rectArray); - GfxCoordAdjuster *coordAdjuster = g_sci->_gfxCoordAdjuster; + GfxCoordAdjuster16 *coordAdjuster = g_sci->_gfxCoordAdjuster; for (uint curRect = 0; curRect < rectCount; curRect++) { coordAdjuster->kernelLocalToGlobal(_codeRefRects[curRect].left, _codeRefRects[curRect].top); coordAdjuster->kernelLocalToGlobal(_codeRefRects[curRect].right, _codeRefRects[curRect].bottom); diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 1939e66179..0c09fcbb30 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -351,18 +351,6 @@ void GfxView::initData(GuiResourceId resourceId) { celData += celSize; } } -#ifdef ENABLE_SCI32 - // adjust width/height returned to scripts - if (_sci2ScaleRes != SCI_VIEW_NATIVERES_NONE) { - for (loopNo = 0; loopNo < _loopCount; loopNo++) - for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) - _screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight, _sci2ScaleRes); - } else if ((getSciVersion() >= SCI_VERSION_2_1_EARLY) && (getSciVersion() <= SCI_VERSION_2_1_LATE)) { - for (loopNo = 0; loopNo < _loopCount; loopNo++) - for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++) - _coordAdjuster->fromDisplayToScript(_loop[loopNo].cel[celNo].scriptHeight, _loop[loopNo].cel[celNo].scriptWidth); - } -#endif break; default: diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h index 96b48c0477..5e422468b5 100644 --- a/engines/sci/graphics/view.h +++ b/engines/sci/graphics/view.h @@ -92,7 +92,7 @@ private: void unditherBitmap(byte *bitmap, int16 width, int16 height, byte clearKey); ResourceManager *_resMan; - GfxCoordAdjuster *_coordAdjuster; + GfxCoordAdjuster16 *_coordAdjuster; GfxScreen *_screen; GfxPalette *_palette; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index bca1aaeb12..cb825389b2 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -732,12 +732,11 @@ void SciEngine::initGraphics() { #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2) { // SCI32 graphic objects creation - _gfxCoordAdjuster = new GfxCoordAdjuster32(_gamestate->_segMan); _gfxCursor32 = new GfxCursor32(); _gfxCompare = new GfxCompare(_gamestate->_segMan, _gfxCache, nullptr, _gfxCoordAdjuster); _gfxPaint32 = new GfxPaint32(_gamestate->_segMan); _gfxTransitions32 = new GfxTransitions32(_gamestate->_segMan); - _gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxPalette32, _gfxTransitions32, _gfxCursor32); + _gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxPalette32, _gfxTransitions32, _gfxCursor32); _gfxCursor32->init(_gfxFrameout->getCurrentBuffer()); _gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache); _gfxControls32 = new GfxControls32(_gamestate->_segMan, _gfxCache, _gfxText32); diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 001430f783..b336eb8cce 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -75,7 +75,7 @@ class GfxCache; class GfxCompare; class GfxControls16; class GfxControls32; -class GfxCoordAdjuster; +class GfxCoordAdjuster16; class GfxCursor; class GfxMacIconBar; class GfxMenu; @@ -369,7 +369,7 @@ public: GfxCompare *_gfxCompare; GfxControls16 *_gfxControls16; // Controls for 16-bit gfx GfxControls32 *_gfxControls32; // Controls for 32-bit gfx - GfxCoordAdjuster *_gfxCoordAdjuster; + GfxCoordAdjuster16 *_gfxCoordAdjuster; GfxCursor *_gfxCursor; GfxMenu *_gfxMenu; // Menu for 16-bit gfx GfxPalette *_gfxPalette16; |