WINTERMUTE: Format platform_osystem.cpp, wintermute.cpp and detection_tables.h

This commit is contained in:
Einar Johan Trøan Sømåen 2012-08-11 02:44:12 +02:00
parent 089920377f
commit 5ecc1fd7f0
3 changed files with 87 additions and 52 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;