aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/res_ami.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agos/res_ami.cpp')
-rw-r--r--engines/agos/res_ami.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp
index 3bd951365f..f86d0344f5 100644
--- a/engines/agos/res_ami.cpp
+++ b/engines/agos/res_ami.cpp
@@ -92,7 +92,7 @@ static void bitplaneToChunkyText(uint16 *w, uint8 colorDepth, uint8 *&dst) {
}
}
-static void convertCompressedImage(const byte *src, byte *dst, uint8 colorDepth, int height, int width) {
+static void convertCompressedImage(const byte *src, byte *dst, uint8 colorDepth, int height, int width, bool horizontal = true) {
const byte *plane[kMaxColorDepth];
byte *uncptr[kMaxColorDepth];
int length, i, j;
@@ -119,10 +119,19 @@ static void convertCompressedImage(const byte *src, byte *dst, uint8 colorDepth,
uncbfroutptr = uncbfrout;
const int chunkSize = colorDepth > 4 ? 16 : 8;
- for (i = 0; i < width / 16; ++i) {
+ if (horizontal) {
for (j = 0; j < height; ++j) {
- memcpy(dst + width * chunkSize / 16 * j + chunkSize * i, uncbfroutptr, chunkSize);
- uncbfroutptr += chunkSize;
+ for (i = 0; i < width / 16; ++i) {
+ memcpy(dst + width * chunkSize / 16 * j + chunkSize * i, uncbfroutptr, chunkSize);
+ uncbfroutptr += chunkSize;
+ }
+ }
+ } else {
+ for (i = 0; i < width / 16; ++i) {
+ for (j = 0; j < height; ++j) {
+ memcpy(dst + width * chunkSize / 16 * j + chunkSize * i, uncbfroutptr, chunkSize);
+ uncbfroutptr += chunkSize;
+ }
}
}
@@ -152,7 +161,7 @@ byte *AGOSEngine::convertImage(VC10_state *state, bool compressed) {
byte *dst = _planarBuf;
if (compressed) {
- convertCompressedImage(src, dst, colorDepth, height, width);
+ convertCompressedImage(src, dst, colorDepth, height, width, (getGameType() == GType_PN));
} else {
length = (width + 15) / 16 * height;
for (i = 0; i < length; i++) {