aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2010-01-11 00:26:01 +0200
committerEugene Sandulenko2015-12-27 15:39:52 +0100
commitf48876270378849d93dda18553bc15974e297e58 (patch)
treeed3b220f858e01338af5a96427ddc95f9f1d50e3 /engines/wage
parent53029635b13c6581031ecae0ed9af841bfbeb3ab (diff)
downloadscummvm-rg350-f48876270378849d93dda18553bc15974e297e58.tar.gz
scummvm-rg350-f48876270378849d93dda18553bc15974e297e58.tar.bz2
scummvm-rg350-f48876270378849d93dda18553bc15974e297e58.zip
WAGE: Finished world loading.
Signed-off-by: Eugene Sandulenko <sev@scummvm.org>
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/chr.h2
-rw-r--r--engines/wage/obj.h1
-rw-r--r--engines/wage/sound.cpp4
-rw-r--r--engines/wage/util.cpp11
-rw-r--r--engines/wage/wage.h2
-rw-r--r--engines/wage/world.cpp72
-rw-r--r--engines/wage/world.h3
7 files changed, 92 insertions, 3 deletions
diff --git a/engines/wage/chr.h b/engines/wage/chr.h
index edc02c6366..10b8286b49 100644
--- a/engines/wage/chr.h
+++ b/engines/wage/chr.h
@@ -50,6 +50,8 @@ public:
SHIELD_ARMOR = 2
};
+ Chr(String name, byte *data) {}
+
int _index;
String _initialScene;
int _gender;
diff --git a/engines/wage/obj.h b/engines/wage/obj.h
index 12db147eb2..41480c7442 100644
--- a/engines/wage/obj.h
+++ b/engines/wage/obj.h
@@ -57,6 +57,7 @@ class Chr;
class Obj : public Weapon, public Designed {
public:
Obj() : _currentOwner(NULL), _currentScene(NULL) {}
+ Obj(String name, byte *data) : _currentOwner(NULL), _currentScene(NULL) {}
enum ObjectTypes {
REGULAR_WEAPON = 1,
diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index 272aafcb32..cbd4bb1f99 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -25,8 +25,12 @@
#include "wage/wage.h"
#include "wage/sound.h"
+#include "wage/world.h"
namespace Wage {
+void World::loadExternalSounds(String fname) {
+}
+
} // End of namespace Wage
diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp
index 2598a01d86..ab36582c5b 100644
--- a/engines/wage/util.cpp
+++ b/engines/wage/util.cpp
@@ -54,4 +54,15 @@ Common::String readPascalString(Common::SeekableReadStream &in) {
return s;
}
+Common::Rect *readRect(Common::SeekableReadStream &in) {
+ int x1, y1, x2, y2;
+
+ y1 = in.readUint16LE();
+ x1 = in.readUint16LE();
+ y2 = in.readUint16LE() + 4;
+ x2 = in.readUint16LE() + 4;
+
+ return new Common::Rect(x1, y1, x2, y2);
+}
+
} // End of namespace Wage
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 8e5a7bb672..75a76e1fb2 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -30,6 +30,7 @@
#include "common/debug.h"
#include "gui/debugger.h"
#include "common/endian.h"
+#include "common/rect.h"
struct ADGameDescription;
@@ -50,6 +51,7 @@ enum {
};
Common::String readPascalString(Common::SeekableReadStream &in);
+Common::Rect *readRect(Common::SeekableReadStream &in);
class WageEngine : public Engine {
public:
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 5fd46357bb..0c1ddb038d 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -77,18 +77,86 @@ bool World::loadWorld(MacResManager *resMan) {
_soundLibrary1 = readPascalString(readS);
_soundLibrary2 = readPascalString(readS);
+ free(res);
+
// Load scenes
resArray = resMan->getResIDArray("ASCN");
-
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
- res = resMan->getResource("ASCND", *iter, &resSize);
+ res = resMan->getResource("ASCN", *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);
+
+ res = resMan->getResource("ATXT", *iter, &resSize);
+ if (res != NULL) {
+ Common::MemoryReadStream readT(res, resSize);
+ scene->_textBounds = readRect(readT);
+ scene->_fontType = readT.readUint16LE();
+ scene->_fontSize = readT.readUint16LE();
+
+ for (int i = 12; i < resSize; i++)
+ if (res[i] == 0x0d)
+ res[i] = '\n';
+ String text(&((char*)res)[12], resSize - 12);
+ scene->_text = text;
+
+ free(res);
+ }
+ addScene(scene);
}
+ // Load Objects
+ resArray = resMan->getResIDArray("AOBJ");
+ for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
+ res = resMan->getResource("AOBJ", *iter, &resSize);
+ addObj(new Obj(resMan->getResName("AOBJ", *iter), res));
+ }
+
+ // Load Characters
+ resArray = resMan->getResIDArray("ACHR");
+ for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
+ res = resMan->getResource("ACHR", *iter, &resSize);
+ Chr *chr = new Chr(resMan->getResName("ACHR", *iter), res);
+
+ addChr(chr);
+ // TODO: What if there's more than one player character?
+ if (chr->_playerCharacter)
+ _player = chr;
+ }
+
+ // Load Sounds
+ resArray = resMan->getResIDArray("ASND");
+ for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
+ res = resMan->getResource("ASND", *iter, &resSize);
+ Sound *sound = new Sound(res);
+ sound->_name = resMan->getResName("ASND", *iter);
+ addSound(sound);
+ }
+
+ if (_soundLibrary1.size() > 0) {
+ loadExternalSounds(_soundLibrary1);
+ }
+ if (_soundLibrary2.size() > 0) {
+ loadExternalSounds(_soundLibrary2);
+ }
+
+ // Load Patterns
+ res = resMan->getResource("PAT#", 900, &resSize);
+ if (res != NULL) {
+ Common::MemoryReadStream readP(res, resSize);
+ int count = readP.readUint16LE();
+ for (int i = 0; i < count; i++) {
+ byte *pattern = (byte *)malloc(8);
+ for (int j = 0; j < 8; j++) {
+ pattern[j] = readP.readByte();
+ _patterns.push_back(pattern);
+ }
+ }
+
+ free(res);
+ }
return true;
}
diff --git a/engines/wage/world.h b/engines/wage/world.h
index 3a8d7edc15..d8c3daeeb3 100644
--- a/engines/wage/world.h
+++ b/engines/wage/world.h
@@ -42,6 +42,7 @@ public:
~World();
bool loadWorld(MacResManager *resMan);
+ void loadExternalSounds(String fname);
String _name;
String _aboutMessage;
@@ -60,7 +61,7 @@ public:
Common::List<Sound *> _orderedSounds;
Common::List<byte *> _patterns;
Scene _storageScene;
- Chr _player;
+ Chr *_player;
//List<MoveListener> moveListeners;
void addScene(Scene *room) {