aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-02-05 20:44:03 +0000
committerMartin Kiewitz2010-02-05 20:44:03 +0000
commit248bc560f32ee78a25e606b8ff54a449be6bf6e2 (patch)
treeefe49c14d8329942ea2f6e66e671d8ab55b8b2c6 /engines
parent779fc7dc193d5ad360d02ccd33a86ea021f2e138 (diff)
downloadscummvm-rg350-248bc560f32ee78a25e606b8ff54a449be6bf6e2.tar.gz
scummvm-rg350-248bc560f32ee78a25e606b8ff54a449be6bf6e2.tar.bz2
scummvm-rg350-248bc560f32ee78a25e606b8ff54a449be6bf6e2.zip
SCI: moved onControl etc. into GfxCompare, now getting called directly. also fixed loading saved games due Gfx* changes
svn-id: r47912
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp39
-rw-r--r--engines/sci/engine/savegame.cpp5
-rw-r--r--engines/sci/engine/state.h2
-rw-r--r--engines/sci/graphics/compare.cpp78
-rw-r--r--engines/sci/graphics/compare.h14
-rw-r--r--engines/sci/graphics/coordadjuster.cpp16
-rw-r--r--engines/sci/graphics/coordadjuster.h8
-rw-r--r--engines/sci/graphics/gui.cpp84
-rw-r--r--engines/sci/graphics/gui.h6
-rw-r--r--engines/sci/graphics/gui32.cpp75
-rw-r--r--engines/sci/graphics/gui32.h1
11 files changed, 126 insertions, 202 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 0b6cd7e6fc..a41a536d63 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -38,6 +38,7 @@
#include "sci/graphics/gui32.h"
#include "sci/graphics/animate.h"
#include "sci/graphics/cache.h"
+#include "sci/graphics/compare.h"
#include "sci/graphics/controls.h"
#include "sci/graphics/cursor.h"
#include "sci/graphics/palette.h"
@@ -403,15 +404,8 @@ reg_t kDirLoop(EngineState *s, int argc, reg_t *argv) {
reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv) {
reg_t curObject = argv[0];
reg_t listReference = (argc > 1) ? argv[1] : NULL_REG;
- bool canBeHere;
-
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- canBeHere = s->_gui32->canBeHere(curObject, listReference);
- else
-#endif
- canBeHere = s->_gui->canBeHere(curObject, listReference);
-
+
+ bool canBeHere = s->_gfxCompare->kernelCanBeHere(curObject, listReference);
return make_reg(0, canBeHere);
}
@@ -419,15 +413,8 @@ reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv) {
reg_t kCantBeHere(EngineState *s, int argc, reg_t *argv) {
reg_t curObject = argv[0];
reg_t listReference = (argc > 1) ? argv[1] : NULL_REG;
- bool canBeHere;
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- canBeHere = s->_gui32->canBeHere(curObject, listReference);
- else
-#endif
- canBeHere = s->_gui->canBeHere(curObject, listReference);
-
+ bool canBeHere = s->_gfxCompare->kernelCanBeHere(curObject, listReference);
return make_reg(0, !canBeHere);
}
@@ -437,7 +424,7 @@ reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv) {
int16 celNo = argv[2].toSint16();
Common::Point position(argv[4].toUint16(), argv[3].toUint16());
- bool result = s->_gui->isItSkip(viewId, loopNo, celNo, position);
+ bool result = s->_gfxCompare->kernelIsItSkip(viewId, loopNo, celNo, position);
return make_reg(0, result);
}
@@ -512,7 +499,7 @@ reg_t kOnControl(EngineState *s, int argc, reg_t *argv) {
rect.right = rect.left + 1;
rect.bottom = rect.top + 1;
}
- uint16 result = s->_gui->onControl(screenMask, rect);
+ uint16 result = s->_gfxCompare->kernelOnControl(screenMask, rect);
return make_reg(0, result);
}
@@ -553,12 +540,7 @@ reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) {
reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) {
reg_t object = argv[0];
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->baseSetter(object);
- else
-#endif
- s->_gui->baseSetter(object);
+ s->_gfxCompare->kernelBaseSetter(object);
// WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened,
// till the actual problem is found
@@ -571,12 +553,7 @@ reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) {
}
reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) {
-#ifdef ENABLE_SCI32
- if (s->_gui32)
- s->_gui32->setNowSeen(argv[0]);
- else
-#endif
- s->_gui->setNowSeen(argv[0]);
+ s->_gfxCompare->kernelSetNowSeen(argv[0]);
return s->r_acc;
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 377c676392..445bab573c 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -945,8 +945,12 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->_gfxAnimate = s->_gfxAnimate;
retval->_gfxCache = s->_gfxCache;
+ retval->_gfxCompare = s->_gfxCompare;
retval->_gfxControls = s->_gfxControls;
+ retval->_gfxCoordAdjuster = s->_gfxCoordAdjuster;
+ retval->_gfxCursor = s->_gfxCursor;
retval->_gfxMenu = s->_gfxMenu;
+ retval->_gfxPaint16 = s->_gfxPaint16;
retval->_gfxPalette = s->_gfxPalette;
retval->_gfxPorts = s->_gfxPorts;
retval->_gfxScreen = s->_gfxScreen;
@@ -954,6 +958,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
#ifdef ENABLE_SCI32
// Copy the Gui32 pointer over to the new EngineState, if it exists
retval->_gui32 = s->_gui32;
+ retval->_gfxFrameout = s->_gfxFrameout;
#endif
// Copy some old data
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index d2981b4a89..cb5dc023c9 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -53,6 +53,7 @@ namespace Sci {
class SciEvent;
class GfxAnimate;
class GfxCache;
+class GfxCompare;
class GfxControls;
class GfxCoordAdjuster;
class GfxCursor;
@@ -147,6 +148,7 @@ public:
GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
GfxCache *_gfxCache;
+ GfxCompare *_gfxCompare;
GfxControls *_gfxControls; // Controls for 16-bit gfx
GfxCoordAdjuster *_gfxCoordAdjuster;
GfxCursor *_gfxCursor;
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index 194dc7f374..82a5d04c44 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -31,6 +31,7 @@
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
#include "sci/graphics/compare.h"
+#include "sci/graphics/coordadjuster.h"
#include "sci/graphics/animate.h"
#include "sci/graphics/cache.h"
#include "sci/graphics/screen.h"
@@ -38,14 +39,14 @@
namespace Sci {
-GfxCompare::GfxCompare(SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen)
- : _segMan(segMan), _kernel(kernel), _cache(cache), _screen(screen) {
+GfxCompare::GfxCompare(SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster *coordAdjuster)
+ : _segMan(segMan), _kernel(kernel), _cache(cache), _screen(screen), _coordAdjuster(coordAdjuster) {
}
GfxCompare::~GfxCompare() {
}
-uint16 GfxCompare::onControl(uint16 screenMask, Common::Rect rect) {
+uint16 GfxCompare::isOnControl(uint16 screenMask, Common::Rect rect) {
int16 x, y;
uint16 result = 0;
@@ -75,7 +76,7 @@ static inline int sign_extend_byte(int value) {
return value;
}
-bool GfxCompare::CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect, List *list) {
+bool GfxCompare::canBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect, List *list) {
reg_t curAddress = list->first;
Node *curNode = _segMan->lookupNode(curAddress);
reg_t curObject;
@@ -103,7 +104,14 @@ bool GfxCompare::CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRec
return true;
}
-void GfxCompare::SetNowSeen(reg_t objectReference) {
+uint16 GfxCompare::kernelOnControl(byte screenMask, Common::Rect rect) {
+ Common::Rect adjustedRect = _coordAdjuster->onControl(rect);
+
+ uint16 result = isOnControl(screenMask, adjustedRect);
+ return result;
+}
+
+void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
GfxView *view = NULL;
Common::Rect celRect(0, 0);
GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, view);
@@ -128,4 +136,64 @@ void GfxCompare::SetNowSeen(reg_t objectReference) {
}
}
+bool GfxCompare::kernelCanBeHere(reg_t curObject, reg_t listReference) {
+ Common::Rect checkRect;
+ Common::Rect adjustedRect;
+ uint16 signal, controlMask;
+ bool result;
+
+ checkRect.left = GET_SEL32V(_segMan, curObject, brLeft);
+ checkRect.top = GET_SEL32V(_segMan, curObject, brTop);
+ checkRect.right = GET_SEL32V(_segMan, curObject, brRight);
+ checkRect.bottom = GET_SEL32V(_segMan, curObject, brBottom);
+
+ adjustedRect = _coordAdjuster->onControl(checkRect);
+
+ signal = GET_SEL32V(_segMan, curObject, signal);
+ controlMask = GET_SEL32V(_segMan, curObject, illegalBits);
+ result = (isOnControl(SCI_SCREEN_MASK_CONTROL, adjustedRect) & controlMask) ? false : true;
+ if ((result) && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) {
+ List *list = _segMan->lookupList(listReference);
+ if (!list)
+ error("kCanBeHere called with non-list as parameter");
+
+ result = canBeHereCheckRectList(curObject, checkRect, list);
+ }
+ return result;
+}
+
+bool GfxCompare::kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position) {
+ GfxView *tmpView = _cache->getView(viewId);
+ CelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo);
+ position.x = CLIP<int>(position.x, 0, celInfo->width - 1);
+ position.y = CLIP<int>(position.y, 0, celInfo->height - 1);
+ byte *celData = tmpView->getBitmap(loopNo, celNo);
+ bool result = (celData[position.y * celInfo->width + position.x] == celInfo->clearKey);
+ return result;
+}
+
+void GfxCompare::kernelBaseSetter(reg_t object) {
+ if (lookup_selector(_segMan, object, _kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) {
+ int16 x = GET_SEL32V(_segMan, object, x);
+ int16 y = GET_SEL32V(_segMan, object, y);
+ int16 z = (_kernel->_selectorCache.z > -1) ? GET_SEL32V(_segMan, object, z) : 0;
+ int16 yStep = GET_SEL32V(_segMan, object, yStep);
+ GuiResourceId viewId = GET_SEL32V(_segMan, object, view);
+ int16 loopNo = GET_SEL32V(_segMan, object, loop);
+ int16 celNo = GET_SEL32V(_segMan, object, cel);
+
+ GfxView *tmpView = _cache->getView(viewId);
+ Common::Rect celRect;
+
+ tmpView->getCelRect(loopNo, celNo, x, y, z, &celRect);
+ celRect.bottom = y + 1;
+ celRect.top = celRect.bottom - yStep;
+
+ PUT_SEL32V(_segMan, object, brLeft, celRect.left);
+ PUT_SEL32V(_segMan, object, brRight, celRect.right);
+ PUT_SEL32V(_segMan, object, brTop, celRect.top);
+ PUT_SEL32V(_segMan, object, brBottom, celRect.bottom);
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/compare.h b/engines/sci/graphics/compare.h
index a825667b97..51752b9513 100644
--- a/engines/sci/graphics/compare.h
+++ b/engines/sci/graphics/compare.h
@@ -39,18 +39,24 @@ class Screen;
*/
class GfxCompare {
public:
- GfxCompare(SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen);
+ GfxCompare(SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster *coordAdjuster);
~GfxCompare();
- uint16 onControl(uint16 screenMask, Common::Rect rect);
- bool CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect, List *list);
- void SetNowSeen(reg_t objectReference);
+ uint16 isOnControl(uint16 screenMask, Common::Rect rect);
+ bool canBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect, List *list);
+
+ uint16 kernelOnControl(byte screenMask, Common::Rect rect);
+ void kernelSetNowSeen(reg_t objectReference);
+ bool kernelCanBeHere(reg_t curObject, reg_t listReference);
+ bool kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
+ void kernelBaseSetter(reg_t object);
private:
SegManager *_segMan;
Kernel *_kernel;
GfxCache *_cache;
GfxScreen *_screen;
+ GfxCoordAdjuster *_coordAdjuster;
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp
index 44a8e60f49..1c5207b2b4 100644
--- a/engines/sci/graphics/coordadjuster.cpp
+++ b/engines/sci/graphics/coordadjuster.cpp
@@ -55,6 +55,16 @@ void GfxCoordAdjuster16::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObje
y += curPort->top;
}
+Common::Rect GfxCoordAdjuster16::onControl(Common::Rect rect) {
+ Port *oldPort = _ports->setPort((Port *)_ports->_picWind);
+ Common::Rect adjustedRect(rect.left, rect.top, rect.right, rect.bottom);
+
+ adjustedRect.clip(_ports->getPort()->rect);
+ _ports->offsetRect(adjustedRect);
+ _ports->setPort(oldPort);
+ return adjustedRect;
+}
+
#ifdef ENABLE_SCI32
GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan)
: _segMan(segMan) {
@@ -79,6 +89,12 @@ void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObje
//*x = ( *x * resX) / _screen->getWidth();
//*y = ( *y * resY) / _screen->getHeight();
}
+
+Common::Rect GfxCoordAdjuster32::onControl(Common::Rect rect) {
+ Common::Rect adjustedRect = rect;
+ adjustedRect.translate(0, 10);
+ return adjustedRect;
+}
#endif
} // End of namespace Sci
diff --git a/engines/sci/graphics/coordadjuster.h b/engines/sci/graphics/coordadjuster.h
index 61bad70c75..4c9cc1a11a 100644
--- a/engines/sci/graphics/coordadjuster.h
+++ b/engines/sci/graphics/coordadjuster.h
@@ -46,6 +46,8 @@ public:
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; };
+
private:
};
@@ -56,9 +58,13 @@ public:
void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
+
+ Common::Rect onControl(Common::Rect rect);
private:
GfxPorts *_ports;
+
+ Port *backuppedPort;
};
#ifdef ENABLE_SCI32
@@ -69,6 +75,8 @@ public:
void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
+
+ Common::Rect onControl(Common::Rect rect);
private:
SegManager *_segMan;
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index 941278f2fc..4227f1a9de 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -56,7 +56,8 @@ SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCa
_coordAdjuster = new GfxCoordAdjuster16(_ports);
_s->_gfxCoordAdjuster = _coordAdjuster;
- _compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen);
+ _compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen, _coordAdjuster);
+ _s->_gfxCompare = _compare;
_transitions = new GfxTransitions(this, _screen, _palette, _s->resMan->isVGA());
_paint16 = new GfxPaint16(_s->resMan, _s->_segMan, _s->_kernel, _cache, _ports, _coordAdjuster, _screen, _palette, _transitions);
_s->_gfxPaint = _paint16;
@@ -290,87 +291,6 @@ void SciGui::shakeScreen(uint16 shakeCount, uint16 directions) {
}
}
-uint16 SciGui::onControl(byte screenMask, Common::Rect rect) {
- Port *oldPort = _ports->setPort((Port *)_ports->_picWind);
- Common::Rect adjustedRect(rect.left, rect.top, rect.right, rect.bottom);
- uint16 result;
-
- adjustedRect.clip(_ports->getPort()->rect);
- _ports->offsetRect(adjustedRect);
- result = _compare->onControl(screenMask, adjustedRect);
-
- _ports->setPort(oldPort);
- return result;
-}
-
-void SciGui::setNowSeen(reg_t objectReference) {
- _compare->SetNowSeen(objectReference);
-}
-
-bool SciGui::canBeHere(reg_t curObject, reg_t listReference) {
- Port *oldPort = _ports->setPort((Port *)_ports->_picWind);
- Common::Rect checkRect;
- Common::Rect adjustedRect;
- uint16 signal, controlMask;
- bool result;
-
- checkRect.left = GET_SEL32V(_s->_segMan, curObject, brLeft);
- checkRect.top = GET_SEL32V(_s->_segMan, curObject, brTop);
- checkRect.right = GET_SEL32V(_s->_segMan, curObject, brRight);
- checkRect.bottom = GET_SEL32V(_s->_segMan, curObject, brBottom);
-
- adjustedRect = checkRect;
- adjustedRect.clip(_ports->getPort()->rect);
- _ports->offsetRect(adjustedRect);
-
- signal = GET_SEL32V(_s->_segMan, curObject, signal);
- controlMask = GET_SEL32V(_s->_segMan, curObject, illegalBits);
- result = (_compare->onControl(SCI_SCREEN_MASK_CONTROL, adjustedRect) & controlMask) ? false : true;
- if ((result) && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) {
- List *list = _s->_segMan->lookupList(listReference);
- if (!list)
- error("kCanBeHere called with non-list as parameter");
-
- result = _compare->CanBeHereCheckRectList(curObject, checkRect, list);
- }
- _ports->setPort(oldPort);
- return result;
-}
-
-bool SciGui::isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position) {
- GfxView *tmpView = _cache->getView(viewId);
- CelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo);
- position.x = CLIP<int>(position.x, 0, celInfo->width - 1);
- position.y = CLIP<int>(position.y, 0, celInfo->height - 1);
- byte *celData = tmpView->getBitmap(loopNo, celNo);
- bool result = (celData[position.y * celInfo->width + position.x] == celInfo->clearKey);
- return result;
-}
-
-void SciGui::baseSetter(reg_t object) {
- if (lookup_selector(_s->_segMan, object, _s->_kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) {
- int16 x = GET_SEL32V(_s->_segMan, object, x);
- int16 y = GET_SEL32V(_s->_segMan, object, y);
- int16 z = (_s->_kernel->_selectorCache.z > -1) ? GET_SEL32V(_s->_segMan, object, z) : 0;
- int16 yStep = GET_SEL32V(_s->_segMan, object, yStep);
- GuiResourceId viewId = GET_SEL32V(_s->_segMan, object, view);
- int16 loopNo = GET_SEL32V(_s->_segMan, object, loop);
- int16 celNo = GET_SEL32V(_s->_segMan, object, cel);
-
- GfxView *tmpView = _cache->getView(viewId);
- Common::Rect celRect;
-
- tmpView->getCelRect(loopNo, celNo, x, y, z, &celRect);
- celRect.bottom = y + 1;
- celRect.top = celRect.bottom - yStep;
-
- PUT_SEL32V(_s->_segMan, object, brLeft, celRect.left);
- PUT_SEL32V(_s->_segMan, object, brRight, celRect.right);
- PUT_SEL32V(_s->_segMan, object, brTop, celRect.top);
- PUT_SEL32V(_s->_segMan, object, brBottom, celRect.bottom);
- }
-}
-
void SciGui::setCursorPos(Common::Point pos) {
pos.y += _ports->getPort()->top;
pos.x += _ports->getPort()->left;
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index 93e49df3a9..6c3c3f13e2 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -79,12 +79,6 @@ public:
virtual void shakeScreen(uint16 shakeCount, uint16 directions);
- virtual uint16 onControl(byte screenMask, Common::Rect rect);
- virtual void setNowSeen(reg_t objectReference);
- virtual bool canBeHere(reg_t curObject, reg_t listReference);
- virtual bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
- virtual void baseSetter(reg_t object);
-
virtual void setCursorPos(Common::Point pos);
virtual void moveCursor(Common::Point pos);
void setCursorZone(Common::Rect zone);
diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp
index 031544e663..c7e21015b4 100644
--- a/engines/sci/graphics/gui32.cpp
+++ b/engines/sci/graphics/gui32.cpp
@@ -51,7 +51,8 @@ SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, G
_coordAdjuster = new GfxCoordAdjuster32(_s->_segMan);
_s->_gfxCoordAdjuster = _coordAdjuster;
- _compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen);
+ _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);
_s->_gfxPaint = _paint32;
_frameout = new GfxFrameout(_s->_segMan, _s->resMan, _cache, _screen, _palette, _paint32);
@@ -91,78 +92,6 @@ void SciGui32::shakeScreen(uint16 shakeCount, uint16 directions) {
}
}
-uint16 SciGui32::onControl(byte screenMask, Common::Rect rect) {
- Common::Rect adjustedRect = rect;
- uint16 result;
-
- adjustedRect.translate(0, 10);
-
- result = _compare->onControl(screenMask, rect);
- return result;
-}
-
-void SciGui32::setNowSeen(reg_t objectReference) {
- _compare->SetNowSeen(objectReference);
-}
-
-bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
- Common::Rect checkRect;
- uint16 signal, controlMask;
- bool result;
-
- checkRect.left = GET_SEL32V(_s->_segMan, curObject, brLeft);
- checkRect.top = GET_SEL32V(_s->_segMan, curObject, brTop);
- checkRect.right = GET_SEL32V(_s->_segMan, curObject, brRight);
- checkRect.bottom = GET_SEL32V(_s->_segMan, curObject, brBottom);
- signal = GET_SEL32V(_s->_segMan, curObject, signal);
- controlMask = GET_SEL32V(_s->_segMan, curObject, illegalBits);
- result = (_compare->onControl(SCI_SCREEN_MASK_CONTROL, checkRect) & controlMask) ? false : true;
- if ((result)) { // gui16 && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) {
- List *list = _s->_segMan->lookupList(listReference);
- if (!list)
- error("kCanBeHere called with non-list as parameter");
-
- result = _compare->CanBeHereCheckRectList(curObject, checkRect, list);
- }
- return result;
-}
-
-bool SciGui32::isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position) {
- GfxView *tmpView = _cache->getView(viewId);
- CelInfo *celInfo = tmpView->getCelInfo(loopNo, celNo);
- position.x = CLIP<int>(position.x, 0, celInfo->width - 1);
- position.y = CLIP<int>(position.y, 0, celInfo->height - 1);
- byte *celData = tmpView->getBitmap(loopNo, celNo);
- bool result = (celData[position.y * celInfo->width + position.x] == celInfo->clearKey);
- return result;
-}
-
-void SciGui32::baseSetter(reg_t object) {
- if (lookup_selector(_s->_segMan, object, _s->_kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) {
- int16 x = GET_SEL32V(_s->_segMan, object, x);
- int16 y = GET_SEL32V(_s->_segMan, object, y);
- int16 z = (_s->_kernel->_selectorCache.z > -1) ? GET_SEL32V(_s->_segMan, object, z) : 0;
- int16 yStep = GET_SEL32V(_s->_segMan, object, yStep);
- GuiResourceId viewId = GET_SEL32V(_s->_segMan, object, view);
- int16 loopNo = GET_SEL32V(_s->_segMan, object, loop);
- int16 celNo = GET_SEL32V(_s->_segMan, object, cel);
-
- if (viewId != SIGNAL_OFFSET) {
- GfxView *tmpView = _cache->getView(viewId);
- Common::Rect celRect;
-
- tmpView->getCelRect(loopNo, celNo, x, y, z, &celRect);
- celRect.bottom = y + 1;
- celRect.top = celRect.bottom - yStep;
-
- PUT_SEL32V(_s->_segMan, object, brLeft, celRect.left);
- PUT_SEL32V(_s->_segMan, object, brRight, celRect.right);
- PUT_SEL32V(_s->_segMan, object, brTop, celRect.top);
- PUT_SEL32V(_s->_segMan, object, brBottom, celRect.bottom);
- }
- }
-}
-
void SciGui32::setCursorPos(Common::Point pos) {
//pos.y += _gfx->GetPort()->top;
//pos.x += _gfx->GetPort()->left;
diff --git a/engines/sci/graphics/gui32.h b/engines/sci/graphics/gui32.h
index 6d9eed5b8e..e4b431df11 100644
--- a/engines/sci/graphics/gui32.h
+++ b/engines/sci/graphics/gui32.h
@@ -50,7 +50,6 @@ public:
void shakeScreen(uint16 shakeCount, uint16 directions);
- uint16 onControl(byte screenMask, Common::Rect rect);
void setNowSeen(reg_t objectReference);
bool canBeHere(reg_t curObject, reg_t listReference);
bool isItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);