aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-09 16:51:10 +0000
committerMartin Kiewitz2009-10-09 16:51:10 +0000
commitab1184770b4b53f4f16af51813a5e03c53139e1b (patch)
tree222b6f85d8dbda30df543e06eb30cab888a3ee87 /engines/sci/gui
parent15e427c2c2a8482edd4352d3051d6b00e685dce3 (diff)
downloadscummvm-rg350-ab1184770b4b53f4f16af51813a5e03c53139e1b.tar.gz
scummvm-rg350-ab1184770b4b53f4f16af51813a5e03c53139e1b.tar.bz2
scummvm-rg350-ab1184770b4b53f4f16af51813a5e03c53139e1b.zip
SCI/newgui: kCanBeHere partially implemented, little corrections
svn-id: r44832
Diffstat (limited to 'engines/sci/gui')
-rw-r--r--engines/sci/gui/gui.cpp25
-rw-r--r--engines/sci/gui/gui.h3
-rw-r--r--engines/sci/gui/gui_gfx.cpp18
-rw-r--r--engines/sci/gui/gui_gfx.h16
-rw-r--r--engines/sci/gui/gui_picture.cpp4
5 files changed, 44 insertions, 22 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 5ef2cf9575..45145c5958 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -375,9 +375,9 @@ void SciGui::paletteAnimate(int fromColor, int toColor, int speed) {
_palette->animate(fromColor, toColor, speed);
}
-int16 SciGui::onControl(byte screenMask, Common::Rect rect) {
+uint16 SciGui::onControl(byte screenMask, Common::Rect rect) {
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind);
- int16 result;
+ uint16 result;
result = _gfx->onControl(screenMask, rect);
_gfx->SetPort(oldPort);
@@ -471,6 +471,27 @@ void SciGui::setNowSeen(reg_t objectReference) {
_gfx->SetNowSeen(objectReference);
}
+bool SciGui::canBeHere(reg_t curObject, reg_t listReference) {
+ SegManager *segMan = _s->_segMan;
+ GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind);
+ Common::Rect checkRect;
+ uint16 signal, controlMask;
+ bool result;
+
+ checkRect.left = GET_SEL32V(curObject, brLeft);
+ checkRect.top = GET_SEL32V(curObject, brTop);
+ checkRect.right = GET_SEL32V(curObject, brRight);
+ checkRect.bottom = GET_SEL32V(curObject, brBottom);
+ signal = GET_SEL32V(curObject, signal);
+ controlMask = GET_SEL32V(curObject, illegalBits);
+ result = (_gfx->onControl(SCI_SCREEN_MASK_CONTROL, checkRect) & controlMask) ? false : true;
+ if ((!result) && (signal & (SCI_ANIMATE_SIGNAL_IGNOREACTOR | SCI_ANIMATE_SIGNAL_REMOVEVIEW))) {
+ result = true;
+ }
+ _gfx->SetPort(oldPort);
+ return result;
+}
+
void SciGui::hideCursor() {
_cursor->hide();
}
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index caeda61d6c..47a038a8b3 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -82,11 +82,12 @@ public:
virtual void paletteSetIntensity(int fromColor, int toColor, int intensity, bool setPalette);
virtual void paletteAnimate(int fromColor, int toColor, int speed);
- virtual int16 onControl(byte screenMask, Common::Rect rect);
+ virtual uint16 onControl(byte screenMask, Common::Rect rect);
virtual void animate(reg_t listReference, bool cycle, int argc, reg_t *argv);
virtual void addToPicList(reg_t listReference, int argc, reg_t *argv);
virtual void addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
virtual void setNowSeen(reg_t objectReference);
+ virtual bool canBeHere(reg_t curObject, reg_t listReference);
virtual void hideCursor();
virtual void showCursor();
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index b296668acd..6f1c03a73e 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -1040,10 +1040,10 @@ void SciGuiGfx::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo
}
}
-int16 SciGuiGfx::onControl(uint16 screenMask, Common::Rect rect) {
+uint16 SciGuiGfx::onControl(uint16 screenMask, Common::Rect rect) {
Common::Rect outRect(rect.left, rect.top, rect.right, rect.bottom);
int16 x, y;
- int16 result = 0;
+ uint16 result = 0;
outRect.clip(_curPort->rect);
if (outRect.isEmpty()) // nothing to control
@@ -1123,20 +1123,6 @@ void SciGuiGfx::AnimateDisposeLastCast() {
//_lastCast->DeleteList();
}
-enum {
- SCI_ANIMATE_SIGNAL_STOPUPDATE = 0x0001,
- SCI_ANIMATE_SIGNAL_VIEWUPDATED = 0x0002,
- SCI_ANIMATE_SIGNAL_NOUPDATE = 0x0004,
- SCI_ANIMATE_SIGNAL_HIDDEN = 0x0008,
- SCI_ANIMATE_SIGNAL_FIXEDPRIORITY = 0x0010,
- SCI_ANIMATE_SIGNAL_ALWAYSUPDATE = 0x0020,
- SCI_ANIMATE_SIGNAL_FORCEUPDATE = 0x0040,
- SCI_ANIMATE_SIGNAL_REMOVEVIEW = 0x0080,
- SCI_ANIMATE_SIGNAL_FROZEN = 0x0100,
- SCI_ANIMATE_SIGNAL_IGNOREACTOR = 0x4000,
- SCI_ANIMATE_SIGNAL_DISPOSEME = 0x8000
-};
-
void SciGuiGfx::AnimateInvoke(List *list, int argc, reg_t *argv) {
SegManager *segMan = _s->_segMan;
reg_t curAddress = list->first;
diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h
index 4e9f0b2288..51d43439bf 100644
--- a/engines/sci/gui/gui_gfx.h
+++ b/engines/sci/gui/gui_gfx.h
@@ -34,6 +34,20 @@ namespace Sci {
#define SCI_PATTERN_CODE_USE_TEXTURE 0x20
#define SCI_PATTERN_CODE_PENSIZE 0x07
+enum {
+ SCI_ANIMATE_SIGNAL_STOPUPDATE = 0x0001,
+ SCI_ANIMATE_SIGNAL_VIEWUPDATED = 0x0002,
+ SCI_ANIMATE_SIGNAL_NOUPDATE = 0x0004,
+ SCI_ANIMATE_SIGNAL_HIDDEN = 0x0008,
+ SCI_ANIMATE_SIGNAL_FIXEDPRIORITY = 0x0010,
+ SCI_ANIMATE_SIGNAL_ALWAYSUPDATE = 0x0020,
+ SCI_ANIMATE_SIGNAL_FORCEUPDATE = 0x0040,
+ SCI_ANIMATE_SIGNAL_REMOVEVIEW = 0x0080,
+ SCI_ANIMATE_SIGNAL_FROZEN = 0x0100,
+ SCI_ANIMATE_SIGNAL_IGNOREACTOR = 0x4000,
+ SCI_ANIMATE_SIGNAL_DISPOSEME = 0x8000
+};
+
class SciGuiScreen;
class SciGuiPalette;
class SciGuiFont;
@@ -99,7 +113,7 @@ public:
void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo);
- int16 onControl(uint16 screenMask, Common::Rect rect);
+ uint16 onControl(uint16 screenMask, Common::Rect rect);
void PriorityBandsInit(int16 top, int16 bottom);
void PriorityBandsInit(byte *data);
diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp
index 15387d05d9..4a093be42e 100644
--- a/engines/sci/gui/gui_picture.cpp
+++ b/engines/sci/gui/gui_picture.cpp
@@ -336,7 +336,7 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) {
break;
case PIC_OP_SET_PRIORITY:
- pic_priority = data[curPos++];
+ pic_priority = data[curPos++] & 0x0F;
if (isEGA) {
pic_priority = EGApriority[pic_priority];
}
@@ -346,7 +346,7 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) {
break;
case PIC_OP_SET_CONTROL:
- pic_control = data[curPos++];
+ pic_control = data[curPos++] & 0x0F;
break;
case PIC_OP_DISABLE_CONTROL:
pic_control = 255;