aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/events.cpp6
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp31
-rw-r--r--engines/sherlock/scalpel/scalpel.h8
-rw-r--r--engines/sherlock/scalpel/scalpel_screen.cpp63
-rw-r--r--engines/sherlock/scalpel/scalpel_screen.h4
-rw-r--r--engines/sherlock/sherlock.cpp1
-rw-r--r--engines/sherlock/sherlock.h2
7 files changed, 90 insertions, 25 deletions
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index ed9d3702e0..697c1420a6 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -97,6 +97,8 @@ void Events::setCursor(const Graphics::Surface &src, int hotspotX, int hotspotY)
if (!IS_3DO) {
// PC 8-bit palettized
CursorMan.replaceCursor(src.getPixels(), src.w, src.h, hotspotX, hotspotY, 0xff);
+ } else if (!_vm->_isScreenDoubled) {
+ CursorMan.replaceCursor(src.getPixels(), src.w, src.h, hotspotX, hotspotY, 0x0000, false, &src.format);
} else {
Graphics::Surface tempSurface;
tempSurface.create(2 * src.w, 2 * src.h, src.format);
@@ -192,7 +194,7 @@ void Events::pollEvents() {
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
_mousePos = event.mouse;
- if (IS_3DO)
+ if (_vm->_isScreenDoubled)
_mousePos = Common::Point(_mousePos.x / 2, _mousePos.y / 2);
// Handle events
@@ -238,7 +240,7 @@ void Events::pollEventsAndWait() {
void Events::warpMouse(const Common::Point &pt) {
Common::Point pos = pt;
- if (IS_3DO)
+ if (_vm->_isScreenDoubled)
pos = Common::Point(pt.x / 2, pt.y);
_mousePos = pos - _vm->_screen->_currentScroll;
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 7b64ca379b..9019dc0bcd 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -247,17 +247,32 @@ ScalpelEngine::~ScalpelEngine() {
delete _darts;
}
-void ScalpelEngine::initialize() {
- // 3DO actually uses RGB555, but some platforms of ours only support RGB565, so we use that
-
- if (getPlatform() == Common::kPlatform3DO) {
- const Graphics::PixelFormat pixelFormatRGB565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
- // 16-bit RGB565 for 3DO support
- initGraphics(640, 400, true, &pixelFormatRGB565);
- } else {
+void ScalpelEngine::setupGraphics() {
+ if (getPlatform() != Common::kPlatform3DO) {
// 320x200 palettized
initGraphics(320, 200, false);
+ } else {
+ // 3DO actually uses RGB555, but some platforms of ours only support RGB565, so we use that
+ const Graphics::PixelFormat pixelFormatRGB565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+
+ // First try for a 640x400 mode
+ g_system->beginGFXTransaction();
+ initCommonGFX(true);
+ g_system->initSize(640, 400, &pixelFormatRGB565);
+ OSystem::TransactionError gfxError = g_system->endGFXTransaction();
+
+ if (gfxError == OSystem::kTransactionSuccess) {
+ _isScreenDoubled = true;
+ } else {
+ // System doesn't support it, so fall back on 320x200 mode
+ initGraphics(320, 200, false, &pixelFormatRGB565);
+ }
}
+}
+
+void ScalpelEngine::initialize() {
+ // Setup graphics mode
+ setupGraphics();
// Let the base engine intialize
SherlockEngine::initialize();
diff --git a/engines/sherlock/scalpel/scalpel.h b/engines/sherlock/scalpel/scalpel.h
index 7bf3615c13..02397304e0 100644
--- a/engines/sherlock/scalpel/scalpel.h
+++ b/engines/sherlock/scalpel/scalpel.h
@@ -53,6 +53,14 @@ private:
Darts *_darts;
int _mapResult;
+ /**
+ * Initialize graphics mode
+ */
+ void setupGraphics();
+
+ /**
+ * Show the 3DO splash screen
+ */
bool show3DOSplash();
/**
diff --git a/engines/sherlock/scalpel/scalpel_screen.cpp b/engines/sherlock/scalpel/scalpel_screen.cpp
index df1a9d4306..a06314f57f 100644
--- a/engines/sherlock/scalpel/scalpel_screen.cpp
+++ b/engines/sherlock/scalpel/scalpel_screen.cpp
@@ -91,6 +91,11 @@ void ScalpelScreen::makeField(const Common::Rect &r) {
/*----------------------------------------------------------------*/
void Scalpel3DOScreen::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
+ if (!_vm->_isScreenDoubled) {
+ ScalpelScreen::blitFrom(src, pt, srcBounds);
+ return;
+ }
+
Common::Rect srcRect = srcBounds;
Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());
@@ -116,6 +121,11 @@ void Scalpel3DOScreen::blitFrom(const Graphics::Surface &src, const Common::Poin
void Scalpel3DOScreen::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
+ if (!_vm->_isScreenDoubled) {
+ ScalpelScreen::transBlitFromUnscaled(src, pt, flipped, overrideColor);
+ return;
+ }
+
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
@@ -154,7 +164,10 @@ void Scalpel3DOScreen::transBlitFromUnscaled(const Graphics::Surface &src, const
}
void Scalpel3DOScreen::fillRect(const Common::Rect &r, uint color) {
- Screen::fillRect(Common::Rect(r.left * 2, r.top * 2, r.right * 2, r.bottom * 2), color);
+ if (_vm->_isScreenDoubled)
+ ScalpelScreen::fillRect(Common::Rect(r.left * 2, r.top * 2, r.right * 2, r.bottom * 2), color);
+ else
+ ScalpelScreen::fillRect(r, color);
}
void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) {
@@ -185,7 +198,7 @@ void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) {
uint16 *currentScreenPtr = currentScreenBasePtr;
uint16 *targetScreenPtr = targetScreenBasePtr;
- for (screenY = 0; screenY < screenHeight; screenY++, currentScreenPtr += 640) {
+ for (screenY = 0; screenY < screenHeight; screenY++) {
for (screenX = 0; screenX < screenWidth; screenX++) {
currentScreenPixel = *currentScreenPtr;
targetScreenPixel = *targetScreenPtr;
@@ -224,20 +237,28 @@ void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) {
uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
*currentScreenPtr = v;
- *(currentScreenPtr + 1) = v;
- *(currentScreenPtr + 640) = v;
- *(currentScreenPtr + 640 + 1) = v;
+ if (_vm->_isScreenDoubled) {
+ *(currentScreenPtr + 1) = v;
+ *(currentScreenPtr + 640) = v;
+ *(currentScreenPtr + 640 + 1) = v;
+ }
pixelsChanged++;
}
- currentScreenPtr += 2;
+ currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1;
targetScreenPtr++;
}
+
+ if (_vm->_isScreenDoubled)
+ currentScreenPtr += 640;
}
// Too much considered dirty at the moment
- addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
+ if (_vm->_isScreenDoubled)
+ addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
+ else
+ addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
events.pollEvents();
events.delay(10 * speed);
@@ -262,7 +283,7 @@ void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) {
uint16 limitPixelGreen = limitColor & 0x07E0;
uint16 limitPixelBlue = limitColor & 0x001F;
- for (screenY = 0; screenY < screenHeight; screenY++, currentScreenPtr += 640) {
+ for (screenY = 0; screenY < screenHeight; screenY++) {
for (screenX = 0; screenX < screenWidth; screenX++) {
currentScreenPixel = *targetScreenPtr;
@@ -279,17 +300,33 @@ void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) {
uint16 v = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
*currentScreenPtr = v;
- *(currentScreenPtr + 1) = v;
- *(currentScreenPtr + 640) = v;
- *(currentScreenPtr + 640 + 1) = v;
+ if (_vm->_isScreenDoubled) {
+ *(currentScreenPtr + 1) = v;
+ *(currentScreenPtr + 640) = v;
+ *(currentScreenPtr + 640 + 1) = v;
+ }
- currentScreenPtr += 2;
+ currentScreenPtr += _vm->_isScreenDoubled ? 2 : 1;
targetScreenPtr++;
}
+
+ if (_vm->_isScreenDoubled)
+ currentScreenPtr += 640;
}
// Too much considered dirty at the moment
- addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
+ if (_vm->_isScreenDoubled)
+ addDirtyRect(Common::Rect(0, 0, screenWidth * 2, screenHeight * 2));
+ else
+ addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
+}
+
+uint16 Scalpel3DOScreen::w() const {
+ return _vm->_isScreenDoubled ? _surface.w / 2 : _surface.w;
+}
+
+uint16 Scalpel3DOScreen::h() const {
+ return _vm->_isScreenDoubled ? _surface.h / 2 : _surface.h;
}
} // End of namespace Scalpel
diff --git a/engines/sherlock/scalpel/scalpel_screen.h b/engines/sherlock/scalpel/scalpel_screen.h
index b1be1210e0..15db24bbd2 100644
--- a/engines/sherlock/scalpel/scalpel_screen.h
+++ b/engines/sherlock/scalpel/scalpel_screen.h
@@ -95,8 +95,8 @@ public:
*/
virtual void fillRect(const Common::Rect &r, uint color);
- inline virtual uint16 w() const { return _surface.w / 2; }
- inline virtual uint16 h() const { return _surface.h / 2; }
+ virtual uint16 w() const;
+ virtual uint16 h() const;
};
} // End of namespace Scalpel
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index ae77c91009..3e3c579fdf 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -51,6 +51,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam
_canLoadSave = false;
_showOriginalSavesDialog = false;
_interactiveFl = true;
+ _isScreenDoubled = false;
}
SherlockEngine::~SherlockEngine() {
diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h
index c05680eb08..b85321c385 100644
--- a/engines/sherlock/sherlock.h
+++ b/engines/sherlock/sherlock.h
@@ -80,6 +80,7 @@ class Resource;
class SherlockEngine : public Engine {
private:
+\
/**
* Main loop for displaying a scene and handling all that occurs within it
*/
@@ -133,6 +134,7 @@ public:
bool _canLoadSave;
bool _showOriginalSavesDialog;
bool _interactiveFl;
+ bool _isScreenDoubled;
public:
SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
virtual ~SherlockEngine();