aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2008-05-03 20:08:46 +0000
committerSven Hesse2008-05-03 20:08:46 +0000
commitedff41b1c35100595d25d151db88a0ed7686a022 (patch)
tree0d1a5381d965e92ba16ff9ab6912ed5c99d752b6 /engines
parent7e3ce73a584b04bbe18832c2f7f1dac1e30d98b6 (diff)
downloadscummvm-rg350-edff41b1c35100595d25d151db88a0ed7686a022.tar.gz
scummvm-rg350-edff41b1c35100595d25d151db88a0ed7686a022.tar.bz2
scummvm-rg350-edff41b1c35100595d25d151db88a0ed7686a022.zip
Correct o2_initScreen() for Woodruff (screen positioning, clipping and cursor limiting)
svn-id: r31846
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/draw_v2.cpp4
-rw-r--r--engines/gob/global.cpp7
-rw-r--r--engines/gob/global.h7
-rw-r--r--engines/gob/gob.cpp13
-rw-r--r--engines/gob/inter_v2.cpp63
-rw-r--r--engines/gob/mult_v2.cpp2
-rw-r--r--engines/gob/util.cpp16
-rw-r--r--engines/gob/video.cpp43
-rw-r--r--engines/gob/video.h6
9 files changed, 117 insertions, 44 deletions
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index a4417f7f1d..8f7d5b325b 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -246,11 +246,11 @@ void Draw_v2::printTotText(int16 id) {
}
if (_renderFlags & RENDERFLAG_FROMSPLIT) {
- destY = _vm->_video->_splitHeight1;
+ destY = _vm->_video->_splitStart;
spriteBottom = READ_LE_UINT16(ptr + 6) - READ_LE_UINT16(ptr + 2);
if (_renderFlags & RENDERFLAG_DOUBLECOORDS)
spriteBottom *= 3;
- spriteBottom += _vm->_video->_splitHeight1;
+ spriteBottom += _vm->_video->_splitStart;
if (_renderFlags & RENDERFLAG_DOUBLECOORDS) {
spriteBottom += _backDeltaX;
destY += _backDeltaX;
diff --git a/engines/gob/global.cpp b/engines/gob/global.cpp
index 0c9dfd6a5c..1445601017 100644
--- a/engines/gob/global.cpp
+++ b/engines/gob/global.cpp
@@ -53,8 +53,11 @@ Global::Global(GobEngine *vm) : _vm(vm) {
_mousePresent = UNDEF;
_mouseXShift = 3;
_mouseYShift = 3;
- _mouseMaxCol = 320;
- _mouseMaxRow = 200;
+
+ _mouseMinX = 0;
+ _mouseMinY = 0;
+ _mouseMaxX = 320;
+ _mouseMaxY = 200;
_useJoystick = 1;
diff --git a/engines/gob/global.h b/engines/gob/global.h
index 6095183b33..45c179d277 100644
--- a/engines/gob/global.h
+++ b/engines/gob/global.h
@@ -90,8 +90,11 @@ public:
int16 _mousePresent;
int16 _mouseXShift;
int16 _mouseYShift;
- int16 _mouseMaxCol;
- int16 _mouseMaxRow;
+
+ int16 _mouseMinX;
+ int16 _mouseMinY;
+ int16 _mouseMaxX;
+ int16 _mouseMaxY;
char _useJoystick;
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index a54d9241e0..863665357b 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -146,10 +146,7 @@ int GobEngine::init() {
return -1;
}
- _system->beginGFXTransaction();
- _system->initSize(_width, _height);
- initCommonGFX(is640());
- _system->endGFXTransaction();
+ _video->setSize(is640());
// On some systems it's not safe to run CD audio games from the CD.
if (isCD())
@@ -346,15 +343,15 @@ bool GobEngine::initGameParts() {
if (is640()) {
_video->_surfWidth = _width = 640;
_video->_surfHeight = _video->_splitHeight1 = _height = 480;
- _global->_mouseMaxCol = 640;
- _global->_mouseMaxRow = 480;
+ _global->_mouseMaxX = 640;
+ _global->_mouseMaxY = 480;
_mode = 0x18;
_global->_primarySurfDesc = new SurfaceDesc(0x18, 640, 480);
} else {
_video->_surfWidth = _width = 320;
_video->_surfHeight = _video->_splitHeight1 = _height = 200;
- _global->_mouseMaxCol = 320;
- _global->_mouseMaxRow = 200;
+ _global->_mouseMaxX = 320;
+ _global->_mouseMaxY = 200;
_mode = 0x14;
_global->_primarySurfDesc = new SurfaceDesc(0x14, 320, 200);
}
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index c1efc42bb8..62b2f26c7b 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1388,17 +1388,21 @@ void Inter_v2::o2_initScreen() {
width = _vm->_parse->parseValExpr();
height = _vm->_parse->parseValExpr();
+ _vm->_video->clearScreen();
+
// Lost in Time switches to 640x400x16 when showing the title screen
if (_vm->getGameType() == kGameTypeLostInTime) {
+
if (videoMode == 0x10) {
+
width = _vm->_width = 640;
height = _vm->_height = 400;
_vm->_global->_colorCount = 16;
- _vm->_system->beginGFXTransaction();
- _vm->_system->initSize(_vm->_width, _vm->_height);
- _vm->initCommonGFX(true);
- _vm->_system->endGFXTransaction();
+
+ _vm->_video->setSize(true);
+
} else if (_vm->_global->_videoMode == 0x10) {
+
if (width == -1)
width = 320;
if (height == -1)
@@ -1407,10 +1411,9 @@ void Inter_v2::o2_initScreen() {
_vm->_width = 320;
_vm->_height = 200;
_vm->_global->_colorCount = 256;
- _vm->_system->beginGFXTransaction();
- _vm->_system->initSize(_vm->_width, _vm->_height);
- _vm->initCommonGFX(false);
- _vm->_system->endGFXTransaction();
+
+ _vm->_video->setSize(false);
+
}
}
@@ -1428,10 +1431,46 @@ void Inter_v2::o2_initScreen() {
if (height > 0)
_vm->_video->_surfHeight = height;
- _vm->_video->_splitHeight1 =
- MIN<int16>(_vm->_height, _vm->_video->_surfHeight - offY);
- _vm->_video->_splitHeight2 = offY;
- _vm->_video->_splitStart = _vm->_video->_surfHeight - offY;
+ if (videoMode == 0x18) {
+
+ if (_vm->_video->_surfWidth < _vm->_width)
+ _vm->_video->_screenDeltaX = (_vm->_width - _vm->_video->_surfWidth) / 2;
+ else
+ _vm->_video->_screenDeltaX = 0;
+
+ _vm->_global->_mouseMinX = _vm->_video->_screenDeltaX;
+ _vm->_global->_mouseMaxX = _vm->_video->_screenDeltaX + _vm->_video->_surfWidth - 1;
+
+
+ int16 screenHeight = _vm->_video->_surfHeight;
+
+ _vm->_video->_surfHeight += offY;
+
+ _vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, screenHeight - offY);
+ _vm->_video->_splitHeight2 = offY;
+ _vm->_video->_splitStart = screenHeight;
+
+ if ((_vm->_video->_surfHeight + offY) < _vm->_height)
+ _vm->_video->_screenDeltaY = (_vm->_height - (screenHeight + offY)) / 2;
+ else
+ _vm->_video->_screenDeltaY = 0;
+
+ _vm->_global->_mouseMaxY = (screenHeight + _vm->_video->_screenDeltaY) - offY - 1;
+ _vm->_global->_mouseMinY = _vm->_video->_screenDeltaY;
+
+ } else {
+ _vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, _vm->_video->_surfHeight - offY);
+ _vm->_video->_splitHeight2 = offY;
+ _vm->_video->_splitStart = _vm->_video->_surfHeight - offY;
+
+ _vm->_video->_screenDeltaX = 0;
+ _vm->_video->_screenDeltaY = 0;
+
+ _vm->_global->_mouseMinX = 0;
+ _vm->_global->_mouseMinY = 0;
+ _vm->_global->_mouseMaxX = _vm->_width;
+ _vm->_global->_mouseMaxY = _vm->_height - _vm->_video->_splitHeight2 - 1;
+ }
_vm->_draw->closeScreen();
_vm->_util->clearPalette();
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index 5acbf9e652..02211880ba 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -533,7 +533,7 @@ void Mult_v2::playMultInit() {
_animArrayData = new Mult_AnimData[_objCount];
memset(_objects, 0, _objCount * sizeof(Mult_Object));
- memset(_orderArray, 0, _objCount * sizeof(int8));
+ memset(_orderArray, 0, _objCount * sizeof(uint8));
memset(_renderObjs, 0, _objCount * sizeof(Mult_Object *));
memset(_animArrayX, 0, _objCount * sizeof(int32));
memset(_animArrayY, 0, _objCount * sizeof(int32));
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 7ed2fb044b..3b6a898a60 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -128,11 +128,11 @@ void Util::processInput(bool scroll) {
}
_vm->_global->_speedFactor = MIN(_fastMode + 1, 3);
- if (scroll && hasMove) {
- if (y >= (_vm->_height - _vm->_video->_splitHeight2)) {
- y = _vm->_height - _vm->_video->_splitHeight2 - 1;
- _vm->_util->setMousePos(x, y);
- }
+ if (hasMove && scroll) {
+ x = CLIP(x, _vm->_global->_mouseMinX, _vm->_global->_mouseMaxX);
+ y = CLIP(y, _vm->_global->_mouseMinY, _vm->_global->_mouseMaxY);
+
+ _vm->_util->setMousePos(x - _vm->_video->_screenDeltaX, y - _vm->_video->_screenDeltaY);
_vm->_game->evaluateScroll(x, y);
}
}
@@ -228,15 +228,15 @@ int16 Util::checkKey(void) {
void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) {
Common::Point mouse = g_system->getEventManager()->getMousePos();
- *pX = mouse.x + _vm->_video->_scrollOffsetX;
- *pY = mouse.y + _vm->_video->_scrollOffsetY;
+ *pX = mouse.x + _vm->_video->_scrollOffsetX - _vm->_video->_screenDeltaX;
+ *pY = mouse.y + _vm->_video->_scrollOffsetY - _vm->_video->_screenDeltaY;
if (pButtons != 0)
*pButtons = _mouseButtons;
}
void Util::setMousePos(int16 x, int16 y) {
- g_system->warpMouse(x, y);
+ g_system->warpMouse(x + _vm->_video->_screenDeltaX, y + _vm->_video->_screenDeltaY);
}
void Util::waitMouseUp(void) {
diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp
index 5a27254890..9a004318b8 100644
--- a/engines/gob/video.cpp
+++ b/engines/gob/video.cpp
@@ -95,6 +95,9 @@ Video::Video(GobEngine *vm) : _vm(vm) {
_splitHeight2 = 0;
_splitStart = 0;
+ _screenDeltaX = 0;
+ _screenDeltaY = 0;
+
_curSparse = 0;
_lastSparse = 0xFFFFFFFF;
}
@@ -142,9 +145,7 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height,
if (flags & PRIMARY_SURFACE) {
_vm->_global->_primaryWidth = width;
- _vm->_global->_mouseMaxCol = width;
_vm->_global->_primaryHeight = height;
- _vm->_global->_mouseMaxRow = height;
descPtr = _vm->_global->_primarySurfDesc;
descPtr->resize(width, height);
@@ -160,17 +161,41 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height,
return descPtr;
}
+void Video::clearScreen() {
+ g_system->clearScreen();
+}
+
+void Video::setSize(bool defaultTo1XScaler) {
+ _vm->_system->beginGFXTransaction();
+ _vm->_system->initSize(_vm->_width, _vm->_height);
+ _vm->initCommonGFX(defaultTo1XScaler);
+ _vm->_system->endGFXTransaction();
+}
+
void Video::retrace(bool mouse) {
if (mouse)
CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
if (_vm->_global->_primarySurfDesc) {
- g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() +
- _scrollOffsetY * _surfWidth + _scrollOffsetX, _surfWidth,
- 0, 0, _vm->_width, _splitHeight1);
- if (_splitHeight2 > 0)
- g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() +
- _splitStart * _surfWidth, _surfWidth, 0,
- _vm->_height - _splitHeight2, _vm->_width, _splitHeight2);
+ int screenOffset = _scrollOffsetY * _surfWidth + _scrollOffsetX;
+ int screenX = _screenDeltaX;
+ int screenY = _screenDeltaY;
+ int screenWidth = _vm->_width;
+ int screenHeight = _splitHeight1;
+
+ g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + screenOffset,
+ _surfWidth, screenX, screenY, screenWidth, screenHeight);
+
+ if (_splitHeight2 > 0) {
+ screenOffset = _splitStart * _surfWidth;
+ screenX = 0;
+ screenY = _vm->_height - _splitHeight2;
+ screenWidth = _vm->_width;
+ screenHeight = _splitHeight2;
+
+ g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + screenOffset,
+ _surfWidth, screenX, screenY, screenWidth, screenHeight);
+ }
+
g_system->updateScreen();
}
}
diff --git a/engines/gob/video.h b/engines/gob/video.h
index 16932d5046..4a585d8857 100644
--- a/engines/gob/video.h
+++ b/engines/gob/video.h
@@ -104,11 +104,17 @@ public:
int16 _splitHeight1;
int16 _splitHeight2;
int16 _splitStart;
+ int16 _screenDeltaX;
+ int16 _screenDeltaY;
void freeDriver();
void initPrimary(int16 mode);
SurfaceDesc *initSurfDesc(int16 vidMode, int16 width,
int16 height, int16 flags);
+
+ void setSize(bool defaultTo1XScaler);
+
+ void clearScreen();
void retrace(bool mouse = true);
void waitRetrace(bool mouse = true);
void sparseRetrace(int max);