aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-01-09 02:01:58 +0200
committerEugene Sandulenko2015-12-27 15:39:52 +0100
commit53029635b13c6581031ecae0ed9af841bfbeb3ab (patch)
treead76eedc11191f190b8cba6b490f317d40941e92
parent199bea21674003ddaffca28125e05d1351bc3712 (diff)
downloadscummvm-rg350-53029635b13c6581031ecae0ed9af841bfbeb3ab.tar.gz
scummvm-rg350-53029635b13c6581031ecae0ed9af841bfbeb3ab.tar.bz2
scummvm-rg350-53029635b13c6581031ecae0ed9af841bfbeb3ab.zip
WAGE: Load scene scripts too.
Signed-off-by: Eugene Sandulenko <sev@scummvm.org>
-rw-r--r--engines/wage/macresman.cpp22
-rw-r--r--engines/wage/macresman.h3
-rw-r--r--engines/wage/module.mk1
-rw-r--r--engines/wage/scene.h5
-rw-r--r--engines/wage/world.cpp7
5 files changed, 33 insertions, 5 deletions
diff --git a/engines/wage/macresman.cpp b/engines/wage/macresman.cpp
index 0dce789874..02ea6c9156 100644
--- a/engines/wage/macresman.cpp
+++ b/engines/wage/macresman.cpp
@@ -141,6 +141,26 @@ MacResIDArray MacResManager::getResIDArray(const char *typeID) {
return res;
}
+char *MacResManager::getResName(const char *typeID, int16 resID) {
+ int i;
+ int typeNum = -1;
+
+ for (i = 0; i < _resMap.numTypes; i++)
+ if (strcmp(_resTypes[i].id, typeID) == 0) {
+ typeNum = i;
+ break;
+ }
+
+ if (typeNum == -1)
+ return NULL;
+
+ for (i = 0; i < _resTypes[typeNum].items; i++)
+ if (_resLists[typeNum][i].id == resID)
+ return _resLists[typeNum][i].name;
+
+ return NULL;
+}
+
byte *MacResManager::getResource(const char *typeID, int16 resID, int *size) {
int i;
int typeNum = -1;
@@ -226,7 +246,7 @@ void MacResManager::readMap() {
_resFile.seek(_resLists[i][j].nameOffset + _mapOffset + _resMap.nameOffset);
len = _resFile.readByte();
- _resLists[i][j].name = new byte[len + 1];
+ _resLists[i][j].name = new char[len + 1];
_resLists[i][j].name[len] = 0;
_resFile.read(_resLists[i][j].name, len);
}
diff --git a/engines/wage/macresman.h b/engines/wage/macresman.h
index 58635ae1f4..c09f4f7a6d 100644
--- a/engines/wage/macresman.h
+++ b/engines/wage/macresman.h
@@ -39,6 +39,7 @@ public:
MacResManager(Common::String fileName);
~MacResManager();
byte *getResource(const char *typeID, int16 resID, int *size);
+ char *getResName(const char *typeID, int16 resID);
void convertCursor(byte *data, int datasize, byte **cursor, int *w, int *h,
int *hotspot_x, int *hotspot_y, int *keycolor, bool colored, byte **palette, int *palSize);
@@ -69,7 +70,7 @@ private:
int16 nameOffset;
byte attr;
int32 dataOffset;
- byte *name;
+ char *name;
};
typedef Resource *ResPtr;
diff --git a/engines/wage/module.mk b/engines/wage/module.mk
index 6f875f8e14..f43886cbe4 100644
--- a/engines/wage/module.mk
+++ b/engines/wage/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
designed.o \
detection.o \
macresman.o \
+ scene.o \
script.o \
sound.o \
util.o \
diff --git a/engines/wage/scene.h b/engines/wage/scene.h
index c239faab5a..509833af0f 100644
--- a/engines/wage/scene.h
+++ b/engines/wage/scene.h
@@ -51,7 +51,6 @@ public:
RANDOM = 1
};
-private:
Script *_script;
String _text;
Common::Rect *_textBounds;
@@ -68,7 +67,9 @@ private:
Common::List<Obj> _objs;
Common::List<Chr> _chrs;
-public:
+ Scene() {}
+ Scene(String name, byte *data);
+
Common::Rect *getTextBounds() {
return _textBounds == NULL ? NULL : new Common::Rect(*_textBounds);
}
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index d897d9e9af..5fd46357bb 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -81,7 +81,12 @@ bool World::loadWorld(MacResManager *resMan) {
resArray = resMan->getResIDArray("ASCN");
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
-
+ res = resMan->getResource("ASCND", *iter, &resSize);
+ Scene *scene = new Scene(resMan->getResName("ASCN", *iter), res);
+
+ res = resMan->getResource("ACOD", *iter, &resSize);
+ if (res != NULL)
+ scene->_script = new Script(res);
}