diff options
author | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-13 03:57:44 +0000 |
commit | 75e8452b6e6a2bf4fb2f588aa00b428a60d873b5 (patch) | |
tree | f29541d55309487a94bd1d38e8b53bb3dde9aec6 /engines/gob/gob.cpp | |
parent | 48ee83b88957dab86bc763e9ef21a70179fa8679 (diff) | |
parent | e9f50882ea5b6beeefa994040be9d3bab6a1f107 (diff) | |
download | scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.gz scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.tar.bz2 scummvm-rg350-75e8452b6e6a2bf4fb2f588aa00b428a60d873b5.zip |
OPENGL: Merged from trunk, from rev 52105 to 53396.
This includes an rather hacky attempt to merge all the recent gp2x backend
changes into the branch. I suppose the gp2x backend and probably all new
backends, i.e. gph, dingux etc., might not compile anymore.
Since I have no way of testing those it would be nice if porters could look
into getting those up to speed in this branch.
svn-id: r53399
Diffstat (limited to 'engines/gob/gob.cpp')
-rw-r--r-- | engines/gob/gob.cpp | 70 |
1 files changed, 47 insertions, 23 deletions
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 03c0b1d991..65c960bd73 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -209,10 +209,6 @@ bool GobEngine::isEGA() const { return (_features & kFeaturesEGA) != 0; } -bool GobEngine::is640() const { - return (_features & kFeatures640) != 0; -} - bool GobEngine::hasAdLib() const { return (_features & kFeaturesAdLib) != 0; } @@ -225,22 +221,36 @@ bool GobEngine::isBATDemo() const { return (_features & kFeaturesBATDemo) != 0; } +bool GobEngine::is640x480() const { + return (_features & kFeatures640x480) != 0; +} + bool GobEngine::is800x600() const { return (_features & kFeatures800x600) != 0; } +bool GobEngine::isTrueColor() const { + return (_features & kFeaturesTrueColor) != 0; +} + bool GobEngine::isDemo() const { return (isSCNDemo() || isBATDemo()); } +const Graphics::PixelFormat &GobEngine::getPixelFormat() const { + return _pixelFormat; +} + Common::Error GobEngine::run() { if (!initGameParts()) { GUIErrorMessage("GobEngine::init(): Unknown version of game engine"); return Common::kUnknownError; } - _video->setSize(is640()); - _video->init(); + if (!initGraphics()) { + GUIErrorMessage("GobEngine::init(): Failed to set up graphics"); + return Common::kUnknownError; + } // On some systems it's not safe to run CD audio games from the CD. if (isCD()) @@ -376,7 +386,7 @@ bool GobEngine::initGameParts() { break; case kGameTypeFascination: - _init = new Init_v2(this); + _init = new Init_Fascination(this); _video = new Video_v2(this); _inter = new Inter_Fascination(this); _mult = new Mult_v2(this); @@ -518,22 +528,6 @@ bool GobEngine::initGameParts() { _inter->setupOpcodes(); - if (is640()) { - _video->_surfWidth = _width = 640; - _video->_surfHeight = _video->_splitHeight1 = _height = 480; - _global->_mouseMaxX = 640; - _global->_mouseMaxY = 480; - _mode = 0x18; - _global->_primarySurfDesc = SurfaceDescPtr(new SurfaceDesc(0x18, 640, 480)); - } else { - _video->_surfWidth = _width = 320; - _video->_surfHeight = _video->_splitHeight1 = _height = 200; - _global->_mouseMaxX = 320; - _global->_mouseMaxY = 200; - _mode = 0x14; - _global->_primarySurfDesc = SurfaceDescPtr(new SurfaceDesc(0x14, 320, 200)); - } - return true; } @@ -556,4 +550,34 @@ void GobEngine::deinitGameParts() { delete _dataIO; _dataIO = 0; } +bool GobEngine::initGraphics() { + if (is800x600()) { + warning("GobEngine::initGraphics(): 800x600 games currently unsupported"); + return false; + } else if (is640x480()) { + _width = 640; + _height = 480; + _mode = 0x18; + } else { + _width = 320; + _height = 200; + _mode = 0x14; + } + + _video->setSize(is640x480()); + + _pixelFormat = g_system->getScreenFormat(); + + _video->_surfWidth = _width; + _video->_surfHeight = _height; + _video->_splitHeight1 = _height; + + _global->_mouseMaxX = _width; + _global->_mouseMaxY = _height; + + _global->_primarySurfDesc = SurfacePtr(new Surface(_width, _height, _pixelFormat.bytesPerPixel)); + + return true; +} + } // End of namespace Gob |