From f1a0d7dfb215708af1cc7fa6252c45b6ee5eca90 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 19 Oct 2008 21:06:26 +0000 Subject: Code formatting fixes svn-id: r34827 --- backends/platform/psp/osys_psp.cpp | 68 ++++++++++++++++++++------------------ backends/platform/psp/psp_main.cpp | 3 +- backends/platform/psp/trace.cpp | 5 --- 3 files changed, 36 insertions(+), 40 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index cf65ef13c9..9c2bacfef6 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -370,9 +370,9 @@ OverlayColor OSystem_PSP::RGBToColor(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); + 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) { @@ -385,11 +385,11 @@ OverlayColor OSystem_PSP::ARGBToColor(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; - else - a = 0; + colorToRGB(color, r, g, b); + if (color & 0x8000) + a = 255; + else + a = 0; } void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) { @@ -452,11 +452,9 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { if (buttonsChanged & (PSP_CTRL_CROSS | PSP_CTRL_CIRCLE | PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER | PSP_CTRL_START | PSP_CTRL_SELECT | PSP_CTRL_SQUARE)) { if (buttonsChanged & PSP_CTRL_CROSS) { event.type = (pad.Buttons & PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP; - } - else if (buttonsChanged & PSP_CTRL_CIRCLE) { + } else if (buttonsChanged & PSP_CTRL_CIRCLE) { event.type = (pad.Buttons & PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP; - } - else { + } else { //any of the other buttons. event.type = buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP; event.kbd.flags = 0; @@ -494,23 +492,23 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { if (pad.Lx < 100) { analogStepAmountX = pad.Lx - 100; - } - else if (pad.Lx > 155) { + } else if (pad.Lx > 155) { analogStepAmountX = pad.Lx - 155; } if (pad.Ly < 100) { analogStepAmountY = pad.Ly - 100; - } - else if (pad.Ly > 155) { + } else if (pad.Ly > 155) { analogStepAmountY = pad.Ly - 155; } if (pad.Buttons & PAD_DIR_MASK || analogStepAmountX != 0 || analogStepAmountY != 0) { if (_prevButtons & PAD_DIR_MASK) { - if (_padAccel < 16) _padAccel++; - } else _padAccel = 0; + if (_padAccel < 16) + _padAccel++; + } else + _padAccel = 0; _prevButtons = pad.Buttons; @@ -526,34 +524,38 @@ bool OSystem_PSP::pollEvent(Common::Event &event) { // If no movement then this has no effect if (pad.Buttons & PSP_CTRL_TRIANGLE) { // Fine control mode for analog - if (analogStepAmountX != 0) + if (analogStepAmountX != 0) { if (analogStepAmountX > 0) newX += analogStepAmountX - (analogStepAmountX - 1); else newX -= -analogStepAmountX - (-analogStepAmountX - 1); + } - if (analogStepAmountY != 0) + if (analogStepAmountY != 0) { if (analogStepAmountY > 0) newY += analogStepAmountY - (analogStepAmountY - 1); else newY -= -analogStepAmountY - (-analogStepAmountY - 1); - } - else { + } + } else { newX += analogStepAmountX >> ((_screenWidth == 640) ? 2 : 3); newY += analogStepAmountY >> ((_screenWidth == 640) ? 2 : 3); } - if (newX < 0) newX = 0; - if (newY < 0) newY = 0; - if (_overlayVisible) - { - if (newX >= _overlayWidth) newX = _overlayWidth - 1; - if (newY >= _overlayHeight) newY = _overlayHeight - 1; - } - else - { - if (newX >= _screenWidth) newX = _screenWidth - 1; - if (newY >= _screenHeight) newY = _screenHeight - 1; + if (newX < 0) + newX = 0; + if (newY < 0) + newY = 0; + if (_overlayVisible) { + if (newX >= _overlayWidth) + newX = _overlayWidth - 1; + if (newY >= _overlayHeight) + newY = _overlayHeight - 1; + } else { + if (newX >= _screenWidth) + newX = _screenWidth - 1; + if (newY >= _screenHeight) + newY = _screenHeight - 1; } if ((_mouseX != newX) || (_mouseY != newY)) { diff --git a/backends/platform/psp/psp_main.cpp b/backends/platform/psp/psp_main.cpp index 94ef63488d..e01f63973b 100644 --- a/backends/platform/psp/psp_main.cpp +++ b/backends/platform/psp/psp_main.cpp @@ -118,8 +118,7 @@ int SetupCallbacks(void) { } #undef main -int main(void) -{ +int main(void) { SetupCallbacks(); static char *argv[] = { "scummvm", NULL }; diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp index a4a409d455..00d19b582c 100644 --- a/backends/platform/psp/trace.cpp +++ b/backends/platform/psp/trace.cpp @@ -42,9 +42,7 @@ void PSPDebugTrace (const char *format, ...) { fd = sceIoOpen("MS0:/DTRACE.TXT", PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); if (fd <= 0) - { return; - } sceIoWrite(fd, (const void*)buff, bufsz); sceIoClose(fd); @@ -64,12 +62,9 @@ void PSPDebugTrace (const char * filename, const char *format, ...) { fd = sceIoOpen(filename, PSP_O_RDWR | PSP_O_CREAT | PSP_O_APPEND, 0777); if (fd <= 0) - { return; - } sceIoWrite(fd, (const void*)buff, bufsz); sceIoClose(fd); #endif } - -- cgit v1.2.3