diff options
author | uruk | 2013-07-03 17:06:36 +0200 |
---|---|---|
committer | uruk | 2013-07-03 17:06:36 +0200 |
commit | 590f89e90e547076f27c25dfb2c1058f7f95bbbf (patch) | |
tree | 799b1bcf40b80a1ae4ff992768b6e28e4016fd8a /engines | |
parent | 8d03232cf85068f1ceb40940f92644fa6441310a (diff) | |
download | scummvm-rg350-590f89e90e547076f27c25dfb2c1058f7f95bbbf.tar.gz scummvm-rg350-590f89e90e547076f27c25dfb2c1058f7f95bbbf.tar.bz2 scummvm-rg350-590f89e90e547076f27c25dfb2c1058f7f95bbbf.zip |
AVALANCHE: Celer: Implement file handling.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/avalanche/celer2.cpp | 51 | ||||
-rw-r--r-- | engines/avalanche/celer2.h | 8 |
2 files changed, 55 insertions, 4 deletions
diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index c02a82f6f0..6bacde735d 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -268,8 +268,55 @@ void Celer::pics_link() { } } -void Celer::load_chunks(Common::String xx) { - warning("STUB: Celer::load_chunks()"); +void Celer::load_chunks(char *xx) { + chunkblocktype ch; + byte fv; + + Common::String filename; + filename = filename.format("chunk%s.avd", xx); + if (!f.open(filename)) { + warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); + return; + } + + f.seek(44); + num_chunks = f.readByte(); + for (int i = 0; i < num_chunks; i++) + offsets[i] = f.readSint32LE(); + + for (fv = 0; fv < num_chunks; fv++) { + f.seek(offsets[fv]); + + ch.flavour = flavourtype(f.readByte()); + ch.x = f.readSint16LE(); + ch.y = f.readSint16LE(); + ch.xl = f.readSint16LE(); + ch.yl = f.readSint16LE(); + ch.size = f.readSint32LE(); + ch.natural = f.readByte(); + ch.memorise = f.readByte(); + + if (ch.memorise) { + + memos[fv].x = ch.x; + memos[fv].xl = ch.xl; + memos[fv].y = ch.y; + memos[fv].yl = ch.yl; + memos[fv].flavour = ch.flavour; + memos[fv].size = ch.size; + + memory[fv] = malloc(ch.size); // Celer::forget_chunks() deallocates it. + + /*if (ch.natural) { + getimage(ch.x * 8, ch.y, (ch.x + ch.xl) * 8, ch.y + ch.yl, memory[fv]); + } else + blockread(f, memory[fv], ch.size);*/ + } else + memos[fv].x = on_disk; + + } + + f.close(); } void Celer::forget_chunks() { diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index e71dec5f19..aa32bf58a2 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -31,6 +31,7 @@ #define CELER2_H #include "common/scummsys.h" +#include "common/file.h" #include "common/str.h" namespace Avalanche { @@ -38,7 +39,7 @@ class AvalancheEngine; class Celer { public: - enum flavourtype {ch_ega, ch_bgi, last_flavourtype}; + enum flavourtype {ch_ega, ch_bgi}; struct chunkblocktype { flavourtype flavour; @@ -62,6 +63,9 @@ public: memotype memos[40]; void *memory[40]; + Common::File f; + + Celer(); @@ -69,7 +73,7 @@ public: void pics_link(); - void load_chunks(Common::String xx); + void load_chunks(char *xx); void forget_chunks(); |