aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise
diff options
context:
space:
mode:
authorVincent Hamm2007-12-25 18:11:35 +0000
committerVincent Hamm2007-12-25 18:11:35 +0000
commita2d2f01835975aa28cbb03d56468abbc894643dd (patch)
tree7c1afd38442c5a1394843d4d6d70d33aab37f089 /engines/cruise
parent37d8bed89be174f37aeba1993f724c3889d88d10 (diff)
downloadscummvm-rg350-a2d2f01835975aa28cbb03d56468abbc894643dd.tar.gz
scummvm-rg350-a2d2f01835975aa28cbb03d56468abbc894643dd.tar.bz2
scummvm-rg350-a2d2f01835975aa28cbb03d56468abbc894643dd.zip
Bunch of gfx fix
svn-id: r29986
Diffstat (limited to 'engines/cruise')
-rw-r--r--engines/cruise/background.cpp17
-rw-r--r--engines/cruise/dataLoader.cpp2
-rw-r--r--engines/cruise/gfxModule.cpp11
-rw-r--r--engines/cruise/mainDraw.cpp4
-rw-r--r--engines/cruise/volume.cpp9
5 files changed, 23 insertions, 20 deletions
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp
index fe83e5c3fb..f29cccf7b3 100644
--- a/engines/cruise/background.cpp
+++ b/engines/cruise/background.cpp
@@ -136,6 +136,7 @@ int loadBackground(const char *name, int idx) {
// read palette
switch(mode)
{
+ case 0:
case 4: // color on 3 bit
{
uint16 oldPalette[32];
@@ -148,7 +149,6 @@ int loadBackground(const char *name, int idx) {
{
gfxModuleData_convertOldPalColor(oldPalette[i], &palScreen[idx][i*3]);
}
- ptr2 += 32000;
break;
}
case 5: // color on 4 bit
@@ -158,9 +158,9 @@ int loadBackground(const char *name, int idx) {
uint8* inPtr = ptr2 + i * 2;
uint8* outPtr = palScreen[idx] +i * 3;
- outPtr[2] = ((inPtr[1])&0x0F) << 4;
- outPtr[1] = (((inPtr[1])&0xF0) >> 4) << 4;
- outPtr[0] = ((inPtr[0])&0x0F) << 4;
+ outPtr[2] = ((inPtr[1])&0x0F) * 17;
+ outPtr[1] = (((inPtr[1])&0xF0) >> 4) * 17;
+ outPtr[0] = ((inPtr[0])&0x0F) * 17;
}
ptr2 += 2*32;
break;
@@ -176,24 +176,27 @@ int loadBackground(const char *name, int idx) {
gfxModuleData_setPal256(palScreen[idx]);
- loadMEN(&ptr2);
- loadCVT(&ptr2);
-
// read image data
gfxModuleData_gfxClearFrameBuffer(backgroundPtrtable[idx]);
switch(mode)
{
+ case 0:
case 4:
convertGfxFromMode4(ptr2, 320, 200, backgroundPtrtable[idx]);
+ ptr2 += 32000;
break;
case 5:
convertGfxFromMode5(ptr2, 320, 200, backgroundPtrtable[idx]);
break;
case 8:
memcpy(backgroundPtrtable[idx], ptr2, 320 * 200);
+ ptr2 += 32000;
break;
}
+
+ loadMEN(&ptr2);
+ loadCVT(&ptr2);
}
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp
index f21a3f1c71..e0bfe70dc0 100644
--- a/engines/cruise/dataLoader.cpp
+++ b/engines/cruise/dataLoader.cpp
@@ -467,7 +467,7 @@ int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentD
ptr5 += resourceSize;
switch (localBuffer.type) {
- case 0:
+ case 0: // polygon
{
filesDatabase[fileIndex].subData.resourceType = 8;
filesDatabase[fileIndex].subData.index = currentEntryIdx;
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 8a990c778e..8460b2a6b7 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -63,9 +63,8 @@ void outputBit(char *buffer, int bitPlaneNumber, uint8 data) {
}
void convertGfxFromMode4(uint8 *sourcePtr, int width, int height, uint8 *destPtr) {
-
- for (int y = 0; y < (height/16); ++y) {
- for (int x = 0; x < width; ++x) {
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width/16; ++x) {
for (int bit = 0; bit < 16; ++bit) {
uint8 color = 0;
for (int p = 0; p < 4; ++p) {
@@ -202,8 +201,7 @@ void gfxModuleData_gfxWaitVSync(void) {
void gfxModuleData_flip(void) {
}
-void gfxModuleData_field_64(char *sourceBuffer, int width, int height,
- char *dest, int x, int y, int color) {
+void gfxModuleData_field_64(char *sourceBuffer, int width, int height, char *dest, int x, int y, int color) {
int i;
int j;
@@ -212,8 +210,7 @@ void gfxModuleData_field_64(char *sourceBuffer, int width, int height,
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
- dest[(y + i) * 320 / 4 + x + j] =
- sourceBuffer[i * width + j];
+ dest[(y + i) * 320 / 4 + x + j] = sourceBuffer[i * width + j];
}
}
}
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index 158d4daf60..4cdcadd223 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -837,9 +837,9 @@ void buildPolyModel(int positionX, int positionY, int scale, char *pMask, char *
if (destBuffer) {
if (pMask) {
- blitPolyMode1(destBuffer, pMask, polyBuffer4, m_color & 0xF);
+ blitPolyMode1(destBuffer, pMask, polyBuffer4, m_color & 0xFF);
} else {
- blitPolyMode2(destBuffer, polyBuffer4, m_color & 0xF);
+ blitPolyMode2(destBuffer, polyBuffer4, m_color & 0xFF);
}
}
}
diff --git a/engines/cruise/volume.cpp b/engines/cruise/volume.cpp
index 6007de1161..c1a09f9295 100644
--- a/engines/cruise/volume.cpp
+++ b/engines/cruise/volume.cpp
@@ -452,12 +452,13 @@ int16 readVolCnf(void) {
char nameBuffer[256];
- sprintf(nameBuffer, "D:/oldies/c-eng/dump/%s", buffer[j].name);
+ sprintf(nameBuffer, "%s", buffer[j].name);
if (buffer[j].size == buffer[j].extSize) {
Common::File fout;
fout.open(nameBuffer, Common::File::kFileWriteMode);
- fout.write(bufferLocal, buffer[j].size);
+ if(fout.isOpen())
+ fout.write(bufferLocal, buffer[j].size);
} else {
char *uncompBuffer = (char *)mallocAndZero(buffer[j].extSize + 500);
@@ -465,7 +466,8 @@ int16 readVolCnf(void) {
Common::File fout;
fout.open(nameBuffer, Common::File::kFileWriteMode);
- fout.write(uncompBuffer, buffer[j].extSize);
+ if(fout.isOpen())
+ fout.write(uncompBuffer, buffer[j].extSize);
//free(uncompBuffer);
@@ -473,6 +475,7 @@ int16 readVolCnf(void) {
free(bufferLocal);
}
+ fileHandle.close();
}
#endif