aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/glk/advsys/game.cpp11
-rw-r--r--engines/glk/advsys/game.h13
2 files changed, 11 insertions, 13 deletions
diff --git a/engines/glk/advsys/game.cpp b/engines/glk/advsys/game.cpp
index 50b258d924..ea8bac93bb 100644
--- a/engines/glk/advsys/game.cpp
+++ b/engines/glk/advsys/game.cpp
@@ -99,9 +99,9 @@ enum LinkField {
};
Game::Game() : Header(), _stream(nullptr), _restartFlag(false), _residentOffset(0), _wordCount(0),
- _objectCount(0), _actionCount(0), _variableCount(0), _residentBase(nullptr),
- _wordTable(nullptr), _wordTypeTable(nullptr), _objectTable(nullptr), _actionTable(nullptr),
- _variableTable(nullptr), _saveArea(nullptr), _msgBlockNum(-1), _msgBlockOffset(0) {
+ _objectCount(0), _actionCount(0), _variableCount(0), _wordTable(nullptr), _wordTypeTable(nullptr),
+ _objectTable(nullptr), _actionTable(nullptr), _variableTable(nullptr), _saveArea(nullptr),
+ _msgBlockNum(-1), _msgBlockOffset(0) {
_msgCache.resize(MESSAGE_CACHE_SIZE);
for (int idx = 0; idx < MESSAGE_CACHE_SIZE; ++idx)
_msgCache[idx] = new CacheEntry();
@@ -133,7 +133,6 @@ bool Game::init(Common::SeekableReadStream *s) {
return false;
decrypt(&_data[0], _size);
- _residentBase = &_data[0];
_wordTable = &_data[_wordTableOffset];
_wordTypeTable = &_data[_wordTypeTableOffset];
_objectTable = &_data[_objectTableOffset];
@@ -183,8 +182,8 @@ int Game::findWord(const Common::String &word) const {
// Iterate over the dictionary for the word
for (int idx = 1; idx <= _wordCount; ++idx) {
int wordOffset = READ_LE_UINT16(_wordTable + idx * 2);
- if (w == (const char *)_residentBase + wordOffset + 2)
- return READ_LE_UINT16(_residentBase + wordOffset);
+ if (w == (const char *)_dataSpace + wordOffset + 2)
+ return readWord(wordOffset);
}
return NIL;
diff --git a/engines/glk/advsys/game.h b/engines/glk/advsys/game.h
index 5920f412d5..cce7822eff 100644
--- a/engines/glk/advsys/game.h
+++ b/engines/glk/advsys/game.h
@@ -213,7 +213,6 @@ public:
int _actionCount;
int _variableCount;
- byte *_residentBase;
byte *_wordTable;
byte *_wordTypeTable;
byte *_objectTable;
@@ -294,14 +293,14 @@ public:
* Gets a field from an object
*/
int getObjectField(int obj, int offset) const {
- return READ_LE_UINT16(_residentBase + getObjectLocation(obj) + offset);
+ return READ_LE_UINT16(_dataSpace + getObjectLocation(obj) + offset);
}
/**
* Sets a field in an object
*/
int setObjectField(int obj, int offset, int val) {
- WRITE_LE_UINT16(_residentBase + getObjectLocation(obj) + offset, val);
+ WRITE_LE_UINT16(_dataSpace + getObjectLocation(obj) + offset, val);
return val;
}
@@ -309,14 +308,14 @@ public:
* Gets a field from an action
*/
int getActionField(int action, int offset) const {
- return READ_LE_UINT16(_residentBase + getActionLocation(action) + offset);
+ return READ_LE_UINT16(_dataSpace + getActionLocation(action) + offset);
}
/**
* Gets a byte field from an action
*/
int getActionByte(int action, int offset) const {
- return _residentBase[getActionLocation(action) + offset];
+ return _dataSpace[getActionLocation(action) + offset];
}
/**
@@ -357,14 +356,14 @@ public:
* Read a word
*/
int readWord(int offset) const {
- return READ_LE_UINT16(_residentBase + offset);
+ return READ_LE_UINT16(_dataSpace + offset);
}
/**
* Write a word
*/
void writeWord(int offset, int val) {
- WRITE_LE_UINT16(_residentBase + offset, val);
+ WRITE_LE_UINT16(_dataSpace + offset, val);
}
/**