aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-16 01:29:02 -0400
committerPaul Gilbert2014-03-16 01:29:02 -0400
commit17870490873bd9ba040b58cb5fbfc1c8480d5461 (patch)
treef7c22bc4f381952ef9e27016f2556094194efdd2 /engines
parent120374b7d0eb1af089111f3dfa710122d2ab7424 (diff)
downloadscummvm-rg350-17870490873bd9ba040b58cb5fbfc1c8480d5461.tar.gz
scummvm-rg350-17870490873bd9ba040b58cb5fbfc1c8480d5461.tar.bz2
scummvm-rg350-17870490873bd9ba040b58cb5fbfc1c8480d5461.zip
MADS: Add loading of game inventory list and quotes
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/game.cpp22
-rw-r--r--engines/mads/resources.cpp4
2 files changed, 16 insertions, 10 deletions
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index a4f3b24542..5c034bf8bf 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -60,6 +60,12 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm),
_abortTimersMode2 = ABORTMODE_0;
_ticksExpiry = 0;
_exitFlag = 0;
+
+ // Load the inventory object list
+ _objects.load();
+
+ // Load the quotes
+ loadQuotes();
}
Game::~Game() {
@@ -285,20 +291,18 @@ void Game::loadQuotes() {
File f("*QUOTES.DAT");
int curPos = 0;
- char buffer[128];
- strcpy(buffer, "");
-
+ Common::String msg;
while (true) {
uint8 b = f.readByte();
- if (f.eos()) break;
- buffer[curPos++] = b;
- if (buffer[curPos - 1] == '\0') {
+ msg += b;
+ if (f.eos() || b == '\0') {
// end of string, add it to the strings list
- _quotes.push_back(buffer);
- curPos = 0;
- strcpy(buffer, "");
+ _quotes.push_back(msg);
+ msg = "";
}
+
+ if (f.eos()) break;
}
f.close();
diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp
index 140a34749a..2742b5b435 100644
--- a/engines/mads/resources.cpp
+++ b/engines/mads/resources.cpp
@@ -313,7 +313,9 @@ Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE e
(prefix < 100) ? "*SC" : "*RM", prefix);
}
- result += Common::String::format("%c%d", asciiCh, id);
+ result += Common::String::format("%c", asciiCh);
+ if (id >= 0)
+ result += Common::String::format("%d", id);
if (!suffix.empty())
result += suffix;