aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/disk.cpp27
-rw-r--r--engines/parallaction/graphics.cpp17
2 files changed, 30 insertions, 14 deletions
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index dea7a54078..c224ac5801 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -1030,6 +1030,31 @@ void buildMask(byte* buf) {
}
}
+class BackgroundDecoder : public Graphics::ILBMDecoder {
+
+ PaletteFxRange *_range;
+ uint32 _i;
+
+protected:
+ void readCRNG() {
+ _range[_i]._timer = _chunk.readUint16();
+ _range[_i]._step = _chunk.readUint16();
+ _range[_i]._flags = _chunk.readUint16();
+ _range[_i]._first = _chunk.readByte();
+ _range[_i]._last = _chunk.readByte();
+
+ _i++;
+ }
+
+public:
+ BackgroundDecoder(Common::ReadStream &input, PaletteFxRange *range) : ILBMDecoder(input), _range(range), _i(0) {
+ }
+
+ uint32 getNumRanges() {
+ return _i;
+ }
+};
+
void AmigaDisk::loadScenery(const char* background, const char* mask) {
debugC(1, kDebugDisk, "AmigaDisk::loadScenery '%s', '%s'", background, mask);
@@ -1039,7 +1064,7 @@ void AmigaDisk::loadScenery(const char* background, const char* mask) {
sprintf(path, "%s.bkgnd", background);
Common::SeekableReadStream *s = openArchivedFile(path, true);
- Graphics::ILBMDecoder decoder(*s);
+ BackgroundDecoder decoder(*s, _vm->_gfx->_palettefx);
decoder.decode(surf, pal);
for (uint32 i = 0; i < PALETTE_SIZE; i++)
_vm->_gfx->_palette[i] = pal[i] >> 2;
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index f7429d6262..7d21c81a5a 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -883,17 +883,6 @@ int16 Gfx::queryMask(int16 v) {
return 3;
}
-void Gfx::initBuffers() {
-
- _buffers[kBitFront] = (byte*)malloc(SCREEN_SIZE);
- _buffers[kBitBack] = (byte*)malloc(SCREEN_SIZE);
- _buffers[kBit2] = (byte*)malloc(SCREEN_SIZE);
- _buffers[kMask0] = (byte*)malloc(SCREENMASK_WIDTH * SCREEN_HEIGHT);
-
- return;
-}
-
-
Gfx::Gfx(Parallaction* vm) :
_vm(vm) {
@@ -901,7 +890,10 @@ Gfx::Gfx(Parallaction* vm) :
g_system->initSize(SCREEN_WIDTH, SCREEN_HEIGHT);
g_system->endGFXTransaction();
- initBuffers();
+ _buffers[kBitFront] = (byte*)malloc(SCREEN_SIZE);
+ _buffers[kBitBack] = (byte*)malloc(SCREEN_SIZE);
+ _buffers[kBit2] = (byte*)malloc(SCREEN_SIZE);
+ _buffers[kMask0] = (byte*)malloc(SCREENMASK_WIDTH * SCREEN_HEIGHT);
setBlackPalette();
@@ -917,7 +909,6 @@ Gfx::Gfx(Parallaction* vm) :
Gfx::~Gfx() {
free(_buffers[kMask0]);
-
free(_buffers[kBitFront]);
free(_buffers[kBitBack]);
free(_buffers[kBit2]);