diff options
author | Alyssa Milburn | 2011-07-17 23:44:41 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-07-17 23:44:41 +0200 |
commit | 2e89bd73f6d61ed45bd15578fe4d618804244092 (patch) | |
tree | 0b1ee5aba0100e3a1743ef6090279b0a4008a8f6 /engines/composer | |
parent | 0366a982c3a5682b636b16e3b3cb6d76e74d6489 (diff) | |
download | scummvm-rg350-2e89bd73f6d61ed45bd15578fe4d618804244092.tar.gz scummvm-rg350-2e89bd73f6d61ed45bd15578fe4d618804244092.tar.bz2 scummvm-rg350-2e89bd73f6d61ed45bd15578fe4d618804244092.zip |
COMPOSER: Implement kFuncLoadData.
Diffstat (limited to 'engines/composer')
-rw-r--r-- | engines/composer/composer.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 9b7b4d6f03..93b201e263 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -1578,8 +1578,25 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1 warning("ignoring kFuncSaveData(%d, %d, %d)", param1, param2, param3); return 1; case kFuncLoadData: - // TODO - warning("ignoring kFuncLoadData(%d, %d, %d)", param1, param2, param3); + debug(3, "ignoring kFuncLoadData(%d, %d, %d)", param1, param2, param3); + { + Common::String filename = getFilename("Data", param1); + Common::File *file = new Common::File(); + if (!file->open(filename)) + error("couldn't open '%s' to get data id '%d'", filename.c_str(), param1); + if (param3 == 0) + param3 = 1000; + else + param3 = param3 / 2; + if (param2 < 0 || param3 < 0 || param2 + param3 > 1000) + error("can't read %d entries into %d from file '%s' for data id '%d'", param3, param2, filename.c_str(), param1); + for (uint i = 0; i < (uint)param3; i++) { + if (file->pos() + 1 > file->size()) + break; + _vars[param2 + i] = file->readUint16LE(); + } + delete file; + } return 1; case kFuncGetSpriteSize: debug(3, "kFuncGetSpriteSize(%d, %d, %d)", param1, param2, param3); |