|
From: Vincent H. <ya...@us...> - 2005-06-22 21:55:23
|
Update of /cvsroot/twin-e/twin-e/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7314 Modified Files: cube.c room.c Log Message: Bit more of cross platform issues. PC version probably brocken Index: room.c =================================================================== RCS file: /cvsroot/twin-e/twin-e/src/room.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** room.c 18 Jun 2005 16:55:18 -0000 1.32 --- room.c 22 Jun 2005 21:55:08 -0000 1.33 *************** *** 1092,1095 **** --- 1092,1101 ---- unsigned int numUsedBricks; unsigned int currentBllEntryIdx = 0; + unsigned char* destinationBrickPtr; + unsigned char* localBufferBrick; + unsigned char* ptrTempDecompression; + unsigned int currentBrickIdx; + unsigned int brickSize; + unsigned int finalSize = 0; printf("GridSize=%d\n", gridSize); *************** *** 1143,1147 **** // compute the number of bricks to load ! currentPositionInBuffer = bufferPtr + firstBrick*2; numUsedBricks = 0; for(i=firstBrick;i<=lastBrick;i++) --- 1149,1153 ---- // compute the number of bricks to load ! currentPositionInBuffer = bufferPtr + firstBrick * 2; numUsedBricks = 0; for(i=firstBrick;i<=lastBrick;i++) *************** *** 1156,1159 **** --- 1162,1232 ---- printf("Need to load %d bricks\n", numUsedBricks); + + currentPositionInBuffer = bufferPtr + firstBrick * 2; + + destinationBrickPtr = bufferBrick + (numUsedBricks+1)*4; + + localBufferBrick = bufferBrick; + + WRITE_LE_U32(localBufferBrick, (numUsedBricks+1)*4); + localBufferBrick+=4; + + ptrTempDecompression = (firstBrick * 4 + workVideoBuffer); + + currentBrickIdx = 0; + + for(i=firstBrick;i<=lastBrick;i++) + { + if(READ_LE_U16(currentPositionInBuffer)) + { + WRITE_LE_U16(currentPositionInBuffer, currentBrickIdx); + + Load_HQR("LBA_BRK.HQR", destinationBrickPtr, i); + brickSize = Size_HQR("LBA_BRK.HQR",i); + + finalSize += brickSize; + destinationBrickPtr += brickSize; + WRITE_LE_U32(localBufferBrick,brickSize); + localBufferBrick+=4; + } + + ptrTempDecompression+=4; + currentPositionInBuffer+=2; + } + + currentBllEntryIdx = 0; + for(i=1;i<256;i++) + { + unsigned char currentBitByte = *(ptrToBllBits + (i/8)); + unsigned char currentBitMask = 1 << (7-(i&7)); + + if(currentBitByte & currentBitMask) + { + unsigned int currentBllOffset = READ_LE_U32(currentBll + currentBllEntryIdx); + unsigned char* currentBllPtr = currentBll + currentBllOffset; + + unsigned int bllSizeX = currentBllPtr[0]; + unsigned int bllSizeY = currentBllPtr[1]; + unsigned int bllSizeZ = currentBllPtr[2]; + + unsigned int bllSize = bllSizeX * bllSizeY * bllSizeZ; + + unsigned char* bllDataPtr = currentBllPtr + 5; + + for(j=0;j<bllSize;j++) + { + unsigned int brickIdx = READ_LE_U16(bllDataPtr); + + if(brickIdx) + { + WRITE_LE_U16(bllDataPtr, READ_LE_U16(bufferPtr + brickIdx * 2 - 2)); + } + bllDataPtr += 4; + } + } + currentBllEntryIdx += 4; + } + + return (finalSize); } Index: cube.c =================================================================== RCS file: /cvsroot/twin-e/twin-e/src/cube.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cube.c 12 Jun 2005 20:19:29 -0000 1.4 --- cube.c 22 Jun 2005 21:55:08 -0000 1.5 *************** *** 242,248 **** unsigned int firstBrickOffset; ! firstBrickOffset = *buffer1; destPtr = (unsigned char *) ((unsigned char*)destBuffer + firstBrickOffset); ! numOfBricks = (*buffer1) >> 2; *(destBuffer++) = startOffset = *buffer1; --- 242,248 ---- unsigned int firstBrickOffset; ! firstBrickOffset = READ_LE_U32(buffer1); destPtr = (unsigned char *) ((unsigned char*)destBuffer + firstBrickOffset); ! numOfBricks = READ_LE_U32(buffer1) >> 2; *(destBuffer++) = startOffset = *buffer1; |