aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/disk_br.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2007-08-12 19:11:37 +0000
committerNicola Mettifogo2007-08-12 19:11:37 +0000
commit3465571b121fdcaba1b97f0a52b1aa16a25390a5 (patch)
treece450e7d458ed4eda0de1e5bb68bac95a94d2430 /engines/parallaction/disk_br.cpp
parentd7b6f0ecc849ec4dbd6916f2ce466caae7343dc0 (diff)
downloadscummvm-rg350-3465571b121fdcaba1b97f0a52b1aa16a25390a5.tar.gz
scummvm-rg350-3465571b121fdcaba1b97f0a52b1aa16a25390a5.tar.bz2
scummvm-rg350-3465571b121fdcaba1b97f0a52b1aa16a25390a5.zip
Added preliminary support for loading locations in BRA:
- changed parseLocation to invoke subclasses for version-specific keywords. - implemented loading of background resources (backgrounds should be visible) svn-id: r28568
Diffstat (limited to 'engines/parallaction/disk_br.cpp')
-rw-r--r--engines/parallaction/disk_br.cpp56
1 files changed, 52 insertions, 4 deletions
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 65332a2a4a..b79af9c655 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -25,6 +25,7 @@
#include "common/stdafx.h"
#include "parallaction/parallaction.h"
+#include "parallaction/util.h"
namespace Parallaction {
@@ -87,17 +88,17 @@ Cnv* DosDisk_br::loadTalk(const char *name) {
Script* DosDisk_br::loadLocation(const char *name) {
debugC(5, kDebugDisk, "DosDisk_br::loadLocation");
- Common::File stream;
+ Common::File *stream = new Common::File;
char path[PATH_LEN];
sprintf(path, "%s/%s/%s.slf", _partPath, _languageDir, name);
- if (!stream.open(path)) {
+ if (!stream->open(path)) {
sprintf(path, "%s/%s/%s.loc", _partPath, _languageDir, name);
- if (!stream.open(path))
+ if (!stream->open(path))
errorFileNotFound(path);
}
- return new Script(&stream, false);
+ return new Script(stream, true);
}
Script* DosDisk_br::loadScript(const char* name) {
@@ -205,6 +206,53 @@ void DosDisk_br::loadSlide(BackgroundInfo& info, const char *name) {
void DosDisk_br::loadScenery(BackgroundInfo& info, const char *name, const char *mask, const char* path) {
debugC(5, kDebugDisk, "DosDisk_br::loadScenery");
+
+ char filename[PATH_LEN];
+ Common::File stream;
+
+ if (name) {
+ sprintf(filename, "%s/bkg/%s.bkg", _partPath, name);
+ if (!stream.open(filename))
+ errorFileNotFound(filename);
+
+ stream.skip(4);
+ info.width = stream.readUint32BE();
+ info.height = stream.readUint32BE();
+ stream.skip(20);
+
+ byte rgb[768];
+ stream.read(rgb, 768);
+
+ for (uint i = 0; i < 256; i++) {
+ info.palette.setEntry(i, rgb[i] >> 2, rgb[i+256] >> 2, rgb[i+512] >> 2);
+ }
+
+ info.bg.create(info.width, info.height, 1);
+ stream.read(info.bg.pixels, info.width * info.height);
+ }
+
+ if (mask) {
+ sprintf(filename, "%s/msk/%s.msk", _partPath, mask);
+ if (!stream.open(filename))
+ errorFileNotFound(filename);
+
+ // NOTE: info.width and info.height are only valid if the background graphics
+ // have already been loaded
+ info.mask.create(info.width, info.height);
+ stream.read(info.mask.data, info.width * info.height);
+ }
+
+ if (path) {
+ sprintf(filename, "%s/pth/%s.pth", _partPath, path);
+ if (!stream.open(filename))
+ errorFileNotFound(filename);
+
+ // NOTE: info.width and info.height are only valid if the background graphics
+ // have already been loaded
+ info.path.create(info.width, info.height);
+ stream.read(info.path.data, info.width * info.height);
+ }
+
return;
}