aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-04 18:34:53 +0000
committerMartin Kiewitz2009-10-04 18:34:53 +0000
commit07353be65a030261f673d1816d01f08bd35c7b90 (patch)
tree648ce6b5be0eac6d8fa623c433a044b6e93a0c51
parent9d80759a71b128c45cfd5217ed14575bff003ed2 (diff)
downloadscummvm-rg350-07353be65a030261f673d1816d01f08bd35c7b90.tar.gz
scummvm-rg350-07353be65a030261f673d1816d01f08bd35c7b90.tar.bz2
scummvm-rg350-07353be65a030261f673d1816d01f08bd35c7b90.zip
SCI/newgui: invokeselector implemented into kAnimate
svn-id: r44627
-rw-r--r--engines/sci/gui/gui.cpp49
-rw-r--r--engines/sci/gui/gui.h1
-rw-r--r--engines/sci/gui/gui_gfx.cpp47
-rw-r--r--engines/sci/gui/gui_gfx.h16
4 files changed, 102 insertions, 11 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 6358c86dee..e50af6a155 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -240,7 +240,7 @@ void SciGUI::drawPicture(GUIResourceId pictureId, uint16 style, uint16 flags, in
_screen->UpdateWhole();
_gfx->SetPort(oldPort);
- _s->pic_not_valid = 1;
+ _gfx->_picNotValid = true;
}
void SciGUI::drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) {
@@ -313,7 +313,7 @@ int16 SciGUI::paletteFind(int r, int g, int b) {
}
void SciGUI::paletteAnimate(int fromColor, int toColor, int speed) {
- _gfx->animatePalette(fromColor, toColor, speed);
+ _gfx->PaletteAnimate(fromColor, toColor, speed);
}
int16 SciGUI::onControl(byte screenMask, Common::Rect rect) {
@@ -325,8 +325,49 @@ int16 SciGUI::onControl(byte screenMask, Common::Rect rect) {
return result;
}
-void SciGUI::animate(reg_t castListReference, bool cycle, int argc, reg_t *argv) {
- // FIXME: port over from gregs engine
+void SciGUI::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
+ bool old_picNotValid = _gfx->_picNotValid;
+
+ if (listReference.isNull()) {
+ _gfx->AnimateDisposeLastCast();
+ if (_gfx->_picNotValid) {
+ //(this->*ShowPic)(_showMap, _showStyle);
+ _gfx->_picNotValid = false;
+ }
+ return;
+ }
+
+ List *list = lookup_list(_s, listReference);
+ if (!list) {
+ error("kAnimate called with non-list as parameter");
+ }
+
+ if (cycle) {
+ _gfx->AnimateInvoke(list, argc, argv);
+ }
+
+ GUIPort *oldPort = _gfx->SetPort((GUIPort *)_windowMgr->_picWind);
+ _gfx->AnimateDisposeLastCast();
+
+ _gfx->AnimateFill();
+
+ _gfx->AnimateSort();
+ if (old_picNotValid) {
+ _gfx->AnimateUpdate();
+ }
+
+ _gfx->AnimateDrawCells();
+
+ if (_gfx->_picNotValid) {
+ //(this->*ShowPic)(_showMap, _showStyle);
+ _gfx->_picNotValid = false;
+ }
+
+ //_gfx->AnimateUpdateScreen();
+ _screen->UpdateWhole();
+ _gfx->AnimateRestoreAndDelete();
+
+ _gfx->SetPort(oldPort);
}
void SciGUI::addToPicList(reg_t listReference, int argc, reg_t *argv) {
diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h
index df57cb600a..59050b8e4a 100644
--- a/engines/sci/gui/gui.h
+++ b/engines/sci/gui/gui.h
@@ -75,7 +75,6 @@ public:
virtual void paletteAnimate(int fromColor, int toColor, int speed);
virtual int16 onControl(byte screenMask, Common::Rect rect);
- // FIXME: argc/argv because of gui32.cpp, should get removed sometime
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, GUIViewCellNo cellNo, int16 leftPos, int16 topPos, int16 priority, int16 control);
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index e16fd7f105..deefa6005f 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -53,6 +53,8 @@ void SciGUIgfx::init() {
_textFonts = NULL; _textFontsCount = 0;
_textColors = NULL; _textColorsCount = 0;
+ _picNotValid = false;
+
_mainPort = mallocPort();
SetPort(_mainPort);
OpenPort(_mainPort);
@@ -209,7 +211,7 @@ void SciGUIgfx::SetPalette(GUIPalette *sciPal, int16 flag) {
if (flag == 2 || sciPal->timestamp != systime) {
MergePalettes(sciPal, &_sysPalette, flag);
sciPal->timestamp = _sysPalette.timestamp;
- if (_s->pic_not_valid == 0 && systime != _sysPalette.timestamp)
+ if (_picNotValid == 0 && systime != _sysPalette.timestamp)
SetCLUT(&_sysPalette);
}
}
@@ -1222,7 +1224,7 @@ void SciGUIgfx::drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCell
}
}
-void SciGUIgfx::animatePalette(byte fromColor, byte toColor, int speed) {
+void SciGUIgfx::PaletteAnimate(byte fromColor, byte toColor, int speed) {
GUIColor col;
int len = toColor - fromColor - 1;
uint32 now = _sysTicks;
@@ -1287,6 +1289,47 @@ static inline int sign_extend_byte(int value) {
return value;
}
+void SciGUIgfx::AnimateDisposeLastCast() {
+ // FIXME
+ //if (!_lastCast->first.isNull())
+ //_lastCast->DeleteList();
+}
+
+void SciGUIgfx::AnimateInvoke(List *list, int argc, reg_t *argv) {
+ reg_t curAddress = list->first;
+ Node *curNode = lookup_node(_s, curAddress);
+ reg_t curObject;
+ //uint16 mask;
+
+ while (curNode) {
+ curObject = curNode->value;
+// FIXME: check what this code does and remove it or fix it, gregs engine had this check included
+// mask = cobj[_objOfs[2]];
+// if ((mask & 0x100) == 0) {
+ invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argv, argc, __FILE__, __LINE__, 0);
+ // Lookup node again, since the nodetable it was in may have been reallocated
+ curNode = lookup_node(_s, curAddress);
+// }
+ curAddress = curNode->succ;
+ curNode = lookup_node(_s, curAddress);
+ }
+}
+
+void SciGUIgfx::AnimateFill() {
+}
+
+void SciGUIgfx::AnimateSort() {
+}
+
+void SciGUIgfx::AnimateUpdate() {
+}
+
+void SciGUIgfx::AnimateDrawCells() {
+}
+
+void SciGUIgfx::AnimateRestoreAndDelete() {
+}
+
void SciGUIgfx::SetNowSeen(reg_t objectReference) {
SegManager *segMan = _s->segMan;
SciGUIview *view = NULL;
diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h
index eda100d751..cd9a12358f 100644
--- a/engines/sci/gui/gui_gfx.h
+++ b/engines/sci/gui/gui_gfx.h
@@ -110,9 +110,16 @@ public:
void drawPicture(GUIResourceId pictureId, uint16 style, bool addToFlag, GUIResourceId paletteId);
void drawCell(GUIResourceId viewId, GUIViewLoopNo loopNo, GUIViewCellNo cellNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo);
- void animatePalette(byte fromColor, byte toColor, int speed);
+ void PaletteAnimate(byte fromColor, byte toColor, int speed);
int16 onControl(uint16 screenMask, Common::Rect rect);
+ void AnimateDisposeLastCast();
+ void AnimateInvoke(List *list, int argc, reg_t *argv);
+ void AnimateFill();
+ void AnimateSort();
+ void AnimateUpdate();
+ void AnimateDrawCells();
+ void AnimateRestoreAndDelete();
void SetNowSeen(reg_t objectReference);
GUIPort *_menuPort;
@@ -120,9 +127,7 @@ public:
int32 _sysSpeed; // ticker timer in ms
GUIPalette _sysPalette;
- uint16 _resolutionWidth;
- uint16 _resolutionHeight;
- uint _resolutionPixels;
+ bool _picNotValid;
private:
int16 TextCodeProcessing(const char *&text, GUIResourceId orgFontId, int16 orgPenColor);
@@ -150,6 +155,9 @@ private:
int _textColorsCount;
uint16 *_textColors;
+ // Animate* related variables
+ List *_lastCast;
+
SciGUIfont *_font;
};