aboutsummaryrefslogtreecommitdiff
path: root/engines/m4/globals.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/m4/globals.h')
-rw-r--r--engines/m4/globals.h59
1 files changed, 1 insertions, 58 deletions
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
index a1339632f3..a95e5169be 100644
--- a/engines/m4/globals.h
+++ b/engines/m4/globals.h
@@ -240,63 +240,6 @@ union DataMapEntry {
typedef Common::HashMap<uint16, uint16> DataMapHash;
-enum DataMapType {BOOL, UINT16, INT, INT_FN};
-
-class DataMapWrapper {
- friend class DataMap;
-private:
- DataMapEntry _value;
- DataMapType _type;
-public:
- DataMapWrapper(bool *v) { _value.boolValue = v; _type = BOOL; }
- DataMapWrapper(uint16 *v) { _value.uint16Value = v; _type = UINT16; }
- DataMapWrapper(int16 *v) { _value.uint16Value = (uint16 *)v; _type = UINT16; }
- DataMapWrapper(int *v) { _value.intValue = v; _type = INT; }
- DataMapWrapper(IntFunctionPtr v) { _value.fnPtr = v; _type = INT_FN; }
-
- uint16 getIntValue() {
- if (_type == BOOL) return *_value.boolValue ? 0xffff : 0;
- else if (_type == UINT16) return *_value.uint16Value;
- else if (_type == INT) return *_value.intValue;
- else return _value.fnPtr();
- }
- void setIntValue(uint16 v) {
- if (_type == BOOL) *_value.boolValue = v != 0;
- else if (_type == UINT16) *_value.uint16Value = v;
- else if (_type == INT) *_value.intValue = v;
- }
-};
-
-#define MAP_DATA(V) _madsVm->globals()->_dataMap.addMapping(new DataMapWrapper(V))
-
-class DataMap {
-private:
- DataMapHash _data;
- Common::Array<DataMapWrapper *> _mapList;
-public:
- DataMap() {
- _mapList.push_back(NULL);
- }
- ~DataMap() {
- for (uint i = 1; i < _mapList.size(); ++i)
- delete _mapList[i];
- }
-
- void addMapping(DataMapWrapper *v) { _mapList.push_back(v); }
- uint16 get(uint16 index) {
- if (index < _mapList.size())
- return _mapList[index]->getIntValue();
-
- return _data[index];
- }
- void set(uint16 index, uint16 v) {
- if (index < _mapList.size())
- _mapList[index]->setIntValue(v);
- else
- _data[index] = v;
- }
-};
-
class MadsGlobals : public Globals {
private:
struct MessageItem {
@@ -325,7 +268,7 @@ public:
int previousScene;
int16 _nextSceneId;
uint16 actionNouns[3];
- DataMap _dataMap;
+ DataMapHash _dataMap;
int _difficultyLevel;
void loadMadsVocab();