aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorD G Turner2011-05-30 17:37:27 +0100
committerEugene Sandulenko2015-12-27 15:39:52 +0100
commit57b464b2e9c8d5e8aff0d5c35e1f8fcb1ef2ae90 (patch)
tree739d789406c6bd6c4639bd8e5a5538a827adf895 /engines/wage
parent2fde3eaabbef1fd809bd3268dfd22f4fbab77efd (diff)
downloadscummvm-rg350-57b464b2e9c8d5e8aff0d5c35e1f8fcb1ef2ae90.tar.gz
scummvm-rg350-57b464b2e9c8d5e8aff0d5c35e1f8fcb1ef2ae90.tar.bz2
scummvm-rg350-57b464b2e9c8d5e8aff0d5c35e1f8fcb1ef2ae90.zip
WAGE: More Updates To World Class for MacResManager API Changes.
Still will not compile as need to deal with propagating SeekableReadStream instead of (byte* res, int resSize) parameters. Signed-off-by: Eugene Sandulenko <sev@scummvm.org>
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/world.cpp54
1 files changed, 26 insertions, 28 deletions
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index a2f01cecc9..d33ca69b38 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -66,17 +66,16 @@ World::World() {
}
bool World::loadWorld(Common::MacResManager *resMan) {
- int resSize;
Common::MacResIDArray resArray;
- byte *res;
+ Common::SeekableReadStream *res;
Common::MacResIDArray::const_iterator iter;
if ((resArray = resMan->getResIDArray(MKTAG('G','C','O','D'))).size() == 0)
return false;
// Load global script
- res = resMan->getResource(MKTAG('G','C','O','D'), resArray[0], &resSize);
- _globalScript = new Script(res, resSize);
+ res = resMan->getResource(MKTAG('G','C','O','D'), resArray[0]);
+ _globalScript = new Script(res, res->size());
// Load main configuration
if ((resArray = resMan->getResIDArray(MKTAG('V','E','R','S'))).size() == 0)
@@ -85,9 +84,9 @@ bool World::loadWorld(Common::MacResManager *resMan) {
if (resArray.size() > 1)
warning("Too many VERS resources");
- res = resMan->getResource(MKTAG('V','E','R','S'), resArray[0], &resSize);
+ res = resMan->getResource(MKTAG('V','E','R','S'), resArray[0]);
- Common::MemoryReadStream readS(res, resSize);
+ Common::MemoryReadStream readS(res, res->size());
readS.skip(10);
byte b = readS.readByte();
_weaponMenuDisabled = (b != 0);
@@ -108,27 +107,27 @@ bool World::loadWorld(Common::MacResManager *resMan) {
// Load scenes
resArray = resMan->getResIDArray(MKTAG('A','S','C','N'));
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
- res = resMan->getResource(MKTAG('A','S','C','N'), *iter, &resSize);
- Scene *scene = new Scene(resMan->getResName(MKTAG('A','S','C','N'), *iter), res, resSize);
+ res = resMan->getResource(MKTAG('A','S','C','N'), *iter);
+ Scene *scene = new Scene(resMan->getResName(MKTAG('A','S','C','N'), *iter), res, res->size());
- res = resMan->getResource(MKTAG('A','C','O','D'), *iter, &resSize);
+ res = resMan->getResource(MKTAG('A','C','O','D'), *iter);
if (res != NULL)
- scene->_script = new Script(res, resSize);
+ scene->_script = new Script(res, res->size());
- res = resMan->getResource(MKTAG('A','T','X','T'), *iter, &resSize);
+ res = resMan->getResource(MKTAG('A','T','X','T'), *iter);
if (res != NULL) {
- Common::MemoryReadStream readT(res, resSize);
+ Common::MemoryReadStream readT(res, res->size());
scene->_textBounds = readRect(readT);
scene->_fontType = readT.readUint16BE();
scene->_fontSize = readT.readUint16BE();
- for (int i = 12; i < resSize; i++)
+ for (int i = 12; i < res->size(); i++)
if (res[i] == 0x0d)
res[i] = '\n';
- String text(&((char*)res)[12], resSize - 12);
+ String text(&((char*)res)[12], res->size() - 12);
scene->_text = text;
- free(res);
+ delete res;
}
addScene(scene);
}
@@ -136,15 +135,15 @@ bool World::loadWorld(Common::MacResManager *resMan) {
// Load Objects
resArray = resMan->getResIDArray(MKTAG('A','O','B','J'));
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
- res = resMan->getResource(MKTAG('A','O','B','J'), *iter, &resSize);
- addObj(new Obj(resMan->getResName(MKTAG('A','O','B','J'), *iter), res, resSize));
+ res = resMan->getResource(MKTAG('A','O','B','J'), *iter);
+ addObj(new Obj(resMan->getResName(MKTAG('A','O','B','J'), *iter), res, res->size()));
}
// Load Characters
resArray = resMan->getResIDArray(MKTAG('A','C','H','R'));
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
- res = resMan->getResource(MKTAG('A','C','H','R'), *iter, &resSize);
- Chr *chr = new Chr(resMan->getResName(MKTAG('A','C','H','R'), *iter), res, resSize);
+ res = resMan->getResource(MKTAG('A','C','H','R'), *iter);
+ Chr *chr = new Chr(resMan->getResName(MKTAG('A','C','H','R'), *iter), res, res->size());
addChr(chr);
// TODO: What if there's more than one player character?
@@ -155,8 +154,8 @@ bool World::loadWorld(Common::MacResManager *resMan) {
// Load Sounds
resArray = resMan->getResIDArray(MKTAG('A','S','N','D'));
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
- res = resMan->getResource(MKTAG('A','S','N','D'), *iter, &resSize);
- addSound(new Sound(resMan->getResName(MKTAG('A','S','N','D')), *iter), res, resSize));
+ res = resMan->getResource(MKTAG('A','S','N','D'), *iter);
+ addSound(new Sound(resMan->getResName(MKTAG('A','S','N','D')), *iter), res, res->size()));
}
if (_soundLibrary1.size() > 0) {
@@ -167,9 +166,9 @@ bool World::loadWorld(Common::MacResManager *resMan) {
}
// Load Patterns
- res = resMan->getResource(MKTAG('P','A','T','#'), 900, &resSize);
+ res = resMan->getResource(MKTAG('P','A','T','#'), 900);
if (res != NULL) {
- Common::MemoryReadStream readP(res, resSize);
+ Common::MemoryReadStream readP(res, res->size());
int count = readP.readUint16BE();
for (int i = 0; i < count; i++) {
byte *pattern = (byte *)malloc(8);
@@ -179,7 +178,7 @@ bool World::loadWorld(Common::MacResManager *resMan) {
}
}
- free(res);
+ delete res;
}
return true;
@@ -198,15 +197,14 @@ void World::loadExternalSounds(String fname) {
Common::MacResManager *resMan;
resMan = new Common::MacResManager(fname);
- int resSize;
Common::MacResIDArray resArray;
- byte *res;
+ Common::SeekableReadStream *res;
Common::MacResIDArray::const_iterator iter;
resArray = resMan->getResIDArray(MKTAG('A','S','N','D'));
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
- res = resMan->getResource(MKTAG('A','S','N','D'), *iter, &resSize);
- addSound(new Sound(resMan->getResName(MKTAG('A','S','N','D'), *iter), res, resSize));
+ res = resMan->getResource(MKTAG('A','S','N','D'), *iter);
+ addSound(new Sound(resMan->getResName(MKTAG('A','S','N','D'), *iter), res, res->size()));
}
}