aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-10-19 13:26:13 +0000
committerMartin Kiewitz2009-10-19 13:26:13 +0000
commit4ac5e3512501a8effee878bd072caf7875cf20b3 (patch)
tree5ef54be82f68d566daad9bc28a95afddb0ab7da5
parenta4704352e4854af6d9ad00ba75178a238f1e8033 (diff)
downloadscummvm-rg350-4ac5e3512501a8effee878bd072caf7875cf20b3.tar.gz
scummvm-rg350-4ac5e3512501a8effee878bd072caf7875cf20b3.tar.bz2
scummvm-rg350-4ac5e3512501a8effee878bd072caf7875cf20b3.zip
SCI/newgui: kAnimate support for globalVar 84 in kq5 to fix cels drawn into talking boxes
svn-id: r45243
-rw-r--r--engines/sci/gui/gui.cpp6
-rw-r--r--engines/sci/gui/gui_animate.cpp11
-rw-r--r--engines/sci/gui/gui_animate.h2
3 files changed, 15 insertions, 4 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 96f15bab09..49d6df2f72 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -528,8 +528,10 @@ void SciGui::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
if (!list)
error("kAnimate called with non-list as parameter");
- if (cycle)
- _animate->invoke(list, argc, argv);
+ if (cycle) {
+ if (!_animate->invoke(list, argc, argv))
+ return;
+ }
GuiPort *oldPort = _gfx->SetPort((GuiPort *)_windowMgr->_picWind);
_animate->disposeLastCast();
diff --git a/engines/sci/gui/gui_animate.cpp b/engines/sci/gui/gui_animate.cpp
index 9ca3ab58ed..1166a4ad89 100644
--- a/engines/sci/gui/gui_animate.cpp
+++ b/engines/sci/gui/gui_animate.cpp
@@ -29,6 +29,7 @@
#include "sci/sci.h"
#include "sci/engine/state.h"
+#include "sci/engine/vm.h"
#include "sci/gui/gui_gfx.h"
#include "sci/gui/gui_view.h"
#include "sci/gui/gui_screen.h"
@@ -56,7 +57,7 @@ void SciGuiAnimate::disposeLastCast() {
//_lastCast->DeleteList();
}
-void SciGuiAnimate::invoke(List *list, int argc, reg_t *argv) {
+bool SciGuiAnimate::invoke(List *list, int argc, reg_t *argv) {
SegManager *segMan = _s->_segMan;
reg_t curAddress = list->first;
Node *curNode = _s->_segMan->lookupNode(curAddress);
@@ -65,6 +66,13 @@ void SciGuiAnimate::invoke(List *list, int argc, reg_t *argv) {
while (curNode) {
curObject = curNode->value;
+ if (_s->_gameName == "kq5") {
+ // This is special to King's Quest 5, globalVar 84 aborts kAnimate completely. If we dont do this
+ // sometimes animation cels will appear within talking boxes
+ if (_s->script_000->_localsBlock->_locals[84].toUint16()) {
+ return false;
+ }
+ }
signal = GET_SEL32V(segMan, curObject, signal);
if (!(signal & SCI_ANIMATE_SIGNAL_FROZEN)) {
// Call .doit method of that object
@@ -75,6 +83,7 @@ void SciGuiAnimate::invoke(List *list, int argc, reg_t *argv) {
curAddress = curNode->succ;
curNode = _s->_segMan->lookupNode(curAddress);
}
+ return true;
}
bool sortHelper(const GuiAnimateEntry* entry1, const GuiAnimateEntry* entry2) {
diff --git a/engines/sci/gui/gui_animate.h b/engines/sci/gui/gui_animate.h
index 1f976b9e84..19bee34597 100644
--- a/engines/sci/gui/gui_animate.h
+++ b/engines/sci/gui/gui_animate.h
@@ -62,7 +62,7 @@ public:
void resetEngineState(EngineState *newState) { _s = newState; }
void disposeLastCast();
- void invoke(List *list, int argc, reg_t *argv);
+ bool invoke(List *list, int argc, reg_t *argv);
void makeSortedList(List *list);
void fill(byte &oldPicNotValid);
void update();