aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche
diff options
context:
space:
mode:
Diffstat (limited to 'engines/avalanche')
-rw-r--r--engines/avalanche/celer2.cpp17
-rw-r--r--engines/avalanche/celer2.h2
2 files changed, 13 insertions, 6 deletions
diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp
index 6bacde735d..a106ce5e2a 100644
--- a/engines/avalanche/celer2.cpp
+++ b/engines/avalanche/celer2.cpp
@@ -281,7 +281,7 @@ void Celer::load_chunks(char *xx) {
f.seek(44);
num_chunks = f.readByte();
- for (int i = 0; i < num_chunks; i++)
+ for (byte i = 0; i < num_chunks; i++)
offsets[i] = f.readSint32LE();
for (fv = 0; fv < num_chunks; fv++) {
@@ -305,22 +305,29 @@ void Celer::load_chunks(char *xx) {
memos[fv].flavour = ch.flavour;
memos[fv].size = ch.size;
- memory[fv] = malloc(ch.size); // Celer::forget_chunks() deallocates it.
+ memory[fv] = new byte[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);*/
+ warning("STUB: Celer::load_chunks()");
+
+ if (!ch.natural)
+ for (int32 i = 0; i < ch.size; i++)
+ memory[fv][i] = f.readByte();
} else
memos[fv].x = on_disk;
-
}
-
f.close();
}
void Celer::forget_chunks() {
- warning("STUB: Celer::forget_chunks()");
+ for (byte fv = 0; fv < num_chunks; fv ++)
+ if (memos[fv].x > on_disk)
+ delete[] memory[fv];
+
+ memset(memos, 255, sizeof(memos)); /* x=-1, => on disk. */
}
void Celer::mdrop(int16 x, int16 y, int16 xl, int16 yl, void *p) { /* assembler;
diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h
index aa32bf58a2..444a5aa94d 100644
--- a/engines/avalanche/celer2.h
+++ b/engines/avalanche/celer2.h
@@ -61,7 +61,7 @@ public:
int32 offsets[40];
byte num_chunks;
memotype memos[40];
- void *memory[40];
+ byte *memory[40];
Common::File f;