aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2012-06-29 18:25:11 +0200
committerSven Hesse2012-07-30 01:44:42 +0200
commit734fc767d25d47b5da703dc1b4a3cfb494234155 (patch)
treedab87d9c27a54f729861911b99f15afbb04a1f89
parent4fc3a88c5f0b053323aeaeac658dafb8e4606662 (diff)
downloadscummvm-rg350-734fc767d25d47b5da703dc1b4a3cfb494234155.tar.gz
scummvm-rg350-734fc767d25d47b5da703dc1b4a3cfb494234155.tar.bz2
scummvm-rg350-734fc767d25d47b5da703dc1b4a3cfb494234155.zip
GOB: Open the Once Upon A Time archives
-rw-r--r--engines/gob/pregob/onceupon/abracadabra.cpp4
-rw-r--r--engines/gob/pregob/onceupon/babayaga.cpp4
-rw-r--r--engines/gob/pregob/onceupon/onceupon.cpp29
-rw-r--r--engines/gob/pregob/onceupon/onceupon.h6
4 files changed, 38 insertions, 5 deletions
diff --git a/engines/gob/pregob/onceupon/abracadabra.cpp b/engines/gob/pregob/onceupon/abracadabra.cpp
index 84d84e89a5..6cfdfa7822 100644
--- a/engines/gob/pregob/onceupon/abracadabra.cpp
+++ b/engines/gob/pregob/onceupon/abracadabra.cpp
@@ -35,9 +35,9 @@ Abracadabra::~Abracadabra() {
}
void Abracadabra::run() {
- warning("TODO: Abracadabra::run()");
+ init();
- initScreen();
+ warning("TODO: Abracadabra::run()");
}
} // End of namespace OnceUpon
diff --git a/engines/gob/pregob/onceupon/babayaga.cpp b/engines/gob/pregob/onceupon/babayaga.cpp
index 21355ab9ed..9f4f53c4e0 100644
--- a/engines/gob/pregob/onceupon/babayaga.cpp
+++ b/engines/gob/pregob/onceupon/babayaga.cpp
@@ -35,9 +35,9 @@ BabaYaga::~BabaYaga() {
}
void BabaYaga::run() {
- warning("TODO: BabaYaga::run()");
+ init();
- initScreen();
+ warning("TODO: BabaYaga::run()");
}
} // End of namespace OnceUpon
diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp
index 7f7dffa7ec..e3d1a8535f 100644
--- a/engines/gob/pregob/onceupon/onceupon.cpp
+++ b/engines/gob/pregob/onceupon/onceupon.cpp
@@ -166,10 +166,37 @@ namespace Gob {
namespace OnceUpon {
-OnceUpon::OnceUpon(GobEngine *vm) : PreGob(vm) {
+OnceUpon::OnceUpon(GobEngine *vm) : PreGob(vm), _openedArchives(false) {
+
}
OnceUpon::~OnceUpon() {
+ deinit();
+}
+
+void OnceUpon::init() {
+ deinit();
+
+ bool hasSTK1 = _vm->_dataIO->openArchive("stk1.stk", true);
+ bool hasSTK2 = _vm->_dataIO->openArchive("stk2.stk", true);
+ bool hasSTK3 = _vm->_dataIO->openArchive("stk3.stk", true);
+
+ if (!hasSTK1 || !hasSTK2 || !hasSTK3)
+ error("OnceUpon::OnceUpon(): Failed to open archives");
+
+ _openedArchives = true;
+
+ initScreen();
+}
+
+void OnceUpon::deinit() {
+ if (_openedArchives) {
+ _vm->_dataIO->closeArchive(true);
+ _vm->_dataIO->closeArchive(true);
+ _vm->_dataIO->closeArchive(true);
+ }
+
+ _openedArchives = false;
}
void OnceUpon::setCopyProtectionPalette() {
diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h
index c1c4d6fa0d..e5f70855ad 100644
--- a/engines/gob/pregob/onceupon/onceupon.h
+++ b/engines/gob/pregob/onceupon/onceupon.h
@@ -39,10 +39,16 @@ public:
~OnceUpon();
protected:
+ void init();
+ void deinit();
+
void setGamePalette(uint palette);
private:
void setCopyProtectionPalette();
+
+
+ bool _openedArchives;
};
} // End of namespace OnceUpon