aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/gob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/gob.cpp')
-rw-r--r--engines/gob/gob.cpp70
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