aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/entities.cpp64
-rw-r--r--engines/wage/util.cpp22
-rw-r--r--engines/wage/wage.h1
-rw-r--r--engines/wage/world.cpp14
4 files changed, 39 insertions, 62 deletions
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 90247a5b21..f4981a7269 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -123,11 +123,11 @@ Scene::Scene(Common::String name, Common::SeekableReadStream *data) {
_soundFrequency = data->readSint16BE();
_soundType = data->readByte();
data->readByte(); // unknown
- _messages[NORTH] = readPascalString(data);
- _messages[SOUTH] = readPascalString(data);
- _messages[EAST] = readPascalString(data);
- _messages[WEST] = readPascalString(data);
- _soundName = readPascalString(data);
+ _messages[NORTH] = data->readPascalString();
+ _messages[SOUTH] = data->readPascalString();
+ _messages[EAST] = data->readPascalString();
+ _messages[WEST] = data->readPascalString();
+ _soundName = data->readPascalString();
_visited = false;
@@ -229,12 +229,12 @@ Obj::Obj(Common::String name, Common::SeekableReadStream *data, int resourceId)
else
error("Obj <%s> had weird returnTo set", name.c_str());
- _sceneOrOwner = readPascalString(data);
- _clickMessage = readPascalString(data);
- _operativeVerb = readPascalString(data);
- _failureMessage = readPascalString(data);
- _useMessage = readPascalString(data);
- _sound = readPascalString(data);
+ _sceneOrOwner = data->readPascalString();
+ _clickMessage = data->readPascalString();
+ _operativeVerb = data->readPascalString();
+ _failureMessage = data->readPascalString();
+ _useMessage = data->readPascalString();
+ _sound = data->readPascalString();
delete data;
}
@@ -329,27 +329,27 @@ Chr::Chr(Common::String name, Common::SeekableReadStream *data) {
else
_nameProperNoun = false;
- _initialScene = readPascalString(data);
- _nativeWeapon1 = readPascalString(data);
- _operativeVerb1 = readPascalString(data);
- _nativeWeapon2 = readPascalString(data);
- _operativeVerb2 = readPascalString(data);
-
- _initialComment = readPascalString(data);
- _scoresHitComment = readPascalString(data);
- _receivesHitComment = readPascalString(data);
- _makesOfferComment = readPascalString(data);
- _rejectsOfferComment = readPascalString(data);
- _acceptsOfferComment = readPascalString(data);
- _dyingWords = readPascalString(data);
-
- _initialSound = readPascalString(data);
- _scoresHitSound = readPascalString(data);
- _receivesHitSound = readPascalString(data);
- _dyingSound = readPascalString(data);
-
- _weaponSound1 = readPascalString(data);
- _weaponSound2 = readPascalString(data);
+ _initialScene = data->readPascalString();
+ _nativeWeapon1 = data->readPascalString();
+ _operativeVerb1 = data->readPascalString();
+ _nativeWeapon2 = data->readPascalString();
+ _operativeVerb2 = data->readPascalString();
+
+ _initialComment = data->readPascalString();
+ _scoresHitComment = data->readPascalString();
+ _receivesHitComment = data->readPascalString();
+ _makesOfferComment = data->readPascalString();
+ _rejectsOfferComment = data->readPascalString();
+ _acceptsOfferComment = data->readPascalString();
+ _dyingWords = data->readPascalString();
+
+ _initialSound = data->readPascalString();
+ _scoresHitSound = data->readPascalString();
+ _receivesHitSound = data->readPascalString();
+ _dyingSound = data->readPascalString();
+
+ _weaponSound1 = data->readPascalString();
+ _weaponSound2 = data->readPascalString();
for (int i = 0; i < NUMBER_OF_ARMOR_TYPES; i++)
_armor[i] = NULL;
diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp
index 6cab7f8ee6..f2073ac140 100644
--- a/engines/wage/util.cpp
+++ b/engines/wage/util.cpp
@@ -51,28 +51,6 @@
namespace Wage {
-Common::String readPascalString(Common::SeekableReadStream *in) {
- Common::String s;
- char *buf;
- int len;
- int i;
-
- len = in->readByte();
- buf = (char *)malloc(len + 1);
- for (i = 0; i < len; i++) {
- buf[i] = in->readByte();
- if (buf[i] == 0x0d)
- buf[i] = '\n';
- }
-
- buf[i] = 0;
-
- s = buf;
- free(buf);
-
- return s;
-}
-
Common::Rect *readRect(Common::SeekableReadStream *in) {
int x1, y1, x2, y2;
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 38c5294ca5..4c93399ad7 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -103,7 +103,6 @@ enum {
// the current limitation is 32 debug levels (1 << 31 is the last one)
};
-Common::String readPascalString(Common::SeekableReadStream *in);
Common::Rect *readRect(Common::SeekableReadStream *in);
const char *getIndefiniteArticle(const Common::String &word);
const char *prependGenderSpecificPronoun(int gender);
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 90d689720e..2e99af9f1e 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -156,13 +156,13 @@ bool World::loadWorld(Common::MacResManager *resMan) {
error("Unexpected value for weapons menu");
res->skip(3);
- _aboutMessage = readPascalString(res);
+ _aboutMessage = res->readPascalString();
if (!scumm_stricmp(resMan->getBaseFileName().c_str(), "Scepters"))
res->skip(1); // ????
- _soundLibrary1 = readPascalString(res);
- _soundLibrary2 = readPascalString(res);
+ _soundLibrary1 = res->readPascalString();
+ _soundLibrary2 = res->readPascalString();
delete res;
}
@@ -337,8 +337,8 @@ void World::addSound(Sound *sound) {
Common::StringArray *World::readMenu(Common::SeekableReadStream *res) {
res->skip(10);
int enableFlags = res->readUint32BE();
- Common::String menuName = readPascalString(res);
- Common::String menuItem = readPascalString(res);
+ Common::String menuName = res->readPascalString();
+ Common::String menuItem = res->readPascalString();
int menuItemNumber = 1;
Common::String menu;
byte itemData[4];
@@ -363,7 +363,7 @@ Common::StringArray *World::readMenu(Common::SeekableReadStream *res) {
menu += '/';
menu += (char)itemData[1];
}
- menuItem = readPascalString(res);
+ menuItem = res->readPascalString();
menuItemNumber++;
}
@@ -408,7 +408,7 @@ Common::String *World::loadStringFromDITL(Common::MacResManager *resMan, int res
for (int i = 0; i <= itemCount; i++) {
// int placeholder; short rect[4]; byte flags; pstring str;
res->skip(13);
- Common::String message = readPascalString(res);
+ Common::String message = res->readPascalString();
if (i == itemIndex) {
Common::String *msg = new Common::String(message);
delete res;