From e31b27176088c3215edf589ed90684abf2240b13 Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Thu, 23 Feb 2006 18:47:28 +0000 Subject: formating code svn-id: r20835 --- engines/cine/anim.cpp | 192 +++++++++++++-------------------------------- engines/cine/auto00.cpp | 33 +++----- engines/cine/bg.cpp | 15 ++-- engines/cine/bg_list.cpp | 3 +- engines/cine/cine.cpp | 14 ++-- engines/cine/gfx.cpp | 86 ++++++-------------- engines/cine/gfx.h | 6 +- engines/cine/main_loop.cpp | 9 +-- engines/cine/msg.cpp | 3 +- engines/cine/object.cpp | 17 ++-- engines/cine/pal.cpp | 6 +- engines/cine/part.cpp | 15 +--- engines/cine/prc.cpp | 8 +- engines/cine/rel.cpp | 8 +- 14 files changed, 126 insertions(+), 289 deletions(-) (limited to 'engines/cine') diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index eb113b9190..65ef6f3891 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -206,8 +206,8 @@ int16 allocFrame(uint16 width, uint16 height, int8 isMask) { if (!isMask) { // sprite + generated mask frameSize = width * height; - animDataTable[i].ptr1 = (uint8 *) malloc(frameSize); - animDataTable[i].ptr2 = (uint8 *) malloc(frameSize); + animDataTable[i].ptr1 = (uint8 *)malloc(frameSize); + animDataTable[i].ptr2 = (uint8 *)malloc(frameSize); animDataTable[i].width = width; animDataTable[i].var1 = width >> 3; @@ -220,7 +220,7 @@ int16 allocFrame(uint16 width, uint16 height, int8 isMask) { // mask frameSize = width * height * 8; - animDataTable[i].ptr1 = (uint8 *) malloc(frameSize); + animDataTable[i].ptr1 = (uint8 *)malloc(frameSize); animDataTable[i].ptr2 = NULL; animDataTable[i].width = width; @@ -251,8 +251,7 @@ int16 allocFrame2(uint16 width, uint16 height, uint16 type) { frameSize = width * height; - if (type == 4) // 16 color sprites to 256 - { + if (type == 4) { // 16 color sprites to 256 frameSize *= 2; type = 8; width *= 2; @@ -264,7 +263,7 @@ int16 allocFrame2(uint16 width, uint16 height, uint16 type) { frameSize *= 2; - animDataTable[i].ptr1 = (uint8 *) malloc(frameSize); + animDataTable[i].ptr1 = (uint8 *)malloc(frameSize); ASSERT_PTR(animDataTable[i].ptr1); @@ -296,8 +295,7 @@ int16 reserveFrame(uint16 width, uint16 height, uint16 type, uint16 idx) { frameSize = width * height; - if (type == 4) // 256 color sprites - { + if (type == 4) { // 256 color sprites frameSize *= 2; type = 8; width *= 2; @@ -309,7 +307,7 @@ int16 reserveFrame(uint16 width, uint16 height, uint16 type, uint16 idx) { frameSize *= 2; - animDataTable[i].ptr1 = (uint8 *) malloc(frameSize); + animDataTable[i].ptr1 = (uint8 *)malloc(frameSize); ASSERT_PTR(animDataTable[i].ptr1); @@ -381,13 +379,11 @@ void loadSpl(char *resourceName) { foundFileIdx = findFileInBundle(resourceName); dataPtr = readBundleFile(foundFileIdx); - entry = - allocFrame((uint16) partBuffer[foundFileIdx].unpacked_size, 1, -1); + entry = allocFrame((uint16) partBuffer[foundFileIdx].unpacked_size, 1, -1); ASSERT(entry != -1); - memcpy(animDataTable[entry].ptr1, dataPtr, - (uint16) partBuffer[foundFileIdx].unpacked_size); + memcpy(animDataTable[entry].ptr1, dataPtr, (uint16) partBuffer[foundFileIdx].unpacked_size); animDataTable[entry].fileIdx = foundFileIdx; animDataTable[entry].frameIdx = 0; @@ -414,14 +410,11 @@ void loadMsk(char *resourceName) { flipU16(&animHeader.numFrames); for (i = 0; i < animHeader.numFrames; i++) { - entry = - allocFrame(animHeader.frameWidth * 2, - animHeader.frameHeight, 1); + entry = allocFrame(animHeader.frameWidth * 2, animHeader.frameHeight, 1); ASSERT(entry != -1); - convertMask(animDataTable[entry].ptr1, ptr, - animHeader.frameWidth, animHeader.frameHeight); + convertMask(animDataTable[entry].ptr1, ptr, animHeader.frameWidth, animHeader.frameHeight); ptr += animHeader.frameWidth * animHeader.frameHeight; animDataTable[entry].fileIdx = foundFileIdx; @@ -458,9 +451,7 @@ void loadAni(char *resourceName) { for (i = 0; i < animHeader.numFrames; i++) { uint8 *animPtr; - entry = - allocFrame(animHeader.frameWidth * 2, - animHeader.frameHeight, 0); + entry = allocFrame(animHeader.frameWidth * 2, animHeader.frameHeight, 0); ASSERT(entry != -1); @@ -481,18 +472,14 @@ void loadAni(char *resourceName) { } } - animPtr = (uint8 *) malloc(fullSize); + animPtr = (uint8 *)malloc(fullSize); memcpy(animPtr, ptr, fullSize); ptr += fullSize; - gfxConvertSpriteToRaw(animDataTable[entry].ptr1, animPtr, - animHeader.frameWidth, animHeader.frameHeight); + gfxConvertSpriteToRaw(animDataTable[entry].ptr1, animPtr, animHeader.frameWidth, animHeader.frameHeight); - generateMask(animDataTable[entry].ptr1, - animDataTable[entry].ptr2, - animHeader.frameWidth * 2 * animHeader.frameHeight, - transparentColor); + generateMask(animDataTable[entry].ptr1, animDataTable[entry].ptr2, animHeader.frameWidth * 2 * animHeader.frameHeight, transparentColor); free(animPtr); @@ -632,7 +619,7 @@ void loadSet(char *resourceName) { ptr = dataPtr + 4; - numSpriteInAnim = *(uint16 *) ptr; + numSpriteInAnim = *(uint16 *)ptr; flipU16(&numSpriteInAnim); ptr += 2; @@ -640,8 +627,7 @@ void loadSet(char *resourceName) { for (i = 0; i < numSpriteInAnim; i++) { int16 typeParam; - uint8 table[16] = - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + uint8 table[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; memcpy(&header2, ptr, 0x10); ptr += 0x10; @@ -665,18 +651,12 @@ void loadSet(char *resourceName) { } if (typeParam) { - entry = - allocFrame2(header2.width * 2, header2.height, - header2.type); + entry = allocFrame2(header2.width * 2, header2.height, header2.type); } else { if (header2.type == 1) { - entry = - allocFrame2(header2.width * 2, - header2.height, header2.type); + entry = allocFrame2(header2.width * 2, header2.height, header2.type); } else { - entry = - allocFrame2(header2.width * 2, - header2.height, header2.type); + entry = allocFrame2(header2.width * 2, header2.height, header2.type); } } @@ -686,21 +666,17 @@ void loadSet(char *resourceName) { if (typeParam) { memcpy(animDataTable[entry].ptr1, table, 0x10); - gfxConvertSpriteToRaw(animDataTable[entry].ptr1, - dataPtr, header2.width, header2.height); - //memcpy(animDataTable[entry].ptr1+0x10,dataPtr,fullSize); + gfxConvertSpriteToRaw(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); + //memcpy(animDataTable[entry].ptr1 + 0x10, dataPtr, fullSize); } else { if (header2.type == 1) { - convert4BBP(animDataTable[entry].ptr1, dataPtr, - header2.width, header2.height); + convert4BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); } else if (header2.type == 5) { - convert8BBP(animDataTable[entry].ptr1, dataPtr, - header2.width, header2.height); + convert8BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); } else if (header2.type == 4) { ASSERT(0); } else { - convert8BBP2(animDataTable[entry].ptr1, - dataPtr, header2.width, header2.height); + convert8BBP2(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); } } @@ -736,8 +712,7 @@ void loadSetAbs(char *resourceName, uint16 idx) { for (i = 0; i < numSpriteInAnim; i++) { int16 typeParam; - uint8 table[16] = - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + uint8 table[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; memcpy(&header2, ptr, 0x10); ptr += 0x10; @@ -761,18 +736,12 @@ void loadSetAbs(char *resourceName, uint16 idx) { } if (typeParam) { - entry = - reserveFrame(header2.width * 2, header2.height, - header2.type, idx + i); + entry = reserveFrame(header2.width * 2, header2.height, header2.type, idx + i); } else { if (header2.type == 1) { - entry = - reserveFrame(header2.width * 2, - header2.height, header2.type, idx + i); + entry = reserveFrame(header2.width * 2, header2.height, header2.type, idx + i); } else { - entry = - reserveFrame(header2.width * 2, - header2.height, header2.type, idx + i); + entry = reserveFrame(header2.width * 2, header2.height, header2.type, idx + i); } } @@ -782,21 +751,17 @@ void loadSetAbs(char *resourceName, uint16 idx) { if (typeParam) { memcpy(animDataTable[entry].ptr1, table, 0x10); - gfxConvertSpriteToRaw(animDataTable[entry].ptr1, - dataPtr, header2.width, header2.height); - //memcpy(animDataTable[entry].ptr1+0x10,dataPtr,fullSize); + gfxConvertSpriteToRaw(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); + //memcpy(animDataTable[entry].ptr1 + 0x10, dataPtr, fullSize); } else { if (header2.type == 1) { - convert4BBP(animDataTable[entry].ptr1, dataPtr, - header2.width, header2.height); + convert4BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); } else if (header2.type == 5) { - convert8BBP(animDataTable[entry].ptr1, dataPtr, - header2.width, header2.height); + convert8BBP(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); } else if (header2.type == 4) { ASSERT(0); } else { - convert8BBP2(animDataTable[entry].ptr1, - dataPtr, header2.width, header2.height); + convert8BBP2(animDataTable[entry].ptr1, dataPtr, header2.width, header2.height); } } @@ -814,11 +779,9 @@ void loadSeq(char *resourceName) { foundFileIdx = findFileInBundle(resourceName); dataPtr = readBundleFile(foundFileIdx); - entry = - allocFrame2((uint16) partBuffer[foundFileIdx].unpacked_size, 1, 0); + entry = allocFrame2((uint16) partBuffer[foundFileIdx].unpacked_size, 1, 0); - memcpy(animDataTable[entry].ptr1, dataPtr + 0x16, - (uint16) partBuffer[foundFileIdx].unpacked_size - 0x16); + memcpy(animDataTable[entry].ptr1, dataPtr + 0x16, (uint16) partBuffer[foundFileIdx].unpacked_size - 0x16); } void loadSeqAbs(char *resourceName, uint16 idx) { @@ -829,12 +792,9 @@ void loadSeqAbs(char *resourceName, uint16 idx) { foundFileIdx = findFileInBundle(resourceName); dataPtr = readBundleFile(foundFileIdx); - entry = - reserveFrame((uint16) partBuffer[foundFileIdx].unpacked_size, 1, 0, - idx); + entry = reserveFrame((uint16) partBuffer[foundFileIdx].unpacked_size, 1, 0, idx); - memcpy(animDataTable[entry].ptr1, dataPtr + 0x16, - (uint16) partBuffer[foundFileIdx].unpacked_size - 0x16); + memcpy(animDataTable[entry].ptr1, dataPtr + 0x16, (uint16) partBuffer[foundFileIdx].unpacked_size - 0x16); } void loadResource(char *resourceName) { @@ -843,27 +803,21 @@ void loadResource(char *resourceName) { 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; } @@ -876,7 +830,6 @@ void loadAbs(char *resourceName, uint16 idx) { if (strstr(resourceName, ".SET")) { loadSetAbs(resourceName, idx); - return; } else if (strstr(resourceName, ".H32")) { return; @@ -934,15 +887,12 @@ void loadResourcesFromSave() { } if (isSpl) { - animHeader.frameWidth = - (uint16) partBuffer[foundFileIdx]. - unpacked_size; + animHeader.frameWidth = (uint16) partBuffer[foundFileIdx].unpacked_size; animHeader.frameHeight = 1; animHeader.numFrames = 1; isMask = -1; } else { - memcpy(&animHeader, ptr, - sizeof(animHeaderStruct)); + memcpy(&animHeader, ptr, sizeof(animHeaderStruct)); ptr += sizeof(animHeaderStruct); flipU16(&animHeader.frameWidth); @@ -955,17 +905,13 @@ void loadResourcesFromSave() { uint16 i; uint8 transparentColor; - fullSize = - animHeader.frameWidth * - animHeader.frameHeight; + fullSize = animHeader.frameWidth * animHeader.frameHeight; loadRelatedPalette(animName); - transparentColor = - findAnimInHardcodedData(animName); + transparentColor = findAnimInHardcodedData(animName); - for (i = 0; i < animHeader.numFrames; i++) // load all the frames - { + for (i = 0; i < animHeader.numFrames; i++) { // load all the frames int16 entry; uint8 *animPtr; @@ -987,66 +933,38 @@ void loadResourcesFromSave() { } currentPtr[i].ptr1 = NULL; - entry = - allocFrame(animHeader.frameWidth * - 2, animHeader.frameHeight, isMask); + entry = allocFrame(animHeader.frameWidth * 2, animHeader.frameHeight, isMask); currentPtr->fileIdx = foundFileIdx; ASSERT(entry != -1); if (isSpl) { - memcpy(animDataTable[entry]. - ptr1, ptr, fullSize); + memcpy(animDataTable[entry].ptr1, ptr, fullSize); ptr += fullSize; } else { if (!isMask) { - animPtr = - (uint8 *) - malloc(fullSize); - - memcpy(animPtr, ptr, - fullSize); + animPtr = (uint8 *)malloc(fullSize); + memcpy(animPtr, ptr, fullSize); ptr += fullSize; - gfxConvertSpriteToRaw - (animDataTable - [entry].ptr1, - animPtr, - animHeader. - frameWidth, - animHeader. - frameHeight); - - generateMask - (animDataTable - [entry].ptr1, - animDataTable - [entry].ptr2, - animHeader. - frameWidth * 2 * - animHeader. - frameHeight, - transparentColor); + gfxConvertSpriteToRaw(animDataTable[entry].ptr1, animPtr, + animHeader.frameWidth, animHeader.frameHeight); + generateMask(animDataTable[entry].ptr1, animDataTable[entry].ptr2, + animHeader.frameWidth * 2 *animHeader.frameHeight, transparentColor); free(animPtr); } else { - convertMask - (animDataTable - [entry].ptr1, ptr, - animHeader. - frameWidth, - animHeader. - frameHeight); + convertMask(animDataTable[entry].ptr1, ptr, animHeader.frameWidth, + animHeader.frameHeight); ptr += fullSize; } } - // animDataTable[entry].fileIdx = foundFileIdx; // Only when reading from bundles + //animDataTable[entry].fileIdx = foundFileIdx; // Only when reading from bundles animDataTable[entry].frameIdx = i; - strcpy(animDataTable[entry].name, - currentPartName); + strcpy(animDataTable[entry].name, currentPartName); } } diff --git a/engines/cine/auto00.cpp b/engines/cine/auto00.cpp index f44185cd40..e50d107c14 100644 --- a/engines/cine/auto00.cpp +++ b/engines/cine/auto00.cpp @@ -23,27 +23,16 @@ */ unsigned char AUT000[] = { - 0x00, 0x32, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6b, 0x6c, 0x01, 0x40, - 0x50, 0x41, 0x52, 0x54, - 0x30, 0x31, 0x00, 0x42, 0x00, 0x49, 0x4e, 0x54, 0x52, 0x4f, 0x2e, 0x50, - 0x52, 0x43, 0x00, 0x42, - 0x02, 0x49, 0x4e, 0x54, 0x52, 0x4f, 0x2e, 0x4f, 0x42, 0x4a, 0x00, 0x3d, - 0x4c, 0x4f, 0x47, 0x4f, - 0x2e, 0x50, 0x49, 0x31, 0x00, 0x46, 0x50, 0x6e, 0x44, 0x55, 0x47, 0x47, - 0x45, 0x52, 0x2e, 0x44, - 0x41, 0x54, 0x00, 0x3d, 0x43, 0x49, 0x4e, 0x45, 0x4d, 0x41, 0x2e, 0x50, - 0x49, 0x31, 0x00, 0x47, + 0x00, 0x32, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6b, 0x6c, 0x01, 0x40, 0x50, 0x41, 0x52, 0x54, + 0x30, 0x31, 0x00, 0x42, 0x00, 0x49, 0x4e, 0x54, 0x52, 0x4f, 0x2e, 0x50, 0x52, 0x43, 0x00, 0x42, + 0x02, 0x49, 0x4e, 0x54, 0x52, 0x4f, 0x2e, 0x4f, 0x42, 0x4a, 0x00, 0x3d, 0x4c, 0x4f, 0x47, 0x4f, + 0x2e, 0x50, 0x49, 0x31, 0x00, 0x46, 0x50, 0x6e, 0x44, 0x55, 0x47, 0x47, 0x45, 0x52, 0x2e, 0x44, + 0x41, 0x54, 0x00, 0x3d, 0x43, 0x49, 0x4e, 0x45, 0x4d, 0x41, 0x2e, 0x50, 0x49, 0x31, 0x00, 0x47, 0x46, 0x6f, 0x43, 0x51, 0x00, 0x1e, 0x1e, 0x43, 0x51, 0x00, }; diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp index b8603cd48c..bdcc893c91 100644 --- a/engines/cine/bg.cpp +++ b/engines/cine/bg.cpp @@ -45,8 +45,7 @@ uint8 loadCt(const char *ctName) { currentPtr = ptr = readBundleFile(findFileInBundle(ctName)); if (gameType == Cine::GID_OS) { - if (*(uint16 *) currentPtr == 0x800) // detect 256 color background - { + if (*(uint16 *) currentPtr == 0x800) { // detect 256 color background loadCtHigh(currentPtr + 2); return 0; } @@ -95,8 +94,7 @@ uint8 loadBg(const char *bgName) { currentPtr = ptr = readBundleFile(fileIdx); - if (*(uint16 *) currentPtr == 0x800) // detect 256 color background - { + if (*(uint16 *) currentPtr == 0x800) { // detect 256 color background loadBgHigh((char *)currentPtr + 2); return 0; } @@ -121,8 +119,7 @@ uint8 loadBg(const char *bgName) { return 0; } -uint8 *additionalBgTable[9] = - { page2Raw, NULL, NULL, NULL, NULL, NULL, NULL, NULL, page3Raw }; +uint8 *additionalBgTable[9] = { page2Raw, NULL, NULL, NULL, NULL, NULL, NULL, NULL, page3Raw }; uint8 currentAdditionalBgIdx = 0; uint8 currentAdditionalBgIdx2 = 0; @@ -139,10 +136,8 @@ void addBackground(char *bgName, uint16 bgIdx) { additionalBgTable[bgIdx] = (uint8 *) malloc(320 * 200); - if (*(uint16 *) currentPtr == 0x800) // detect 256 color background - { - memcpy(additionalBgTable[bgIdx], currentPtr + 2 + 3 * 256, - 320 * 200); + if (*(uint16 *) currentPtr == 0x800) { // detect 256 color background + memcpy(additionalBgTable[bgIdx], currentPtr + 2 + 3 * 256, 320 * 200); return; } diff --git a/engines/cine/bg_list.cpp b/engines/cine/bg_list.cpp index 0a6ae4b84e..b102ca33fd 100644 --- a/engines/cine/bg_list.cpp +++ b/engines/cine/bg_list.cpp @@ -39,8 +39,7 @@ void addSpriteFilledToBGList(int16 idx) { height = animDataTable[objectTable[idx].frame].var2; if (animDataTable[objectTable[idx].frame].ptr1) { - gfxFillSprite(animDataTable[objectTable[idx].frame].ptr1, - width / 2, height, page2Raw, x, y); + gfxFillSprite(animDataTable[objectTable[idx].frame].ptr1, width / 2, height, page2Raw, x, y); } createVar9Element(idx, 1); diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 02c637a0cf..4d3bd94b96 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -128,10 +128,8 @@ CineEngine::CineEngine(GameDetector *detector, OSystem *syst) : Engine(syst) { } cine_g_mixer = _mixer; - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, - ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, - ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _dataPath = getGameDataPath(); _savePath = _saveFileMan->getSavePath(); @@ -157,8 +155,8 @@ void CineEngine::errorString(const char *buf1, char *buf2) { int CineEngine::init(GameDetector &detector) { // Initialize backend _system->beginGFXTransaction(); - initCommonGFX(detector, false); - _system->initSize(320, 200); + initCommonGFX(detector, false); + _system->initSize(320, 200); _system->endGFXTransaction(); g_cine_adlib = new AdlibMusic(_mixer); @@ -190,9 +188,9 @@ static void initialize() { init_video(); - textDataPtr = (uint8 *) malloc(8000); + textDataPtr = (uint8 *)malloc(8000); - partBuffer = (partBufferStruct *) malloc(255 * sizeof(animDataStruct)); + partBuffer = (partBufferStruct *)malloc(255 * sizeof(animDataStruct)); loadTextData("texte.dat", textDataPtr); snd_loadBasesonEntries("BASESON.SND"); diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index 2052861661..cb3e45debc 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -38,7 +38,7 @@ uint8 page2Raw[320 * 200]; uint8 page3Raw[320 * 200]; void init_video() { - screenBuffer = (byte *) malloc(320 * 200 * 3); + screenBuffer = (byte *)malloc(320 * 200 * 3); assert(screenBuffer); page0 = (unsigned char *)malloc(0x8000); @@ -182,8 +182,7 @@ void gfxResetRawPage(uint8 *pageRaw) { void gfxConvertSpriteToRaw(uint8 *dest, uint8 *source, uint16 width, uint16 height) { int x, y; - uint8 b1, b2, b3, b4, b5, b6, b7, b8, d1a, d1b, d2a, d2b, d3a, d3b, d4a, - d4b; + uint8 b1, b2, b3, b4, b5, b6, b7, b8, d1a, d1b, d2a, d2b, d3a, d3b, d4a, d4b; for (y = 0; y < height; y++) { for (x = 0; x < (width >> 3); x++) { @@ -198,36 +197,20 @@ void gfxConvertSpriteToRaw(uint8 *dest, uint8 *source, uint16 width, uint16 heig d1a = d1b = d2a = d2b = d3a = d3b = d4a = d4b = 0; - d1a |= - (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << - 2) | ((b1 & 1) << 3)) << 0; - d1b |= - (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << - 1) | ((b1 & 2) << 2)) << 0; - d2a |= - (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> - 0) | ((b1 & 4) << 1)) << 0; - d2b |= - (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> - 1) | ((b1 & 8) >> 0)) << 0; + d1a |= (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << 2) | ((b1 & 1) << 3)) << 0; + d1b |= (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << 1) | ((b1 & 2) << 2)) << 0; + d2a |= (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> 0) | ((b1 & 4) << 1)) << 0; + d2b |= (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> 1) | ((b1 & 8) >> 0)) << 0; b1 >>= 4; b2 >>= 4; b3 >>= 4; b4 >>= 4; - d3a |= - (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << - 2) | ((b1 & 1) << 3)) << 0; - d3b |= - (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << - 1) | ((b1 & 2) << 2)) << 0; - d4a |= - (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> - 0) | ((b1 & 4) << 1)) << 0; - d4b |= - (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> - 1) | ((b1 & 8) >> 0)) << 0; + d3a |= (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << 2) | ((b1 & 1) << 3)) << 0; + d3b |= (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << 1) | ((b1 & 2) << 2)) << 0; + d4a |= (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> 0) | ((b1 & 4) << 1)) << 0; + d4b |= (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> 1) | ((b1 & 8) >> 0)) << 0; *(dest++) = d4b; *(dest++) = d4a; @@ -245,36 +228,20 @@ void gfxConvertSpriteToRaw(uint8 *dest, uint8 *source, uint16 width, uint16 heig d1a = d1b = d2a = d2b = d3a = d3b = d4a = d4b = 0; - d1a |= - (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << - 2) | ((b1 & 1) << 3)) << 0; - d1b |= - (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << - 1) | ((b1 & 2) << 2)) << 0; - d2a |= - (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> - 0) | ((b1 & 4) << 1)) << 0; - d2b |= - (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> - 1) | ((b1 & 8) >> 0)) << 0; + d1a |= (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << 2) | ((b1 & 1) << 3)) << 0; + d1b |= (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << 1) | ((b1 & 2) << 2)) << 0; + d2a |= (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> 0) | ((b1 & 4) << 1)) << 0; + d2b |= (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> 1) | ((b1 & 8) >> 0)) << 0; b1 >>= 4; b2 >>= 4; b3 >>= 4; b4 >>= 4; - d3a |= - (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << - 2) | ((b1 & 1) << 3)) << 0; - d3b |= - (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << - 1) | ((b1 & 2) << 2)) << 0; - d4a |= - (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> - 0) | ((b1 & 4) << 1)) << 0; - d4b |= - (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> - 1) | ((b1 & 8) >> 0)) << 0; + d3a |= (((b4 & 1) >> 0) | ((b3 & 1) << 1) | ((b2 & 1) << 2) | ((b1 & 1) << 3)) << 0; + d3b |= (((b4 & 2) >> 1) | ((b3 & 2) >> 0) | ((b2 & 2) << 1) | ((b1 & 2) << 2)) << 0; + d4a |= (((b4 & 4) >> 2) | ((b3 & 4) >> 1) | ((b2 & 4) >> 0) | ((b1 & 4) << 1)) << 0; + d4b |= (((b4 & 8) >> 3) | ((b3 & 8) >> 2) | ((b2 & 8) >> 1) | ((b1 & 8) >> 0)) << 0; *(dest++) = d4b; *(dest++) = d4a; @@ -324,12 +291,9 @@ void gfxFlipRawPage(uint8 *frontBuffer) { g_system->setPalette(pal, 0, 256); } else { for (i = 0; i < 16; i++) { - pal[i * 4 + 2] = - ((c_palette[i] & 0x00f) >> 0) * 255 / 7; - pal[i * 4 + 1] = - ((c_palette[i] & 0x0f0) >> 4) * 255 / 7; - pal[i * 4 + 0] = - ((c_palette[i] & 0xf00) >> 8) * 255 / 7; + pal[i * 4 + 2] = ((c_palette[i] & 0x00f) >> 0) * 255 / 7; + pal[i * 4 + 1] = ((c_palette[i] & 0x0f0) >> 4) * 255 / 7; + pal[i * 4 + 0] = ((c_palette[i] & 0xf00) >> 8) * 255 / 7; pal[i * 4 + 3] = 0; } g_system->setPalette(pal, 0, 16); @@ -350,9 +314,8 @@ void drawSpriteRaw(uint8 *spritePtr, uint8 *maskPtr, int16 width, int16 height, destPtr += i * 320; for (j = 0; j < width * 8; j++) { - if (((gameType == Cine::GID_FW && !(*maskPtr)) - || (gameType == Cine::GID_OS)) && (x + j >= 0 - && x + j < 320 && i + y >= 0 && i + y < 200)) { + if (((gameType == Cine::GID_FW && !(*maskPtr)) || (gameType == Cine::GID_OS)) && (x + j >= 0 + && x + j < 320 && i + y >= 0 && i + y < 200)) { *(destPtr++) = *(spritePtr++); } else { destPtr++; @@ -374,8 +337,7 @@ void drawSpriteRaw2(uint8 *spritePtr, uint8 transColor, int16 width, int16 heigh destPtr += i * 320; for (j = 0; j < width * 8; j++) { - if ((*(spritePtr) != transColor) && (x + j >= 0 - && x + j < 320 && i + y >= 0 && i + y < 200)) { + if ((*(spritePtr) != transColor) && (x + j >= 0 && x + j < 320 && i + y >= 0 && i + y < 200)) { *(destPtr++) = *(spritePtr++); } else { destPtr++; diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h index 29b645ca75..ee403d74da 100644 --- a/engines/cine/gfx.h +++ b/engines/cine/gfx.h @@ -62,10 +62,8 @@ void gfxResetRawPage(uint8 *pageRaw); void gfxConvertSpriteToRaw(uint8 *dest, uint8 *source, uint16 width, uint16 height); void gfxCopyRawPage(uint8 *source, uint8 * dest); void gfxFlipRawPage(uint8 *frontBuffer); -void drawSpriteRaw(uint8 *spritePtr, uint8 *maskPtr, int16 width, int16 height, - uint8 *page, int16 x, int16 y); +void drawSpriteRaw(uint8 *spritePtr, uint8 *maskPtr, int16 width, int16 height, uint8 *page, int16 x, int16 y); void gfxDrawPlainBoxRaw(int16 x1, int16 y1, int16 x2, int16 y2, uint8 color, uint8 *page); -void drawSpriteRaw2(uint8 *spritePtr, uint8 transColor, int16 width, int16 height, - uint8 *page, int16 x, int16 y); +void drawSpriteRaw2(uint8 *spritePtr, uint8 transColor, int16 width, int16 height, uint8 *page, int16 x, int16 y); #endif diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index e7c1119444..72a4e2cc46 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -172,16 +172,14 @@ void mainLoop(int bootScriptIdx) { do { manageEvents(); - getMouseData(mouseUpdateStatus, &mouseButton, - &dummyU16, &dummyU16); + getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16); } while (mouseButton != 0); menuVar = 0; do { manageEvents(); - getMouseData(mouseUpdateStatus, &mouseButton, - &dummyU16, &dummyU16); + getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16); if (mouseButton == 0) { if (processKeyboard(menuVar)) { @@ -198,8 +196,7 @@ void mainLoop(int bootScriptIdx) { do { manageEvents(); - getMouseData(mouseUpdateStatus, &mouseButton, - &dummyU16, &dummyU16); + getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16); } while (mouseButton != 0); waitForPlayerClick = 0; diff --git a/engines/cine/msg.cpp b/engines/cine/msg.cpp index 2732ab09bb..52f18130b9 100644 --- a/engines/cine/msg.cpp +++ b/engines/cine/msg.cpp @@ -64,8 +64,7 @@ void loadMsg(char *pMsgName) { for (i = 0; i < msgVar0; i++) { if (messageTable[i].len) { - messageTable[i].ptr = - (uint8 *) malloc(messageTable[i].len); + messageTable[i].ptr = (uint8 *) malloc(messageTable[i].len); ASSERT_PTR(messageTable[i].ptr); diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp index 38ed864455..894ae600d2 100644 --- a/engines/cine/object.cpp +++ b/engines/cine/object.cpp @@ -100,10 +100,8 @@ int8 removeOverlayElement(uint16 objIdx, uint16 param) { currentHeadPtr = tempHead->next; - while (currentHeadPtr && (objIdx == currentHeadPtr->objIdx - || param == currentHeadPtr->type)) { + while (currentHeadPtr && (objIdx == currentHeadPtr->objIdx || param == currentHeadPtr->type)) { tempHead = currentHeadPtr; - currentHeadPtr = tempHead->next; } @@ -134,8 +132,7 @@ int16 freeOverlay(uint16 objIdx, uint16 param) { overlayHeadElement *tempHead = &overlayHead; overlayHeadElement *tempPtr2; - while (currentHeadPtr && ((currentHeadPtr->objIdx != objIdx) - || (currentHeadPtr->type != param))) { + while (currentHeadPtr && ((currentHeadPtr->objIdx != objIdx) || (currentHeadPtr->type != param))) { tempHead = currentHeadPtr; currentHeadPtr = tempHead->next; } @@ -144,8 +141,7 @@ int16 freeOverlay(uint16 objIdx, uint16 param) { return -1; } - if (!((currentHeadPtr->objIdx == objIdx) - && (currentHeadPtr->type == param))) { + if (!((currentHeadPtr->objIdx == objIdx) && (currentHeadPtr->type == param))) { return -1; } @@ -174,15 +170,12 @@ void loadOverlayElement(uint16 objIdx, uint16 param) { currentHeadPtr = tempHead->next; - while (currentHeadPtr - && (objectTable[currentHeadPtr->objIdx].mask < si)) { + while (currentHeadPtr && (objectTable[currentHeadPtr->objIdx].mask < si)) { tempHead = currentHeadPtr; - currentHeadPtr = tempHead->next; } - pNewElement = - (overlayHeadElement *) malloc(sizeof(overlayHeadElement)); + pNewElement = (overlayHeadElement *)malloc(sizeof(overlayHeadElement)); ASSERT_PTR(pNewElement); diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index 45c5bf9c04..6d207c72a0 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -105,8 +105,7 @@ void loadRelatedPalette(const char *fileName) { paletteIndex = findPaletteFromName(localName); if (paletteIndex == -1) { - for (i = 0; i < 16; i++) // generate default palette - { + for (i = 0; i < 16; i++) { // generate default palette paletteBuffer1[i] = paletteBuffer2[i] = (i << 4) + i; } } else { @@ -114,8 +113,7 @@ void loadRelatedPalette(const char *fileName) { ASSERT_PTR(paletteBuffer2); - for (i = 0; i < 16; i++) // convert palette - { + for (i = 0; i < 16; i++) { // convert palette paletteBuffer1[i] = palEntryPtr->pal1[i]; paletteBuffer2[i] = palEntryPtr->pal2[i]; } diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 5739eb42c4..f332089b57 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -37,7 +37,6 @@ void loadPart(const char *partName) { for (i = 0; i < 255; i++) { partBuffer[i].part_name[0] = 0; - partBuffer[i].offset = 0; partBuffer[i].packed_size = 0; partBuffer[i].unpacked_size = 0; @@ -191,7 +190,6 @@ void readFromPart(int16 idx, uint8 *dataPtr) { processPendingUpdates(1); partFileHandle.seek(partBuffer[idx].offset, SEEK_SET); - partFileHandle.read(dataPtr, partBuffer[idx].packed_size); } @@ -201,22 +199,17 @@ uint8 *readBundleFile(int16 foundFileIdx) { dataPtr = (uint8 *) malloc(partBuffer[foundFileIdx].unpacked_size + 2); memset(dataPtr, 0, partBuffer[foundFileIdx].unpacked_size + 2); - if (partBuffer[foundFileIdx].unpacked_size != - partBuffer[foundFileIdx].packed_size) { + if (partBuffer[foundFileIdx].unpacked_size != partBuffer[foundFileIdx].packed_size) { uint8 *unpackBuffer; uint16 realSize; - unpackBuffer = - (uint8 *) malloc(partBuffer[foundFileIdx].packed_size + 500); + unpackBuffer = (uint8 *)malloc(partBuffer[foundFileIdx].packed_size + 500); readFromPart(foundFileIdx, unpackBuffer); - realSize = - *(uint16 *) (unpackBuffer + - partBuffer[foundFileIdx].packed_size - 2); + realSize = *(uint16 *)(unpackBuffer + partBuffer[foundFileIdx].packed_size - 2); flipU16(&realSize); - decomp(unpackBuffer + partBuffer[foundFileIdx].packed_size - 4, - dataPtr + realSize, realSize); + decomp(unpackBuffer + partBuffer[foundFileIdx].packed_size - 4, dataPtr + realSize, realSize); free(unpackBuffer); } else { readFromPart(foundFileIdx, dataPtr); diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index e6930bb77c..a73f045898 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -93,15 +93,14 @@ void loadPrc(const char *pPrcName) { size = scriptTable[i].var4; if (size) { - scriptTable[i].ptr = (byte *) malloc(size); + scriptTable[i].ptr = (byte *)malloc(size); ASSERT_PTR(scriptTable[i].ptr); memcpy(scriptTable[i].ptr, readPtr, size); readPtr += size; - computeScriptStack(scriptTable[i].ptr, - scriptTable[i].stack, size); + computeScriptStack(scriptTable[i].ptr, scriptTable[i].stack, size); } } } else { @@ -136,8 +135,7 @@ void loadPrc(const char *pPrcName) { memcpy(scriptTable[i].ptr, ptr, size); ptr += size; - computeScriptStack(scriptTable[i].ptr, - scriptTable[i].stack, size); + computeScriptStack(scriptTable[i].ptr, scriptTable[i].stack, size); } } } diff --git a/engines/cine/rel.cpp b/engines/cine/rel.cpp index f0a7a81821..ed4ef67bbc 100644 --- a/engines/cine/rel.cpp +++ b/engines/cine/rel.cpp @@ -79,19 +79,19 @@ void loadRel(char *pRelName) { ASSERT(numEntry <= NUM_MAX_REL); for (i = 0; i < numEntry; i++) { - relTable[i].var4 = *(uint16 *) ptr; + relTable[i].var4 = *(uint16 *)ptr; ptr += 2; flipU16(&relTable[i].var4); - relTable[i].var6 = *(uint16 *) ptr; + relTable[i].var6 = *(uint16 *)ptr; ptr += 2; flipU16(&relTable[i].var6); - relTable[i].var8 = *(uint16 *) ptr; + relTable[i].var8 = *(uint16 *)ptr; ptr += 2; flipU16(&relTable[i].var8); - relTable[i].varA = *(uint16 *) ptr; + relTable[i].varA = *(uint16 *)ptr; ptr += 2; flipU16(&relTable[i].varA); } -- cgit v1.2.3