diff options
author | Vincent Hamm | 2007-12-25 16:37:12 +0000 |
---|---|---|
committer | Vincent Hamm | 2007-12-25 16:37:12 +0000 |
commit | 37d8bed89be174f37aeba1993f724c3889d88d10 (patch) | |
tree | 9a1575ac352224c8dca7e9f4f3371b8fe0abba81 | |
parent | c10f74411ec9bb1323551a3958eebd58e06c134a (diff) | |
download | scummvm-rg350-37d8bed89be174f37aeba1993f724c3889d88d10.tar.gz scummvm-rg350-37d8bed89be174f37aeba1993f724c3889d88d10.tar.bz2 scummvm-rg350-37d8bed89be174f37aeba1993f724c3889d88d10.zip |
Fix cell sorting
Fix palette loading
svn-id: r29985
-rw-r--r-- | engines/cruise/background.cpp | 4 | ||||
-rw-r--r-- | engines/cruise/cell.cpp | 13 | ||||
-rw-r--r-- | engines/cruise/dataLoader.cpp | 5 | ||||
-rw-r--r-- | engines/cruise/overlay.cpp | 3 | ||||
-rw-r--r-- | engines/cruise/volume.cpp | 47 |
5 files changed, 30 insertions, 42 deletions
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp index 11d70c06de..fe83e5c3fb 100644 --- a/engines/cruise/background.cpp +++ b/engines/cruise/background.cpp @@ -128,8 +128,8 @@ int loadBackground(const char *name, int idx) { } if (!strcmp((char*)ptr, "PAL")) { - printf("Pal loading unsupported !\n"); - ASSERT(0); + memcpy(palScreen[idx], ptr+4, 256*3); + gfxModuleData_setPal256(palScreen[idx]); } else { int mode = ptr2[1]; ptr2 += 2; diff --git a/engines/cruise/cell.cpp b/engines/cruise/cell.cpp index 39e8a2f1ec..a716d0b61f 100644 --- a/engines/cruise/cell.cpp +++ b/engines/cruise/cell.cpp @@ -159,17 +159,14 @@ cellStruct *addCell(cellStruct *pHead, int16 overlayIdx, int16 objIdx, int16 typ currentHead3 = currentHead; currentHead2 = currentHead->next; - while (currentHead2) { - if (currentHead2->type == 3) { - break; - } + while (currentHead2 && (currentHead2->type != 3)) { if (currentHead2->type != 5) { int16 lvar2; getSingleObjectParam(currentHead2->overlay, currentHead2->idx, 2, &lvar2); - if (lvar2 > var) + if (lvar2 >= var) break; } @@ -360,14 +357,14 @@ void freezeCell(cellStruct * pObject, int overlayIdx, int objIdx, int objType, i } } -void sortCells(int16 param1, int16 param2, cellStruct *objPtr) { +void sortCells(int16 ovlIdx, int16 ovjIdx, cellStruct *objPtr) { cellStruct *pl,*pl2,*pl3,*pl4,*plz,*pllast; cellStruct prov; int16 newz, objz, sobjz; pl4 = NULL; - getSingleObjectParam(param1, param2, 2, &sobjz); + getSingleObjectParam(ovlIdx, ovjIdx, 2, &sobjz); pl = objPtr; prov.next = NULL; prov.prev = NULL; @@ -378,7 +375,7 @@ void sortCells(int16 param1, int16 param2, cellStruct *objPtr) { while (pl2) { pl3 = pl2->next; - if ((pl2->overlay == param1) && (pl2->idx == param2)) {// found + if ((pl2->overlay == ovlIdx) && (pl2->idx == ovjIdx)) {// found pl->next = pl3; if (pl3) { diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp index 4c89c0b93f..f21a3f1c71 100644 --- a/engines/cruise/dataLoader.cpp +++ b/engines/cruise/dataLoader.cpp @@ -42,8 +42,7 @@ void decodeGfxFormat1(dataFileEntry *pCurrentFileEntry) { uint8 *buffer; uint8 *dataPtr = pCurrentFileEntry->subData.ptr; - int spriteSize = - pCurrentFileEntry->height * pCurrentFileEntry->width; + int spriteSize = pCurrentFileEntry->height * pCurrentFileEntry->width; int x = 0; buffer = (uint8 *) malloc(spriteSize); @@ -480,7 +479,7 @@ int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentD filesDatabase[fileIndex].subData.resourceType = 2; decodeGfxFormat1(&filesDatabase[fileIndex]); filesDatabase[fileIndex].subData.index = currentEntryIdx; - filesDatabase[fileIndex].subData.transparency = localBuffer.transparency % 0x10; + filesDatabase[fileIndex].subData.transparency = 0; break; } case 4: diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp index 73ca422bd3..67f9bbab6e 100644 --- a/engines/cruise/overlay.cpp +++ b/engines/cruise/overlay.cpp @@ -607,8 +607,7 @@ int loadOverlay(const char *scriptName) { return (-2); } - memcpy(ovlData->stringTable[i].string, - scriptPtr, ovlData->stringTable[i].length); + memcpy(ovlData->stringTable[i].string, scriptPtr, ovlData->stringTable[i].length); scriptPtr += ovlData->stringTable[i].length; } } diff --git a/engines/cruise/volume.cpp b/engines/cruise/volume.cpp index 324aac303d..6007de1161 100644 --- a/engines/cruise/volume.cpp +++ b/engines/cruise/volume.cpp @@ -425,54 +425,47 @@ int16 readVolCnf(void) { sprintf(nameBuffer, "D%d.", i + 1); - fileHandle = fopen(nameBuffer, "rb"); + fileHandle.open(nameBuffer); short int numEntry; short int sizeEntry; - fread(&numEntry, 2, 1, fileHandle); - fread(&sizeEntry, 2, 1, fileHandle); - - flipShort(&numEntry); - flipShort(&sizeEntry); + numEntry = fileHandle.readSint16BE(); + sizeEntry = fileHandle.readSint16BE(); buffer = (fileEntry *) mallocAndZero(numEntry * sizeEntry); - fread(buffer, numEntry * sizeEntry, 1, fileHandle); - for (j = 0; j < numEntry; j++) { - flipLong(&buffer[j].offset); - flipLong(&buffer[j].size); - flipLong(&buffer[j].unk2); - flipLong(&buffer[j].unk3); + fileHandle.seek(4+j*0x1E); + fileHandle.read(buffer[j].name, 14); + buffer[j].offset = fileHandle.readSint32BE(); + buffer[j].size = fileHandle.readSint32BE(); + buffer[j].extSize = fileHandle.readSint32BE(); + buffer[j].unk3 = fileHandle.readSint32BE(); - fseek(fileHandle, buffer[j].offset, SEEK_SET); + fileHandle.seek(buffer[j].offset); char *bufferLocal; bufferLocal = (char *)mallocAndZero(buffer[j].size); - fread(bufferLocal, buffer[j].size, 1, fileHandle); + fileHandle.read(bufferLocal, buffer[j].size); char nameBuffer[256]; - sprintf(nameBuffer, "D%d.dmp/%s", i + 1, - buffer[j].name); + sprintf(nameBuffer, "D:/oldies/c-eng/dump/%s", buffer[j].name); - if (buffer[j].size == buffer[j].unk2) { - FILE *fOut = fopen(nameBuffer, "wb+"); - fwrite(bufferLocal, buffer[j].size, 1, fOut); - fclose(fOut); + if (buffer[j].size == buffer[j].extSize) { + Common::File fout; + fout.open(nameBuffer, Common::File::kFileWriteMode); + fout.write(bufferLocal, buffer[j].size); } else { - char *uncompBuffer = - (char *)mallocAndZero(buffer[j].unk2 + - 500); + char *uncompBuffer = (char *)mallocAndZero(buffer[j].extSize + 500); delphineUnpack((uint8 *) uncompBuffer, (const uint8 *) bufferLocal, buffer[j].size); - FILE *fOut = fopen(nameBuffer, "wb+"); - fwrite(uncompBuffer, buffer[j].unk2, 1, - fOut); - fclose(fOut); + Common::File fout; + fout.open(nameBuffer, Common::File::kFileWriteMode); + fout.write(uncompBuffer, buffer[j].extSize); //free(uncompBuffer); |