diff options
90 files changed, 700 insertions, 715 deletions
diff --git a/backends/fs/abstract-fs.cpp b/backends/fs/abstract-fs.cpp index aa341e70d9..f110e862b7 100644 --- a/backends/fs/abstract-fs.cpp +++ b/backends/fs/abstract-fs.cpp @@ -26,7 +26,7 @@  const char *AbstractFSNode::lastPathComponent(const Common::String &str, const char sep) {  	// TODO: Get rid of this eventually! Use Common::lastPathComponent instead -	if(str.empty()) +	if (str.empty())  		return "";  	const char *start = str.c_str(); diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 183558409e..9eababe60b 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -179,8 +179,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const Common::String &p) {  			const char c = _sPath.lastChar();  			if (c != '/' && c != ':')  				_sPath += '/'; -		} -		else { +		} else {  			//_bIsDirectory = false;  			_bIsValid = true;  		} @@ -231,15 +230,13 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayNam  			const char c = _sPath.lastChar();  			if (c != '/' && c != ':')  				_sPath += '/'; -		} -		else { +		} else {  			//_bIsDirectory = false;  			_bIsValid = true;  		}          IDOS->FreeDosObject(DOS_EXAMINEDATA, pExd); -	} -	else { +	} else {  		debug(6, "ExamineObject() returned NULL");      } @@ -268,7 +265,7 @@ AmigaOSFilesystemNode::~AmigaOSFilesystemNode() {  bool AmigaOSFilesystemNode::exists() const {  	ENTER(); -	if(_sPath.empty()) +	if (_sPath.empty())  		return false;  	bool nodeExists = false; @@ -352,16 +349,16 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b  		struct ExamineData * pExd = NULL; // NB: no need to free value after usage, all is dealt by the DirContext release  		AmigaOSFilesystemNode *entry ; -		while( (pExd = IDOS->ExamineDir(context)) ) { -			if(     (EXD_IS_FILE(pExd) && ( Common::FSNode::kListFilesOnly == mode )) +		while ( (pExd = IDOS->ExamineDir(context)) ) { +			if (     (EXD_IS_FILE(pExd) && ( Common::FSNode::kListFilesOnly == mode ))  				||  (EXD_IS_DIRECTORY(pExd) && ( Common::FSNode::kListDirectoriesOnly == mode ))  				||  Common::FSNode::kListAll == mode  				)  			{  				BPTR pLock = IDOS->Lock( pExd->Name, SHARED_LOCK ); -				if( pLock ) { +				if (pLock) {  					entry = new AmigaOSFilesystemNode( pLock, pExd->Name ); -					if( entry ) { +					if (entry) {  						myList.push_back(entry);  					} @@ -369,18 +366,17 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b  				}  			}  		} -		if( ERROR_NO_MORE_ENTRIES != IDOS->IoErr() ) { + +		if (ERROR_NO_MORE_ENTRIES != IDOS->IoErr() ) {  			debug(6, "An error occured during ExamineDir");  			ret = false; -		} -		else { +		} else {  			ret = true;  		}  		IDOS->ReleaseDirContext(context); -	} -	else { +	} else {  		debug(6, "Unable to ObtainDirContext");  		ret = false;  	} @@ -411,8 +407,7 @@ AbstractFSNode *AmigaOSFilesystemNode::getParent() const {  	if (parentDir) {  		node = new AmigaOSFilesystemNode(parentDir);  		IDOS->UnLock(parentDir); -	} -	else +	} else  		node = new AmigaOSFilesystemNode();  	LEAVE(); diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp index 0c53020d94..75a91e5802 100644 --- a/backends/fs/psp/psp-fs.cpp +++ b/backends/fs/psp/psp-fs.cpp @@ -96,7 +96,7 @@ PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {  	if (verify) {  		struct stat st; -		if(PowerMan.beginCriticalSection()==PowerManager::Blocked) +		if (PowerMan.beginCriticalSection()==PowerManager::Blocked)  			PSPDebugSuspend("Suspended in PSPFilesystemNode::PSPFilesystemNode\n");  		_isValid = (0 == stat(_path.c_str(), &st));  		PowerMan.endCriticalSection(); diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index 2fa5d7b142..5d4951e269 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -66,9 +66,9 @@ public:  		TPtrC8 ptr((const unsigned char*) _path.c_str(), _path.size());  		fname.Copy(ptr);  		TBool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian*> (g_system)->FsSession(), fname); -		if(!fileExists) { +		if (!fileExists) {  			TParsePtrC parser(fname); -			if(parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) { +			if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent()) {  				fileExists = ETrue;  			}  		} @@ -137,7 +137,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) {  		_isValid = ETrue;  		_isDirectory = EFalse;  		TParsePtrC parser(fname); -		if(parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent())  { +		if (parser.PathPresent() && parser.Path().Compare(_L("\\")) == KErrNone && !parser.NameOrExtPresent())  {  			_isDirectory = ETrue;  		}  	} diff --git a/backends/fs/symbian/symbianstream.cpp b/backends/fs/symbian/symbianstream.cpp index 650bbd0dcd..c926cc65f8 100644 --- a/backends/fs/symbian/symbianstream.cpp +++ b/backends/fs/symbian/symbianstream.cpp @@ -71,7 +71,7 @@ TSymbianFileEntry*	CreateSymbianFileEntry(const char* name, const char* mode) {  		fileMode = fileMode| EFileShareAny; -		switch(mode[0]) { +		switch (mode[0]) {  		case 'a':  			if (fileEntry->_fileHandle.Open(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) {  				if (fileEntry->_fileHandle.Create(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), tempFileName, fileMode) != KErrNone) { @@ -160,7 +160,7 @@ size_t ReadData(const void* ptr, size_t size, size_t numItems, TSymbianFileEntry  		}  	} -	if((numItems * size) != pointer.Length() && entry->_lastError == KErrNone) { +	if ((numItems * size) != pointer.Length() && entry->_lastError == KErrNone) {  		entry->_eofReached = ETrue;  	} diff --git a/backends/platform/PalmOS/Src/base_event.cpp b/backends/platform/PalmOS/Src/base_event.cpp index 81eeb4e79c..ae93514e34 100644 --- a/backends/platform/PalmOS/Src/base_event.cpp +++ b/backends/platform/PalmOS/Src/base_event.cpp @@ -324,7 +324,7 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {  			if (SysHandleEvent(&ev))  				continue; -		switch(ev.eType) { +		switch (ev.eType) {  		case penMoveEvent:  			get_coordinates(&ev, x, y); diff --git a/backends/platform/PalmOS/Src/base_gfx.cpp b/backends/platform/PalmOS/Src/base_gfx.cpp index 73a98909d6..2d2904bdec 100644 --- a/backends/platform/PalmOS/Src/base_gfx.cpp +++ b/backends/platform/PalmOS/Src/base_gfx.cpp @@ -53,7 +53,7 @@ int OSystem_PalmBase::getGraphicsMode() const {  }  bool OSystem_PalmBase::setGraphicsMode(int mode) { -	switch(mode) { +	switch (mode) {  	case GFX_NORMAL:  	case GFX_WIDE:  		_setMode = mode; diff --git a/backends/platform/gp2x/events.cpp b/backends/platform/gp2x/events.cpp index bc9a4ff26c..e0117e9313 100644 --- a/backends/platform/gp2x/events.cpp +++ b/backends/platform/gp2x/events.cpp @@ -282,7 +282,7 @@ bool OSystem_GP2X::pollEvent(Common::Event &event) {  	while (SDL_PollEvent(&ev)) { -		switch(ev.type) { +		switch (ev.type) {  		case SDL_KEYDOWN:{  			b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); diff --git a/backends/platform/gp2x/graphics.cpp b/backends/platform/gp2x/graphics.cpp index cf874323e0..27732007bc 100644 --- a/backends/platform/gp2x/graphics.cpp +++ b/backends/platform/gp2x/graphics.cpp @@ -179,7 +179,7 @@ bool OSystem_GP2X::setGraphicsMode(int mode) {  	int newScaleFactor = 1; -	switch(mode) { +	switch (mode) {  	case GFX_NORMAL:  		newScaleFactor = 1;  		break; diff --git a/backends/platform/gp2xwiz/gp2xwiz-events.cpp b/backends/platform/gp2xwiz/gp2xwiz-events.cpp index 48c9af00ff..2774efce1b 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-events.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-events.cpp @@ -81,13 +81,13 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {  }  void OSystem_GP2XWIZ::fillMouseEvent(Common::Event &event, int x, int y) { -    if(_videoMode.mode == GFX_HALF && !_overlayVisible){ -	    event.mouse.x = x*2; -	    event.mouse.y = y*2; -    } else { -        event.mouse.x = x; -	    event.mouse.y = y; -    } +	if (_videoMode.mode == GFX_HALF && !_overlayVisible){ +		event.mouse.x = x*2; +		event.mouse.y = y*2; +	} else { +		event.mouse.x = x; +		event.mouse.y = y; +	}  	// Update the "keyboard mouse" coords  	_km.x = x; @@ -216,7 +216,7 @@ bool OSystem_GP2XWIZ::pollEvent(Common::Event &event) {  	while (SDL_PollEvent(&ev)) { -		switch(ev.type) { +		switch (ev.type) {  		case SDL_KEYDOWN:{  			b = event.kbd.flags = SDLModToOSystemKeyFlags(SDL_GetModState()); diff --git a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp index 90f2c821aa..ad4b0fc6ef 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp @@ -58,13 +58,13 @@ bool OSystem_GP2XWIZ::setGraphicsMode(int mode) {  	int newScaleFactor = 1; -	switch(mode) { +	switch (mode) {  	case GFX_NORMAL:  		newScaleFactor = 1;  		break; -    case GFX_HALF: -        newScaleFactor = 1; -        break; +	case GFX_HALF: +		newScaleFactor = 1; +		break;  	default:  		warning("unknown gfx mode %d", mode);  		return false; @@ -90,9 +90,9 @@ void OSystem_GP2XWIZ::setGraphicsModeIntern() {  	case GFX_NORMAL:  		newScalerProc = Normal1x;  		break; -    case GFX_HALF: -        newScalerProc = HalfScale; -        break; +	case GFX_HALF: +		newScalerProc = HalfScale; +		break;  	default:  		error("Unknown gfx mode %d", _videoMode.mode); @@ -113,19 +113,19 @@ void OSystem_GP2XWIZ::setGraphicsModeIntern() {  void OSystem_GP2XWIZ::initSize(uint w, uint h) { -    assert(_transactionMode == kTransactionActive); +	assert(_transactionMode == kTransactionActive);  	// Avoid redundant res changes  	if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)  		return; -    _videoMode.screenWidth = w; +	_videoMode.screenWidth = w;  	_videoMode.screenHeight = h; -    if(w > 320 || h > 240){ -        setGraphicsMode(GFX_HALF); -        setGraphicsModeIntern(); -        toggleMouseGrab(); -    } +	if (w > 320 || h > 240){ +		setGraphicsMode(GFX_HALF); +		setGraphicsModeIntern(); +		toggleMouseGrab(); +	}  	_cksumNum = (w * h / (8 * 8)); @@ -157,13 +157,13 @@ void OSystem_GP2XWIZ::drawMouse() {  	int width, height;  	int hotX, hotY; -    if(_videoMode.mode == GFX_HALF && !_overlayVisible){ -	    dst.x = _mouseCurState.x/2; -	    dst.y = _mouseCurState.y/2; -    } else { -        dst.x = _mouseCurState.x; -	    dst.y = _mouseCurState.y; -    } +	if (_videoMode.mode == GFX_HALF && !_overlayVisible){ +		dst.x = _mouseCurState.x/2; +		dst.y = _mouseCurState.y/2; +	} else { +		dst.x = _mouseCurState.x; +		dst.y = _mouseCurState.y; +	}  	if (!_overlayVisible) {  		scale = _videoMode.scaleFactor; @@ -214,7 +214,7 @@ void OSystem_GP2XWIZ::drawMouse() {  	// The screen will be updated using real surface coordinates, i.e.  	// they will not be scaled or aspect-ratio corrected. -    addDirtyRect(dst.x, dst.y, dst.w, dst.h, true); +	addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);  }  void OSystem_GP2XWIZ::undrawMouse() { @@ -227,12 +227,12 @@ void OSystem_GP2XWIZ::undrawMouse() {  		return;  	if (_mouseBackup.w != 0 && _mouseBackup.h != 0){ -        if(_videoMode.mode == GFX_HALF && !_overlayVisible){ -		    addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); -        } else { -            addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); -        } -    } +		if (_videoMode.mode == GFX_HALF && !_overlayVisible){ +			addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); +		} else { +			addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); +		} +	}  }  void OSystem_GP2XWIZ::internUpdateScreen() { @@ -348,11 +348,11 @@ void OSystem_GP2XWIZ::internUpdateScreen() {  		for (r = _dirtyRectList; r != lastRect; ++r) {  			register int dst_y = r->y + _currentShakePos;  			register int dst_h = 0; -            register int dst_w = r->w; +			register int dst_w = r->w;  			register int orig_dst_y = 0;  			register int dst_x = r->x; -            register int src_y; -            register int src_x; +			register int src_y; +			register int src_x;  			if (dst_y < height) {  				dst_h = r->h; @@ -360,42 +360,42 @@ void OSystem_GP2XWIZ::internUpdateScreen() {  					dst_h = height - dst_y;  				orig_dst_y = dst_y; -                src_x = dst_x; -                src_y = dst_y; +				src_x = dst_x; +				src_y = dst_y;  				if (_videoMode.aspectRatioCorrection && !_overlayVisible)  					dst_y = real2Aspect(dst_y);  				assert(scalerProc != NULL); -                if(_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ -                    if(dst_x%2==1){ -                        dst_x--; -                        dst_w++; -                    } -                    if(dst_y%2==1){ -                        dst_y--; -                        dst_h++; -                    } -                    src_x = dst_x; -                    src_y = dst_y; -                    dst_x = dst_x / 2; -                    dst_y = dst_y / 2; -                } -                scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch, +				if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ +					if (dst_x%2==1){ +						dst_x--; +						dst_w++; +					} +					if (dst_y%2==1){ +						dst_y--; +						dst_h++; +					} +					src_x = dst_x; +					src_y = dst_y; +					dst_x = dst_x / 2; +					dst_y = dst_y / 2; +				} +				scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch,  						   (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);  			} -            if(_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ -			    r->w = r->w / 2; -			    r->h = dst_h / 2; -            } else { -			    r->w = r->w; -			    r->h = dst_h; -            } +			if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale){ +				r->w = r->w / 2; +				r->h = dst_h / 2; +			} else { +				r->w = r->w; +				r->h = dst_h; +			} -		    r->x = dst_x; -		    r->y = dst_y; +			r->x = dst_x; +			r->y = dst_y;  #ifndef DISABLE_SCALERS @@ -430,27 +430,27 @@ void OSystem_GP2XWIZ::internUpdateScreen() {  }  void OSystem_GP2XWIZ::showOverlay() { -    if(_videoMode.mode == GFX_HALF){ -        _mouseCurState.x = _mouseCurState.x / 2; -        _mouseCurState.y = _mouseCurState.y / 2; -    } +	if (_videoMode.mode == GFX_HALF){ +		_mouseCurState.x = _mouseCurState.x / 2; +		_mouseCurState.y = _mouseCurState.y / 2; +	}  	OSystem_SDL::showOverlay();  }  void OSystem_GP2XWIZ::hideOverlay() { -    if(_videoMode.mode == GFX_HALF){ -        _mouseCurState.x = _mouseCurState.x * 2; -        _mouseCurState.y = _mouseCurState.y * 2; -    } +	if (_videoMode.mode == GFX_HALF){ +		_mouseCurState.x = _mouseCurState.x * 2; +		_mouseCurState.y = _mouseCurState.y * 2; +	}  	OSystem_SDL::hideOverlay();  }  void OSystem_GP2XWIZ::warpMouse(int x, int y) {  	if (_mouseCurState.x != x || _mouseCurState.y != y) { -        if(_videoMode.mode == GFX_HALF && !_overlayVisible){ -            x = x / 2; -            y = y / 2; -        } +		if (_videoMode.mode == GFX_HALF && !_overlayVisible){ +			x = x / 2; +			y = y / 2; +		}  	}  	OSystem_SDL::warpMouse(x, y);  } diff --git a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp index 4a86443aa7..bc1aa00ce4 100644 --- a/backends/platform/gp2xwiz/gp2xwiz-hw.cpp +++ b/backends/platform/gp2xwiz/gp2xwiz-hw.cpp @@ -65,8 +65,8 @@ void mixerMoveVolume(int direction) {          if (direction == VOLUME_UP)   volumeLevel += VOLUME_CHANGE_RATE/2;          if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE/2;      } else { -        if(direction == VOLUME_UP)   volumeLevel += VOLUME_CHANGE_RATE; -        if(direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE; +        if (direction == VOLUME_UP)   volumeLevel += VOLUME_CHANGE_RATE; +        if (direction == VOLUME_DOWN) volumeLevel -= VOLUME_CHANGE_RATE;      }      if (volumeLevel < VOLUME_MIN) volumeLevel = VOLUME_MIN; @@ -74,7 +74,7 @@ void mixerMoveVolume(int direction) {      unsigned long soundDev = open("/dev/mixer", O_RDWR); -    if(soundDev) { +    if (soundDev) {          int vol = ((volumeLevel << 8) | volumeLevel);          ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);          close(soundDev); diff --git a/backends/platform/iphone/iphone_video.m b/backends/platform/iphone/iphone_video.m index ef55a655c0..33585bdacb 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -352,7 +352,7 @@ uint getSizeNextPOT(uint size) {  - (void)addEvent:(NSDictionary*)event { -	if(_events == nil) +	if (_events == nil)  		_events = [[NSMutableArray alloc] init];  	[_events addObject: event]; diff --git a/backends/platform/linuxmoto/linuxmoto-events.cpp b/backends/platform/linuxmoto/linuxmoto-events.cpp index aa71fe8be3..50daa12d5b 100644 --- a/backends/platform/linuxmoto/linuxmoto-events.cpp +++ b/backends/platform/linuxmoto/linuxmoto-events.cpp @@ -44,13 +44,13 @@ static int mapKey(SDLKey key, SDLMod mod, Uint16 unicode) {  }  void OSystem_LINUXMOTO::fillMouseEvent(Common::Event &event, int x, int y) { -    if(_videoMode.mode == GFX_HALF && !_overlayVisible) { -	    event.mouse.x = x*2; -	    event.mouse.y = y*2; -    } else { -        event.mouse.x = x; -	    event.mouse.y = y; -    } +	if (_videoMode.mode == GFX_HALF && !_overlayVisible) { +		event.mouse.x = x*2; +		event.mouse.y = y*2; +	} else { +		event.mouse.x = x; +		event.mouse.y = y; +	}  	// Update the "keyboard mouse" coords  	_km.x = x; @@ -82,7 +82,7 @@ bool OSystem_LINUXMOTO::remapKey(SDL_Event &ev, Common::Event &event) {  		ev.key.keysym.sym = SDLK_F5;  	}  	// VirtualKeyboard - Camera key - 	else if (ev.key.keysym.sym == SDLK_PAUSE) { +	else if (ev.key.keysym.sym == SDLK_PAUSE) {  		ev.key.keysym.sym = SDLK_F7;  	}  	// Enter - mod+fire key diff --git a/backends/platform/linuxmoto/linuxmoto-graphics.cpp b/backends/platform/linuxmoto/linuxmoto-graphics.cpp index e74cb8dbf3..592d991a7f 100644 --- a/backends/platform/linuxmoto/linuxmoto-graphics.cpp +++ b/backends/platform/linuxmoto/linuxmoto-graphics.cpp @@ -58,13 +58,13 @@ bool OSystem_LINUXMOTO::setGraphicsMode(int mode) {  	int newScaleFactor = 1; -	switch(mode) { +	switch (mode) {  	case GFX_NORMAL: -	    newScaleFactor = 1; -	  break; +		newScaleFactor = 1; +		break;  	case GFX_HALF: -	    newScaleFactor = 1; -	  break; +		newScaleFactor = 1; +		break;  	default:  		warning("unknown gfx mode %d", mode);  		return false; @@ -113,20 +113,20 @@ void OSystem_LINUXMOTO::setGraphicsModeIntern() {  void OSystem_LINUXMOTO::initSize(uint w, uint h) { -    assert(_transactionMode == kTransactionActive); +	assert(_transactionMode == kTransactionActive);  	// Avoid redundant res changes  	if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)  		return; -    _videoMode.screenWidth = w; -    _videoMode.screenHeight = h; +	_videoMode.screenWidth = w; +	_videoMode.screenHeight = h; -    if	(w > 320 || h > 240) { -        setGraphicsMode(GFX_HALF); -        setGraphicsModeIntern(); -        toggleMouseGrab(); -    } +	if	(w > 320 || h > 240) { +		setGraphicsMode(GFX_HALF); +		setGraphicsModeIntern(); +		toggleMouseGrab(); +	}  	_cksumNum = (w * h / (8 * 8)); @@ -137,30 +137,30 @@ void OSystem_LINUXMOTO::initSize(uint w, uint h) {  }  bool OSystem_LINUXMOTO::loadGFXMode() { -    printf("Game ScreenMode = %d*%d\n",_videoMode.screenWidth, _videoMode.screenHeight); -    if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { -	  _videoMode.aspectRatioCorrection = false; -	  setGraphicsMode(GFX_HALF); -	  printf("GraphicsMode set to HALF\n"); +	printf("Game ScreenMode = %d*%d\n",_videoMode.screenWidth, _videoMode.screenHeight); +	if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) { +		_videoMode.aspectRatioCorrection = false; +		setGraphicsMode(GFX_HALF); +		printf("GraphicsMode set to HALF\n"); +	} else { +		setGraphicsMode(GFX_NORMAL); +		printf("GraphicsMode set to NORMAL\n"); +	} +	if (_videoMode.mode == GFX_HALF && !_overlayVisible) { +		_videoMode.overlayWidth = 320; +		_videoMode.overlayHeight = 240; +		_videoMode.fullscreen = true;  	} else { -	  setGraphicsMode(GFX_NORMAL); -	  printf("GraphicsMode set to NORMAL\n"); -    } -    if (_videoMode.mode == GFX_HALF && !_overlayVisible) { -	_videoMode.overlayWidth = 320; -	_videoMode.overlayHeight = 240; -	_videoMode.fullscreen = true; -    } else { -	_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; -	_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; +		_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; +		_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; -	if (_videoMode.aspectRatioCorrection) -		_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); +		if (_videoMode.aspectRatioCorrection) +			_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); -	_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; -	_videoMode.hardwareHeight = effectiveScreenHeight(); -    } +		_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; +		_videoMode.hardwareHeight = effectiveScreenHeight(); +	}  	return OSystem_SDL::loadGFXMode();  } @@ -176,13 +176,13 @@ void OSystem_LINUXMOTO::drawMouse() {  	int width, height;  	int hotX, hotY; -    if (_videoMode.mode == GFX_HALF && !_overlayVisible) { -	    dst.x = _mouseCurState.x/2; -	    dst.y = _mouseCurState.y/2; -    } else { -	    dst.x = _mouseCurState.x; -	    dst.y = _mouseCurState.y; -    } +	if (_videoMode.mode == GFX_HALF && !_overlayVisible) { +		dst.x = _mouseCurState.x/2; +		dst.y = _mouseCurState.y/2; +	} else { +		dst.x = _mouseCurState.x; +		dst.y = _mouseCurState.y; +	}  	if (!_overlayVisible) {  		scale = _videoMode.scaleFactor; @@ -192,7 +192,6 @@ void OSystem_LINUXMOTO::drawMouse() {  		dst.h = _mouseCurState.vH;  		hotX = _mouseCurState.vHotX;  		hotY = _mouseCurState.vHotY; -  	} else {  		scale = 1;  		width = _videoMode.overlayWidth; @@ -201,7 +200,6 @@ void OSystem_LINUXMOTO::drawMouse() {  		dst.h = _mouseCurState.rH;  		hotX = _mouseCurState.rHotX;  		hotY = _mouseCurState.rHotY; -  	}  	// The mouse is undrawn using virtual coordinates, i.e. they may be @@ -235,7 +233,7 @@ void OSystem_LINUXMOTO::drawMouse() {  	// The screen will be updated using real surface coordinates, i.e.  	// they will not be scaled or aspect-ratio corrected. -    addDirtyRect(dst.x, dst.y, dst.w, dst.h, true); +	addDirtyRect(dst.x, dst.y, dst.w, dst.h, true);  }  void OSystem_LINUXMOTO::undrawMouse() { @@ -247,13 +245,13 @@ void OSystem_LINUXMOTO::undrawMouse() {  	if (!_overlayVisible && (x >= _videoMode.screenWidth || y >= _videoMode.screenHeight))  		return; -	if (_mouseBackup.w != 0 && _mouseBackup.h != 0){ -        if (_videoMode.mode == GFX_HALF && !_overlayVisible) { -		    addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); -        } else { -            addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); -        } -    } +	if (_mouseBackup.w != 0 && _mouseBackup.h != 0) { +		if (_videoMode.mode == GFX_HALF && !_overlayVisible) { +			addDirtyRect(x*2, y*2, _mouseBackup.w*2, _mouseBackup.h*2); +		} else { +			addDirtyRect(x, y, _mouseBackup.w, _mouseBackup.h); +		} +	}  }  void OSystem_LINUXMOTO::internUpdateScreen() { @@ -388,43 +386,41 @@ void OSystem_LINUXMOTO::internUpdateScreen() {  				assert(scalerProc != NULL); -                if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) { - -                    if (dst_x%2==1) { -                        dst_x--; -                        dst_w++; -                    } -                    if (dst_y%2==1) { -                        dst_y--; -                        dst_h++; -                    } - -		    if (dst_w&1) -			dst_w++; -		    if (dst_h&1) -			dst_h++; - -                    src_x = dst_x; -                    src_y = dst_y; -                    dst_x = dst_x / 2; -                    dst_y = dst_y / 2; -                } -                scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch, +				if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) { + +					if (dst_x%2==1) { +						dst_x--; +						dst_w++; +					} +					if (dst_y%2==1) { +						dst_y--; +						dst_h++; +					} + +					if (dst_w&1) +						dst_w++; +					if (dst_h&1) +						dst_h++; + +					src_x = dst_x; +					src_y = dst_y; +					dst_x = dst_x / 2; +					dst_y = dst_y / 2; +				} +				scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch,  						   (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);  			} -            if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) { - -			    r->w = r->w / 2; -			    r->h = dst_h / 2; -            } else { -			    r->w = r->w; -			    r->h = dst_h; -            } - -		    r->x = dst_x; -		    r->y = dst_y; +			if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) { +				r->w = r->w / 2; +				r->h = dst_h / 2; +			} else { +				r->w = r->w; +				r->h = dst_h; +			} +			r->x = dst_x; +			r->y = dst_y;  #ifndef DISABLE_SCALERS  			if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible) @@ -458,27 +454,27 @@ void OSystem_LINUXMOTO::internUpdateScreen() {  }  void OSystem_LINUXMOTO::showOverlay() { -    if (_videoMode.mode == GFX_HALF) { -        _mouseCurState.x = _mouseCurState.x / 2; -        _mouseCurState.y = _mouseCurState.y / 2; -    } +	if (_videoMode.mode == GFX_HALF) { +		_mouseCurState.x = _mouseCurState.x / 2; +		_mouseCurState.y = _mouseCurState.y / 2; +	}  	OSystem_SDL::showOverlay();  }  void OSystem_LINUXMOTO::hideOverlay() { -    if (_videoMode.mode == GFX_HALF) { -        _mouseCurState.x = _mouseCurState.x * 2; -        _mouseCurState.y = _mouseCurState.y * 2; -    } +	if (_videoMode.mode == GFX_HALF) { +		_mouseCurState.x = _mouseCurState.x * 2; +		_mouseCurState.y = _mouseCurState.y * 2; +	}  	OSystem_SDL::hideOverlay();  }  void OSystem_LINUXMOTO::warpMouse(int x, int y) {  	if (_mouseCurState.x != x || _mouseCurState.y != y) { -	if (_videoMode.mode == GFX_HALF && !_overlayVisible) { -            x = x / 2; -            y = y / 2; -        } +		if (_videoMode.mode == GFX_HALF && !_overlayVisible) { +			x = x / 2; +			y = y / 2; +		}  	}  	OSystem_SDL::warpMouse(x, y);  } diff --git a/backends/platform/linuxmoto/linuxmoto-scaler.h b/backends/platform/linuxmoto/linuxmoto-scaler.h index e8064f40f9..03d4bec82f 100644 --- a/backends/platform/linuxmoto/linuxmoto-scaler.h +++ b/backends/platform/linuxmoto/linuxmoto-scaler.h @@ -33,7 +33,7 @@  // FIXME: For now keep hacks in this header to save polluting the SDL backend.  enum { -    GFX_HALF = 12 +	GFX_HALF = 12  };  // TODO/FIXME: Move this platform specific scaler into /graphics/scaler and properly merge with the WinCE PocketPCHalf that it is based on. diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp index 1613863530..192e3a4b7e 100644 --- a/backends/platform/ps2/savefilemgr.cpp +++ b/backends/platform/ps2/savefilemgr.cpp @@ -125,7 +125,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil  		Common::FSNode file(path); -		if(!file.exists()) +		if (!file.exists())  			return NULL;  		sf = file.createReadStream(); @@ -133,7 +133,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil  	} else {  		Common::FSNode file = savePath.getChild(filename); -		if(!file.exists()) +		if (!file.exists())  			return NULL;  		sf = file.createReadStream(); diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 16f35f971f..960f135499 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -617,19 +617,19 @@ void OSystem_PSP::updateScreen() {  		sceGuDisable(GU_ALPHA_TEST);  		sceGuEnable(GU_BLEND);  		sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); -		switch(_keyboardMode) { -			case 0: -				sceGuTexImage(0, 512, 512, 480, keyboard_letters); -				break; -			case CAPS_LOCK: -				sceGuTexImage(0, 512, 512, 480, keyboard_letters_shift); -				break; -			case SYMBOLS: -				sceGuTexImage(0, 512, 512, 480, keyboard_symbols); -				break; -			case (CAPS_LOCK | SYMBOLS): -				sceGuTexImage(0, 512, 512, 480, keyboard_symbols_shift); -				break; +		switch (_keyboardMode) { +		case 0: +			sceGuTexImage(0, 512, 512, 480, keyboard_letters); +			break; +		case CAPS_LOCK: +			sceGuTexImage(0, 512, 512, 480, keyboard_letters_shift); +			break; +		case SYMBOLS: +			sceGuTexImage(0, 512, 512, 480, keyboard_symbols); +			break; +		case (CAPS_LOCK | SYMBOLS): +			sceGuTexImage(0, 512, 512, 480, keyboard_symbols_shift); +			break;  		}  		sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA); @@ -1006,50 +1006,50 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {  			event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;  			if (_keySelected > 26) {  				event.kbd.flags = 0; -				switch(_keySelected) { -					case 27: -						event.kbd.ascii = ' '; -						event.kbd.keycode = Common::KEYCODE_SPACE; -					break; -					case 28: -						event.kbd.ascii = 127; -						event.kbd.keycode = Common::KEYCODE_DELETE; +				switch (_keySelected) { +				case 27: +					event.kbd.ascii = ' '; +					event.kbd.keycode = Common::KEYCODE_SPACE; +				break; +				case 28: +					event.kbd.ascii = 127; +					event.kbd.keycode = Common::KEYCODE_DELETE; +				break; +				case 29: +					event.kbd.ascii = 8; +					event.kbd.keycode = Common::KEYCODE_BACKSPACE; +				break; +				case 30: +					event.kbd.ascii = 13; +					event.kbd.keycode = Common::KEYCODE_RETURN; +				break; +				} +			} else { +				switch ( _keyboardMode) { +				case 0: +					event.kbd.flags = 0; +					event.kbd.ascii = 'a'+_keySelected-1; +					event.kbd.keycode = (Common::KeyCode)(Common::KEYCODE_a + _keySelected-1);  					break; -					case 29: -						event.kbd.ascii = 8; -						event.kbd.keycode = Common::KEYCODE_BACKSPACE; +				case CAPS_LOCK: +					event.kbd.ascii = 'A'+_keySelected-1; +					event.kbd.keycode = (Common::KeyCode)(Common::KEYCODE_a + _keySelected-1); +					event.kbd.flags = Common::KBD_SHIFT;  					break; -					case 30: -						event.kbd.ascii = 13; -						event.kbd.keycode = Common::KEYCODE_RETURN; +				case SYMBOLS: +					if (_keySelected < 21) { +						event.kbd.flags = 0; +						event.kbd.ascii = kbd_ascii[_keySelected-1]; +						event.kbd.keycode = kbd_code[ _keySelected-1]; +					}  					break; -				} -			} else { -				switch( _keyboardMode) { -					case 0: +				case (SYMBOLS|CAPS_LOCK): +					if (_keySelected < 21) {  						event.kbd.flags = 0; -						event.kbd.ascii = 'a'+_keySelected-1; -						event.kbd.keycode = (Common::KeyCode)(Common::KEYCODE_a + _keySelected-1); -						break; -					case CAPS_LOCK: -						event.kbd.ascii = 'A'+_keySelected-1; -						event.kbd.keycode = (Common::KeyCode)(Common::KEYCODE_a + _keySelected-1); -						event.kbd.flags = Common::KBD_SHIFT; -						break; -					case SYMBOLS: -						if (_keySelected < 21) { -							event.kbd.flags = 0; -							event.kbd.ascii = kbd_ascii[_keySelected-1]; -							event.kbd.keycode = kbd_code[ _keySelected-1]; -						} -						break; -					case (SYMBOLS|CAPS_LOCK): -						if (_keySelected < 21) { -							event.kbd.flags = 0; -							event.kbd.ascii = kbd_ascii_cl[_keySelected-1]; -							event.kbd.keycode = kbd_code_cl[ _keySelected-1]; -						} -						break; +						event.kbd.ascii = kbd_ascii_cl[_keySelected-1]; +						event.kbd.keycode = kbd_code_cl[ _keySelected-1]; +					} +					break;  				}  			}  			_prevButtons = pad.Buttons; diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index 74363e4ac9..1f33e0add0 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -23,7 +23,6 @@   *   */ -  #define	USERSPACE_ONLY	//don't use kernel mode features  #ifndef USERSPACE_ONLY @@ -118,7 +117,7 @@ int CallbackThread(SceSize /*size*/, void *arg) {  	cbid = sceKernelCreateCallback("Power Callback", (SceKernelCallbackFunction)power_callback, 0);  	if (cbid >= 0) { -		if(scePowerRegisterCallback(-1, cbid) < 0) { +		if (scePowerRegisterCallback(-1, cbid) < 0) {  			PSPDebugTrace("SetupCallbacks(): Couldn't register callback for power_callback\n");  		}  	} else { diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index ed881952b7..ff09e5bc8f 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -301,7 +301,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {  	int newScaleFactor = 1; -	switch(mode) { +	switch (mode) {  	case GFX_NORMAL:  		newScaleFactor = 1;  		break; diff --git a/backends/platform/symbian/src/ScummVMApp.cpp b/backends/platform/symbian/src/ScummVMApp.cpp index 741f93cfd1..e031244135 100644 --- a/backends/platform/symbian/src/ScummVMApp.cpp +++ b/backends/platform/symbian/src/ScummVMApp.cpp @@ -151,7 +151,7 @@ void CScummVMUi::BringUpEmulatorL() {  }  void CScummVMUi::HandleCommandL(TInt aCommand) { -	switch(aCommand) { +	switch (aCommand) {  	case EEikCmdExit:  		{  			RThread thread; diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 7af1cade8c..fcdc22db51 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -84,35 +84,35 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {  };  bool OSystem_SDL_Symbian::hasFeature(Feature f) { -	switch(f) { -		case kFeatureFullscreenMode: -		case kFeatureAspectRatioCorrection: -		case kFeatureAutoComputeDirtyRects: -		case kFeatureCursorHasPalette: +	switch (f) { +	case kFeatureFullscreenMode: +	case kFeatureAspectRatioCorrection: +	case kFeatureAutoComputeDirtyRects: +	case kFeatureCursorHasPalette:  #ifdef  USE_VIBRA_SE_PXXX -		case kFeatureVibration: +	case kFeatureVibration:  #endif -			return true; +		return true; -		default: -			return false; +	default: +		return false;  	}  }  void OSystem_SDL_Symbian::setFeatureState(Feature f, bool enable) { -	switch(f) { -		case kFeatureVirtualKeyboard: -			if (enable) { -			} -			else { +	switch (f) { +	case kFeatureVirtualKeyboard: +		if (enable) { +		} +		else { -			} -			break; -		case kFeatureDisableKeyFiltering: -			GUI::Actions::Instance()->beginMapping(enable); -			break; -		default: -			OSystem_SDL::setFeatureState(f, enable); +		} +		break; +	case kFeatureDisableKeyFiltering: +		GUI::Actions::Instance()->beginMapping(enable); +		break; +	default: +		OSystem_SDL::setFeatureState(f, enable);  	}  } @@ -326,7 +326,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) {  		if (GUI::Actions::Instance()->getMapping(loop) == ev.key.keysym.sym &&  			GUI::Actions::Instance()->isEnabled(loop)) {  			// Create proper event instead -			switch(loop) { +			switch (loop) {  			case GUI::ACTION_UP:  				if (ev.type == SDL_KEYDOWN) {  					_km.y_vel = -1; diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index fdb32de362..13ad3267bf 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -258,7 +258,7 @@ void OSystem_Wii::initSize(uint width, uint height,  	}  	if (update) { -		if(_gamePixels) +		if (_gamePixels)  			free(_gamePixels);  		tex_format = GFX_TF_PALETTE_RGB565; diff --git a/backends/platform/wince/CEActionsPocket.cpp b/backends/platform/wince/CEActionsPocket.cpp index 45dbad12cc..ebe6981290 100644 --- a/backends/platform/wince/CEActionsPocket.cpp +++ b/backends/platform/wince/CEActionsPocket.cpp @@ -232,7 +232,7 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {  	static bool keydialogrunning = false, quitdialog = false;  	if (!pushed) { -		switch(action) { +		switch (action) {  		case POCKET_ACTION_RIGHTCLICK:  			_CESystem->add_right_click(false);  			return true; @@ -251,78 +251,78 @@ bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {  	}  	switch (action) { -		case POCKET_ACTION_PAUSE: -		case POCKET_ACTION_SAVE: -		case POCKET_ACTION_SKIP: -		case POCKET_ACTION_MULTI: -			if (action == POCKET_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") { -				// FIXME: This is a temporary solution. The engine should handle its own menus. -				// Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience -				GUI::MessageDialog alert("Do you want to load or save the game?", "Load", "Save"); -				if (alert.runModal() == GUI::kMessageOK) -					_key_action[action].setKey(SDLK_l); -				else -					_key_action[action].setKey(SDLK_s); -			} -			EventsBuffer::simulateKey(&_key_action[action], true); -			return true; -		case POCKET_ACTION_KEYBOARD: -			_CESystem->swap_panel(); -			return true; -		case POCKET_ACTION_HIDE: -			_CESystem->swap_panel_visibility(); -			return true; -		case POCKET_ACTION_SOUND: -			_CESystem->swap_sound_master(); -			return true; -		case POCKET_ACTION_RIGHTCLICK: -			_CESystem->add_right_click(true); -			return true; -		case POCKET_ACTION_CURSOR: -			_CESystem->swap_mouse_visibility(); -			return true; -		case POCKET_ACTION_FREELOOK: -			_CESystem->swap_freeLook(); -			return true; -		case POCKET_ACTION_ZOOM_UP: -			_CESystem->swap_zoom_up(); -			return true; -		case POCKET_ACTION_ZOOM_DOWN: -			_CESystem->swap_zoom_down(); -			return true; -		case POCKET_ACTION_LEFTCLICK: -			_CESystem->add_left_click(true); -			return true; -		case POCKET_ACTION_UP: -			_CESystem->move_cursor_up(); -			return true; -		case POCKET_ACTION_DOWN: -			_CESystem->move_cursor_down(); -			return true; -		case POCKET_ACTION_LEFT: -			_CESystem->move_cursor_left(); -			return true; -		case POCKET_ACTION_RIGHT: -			_CESystem->move_cursor_right(); -			return true; -		case POCKET_ACTION_QUIT: -			if (!quitdialog) { -				quitdialog = true; -				GUI::MessageDialog alert("   Are you sure you want to quit ?   ", "Yes", "No"); -				if (alert.runModal() == GUI::kMessageOK) -					_mainSystem->quit(); -				quitdialog = false; -			} -			return true; -		case POCKET_ACTION_BINDKEYS: -			if (!keydialogrunning) { -				keydialogrunning = true; -				GUI::KeysDialog *keysDialog = new GUI::KeysDialog(); -				keysDialog->runModal(); -				delete keysDialog; -				keydialogrunning = false; -			} -			return true; +	case POCKET_ACTION_PAUSE: +	case POCKET_ACTION_SAVE: +	case POCKET_ACTION_SKIP: +	case POCKET_ACTION_MULTI: +		if (action == POCKET_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") { +			// FIXME: This is a temporary solution. The engine should handle its own menus. +			// Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience +			GUI::MessageDialog alert("Do you want to load or save the game?", "Load", "Save"); +			if (alert.runModal() == GUI::kMessageOK) +				_key_action[action].setKey(SDLK_l); +			else +				_key_action[action].setKey(SDLK_s); +		} +		EventsBuffer::simulateKey(&_key_action[action], true); +		return true; +	case POCKET_ACTION_KEYBOARD: +		_CESystem->swap_panel(); +		return true; +	case POCKET_ACTION_HIDE: +		_CESystem->swap_panel_visibility(); +		return true; +	case POCKET_ACTION_SOUND: +		_CESystem->swap_sound_master(); +		return true; +	case POCKET_ACTION_RIGHTCLICK: +		_CESystem->add_right_click(true); +		return true; +	case POCKET_ACTION_CURSOR: +		_CESystem->swap_mouse_visibility(); +		return true; +	case POCKET_ACTION_FREELOOK: +		_CESystem->swap_freeLook(); +		return true; +	case POCKET_ACTION_ZOOM_UP: +		_CESystem->swap_zoom_up(); +		return true; +	case POCKET_ACTION_ZOOM_DOWN: +		_CESystem->swap_zoom_down(); +		return true; +	case POCKET_ACTION_LEFTCLICK: +		_CESystem->add_left_click(true); +		return true; +	case POCKET_ACTION_UP: +		_CESystem->move_cursor_up(); +		return true; +	case POCKET_ACTION_DOWN: +		_CESystem->move_cursor_down(); +		return true; +	case POCKET_ACTION_LEFT: +		_CESystem->move_cursor_left(); +		return true; +	case POCKET_ACTION_RIGHT: +		_CESystem->move_cursor_right(); +		return true; +	case POCKET_ACTION_QUIT: +		if (!quitdialog) { +			quitdialog = true; +			GUI::MessageDialog alert("   Are you sure you want to quit ?   ", "Yes", "No"); +			if (alert.runModal() == GUI::kMessageOK) +				_mainSystem->quit(); +			quitdialog = false; +		} +		return true; +	case POCKET_ACTION_BINDKEYS: +		if (!keydialogrunning) { +			keydialogrunning = true; +			GUI::KeysDialog *keysDialog = new GUI::KeysDialog(); +			keysDialog->runModal(); +			delete keysDialog; +			keydialogrunning = false; +		} +		return true;  	}  	return false;  } diff --git a/backends/platform/wince/CEException.cpp b/backends/platform/wince/CEException.cpp index aec818102d..4ecabece5a 100644 --- a/backends/platform/wince/CEException.cpp +++ b/backends/platform/wince/CEException.cpp @@ -94,31 +94,31 @@ void CEException::dumpException(HANDLE file, EXCEPTION_RECORD *exceptionRecord)  	unsigned int i;  #if (_WIN32_WCE >= 300)  	writeBreak(file); -	switch(exceptionRecord->ExceptionCode) { -		case EXCEPTION_ACCESS_VIOLATION : -			strcpy(exceptionName, "Access Violation"); -			break; -		case EXCEPTION_ARRAY_BOUNDS_EXCEEDED : -			strcpy(exceptionName, "Array Bounds Exceeded"); -			break; -		case EXCEPTION_DATATYPE_MISALIGNMENT : -			strcpy(exceptionName, "Datatype Misalignment"); -			break; -		case EXCEPTION_IN_PAGE_ERROR : -			strcpy(exceptionName, "In Page Error"); -			break; -		case EXCEPTION_INT_DIVIDE_BY_ZERO : -			strcpy(exceptionName, "Int Divide By Zero"); -			break; -		case EXCEPTION_INT_OVERFLOW : -			strcpy(exceptionName, "Int Overflow"); -			break; -		case EXCEPTION_STACK_OVERFLOW : -			strcpy(exceptionName, "Stack Overflow"); -			break; -		default: -			sprintf(exceptionName, "%.8x", exceptionRecord->ExceptionCode); -			break; +	switch (exceptionRecord->ExceptionCode) { +	case EXCEPTION_ACCESS_VIOLATION : +		strcpy(exceptionName, "Access Violation"); +		break; +	case EXCEPTION_ARRAY_BOUNDS_EXCEEDED : +		strcpy(exceptionName, "Array Bounds Exceeded"); +		break; +	case EXCEPTION_DATATYPE_MISALIGNMENT : +		strcpy(exceptionName, "Datatype Misalignment"); +		break; +	case EXCEPTION_IN_PAGE_ERROR : +		strcpy(exceptionName, "In Page Error"); +		break; +	case EXCEPTION_INT_DIVIDE_BY_ZERO : +		strcpy(exceptionName, "Int Divide By Zero"); +		break; +	case EXCEPTION_INT_OVERFLOW : +		strcpy(exceptionName, "Int Overflow"); +		break; +	case EXCEPTION_STACK_OVERFLOW : +		strcpy(exceptionName, "Stack Overflow"); +		break; +	default: +		sprintf(exceptionName, "%.8x", exceptionRecord->ExceptionCode); +		break;  	}  	sprintf(tempo, "Exception %s Flags %.8x Address %.8x", exceptionName, exceptionRecord->ExceptionFlags,  		exceptionRecord->ExceptionAddress); diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 1291e09671..b2512e0234 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -935,46 +935,46 @@ bool OSystem_WINCE3::hasFeature(Feature f) {  }  void OSystem_WINCE3::setFeatureState(Feature f, bool enable) { -	switch(f) { -		case kFeatureFullscreenMode: -			return; +	switch (f) { +	case kFeatureFullscreenMode: +		return; -		case kFeatureVirtualKeyboard: -			if (_hasSmartphoneResolution) -				return; -			_toolbarHighDrawn = false; -			if (enable) { -				_panelStateForced = true; -				if (!_toolbarHandler.visible()) swap_panel_visibility(); -				//_saveToolbarState = _toolbarHandler.visible(); -				_saveActiveToolbar = _toolbarHandler.activeName(); -				_toolbarHandler.setActive(NAME_PANEL_KEYBOARD); -				_toolbarHandler.setVisible(true); -			} -			else -				if (_panelStateForced) { -					_panelStateForced = false; -					_toolbarHandler.setActive(_saveActiveToolbar); -					//_toolbarHandler.setVisible(_saveToolbarState); -				} +	case kFeatureVirtualKeyboard: +		if (_hasSmartphoneResolution)  			return; +		_toolbarHighDrawn = false; +		if (enable) { +			_panelStateForced = true; +			if (!_toolbarHandler.visible()) swap_panel_visibility(); +			//_saveToolbarState = _toolbarHandler.visible(); +			_saveActiveToolbar = _toolbarHandler.activeName(); +			_toolbarHandler.setActive(NAME_PANEL_KEYBOARD); +			_toolbarHandler.setVisible(true); +		} +		else +			if (_panelStateForced) { +				_panelStateForced = false; +				_toolbarHandler.setActive(_saveActiveToolbar); +				//_toolbarHandler.setVisible(_saveToolbarState); +			} +		return; -		case kFeatureDisableKeyFiltering: -			if (_hasSmartphoneResolution) -				_unfilteredkeys = enable; -			return; +	case kFeatureDisableKeyFiltering: +		if (_hasSmartphoneResolution) +			_unfilteredkeys = enable; +		return; -		default: -			OSystem_SDL::setFeatureState(f, enable); +	default: +		OSystem_SDL::setFeatureState(f, enable);  	}  }  bool OSystem_WINCE3::getFeatureState(Feature f) { -	switch(f) { -		case kFeatureFullscreenMode: -			return false; -		case kFeatureVirtualKeyboard: -			return (_panelStateForced); +	switch (f) { +	case kFeatureFullscreenMode: +		return false; +	case kFeatureVirtualKeyboard: +		return (_panelStateForced);  	}  	return OSystem_SDL::getFeatureState(f);  } @@ -1277,7 +1277,7 @@ bool OSystem_WINCE3::setGraphicsMode(int mode) {  	if (_scaleFactorXm < 0) {  		/* Standard scalers, from the SDL backend */ -		switch(_videoMode.mode) { +		switch (_videoMode.mode) {  		case GFX_NORMAL:  			_videoMode.scaleFactor = 1;  			_scalerProc = Normal1x; @@ -2308,7 +2308,7 @@ bool OSystem_WINCE3::pollEvent(Common::Event &event) {  	currentTime = GetTickCount();  	while (SDL_PollEvent(&ev)) { -		switch(ev.type) { +		switch (ev.type) {  		case SDL_KEYDOWN:  			debug(1, "Key down %X %s", ev.key.keysym.sym, SDL_GetKeyName((SDLKey)ev.key.keysym.sym));  			// KMOD_RESERVED is used if the key has been injected by an external buffer diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index 4ca4a5f586..80aad3be4a 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -337,7 +337,7 @@ void VirtualKeyboard::KeyPressQueue::deleteKey() {  	List<VirtualKeyPress>::iterator it = _keyPos;  	it--;  	_strPos -= it->strLen; -	while((it->strLen)-- > 0) +	while ((it->strLen)-- > 0)  		_keysStr.deleteChar(_strPos);  	_keys.erase(it);  	_strChanged = true; diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp index 57ab475f4a..64de26a8c7 100644 --- a/common/EventRecorder.cpp +++ b/common/EventRecorder.cpp @@ -39,7 +39,7 @@ void readRecord(Common::InSaveFile *inFile, uint32 &diff, Common::Event &event)  	event.type = (Common::EventType)inFile->readUint32LE(); -	switch(event.type) { +	switch (event.type) {  	case Common::EVENT_KEYDOWN:  	case Common::EVENT_KEYUP:  		event.kbd.keycode = (Common::KeyCode)inFile->readSint32LE(); @@ -66,7 +66,7 @@ void writeRecord(Common::OutSaveFile *outFile, uint32 diff, const Common::Event  	outFile->writeUint32LE((uint32)event.type); -	switch(event.type) { +	switch (event.type) {  	case Common::EVENT_KEYDOWN:  	case Common::EVENT_KEYUP:  		outFile->writeSint32LE(event.kbd.keycode); @@ -340,7 +340,7 @@ bool EventRecorder::pollEvent(Common::Event &ev) {  	if (_hasPlaybackEvent) {  		if (_playbackDiff <= (_eventCount - _lastEventCount)) { -			switch(_playbackEvent.type) { +			switch (_playbackEvent.type) {  			case Common::EVENT_MOUSEMOVE:  			case Common::EVENT_LBUTTONDOWN:  			case Common::EVENT_LBUTTONUP: diff --git a/common/stream.cpp b/common/stream.cpp index 946b26a393..9329ddea6c 100644 --- a/common/stream.cpp +++ b/common/stream.cpp @@ -202,7 +202,7 @@ bool SeekableSubReadStream::seek(int32 offset, int whence) {  	assert(_pos >= _begin);  	assert(_pos <= _end); -	switch(whence) { +	switch (whence) {  	case SEEK_END:  		offset = size() + offset;  		// fallthrough diff --git a/common/zlib.cpp b/common/zlib.cpp index 519b7c4806..7f04bd5a4f 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -154,7 +154,7 @@ public:  	bool seek(int32 offset, int whence = SEEK_SET) {  		int32 newPos = 0;  		assert(whence != SEEK_END);	// SEEK_END not supported -		switch(whence) { +		switch (whence) {  		case SEEK_SET:  			newPos = offset;  			break; diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp index 74dcd75edb..e84bf0d1ba 100644 --- a/engines/agi/preagi_common.cpp +++ b/engines/agi/preagi_common.cpp @@ -124,7 +124,7 @@ int PreAgiEngine::getSelection(SelectionTypes type) {  	while (!shouldQuit()) {  		while (_eventMan->pollEvent(event)) { -			switch(event.type) { +			switch (event.type) {  			case Common::EVENT_RTL:  			case Common::EVENT_QUIT:  				return 0; diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index c06cd94bec..e61637194c 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -295,7 +295,7 @@ void Mickey::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow, i  	int iWord;  	int *sel = 0; -	switch(iRow) { +	switch (iRow) {  	case 0:  		if (y != IDI_MSA_ROW_MENU_0) return;  		sel = sel0; @@ -323,7 +323,7 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {  	int x, y;  	int goIndex = -1, northIndex = -1, southIndex = -1, eastIndex = -1, westIndex = -1; -	switch(iRow) { +	switch (iRow) {  	case 0:  		sel = sel0;  		break; @@ -361,7 +361,7 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {  	while (!_vm->shouldQuit()) {  		while (_vm->_system->getEventManager()->pollEvent(event)) { -			switch(event.type) { +			switch (event.type) {  			case Common::EVENT_RTL:  			case Common::EVENT_QUIT:  				return 0; @@ -679,7 +679,7 @@ void Mickey::playSound(ENUM_MSA_SOUND iSound) {  	uint8 *buffer = new uint8[1024];  	int pBuf = 1; -	switch(iSound) { +	switch (iSound) {  	case IDI_MSA_SND_XL30:  		for (int iNote = 0; iNote < 6; iNote++) {  			note.counter = _vm->rnd(59600) + 59; @@ -701,7 +701,7 @@ void Mickey::playSound(ENUM_MSA_SOUND iSound) {  			if (iSound == IDI_MSA_SND_THEME) {  				while (_vm->_system->getEventManager()->pollEvent(event)) { -					switch(event.type) { +					switch (event.type) {  					case Common::EVENT_RTL:  					case Common::EVENT_QUIT:  					case Common::EVENT_LBUTTONUP: @@ -769,7 +769,7 @@ void Mickey::drawRoomAnimation() {  		0xF0, 1, 0xF9, 2, 43, 45, 0xFF  	}; -	switch(_game.iRoom) { +	switch (_game.iRoom) {  	case IDI_MSA_PIC_EARTH_SHIP:  	case IDI_MSA_PIC_VENUS_SHIP:  	case IDI_MSA_PIC_NEPTUNE_SHIP: @@ -835,7 +835,7 @@ void Mickey::drawRoomAnimation() {  		// draw crystal  		if (_game.iRoom == IDI_MSA_XTAL_ROOM_XY[_game.iPlanet][0]) {  			if (!_game.fHasXtal) { -				switch(_game.iPlanet) { +				switch (_game.iPlanet) {  				case IDI_MSA_PLANET_VENUS:  					if (_game.iRmMenu[_game.iRoom] != 2)  						break; @@ -1488,7 +1488,7 @@ void Mickey::getXtal(int iStr) {  }  bool Mickey::parse(int cmd, int arg) { -	switch(cmd) { +	switch (cmd) {  	// BASIC @@ -2211,7 +2211,7 @@ void Mickey::waitAnyKey(bool anim) {  	while (!_vm->shouldQuit()) {  		while (_vm->_system->getEventManager()->pollEvent(event)) { -			switch(event.type) { +			switch (event.type) {  			case Common::EVENT_RTL:  			case Common::EVENT_QUIT:  			case Common::EVENT_KEYDOWN: diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index e34949c8fe..04c0d25b11 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -60,7 +60,7 @@ bool Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) {  	while (!_vm->shouldQuit()) {  		while (_vm->_system->getEventManager()->pollEvent(event)) { -			switch(event.type) { +			switch (event.type) {  			case Common::EVENT_RTL:  			case Common::EVENT_QUIT:  				return 0; @@ -207,7 +207,7 @@ void Troll::waitAnyKeyIntro() {  	while (!_vm->shouldQuit()) {  		while (_vm->_system->getEventManager()->pollEvent(event)) { -			switch(event.type) { +			switch (event.type) {  			case Common::EVENT_RTL:  			case Common::EVENT_QUIT:  			case Common::EVENT_LBUTTONUP: @@ -285,7 +285,7 @@ void Troll::tutorial() {  		while (!done && !_vm->shouldQuit()) {  			getMenuSel(IDS_TRO_TUTORIAL_1, &iSel, IDI_TRO_MAX_OPTION); -			switch(iSel) { +			switch (iSel) {  			case IDI_TRO_SEL_OPTION_1:  				_vm->clearScreen(0x22, false);  				_vm->_gfx->doUpdate(); @@ -579,7 +579,7 @@ void Troll::gameLoop() {  		roomParam = _roomDescs[_roomPicture - 1].roomDescIndex[currentOption]; -		switch(_roomDescs[_roomPicture - 1].optionTypes[currentOption]) { +		switch (_roomDescs[_roomPicture - 1].optionTypes[currentOption]) {  		case OT_FLASHLIGHT:  			if (!haveFlashlight) {  				printUserMessage(13); diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index ac0d3625b2..85cf2d29ef 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -266,7 +266,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {  		// extract text from block  		opcode = *(buffer + pc); -		switch(opcode) { +		switch (opcode) {  		case 0:  		case IDO_WTP_OPTION_0:  		case IDO_WTP_OPTION_1: @@ -331,9 +331,9 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {  			}  			// process selection -			switch(iSel) { +			switch (iSel) {  			case IDI_WTP_SEL_HOME: -				switch(_room) { +				switch (_room) {  				case IDI_WTP_ROOM_HOME:  				case IDI_WTP_ROOM_MIST:  				case IDI_WTP_ROOM_TIGGER: @@ -384,7 +384,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {  		// process script  		do {  			opcode = *(buffer + pc++); -			switch(opcode) { +			switch (opcode) {  			case IDO_WTP_GOTO_ROOM:  				opcode = *(buffer + pc++);  				iNewRoom = opcode; @@ -726,7 +726,7 @@ void Winnie::drawMenu(char *szMenu, int iSel, int fCanSel[]) {  	if (fCanSel[IDI_WTP_SEL_DROP])  		_vm->drawStr(IDI_WTP_ROW_OPTION_4, IDI_WTP_COL_DROP, IDA_DEFAULT, IDS_WTP_DROP); -	switch(iSel) { +	switch (iSel) {  	case IDI_WTP_SEL_OPT_1:  	case IDI_WTP_SEL_OPT_2:  	case IDI_WTP_SEL_OPT_3: @@ -778,7 +778,7 @@ void Winnie::decMenuSel(int *iSel, int fCanSel[]) {  }  void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) { -	switch(y) { +	switch (y) {  	case IDI_WTP_ROW_OPTION_1:  	case IDI_WTP_ROW_OPTION_2:  	case IDI_WTP_ROW_OPTION_3: @@ -816,7 +816,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {  	while (!_vm->shouldQuit()) {  		while (_vm->_system->getEventManager()->pollEvent(event)) { -			switch(event.type) { +			switch (event.type) {  			case Common::EVENT_RTL:  			case Common::EVENT_QUIT:  				return; @@ -865,7 +865,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {  					_vm->_gfx->setCursorPalette(false);  				} -				switch(*iSel) { +				switch (*iSel) {  					case IDI_WTP_SEL_OPT_1:  					case IDI_WTP_SEL_OPT_2:  					case IDI_WTP_SEL_OPT_3: @@ -970,7 +970,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {  					makeSel();  					break;  				case Common::KEYCODE_RETURN: -					switch(*iSel) { +					switch (*iSel) {  					case IDI_WTP_SEL_OPT_1:  					case IDI_WTP_SEL_OPT_2:  					case IDI_WTP_SEL_OPT_3: @@ -1036,7 +1036,7 @@ phase2:  	while (!_vm->shouldQuit()) {  		for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) { -			switch(parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata)) { +			switch (parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata)) {  			case IDI_WTP_PAR_GOTO:  				goto phase0;  				break; diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index 67ae7ef2c2..360fa4bf8c 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -695,7 +695,7 @@ void AGOSEngine_DIMP::dimpIdle() {  								if (_variableArray[110] > 2)  									break;  								n = _rnd.getRandomNumber(6); -								switch(n) { +								switch (n) {  									case(0): loadSoundFile("And01.wav");break;  									case(1): loadSoundFile("And02.wav");break;  									case(2): loadSoundFile("And03.wav");break; @@ -710,7 +710,7 @@ void AGOSEngine_DIMP::dimpIdle() {  								if (_variableArray[111] > 2)  									break;  								n = _rnd.getRandomNumber(6); -								switch(n) { +								switch (n) {  									case(0): loadSoundFile("And08.wav");break;  									case(1): loadSoundFile("And09.wav");break;  									case(2): loadSoundFile("And0a.wav");break; @@ -725,7 +725,7 @@ void AGOSEngine_DIMP::dimpIdle() {  								if (_variableArray[112] > 2)  									break;  								n = _rnd.getRandomNumber(4); -								switch(n) { +								switch (n) {  									case(0): loadSoundFile("And0f.wav");break;  									case(1): loadSoundFile("And0g.wav");break;  									case(2): loadSoundFile("And0h.wav");break; diff --git a/engines/agos/string_pn.cpp b/engines/agos/string_pn.cpp index 0872e9d589..a4e40d8306 100644 --- a/engines/agos/string_pn.cpp +++ b/engines/agos/string_pn.cpp @@ -23,8 +23,6 @@   *   */ - -  #include "agos/agos.h"  #include "agos/intern.h" @@ -34,7 +32,7 @@ uint32 AGOSEngine_PN::ftext(uint32 base, int n) {  	uint32 b = base;  	int ct = n;  	while (ct) { -		while(_textBase[b++]) +		while (_textBase[b++])  			;  		ct--;  	} diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index b148852892..df723dbbba 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -299,7 +299,7 @@ void Game::loop() {  			}  		} -		if(_vm->_mouse->isCursorOn()) { +		if (_vm->_mouse->isCursorOn()) {  			// Fetch the dedicated objects' title animation / current frame  			Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);  			Text *title = reinterpret_cast<Text *>(titleAnim->getFrame()); @@ -787,7 +787,7 @@ void Game::dialogueMenu(int dialogueID) {  		_dialogueBegin = false;  		oldLines = _dialogueLinesNum; -	} while(!_dialogueExit); +	} while (!_dialogueExit);  	dialogueDone();  	_currentDialogue = kNoDialogue; @@ -1562,7 +1562,7 @@ Common::Point WalkingMap::findNearestWalkable(int startX, int startY, Common::Re  	// such resizing step, it checks some select points on the ellipse for walkability.  	// It also does the same check for the ellipse perpendicular to it (rotated by 90 degrees). -	while(1) { +	while (1) {  		// The default major radius  		radius += _deltaX; diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 7cf5ef50a1..aec95241e0 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -369,7 +369,7 @@ void Script::load(Common::Queue<int> ¶ms) {  	GameObject *obj = _vm->_game->getObject(objID);  	// If the animation is already loaded, return -	for(i = 0; i < obj->_anims.size(); ++i) { +	for (i = 0; i < obj->_anims.size(); ++i) {  		if (obj->_anims[i] == animID) {  			return;  		} @@ -384,7 +384,7 @@ void Script::load(Common::Queue<int> ¶ms) {  	// Care must be taken to store them sorted (increasing order) as some things  	// depend on this. -	for(i = 0; i < obj->_anims.size(); ++i) { +	for (i = 0; i < obj->_anims.size(); ++i) {  		if (obj->_anims[i] > animID) {  			break;  		} diff --git a/engines/gob/draw_playtoons.cpp b/engines/gob/draw_playtoons.cpp index 2dcdaba388..df246de281 100644 --- a/engines/gob/draw_playtoons.cpp +++ b/engines/gob/draw_playtoons.cpp @@ -151,7 +151,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) {  		break;  	case DRAW_PUTPIXEL: -		switch(_pattern & 0xFF) { +		switch (_pattern & 0xFF) {  		case -1:  			warning("oPlaytoons_spriteOperation: operation DRAW_PUTPIXEL, pattern -1");  			break; @@ -180,7 +180,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) {  								  _destSpriteY + (_pattern + 1) / 2);  		break;  	case DRAW_FILLRECT: -		switch(_pattern & 0xFF) { +		switch (_pattern & 0xFF) {  		case 1:  		case 2:  		case 3: @@ -217,7 +217,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) {  					_destSpriteX + 1, _destSpriteY + 1,  					_spriteRight + 1, _spriteBottom + 1, _frontColor);  		} else { -			switch(_pattern & 0xFF) { +			switch (_pattern & 0xFF) {  			case 0:   				_vm->_video->drawLine(*_spritesArray[_destSurface],  					_destSpriteX, _destSpriteY, diff --git a/engines/gob/inter.h b/engines/gob/inter.h index 157476f241..df5e5ccda1 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -199,7 +199,7 @@ protected:  	bool o1_callSub(OpFuncParams ¶ms);  	bool o1_printTotText(OpFuncParams ¶ms);  	bool o1_loadCursor(OpFuncParams ¶ms); -	bool o1_switch(OpFuncParams ¶ms); +	bool o1_switch (OpFuncParams ¶ms);  	bool o1_repeatUntil(OpFuncParams ¶ms);  	bool o1_whileDo(OpFuncParams ¶ms);  	bool o1_if(OpFuncParams ¶ms); diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index d3bd11ab75..51142e3659 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -722,7 +722,7 @@ bool Inter_v1::o1_loadCursor(OpFuncParams ¶ms) {  	return false;  } -bool Inter_v1::o1_switch(OpFuncParams ¶ms) { +bool Inter_v1::o1_switch (OpFuncParams ¶ms) {  	uint32 offset;  	checkSwitchTable(offset); diff --git a/engines/gob/sound/adlib.cpp b/engines/gob/sound/adlib.cpp index 170ed5ccf4..03bc87fb88 100644 --- a/engines/gob/sound/adlib.cpp +++ b/engines/gob/sound/adlib.cpp @@ -610,7 +610,7 @@ void MDYPlayer::interpret() {  	do {  		instr = *_playPos;  //			printf("instr 0x%X\n", instr); -		switch(instr) { +		switch (instr) {  		case 0xF8:  			_wait = *(_playPos++);  			break; @@ -640,7 +640,7 @@ void MDYPlayer::interpret() {  			}  			channel = (int)(instr & 0x0f); -			switch(instr & 0xf0) { +			switch (instr & 0xf0) {  			case 0x90:  				note = *(_playPos++);  				volume = *(_playPos++); diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index cf2b360d79..098a698e14 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -279,7 +279,7 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag)  					quitGame();  				}  			} else { -				switch(event.kbd.keycode) { +				switch (event.kbd.keycode) {  				case Common::KEYCODE_SPACE:  					keys = 61;  					break; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 09fb0f0329..5a18869da0 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -1405,7 +1405,7 @@ void LoLEngine::processGasExplosion(int soundId) {  }  int LoLEngine::smoothScrollDrawSpecialGuiShape(int pageNum) { -	if(!_specialGuiShape) +	if (!_specialGuiShape)  		return 0;  	_screen->clearGuiShapeMemory(pageNum); diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index 0c9cf6d297..15c9bbdd7e 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -714,7 +714,7 @@ void LoLEngine::showStarcraftLogo() {  	if (!(shouldQuit() || inputFlag)) {  		_sound->voicePlay("star2", &_speechHandle); -		while(_sound->voiceIsPlaying(&_speechHandle) && !(shouldQuit() || inputFlag)) { +		while (_sound->voiceIsPlaying(&_speechHandle) && !(shouldQuit() || inputFlag)) {  			inputFlag = checkInput(0) & 0xff;  			delay(_tickLength);  		} diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 61f4c1eac7..79baebeb18 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -235,7 +235,7 @@ void ConversationView::selectEntry(int entryIndex) {  }  void ConversationView::updateState() { -	switch(_conversationState) { +	switch (_conversationState) {  		case kConversationOptionsShown:  			return;  		case kEntryIsActive: @@ -412,7 +412,7 @@ void Converse::loadConversation(const char *convName) {  		if (convS->eos()) break;  		if (debugFlag) printf("***** Pos: %i -> ", chunkPos); -		switch(chunk) { +		switch (chunk) {  			case CHUNK_DECL:	// Declare  				if (debugFlag) printf("DECL chunk\n");  				data = convS->readUint32LE(); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 8fadd4e462..edfd14e6c7 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -572,7 +572,7 @@ void Parallaction::runZone(ZonePtr z) {  	uint16 actionType = ACTIONTYPE(z);  	debugC(3, kDebugExec, "actionType = %x, itemType = %x", actionType, ITEMTYPE(z)); -	switch(actionType) { +	switch (actionType) {  	case kZoneExamine:  		enterCommentMode(z); diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index c2982185ab..033350643e 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -134,7 +134,7 @@ bool Parallaction_br::processGameEvent(int event) {  	bool c = true;  	_input->stopHovering(); -	switch(event) { +	switch (event) {  	case kEvIngameMenu:  		startIngameMenu();  		c = false; diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 9604b26026..de3cb1e557 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -256,7 +256,7 @@ bool Parallaction_ns::processGameEvent(int event) {  	bool c = true;  	_input->stopHovering(); -	switch(event) { +	switch (event) {  	case kEvSaveGame:  		_saveLoad->saveGame();  		break; diff --git a/engines/saga/isomap.cpp b/engines/saga/isomap.cpp index 850eb994a7..08a00acd2a 100644 --- a/engines/saga/isomap.cpp +++ b/engines/saga/isomap.cpp @@ -1067,7 +1067,7 @@ void IsoMap::testPossibleDirections(int16 u, int16 v, uint16 terraComp[8], int s  	memset(terraComp, 0, 8 * sizeof(uint16));  #define FILL_MASK(index, testMask)		\ -	if ( mask & testMask) {				\ +	if (mask & testMask) {				\  		terraComp[index] |= fgdMask;	\  	}									\  	if (~mask & testMask) {				\ @@ -1370,7 +1370,7 @@ void IsoMap::findDragonTilePath(ActorData* actor,const Location &start, const Lo  			tile = getTile(u1, v1, _platformHeight );  			if (tile != NULL) {  				mask = tile->terrainMask; -				if ( ((mask != 0) && (tile->GetFGDAttr() >= kTerrBlock)) || +				if (((mask != 0) && (tile->GetFGDAttr() >= kTerrBlock)) ||  					((mask != 0xFFFF) && (tile->GetBGDAttr() >= kTerrBlock)) ) {  					pcell->visited = 1;  				} diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 7386b6dd10..84d151223f 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -169,7 +169,7 @@ Common::Error SagaEngine::run() {  	if (_readingSpeed > 3)  		_readingSpeed = 0; -	switch(getGameId()) { +	switch (getGameId()) {  		case GID_ITE:  			_resource = new Resource_RSC(this);  			break; diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 7b20a65e95..5d73fd4fb3 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -1003,7 +1003,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) {   * Used for synthesized music playback   */  reg_t kDoSound(EngineState *s, int argc, reg_t *argv) { -	switch(s->detectDoSoundType()) { +	switch (s->detectDoSoundType()) {  	case SCI_VERSION_0_EARLY:  		return kDoSoundSci0(s, argc, argv);  	case SCI_VERSION_1_EARLY: diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index ae9db4cb67..8747ba31b8 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -545,7 +545,7 @@ static byte *find_unique_script_block(EngineState *s, byte *buf, int type) {  		int seeker_size = READ_LE_UINT16(buf + 2);  		assert(seeker_size > 0);  		buf += seeker_size; -	} while(1); +	} while (1);  	return NULL;  } diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 10d2a957a8..effaac0ca5 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -271,7 +271,7 @@ SciVersion EngineState::detectDoSoundType() {  		if (!parse_reg_t(this, "?Sound", &soundClass)) {  			int sum = methodChecksum(soundClass, _kernel->_selectorCache.play, -6, 6); -			switch(sum) { +			switch (sum) {  			case 0x1B2: // SCI0  			case 0x1AE: // SCI01  				_doSoundType = SCI_VERSION_0_EARLY; diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index acb89824b2..f377e77d13 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -403,7 +403,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt  			sendCalls.push(call);  			break; -		} // switch(lookup_selector()) +		} // switch (lookup_selector())  		framesize -= (2 + argc);  		argp += argc + 1; @@ -1410,7 +1410,7 @@ void run_vm(EngineState *s, int restoring) {  		default:  			error("run_vm(): illegal opcode %x", opnumber); -		} // switch(opcode >> 1) +		} // switch (opcode >> 1)  		if (s->_executionStackPosChanged) // Force initialization  			scriptState.xs = xs_new; diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index f6b24d0a12..f413020267 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1532,7 +1532,7 @@ ViewType ResourceManager::detectViewType() {  		Resource *res = findResource(ResourceId(kResourceTypeView, i), 0);  		if (res) { -			switch(res->data[1]) { +			switch (res->data[1]) {  			case 128:  				// If the 2nd byte is 128, it's a VGA game  				return kViewVga; diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index 669a3f7d76..643d919da1 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -226,7 +226,7 @@ void SfxPlayer::player_timer_callback(void *refCon) {  Common::Error SfxPlayer::init(ResourceManager *resMan, int expected_latency) {  	MidiDriverType musicDriver = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB); -	switch(musicDriver) { +	switch (musicDriver) {  	case MD_ADLIB:  		_mididrv = new MidiPlayer_Adlib();  		break; diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp index d628293d7d..bffe9faf70 100644 --- a/engines/scumm/player_v2cms.cpp +++ b/engines/scumm/player_v2cms.cpp @@ -320,7 +320,7 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) {  			saa->noise[ch].counter -= saa->noise[ch].freq;  			while (saa->noise[ch].counter < 0) {  				saa->noise[ch].counter += _sampleRate; -				if( ((saa->noise[ch].level & 0x4000) == 0) == ((saa->noise[ch].level & 0x0040) == 0) ) +				if (((saa->noise[ch].level & 0x4000) == 0) == ((saa->noise[ch].level & 0x0040) == 0) )  					saa->noise[ch].level = (saa->noise[ch].level << 1) | 1;  				else  					saa->noise[ch].level <<= 1; diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp index 5924197d96..c67b7fe675 100644 --- a/engines/sky/logic.cpp +++ b/engines/sky/logic.cpp @@ -23,7 +23,6 @@   *   */ -  #include "common/endian.h"  #include "common/rect.h"  #include "common/events.h" @@ -1918,7 +1917,7 @@ bool Logic::fnStartMenu(uint32 firstObject, uint32 b, uint32 c) {  	uint32 menuLength = 0;  	for (i = firstObject; i < firstObject + ARRAYSIZE(_objectList); i++) { -		if ( _scriptVariables[i] ) +		if (_scriptVariables[i])  			_objectList[menuLength++] = _scriptVariables[i];  	}  	_scriptVariables[MENU_LENGTH] = menuLength; 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; diff --git a/engines/sword2/maketext.cpp b/engines/sword2/maketext.cpp index 0c29e5719c..35f0924404 100644 --- a/engines/sword2/maketext.cpp +++ b/engines/sword2/maketext.cpp @@ -325,7 +325,7 @@ uint16 FontRenderer::charWidth(byte ch, uint32 fontRes) {  	frame_head.read(charBuf); -	if(Sword2Engine::isPsx()) +	if (Sword2Engine::isPsx())  		free(charBuf);  	_vm->_resman->closeResource(fontRes); @@ -353,7 +353,7 @@ uint16 FontRenderer::charHeight(uint32 fontRes) {  	frame_head.read(charbuf); -	if(Sword2Engine::isPsx()) +	if (Sword2Engine::isPsx())  		free(charbuf);  	_vm->_resman->closeResource(fontRes); diff --git a/engines/sword2/palette.cpp b/engines/sword2/palette.cpp index aa569689ff..84ebd142ca 100644 --- a/engines/sword2/palette.cpp +++ b/engines/sword2/palette.cpp @@ -50,7 +50,7 @@ void Screen::startNewPalette() {  	// Don't fetch palette match table while using PSX version,  	// because it is not present. -	if(!Sword2Engine::isPsx()) +	if (!Sword2Engine::isPsx())  		memcpy(_paletteMatch, _vm->fetchPaletteMatchTable(screenFile), PALTABLESIZE);  	setPalette(0, 256, _vm->fetchPalette(screenFile), RDPAL_FADE); diff --git a/engines/sword2/protocol.cpp b/engines/sword2/protocol.cpp index dcb5b5f5b0..bb5f68fd5f 100644 --- a/engines/sword2/protocol.cpp +++ b/engines/sword2/protocol.cpp @@ -43,7 +43,7 @@ namespace Sword2 {  byte *Sword2Engine::fetchPalette(byte *screenFile) {  	byte *palette; -	if(isPsx()) { // PSX version doesn't have a "MultiScreenHeader", instead there's a ScreenHeader and a tag +	if (isPsx()) { // PSX version doesn't have a "MultiScreenHeader", instead there's a ScreenHeader and a tag  		palette = screenFile + ResHeader::size() + ScreenHeader::size() + 2;  	} else {  		MultiScreenHeader mscreenHeader; diff --git a/engines/sword2/render.cpp b/engines/sword2/render.cpp index 7d41ccd207..6123986367 100644 --- a/engines/sword2/render.cpp +++ b/engines/sword2/render.cpp @@ -618,7 +618,7 @@ int32 Screen::initialisePsxBackgroundLayer(byte *parallax) {  		if (!(remLines && posY == _yBlocks[_layer] - 1))  			remLines = 32; -		for(j = 0; j < remLines; j++) { +		for (j = 0; j < remLines; j++) {  			memcpy(tileChunk + j * BLOCKWIDTH * 2, parallax + stripeOffset + j * BLOCKWIDTH, BLOCKWIDTH);  			memcpy(tileChunk + j * BLOCKWIDTH * 2 + BLOCKWIDTH, parallax + stripeOffset + j * BLOCKWIDTH, BLOCKWIDTH);  		} @@ -728,7 +728,7 @@ int32 Screen::initialisePsxParallaxLayer(byte *parallax) {  			block_has_data = true;  			// If one of the two grouped blocks is without data, then we also have transparency -			if(!firstTilePresent || !secondTilePresent) +			if (!firstTilePresent || !secondTilePresent)  				block_is_transparent = true;  		} @@ -737,7 +737,7 @@ int32 Screen::initialisePsxParallaxLayer(byte *parallax) {  			byte *block = data;  			if (firstTilePresent) {  				for (k = 0; k < 0x400; k++) { -					if ( *(block + k) == 0) { +					if (*(block + k) == 0) {  						block_is_transparent = true;  						break;  					} @@ -749,7 +749,7 @@ int32 Screen::initialisePsxParallaxLayer(byte *parallax) {  			// a second tile, check it  			if (secondTilePresent && !block_is_transparent) {  				for (k = 0; k < 0x400; k++) { -					if ( *(block + k) == 0) { +					if (*(block + k) == 0) {  						block_is_transparent = true;  						break;  					} diff --git a/engines/sword2/router.cpp b/engines/sword2/router.cpp index 2fc5c9efd5..d8789d00fb 100644 --- a/engines/sword2/router.cpp +++ b/engines/sword2/router.cpp @@ -945,11 +945,11 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {  			// new frames for turn frames	29oct95jps  			if (turnDir < 0) { -				if ( lastDir < 0) +				if (lastDir < 0)  					lastDir += NO_DIRECTIONS;  				module = _firstStandingTurnLeftFrame + lastDir;  			} else { -				if ( lastDir > 7) +				if (lastDir > 7)  					lastDir -= NO_DIRECTIONS;  				module = _firstStandingTurnRightFrame + lastDir;  			} @@ -1208,7 +1208,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {  	} else if (_targetDir != lastRealDir) {  		// rotate to target direction  		turnDir = _targetDir - lastRealDir; -		if ( turnDir < 0) +		if (turnDir < 0)  			turnDir += NO_DIRECTIONS;  		if (turnDir > 4) diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp index 39abb8efe9..3d40c2b858 100644 --- a/engines/sword2/sprite.cpp +++ b/engines/sword2/sprite.cpp @@ -279,7 +279,7 @@ uint32 Screen::decompressHIF(byte *src, byte *dst, uint32 *skipData) {  				}  				int32 repeat_count = (info_word >> 12) + 2; // How many time data needs to be refetched -				while(repeat_count >= 0) { +				while (repeat_count >= 0) {  					uint16 refetchData = (info_word & 0xFFF) + 1;  					if (refetchData > decompSize) return 0; // We have a problem here...  					uint8 *old_data_src = dst - refetchData; @@ -498,7 +498,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {  	// Decompression and mirroring  	// -----------------------------------------------------------------  	if (s->type & RDSPR_NOCOMPRESSION) { -		if(Sword2Engine::isPsx()) { // PSX Uncompressed sprites +		if (Sword2Engine::isPsx()) { // PSX Uncompressed sprites  			if (s->w > 254 && !s->isText) { // We need to recompose these frames  				recomposePsxSprite(s);  			} @@ -528,7 +528,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {  				decompData = decompressHIF(s->data, tempBuf);  				// Check that we correctly decompressed data -				if(!decompData) +				if (!decompData)  					return RDERR_DECOMPRESSION;  				s->w = (decompData / (s->h / 2)) * 2; @@ -568,7 +568,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {  					uint32 decompData = decompressHIF(s->data, tempBuf);  					// Check that we correctly decompressed data -					if(!decompData) +					if (!decompData)  						return RDERR_DECOMPRESSION;  					s->w = (decompData / (s->h / 2)); diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index bee079cda7..d21e5b4eee 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -186,7 +186,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {  			displayMessage(0x57b2);  			return true;  		} else { -			for(byte i = 11; i <= 27; i += 4) +			for (byte i = 11; i <= 27; i += 4)  				playSound(76, i);  			playSound(56, 35); diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp index d8d40f64d3..91de759bec 100644 --- a/engines/teenagent/inventory.cpp +++ b/engines/teenagent/inventory.cpp @@ -50,7 +50,7 @@ void Inventory::init(TeenAgentEngine *engine) {  		offset[i] = items->readUint16LE();  	} -	for(byte i = 0; i < 92; ++i) { +	for (byte i = 0; i < 92; ++i) {  		InventoryObject io;  		uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2);  		if (obj_addr != 0)  diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 196283159d..4f21fb774c 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -116,7 +116,7 @@ void Scene::init(TeenAgentEngine *engine, OSystem *system) {  	objects.resize(42);  	walkboxes.resize(42); -	for(byte i = 0; i < 42; ++i) { +	for (byte i = 0; i < 42; ++i) {  		Common::Array<Object> &scene_objects = objects[i];  		scene_objects.clear(); @@ -151,7 +151,7 @@ Object *Scene::findObject(const Common::Point &point) {  	Common::Array<Object> &scene_objects = objects[_id - 1]; -	for(uint i = 0; i < scene_objects.size(); ++i) { +	for (uint i = 0; i < scene_objects.size(); ++i) {  		Object &obj = scene_objects[i];  		if (obj.enabled != 0 && obj.rect.in(point))  			return &obj; diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index 53d214950e..a1176e04ef 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -134,10 +134,10 @@ void TeenAgentEngine::init() {  	Resources * res = Resources::instance();  	use_hotspots.resize(42);  	byte *scene_hotspots = res->dseg.ptr(0xbb87); -	for(byte i = 0; i < 42; ++i) { +	for (byte i = 0; i < 42; ++i) {  		Common::Array<UseHotspot> & hotspots = use_hotspots[i];  		byte * hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2)); -		while(*hotspots_ptr) { +		while (*hotspots_ptr) {  			UseHotspot h;  			h.load(hotspots_ptr);  			hotspots_ptr += 9; diff --git a/engines/tinsel/coroutine.h b/engines/tinsel/coroutine.h index c562ecdabb..34d4865ce9 100644 --- a/engines/tinsel/coroutine.h +++ b/engines/tinsel/coroutine.h @@ -145,7 +145,7 @@ public:  		if (&coroParam == &nullContext) assert(!nullContext);\  		if (!x) {coroParam = x = new CoroContextTag();}\  		CoroContextHolder tmpHolder(coroParam);\ -		switch(coroParam->_line) { case 0:; +		switch (coroParam->_line) { case 0:;  /**   * End the code section of a coroutine. diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 0b3f2e6e24..9700e8947f 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -286,7 +286,7 @@ static void PsxDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply  			p += boxBounds.top * (fourBitClut ? sizeof(uint16) : sizeof(uint32));  			for (int yp = boxBounds.top; yp <= boxBounds.bottom; ++yp, p += (fourBitClut ? sizeof(uint16) : sizeof(uint32))) { -				if(!fourBitClut) { +				if (!fourBitClut) {  					if (!transparency)  						Common::copy(p + boxBounds.left, p + boxBounds.right + 1, tempDest + (SCREEN_WIDTH * (yp - boxBounds.top)));  					else diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index 2616664841..46e1e975d5 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -84,26 +84,26 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &  	if (!step.autoWidth) {  		in_w = step.w == -1 ? area.height() : step.w; -		switch(step.xAlign) { -			case Graphics::DrawStep::kVectorAlignManual: -				if (step.x >= 0) in_x = area.left + step.x; -				else in_x = area.left + area.width() + step.x; // value relative to the opposite corner. -				break; - -			case Graphics::DrawStep::kVectorAlignCenter: -				in_x = area.left + (area.width() / 2) - (in_w / 2); -				break; - -			case Graphics::DrawStep::kVectorAlignLeft: -				in_x = area.left; -				break; - -			case Graphics::DrawStep::kVectorAlignRight: -				in_x = area.left + area.width() - in_w; -				break; - -			default: -				error("Vertical alignment in horizontal data."); +		switch (step.xAlign) { +		case Graphics::DrawStep::kVectorAlignManual: +			if (step.x >= 0) in_x = area.left + step.x; +			else in_x = area.left + area.width() + step.x; // value relative to the opposite corner. +			break; + +		case Graphics::DrawStep::kVectorAlignCenter: +			in_x = area.left + (area.width() / 2) - (in_w / 2); +			break; + +		case Graphics::DrawStep::kVectorAlignLeft: +			in_x = area.left; +			break; + +		case Graphics::DrawStep::kVectorAlignRight: +			in_x = area.left + area.width() - in_w; +			break; + +		default: +			error("Vertical alignment in horizontal data.");  		}  	} else {  		in_x = area.left; @@ -113,26 +113,26 @@ void VectorRenderer::stepGetPositions(const DrawStep &step, const Common::Rect &  	if (!step.autoHeight) {  		in_h = step.h == -1 ? area.width() : step.h; -		switch(step.yAlign) { -			case Graphics::DrawStep::kVectorAlignManual: -				if (step.y >= 0) in_y = area.top + step.y; -				else in_y = area.top + area.height() + step.y; // relative -				break; +		switch (step.yAlign) { +		case Graphics::DrawStep::kVectorAlignManual: +			if (step.y >= 0) in_y = area.top + step.y; +			else in_y = area.top + area.height() + step.y; // relative +			break; -			case Graphics::DrawStep::kVectorAlignCenter: -				in_y = area.top + (area.height() / 2) - (in_h / 2); -				break; +		case Graphics::DrawStep::kVectorAlignCenter: +			in_y = area.top + (area.height() / 2) - (in_h / 2); +			break; -			case Graphics::DrawStep::kVectorAlignTop: -				in_y = area.top; -				break; +		case Graphics::DrawStep::kVectorAlignTop: +			in_y = area.top; +			break; -			case Graphics::DrawStep::kVectorAlignBottom: -				in_y = area.top + area.height() - in_h; -				break; +		case Graphics::DrawStep::kVectorAlignBottom: +			in_y = area.top + area.height() - in_h; +			break; -			default: -				error("Horizontal alignment in vertical data."); +		default: +			error("Horizontal alignment in vertical data.");  		}  	} else {  		in_y = area.top; diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index a575ee8b94..bb52874230 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -700,7 +700,7 @@ drawTriangle(int x, int y, int w, int h, TriangleOrientation orient) {  	int newW = w / 2;  	if (newW % 2) newW++; -	switch(orient) { +	switch (orient) {  		case kTriangleUp:  		case kTriangleDown:  			drawTriangleFast(x + (newW / 2), y + (h / 2) - (newW / 2), newW, (orient == kTriangleDown), color, Base::_fillMode); @@ -1028,7 +1028,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color  		int dysub = ddy - (dx * 2);  		int error_term = ddy - dx; -		switch(fill_m) { +		switch (fill_m) {  		case kFillDisabled:  			while (dx--) {  				__TRIANGLE_MAINX(); @@ -1060,7 +1060,7 @@ drawTriangleVertAlg(int x1, int y1, int w, int h, bool inverted, PixelType color  		int dxsub = ddx - (dy * 2);  		int error_term = ddx - dy; -		switch(fill_m) { +		switch (fill_m) {  		case kFillDisabled:  			while (dy--) {  				__TRIANGLE_MAINY(); diff --git a/graphics/video/coktelvideo/indeo3.cpp b/graphics/video/coktelvideo/indeo3.cpp index 581f59b1b1..983705ab9c 100644 --- a/graphics/video/coktelvideo/indeo3.cpp +++ b/graphics/video/coktelvideo/indeo3.cpp @@ -96,7 +96,7 @@ void Indeo3::setDither(DitherAlgorithm dither) {  	_dither = dither; -	switch(dither) { +	switch (dither) {  	case kDitherSierraLight:  		_ditherSL = new Graphics::SierraLight(_width, _palLUT);  		break; @@ -538,7 +538,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,  				correction_lp[0] = correction_lp[1] = correction + (lv << 8);  			} -			switch(k) { +			switch (k) {  				case 1:  				case 0:                    /********** CASE 0 **********/  					for ( ; blks_height > 0; blks_height -= 4) { @@ -548,7 +548,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,  								cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2];  								ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2]; -								switch(correction_type_sp[0][k]) { +								switch (correction_type_sp[0][k]) {  									case 0:  										*cur_lp = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);  										lp2++; @@ -651,7 +651,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,  								cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];  								ref_lp = ((uint32 *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1]; -								switch(correction_type_sp[lp2 & 0x01][k]) { +								switch (correction_type_sp[lp2 & 0x01][k]) {  									case 0:  										cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);  										if (lp2 > 0 || flag1 == 0 || strip->ypos != 0) @@ -780,7 +780,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,  #endif  									} -									switch(correction_type_sp[lp2 & 0x01][k]) { +									switch (correction_type_sp[lp2 & 0x01][k]) {  										case 0:  											cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);  											cur_lp[width_tbl[1]+1] = FROM_LE_32(((FROM_LE_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1); @@ -935,7 +935,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,  									cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];  									ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2]; -									switch(correction_type_sp[lp2 & 0x01][k]) { +									switch (correction_type_sp[lp2 & 0x01][k]) {  										case 0:  											lv1 = correctionloworder_lp[lp2 & 0x01][k];  											lv2 = correctionhighorder_lp[lp2 & 0x01][k]; @@ -1038,7 +1038,7 @@ void Indeo3::decodeChunk(byte *cur, byte *ref, int width, int height,  								cur_lp = ((uint32 *)cur_frm_pos) + width_tbl[lp2 * 2];  								ref_lp = ((uint32 *)ref_frm_pos) + width_tbl[lp2 * 2]; -								switch(correction_type_sp[lp2 & 0x01][k]) { +								switch (correction_type_sp[lp2 & 0x01][k]) {  									case 0:  										cur_lp[0] = FROM_LE_32(((FROM_LE_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);  										cur_lp[width_tbl[1]] = FROM_LE_32(((FROM_LE_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1); diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index e30e759e66..4d7c91686b 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -459,7 +459,7 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst  			if (stepNode->values.contains("orientation")) {  				val = stepNode->values["orientation"]; -				if ( val == "top") +				if (val == "top")  					drawstep->extraData = Graphics::VectorRenderer::kTriangleUp;  				else if (val == "bottom")  					drawstep->extraData = Graphics::VectorRenderer::kTriangleDown; @@ -622,7 +622,7 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {  		Graphics::TextAlign alignH = Graphics::kTextAlignLeft;  		if (node->values.contains("textalign")) { -			if((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid) +			if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)  				return parserError("Invalid value for text alignment.");  		} @@ -847,7 +847,7 @@ bool ThemeParser::parseCommonLayoutProps(ParserNode *node, const Common::String  	if (node->values.contains("textalign")) {  		Graphics::TextAlign alignH = Graphics::kTextAlignLeft; -		if((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid) +		if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)  			return parserError("Invalid value for text alignment.");  		_theme->getEvaluator()->setVar(var + "Align", alignH); diff --git a/gui/about.cpp b/gui/about.cpp index 03927e6a40..0a9265cb13 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -100,7 +100,7 @@ AboutDialog::AboutDialog()  	_w = 0;  	for (i = 0; i < ARRAYSIZE(credits); i++) {  		int tmp = g_gui.getStringWidth(credits[i] + 5); -		if ( _w < tmp && tmp <= maxW) { +		if (_w < tmp && tmp <= maxW) {  			_w = tmp;  		}  	} @@ -311,7 +311,7 @@ void AboutDialog::reflowLayout() {  	_w = 0;  	for (int i = 0; i < ARRAYSIZE(credits); i++) {  		int tmp = g_gui.getStringWidth(credits[i] + 5); -		if ( _w < tmp && tmp <= maxW) { +		if (_w < tmp && tmp <= maxW) {  			_w = tmp;  		}  	} diff --git a/sound/mods/infogrames.cpp b/sound/mods/infogrames.cpp index a5b3ea1f35..62c66d7765 100644 --- a/sound/mods/infogrames.cpp +++ b/sound/mods/infogrames.cpp @@ -320,7 +320,7 @@ void Infogrames::getNextSample(Channel &chn) {  						chn.volSlide.curDelay2 = 0;  						break;  					case 0xE0: // 111xxxxx - Extended -						switch(cmd & 0x1F) { +						switch (cmd & 0x1F) {  						case 0: // Set period modifier  							chn.periodMod = (int8) *chn.cmds++;  							break; diff --git a/sound/shorten.cpp b/sound/shorten.cpp index e8066a49be..8f5f8456f7 100644 --- a/sound/shorten.cpp +++ b/sound/shorten.cpp @@ -116,13 +116,13 @@ ShortenGolombReader::ShortenGolombReader(Common::ReadStream *stream, int version  int32 ShortenGolombReader::getURice(uint32 numBits) {  	int32 result = 0; -	if(!_nbitget) { +	if (!_nbitget) {  		_buf = _stream->readUint32BE();  		_nbitget = 32;  	}  	for (result = 0; !(_buf & (1L << --_nbitget)); result++) { -		if(!_nbitget) { +		if (!_nbitget) {  			_buf = _stream->readUint32BE();  			_nbitget = 32;  		} diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp index 914b37b6eb..f3e768d08d 100644 --- a/sound/softsynth/mt32.cpp +++ b/sound/softsynth/mt32.cpp @@ -189,7 +189,7 @@ static void MT32_PrintDebug(void *userData, const char *fmt, va_list list) {  }  static int MT32_Report(void *userData, MT32Emu::ReportType type, const void *reportData) { -	switch(type) { +	switch (type) {  	case MT32Emu::ReportType_lcdMessage:  		g_system->displayMessageOnOSD((const char *)reportData);  		break; diff --git a/sound/softsynth/mt32/synth.cpp b/sound/softsynth/mt32/synth.cpp index c8b7abdf67..0f0d15686c 100644 --- a/sound/softsynth/mt32/synth.cpp +++ b/sound/softsynth/mt32/synth.cpp @@ -839,7 +839,7 @@ void Synth::readMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u len  	unsigned int m; -	switch(region->type) { +	switch (region->type) {  	case MR_PatchTemp:  		for (m = 0; m < len; m++)  			data[m] = ((Bit8u *)&mt32ram.patchSettings[first])[off + m]; diff --git a/sound/softsynth/opl/mame.cpp b/sound/softsynth/opl/mame.cpp index 559c84f717..906cf31626 100644 --- a/sound/softsynth/opl/mame.cpp +++ b/sound/softsynth/opl/mame.cpp @@ -289,11 +289,11 @@ void OPLBuildTables(int ENV_BITS_PARAM, int EG_ENT_PARAM) {  inline void OPL_STATUS_SET(FM_OPL *OPL, int flag) {  	/* set status flag */  	OPL->status |= flag; -	if(!(OPL->status & 0x80)) { -		if(OPL->status & OPL->statusmask) {	/* IRQ on */ +	if (!(OPL->status & 0x80)) { +		if (OPL->status & OPL->statusmask) {	/* IRQ on */  			OPL->status |= 0x80;  			/* callback user interrupt handler (IRQ is OFF to ON) */ -			if(OPL->IRQHandler) +			if (OPL->IRQHandler)  				(OPL->IRQHandler)(OPL->IRQParam,1);  		}  	} @@ -303,11 +303,11 @@ inline void OPL_STATUS_SET(FM_OPL *OPL, int flag) {  inline void OPL_STATUS_RESET(FM_OPL *OPL, int flag) {  	/* reset status flag */  	OPL->status &= ~flag; -	if((OPL->status & 0x80)) { +	if ((OPL->status & 0x80)) {  		if (!(OPL->status & OPL->statusmask)) {  			OPL->status &= 0x7f;  			/* callback user interrupt handler (IRQ is ON to OFF) */ -			if(OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,0); +			if (OPL->IRQHandler) (OPL->IRQHandler)(OPL->IRQParam,0);  		}  	}  } @@ -333,7 +333,7 @@ inline void OPL_KEYON(OPL_SLOT *SLOT) {  /* ----- key off ----- */  inline void OPL_KEYOFF(OPL_SLOT *SLOT) { -	if( SLOT->evm > ENV_MOD_RR) { +	if (SLOT->evm > ENV_MOD_RR) {  		/* set envelope counter from envleope output */  		// WORKAROUND: The Kyra engine does something very strange when @@ -364,7 +364,7 @@ inline void OPL_KEYOFF(OPL_SLOT *SLOT) {  		if (SLOT->evm == ENV_MOD_AR && SLOT->evc == EG_AST)  			SLOT->evc = EG_DED; -		else if( !(SLOT->evc & EG_DST) ) +		else if (!(SLOT->evc & EG_DST))  			//SLOT->evc = (ENV_CURVE[SLOT->evc>>ENV_BITS]<<ENV_BITS) + EG_DST;  			SLOT->evc = EG_DST;  		SLOT->eve = EG_DED; @@ -378,8 +378,8 @@ inline void OPL_KEYOFF(OPL_SLOT *SLOT) {  /* return : envelope output */  inline uint OPL_CALC_SLOT(OPL_SLOT *SLOT) {  	/* calcrate envelope generator */ -	if((SLOT->evc += SLOT->evs) >= SLOT->eve) { -		switch( SLOT->evm ) { +	if ((SLOT->evc += SLOT->evs) >= SLOT->eve) { +		switch (SLOT->evm) {  		case ENV_MOD_AR: /* ATTACK -> DECAY1 */  			/* next DR */  			SLOT->evm = ENV_MOD_DR; @@ -390,7 +390,7 @@ inline uint OPL_CALC_SLOT(OPL_SLOT *SLOT) {  		case ENV_MOD_DR: /* DECAY -> SL or RR */  			SLOT->evc = SLOT->SL;  			SLOT->eve = EG_DED; -			if(SLOT->eg_typ) { +			if (SLOT->eg_typ) {  				SLOT->evs = 0;  			} else {  				SLOT->evm = ENV_MOD_RR; @@ -423,7 +423,7 @@ inline void CALC_FCSLOT(OPL_CH *CH, OPL_SLOT *SLOT) {  	SLOT->Incr = CH->fc * SLOT->mul;  	ksr = CH->kcode >> SLOT->KSR; -	if( SLOT->ksr != ksr ) { +	if (SLOT->ksr != ksr) {  		SLOT->ksr = ksr;  		/* attack , decay rate recalcration */  		SLOT->evsa = SLOT->AR[ksr]; @@ -455,7 +455,7 @@ inline void set_ksl_tl(FM_OPL *OPL, int slot, int v) {  	SLOT->ksl = ksl ? 3-ksl : 31;  	SLOT->TL  = (int)((v & 0x3f) * (0.75 / EG_STEP)); /* 0.75db step */ -	if(!(OPL->mode & 0x80)) {	/* not CSM latch total level */ +	if (!(OPL->mode & 0x80)) {	/* not CSM latch total level */  		SLOT->TLL = SLOT->TL + (CH->ksl_base >> SLOT->ksl);  	}  } @@ -469,12 +469,12 @@ inline void set_ar_dr(FM_OPL *OPL, int slot, int v) {  	SLOT->AR = ar ? &OPL->AR_TABLE[ar << 2] : RATE_0;  	SLOT->evsa = SLOT->AR[SLOT->ksr]; -	if(SLOT->evm == ENV_MOD_AR) +	if (SLOT->evm == ENV_MOD_AR)  		SLOT->evs = SLOT->evsa;  	SLOT->DR = dr ? &OPL->DR_TABLE[dr<<2] : RATE_0;  	SLOT->evsd = SLOT->DR[SLOT->ksr]; -	if(SLOT->evm == ENV_MOD_DR) +	if (SLOT->evm == ENV_MOD_DR)  		SLOT->evs = SLOT->evsd;  } @@ -486,11 +486,11 @@ inline void set_sl_rr(FM_OPL *OPL, int slot, int v) {  	int rr = v & 0x0f;  	SLOT->SL = SL_TABLE[sl]; -	if(SLOT->evm == ENV_MOD_DR) +	if (SLOT->evm == ENV_MOD_DR)  		SLOT->eve = SLOT->SL;  	SLOT->RR = &OPL->DR_TABLE[rr<<2];  	SLOT->evsr = SLOT->RR[SLOT->ksr]; -	if(SLOT->evm == ENV_MOD_RR) +	if (SLOT->evm == ENV_MOD_RR)  		SLOT->evs = SLOT->evsr;  } @@ -506,14 +506,14 @@ inline void OPL_CALC_CH(OPL_CH *CH) {  	/* SLOT 1 */  	SLOT = &CH->SLOT[SLOT1];  	env_out=OPL_CALC_SLOT(SLOT); -	if(env_out < (uint)(EG_ENT - 1)) { +	if (env_out < (uint)(EG_ENT - 1)) {  		/* PG */ -		if(SLOT->vib) +		if (SLOT->vib)  			SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;  		else  			SLOT->Cnt += SLOT->Incr;  		/* connection */ -		if(CH->FB) { +		if (CH->FB) {  			int feedback1 = (CH->op1_out[0] + CH->op1_out[1]) >> CH->FB;  			CH->op1_out[1] = CH->op1_out[0];  			*CH->connect1 += CH->op1_out[0] = OP_OUT(SLOT, env_out, feedback1); @@ -527,9 +527,9 @@ inline void OPL_CALC_CH(OPL_CH *CH) {  	/* SLOT 2 */  	SLOT = &CH->SLOT[SLOT2];  	env_out=OPL_CALC_SLOT(SLOT); -	if(env_out < (uint)(EG_ENT - 1)) { +	if (env_out < (uint)(EG_ENT - 1)) {  		/* PG */ -		if(SLOT->vib) +		if (SLOT->vib)  			SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;  		else  			SLOT->Cnt += SLOT->Incr; @@ -558,14 +558,14 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {  	/* SLOT 1 */  	SLOT = &CH[6].SLOT[SLOT1];  	env_out = OPL_CALC_SLOT(SLOT); -	if(env_out < EG_ENT-1) { +	if (env_out < EG_ENT-1) {  		/* PG */ -		if(SLOT->vib) +		if (SLOT->vib)  			SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;  		else  			SLOT->Cnt += SLOT->Incr;  		/* connection */ -		if(CH[6].FB) { +		if (CH[6].FB) {  			int feedback1 = (CH[6].op1_out[0] + CH[6].op1_out[1]) >> CH[6].FB;  			CH[6].op1_out[1] = CH[6].op1_out[0];  			feedback2 = CH[6].op1_out[0] = OP_OUT(SLOT, env_out, feedback1); @@ -581,9 +581,9 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {  	/* SLOT 2 */  	SLOT = &CH[6].SLOT[SLOT2];  	env_out = OPL_CALC_SLOT(SLOT); -	if(env_out < EG_ENT-1) { +	if (env_out < EG_ENT-1) {  		/* PG */ -		if(SLOT->vib) +		if (SLOT->vib)  			SLOT->Cnt += (SLOT->Incr * vib) >> VIB_RATE_SHIFT;  		else  			SLOT->Cnt += SLOT->Incr; @@ -601,19 +601,19 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {  	env_hh = OPL_CALC_SLOT(SLOT7_1) + whitenoise;  	/* PG */ -	if(SLOT7_1->vib) +	if (SLOT7_1->vib)  		SLOT7_1->Cnt += (SLOT7_1->Incr * vib) >> (VIB_RATE_SHIFT-1);  	else  		SLOT7_1->Cnt += 2 * SLOT7_1->Incr; -	if(SLOT7_2->vib) +	if (SLOT7_2->vib)  		SLOT7_2->Cnt += (CH[7].fc * vib) >> (VIB_RATE_SHIFT-3);  	else  		SLOT7_2->Cnt += (CH[7].fc * 8); -	if(SLOT8_1->vib) +	if (SLOT8_1->vib)  		SLOT8_1->Cnt += (SLOT8_1->Incr * vib) >> VIB_RATE_SHIFT;  	else  		SLOT8_1->Cnt += SLOT8_1->Incr; -	if(SLOT8_2->vib) +	if (SLOT8_2->vib)  		SLOT8_2->Cnt += ((CH[8].fc * 3) * vib) >> (VIB_RATE_SHIFT-4);  	else  		SLOT8_2->Cnt += (CH[8].fc * 48); @@ -621,16 +621,16 @@ inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {  	tone8 = OP_OUT(SLOT8_2,whitenoise,0 );  	/* SD */ -	if(env_sd < (uint)(EG_ENT - 1)) +	if (env_sd < (uint)(EG_ENT - 1))  		outd[0] += OP_OUT(SLOT7_1, env_sd, 0) * 8;  	/* TAM */ -	if(env_tam < (uint)(EG_ENT - 1)) +	if (env_tam < (uint)(EG_ENT - 1))  		outd[0] += OP_OUT(SLOT8_1, env_tam, 0) * 2;  	/* TOP-CY */ -	if(env_top < (uint)(EG_ENT - 1)) +	if (env_top < (uint)(EG_ENT - 1))  		outd[0] += OP_OUT(SLOT7_2, env_top, tone8) * 2;  	/* HH */ -	if(env_hh  < (uint)(EG_ENT-1)) +	if (env_hh  < (uint)(EG_ENT-1))  		outd[0] += OP_OUT(SLOT7_2, env_hh, tone8) * 2;  } @@ -644,7 +644,7 @@ static void init_timetables(FM_OPL *OPL, int ARRATE, int DRRATE) {  		OPL->AR_TABLE[i] = OPL->DR_TABLE[i] = 0;  	for (i = 4; i <= 60; i++) {  		rate = OPL->freqbase;						/* frequency rate */ -		if(i < 60) +		if (i < 60)  			rate *= 1.0 + (i & 3) * 0.25;		/* b0-1 : x1 , x1.25 , x1.5 , x1.75 */  		rate *= 1 << ((i >> 2) - 1);						/* b2-5 : shift bit */  		rate *= (double)(EG_ENT << ENV_BITS); @@ -672,22 +672,22 @@ static int OPLOpenTable(void) {  #else  	/* allocate dynamic tables */ -	if((TL_TABLE = (int *)malloc(TL_MAX * 2 * sizeof(int))) == NULL) +	if ((TL_TABLE = (int *)malloc(TL_MAX * 2 * sizeof(int))) == NULL)  		return 0; -	if((SIN_TABLE = (int **)malloc(SIN_ENT * 4 * sizeof(int *))) == NULL) { +	if ((SIN_TABLE = (int **)malloc(SIN_ENT * 4 * sizeof(int *))) == NULL) {  		free(TL_TABLE);  		return 0;  	}  #endif -	if((AMS_TABLE = (int *)malloc(AMS_ENT * 2 * sizeof(int))) == NULL) { +	if ((AMS_TABLE = (int *)malloc(AMS_ENT * 2 * sizeof(int))) == NULL) {  		free(TL_TABLE);  		free(SIN_TABLE);  		return 0;  	} -	if((VIB_TABLE = (int *)malloc(VIB_ENT * 2 * sizeof(int))) == NULL) { +	if ((VIB_TABLE = (int *)malloc(VIB_ENT * 2 * sizeof(int))) == NULL) {  		free(TL_TABLE);  		free(SIN_TABLE);  		free(AMS_TABLE); @@ -730,7 +730,7 @@ static int OPLOpenTable(void) {  	for (i=0; i < EG_ENT; i++) {  		/* ATTACK curve */  		pom = pow(((double)(EG_ENT - 1 - i) / EG_ENT), 8) * EG_ENT; -		/* if( pom >= EG_ENT ) pom = EG_ENT-1; */ +		/* if (pom >= EG_ENT) pom = EG_ENT-1; */  		ENV_CURVE[i] = (int)pom;  		/* DECAY ,RELEASE curve */  		ENV_CURVE[(EG_DST >> ENV_BITS) + i]= i; @@ -788,7 +788,7 @@ static void OPL_initalize(FM_OPL *OPL) {  	/* make time tables */  	init_timetables(OPL, OPL_ARRATE, OPL_DRRATE);  	/* make fnumber -> increment counter table */ -	for( fn=0; fn < 1024; fn++) { +	for (fn=0; fn < 1024; fn++) {  		OPL->FN_TABLE[fn] = (uint)(OPL->freqbase * fn * FREQ_RATE * (1<<7) / 2);  	}  	/* LFO freq.table */ @@ -802,17 +802,17 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  	int slot;  	uint block_fnum; -	switch(r & 0xe0) { +	switch (r & 0xe0) {  	case 0x00: /* 00-1f:controll */ -		switch(r & 0x1f) { +		switch (r & 0x1f) {  		case 0x01:  			/* wave selector enable */ -			if(OPL->type&OPL_TYPE_WAVESEL) { +			if (OPL->type&OPL_TYPE_WAVESEL) {  				OPL->wavesel = v & 0x20; -				if(!OPL->wavesel) { +				if (!OPL->wavesel) {  					/* preset compatible mode */  					int c; -					for(c=0; c<OPL->max_ch; c++) { +					for (c = 0; c < OPL->max_ch; c++) {  						OPL->P_CH[c].SLOT[SLOT1].wavetable = &SIN_TABLE[0];  						OPL->P_CH[c].SLOT[SLOT2].wavetable = &SIN_TABLE[0];  					} @@ -826,7 +826,7 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  			OPL->T[1] = (256-v) * 16;  			return;  		case 0x04:	/* IRQ clear / mask and Timer enable */ -			if(v & 0x80) {	/* IRQ flag clear */ +			if (v & 0x80) {	/* IRQ flag clear */  				OPL_STATUS_RESET(OPL, 0x7f);  			} else {	/* set IRQ mask ,timer enable*/  				uint8 st1 = v & 1; @@ -835,13 +835,13 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  				OPL_STATUS_RESET(OPL, v & 0x78);  				OPL_STATUSMASK_SET(OPL,((~v) & 0x78) | 0x01);  				/* timer 2 */ -				if(OPL->st[1] != st2) { +				if (OPL->st[1] != st2) {  					double interval = st2 ? (double)OPL->T[1] * OPL->TimerBase : 0.0;  					OPL->st[1] = st2;  					if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam + 1, interval);  				}  				/* timer 1 */ -				if(OPL->st[0] != st1) { +				if (OPL->st[0] != st1) {  					double interval = st1 ? (double)OPL->T[0] * OPL->TimerBase : 0.0;  					OPL->st[0] = st1;  					if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam + 0, interval); @@ -852,30 +852,30 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  		break;  	case 0x20:	/* am,vib,ksr,eg type,mul */  		slot = slot_array[r&0x1f]; -		if(slot == -1) +		if (slot == -1)  			return;  		set_mul(OPL,slot,v);  		return;  	case 0x40:  		slot = slot_array[r&0x1f]; -		if(slot == -1) +		if (slot == -1)  			return;  		set_ksl_tl(OPL,slot,v);  		return;  	case 0x60:  		slot = slot_array[r&0x1f]; -		if(slot == -1) +		if (slot == -1)  			return;  		set_ar_dr(OPL,slot,v);  		return;  	case 0x80:  		slot = slot_array[r&0x1f]; -		if(slot == -1) +		if (slot == -1)  			return;  		set_sl_rr(OPL,slot,v);  		return;  	case 0xa0: -		switch(r) { +		switch (r) {  		case 0xbd:  			/* amsep,vibdep,r,bd,sd,tom,tc,hh */  			{ @@ -883,10 +883,10 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  			OPL->ams_table = &AMS_TABLE[v & 0x80 ? AMS_ENT : 0];  			OPL->vib_table = &VIB_TABLE[v & 0x40 ? VIB_ENT : 0];  			OPL->rythm  = v & 0x3f; -			if(OPL->rythm & 0x20) { +			if (OPL->rythm & 0x20) {  				/* BD key on/off */ -				if(rkey & 0x10) { -					if(v & 0x10) { +				if (rkey & 0x10) { +					if (v & 0x10) {  						OPL->P_CH[6].op1_out[0] = OPL->P_CH[6].op1_out[1] = 0;  						OPL_KEYON(&OPL->P_CH[6].SLOT[SLOT1]);  						OPL_KEYON(&OPL->P_CH[6].SLOT[SLOT2]); @@ -896,28 +896,28 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  					}  				}  				/* SD key on/off */ -				if(rkey & 0x08) { -					if(v & 0x08) +				if (rkey & 0x08) { +					if (v & 0x08)  						OPL_KEYON(&OPL->P_CH[7].SLOT[SLOT2]);  					else  						OPL_KEYOFF(&OPL->P_CH[7].SLOT[SLOT2]);  				}/* TAM key on/off */ -				if(rkey & 0x04) { -					if(v & 0x04) +				if (rkey & 0x04) { +					if (v & 0x04)  						OPL_KEYON(&OPL->P_CH[8].SLOT[SLOT1]);  					else  						OPL_KEYOFF(&OPL->P_CH[8].SLOT[SLOT1]);  				}  				/* TOP-CY key on/off */ -				if(rkey & 0x02) { -					if(v & 0x02) +				if (rkey & 0x02) { +					if (v & 0x02)  						OPL_KEYON(&OPL->P_CH[8].SLOT[SLOT2]);  					else  						OPL_KEYOFF(&OPL->P_CH[8].SLOT[SLOT2]);  				}  				/* HH key on/off */ -				if(rkey & 0x01) { -					if(v & 0x01) +				if (rkey & 0x01) { +					if (v & 0x01)  						OPL_KEYON(&OPL->P_CH[7].SLOT[SLOT1]);  					else  						OPL_KEYOFF(&OPL->P_CH[7].SLOT[SLOT1]); @@ -930,16 +930,16 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  			break;  		}  		/* keyon,block,fnum */ -		if((r & 0x0f) > 8) +		if ((r & 0x0f) > 8)  			return;  		CH = &OPL->P_CH[r & 0x0f]; -		if(!(r&0x10)) {	/* a0-a8 */ +		if (!(r&0x10)) {	/* a0-a8 */  			block_fnum  = (CH->block_fnum & 0x1f00) | v;  		} else {	/* b0-b8 */  			int keyon = (v >> 5) & 1;  			block_fnum = ((v & 0x1f) << 8) | (CH->block_fnum & 0xff); -			if(CH->keyon != keyon) { -				if((CH->keyon=keyon)) { +			if (CH->keyon != keyon) { +				if ((CH->keyon=keyon)) {  					CH->op1_out[0] = CH->op1_out[1] = 0;  					OPL_KEYON(&CH->SLOT[SLOT1]);  					OPL_KEYON(&CH->SLOT[SLOT2]); @@ -950,14 +950,14 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  			}  		}  		/* update */ -		if(CH->block_fnum != block_fnum) { +		if (CH->block_fnum != block_fnum) {  			int blockRv = 7 - (block_fnum >> 10);  			int fnum = block_fnum & 0x3ff;  			CH->block_fnum = block_fnum;  			CH->ksl_base = KSL_TABLE[block_fnum >> 6];  			CH->fc = OPL->FN_TABLE[fnum] >> blockRv;  			CH->kcode = CH->block_fnum >> 9; -			if((OPL->mode & 0x40) && CH->block_fnum & 0x100) +			if ((OPL->mode & 0x40) && CH->block_fnum & 0x100)  				CH->kcode |=1;  			CALC_FCSLOT(CH,&CH->SLOT[SLOT1]);  			CALC_FCSLOT(CH,&CH->SLOT[SLOT2]); @@ -965,7 +965,7 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  		return;  	case 0xc0:  		/* FB,C */ -		if((r & 0x0f) > 8) +		if ((r & 0x0f) > 8)  			return;  		CH = &OPL->P_CH[r&0x0f];  		{ @@ -977,10 +977,10 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  		return;  	case 0xe0: /* wave type */  		slot = slot_array[r & 0x1f]; -		if(slot == -1) +		if (slot == -1)  			return;  		CH = &OPL->P_CH[slot>>1]; -		if(OPL->wavesel) { +		if (OPL->wavesel) {  			CH->SLOT[slot&1].wavetable = &SIN_TABLE[(v & 0x03) * SIN_ENT];  		}  		return; @@ -990,12 +990,12 @@ void OPLWriteReg(FM_OPL *OPL, int r, int v) {  /* lock/unlock for common table */  static int OPL_LockTable(void) {  	num_lock++; -	if(num_lock>1) +	if (num_lock>1)  		return 0;  	/* first time */  	cur_chip = NULL;  	/* allocate total level table (128kb space) */ -	if(!OPLOpenTable()) { +	if (!OPLOpenTable()) {  		num_lock--;  		return -1;  	} @@ -1003,9 +1003,9 @@ static int OPL_LockTable(void) {  }  static void OPL_UnLockTable(void) { -	if(num_lock) +	if (num_lock)  		num_lock--; -	if(num_lock) +	if (num_lock)  		return;  	/* last time */  	cur_chip = NULL; @@ -1027,7 +1027,7 @@ void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length) {  	OPL_CH *CH, *R_CH; -	if((void *)OPL != cur_chip) { +	if ((void *)OPL != cur_chip) {  		cur_chip = (void *)OPL;  		/* channel pointers */  		S_CH = OPL->P_CH; @@ -1044,17 +1044,17 @@ void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length) {  		vib_table = OPL->vib_table;  	}  	R_CH = rythm ? &S_CH[6] : E_CH; -	for(i = 0; i < length; i++) { +	for (i = 0; i < length; i++) {  		/*            channel A         channel B         channel C      */  		/* LFO */  		ams = ams_table[(amsCnt += amsIncr) >> AMS_SHIFT];  		vib = vib_table[(vibCnt += vibIncr) >> VIB_SHIFT];  		outd[0] = 0;  		/* FM part */ -		for(CH=S_CH; CH < R_CH; CH++) +		for (CH = S_CH; CH < R_CH; CH++)  			OPL_CALC_CH(CH);  		/* Rythn part */ -		if(rythm) +		if (rythm)  			OPL_CALC_RH(OPL, S_CH);  		/* limit check */  		data = CLIP(outd[0], OPL_MINOUT, OPL_MAXOUT); @@ -1079,13 +1079,13 @@ void OPLResetChip(FM_OPL *OPL) {  	OPLWriteReg(OPL, 0x02,0); /* Timer1 */  	OPLWriteReg(OPL, 0x03,0); /* Timer2 */  	OPLWriteReg(OPL, 0x04,0); /* IRQ mask clear */ -	for(i = 0xff; i >= 0x20; i--) +	for (i = 0xff; i >= 0x20; i--)  		OPLWriteReg(OPL,i,0);  	/* reset OPerator parameter */ -	for(c = 0; c < OPL->max_ch ;c++ ) { +	for (c = 0; c < OPL->max_ch ;c++ ) {  		OPL_CH *CH = &OPL->P_CH[c];  		/* OPL->P_CH[c].PAN = OPN_CENTER; */ -		for(s = 0; s < 2; s++ ) { +		for (s = 0; s < 2; s++ ) {  			/* wave table */  			CH->SLOT[s].wavetable = &SIN_TABLE[0];  			/* CH->SLOT[s].evm = ENV_MOD_RR; */ @@ -1104,7 +1104,7 @@ FM_OPL *OPLCreate(int type, int clock, int rate) {  	int state_size;  	int max_ch = 9; /* normaly 9 channels */ -	if( OPL_LockTable() == -1) +	if (OPL_LockTable() == -1)  		return NULL;  	/* allocate OPL state space */  	state_size  = sizeof(FM_OPL); @@ -1112,7 +1112,7 @@ FM_OPL *OPLCreate(int type, int clock, int rate) {  	/* allocate memory block */  	ptr = (char *)calloc(state_size, 1); -	if(ptr == NULL) +	if (ptr == NULL)  		return NULL;  	/* clear */ @@ -1158,10 +1158,10 @@ void OPLSetUpdateHandler(FM_OPL *OPL, OPL_UPDATEHANDLER UpdateHandler,int param)  /* ---------- YM3812 I/O interface ---------- */  int OPLWrite(FM_OPL *OPL,int a,int v) { -	if(!(a & 1)) {	/* address port */ +	if (!(a & 1)) {	/* address port */  		OPL->address = v & 0xff;  	} else {	/* data port */ -		if(OPL->UpdateHandler) +		if (OPL->UpdateHandler)  			OPL->UpdateHandler(OPL->UpdateParam,0);  		OPLWriteReg(OPL, OPL->address,v);  	} @@ -1169,11 +1169,11 @@ int OPLWrite(FM_OPL *OPL,int a,int v) {  }  unsigned char OPLRead(FM_OPL *OPL,int a) { -	if(!(a & 1)) {	/* status port */ +	if (!(a & 1)) {	/* status port */  		return OPL->status & (OPL->statusmask | 0x80);  	}  	/* data port */ -	switch(OPL->address) { +	switch (OPL->address) {  	case 0x05: /* KeyBoard IN */  		warning("OPL:read unmapped KEYBOARD port");  		return 0; @@ -1189,16 +1189,16 @@ unsigned char OPLRead(FM_OPL *OPL,int a) {  }  int OPLTimerOver(FM_OPL *OPL, int c) { -	if(c) {	/* Timer B */ +	if (c) {	/* Timer B */  		OPL_STATUS_SET(OPL, 0x20);  	} else {	/* Timer A */  		OPL_STATUS_SET(OPL, 0x40);  		/* CSM mode key,TL controll */ -		if(OPL->mode & 0x80) {	/* CSM mode total level latch and auto key on */ +		if (OPL->mode & 0x80) {	/* CSM mode total level latch and auto key on */  			int ch; -			if(OPL->UpdateHandler) +			if (OPL->UpdateHandler)  				OPL->UpdateHandler(OPL->UpdateParam,0); -			for(ch = 0; ch < 9; ch++) +			for (ch = 0; ch < 9; ch++)  				CSMKeyControll(&OPL->P_CH[ch]);  		}  	} diff --git a/sound/vag.cpp b/sound/vag.cpp index a08c1c0a72..688db2ce1c 100644 --- a/sound/vag.cpp +++ b/sound/vag.cpp @@ -106,7 +106,7 @@ int VagStream::readBuffer(int16 *buffer, const int numSamples) {  			_samplesRemaining = 28 - i;  	} -	if(_loop && _stream->eos()) +	if (_loop && _stream->eos())  		rewind();  	return samplesDecoded; diff --git a/tools/create_lure/process_actions.cpp b/tools/create_lure/process_actions.cpp index 81db0de022..7ea45d8681 100644 --- a/tools/create_lure/process_actions.cpp +++ b/tools/create_lure/process_actions.cpp @@ -221,7 +221,7 @@ uint16 process_action_sequence_entry(int supportIndex, byte *data, uint16 remain  		for (int paramCtr = 0; paramCtr < numParams[actionNum]; ++paramCtr)  			params[paramCtr] = lureExe.readWord(); -		switch(actionNum) { +		switch (actionNum) {  		case NPC_SET_ROOM_AND_BLOCKED_OFFSET:  		case NPC_SET_SUPPORT_OFFSET:  		case NPC_SUPPORT_OFFSET_COND: diff --git a/tools/qtable/qtable.cpp b/tools/qtable/qtable.cpp index fe4eb07809..a659698688 100644 --- a/tools/qtable/qtable.cpp +++ b/tools/qtable/qtable.cpp @@ -147,7 +147,7 @@ static void createTableFile(TableFile *tf) {  	writeUint32BE(out, CURRENT_VERSION);  	/* write tables */  	offset = 4 + 4; -	for(i = 0; i < tf->dataFileEntriesTableCount; ++i) { +	for (i = 0; i < tf->dataFileEntriesTableCount; ++i) {  		const DataFileEntriesTable *dfet = &tf->dataFileEntriesTable[i];  		/* write number of entries in table */  		writeUint16BE(out, dfet->fileEntriesCount);  | 
