aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-17 16:01:49 -0400
committerPaul Gilbert2016-07-17 16:01:49 -0400
commit9e14d4a56660ab3f090fd8eaed756a4d83353d76 (patch)
treeb25e96afa26b8fcd23bdc66341dfbf47cc3d0e5b /engines/titanic
parent90f2cce0b9621b483f9530c3615b40a0c8a50bb8 (diff)
downloadscummvm-rg350-9e14d4a56660ab3f090fd8eaed756a4d83353d76.tar.gz
scummvm-rg350-9e14d4a56660ab3f090fd8eaed756a4d83353d76.tar.bz2
scummvm-rg350-9e14d4a56660ab3f090fd8eaed756a4d83353d76.zip
TITANIC: Added CStarControlSub12 setupHandler
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/star_control/star_control_sub12.cpp43
-rw-r--r--engines/titanic/star_control/star_control_sub12.h15
-rw-r--r--engines/titanic/star_control/star_control_sub21.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub21.h5
-rw-r--r--engines/titanic/star_control/star_control_sub22.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub22.h9
-rw-r--r--engines/titanic/star_control/star_control_sub24.h4
-rw-r--r--engines/titanic/star_control/star_control_sub27.cpp29
-rw-r--r--engines/titanic/star_control/star_control_sub27.h35
10 files changed, 141 insertions, 8 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 33e3558f72..ec3294747e 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -438,6 +438,7 @@ MODULE_OBJS := \
star_control/star_control_sub24.o \
star_control/star_control_sub25.o \
star_control/star_control_sub26.o \
+ star_control/star_control_sub27.o \
star_control/star_field.o \
star_control/star_points1.o \
star_control/star_points2.o \
diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp
index 5fc26e4cf3..a2e1f068ef 100644
--- a/engines/titanic/star_control/star_control_sub12.cpp
+++ b/engines/titanic/star_control/star_control_sub12.cpp
@@ -21,12 +21,19 @@
*/
#include "titanic/star_control/star_control_sub12.h"
+#include "titanic/star_control/star_control_sub21.h"
+#include "titanic/star_control/star_control_sub22.h"
namespace Titanic {
CStarControlSub12::CStarControlSub12(void *val1, void *val2) :
- _field4(-1), _field2C(0), _field108(0),
+ _field4(-1), _handlerP(nullptr), _field108(0),
_sub13(val1) {
+ setupHandler(val2);
+}
+
+CStarControlSub12::~CStarControlSub12() {
+ deleteHandler();
}
void CStarControlSub12::load(SimpleFile *file, int param) {
@@ -37,8 +44,38 @@ void CStarControlSub12::save(SimpleFile *file, int indent) {
_sub13.save(file, indent);
}
-void CStarControlSub12::setupHandler(void *v) {
- // TODO
+bool CStarControlSub12::setupHandler(void *src) {
+ CStarControlSub20 *handler = nullptr;
+
+ switch (_field4) {
+ case -1:
+ handler = new CStarControlSub21(src);
+ break;
+
+ case 0:
+ case 1:
+ case 2:
+ handler = new CStarControlSub22(src);
+ break;
+
+ default:
+ break;
+ }
+
+ if (handler) {
+ assert(!_handlerP);
+ _handlerP = handler;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void CStarControlSub12::deleteHandler() {
+ if (_handlerP) {
+ delete _handlerP;
+ _handlerP = nullptr;
+ }
}
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h
index 51d836628f..a114cded81 100644
--- a/engines/titanic/star_control/star_control_sub12.h
+++ b/engines/titanic/star_control/star_control_sub12.h
@@ -25,6 +25,7 @@
#include "titanic/support/simple_file.h"
#include "titanic/star_control/star_control_sub13.h"
+#include "titanic/star_control/star_control_sub20.h"
namespace Titanic {
@@ -38,14 +39,22 @@ class CStarControlSub12 {
private:
int _field4;
ArrayEntry _array[3];
- int _field2C;
+ CStarControlSub20 *_handlerP;
CStarControlSub13 _sub13;
int _field108;
private:
- void setupHandler(void *v);
+ /**
+ * Set up a handler
+ */
+ bool setupHandler(void *src);
+
+ /**
+ * Deletes any previous handler
+ */
+ void deleteHandler();
public:
CStarControlSub12(void *val1, void *val2);
- virtual ~CStarControlSub12() {}
+ virtual ~CStarControlSub12();
virtual void proc3() {}
diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp
index b606d15b41..20b8bc5f86 100644
--- a/engines/titanic/star_control/star_control_sub21.cpp
+++ b/engines/titanic/star_control/star_control_sub21.cpp
@@ -25,4 +25,8 @@
namespace Titanic {
+CStarControlSub21::CStarControlSub21(void *src) :
+ CStarControlSub20(src), _sub24() {
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h
index 8214a1824e..610f26ec65 100644
--- a/engines/titanic/star_control/star_control_sub21.h
+++ b/engines/titanic/star_control/star_control_sub21.h
@@ -24,10 +24,15 @@
#define TITANIC_STAR_CONTROL_SUB21_H
#include "titanic/star_control/star_control_sub20.h"
+#include "titanic/star_control/star_control_sub24.h"
namespace Titanic {
class CStarControlSub21 : public CStarControlSub20 {
+private:
+ CStarControlSub24 _sub24;
+public:
+ CStarControlSub21(void *src);
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp
index d7835a68bf..9298d5b6de 100644
--- a/engines/titanic/star_control/star_control_sub22.cpp
+++ b/engines/titanic/star_control/star_control_sub22.cpp
@@ -25,4 +25,8 @@
namespace Titanic {
+CStarControlSub22::CStarControlSub22(void *src) :
+ CStarControlSub20(src), _sub27() {
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub22.h b/engines/titanic/star_control/star_control_sub22.h
index 94a0cdf7f9..dae231f703 100644
--- a/engines/titanic/star_control/star_control_sub22.h
+++ b/engines/titanic/star_control/star_control_sub22.h
@@ -23,9 +23,16 @@
#ifndef TITANIC_STAR_CONTROL_SUB22_H
#define TITANIC_STAR_CONTROL_SUB22_H
+#include "titanic/star_control/star_control_sub20.h"
+#include "titanic/star_control/star_control_sub27.h"
+
namespace Titanic {
-class CStarControlSub22 {
+class CStarControlSub22 : public CStarControlSub20 {
+private:
+ CStarControlSub27 _sub27;
+public:
+ CStarControlSub22(void *src);
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub24.h b/engines/titanic/star_control/star_control_sub24.h
index 43f1e0933e..e0970fc1de 100644
--- a/engines/titanic/star_control/star_control_sub24.h
+++ b/engines/titanic/star_control/star_control_sub24.h
@@ -23,9 +23,11 @@
#ifndef TITANIC_STAR_CONTROL_SUB24_H
#define TITANIC_STAR_CONTROL_SUB24_H
+#include "titanic/star_control/star_control_sub23.h"
+
namespace Titanic {
-class CStarControlSub24 {
+class CStarControlSub24 : public CStarControlSub23 {
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub27.cpp b/engines/titanic/star_control/star_control_sub27.cpp
new file mode 100644
index 0000000000..6f17eb7193
--- /dev/null
+++ b/engines/titanic/star_control/star_control_sub27.cpp
@@ -0,0 +1,29 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/star_control/star_control_sub24.h"
+#include "common/textconsole.h"
+
+namespace Titanic {
+
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub27.h b/engines/titanic/star_control/star_control_sub27.h
new file mode 100644
index 0000000000..01782b69ca
--- /dev/null
+++ b/engines/titanic/star_control/star_control_sub27.h
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_STAR_CONTROL_SUB27_H
+#define TITANIC_STAR_CONTROL_SUB27_H
+
+#include "titanic/star_control/star_control_sub23.h"
+
+namespace Titanic {
+
+class CStarControlSub27 : public CStarControlSub23 {
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_STAR_CONTROL_SUB27_H */