aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2007-03-16 23:08:59 +0000
committerJohannes Schickel2007-03-16 23:08:59 +0000
commit4951f82c65d31e1f62041c9c07cf74181c035ce7 (patch)
treee9d6578b50144c6f8049598d34c4dc2afcda84ab
parent5d59ee609190d8b349e2751adf9f98ba0b9695e8 (diff)
downloadscummvm-rg350-4951f82c65d31e1f62041c9c07cf74181c035ce7.tar.gz
scummvm-rg350-4951f82c65d31e1f62041c9c07cf74181c035ce7.tar.bz2
scummvm-rg350-4951f82c65d31e1f62041c9c07cf74181c035ce7.zip
Basic support for Amiga MSC files.
svn-id: r26153
-rw-r--r--engines/kyra/screen.cpp38
-rw-r--r--engines/kyra/screen.h3
-rw-r--r--engines/kyra/sprites.cpp1
3 files changed, 31 insertions, 11 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index ca736aac7b..6b4006e523 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -415,8 +415,10 @@ void Screen::setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue) {
void Screen::setScreenPalette(const uint8 *palData) {
debugC(9, kDebugLevelScreen, "Screen::setScreenPalette(%p)", (const void *)palData);
+
if (palData != _screenPalette)
memcpy(_screenPalette, palData, 768);
+
uint8 screenPal[256 * 4];
for (int i = 0; i < 256; ++i) {
screenPal[4 * i + 0] = (palData[0] << 2) | (palData[0] & 3);
@@ -1690,7 +1692,7 @@ void Screen::decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch, bool
}
}
-void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen) {
+void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen, int planeOffset) {
static uint8 tmp[320*200];
if (offscreen) {
@@ -1699,10 +1701,10 @@ void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen) {
int hC = h;
while (hC--) {
uint8 *dst1 = curLine;
- uint8 *dst2 = dst1 + 8000;
- uint8 *dst3 = dst2 + 8000;
- uint8 *dst4 = dst3 + 8000;
- uint8 *dst5 = dst4 + 8000;
+ uint8 *dst2 = dst1 + planeOffset;
+ uint8 *dst3 = dst2 + planeOffset;
+ uint8 *dst4 = dst3 + planeOffset;
+ uint8 *dst5 = dst4 + planeOffset;
int width = w >> 3;
while (width--) {
@@ -1719,7 +1721,6 @@ void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen) {
memcpy(tmp, data, w*h);
}
- int planeOffset = 8000;
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
int bytePos = x/8+y*40;
@@ -1736,6 +1737,22 @@ void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen) {
}
}
+void Screen::convertAmigaMsc(uint8 *data) {
+ Screen::convertAmigaGfx(data, 320, 200, false, 5760);
+ for (int i = 0; i < 64000; ++i) {
+ byte src = *data;
+ byte dst = 0;
+ if (!(src & 0x1)) {
+ dst |= 0x80;
+ }
+ // FIXME: this is totally wrong, correct this
+ src >>= 1;
+ src &= 0x7;
+ dst |= src;
+ *data++ = dst;
+ }
+}
+
template<bool noXor>
void Screen::wrapped_decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch) {
int count = 0;
@@ -2282,9 +2299,8 @@ byte Screen::getShapeFlag1(int x, int y) {
color &= 0x80;
color ^= 0x80;
- if (color & 0x80) {
+ if (color & 0x80)
return 1;
- }
return 0;
}
@@ -2558,7 +2574,11 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *
}
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
- Screen::convertAmigaGfx(dstData, 320, 200, false);
+ const char *ext = filename + strlen(filename) - 3;
+ if (!scumm_stricmp(ext, "MSC"))
+ Screen::convertAmigaMsc(dstData);
+ else
+ Screen::convertAmigaGfx(dstData, 320, 200, false);
}
delete [] srcData;
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index aaf913c8d2..5d317e0035 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -231,7 +231,8 @@ public:
static uint decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize);
static void decodeFrameDelta(uint8 *dst, const uint8 *src, bool noXor = false);
static void decodeFrameDeltaPage(uint8 *dst, const uint8 *src, const int pitch, bool noXor);
- static void convertAmigaGfx(uint8 *data, int w, int h, bool offscreen = true);
+ static void convertAmigaGfx(uint8 *data, int w, int h, bool offscreen = true, int planeOffset = 8000);
+ static void convertAmigaMsc(uint8 *data);
// maybe subclass screen for kyra3
static const ScreenDim _screenDimTableK3[];
diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp
index 707f3eec35..409958da18 100644
--- a/engines/kyra/sprites.cpp
+++ b/engines/kyra/sprites.cpp
@@ -422,7 +422,6 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) {
}
// XXX
_engine->_paletteChanged = 1;
- // FIXME: check this...
if (_engine->gameFlags().platform != Common::kPlatformAmiga) {
_screen->loadPalette(_dat + 0x17, _screen->getPalette(1) + 684, 60);
}