From 5ecc1fd7f0580a60c6563bfa3fe7ef8f22e212f4 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sat, 11 Aug 2012 02:44:12 +0200 Subject: WINTERMUTE: Format platform_osystem.cpp, wintermute.cpp and detection_tables.h --- engines/wintermute/detection_tables.h | 40 ++++++++++++------------- engines/wintermute/platform_osystem.cpp | 46 ++++++++++++++++++++-------- engines/wintermute/wintermute.cpp | 53 +++++++++++++++++++++------------ 3 files changed, 87 insertions(+), 52 deletions(-) (limited to 'engines') diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 0f15d1043e..272daea2d9 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -23,23 +23,23 @@ namespace WinterMute { static const PlainGameDescriptor wintermuteGames[] = { - {"5ld", "Five Lethal Demons"}, - {"5ma", "Five Magical Amulets"}, - {"actualdest", "Actual Destination"}, - {"chivalry", "Chivalry is Not Dead"}, - {"deadcity", "Dead City"}, - {"dirtysplit", "Dirty Split"}, - {"eastside", "East Side Story"}, - {"ghostsheet", "Ghost in the Sheet"}, - {"hamlet", "Hamlet or the last game without MMORPS features, shaders and product placement"}, - {"julia", "J.U.L.I.A."}, - {"mirage", "Mirage"}, - {"pigeons", "Pigeons in the Park"}, - {"reversion", "Reversion"}, - {"rosemary", "Rosemary"}, - {"thebox", "The Box"}, - {"twc", "the white chamber"}, - {"wintermute", "Wintermute engine game"}, + {"5ld", "Five Lethal Demons"}, + {"5ma", "Five Magical Amulets"}, + {"actualdest", "Actual Destination"}, + {"chivalry", "Chivalry is Not Dead"}, + {"deadcity", "Dead City"}, + {"dirtysplit", "Dirty Split"}, + {"eastside", "East Side Story"}, + {"ghostsheet", "Ghost in the Sheet"}, + {"hamlet", "Hamlet or the last game without MMORPS features, shaders and product placement"}, + {"julia", "J.U.L.I.A."}, + {"mirage", "Mirage"}, + {"pigeons", "Pigeons in the Park"}, + {"reversion", "Reversion"}, + {"rosemary", "Rosemary"}, + {"thebox", "The Box"}, + {"twc", "the white chamber"}, + {"wintermute", "Wintermute engine game"}, {0, 0} }; @@ -229,5 +229,5 @@ static const ADGameDescription gameDescriptions[] = { }, AD_TABLE_END_MARKER }; - + } // End of namespace WinterMute diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp index a23e606931..a1220cfa45 100644 --- a/engines/wintermute/platform_osystem.cpp +++ b/engines/wintermute/platform_osystem.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -51,37 +51,55 @@ void BasePlatform::handleEvent(Common::Event *event) { if (_gameRef) { if (_gameRef->isLeftDoubleClick()) { _gameRef->onMouseLeftDblClick(); + } else { + _gameRef->onMouseLeftDown(); } - else _gameRef->onMouseLeftDown(); } break; case Common::EVENT_RBUTTONDOWN: if (_gameRef) { - if (_gameRef->isRightDoubleClick()) _gameRef->onMouseRightDblClick(); - else _gameRef->onMouseRightDown(); + if (_gameRef->isRightDoubleClick()) { + _gameRef->onMouseRightDblClick(); + } else { + _gameRef->onMouseRightDown(); + } } break; case Common::EVENT_MBUTTONDOWN: - if (_gameRef) _gameRef->onMouseMiddleDown(); + if (_gameRef) { + _gameRef->onMouseMiddleDown(); + } break; case Common::EVENT_LBUTTONUP: - if (_gameRef) _gameRef->onMouseLeftUp(); + if (_gameRef) { + _gameRef->onMouseLeftUp(); + } break; case Common::EVENT_RBUTTONUP: - if (_gameRef) _gameRef->onMouseRightUp(); + if (_gameRef) { + _gameRef->onMouseRightUp(); + } break; case Common::EVENT_MBUTTONUP: - if (_gameRef) _gameRef->onMouseMiddleUp(); + if (_gameRef) { + _gameRef->onMouseMiddleUp(); + } break; case Common::EVENT_KEYDOWN: - if (_gameRef) _gameRef->handleKeypress(event); + if (_gameRef) { + _gameRef->handleKeypress(event); + } break; case Common::EVENT_KEYUP: - if (_gameRef) _gameRef->handleKeyRelease(event); + if (_gameRef) { + _gameRef->handleKeyRelease(event); + } break; case Common::EVENT_WHEELUP: case Common::EVENT_WHEELDOWN: - if (_gameRef) _gameRef->handleMouseWheel(event->mouse.y); + if (_gameRef) { + _gameRef->handleMouseWheel(event->mouse.y); + } break; // Focus-events have been removed (_gameRef->onActivate originally) case Common::EVENT_RTL: @@ -216,7 +234,9 @@ bool BasePlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2 ////////////////////////////////////////////////////////////////////////// bool BasePlatform::copyRect(Rect32 *lprcDst, Rect32 *lprcSrc) { - if (lprcDst == NULL || lprcSrc == NULL) return false; + if (lprcDst == NULL || lprcSrc == NULL) { + return false; + } *lprcDst = *lprcSrc; return true; diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 9bb567055a..e363c7bd54 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -115,7 +115,7 @@ Common::Error WinterMuteEngine::run() { // Additional setup. debugC(kWinterMuteDebugLog, "WinterMuteEngine::init"); ret = init(); - + debugC(kWinterMuteDebugLog, "WinterMuteEngine::messageLoop"); if (ret == 0) { ret = messageLoop(); @@ -127,7 +127,9 @@ Common::Error WinterMuteEngine::run() { int WinterMuteEngine::init() { BaseEngine::createInstance(_targetName); _game = new AdGame(_targetName); - if (!_game) return 1; + if (!_game) { + return 1; + } BaseEngine::instance().setGameRef(_game); BasePlatform::initialize(_game, 0, NULL); @@ -241,15 +243,22 @@ int WinterMuteEngine::messageLoop() { time = _system->getMillis(); diff = time - prevTime; - if (frameTime > diff) // Avoid overflows + if (frameTime > diff) { // Avoid overflows _system->delayMillis(frameTime - diff); + } // ***** flip - if (!_game->_suspendedRendering) _game->_renderer->flip(); - if (_game->_loading) _game->loadGame(_game->_scheduledLoadSlot); + if (!_game->_suspendedRendering) { + _game->_renderer->flip(); + } + if (_game->_loading) { + _game->loadGame(_game->_scheduledLoadSlot); + } prevTime = time; } - if (_game->_quitting) break; + if (_game->_quitting) { + break; + } } if (_game) { @@ -302,21 +311,24 @@ bool WinterMuteEngine::getGameInfo(const Common::FSList &fslist, Common::String Common::String line = stream->readLine(); line.trim(); // Get rid of indentation // Expect "SETTINGS {" or comment, or empty line - if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) + if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) { continue; - else { + } else { // We are looking for "GAME =" Common::StringTokenizer token(line, "="); Common::String key = token.nextToken(); Common::String value = token.nextToken(); - if (value.size() == 0) + if (value.size() == 0) { continue; - if (value[0] == '\"') + } + if (value[0] == '\"') { value.deleteChar(0); - else + } else { continue; - if (value.lastChar() == '\"') + } + if (value.lastChar() == '\"') { value.deleteLastChar(); + } if (key == "GAME") { settingsGameFile = value; break; @@ -333,20 +345,23 @@ bool WinterMuteEngine::getGameInfo(const Common::FSList &fslist, Common::String Common::String line = stream->readLine(); line.trim(); // Get rid of indentation // Expect "GAME {" or comment, or empty line - if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) + if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) { continue; - else { + } else { Common::StringTokenizer token(line, "="); Common::String key = token.nextToken(); Common::String value = token.nextToken(); - if (value.size() == 0) + if (value.size() == 0) { continue; - if (value[0] == '\"') + } + if (value[0] == '\"') { value.deleteChar(0); - else - continue; // not a string - if (value.lastChar() == '\"') + } else { + continue; // not a string + } + if (value.lastChar() == '\"') { value.deleteLastChar(); + } if (key == "NAME") { retVal = true; name = value; -- cgit v1.2.3