aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2011-12-06 19:49:46 +0100
committerWillem Jan Palenstijn2011-12-07 10:30:44 +0100
commit25216466761c1b0c1411454e257cdf82d66b7f65 (patch)
tree1708087dae5fb1d86392ae14022f550aedb1a1ef /engines
parent218f47a7f2301bdc5cceee445c2217a39727dca7 (diff)
downloadscummvm-rg350-25216466761c1b0c1411454e257cdf82d66b7f65.tar.gz
scummvm-rg350-25216466761c1b0c1411454e257cdf82d66b7f65.tar.bz2
scummvm-rg350-25216466761c1b0c1411454e257cdf82d66b7f65.zip
DREAMWEB: Add DreamBase as second base class for DreamGenContext
The idea is to slowly transfer converted methods into this new base class. This transition then proves that the method does not access or modify any of the emulation context. for eaiser step-by-step migration away from Context
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreambase.h57
-rw-r--r--engines/dreamweb/dreamgen.h7
-rw-r--r--engines/dreamweb/runtime.h20
3 files changed, 67 insertions, 17 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
new file mode 100644
index 0000000000..db3c6d94c3
--- /dev/null
+++ b/engines/dreamweb/dreambase.h
@@ -0,0 +1,57 @@
+/* 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 DREAMBASE_H
+#define DREAMBASE_H
+
+#include "common/scummsys.h"
+
+#include "dreamweb/runtime.h"
+
+namespace DreamWeb {
+ class DreamWebEngine;
+}
+
+
+namespace DreamGen {
+
+class DreamBase {
+public:
+ enum { kDefaultDataSegment = 0x1000 };
+
+ DreamWeb::DreamWebEngine *engine;
+
+ SegmentPtr _realData; ///< the primary data segment, points to a huge blob of binary data
+ SegmentRef data; ///< fake segment register always pointing to data segment
+
+ DreamBase() : _realData(new Segment()), data(kDefaultDataSegment, _realData) {
+ }
+
+
+public:
+// TODO: Move functions from stubs.h which do not access any Context member variables to here.
+};
+
+
+} // End of namespace DreamGen
+
+#endif
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 9b5a798782..33a362f449 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -27,12 +27,15 @@
#include "dreamweb/runtime.h"
-#include "structs.h"
+#include "dreamweb/structs.h"
+#include "dreamweb/dreambase.h"
namespace DreamGen {
-class DreamGenContext : public Context {
+class DreamGenContext : public DreamBase, public Context {
public:
+ DreamGenContext() : DreamBase(), Context(_realData) {}
+
void __start();
#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h
index 2a23c3ec8d..48f7c88a20 100644
--- a/engines/dreamweb/runtime.h
+++ b/engines/dreamweb/runtime.h
@@ -31,10 +31,6 @@
#include "common/list.h"
#include "common/ptr.h"
-namespace DreamWeb {
- class DreamWebEngine;
-}
-
namespace DreamGen {
struct Register {
@@ -242,8 +238,6 @@ class Context {
FreeSegmentList _freeSegments;
public:
- DreamWeb::DreamWebEngine *engine;
-
enum { kDefaultDataSegment = 0x1000 };
Register ax, dx, bx, cx, si, di;
@@ -256,21 +250,17 @@ public:
LowPartOfRegister dl;
HighPartOfRegister dh;
- SegmentPtr _realData; ///< the primary data segment, points to a huge blob of binary data
SegmentRef cs;
MutableSegmentRef ds;
MutableSegmentRef es;
- SegmentRef data; ///< fake segment register always pointing to data segment
Flags flags;
- inline Context(): engine(0), al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
- _realData(new Segment()),
- cs(kDefaultDataSegment, _realData),
- ds(this, kDefaultDataSegment, _realData),
- es(this, kDefaultDataSegment, _realData),
- data(kDefaultDataSegment, _realData) {
+ Context(SegmentPtr realData): al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
+ cs(kDefaultDataSegment, realData),
+ ds(this, kDefaultDataSegment, realData),
+ es(this, kDefaultDataSegment, realData) {
- _segments[kDefaultDataSegment] = _realData;
+ _segments[kDefaultDataSegment] = realData;
}
SegmentRef getSegment(uint16 value) {