From e64c3dc002a083cb7ff471be89817015b35345dd Mon Sep 17 00:00:00 2001 From: Kamil Zbróg Date: Thu, 24 Oct 2013 13:28:06 +0100 Subject: PRINCE: code cleanup --- engines/prince/detection.cpp | 120 +++++++++++++++++++++---------------------- engines/prince/graphics.cpp | 9 ++-- engines/prince/prince.cpp | 28 ++++------ 3 files changed, 72 insertions(+), 85 deletions(-) (limited to 'engines/prince') diff --git a/engines/prince/detection.cpp b/engines/prince/detection.cpp index e7f1ac01dd..c5f6039ca1 100644 --- a/engines/prince/detection.cpp +++ b/engines/prince/detection.cpp @@ -28,32 +28,32 @@ namespace Prince { struct PrinceGameDescription { - ADGameDescription desc; + ADGameDescription desc; - int gameType; + int gameType; }; int PrinceEngine::getGameType() const { - return _gameDescription->gameType; + return _gameDescription->gameType; } const char *PrinceEngine::getGameId() const { - return _gameDescription->desc.gameid; + return _gameDescription->desc.gameid; } uint32 PrinceEngine::getFeatures() const { - return _gameDescription->desc.flags; + return _gameDescription->desc.flags; } Common::Language PrinceEngine::getLanguage() const { - return _gameDescription->desc.language; + return _gameDescription->desc.language; } } static const PlainGameDescriptor princeGames[] = { - {"prince", "Prince Game"}, - {0, 0} + {"prince", "Prince Game"}, + {0, 0} }; namespace Prince { @@ -61,34 +61,34 @@ namespace Prince { static const PrinceGameDescription gameDescriptions[] = { // German - { - { - "prince", - "Galador", - AD_ENTRY1s("databank.ptc", "5fa03833177331214ec1354761b1d2ee", 3565031), - Common::DE_DEU, - Common::kPlatformWindows, - ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) - }, - 0 - }, + { + { + "prince", + "Galador", + AD_ENTRY1s("databank.ptc", "5fa03833177331214ec1354761b1d2ee", 3565031), + Common::DE_DEU, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + 0 + }, // Polish - { - { - "prince", - "Ksiaze i Tchorz", - AD_ENTRY1s("databank.ptc", "48ec9806bda9d152acbea8ce31c93c49", 3435298), - Common::PL_POL, - Common::kPlatformWindows, - ADGF_NO_FLAGS, - GUIO1(GUIO_NONE) - }, - 1 - }, - - - { AD_TABLE_END_MARKER, 0 } + { + { + "prince", + "Ksiaze i Tchorz", + AD_ENTRY1s("databank.ptc", "48ec9806bda9d152acbea8ce31c93c49", 3435298), + Common::PL_POL, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + 1 + }, + + + { AD_TABLE_END_MARKER, 0 } }; } // End of namespace Prince @@ -97,45 +97,45 @@ using namespace Prince; // we match from data too, to stop detection from a non-top-level directory const static char *directoryGlobs[] = { - "all", - 0 + "all", + 0 }; class PrinceMetaEngine : public AdvancedMetaEngine { public: - PrinceMetaEngine() : AdvancedMetaEngine(Prince::gameDescriptions, sizeof(Prince::PrinceGameDescription), princeGames) { - _singleid = "prince"; - _maxScanDepth = 2; - _directoryGlobs = directoryGlobs; - } - - virtual const char *getName() const { - return "Prince Engine"; - } - - virtual const char *getOriginalCopyright() const { - return "Copyright (C)"; - } - - virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; - virtual bool hasFeature(MetaEngineFeature f) const; + PrinceMetaEngine() : AdvancedMetaEngine(Prince::gameDescriptions, sizeof(Prince::PrinceGameDescription), princeGames) { + _singleid = "prince"; + _maxScanDepth = 2; + _directoryGlobs = directoryGlobs; + } + + virtual const char *getName() const { + return "Prince Engine"; + } + + virtual const char *getOriginalCopyright() const { + return "Copyright (C)"; + } + + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + virtual bool hasFeature(MetaEngineFeature f) const; }; bool PrinceMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { using namespace Prince; - const PrinceGameDescription *gd = (const PrinceGameDescription *)desc; - if (gd) { - *engine = new PrinceEngine(syst, gd); - } - return gd != 0; + const PrinceGameDescription *gd = (const PrinceGameDescription *)desc; + if (gd) { + *engine = new PrinceEngine(syst, gd); + } + return gd != 0; } bool PrinceMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; + return false; } bool Prince::PrinceEngine::hasFeature(EngineFeature f) const { - return false;//(f == kSupportsRTL); + return false;//(f == kSupportsRTL); } #if PLUGIN_ENABLED_DYNAMIC(PRINCE) diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp index eae94748f6..29fbd6a611 100644 --- a/engines/prince/graphics.cpp +++ b/engines/prince/graphics.cpp @@ -38,13 +38,10 @@ void GraphicsMan::draw(const Graphics::Surface *s) void GraphicsMan::drawTransparent(const Graphics::Surface *s) { - for (uint y = 0; y < 480; ++y) - { - for (uint x = 0; x < 640; ++x) - { + for (uint y = 0; y < 480; ++y) { + for (uint x = 0; x < 640; ++x) { byte pixel = *((byte*)s->getBasePtr(x,y)); - if (pixel != 255) - { + if (pixel != 255) { *((byte*)_frontScreen->getBasePtr(x, y)) = pixel; } } diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index aec84684a7..1dd54bafd8 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -67,13 +67,11 @@ PrinceEngine::~PrinceEngine() { delete _debugger; } -GUI::Debugger *PrinceEngine::getDebugger() -{ +GUI::Debugger *PrinceEngine::getDebugger() { return _debugger; } Common::Error PrinceEngine::run() { - _graph = new GraphicsMan(this); const Common::FSNode gameDataDir(ConfMan.get("path")); @@ -127,8 +125,7 @@ Common::Error PrinceEngine::run() { return Common::kNoError; } -bool PrinceEngine::loadLocation(uint16 locationNr) -{ +bool PrinceEngine::loadLocation(uint16 locationNr) { debug("PrinceEngine::loadLocation %d", locationNr); const Common::FSNode gameDataDir(ConfMan.get("path")); SearchMan.remove(Common::String::format("%02d", _locationNr)); @@ -141,14 +138,12 @@ bool PrinceEngine::loadLocation(uint16 locationNr) // load location background Common::SeekableReadStream *room = SearchMan.createReadStreamForMember("room"); - if (!room) - { + if (!room) { error("Can't load room bitmap"); return false; } - if(_roomBmp.loadStream(*room)) - { + if(_roomBmp.loadStream(*room)) { debug("Room bitmap loaded"); _system->getPaletteManager()->setPalette(_roomBmp.getPalette(), 0, 256); } @@ -158,11 +153,9 @@ bool PrinceEngine::loadLocation(uint16 locationNr) return true; } -bool PrinceEngine::playNextFrame() -{ +bool PrinceEngine::playNextFrame() { const Graphics::Surface *s = _flicPlayer.decodeNextFrame(); - if (s) - { + if (s) { _graph->drawTransparent(s); _graph->change(); } @@ -170,19 +163,16 @@ bool PrinceEngine::playNextFrame() return true; } -bool PrinceEngine::loadAnim(uint16 animNr) -{ +bool PrinceEngine::loadAnim(uint16 animNr) { Common::String streamName = Common::String::format("AN%02d", animNr); Common::SeekableReadStream * flicStream = SearchMan.createReadStreamForMember(streamName); - if (!flicStream) - { + if (!flicStream) { error("Can't open %s", streamName.c_str()); return false; } - if (!_flicPlayer.loadStream(flicStream)) - { + if (!_flicPlayer.loadStream(flicStream)) { error("Can't load flic stream %s", streamName.c_str()); } -- cgit v1.2.3