[Scummvm-cvs-logs] SF.net SVN: scummvm: [29970] scummvm/trunk/engines/cruise
yazoo at users.sourceforge.net
yazoo at users.sourceforge.net
Mon Dec 24 03:59:28 CET 2007
Revision: 29970
http://scummvm.svn.sourceforge.net/scummvm/?rev=29970&view=rev
Author: yazoo
Date: 2007-12-23 18:59:23 -0800 (Sun, 23 Dec 2007)
Log Message:
-----------
Fix sprite mode 5
Fix backgroundIncrust system
Modified Paths:
--------------
scummvm/trunk/engines/cruise/backgroundIncrust.cpp
scummvm/trunk/engines/cruise/dataLoader.cpp
Modified: scummvm/trunk/engines/cruise/backgroundIncrust.cpp
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.cpp 2007-12-24 02:42:58 UTC (rev 29969)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.cpp 2007-12-24 02:59:23 UTC (rev 29970)
@@ -56,7 +56,7 @@
{
for(int j=0; j<width; j++)
{
- pIncrust->ptr[i*width+j] = pBackground[(i+Y)*320+j+Y];
+ pIncrust->ptr[i*width+j] = pBackground[(i+Y)*320+j+X];
}
}
}
@@ -72,7 +72,7 @@
if(pBackground == NULL)
return;
- //int X = pIncrust->savedX;
+ int X = pIncrust->savedX;
int Y = pIncrust->savedY;
int width = pIncrust->saveWidth;
int height = pIncrust->saveHeight;
@@ -81,7 +81,7 @@
{
for(int j=0; j<width; j++)
{
- pBackground[(i+Y)*320+j+Y] = pIncrust->ptr[i*width+j];
+ pBackground[(i+Y)*320+j+X] = pIncrust->ptr[i*width+j];
}
}
}
Modified: scummvm/trunk/engines/cruise/dataLoader.cpp
===================================================================
--- scummvm/trunk/engines/cruise/dataLoader.cpp 2007-12-24 02:42:58 UTC (rev 29969)
+++ scummvm/trunk/engines/cruise/dataLoader.cpp 2007-12-24 02:59:23 UTC (rev 29970)
@@ -109,43 +109,31 @@
}
void decodeGfxFormat5(dataFileEntry *pCurrentFileEntry) {
- uint8 *buffer;
uint8 *dataPtr = pCurrentFileEntry->subData.ptr;
-
int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->widthInColumn;
- int x = 0;
int range = pCurrentFileEntry->height * pCurrentFileEntry->width;
- buffer = (uint8 *) malloc(spriteSize);
+ uint8 *buffer = (uint8 *) malloc(spriteSize);
- while (x < spriteSize) {
- uint8 c;
- uint16 p0;
- uint16 p1;
- uint16 p2;
- uint16 p3;
- uint16 p4;
+ for(int line = 0; line < pCurrentFileEntry->height; line++) {
+ uint8 p0;
+ uint8 p1;
+ uint8 p2;
+ uint8 p3;
+ uint8 p4;
- p0 = (dataPtr[0 + range * 0] << 8) | dataPtr[1 + range * 0];
- p1 = (dataPtr[0 + range * 1] << 8) | dataPtr[1 + range * 1];
- p2 = (dataPtr[0 + range * 2] << 8) | dataPtr[1 + range * 2];
- p3 = (dataPtr[0 + range * 3] << 8) | dataPtr[1 + range * 3];
- p4 = (dataPtr[0 + range * 4] << 8) | dataPtr[1 + range * 4];
+ for(int x = 0; x < pCurrentFileEntry->widthInColumn; x++) {
+ int bit = 7 - (x % 8);
+ int col = x / 8;
- /* decode planes */
- for (c = 0; c < 16; c++) {
- buffer[x + c] = ((p0 >> 15) & 1) | ((p1 >> 14) & 2) | ((p2 >> 13) & 4) | ((p3 >> 12) & 8) | ((p4 >> 11) & 16);
+ p0 = (dataPtr[line*pCurrentFileEntry->width + col + range * 0] >> bit) & 1;
+ p1 = (dataPtr[line*pCurrentFileEntry->width + col + range * 1] >> bit) & 1;
+ p2 = (dataPtr[line*pCurrentFileEntry->width + col + range * 2] >> bit) & 1;
+ p3 = (dataPtr[line*pCurrentFileEntry->width + col + range * 3] >> bit) & 1;
+ p4 = (dataPtr[line*pCurrentFileEntry->width + col + range * 4] >> bit) & 1;
- p0 <<= 1;
- p1 <<= 1;
- p2 <<= 1;
- p3 <<= 1;
- p4 <<= 1;
+ buffer[line * pCurrentFileEntry->widthInColumn + x] = p0 | (p1 << 1) | (p2 << 2) | (p3 << 3) | (p4 << 4);
}
-
- x += 16;
-
- dataPtr += 2;
}
pCurrentFileEntry->subData.ptr = buffer;
@@ -341,6 +329,9 @@
loadFileSub1(&ptr, name, NULL);
+ if(ptr == NULL)
+ return 0;
+
switch (fileType) {
case type_SET:
{
@@ -455,7 +446,7 @@
flipLong((int32 *) & localBuffer.field_0);
flipGen(&localBuffer.width, 12);
- if ((sec == 1) || (localBuffer.type == 5)) {
+ if (sec == 1) {
localBuffer.width = localBuffer.width - (localBuffer.type * 2); // Type 1: Width - (1*2) , Type 5: Width - (5*2)
}
@@ -502,12 +493,6 @@
}
case 5:
{
- if (sec == 0) {
- // TODO sec type 5 needs special conversion. cut out 2 bytes at every width/5 position.
-// ASSERT(0);
-// return -1;
- }
-
filesDatabase[fileIndex].subData.resourceType = 4;
decodeGfxFormat5(&filesDatabase[fileIndex]);
filesDatabase[fileIndex].width = filesDatabase[fileIndex].widthInColumn;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list