[Scummvm-cvs-logs] SF.net SVN: scummvm: [22753] scummvm/trunk/backends/psp

joostp at users.sourceforge.net joostp at users.sourceforge.net
Mon May 29 11:07:02 CEST 2006


Revision: 22753
Author:   joostp
Date:     2006-05-29 11:06:02 -0700 (Mon, 29 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22753&view=rev

Log Message:
-----------
some cleanup

Modified Paths:
--------------
    scummvm/trunk/backends/psp/osys_psp.cpp
    scummvm/trunk/backends/psp/osys_psp_gu.cpp
Modified: scummvm/trunk/backends/psp/osys_psp.cpp
===================================================================
--- scummvm/trunk/backends/psp/osys_psp.cpp	2006-05-29 18:00:38 UTC (rev 22752)
+++ scummvm/trunk/backends/psp/osys_psp.cpp	2006-05-29 18:06:02 UTC (rev 22753)
@@ -80,43 +80,35 @@
 	if (_mouseBuf)	free(_mouseBuf);
 }
 
-bool OSystem_PSP::hasFeature(Feature f)
-{
+bool OSystem_PSP::hasFeature(Feature f) {
 	return false;
 }
 
-void OSystem_PSP::setFeatureState(Feature f, bool enable)
-{
+void OSystem_PSP::setFeatureState(Feature f, bool enable) {
 }
 
-bool OSystem_PSP::getFeatureState(Feature f)
-{
+bool OSystem_PSP::getFeatureState(Feature f) {
 	return false;
 }
 
-const OSystem::GraphicsMode* OSystem_PSP::getSupportedGraphicsModes() const
-{
+const OSystem::GraphicsMode* OSystem_PSP::getSupportedGraphicsModes() const {
 	return s_supportedGraphicsModes;
 }
 
 
-int OSystem_PSP::getDefaultGraphicsMode() const
-{
+int OSystem_PSP::getDefaultGraphicsMode() const {
 	return -1;
 }
 
-bool OSystem_PSP::setGraphicsMode(int mode)
-{
+bool OSystem_PSP::setGraphicsMode(int mode) {
 	return true;
 }
 
-bool OSystem_PSP::setGraphicsMode(const char *name)
-{
+bool OSystem_PSP::setGraphicsMode(const char *name) {
 	return true;
 }
 
-int OSystem_PSP::getGraphicsMode() const
-{
+int OSystem_PSP::getGraphicsMode() const {
 	return -1;
 }
 
@@ -240,29 +232,24 @@
 	_shakePos = shakeOffset;
 }
 
-void OSystem_PSP::showOverlay ()
-{
+void OSystem_PSP::showOverlay() {
 	_overlayVisible = true;
 }
 
-void OSystem_PSP::hideOverlay ()
-{
+void OSystem_PSP::hideOverlay() {
 	PSPDebugTrace("OSystem_PSP::hideOverlay called\n");
 	_overlayVisible = false;
 }
 
-void OSystem_PSP::clearOverlay ()
-{
+void OSystem_PSP::clearOverlay() {
 	PSPDebugTrace("clearOverlay\n");
 	bzero(_overlayBuffer, _overlayWidth * _overlayHeight * sizeof(OverlayColor));
 }
 
-void OSystem_PSP::grabOverlay (OverlayColor *buf, int pitch)
-{
+void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) {
 }
 
-void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h)
-{
+void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
 	PSPDebugTrace("copyRectToOverlay\n");
 	
 	//Clip the coordinates
@@ -302,30 +289,25 @@
 	}
 }
 
-int16 OSystem_PSP::getOverlayWidth()
-{
+int16 OSystem_PSP::getOverlayWidth() {
 	return _overlayWidth;
 }
 
-int16 OSystem_PSP::getOverlayHeight()
-{
+int16 OSystem_PSP::getOverlayHeight() {
 	return _overlayHeight;
 }
 
-OverlayColor OSystem_PSP::RGBToColor(uint8 r, uint8 g, uint8 b)
-{
+OverlayColor OSystem_PSP::RGBToColor(uint8 r, uint8 g, uint8 b) {
 	return (((r >> 3) & 0x1F) | (((g >> 3) & 0x1F) << 5) | (((b >> 3) & 0x1F) << 10 ) ) | 0x8000;
 }
 
-void OSystem_PSP::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b)
-{
+void OSystem_PSP::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
 		r = ((color & 0x1F) << 3);
 		g = (((color >> 5) & 0x1F) << 3);
 		b = (((color >> 10) & 0x1F) << 3);
 }
 	
-OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) 
-{
+OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
 	OverlayColor color = RGBToColor(r, g, b);
 
 	if(a == 255)
@@ -334,8 +316,7 @@
 	return color;
 }
 
-void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) 
-{
+void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
 		colorToRGB(color, r, g, b);
 		if(color & 0x8000)
 			a = 255;
@@ -343,13 +324,11 @@
 			a = 0;
 }
 
-void OSystem_PSP::grabPalette(byte *colors, uint start, uint num)
-{
+void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) {
 	uint i;
 	uint16 color;
 
-	for(i=start; i < start+num; i++)
-	{
+	for (i = start; i < start + num; i++) {
 		color = _palette[i];
 		*colors++ = ((color & 0x1F) << 3);
 		*colors++ = (((color >> 5) & 0x1F) << 3);
@@ -530,7 +509,6 @@
 }
 
 void OSystem_PSP::delayMillis(uint msecs) {	
-	sceKernelDelayThread(1);        // Sleep thread for 1 millionth of a second to allow callback threads to run
 	SDL_Delay(msecs);
 }
 

Modified: scummvm/trunk/backends/psp/osys_psp_gu.cpp
===================================================================
--- scummvm/trunk/backends/psp/osys_psp_gu.cpp	2006-05-29 18:00:38 UTC (rev 22752)
+++ scummvm/trunk/backends/psp/osys_psp_gu.cpp	2006-05-29 18:06:02 UTC (rev 22753)
@@ -114,13 +114,9 @@
 	_graphicMode = STRETCHED_480X272;
 	_keySelected = 1;
 	_keyboardMode = 0;
-	//_graphicMode = CENTERED_435X272;
-	//_graphicMode = CENTERED_320X200;
-	//_graphicMode = CENTERED_362X272;
 }
 
-OSystem_PSP_GU::~OSystem_PSP_GU()
-{
+OSystem_PSP_GU::~OSystem_PSP_GU() {
 	free(keyboard_symbols_shift);
 	free(keyboard_symbols);
 	free(keyboard_letters_shift);
@@ -155,25 +151,20 @@
 	sceKernelDcacheWritebackAll();
 }
 
-int OSystem_PSP_GU::getDefaultGraphicsMode() const
-{
+int OSystem_PSP_GU::getDefaultGraphicsMode() const {
 	return STRETCHED_480X272;
 }
 
-bool OSystem_PSP_GU::setGraphicsMode(int mode)
-{
+bool OSystem_PSP_GU::setGraphicsMode(int mode) {
 	_graphicMode = mode;
 	return true;
 }
 
-bool OSystem_PSP_GU::setGraphicsMode(const char *name)
-{
+bool OSystem_PSP_GU::setGraphicsMode(const char *name) {
 	int i = 0;
 
-	while(s_supportedGraphicsModes[i].name)
-	{
-		if(!strcmpi(s_supportedGraphicsModes[i].name, name))
-		{
+	while(s_supportedGraphicsModes[i].name) {
+		if(!strcmpi(s_supportedGraphicsModes[i].name, name)) {
 			_graphicMode = s_supportedGraphicsModes[i].id;
 			return true;
 		}
@@ -183,8 +174,7 @@
 	return false;
 }
 
-int OSystem_PSP_GU::getGraphicsMode() const
-{
+int OSystem_PSP_GU::getGraphicsMode() const {
 	return _graphicMode;
 }
 
@@ -225,8 +215,7 @@
 }
 
 
-void OSystem_PSP_GU::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) 
-{
+void OSystem_PSP_GU::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
 	//Clip the coordinates
 	if (x < 0) {
 		w += x;
@@ -275,9 +264,7 @@
 	}
 }
 
-void
-OSystem_PSP_GU::updateScreen()
-{
+void OSystem_PSP_GU::updateScreen() {
 	float scale;
 
 	sceGuStart(0,list);
@@ -300,24 +287,23 @@
 
 	struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
 	vertices[0].u = 0.5; vertices[0].v = 0.5;
-	vertices[1].u = _screenWidth-0.5; vertices[1].v = _screenHeight-0.5;
-	switch(_graphicMode)
-	{
+	vertices[1].u = _screenWidth - 0.5; vertices[1].v = _screenHeight - 0.5;
+	switch(_graphicMode) {
 		case CENTERED_320X200:
-			vertices[0].x = (PSP_SCREEN_WIDTH-320)/2; vertices[0].y = (PSP_SCREEN_HEIGHT-200)/2; vertices[0].z = 0;
-			vertices[1].x = PSP_SCREEN_WIDTH-(PSP_SCREEN_WIDTH-320)/2; vertices[1].y = PSP_SCREEN_HEIGHT-(PSP_SCREEN_HEIGHT-200)/2; vertices[1].z = 0;
+			vertices[0].x = (PSP_SCREEN_WIDTH - 320) / 2; vertices[0].y = (PSP_SCREEN_HEIGHT - 200) / 2; vertices[0].z = 0;
+			vertices[1].x = PSP_SCREEN_WIDTH - (PSP_SCREEN_WIDTH - 320) / 2; vertices[1].y = PSP_SCREEN_HEIGHT - (PSP_SCREEN_HEIGHT - 200) / 2; vertices[1].z = 0;
 		break;
 		case CENTERED_435X272:
-			vertices[0].x = (PSP_SCREEN_WIDTH-435)/2; vertices[0].y = 0; vertices[0].z = 0;
-			vertices[1].x = PSP_SCREEN_WIDTH-(PSP_SCREEN_WIDTH-435)/2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
+			vertices[0].x = (PSP_SCREEN_WIDTH - 435) / 2; vertices[0].y = 0; vertices[0].z = 0;
+			vertices[1].x = PSP_SCREEN_WIDTH - (PSP_SCREEN_WIDTH - 435) / 2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
 		break;
 		case STRETCHED_480X272:
 			vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0;
 			vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
 		break;
 		case CENTERED_362X272:
-			vertices[0].x = (PSP_SCREEN_WIDTH-362)/2; vertices[0].y = 0; vertices[0].z = 0;
-			vertices[1].x = PSP_SCREEN_WIDTH-(PSP_SCREEN_WIDTH-362)/2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
+			vertices[0].x = (PSP_SCREEN_WIDTH - 362) / 2; vertices[0].y = 0; vertices[0].z = 0;
+			vertices[1].x = PSP_SCREEN_WIDTH - (PSP_SCREEN_WIDTH - 362) / 2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
 		break;
 	}
 
@@ -326,25 +312,23 @@
 		vertices[1].y += _shakePos;
 	}
 
-	sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
-	if(_screenWidth==640)
-	{
+	sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
+	if(_screenWidth == 640) {
 		sceGuTexImage(0, 512, 512, _screenWidth, _offscreen+512);
-		vertices[0].u = 512 + 0.5; vertices[1].v = _screenHeight  - 0.5;
-		vertices[0].x += (vertices[1].x-vertices[0].x)*511/640; vertices[0].y = 0; vertices[0].z = 0;
-		sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
+		vertices[0].u = 512 + 0.5; vertices[1].v = _screenHeight - 0.5;
+		vertices[0].x += (vertices[1].x - vertices[0].x) * 511 / 640; vertices[0].y = 0; vertices[0].z = 0;
+		sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
 	}
 			
 	
 	// draw overlay
-	if(_overlayVisible)
-	{
+	if(_overlayVisible) {
 		vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0;
 		vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0;
 		vertices[0].u = 0.5; vertices[0].v = 0.5;
-		vertices[1].u = _overlayWidth-0.5; vertices[1].v = _overlayHeight-0.5;
+		vertices[1].u = _overlayWidth - 0.5; vertices[1].v = _overlayHeight - 0.5;
 		sceGuTexMode(GU_PSM_5551, 0, 0, 0); // 16-bit image
-		sceGuAlphaFunc(GU_GREATER,0,0xff);
+		sceGuAlphaFunc(GU_GREATER, 0, 0xff);
 		sceGuEnable(GU_ALPHA_TEST);
 		if (_overlayWidth > 320)
 			sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer);
@@ -354,18 +338,16 @@
 		sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); 
 		sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
 		// need to render twice for textures > 512
-		if( _overlayWidth > 512)
-		{
-			sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer+512);
+		if( _overlayWidth > 512) {
+			sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer + 512);
 			vertices[0].u = 512 + 0.5; vertices[1].v = _overlayHeight - 0.5;
-			vertices[0].x = PSP_SCREEN_WIDTH*512/640; vertices[0].y = 0; vertices[0].z = 0;
-			sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
+			vertices[0].x = PSP_SCREEN_WIDTH * 512 / 640; vertices[0].y = 0; vertices[0].z = 0;
+			sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
 		}
 	}
 	
 	// draw mouse
-   	if (_mouseVisible) 
-	{
+   	if (_mouseVisible) {
 		sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image
 		sceGuClutMode(GU_PSM_5551, 0, 0xff, 0);
 		sceGuClutLoad(32, mouseClut); // upload 32*8 entries (256)
@@ -375,72 +357,67 @@
 		sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); 
 		
 		vertices[0].u = 0.5; vertices[0].v = 0.5;
-		vertices[1].u = _mouseWidth-0.5; vertices[1].v = _mouseHeight-0.5;
+		vertices[1].u = _mouseWidth - 0.5; vertices[1].v = _mouseHeight - 0.5;
 
 		//adjust cursor position
 		int mX = _mouseX - _mouseHotspotX;
 		int mY = _mouseY - _mouseHotspotY;
 		
-		if(_overlayVisible)
-		{
+		if(_overlayVisible) {
 			float scalex, scaley;
 
-			scalex = (float)PSP_SCREEN_WIDTH/_overlayWidth;
-			scaley = (float)PSP_SCREEN_HEIGHT/_overlayHeight;
+			scalex = (float)PSP_SCREEN_WIDTH /_overlayWidth;
+			scaley = (float)PSP_SCREEN_HEIGHT /_overlayHeight;
 
-			vertices[0].x = mX*scalex; vertices[0].y = mY*scaley; vertices[0].z = 0;
-			vertices[1].x = vertices[0].x+_mouseWidth*scalex; vertices[1].y = vertices[0].y + _mouseHeight*scaley; vertices[0].z = 0;
-		}
-		else
-		switch(_graphicMode)
-		{
+			vertices[0].x = mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0;
+			vertices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0;
+		} else
+			switch(_graphicMode) {
 			case CENTERED_320X200:
-				vertices[0].x = (PSP_SCREEN_WIDTH-320)/2+mX; vertices[0].y = (PSP_SCREEN_HEIGHT-200)/2+mY; vertices[0].z = 0;
+				vertices[0].x = (PSP_SCREEN_WIDTH - 320) / 2 + mX; vertices[0].y = (PSP_SCREEN_HEIGHT - 200) / 2 + mY; vertices[0].z = 0;
 				vertices[1].x = vertices[0].x+_mouseWidth; vertices[1].y = vertices[0].y + _mouseHeight; vertices[1].z = 0;
 			break;
 			case CENTERED_435X272:
 			{
-				scale = 435.0f/_screenWidth;
-				vertices[0].x = (PSP_SCREEN_WIDTH-435)/2 +mX*scale; vertices[0].y = mY*scale; vertices[0].z = 0;
-				vertices[1].x = vertices[0].x+_mouseWidth*scale; vertices[1].y = vertices[0].y + _mouseHeight*scale; vertices[0].z = 0;
+				scale = 435.0f / _screenWidth;
+				vertices[0].x = (PSP_SCREEN_WIDTH - 435) / 2 + mX * scale; vertices[0].y = mY * scale; vertices[0].z = 0;
+				vertices[1].x = vertices[0].x + _mouseWidth * scale; vertices[1].y = vertices[0].y + _mouseHeight * scale; vertices[0].z = 0;
 			}
 			break;
 			case CENTERED_362X272:
 			{
 				float scalex, scaley;
 				
-				scalex = 362.0f/_screenWidth;
-				scaley = 272.0f/_screenHeight;
+				scalex = 362.0f / _screenWidth;
+				scaley = 272.0f / _screenHeight;
 
-				vertices[0].x = (PSP_SCREEN_WIDTH-362)/2 +mX*scalex; vertices[0].y = mY*scaley; vertices[0].z = 0;
-				vertices[1].x = vertices[0].x+_mouseWidth*scalex; vertices[1].y = vertices[0].y + _mouseHeight*scaley; vertices[0].z = 0;
+				vertices[0].x = (PSP_SCREEN_WIDTH - 362) / 2 + mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0;
+				vertices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0;
 			}
 			break;
 			case STRETCHED_480X272:
 			{
 				float scalex, scaley;
 
-				scalex = (float)PSP_SCREEN_WIDTH/_screenWidth;
-				scaley = (float)PSP_SCREEN_HEIGHT/_screenHeight;
+				scalex = (float)PSP_SCREEN_WIDTH / _screenWidth;
+				scaley = (float)PSP_SCREEN_HEIGHT / _screenHeight;
 				
-				vertices[0].x = mX*scalex; vertices[0].y = mY*scaley; vertices[0].z = 0;
-				vertices[1].x = vertices[0].x+_mouseWidth*scalex; vertices[1].y = vertices[0].y + _mouseHeight*scaley; vertices[0].z = 0;
+				vertices[0].x = mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0;
+				vertices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0;
 			}
 			break;
 		}
-		sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices);
+		sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
 	}
 
-	if(_keyboardVisible)
-	{
+	if(_keyboardVisible) {
 		sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image
 		sceGuClutMode(GU_PSM_4444, 0, 0xff, 0);
 		sceGuClutLoad(32, kbClut); // upload 32*8 entries (256)
 		sceGuDisable(GU_ALPHA_TEST);
 		sceGuEnable(GU_BLEND);
 		sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
-		switch(_keyboardMode)
-		{
+		switch(_keyboardMode) {
 			case 0:
 				sceGuTexImage(0, 512, 512, 480, keyboard_letters);
 				break;
@@ -484,8 +461,7 @@
 
 	uint32 buttonsChanged = pad.Buttons ^ _prevButtons;
 
-	if  ((buttonsChanged & PSP_CTRL_SELECT) || (pad.Buttons & PSP_CTRL_SELECT)) 
-	{
+	if  ((buttonsChanged & PSP_CTRL_SELECT) || (pad.Buttons & PSP_CTRL_SELECT)) {
 		if( !(pad.Buttons & PSP_CTRL_SELECT) )
 			_keyboardVisible = !_keyboardVisible;
 		_prevButtons = pad.Buttons;
@@ -501,8 +477,7 @@
 	if ( (buttonsChanged & PSP_CTRL_LTRIGGER) && !(pad.Buttons & PSP_CTRL_LTRIGGER))
 		_keyboardMode ^= SYMBOLS;
 
-	if ( (buttonsChanged & PSP_CTRL_LEFT) && !(pad.Buttons & PSP_CTRL_LEFT))
-	{
+	if ( (buttonsChanged & PSP_CTRL_LEFT) && !(pad.Buttons & PSP_CTRL_LEFT)) {
 		event.kbd.flags = 0;
 		event.kbd.ascii = 0;
 		event.kbd.keycode = SDLK_LEFT;
@@ -510,8 +485,7 @@
 		return true;
 	}
 	
-	if ( (buttonsChanged & PSP_CTRL_RIGHT) && !(pad.Buttons & PSP_CTRL_RIGHT))
-	{
+	if ( (buttonsChanged & PSP_CTRL_RIGHT) && !(pad.Buttons & PSP_CTRL_RIGHT)) {
 		event.kbd.flags = 0;
 		event.kbd.ascii = 0;
 		event.kbd.keycode = SDLK_RIGHT;
@@ -519,8 +493,7 @@
 		return true;
 	}
 	
-	if ( (buttonsChanged & PSP_CTRL_UP) && !(pad.Buttons & PSP_CTRL_UP))
-	{
+	if ( (buttonsChanged & PSP_CTRL_UP) && !(pad.Buttons & PSP_CTRL_UP)) {
 		event.kbd.flags = 0;
 		event.kbd.ascii = 0;
 		event.kbd.keycode = SDLK_UP;
@@ -528,8 +501,7 @@
 		return true;
 	}
 	
-	if ( (buttonsChanged & PSP_CTRL_DOWN) && !(pad.Buttons & PSP_CTRL_DOWN))
-	{
+	if ( (buttonsChanged & PSP_CTRL_DOWN) && !(pad.Buttons & PSP_CTRL_DOWN)) {
 		event.kbd.flags = 0;
 		event.kbd.ascii = 0;
 		event.kbd.keycode = SDLK_DOWN;
@@ -538,49 +510,41 @@
 	}
 	
 	// compute nub direction
-	//
 	x = pad.Lx-128;
 	y = pad.Ly-128;
 	_kbdClut[_keySelected] = 0xf888;
-	if(x*x + y*y > 10000)
-	{
+	if(x*x + y*y > 10000) {
 		nub_angle = atan2(y, x);
-		_keySelected = (int)(1+(M_PI+nub_angle)*30/(2*M_PI));
+		_keySelected = (int)(1 + (M_PI + nub_angle) * 30 / (2 * M_PI));
 		_keySelected -= 2;
 		if(_keySelected < 1)
 			_keySelected += 30;
 		_kbdClut[_keySelected] = 0xffff;
 	
-		if  (buttonsChanged & PSP_CTRL_CROSS) 
-		{
+		if  (buttonsChanged & PSP_CTRL_CROSS) {
 			event.type = (pad.Buttons & PSP_CTRL_CROSS) ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP;
-			if(_keySelected >26)
-			{
+			if(_keySelected > 26) {
 				event.kbd.flags = 0;
-				switch(_keySelected)
-				{
+				switch(_keySelected) {
 					case 27:
-					event.kbd.ascii = ' ';
-					event.kbd.keycode = SDLK_SPACE;
+						event.kbd.ascii = ' ';
+						event.kbd.keycode = SDLK_SPACE;
 					break;
 					case 28:
-					event.kbd.ascii = 127;
-					event.kbd.keycode = SDLK_DELETE;
+						event.kbd.ascii = 127;
+						event.kbd.keycode = SDLK_DELETE;
 					break;
 					case 29:
-					event.kbd.ascii = 8;
-					event.kbd.keycode = SDLK_BACKSPACE;
+						event.kbd.ascii = 8;
+						event.kbd.keycode = SDLK_BACKSPACE;
 					break;
 					case 30:
-					event.kbd.ascii = 13;
-					event.kbd.keycode = SDLK_RETURN;
+						event.kbd.ascii = 13;
+						event.kbd.keycode = SDLK_RETURN;
 					break;
 				}
-			}
-			else
-			{			
-				switch( _keyboardMode)
-				{
+			} else {			
+				switch( _keyboardMode) {
 					case 0:
 						event.kbd.flags = 0;
 						event.kbd.ascii = 'a'+_keySelected-1;
@@ -592,16 +556,14 @@
 						event.kbd.flags = KBD_SHIFT;
 						break;
 					case SYMBOLS:
-						if(_keySelected < 21)
-						{
+						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)
-						{
+						if(_keySelected < 21) {
 							event.kbd.flags = 0;
 							event.kbd.ascii = kbd_ascii_cl[_keySelected-1];
 							event.kbd.keycode = kbd_code_cl[ _keySelected-1];


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list