2006-02-22 22:40:53 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2006 The ScummVM project
|
|
|
|
*
|
|
|
|
* cinE Engine is (C) 2004-2005 by CinE Team
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cine/cine.h"
|
|
|
|
|
2006-02-25 00:26:14 +00:00
|
|
|
namespace Cine {
|
|
|
|
|
2006-02-22 22:40:53 +00:00
|
|
|
struct animHeader2Struct {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint32 field_0;
|
|
|
|
uint16 width;
|
|
|
|
uint16 height;
|
|
|
|
uint16 type;
|
|
|
|
uint16 field_A;
|
|
|
|
uint16 field_C;
|
|
|
|
uint16 field_E;
|
2006-02-22 22:40:53 +00:00
|
|
|
};
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 frameVar0 = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animHeaderStruct animHeader;
|
|
|
|
|
|
|
|
animDataEntry animData[] = {
|
|
|
|
{"ALPHA", 0xF},
|
|
|
|
{"TITRE2", 0xF},
|
|
|
|
{"ET", 0xC},
|
|
|
|
{"L311", 0x3},
|
|
|
|
{"L405", 0x1},
|
|
|
|
{"L515", 0xC},
|
|
|
|
{"L009", 0xE},
|
|
|
|
{"L010", 0xE},
|
|
|
|
{"FUTUR", 0x6},
|
|
|
|
{"PAYSAN3", 0xB},
|
|
|
|
{"L801", 0xC},
|
|
|
|
{"L802", 0xC},
|
|
|
|
{"L803", 0xC},
|
|
|
|
{"L901", 0xD},
|
|
|
|
{"L902", 0x8},
|
|
|
|
{"L903", 0xD},
|
|
|
|
{"L904", 0xD},
|
|
|
|
{"L905", 0xD},
|
|
|
|
{"L906", 0xD},
|
|
|
|
{"L907", 0xD},
|
|
|
|
{"LA03", 0x4},
|
|
|
|
{"MOINE", 0xB},
|
|
|
|
{"L908", 0x8},
|
|
|
|
{"L909", 0x8},
|
|
|
|
{"L807", 0xC},
|
|
|
|
{"L808", 0xC},
|
|
|
|
{"LA01", 0xB},
|
|
|
|
{"L1201", 0xC},
|
|
|
|
{"L1202", 0xC},
|
|
|
|
{"L1203", 0xC},
|
|
|
|
{"L1210", 0x5},
|
|
|
|
{"L1211", 0xC},
|
|
|
|
{"L1214", 0xC},
|
|
|
|
{"L1215", 0xC},
|
|
|
|
{"L1216", 0xC},
|
|
|
|
{"L1217", 0xC},
|
|
|
|
{"L1218", 0xC},
|
|
|
|
{"L1219", 0xC},
|
|
|
|
{"L1220", 0xC},
|
|
|
|
{"SEIGNEUR", 0x6},
|
|
|
|
{"PERE0", 0xD},
|
|
|
|
{"L1302", 0x4},
|
|
|
|
{"L1303", 0x4},
|
|
|
|
{"L1304", 0x4},
|
|
|
|
{"L1401", 0xF},
|
|
|
|
{"L1402", 0xF},
|
|
|
|
{"L1501", 0x8},
|
|
|
|
{"L1503", 0x8},
|
|
|
|
{"L1504", 0x4},
|
|
|
|
{"L1505", 0x8},
|
|
|
|
{"L1506", 0x8},
|
|
|
|
{"L1601", 0xB},
|
|
|
|
{"L1602", 0xB},
|
|
|
|
{"L1603", 0xB},
|
|
|
|
{"L1604", 0x4},
|
|
|
|
{"L1605", 0x4},
|
|
|
|
{"L1701", 0x4},
|
|
|
|
{"L1702", 0x4},
|
|
|
|
{"L1801", 0x6},
|
|
|
|
{"L1904", 0x8},
|
|
|
|
{"L2002", 0x8},
|
|
|
|
{"L2003", 0x8},
|
|
|
|
{"L2101", 0x4},
|
|
|
|
{"L2102", 0x4},
|
|
|
|
{"L2201", 0x7},
|
|
|
|
{"L2202", 0x7},
|
|
|
|
{"L2203", 0xE},
|
|
|
|
{"L2305", 0x9},
|
|
|
|
{"L2306", 0x9},
|
|
|
|
{"GARDE1", 0x7},
|
|
|
|
{"L2402", 0x7},
|
|
|
|
{"L2407", 0x7},
|
|
|
|
{"L2408", 0x7},
|
|
|
|
{"GARDE2", 0x6},
|
|
|
|
{"L2601", 0x6},
|
|
|
|
{"L2602", 0x6},
|
|
|
|
{"L2603", 0x6},
|
|
|
|
{"L2604", 0x6},
|
|
|
|
{"L2605", 0x8},
|
|
|
|
{"L2606", 0x8},
|
|
|
|
{"L2607", 0x8},
|
|
|
|
{"L2610", 0x6},
|
|
|
|
{"L2611", 0x6},
|
|
|
|
{"L2612", 0x6},
|
|
|
|
{"L2613", 0x8},
|
|
|
|
{"L2614", 0x6},
|
|
|
|
{"VOYAGEUR", 0x6},
|
|
|
|
{"L2701", 0xD},
|
|
|
|
{"L2702", 0xD},
|
|
|
|
{"L2703", 0x6},
|
|
|
|
{"L2801", 0xD},
|
|
|
|
{"L2802", 0xD},
|
|
|
|
{"L2803", 0xD},
|
|
|
|
{"L2804", 0xD},
|
|
|
|
{"L2807", 0xD},
|
|
|
|
{"L2902", 0x8},
|
|
|
|
{"L2903", 0x8},
|
|
|
|
{"L3101", 0xA},
|
|
|
|
{"L3102", 0xA},
|
|
|
|
{"L3103", 0xA},
|
|
|
|
{"L3203", 0xF},
|
|
|
|
{"L3204", 0xF},
|
|
|
|
{"L3001", 0x7},
|
|
|
|
{"L3002", 0x7},
|
|
|
|
{"L3416", 0xC},
|
|
|
|
{"L3601", 0x5},
|
|
|
|
{"L3602", 0x5},
|
|
|
|
{"L3603", 0x5},
|
|
|
|
{"L3607", 0x5},
|
|
|
|
{"L3701", 0x8},
|
|
|
|
{"L3702", 0x8},
|
|
|
|
{"L3703", 0x8},
|
|
|
|
{"L4001", 0xD},
|
|
|
|
{"L4002", 0xD},
|
|
|
|
{"L4103", 0xF},
|
|
|
|
{"L4106", 0xF},
|
|
|
|
{"CRUGHON1", 0xC},
|
|
|
|
{"L4203", 0xC},
|
|
|
|
{"L4301", 0xC},
|
|
|
|
{"L4302", 0xC},
|
|
|
|
{"L4303", 0xC},
|
|
|
|
{"FUTUR2", 0x6},
|
|
|
|
{"L4601", 0xE},
|
|
|
|
{"L4603", 0x1},
|
|
|
|
{"L4106", 0xF},
|
|
|
|
{"L4801", 0xD},
|
|
|
|
{"L4802", 0xD},
|
|
|
|
{"FIN01", 0xB},
|
|
|
|
{"FIN02", 0xB},
|
|
|
|
{"FIN03", 0xB},
|
|
|
|
{"FIN", 0x9},
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NUM_ANIM_DATA (sizeof(animData)/sizeof(animDataEntry))
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 findAnimInHardcodedData(char *animName) {
|
2006-02-22 22:40:53 +00:00
|
|
|
char name[15];
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
removeExtention(name, animName);
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_ANIM_DATA; i++) {
|
|
|
|
if (!strcmp(name, animData[i].name)) {
|
|
|
|
return (animData[i].param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 allocFrame(uint16 width, uint16 height, int8 isMask) {
|
|
|
|
uint16 i;
|
|
|
|
uint32 frameSize;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_PARTDATA; i++) {
|
|
|
|
if (!animDataTable[i].ptr1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == NUM_MAX_PARTDATA)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (!isMask) { // sprite + generated mask
|
|
|
|
frameSize = width * height;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
animDataTable[i].ptr1 = (uint8 *)malloc(frameSize);
|
|
|
|
animDataTable[i].ptr2 = (uint8 *)malloc(frameSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animDataTable[i].width = width;
|
|
|
|
animDataTable[i].var1 = width >> 3;
|
2006-02-24 22:34:22 +00:00
|
|
|
animDataTable[i].bpp = 4;
|
|
|
|
animDataTable[i].height = height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animDataTable[i].fileIdx = -1;
|
|
|
|
animDataTable[i].frameIdx = -1;
|
|
|
|
} else {
|
|
|
|
// mask
|
|
|
|
frameSize = width * height * 8;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
animDataTable[i].ptr1 = (uint8 *)malloc(frameSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
animDataTable[i].ptr2 = NULL;
|
|
|
|
|
|
|
|
animDataTable[i].width = width;
|
|
|
|
animDataTable[i].var1 = width >> 3;
|
2006-02-24 22:34:22 +00:00
|
|
|
animDataTable[i].bpp = 4;
|
|
|
|
animDataTable[i].height = height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animDataTable[i].fileIdx = -1;
|
|
|
|
animDataTable[i].frameIdx = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
frameVar0++;
|
|
|
|
|
|
|
|
return (i);
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 allocFrame2(uint16 width, uint16 height, uint16 type) {
|
|
|
|
uint16 i;
|
|
|
|
uint32 frameSize;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_PARTDATA; i++) {
|
|
|
|
if (!animDataTable[i].ptr1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == NUM_MAX_PARTDATA)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
frameSize = width * height;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
if (type == 4) { // 16 color sprites to 256
|
2006-02-22 22:40:53 +00:00
|
|
|
frameSize *= 2;
|
|
|
|
type = 8;
|
|
|
|
width *= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == 5) {
|
|
|
|
frameSize += 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
frameSize *= 2;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
animDataTable[i].ptr1 = (uint8 *)malloc(frameSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT_PTR(animDataTable[i].ptr1);
|
|
|
|
|
|
|
|
animDataTable[i].width = width;
|
|
|
|
|
|
|
|
if (type == 5) {
|
|
|
|
animDataTable[i].var1 = width / 8;
|
|
|
|
} else {
|
|
|
|
animDataTable[i].var1 = width / 16;
|
|
|
|
}
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
animDataTable[i].bpp = type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
animDataTable[i].height = height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animDataTable[i].fileIdx = -1;
|
|
|
|
animDataTable[i].frameIdx = -1;
|
|
|
|
|
|
|
|
frameVar0++;
|
|
|
|
|
|
|
|
return (i);
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 reserveFrame(uint16 width, uint16 height, uint16 type, uint16 idx) {
|
|
|
|
uint16 i;
|
|
|
|
uint32 frameSize;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
i = idx;
|
|
|
|
|
|
|
|
frameSize = width * height;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
if (type == 4) { // 256 color sprites
|
2006-02-22 22:40:53 +00:00
|
|
|
frameSize *= 2;
|
|
|
|
type = 8;
|
|
|
|
width *= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == 5) {
|
|
|
|
frameSize += 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
frameSize *= 2;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
animDataTable[i].ptr1 = (uint8 *)malloc(frameSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT_PTR(animDataTable[i].ptr1);
|
|
|
|
|
|
|
|
animDataTable[i].width = width;
|
|
|
|
|
|
|
|
if (type == 5) {
|
|
|
|
animDataTable[i].var1 = width / 8;
|
|
|
|
} else {
|
|
|
|
animDataTable[i].var1 = width / 16;
|
|
|
|
}
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
animDataTable[i].bpp = type;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
animDataTable[i].height = height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animDataTable[i].fileIdx = -1;
|
|
|
|
animDataTable[i].frameIdx = -1;
|
|
|
|
|
|
|
|
frameVar0++;
|
|
|
|
|
|
|
|
return (i);
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void generateMask(uint8 * sprite, uint8 * mask, uint16 size, uint8 transparency) {
|
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
if (*(sprite++) != transparency) {
|
|
|
|
*(mask++) = 0;
|
|
|
|
} else {
|
|
|
|
*(mask++) = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void convertMask(uint8 * dest, uint8 * source, int16 width, int16 height) {
|
|
|
|
int16 i;
|
|
|
|
int16 j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < width * height; i++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 maskEntry = *(source++);
|
2006-02-22 22:40:53 +00:00
|
|
|
for (j = 0; j < 8; j++) {
|
|
|
|
if (maskEntry & 0x80) {
|
|
|
|
*(dest++) = 0;
|
|
|
|
} else {
|
|
|
|
*(dest++) = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
maskEntry <<= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void convert4BBP(uint8 * dest, uint8 * source, int16 width, int16 height) {
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < width * height; i++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 maskEntry = *(source++);
|
2006-02-22 22:40:53 +00:00
|
|
|
*(dest++) = (maskEntry & 0xF0) >> 4;
|
|
|
|
*(dest++) = (maskEntry & 0xF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void loadSpl(char *resourceName) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
int16 entry;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
foundFileIdx = findFileInBundle(resourceName);
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame((uint16) partBuffer[foundFileIdx].unpacked_size, 1, -1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT(entry != -1);
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
memcpy(animDataTable[entry].ptr1, dataPtr, (uint16) partBuffer[foundFileIdx].unpacked_size);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animDataTable[entry].fileIdx = foundFileIdx;
|
|
|
|
animDataTable[entry].frameIdx = 0;
|
|
|
|
strcpy(animDataTable[entry].name, currentPartName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loadMsk(char *resourceName) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
int16 entry;
|
|
|
|
uint8 *ptr;
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
foundFileIdx = findFileInBundle(resourceName);
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
|
|
|
ptr = dataPtr;
|
|
|
|
|
|
|
|
memcpy(&animHeader, ptr, sizeof(animHeaderStruct));
|
|
|
|
ptr += sizeof(animHeaderStruct);
|
|
|
|
|
|
|
|
flipU16(&animHeader.frameWidth);
|
|
|
|
flipU16(&animHeader.frameHeight);
|
|
|
|
flipU16(&animHeader.numFrames);
|
|
|
|
|
|
|
|
for (i = 0; i < animHeader.numFrames; i++) {
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame(animHeader.frameWidth * 2, animHeader.frameHeight, 1);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT(entry != -1);
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
convertMask(animDataTable[entry].ptr1, ptr, animHeader.frameWidth, animHeader.frameHeight);
|
2006-02-22 22:40:53 +00:00
|
|
|
ptr += animHeader.frameWidth * animHeader.frameHeight;
|
|
|
|
|
|
|
|
animDataTable[entry].fileIdx = foundFileIdx;
|
|
|
|
animDataTable[entry].frameIdx = i;
|
|
|
|
strcpy(animDataTable[entry].name, currentPartName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void loadAni(char *resourceName) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
int16 entry;
|
|
|
|
uint8 *ptr;
|
|
|
|
int16 i;
|
|
|
|
uint8 transparentColor;
|
|
|
|
uint32 fullSize;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
foundFileIdx = findFileInBundle(resourceName);
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
|
|
|
ptr = dataPtr;
|
|
|
|
|
|
|
|
memcpy(&animHeader, ptr, sizeof(animHeaderStruct));
|
|
|
|
ptr += sizeof(animHeaderStruct);
|
|
|
|
|
|
|
|
flipU16(&animHeader.frameWidth);
|
|
|
|
flipU16(&animHeader.frameHeight);
|
|
|
|
flipU16(&animHeader.numFrames);
|
|
|
|
|
|
|
|
transparentColor = findAnimInHardcodedData(resourceName);
|
|
|
|
|
|
|
|
fullSize = animHeader.frameWidth * animHeader.frameHeight;
|
|
|
|
|
|
|
|
for (i = 0; i < animHeader.numFrames; i++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 *animPtr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame(animHeader.frameWidth * 2, animHeader.frameHeight, 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
ASSERT(entry != -1);
|
|
|
|
|
|
|
|
// special case transparency handling
|
|
|
|
if (!strcmp(resourceName, "L2202.ANI")) {
|
|
|
|
if (i < 2) {
|
|
|
|
transparentColor = 0;
|
|
|
|
} else {
|
|
|
|
transparentColor = 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(resourceName, "L4601.ANI")) {
|
|
|
|
if (i < 1) {
|
|
|
|
transparentColor = 0xE;
|
|
|
|
} else {
|
|
|
|
transparentColor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
animPtr = (uint8 *)malloc(fullSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
memcpy(animPtr, ptr, fullSize);
|
|
|
|
ptr += fullSize;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
gfxConvertSpriteToRaw(animDataTable[entry].ptr1, animPtr, animHeader.frameWidth, animHeader.frameHeight);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
generateMask(animDataTable[entry].ptr1, animDataTable[entry].ptr2, animHeader.frameWidth * 2 * animHeader.frameHeight, transparentColor);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
free(animPtr);
|
|
|
|
|
|
|
|
animDataTable[entry].fileIdx = foundFileIdx;
|
|
|
|
animDataTable[entry].frameIdx = i;
|
|
|
|
strcpy(animDataTable[entry].name, currentPartName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void convert8BBP(uint8 * dest, uint8 * source, int16 width, int16 height) {
|
|
|
|
uint16 i;
|
|
|
|
uint8 table[16];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
memcpy(table, source, 16);
|
|
|
|
source += 16;
|
|
|
|
|
|
|
|
for (i = 0; i < width * height; i++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 color = *(source++);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
*(dest++) = table[color >> 4];
|
|
|
|
*(dest++) = table[color & 0xF];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void convert8BBP2(uint8 * dest, uint8 * source, int16 width, int16 height) {
|
|
|
|
uint16 i;
|
|
|
|
uint16 j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
uint8 al;
|
|
|
|
uint8 ah;
|
|
|
|
uint8 bl;
|
|
|
|
uint8 bh;
|
|
|
|
uint8 cl;
|
|
|
|
uint8 ch;
|
|
|
|
uint8 dl;
|
|
|
|
uint8 dh;
|
|
|
|
uint8 color;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
for (j = 0; j < (width * height) / 16; j++) {
|
|
|
|
al = *(source);
|
|
|
|
ah = *(source + 2);
|
|
|
|
bl = *(source + 4);
|
|
|
|
bh = *(source + 6);
|
|
|
|
cl = *(source + 8);
|
|
|
|
ch = *(source + 0xA);
|
|
|
|
dl = *(source + 0xC);
|
|
|
|
dh = *(source + 0xE);
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
color = 0;
|
|
|
|
|
|
|
|
color |= ((dh & 0x080) >> 7);
|
|
|
|
dh <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((dl & 0x080) >> 7);
|
|
|
|
dl <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((ch & 0x080) >> 7);
|
|
|
|
ch <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((cl & 0x080) >> 7);
|
|
|
|
cl <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((bh & 0x080) >> 7);
|
|
|
|
bh <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((bl & 0x080) >> 7);
|
|
|
|
bl <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((ah & 0x080) >> 7);
|
|
|
|
ah <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((al & 0x080) >> 7);
|
|
|
|
al <<= 1;
|
|
|
|
|
|
|
|
*(dest++) = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
al = *(source + 1);
|
|
|
|
ah = *(source + 3);
|
|
|
|
bl = *(source + 5);
|
|
|
|
bh = *(source + 7);
|
|
|
|
cl = *(source + 9);
|
|
|
|
ch = *(source + 0xB);
|
|
|
|
dl = *(source + 0xD);
|
|
|
|
dh = *(source + 0xF);
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
color = 0;
|
|
|
|
|
|
|
|
color |= ((dh & 0x080) >> 7);
|
|
|
|
dh <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((dl & 0x080) >> 7);
|
|
|
|
dl <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((ch & 0x080) >> 7);
|
|
|
|
ch <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((cl & 0x080) >> 7);
|
|
|
|
cl <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((bh & 0x080) >> 7);
|
|
|
|
bh <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((bl & 0x080) >> 7);
|
|
|
|
bl <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((ah & 0x080) >> 7);
|
|
|
|
ah <<= 1;
|
|
|
|
color <<= 1;
|
|
|
|
color |= ((al & 0x080) >> 7);
|
|
|
|
al <<= 1;
|
|
|
|
|
|
|
|
*(dest++) = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
source += 0x10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void loadSet(char *resourceName) {
|
|
|
|
animHeader2Struct header2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
int16 entry;
|
|
|
|
uint8 *ptr;
|
|
|
|
int16 i;
|
|
|
|
uint32 fullSize;
|
|
|
|
uint16 numSpriteInAnim;
|
|
|
|
uint8 *startOfDataPtr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
foundFileIdx = findFileInBundle(resourceName);
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
|
|
|
ASSERT(!memcmp(dataPtr, "SET", 3));
|
|
|
|
|
|
|
|
ptr = dataPtr + 4;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
numSpriteInAnim = *(uint16 *)ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
flipU16(&numSpriteInAnim);
|
|
|
|
ptr += 2;
|
|
|
|
|
|
|
|
startOfDataPtr = ptr + numSpriteInAnim * 0x10;
|
|
|
|
|
|
|
|
for (i = 0; i < numSpriteInAnim; i++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 typeParam;
|
2006-02-23 18:47:28 +00:00
|
|
|
uint8 table[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
memcpy(&header2, ptr, 0x10);
|
|
|
|
ptr += 0x10;
|
|
|
|
|
|
|
|
flipU32(&header2.field_0);
|
|
|
|
flipU16(&header2.width);
|
|
|
|
flipU16(&header2.height);
|
|
|
|
flipU16(&header2.type);
|
|
|
|
|
|
|
|
fullSize = header2.width * header2.height;
|
|
|
|
|
|
|
|
typeParam = 0;
|
|
|
|
|
|
|
|
if (header2.type == 5) {
|
|
|
|
fullSize += 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (header2.type == 4) {
|
|
|
|
header2.type = 5;
|
|
|
|
typeParam = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeParam) {
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame2(header2.width * 2, header2.height, header2.type);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
|
|
|
if (header2.type == 1) {
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame2(header2.width * 2, header2.height, header2.type);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame2(header2.width * 2, header2.height, header2.type);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT(entry != -1);
|
|
|
|
|
|
|
|
dataPtr = startOfDataPtr + header2.field_0;
|
|
|
|
|
|
|
|
if (typeParam) {
|
|
|
|
memcpy(animDataTable[entry].ptr1, table, 0x10);
|
2006-02-23 18:47:28 +00:00
|
|
|
gfxConvertSpriteToRaw(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
|
|
|
//memcpy(animDataTable[entry].ptr1 + 0x10, dataPtr, fullSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
|
|
|
if (header2.type == 1) {
|
2006-02-23 18:47:28 +00:00
|
|
|
convert4BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (header2.type == 5) {
|
2006-02-23 18:47:28 +00:00
|
|
|
convert8BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (header2.type == 4) {
|
|
|
|
ASSERT(0);
|
|
|
|
} else {
|
2006-02-23 18:47:28 +00:00
|
|
|
convert8BBP2(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
animDataTable[entry].fileIdx = foundFileIdx;
|
|
|
|
animDataTable[entry].frameIdx = i;
|
|
|
|
strcpy(animDataTable[entry].name, currentPartName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void loadSetAbs(char *resourceName, uint16 idx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
animHeader2Struct header2;
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
int16 entry;
|
|
|
|
uint8 *ptr;
|
|
|
|
int16 i;
|
|
|
|
uint32 fullSize;
|
|
|
|
uint16 numSpriteInAnim;
|
|
|
|
uint8 *startOfDataPtr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
foundFileIdx = findFileInBundle(resourceName);
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
|
|
|
ASSERT(!memcmp(dataPtr, "SET", 3));
|
|
|
|
|
|
|
|
ptr = dataPtr + 4;
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
numSpriteInAnim = *(uint16 *) ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
flipU16(&numSpriteInAnim);
|
|
|
|
ptr += 2;
|
|
|
|
|
|
|
|
startOfDataPtr = ptr + numSpriteInAnim * 0x10;
|
|
|
|
|
|
|
|
for (i = 0; i < numSpriteInAnim; i++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 typeParam;
|
2006-02-23 18:47:28 +00:00
|
|
|
uint8 table[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
memcpy(&header2, ptr, 0x10);
|
|
|
|
ptr += 0x10;
|
|
|
|
|
|
|
|
flipU32(&header2.field_0);
|
|
|
|
flipU16(&header2.width);
|
|
|
|
flipU16(&header2.height);
|
|
|
|
flipU16(&header2.type);
|
|
|
|
|
|
|
|
fullSize = header2.width * header2.height;
|
|
|
|
|
|
|
|
typeParam = 0;
|
|
|
|
|
|
|
|
if (header2.type == 5) {
|
|
|
|
fullSize += 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (header2.type == 4) {
|
|
|
|
header2.type = 5;
|
|
|
|
typeParam = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeParam) {
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = reserveFrame(header2.width * 2, header2.height, header2.type, idx + i);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
|
|
|
if (header2.type == 1) {
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = reserveFrame(header2.width * 2, header2.height, header2.type, idx + i);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = reserveFrame(header2.width * 2, header2.height, header2.type, idx + i);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT(entry != -1);
|
|
|
|
|
|
|
|
dataPtr = startOfDataPtr + header2.field_0;
|
|
|
|
|
|
|
|
if (typeParam) {
|
|
|
|
memcpy(animDataTable[entry].ptr1, table, 0x10);
|
2006-02-23 18:47:28 +00:00
|
|
|
gfxConvertSpriteToRaw(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
|
|
|
//memcpy(animDataTable[entry].ptr1 + 0x10, dataPtr, fullSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else {
|
|
|
|
if (header2.type == 1) {
|
2006-02-23 18:47:28 +00:00
|
|
|
convert4BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (header2.type == 5) {
|
2006-02-23 18:47:28 +00:00
|
|
|
convert8BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
2006-02-22 22:40:53 +00:00
|
|
|
} else if (header2.type == 4) {
|
|
|
|
ASSERT(0);
|
|
|
|
} else {
|
2006-02-23 18:47:28 +00:00
|
|
|
convert8BBP2(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
animDataTable[entry].fileIdx = foundFileIdx;
|
|
|
|
animDataTable[entry].frameIdx = i;
|
|
|
|
strcpy(animDataTable[entry].name, currentPartName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void loadSeq(char *resourceName) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
int16 entry;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
foundFileIdx = findFileInBundle(resourceName);
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame2((uint16) partBuffer[foundFileIdx].unpacked_size, 1, 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
memcpy(animDataTable[entry].ptr1, dataPtr + 0x16, (uint16) partBuffer[foundFileIdx].unpacked_size - 0x16);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void loadSeqAbs(char *resourceName, uint16 idx) {
|
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
int16 entry;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
foundFileIdx = findFileInBundle(resourceName);
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = reserveFrame((uint16) partBuffer[foundFileIdx].unpacked_size, 1, 0, idx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
memcpy(animDataTable[entry].ptr1, dataPtr + 0x16, (uint16) partBuffer[foundFileIdx].unpacked_size - 0x16);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loadResource(char *resourceName) {
|
2006-02-23 10:35:33 +00:00
|
|
|
/* uint8 isMask = 0; */
|
|
|
|
/* uint8 isSpl = 0; */
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (strstr(resourceName, ".SPL")) {
|
|
|
|
loadSpl(resourceName);
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".MSK")) {
|
|
|
|
loadMsk(resourceName);
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".ANI")) {
|
|
|
|
loadAni(resourceName);
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".ANM")) {
|
|
|
|
loadAni(resourceName);
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".SET")) {
|
|
|
|
loadSet(resourceName);
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".SEQ")) {
|
|
|
|
loadSeq(resourceName);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
void loadAbs(char *resourceName, uint16 idx) {
|
2006-02-23 10:35:33 +00:00
|
|
|
/* uint8 isMask = 0; */
|
|
|
|
/* uint8 isSpl = 0; */
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
if (strstr(resourceName, ".SET")) {
|
|
|
|
loadSetAbs(resourceName, idx);
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".H32")) {
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".SEQ")) {
|
|
|
|
loadSeqAbs(resourceName, idx);
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".SPL")) {
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".AMI")) {
|
|
|
|
return;
|
|
|
|
} else if (strstr(resourceName, ".ANI")) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loadResourcesFromSave() {
|
|
|
|
char part[256];
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 currentAnim;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
strcpy(part, currentPartName);
|
|
|
|
|
|
|
|
for (currentAnim = 0; currentAnim < NUM_MAX_ANIMDATA; currentAnim++) {
|
|
|
|
animDataStruct *currentPtr = &animDataTable[currentAnim];
|
|
|
|
if (currentPtr->ptr1 && currentPtr->fileIdx != -1) {
|
2006-02-23 09:12:21 +00:00
|
|
|
int8 isMask = 0;
|
|
|
|
int8 isSpl = 0;
|
|
|
|
int16 foundFileIdx;
|
|
|
|
uint8 *dataPtr;
|
|
|
|
uint8 *ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
char animName[256];
|
|
|
|
|
|
|
|
if (strcmp(currentPartName, currentPtr->name)) {
|
|
|
|
closePart();
|
|
|
|
loadPart(currentPtr->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
foundFileIdx = currentPtr->fileIdx;
|
|
|
|
|
|
|
|
strcpy(animName, partBuffer[foundFileIdx].part_name);
|
|
|
|
|
|
|
|
if (strstr(animName, ".SPL")) {
|
|
|
|
isSpl = 1;
|
|
|
|
} else {
|
|
|
|
isSpl = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
dataPtr = readBundleFile(foundFileIdx);
|
|
|
|
|
|
|
|
ptr = dataPtr;
|
|
|
|
|
|
|
|
if (strstr(animName, ".MSK")) {
|
|
|
|
isMask = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isSpl) {
|
2006-02-23 18:47:28 +00:00
|
|
|
animHeader.frameWidth = (uint16) partBuffer[foundFileIdx].unpacked_size;
|
2006-02-22 22:40:53 +00:00
|
|
|
animHeader.frameHeight = 1;
|
|
|
|
animHeader.numFrames = 1;
|
|
|
|
isMask = -1;
|
|
|
|
} else {
|
2006-02-23 18:47:28 +00:00
|
|
|
memcpy(&animHeader, ptr, sizeof(animHeaderStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
ptr += sizeof(animHeaderStruct);
|
|
|
|
|
|
|
|
flipU16(&animHeader.frameWidth);
|
|
|
|
flipU16(&animHeader.frameHeight);
|
|
|
|
flipU16(&animHeader.numFrames);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
uint16 fullSize;
|
|
|
|
uint16 i;
|
|
|
|
uint8 transparentColor;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
fullSize = animHeader.frameWidth * animHeader.frameHeight;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
loadRelatedPalette(animName);
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
transparentColor = findAnimInHardcodedData(animName);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
for (i = 0; i < animHeader.numFrames; i++) { // load all the frames
|
2006-02-23 09:12:21 +00:00
|
|
|
int16 entry;
|
|
|
|
uint8 *animPtr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
// special case transparency handling
|
|
|
|
if (!strcmp(animName, "L2202.ANI")) {
|
|
|
|
if (i < 2) {
|
|
|
|
transparentColor = 0;
|
|
|
|
} else {
|
|
|
|
transparentColor = 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp(animName, "L4601.ANI")) {
|
|
|
|
if (i < 1) {
|
|
|
|
transparentColor = 0xE;
|
|
|
|
} else {
|
|
|
|
transparentColor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
currentPtr[i].ptr1 = NULL;
|
2006-02-23 18:47:28 +00:00
|
|
|
entry = allocFrame(animHeader.frameWidth * 2, animHeader.frameHeight, isMask);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
currentPtr->fileIdx = foundFileIdx;
|
|
|
|
|
|
|
|
ASSERT(entry != -1);
|
|
|
|
|
|
|
|
if (isSpl) {
|
2006-02-23 18:47:28 +00:00
|
|
|
memcpy(animDataTable[entry].ptr1, ptr, fullSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
ptr += fullSize;
|
|
|
|
} else {
|
|
|
|
if (!isMask) {
|
2006-02-23 18:47:28 +00:00
|
|
|
animPtr = (uint8 *)malloc(fullSize);
|
|
|
|
memcpy(animPtr, ptr, fullSize);
|
2006-02-22 22:40:53 +00:00
|
|
|
ptr += fullSize;
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
gfxConvertSpriteToRaw(animDataTable[entry].ptr1, animPtr,
|
|
|
|
animHeader.frameWidth, animHeader.frameHeight);
|
|
|
|
generateMask(animDataTable[entry].ptr1, animDataTable[entry].ptr2,
|
|
|
|
animHeader.frameWidth * 2 *animHeader.frameHeight, transparentColor);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
free(animPtr);
|
|
|
|
} else {
|
2006-02-23 18:47:28 +00:00
|
|
|
convertMask(animDataTable[entry].ptr1, ptr, animHeader.frameWidth,
|
|
|
|
animHeader.frameHeight);
|
2006-02-22 22:40:53 +00:00
|
|
|
ptr += fullSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-23 18:47:28 +00:00
|
|
|
//animDataTable[entry].fileIdx = foundFileIdx; // Only when reading from bundles
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
animDataTable[entry].frameIdx = i;
|
2006-02-23 18:47:28 +00:00
|
|
|
strcpy(animDataTable[entry].name, currentPartName);
|
2006-02-22 22:40:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
loadPart(part);
|
|
|
|
}
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
} // End of namespace Cine
|