diff options
author | Max Horn | 2009-09-30 16:16:53 +0000 |
---|---|---|
committer | Max Horn | 2009-09-30 16:16:53 +0000 |
commit | 8ba75fc522f16844524dd4d6f88c3851e2402969 (patch) | |
tree | df25c20389e3e706d508f37914dedc73c6479f00 /engines/sword1 | |
parent | 25dde91c7c6c7da52636e3daa34bd9eee5d9dcb9 (diff) | |
download | scummvm-rg350-8ba75fc522f16844524dd4d6f88c3851e2402969.tar.gz scummvm-rg350-8ba75fc522f16844524dd4d6f88c3851e2402969.tar.bz2 scummvm-rg350-8ba75fc522f16844524dd4d6f88c3851e2402969.zip |
Fix code formatting (esp. 'if(' -> 'if (' etc., but also indention and other things)
svn-id: r44495
Diffstat (limited to 'engines/sword1')
-rw-r--r-- | engines/sword1/control.cpp | 4 | ||||
-rw-r--r-- | engines/sword1/logic.cpp | 3 | ||||
-rw-r--r-- | engines/sword1/mouse.cpp | 5 | ||||
-rw-r--r-- | engines/sword1/router.cpp | 34 | ||||
-rw-r--r-- | engines/sword1/screen.cpp | 26 | ||||
-rw-r--r-- | engines/sword1/text.cpp | 8 |
6 files changed, 39 insertions, 41 deletions
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index e5f3b9a04c..2134e7dc2d 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -1032,7 +1032,7 @@ void Control::renderText(const uint8 *str, uint16 x, uint16 y, uint8 mode) { dst[cntx] = sprData[cntx]; } - if(SwordEngine::isPsx()) { //On PSX version we need to double horizontal lines + if (SwordEngine::isPsx()) { //On PSX version we need to double horizontal lines dst += SCREEN_WIDTH; for (uint16 cntx = 0; cntx < _resMan->getUint16(chSpr->width); cntx++) if (sprData[cntx]) @@ -1074,7 +1074,7 @@ void Control::renderVolumeBar(uint8 id, uint8 volL, uint8 volR) { for (uint16 cnty = 0; cnty < barHeight; cnty++) { memcpy(destMem, srcMem, _resMan->getUint16(frHead->width)); - if(SwordEngine::isPsx()) { //linedoubling + if (SwordEngine::isPsx()) { //linedoubling destMem += SCREEN_WIDTH; memcpy(destMem, srcMem, _resMan->getUint16(frHead->width)); } diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index 26635c2708..f32c422540 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -23,7 +23,6 @@ * */ - #include "common/endian.h" #include "common/util.h" #include "common/system.h" @@ -114,7 +113,7 @@ void Logic::newScreen(uint32 screen) { } // work around, at screen 69 in psx version TOP menu gets stuck at disabled, fix it at next screen (71) - if( (screen == 71) && (SwordEngine::isPsx())) + if ((screen == 71) && (SwordEngine::isPsx())) _scriptVars[TOP_MENU_DISABLED] = 0; if (SwordEngine::_systemVars.justRestoredGame) { // if we've just restored a game - we want George to be exactly as saved diff --git a/engines/sword1/mouse.cpp b/engines/sword1/mouse.cpp index 020586d702..77e58f8116 100644 --- a/engines/sword1/mouse.cpp +++ b/engines/sword1/mouse.cpp @@ -23,7 +23,6 @@ * */ - #include "common/system.h" #include "graphics/cursorman.h" @@ -245,7 +244,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) { if (luggSrc[cntx]) dstData[cntx] = luggSrc[cntx]; - if(SwordEngine::isPsx()) { + if (SwordEngine::isPsx()) { dstData += resSizeX; for (uint32 cntx = 0; cntx < luggSizeX; cntx++) if (luggSrc[cntx]) @@ -267,7 +266,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) { if (srcData[cntx]) dstData[cntx] = srcData[cntx]; - if(SwordEngine::isPsx()) { + if (SwordEngine::isPsx()) { dstData +=resSizeX; for (uint32 cntx = 0; cntx < ptrSizeX; cntx++) if (srcData[cntx]) diff --git a/engines/sword1/router.cpp b/engines/sword1/router.cpp index df7640f80b..b8347abd32 100644 --- a/engines/sword1/router.cpp +++ b/engines/sword1/router.cpp @@ -705,7 +705,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { if (lastDir != currentDir) { // get the direction to turn turnDir = currentDir - lastDir; - if ( turnDir < 0) + if (turnDir < 0) turnDir += NO_DIRECTIONS; if (turnDir > 4) @@ -716,7 +716,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { // rotate to new walk direction // for george and nico put in a head turn at the start if ((megaId == GEORGE) || (megaId == NICO)) { - if ( turnDir < 0) { // new frames for turn frames 29oct95jps + if (turnDir < 0) { // new frames for turn frames 29oct95jps module = turnFramesLeft + lastDir; } else { module = turnFramesRight + lastDir; @@ -732,12 +732,12 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { // rotate till were facing new dir then go back 45 degrees while (lastDir != currentDir) { lastDir += turnDir; - if ( turnDir < 0) { // new frames for turn frames 29oct95jps - if ( lastDir < 0) + if (turnDir < 0) { // new frames for turn frames 29oct95jps + if (lastDir < 0) lastDir += NO_DIRECTIONS; module = turnFramesLeft + lastDir; } else { - if ( lastDir > 7) + if (lastDir > 7) lastDir -= NO_DIRECTIONS; module = turnFramesRight + lastDir; } @@ -926,7 +926,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { } else if (_targetDir != lastRealDir) { // rotate to _targetDir // rotate to target direction turnDir = _targetDir - lastRealDir; - if ( turnDir < 0) + if (turnDir < 0) turnDir += NO_DIRECTIONS; if (turnDir > 4) @@ -937,7 +937,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { // rotate to target direction // for george and nico put in a head turn at the start if ((megaId == GEORGE) || (megaId == NICO)) { - if ( turnDir < 0) { // new frames for turn frames 29oct95jps + if (turnDir < 0) { // new frames for turn frames 29oct95jps module = turnFramesLeft + lastDir; } else { module = turnFramesRight + lastDir; @@ -953,12 +953,12 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) { // rotate if we need to while (lastRealDir != _targetDir) { lastRealDir += turnDir; - if ( turnDir < 0) { // new frames for turn frames 29oct95jps - if ( lastRealDir < 0) + if (turnDir < 0) { // new frames for turn frames 29oct95jps + if (lastRealDir < 0) lastRealDir += NO_DIRECTIONS; module = turnFramesLeft + lastRealDir; } else { - if ( lastRealDir > 7) + if (lastRealDir > 7) lastRealDir -= NO_DIRECTIONS; module = turnFramesRight + lastRealDir; } @@ -1123,7 +1123,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) { if (lastDir != currentDir) { // get the direction to turn turnDir = currentDir - lastDir; - if ( turnDir < 0) + if (turnDir < 0) turnDir += NO_DIRECTIONS; if (turnDir > 4) @@ -1134,7 +1134,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) { // rotate to new walk direction // for george and nico put in a head turn at the start if ((megaId == GEORGE) || (megaId == NICO)) { - if ( turnDir < 0) { // new frames for turn frames 29oct95jps + if (turnDir < 0) { // new frames for turn frames 29oct95jps module = turnFramesLeft + lastDir; } else { module = turnFramesRight + lastDir; @@ -1150,12 +1150,12 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) { // rotate till were facing new dir then go back 45 degrees while (lastDir != currentDir) { lastDir += turnDir; - if ( turnDir < 0) { // new frames for turn frames 29oct95jps - if ( lastDir < 0) + if (turnDir < 0) { // new frames for turn frames 29oct95jps + if (lastDir < 0) lastDir += NO_DIRECTIONS; module = turnFramesLeft + lastDir; } else { - if ( lastDir > 7) + if (lastDir > 7) lastDir -= NO_DIRECTIONS; module = turnFramesRight + lastDir; } @@ -2125,9 +2125,9 @@ int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) { int signY = (deltaY > 0); int slope; - if ( (ABS(deltaY) * DIAGONALX ) < (ABS(deltaX) * DIAGONALY / 2)) + if ((ABS(deltaY) * DIAGONALX ) < (ABS(deltaX) * DIAGONALY / 2)) slope = 0;// its flat - else if ( (ABS(deltaY) * DIAGONALX / 2) > (ABS(deltaX) * DIAGONALY ) ) + else if ((ABS(deltaY) * DIAGONALX / 2) > (ABS(deltaX) * DIAGONALY ) ) slope = 2;// its vertical else slope = 1;// its diagonal diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp index e6193e4137..bef715199c 100644 --- a/engines/sword1/screen.cpp +++ b/engines/sword1/screen.cpp @@ -373,7 +373,7 @@ void Screen::draw(void) { uint8 *src = _layerBlocks[0]; uint8 *dest = _screenBuf; - if(SwordEngine::isPsx()) { + if (SwordEngine::isPsx()) { if (!_psxCache.decodedBackground) _psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY); memcpy(_screenBuf, _psxCache.decodedBackground, _scrnSizeX * _scrnSizeY); @@ -398,7 +398,7 @@ void Screen::draw(void) { } else if (!(SwordEngine::isPsx())) { memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY); } else { //We are using PSX version - if(_currentScreen == 45 || _currentScreen == 55 || + if (_currentScreen == 45 || _currentScreen == 55 || _currentScreen == 57 || _currentScreen == 63 || _currentScreen == 71) { // Width shrinked backgrounds if (!_psxCache.decodedBackground) _psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY); @@ -426,7 +426,7 @@ void Screen::draw(void) { renderParallax(_parallax[1]); // PSX version has parallax layer for this room in an external file (TRAIN.PLX) - if(SwordEngine::isPsx() && _currentScreen == 63) { + if (SwordEngine::isPsx() && _currentScreen == 63) { // FIXME: this should be handled in a cleaner way... if (!_psxCache.extPlxCache) { Common::File parallax; @@ -493,7 +493,7 @@ void Screen::processImage(uint32 id) { uint16 sprSizeX, sprSizeY; if (compact->o_status & STAT_SHRINK) { memset(_shrinkBuffer, 0, SHRINK_BUFFER_SIZE); //Clean shrink buffer to avoid corruption - if( SwordEngine::isPsx() && (compact->o_resource != GEORGE_MEGA)) { //PSX Height shrinked sprites + if (SwordEngine::isPsx() && (compact->o_resource != GEORGE_MEGA)) { //PSX Height shrinked sprites sprSizeX = (scale * _resMan->readUint16(&frameHead->width)) / 256; sprSizeY = (scale * (_resMan->readUint16(&frameHead->height))) / 256 / 2; fastShrink(sprData, _resMan->readUint16(&frameHead->width), (_resMan->readUint16(&frameHead->height)) / 2, scale, _shrinkBuffer); @@ -509,7 +509,7 @@ void Screen::processImage(uint32 id) { sprData = _shrinkBuffer; } else { sprSizeX = _resMan->readUint16(&frameHead->width); - if(SwordEngine::isPsx()) { //PSX sprites are half height + if (SwordEngine::isPsx()) { //PSX sprites are half height sprSizeY = _resMan->readUint16(&frameHead->height) / 2; } else sprSizeY = (_resMan->readUint16(&frameHead->height)); @@ -537,7 +537,7 @@ void Screen::processImage(uint32 id) { spriteClipAndSet(&spriteX, &spriteY, &sprSizeX, &sprSizeY, &incr); if ((sprSizeX > 0) && (sprSizeY > 0)) { - if( (!(SwordEngine::isPsx()) || (compact->o_type == TYPE_TEXT) + if ((!(SwordEngine::isPsx()) || (compact->o_type == TYPE_TEXT) || (compact->o_resource == LVSFLY) || (!(compact->o_resource == GEORGE_MEGA) && (sprSizeX < 260)))) drawSprite(sprData + incr, spriteX, spriteY, sprSizeX, sprSizeY, sprPitch); else if (((sprSizeX >= 260) && (sprSizeX < 450)) || ((compact->o_resource == GMWRITH) && (sprSizeX < 515)) // a psx shrinked sprite (1/2 width) @@ -666,7 +666,7 @@ void Screen::renderParallax(uint8 *data) { } else paraScrlY = 0; - if(SwordEngine::isPsx()) + if (SwordEngine::isPsx()) drawPsxParallax(data, paraScrlX, scrnScrlX, scrnWidth); else for (uint16 cnty = 0; cnty < scrnHeight; cnty++) { @@ -867,7 +867,7 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint for (uint32 currentTile = 0; currentTile < totTiles; currentTile++) { uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile); - if(isCompressed) + if (isCompressed) decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile else memcpy(decomp_tile, psxBackground + tileOffset - 4, 16*16); @@ -911,7 +911,7 @@ uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXr for (currentTile = 0; currentTile < totTiles; currentTile++) { uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile); - if(isCompressed) + if (isCompressed) decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile else memcpy(decomp_tile, psxBackground + tileOffset - 4, 16 * 16); @@ -949,7 +949,7 @@ uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXr for (; currentTile < totTiles + remainingTiles; currentTile++) { uint32 tileOffset = READ_LE_UINT32(psxBackground + 4 * currentTile); - if(isCompressed) + if (isCompressed) decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile else memcpy(decomp_tile, psxBackground + tileOffset - 4, 256); @@ -1101,7 +1101,7 @@ void Screen::decompressHIF(uint8 *src, uint8 *dest) { if (info_word == 0xFFFF) return; //Got 0xFFFF code, finished. int32 repeat_count = (info_word >> 12) + 2; //How many time data needs to be refetched - while(repeat_count >= 0) { + while (repeat_count >= 0) { uint8 *old_data_src = dest - ((info_word & 0xFFF) + 1); *dest++ = *old_data_src; repeat_count--; @@ -1187,7 +1187,7 @@ void Screen::spriteClipAndSet(uint16 *pSprX, uint16 *pSprY, uint16 *pSprWidth, u uint16 gridH = (*pSprHeight + (sprY & (SCRNGRID_Y - 1)) + (SCRNGRID_Y - 1)) / SCRNGRID_Y; uint16 gridW = (*pSprWidth + (sprX & (SCRNGRID_X - 1)) + (SCRNGRID_X - 1)) / SCRNGRID_X; - if(SwordEngine::isPsx()) { + if (SwordEngine::isPsx()) { gridH *= 2; // This will correct the PSX sprite being cut at half height gridW *= 2; // and masking problems when sprites are stretched in width @@ -1225,7 +1225,7 @@ void Screen::showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, const b uint8 frame[40 * 40]; int i, j; - if(SwordEngine::isPsx()) + if (SwordEngine::isPsx()) memset(frame, 0, sizeof(frame)); // PSX top menu is black else memset(frame, 199, sizeof(frame)); // Dark gray background diff --git a/engines/sword1/text.cpp b/engines/sword1/text.cpp index 0c78798a49..d71b5027b8 100644 --- a/engines/sword1/text.cpp +++ b/engines/sword1/text.cpp @@ -106,7 +106,7 @@ void Text::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 pen) { for (uint16 pos = 0; pos < lines[lineCnt].length; pos++) sprPtr += copyChar(*text++, sprPtr, sprWidth, pen) - OVERLAP; text++; // skip space at the end of the line - if(SwordEngine::isPsx()) //Chars are half height in psx version + if (SwordEngine::isPsx()) //Chars are half height in psx version linePtr += (_charHeight / 2) * sprWidth; else linePtr += _charHeight * sprWidth; @@ -136,7 +136,7 @@ uint16 Text::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line) { text++; wordWidth += OVERLAP; // no overlap on final letter of word! - if ( firstWord ) { // first word on first line, so no separating SPACE needed + if (firstWord) { // first word on first line, so no separating SPACE needed line[0].width = wordWidth; line[0].length = wordLength; firstWord = false; @@ -167,9 +167,9 @@ uint16 Text::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen) { uint8 *decChr; uint16 frameHeight = 0; - if(SwordEngine::isPsx()) { + if (SwordEngine::isPsx()) { frameHeight = _resMan->getUint16(chFrame->height)/2; - if(_fontId == CZECH_GAME_FONT) { //Czech game fonts are compressed + if (_fontId == CZECH_GAME_FONT) { //Czech game fonts are compressed decBuf = (uint8*) malloc((_resMan->getUint16(chFrame->width))*(_resMan->getUint16(chFrame->height)/2)); Screen::decompressHIF(chData, decBuf); decChr = decBuf; |