aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/pregob/pregob.cpp
diff options
context:
space:
mode:
authorSven Hesse2012-07-02 21:31:23 +0200
committerSven Hesse2012-07-30 01:44:44 +0200
commitdf18bc95834837f1f905bfe5613ffd43dfc908f9 (patch)
tree51f4d28d5cd1e73f2ddc6cd734c2e331d5ff7464 /engines/gob/pregob/pregob.cpp
parent60f52ab9a0beccccca4958fbcf4d369e6dd22748 (diff)
downloadscummvm-rg350-df18bc95834837f1f905bfe5613ffd43dfc908f9.tar.gz
scummvm-rg350-df18bc95834837f1f905bfe5613ffd43dfc908f9.tar.bz2
scummvm-rg350-df18bc95834837f1f905bfe5613ffd43dfc908f9.zip
GOB: Implement parts of the Once Upon A Time end sequence
We don't yet support GCT files, so texts are still missing.
Diffstat (limited to 'engines/gob/pregob/pregob.cpp')
-rw-r--r--engines/gob/pregob/pregob.cpp62
1 files changed, 54 insertions, 8 deletions
diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp
index 675958035d..4ee5430de7 100644
--- a/engines/gob/pregob/pregob.cpp
+++ b/engines/gob/pregob/pregob.cpp
@@ -251,24 +251,70 @@ bool PreGob::hasInput() {
return checkInput(mouseX, mouseY, mouseButtons) || (mouseButtons != kMouseButtonsNone);
}
-void PreGob::clearAnim(ANIObject &ani) {
+void PreGob::clearAnim(ANIObject &anim) {
int16 left, top, right, bottom;
- if (ani.clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ if (anim.clear(*_vm->_draw->_backSurface, left, top, right, bottom))
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
-void PreGob::drawAnim(ANIObject &ani) {
+void PreGob::drawAnim(ANIObject &anim) {
int16 left, top, right, bottom;
- if (ani.draw(*_vm->_draw->_backSurface, left, top, right, bottom))
+ if (anim.draw(*_vm->_draw->_backSurface, left, top, right, bottom))
_vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
- ani.advance();
+ anim.advance();
}
-void PreGob::redrawAnim(ANIObject &ani) {
- clearAnim(ani);
- drawAnim(ani);
+void PreGob::redrawAnim(ANIObject &anim) {
+ clearAnim(anim);
+ drawAnim(anim);
+}
+
+void PreGob::clearAnim(const ANIList &anims) {
+ for (int i = (anims.size() - 1); i >= 0; i--)
+ clearAnim(*anims[i]);
+}
+
+void PreGob::drawAnim(const ANIList &anims) {
+ for (ANIList::const_iterator a = anims.begin(); a != anims.end(); ++a)
+ drawAnim(**a);
+}
+
+void PreGob::redrawAnim(const ANIList &anims) {
+ clearAnim(anims);
+ drawAnim(anims);
+}
+
+void PreGob::loadAnims(ANIList &anims, ANIFile &ani, uint count, const AnimProperties *props) const {
+ freeAnims(anims);
+
+ anims.resize(count);
+ for (uint i = 0; i < count; i++) {
+ anims[i] = new ANIObject(ani);
+
+ setAnim(*anims[i], props[i]);
+ }
+}
+
+void PreGob::freeAnims(ANIList &anims) const {
+ for (ANIList::iterator a = anims.begin(); a != anims.end(); ++a)
+ delete *a;
+
+ anims.clear();
+}
+
+void PreGob::setAnim(ANIObject &anim, const AnimProperties &props) const {
+ anim.setAnimation(props.animation);
+ anim.setFrame(props.frame);
+ anim.setMode(props.mode);
+ anim.setPause(props.paused);
+ anim.setVisible(props.visible);
+
+ if (props.hasPosition)
+ anim.setPosition(props.x, props.y);
+ else
+ anim.setPosition();
}
Common::String PreGob::getLocFile(const Common::String &file) const {