2004-04-12 21:40:49 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2004-2006 The ScummVM project
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
2006-02-11 12:44:16 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
// SAGA Image resource management routines
|
2004-08-02 16:20:35 +00:00
|
|
|
#include "saga/saga.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-15 00:24:12 +00:00
|
|
|
#include "saga/stream.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
namespace Saga {
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
static int granulate(int value, int granularity) {
|
2004-04-27 11:44:17 +00:00
|
|
|
int remainder;
|
|
|
|
|
|
|
|
if (value == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (granularity == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
remainder = value % granularity;
|
|
|
|
|
|
|
|
if (remainder == 0) {
|
|
|
|
return value;
|
|
|
|
} else {
|
|
|
|
return (granularity - remainder + value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-31 13:49:26 +00:00
|
|
|
int SagaEngine::decodeBGImage(const byte *image_data, size_t image_size,
|
2005-10-17 14:20:18 +00:00
|
|
|
byte **output_buf, size_t *output_buf_len, int *w, int *h, bool flip) {
|
2005-07-14 17:46:21 +00:00
|
|
|
ImageHeader hdr;
|
2004-04-12 21:40:49 +00:00
|
|
|
int modex_height;
|
2004-04-30 23:02:23 +00:00
|
|
|
const byte *RLE_data_ptr;
|
2004-04-12 21:40:49 +00:00
|
|
|
size_t RLE_data_len;
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *decode_buf;
|
2004-04-12 21:40:49 +00:00
|
|
|
size_t decode_buf_len;
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *out_buf;
|
2004-04-12 21:40:49 +00:00
|
|
|
size_t out_buf_len;
|
|
|
|
|
|
|
|
if (image_size <= SAGA_IMAGE_DATA_OFFSET) {
|
2006-03-08 11:37:25 +00:00
|
|
|
error("decodeBGImage() Image size is way too small (%d)", (int)image_size);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2005-07-19 19:05:52 +00:00
|
|
|
MemoryReadStreamEndian readS(image_data, image_size, isBigEndian());
|
2004-05-04 03:33:03 +00:00
|
|
|
|
2004-12-15 00:24:12 +00:00
|
|
|
hdr.width = readS.readUint16();
|
|
|
|
hdr.height = readS.readUint16();
|
2004-11-02 08:37:14 +00:00
|
|
|
// The next four bytes of the image header aren't used.
|
2004-12-15 00:24:12 +00:00
|
|
|
readS.readUint16();
|
|
|
|
readS.readUint16();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
RLE_data_ptr = image_data + SAGA_IMAGE_DATA_OFFSET;
|
|
|
|
RLE_data_len = image_size - SAGA_IMAGE_DATA_OFFSET;
|
|
|
|
|
2004-04-27 11:44:17 +00:00
|
|
|
modex_height = granulate(hdr.height, 4);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
decode_buf_len = hdr.width * modex_height;
|
2004-04-30 23:02:23 +00:00
|
|
|
decode_buf = (byte *)malloc(decode_buf_len);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
out_buf_len = hdr.width * hdr.height;
|
2004-04-30 23:02:23 +00:00
|
|
|
out_buf = (byte *)malloc(out_buf_len);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-07-31 20:50:34 +00:00
|
|
|
if (decodeBGImageRLE(RLE_data_ptr,
|
2004-10-27 21:32:28 +00:00
|
|
|
RLE_data_len, decode_buf, decode_buf_len) != SUCCESS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
free(decode_buf);
|
|
|
|
free(out_buf);
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-07-31 20:50:34 +00:00
|
|
|
unbankBGImage(out_buf, decode_buf, hdr.width, hdr.height);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
// For some reason bg images in IHNM are upside down
|
2005-10-17 14:20:18 +00:00
|
|
|
if (getGameType() == GType_IHNM && !flip) {
|
2004-07-31 20:50:34 +00:00
|
|
|
flipImage(out_buf, hdr.width, hdr.height);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
free(decode_buf);
|
|
|
|
|
|
|
|
*output_buf_len = out_buf_len;
|
|
|
|
*output_buf = out_buf;
|
|
|
|
|
|
|
|
*w = hdr.width;
|
|
|
|
*h = hdr.height;
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
return SUCCESS;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-07-31 20:50:34 +00:00
|
|
|
int SagaEngine::decodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len) {
|
2004-04-30 23:02:23 +00:00
|
|
|
const byte *inbuf_ptr;
|
|
|
|
byte *outbuf_ptr;
|
2004-05-01 15:08:20 +00:00
|
|
|
uint32 inbuf_remain;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-04-30 23:02:23 +00:00
|
|
|
const byte *inbuf_end;
|
|
|
|
byte *outbuf_end;
|
2004-05-01 15:08:20 +00:00
|
|
|
uint32 outbuf_remain;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-04-30 23:02:23 +00:00
|
|
|
byte mark_byte;
|
2004-04-12 21:40:49 +00:00
|
|
|
int test_byte;
|
|
|
|
|
2004-05-01 16:24:39 +00:00
|
|
|
uint32 runcount;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-04-30 23:02:23 +00:00
|
|
|
byte bitfield;
|
|
|
|
byte bitfield_byte1;
|
|
|
|
byte bitfield_byte2;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *backtrack_ptr;
|
2004-04-12 21:40:49 +00:00
|
|
|
int backtrack_amount;
|
|
|
|
|
2004-04-30 23:02:23 +00:00
|
|
|
uint16 c, b;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
int decode_err = 0;
|
|
|
|
|
|
|
|
inbuf_ptr = inbuf;
|
|
|
|
inbuf_remain = inbuf_len;
|
|
|
|
|
|
|
|
outbuf_ptr = outbuf;
|
|
|
|
outbuf_remain = outbuf_len;
|
|
|
|
|
|
|
|
inbuf_end = (inbuf + inbuf_len) - 1;
|
|
|
|
outbuf_end = (outbuf + outbuf_len) - 1;
|
|
|
|
|
|
|
|
memset(outbuf, 0, outbuf_len);
|
|
|
|
|
|
|
|
while ((inbuf_remain > 1) && (outbuf_remain > 0) && !decode_err) {
|
|
|
|
|
|
|
|
if ((inbuf_ptr > inbuf_end) || (outbuf_ptr > outbuf_end)) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mark_byte = *inbuf_ptr++;
|
|
|
|
inbuf_remain--;
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
test_byte = mark_byte & 0xC0; // Mask all but two high order bits
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
switch (test_byte) {
|
2004-05-01 09:19:35 +00:00
|
|
|
case 0xC0: // 1100 0000
|
|
|
|
// Uncompressed run follows: Max runlength 63
|
2004-04-12 21:40:49 +00:00
|
|
|
runcount = mark_byte & 0x3f;
|
2004-05-01 09:19:35 +00:00
|
|
|
if ((inbuf_remain < runcount) || (outbuf_remain < runcount)) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (c = 0; c < runcount; c++) {
|
|
|
|
*outbuf_ptr++ = *inbuf_ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_remain -= runcount;
|
|
|
|
outbuf_remain -= runcount;
|
|
|
|
continue;
|
|
|
|
break;
|
2004-05-01 09:19:35 +00:00
|
|
|
case 0x80: // 1000 0000
|
|
|
|
// Compressed run follows: Max runlength 63
|
2004-04-12 21:40:49 +00:00
|
|
|
runcount = (mark_byte & 0x3f) + 3;
|
|
|
|
if (!inbuf_remain || (outbuf_remain < runcount)) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (c = 0; c < runcount; c++) {
|
|
|
|
*outbuf_ptr++ = *inbuf_ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_ptr++;
|
|
|
|
inbuf_remain--;
|
|
|
|
outbuf_remain -= runcount;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
case 0x40: // 0100 0000
|
2005-07-29 17:58:00 +00:00
|
|
|
// Repeat decoded sequence from output stream:
|
2004-05-01 09:19:35 +00:00
|
|
|
// Max runlength 10
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
runcount = ((mark_byte >> 3) & 0x07U) + 3;
|
|
|
|
backtrack_amount = *inbuf_ptr;
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
if (!inbuf_remain || (backtrack_amount > (outbuf_ptr - outbuf)) || (runcount > outbuf_remain)) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_ptr++;
|
|
|
|
inbuf_remain--;
|
|
|
|
|
|
|
|
backtrack_ptr = outbuf_ptr - backtrack_amount;
|
|
|
|
|
|
|
|
for (c = 0; c < runcount; c++) {
|
|
|
|
*outbuf_ptr++ = *backtrack_ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
outbuf_remain -= runcount;
|
|
|
|
continue;
|
|
|
|
break;
|
2004-05-01 09:19:35 +00:00
|
|
|
default: // 0000 0000
|
2004-04-12 21:40:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
// Mask all but the third and fourth highest order bits
|
2004-04-12 21:40:49 +00:00
|
|
|
test_byte = mark_byte & 0x30;
|
|
|
|
|
|
|
|
switch (test_byte) {
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
case 0x30: // 0011 0000
|
|
|
|
// Bitfield compression
|
2004-04-12 21:40:49 +00:00
|
|
|
runcount = (mark_byte & 0x0F) + 1;
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
if ((inbuf_remain < (runcount + 2)) || (outbuf_remain < (runcount * 8))) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bitfield_byte1 = *inbuf_ptr++;
|
|
|
|
bitfield_byte2 = *inbuf_ptr++;
|
|
|
|
|
|
|
|
for (c = 0; c < runcount; c++) {
|
|
|
|
bitfield = *inbuf_ptr;
|
|
|
|
for (b = 0; b < 8; b++) {
|
|
|
|
if (bitfield & 0x80) {
|
|
|
|
*outbuf_ptr = bitfield_byte2;
|
|
|
|
} else {
|
|
|
|
*outbuf_ptr = bitfield_byte1;
|
|
|
|
}
|
|
|
|
bitfield <<= 1;
|
|
|
|
outbuf_ptr++;
|
|
|
|
}
|
|
|
|
inbuf_ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_remain -= (runcount + 2);
|
|
|
|
outbuf_remain -= (runcount * 8);
|
|
|
|
continue;
|
|
|
|
break;
|
2004-05-01 09:19:35 +00:00
|
|
|
case 0x20: // 0010 0000
|
|
|
|
// Uncompressed run follows
|
2004-04-12 21:40:49 +00:00
|
|
|
runcount = ((mark_byte & 0x0F) << 8) + *inbuf_ptr;
|
2004-05-01 09:19:35 +00:00
|
|
|
if ((inbuf_remain < (runcount + 1)) || (outbuf_remain < runcount)) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_ptr++;
|
|
|
|
|
|
|
|
for (c = 0; c < runcount; c++) {
|
|
|
|
*outbuf_ptr++ = *inbuf_ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_remain -= (runcount + 1);
|
|
|
|
outbuf_remain -= runcount;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
case 0x10: // 0001 0000
|
|
|
|
// Repeat decoded sequence from output stream
|
|
|
|
backtrack_amount = ((mark_byte & 0x0F) << 8) + *inbuf_ptr;
|
2004-04-12 21:40:49 +00:00
|
|
|
if (inbuf_remain < 2) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_ptr++;
|
|
|
|
runcount = *inbuf_ptr++;
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
if ((backtrack_amount > (outbuf_ptr - outbuf)) || (outbuf_remain < runcount)) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
backtrack_ptr = outbuf_ptr - backtrack_amount;
|
|
|
|
|
|
|
|
for (c = 0; c < runcount; c++) {
|
|
|
|
*outbuf_ptr++ = *backtrack_ptr++;
|
|
|
|
}
|
|
|
|
|
|
|
|
inbuf_remain -= 2;
|
|
|
|
outbuf_remain -= runcount;
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
default:
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
2004-05-01 09:19:35 +00:00
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
return SUCCESS;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-07-31 20:50:34 +00:00
|
|
|
int SagaEngine::flipImage(byte *img_buf, int columns, int scanlines) {
|
2004-04-12 21:40:49 +00:00
|
|
|
int line;
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *tmp_scan;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-04-30 23:02:23 +00:00
|
|
|
byte *flip_p1;
|
|
|
|
byte *flip_p2;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
int flipcount = scanlines / 2;
|
|
|
|
|
2004-04-30 23:02:23 +00:00
|
|
|
tmp_scan = (byte *)malloc(columns);
|
2004-04-12 21:40:49 +00:00
|
|
|
if (tmp_scan == NULL) {
|
2004-10-27 21:32:28 +00:00
|
|
|
return FAILURE;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
flip_p1 = img_buf;
|
|
|
|
flip_p2 = img_buf + (columns * (scanlines - 1));
|
|
|
|
|
|
|
|
for (line = 0; line < flipcount; line++) {
|
|
|
|
memcpy(tmp_scan, flip_p1, columns);
|
|
|
|
memcpy(flip_p1, flip_p2, columns);
|
|
|
|
memcpy(flip_p2, tmp_scan, columns);
|
|
|
|
flip_p1 += columns;
|
|
|
|
flip_p2 -= columns;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(tmp_scan);
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
return SUCCESS;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-07-31 20:50:34 +00:00
|
|
|
int SagaEngine::unbankBGImage(byte *dst_buf, const byte *src_buf, int columns, int scanlines) {
|
2004-04-12 21:40:49 +00:00
|
|
|
int x, y;
|
|
|
|
int temp;
|
|
|
|
int quadruple_rows;
|
|
|
|
int remain_rows;
|
|
|
|
int rowjump_src;
|
|
|
|
int rowjump_dest;
|
2004-04-30 23:02:23 +00:00
|
|
|
const byte *src_p;
|
|
|
|
byte *dst_p;
|
|
|
|
const byte *srcptr1, *srcptr2, *srcptr3, *srcptr4;
|
|
|
|
byte *dstptr1, *dstptr2, *dstptr3, *dstptr4;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
quadruple_rows = scanlines - (scanlines % 4);
|
|
|
|
remain_rows = scanlines - quadruple_rows;
|
|
|
|
|
|
|
|
assert(scanlines > 0);
|
|
|
|
|
|
|
|
src_p = src_buf;
|
|
|
|
dst_p = dst_buf + columns;
|
|
|
|
|
|
|
|
srcptr1 = src_p;
|
|
|
|
srcptr2 = src_p + 1;
|
|
|
|
srcptr3 = src_p + 2;
|
|
|
|
srcptr4 = src_p + 3;
|
|
|
|
|
|
|
|
dstptr1 = dst_buf;
|
|
|
|
dstptr2 = dst_buf + columns;
|
|
|
|
dstptr3 = dst_buf + columns * 2;
|
|
|
|
dstptr4 = dst_buf + columns * 3;
|
|
|
|
|
|
|
|
rowjump_src = columns * 4;
|
|
|
|
rowjump_dest = columns * 4;
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
// Unbank groups of 4 first
|
2004-04-12 21:40:49 +00:00
|
|
|
for (y = 0; y < quadruple_rows; y += 4) {
|
|
|
|
for (x = 0; x < columns; x++) {
|
|
|
|
temp = x * 4;
|
|
|
|
dstptr1[x] = srcptr1[temp];
|
|
|
|
dstptr2[x] = srcptr2[temp];
|
|
|
|
dstptr3[x] = srcptr3[temp];
|
|
|
|
dstptr4[x] = srcptr4[temp];
|
|
|
|
}
|
|
|
|
|
2005-07-29 17:58:00 +00:00
|
|
|
// This is to avoid generating invalid pointers -
|
2004-05-01 09:19:35 +00:00
|
|
|
// usually innocuous, but undefined
|
2004-04-12 21:40:49 +00:00
|
|
|
if (y < quadruple_rows - 4) {
|
|
|
|
dstptr1 += rowjump_dest;
|
|
|
|
dstptr2 += rowjump_dest;
|
|
|
|
dstptr3 += rowjump_dest;
|
|
|
|
dstptr4 += rowjump_dest;
|
|
|
|
srcptr1 += rowjump_src;
|
|
|
|
srcptr2 += rowjump_src;
|
|
|
|
srcptr3 += rowjump_src;
|
|
|
|
srcptr4 += rowjump_src;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-01 09:19:35 +00:00
|
|
|
// Unbank rows remaining
|
2004-04-12 21:40:49 +00:00
|
|
|
switch (remain_rows) {
|
|
|
|
case 1:
|
|
|
|
dstptr1 += rowjump_dest;
|
|
|
|
srcptr1 += rowjump_src;
|
|
|
|
for (x = 0; x < columns; x++) {
|
|
|
|
temp = x * 4;
|
|
|
|
dstptr1[x] = srcptr1[temp];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
dstptr1 += rowjump_dest;
|
|
|
|
dstptr2 += rowjump_dest;
|
|
|
|
srcptr1 += rowjump_src;
|
|
|
|
srcptr2 += rowjump_src;
|
|
|
|
for (x = 0; x < columns; x++) {
|
|
|
|
temp = x * 4;
|
|
|
|
dstptr1[x] = srcptr1[temp];
|
|
|
|
dstptr2[x] = srcptr2[temp];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
dstptr1 += rowjump_dest;
|
|
|
|
dstptr2 += rowjump_dest;
|
|
|
|
dstptr3 += rowjump_dest;
|
|
|
|
srcptr1 += rowjump_src;
|
|
|
|
srcptr2 += rowjump_src;
|
|
|
|
srcptr3 += rowjump_src;
|
|
|
|
for (x = 0; x < columns; x++) {
|
|
|
|
temp = x * 4;
|
|
|
|
dstptr1[x] = srcptr1[temp];
|
|
|
|
dstptr2[x] = srcptr2[temp];
|
|
|
|
dstptr3[x] = srcptr3[temp];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-10-27 21:32:28 +00:00
|
|
|
return SUCCESS;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-07-31 13:49:26 +00:00
|
|
|
const byte *SagaEngine::getImagePal(const byte *image_data, size_t image_size) {
|
2004-04-12 21:40:49 +00:00
|
|
|
if (image_size <= SAGA_IMAGE_HEADER_LEN) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return image_data + SAGA_IMAGE_HEADER_LEN;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Saga
|