Correct o2_initScreen() for Woodruff (screen positioning, clipping and cursor limiting)
svn-id: r31846
This commit is contained in:
parent
7e3ce73a58
commit
edff41b1c3
9 changed files with 117 additions and 44 deletions
|
@ -246,11 +246,11 @@ void Draw_v2::printTotText(int16 id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_renderFlags & RENDERFLAG_FROMSPLIT) {
|
if (_renderFlags & RENDERFLAG_FROMSPLIT) {
|
||||||
destY = _vm->_video->_splitHeight1;
|
destY = _vm->_video->_splitStart;
|
||||||
spriteBottom = READ_LE_UINT16(ptr + 6) - READ_LE_UINT16(ptr + 2);
|
spriteBottom = READ_LE_UINT16(ptr + 6) - READ_LE_UINT16(ptr + 2);
|
||||||
if (_renderFlags & RENDERFLAG_DOUBLECOORDS)
|
if (_renderFlags & RENDERFLAG_DOUBLECOORDS)
|
||||||
spriteBottom *= 3;
|
spriteBottom *= 3;
|
||||||
spriteBottom += _vm->_video->_splitHeight1;
|
spriteBottom += _vm->_video->_splitStart;
|
||||||
if (_renderFlags & RENDERFLAG_DOUBLECOORDS) {
|
if (_renderFlags & RENDERFLAG_DOUBLECOORDS) {
|
||||||
spriteBottom += _backDeltaX;
|
spriteBottom += _backDeltaX;
|
||||||
destY += _backDeltaX;
|
destY += _backDeltaX;
|
||||||
|
|
|
@ -53,8 +53,11 @@ Global::Global(GobEngine *vm) : _vm(vm) {
|
||||||
_mousePresent = UNDEF;
|
_mousePresent = UNDEF;
|
||||||
_mouseXShift = 3;
|
_mouseXShift = 3;
|
||||||
_mouseYShift = 3;
|
_mouseYShift = 3;
|
||||||
_mouseMaxCol = 320;
|
|
||||||
_mouseMaxRow = 200;
|
_mouseMinX = 0;
|
||||||
|
_mouseMinY = 0;
|
||||||
|
_mouseMaxX = 320;
|
||||||
|
_mouseMaxY = 200;
|
||||||
|
|
||||||
_useJoystick = 1;
|
_useJoystick = 1;
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,11 @@ public:
|
||||||
int16 _mousePresent;
|
int16 _mousePresent;
|
||||||
int16 _mouseXShift;
|
int16 _mouseXShift;
|
||||||
int16 _mouseYShift;
|
int16 _mouseYShift;
|
||||||
int16 _mouseMaxCol;
|
|
||||||
int16 _mouseMaxRow;
|
int16 _mouseMinX;
|
||||||
|
int16 _mouseMinY;
|
||||||
|
int16 _mouseMaxX;
|
||||||
|
int16 _mouseMaxY;
|
||||||
|
|
||||||
char _useJoystick;
|
char _useJoystick;
|
||||||
|
|
||||||
|
|
|
@ -146,10 +146,7 @@ int GobEngine::init() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_system->beginGFXTransaction();
|
_video->setSize(is640());
|
||||||
_system->initSize(_width, _height);
|
|
||||||
initCommonGFX(is640());
|
|
||||||
_system->endGFXTransaction();
|
|
||||||
|
|
||||||
// On some systems it's not safe to run CD audio games from the CD.
|
// On some systems it's not safe to run CD audio games from the CD.
|
||||||
if (isCD())
|
if (isCD())
|
||||||
|
@ -346,15 +343,15 @@ bool GobEngine::initGameParts() {
|
||||||
if (is640()) {
|
if (is640()) {
|
||||||
_video->_surfWidth = _width = 640;
|
_video->_surfWidth = _width = 640;
|
||||||
_video->_surfHeight = _video->_splitHeight1 = _height = 480;
|
_video->_surfHeight = _video->_splitHeight1 = _height = 480;
|
||||||
_global->_mouseMaxCol = 640;
|
_global->_mouseMaxX = 640;
|
||||||
_global->_mouseMaxRow = 480;
|
_global->_mouseMaxY = 480;
|
||||||
_mode = 0x18;
|
_mode = 0x18;
|
||||||
_global->_primarySurfDesc = new SurfaceDesc(0x18, 640, 480);
|
_global->_primarySurfDesc = new SurfaceDesc(0x18, 640, 480);
|
||||||
} else {
|
} else {
|
||||||
_video->_surfWidth = _width = 320;
|
_video->_surfWidth = _width = 320;
|
||||||
_video->_surfHeight = _video->_splitHeight1 = _height = 200;
|
_video->_surfHeight = _video->_splitHeight1 = _height = 200;
|
||||||
_global->_mouseMaxCol = 320;
|
_global->_mouseMaxX = 320;
|
||||||
_global->_mouseMaxRow = 200;
|
_global->_mouseMaxY = 200;
|
||||||
_mode = 0x14;
|
_mode = 0x14;
|
||||||
_global->_primarySurfDesc = new SurfaceDesc(0x14, 320, 200);
|
_global->_primarySurfDesc = new SurfaceDesc(0x14, 320, 200);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1388,17 +1388,21 @@ void Inter_v2::o2_initScreen() {
|
||||||
width = _vm->_parse->parseValExpr();
|
width = _vm->_parse->parseValExpr();
|
||||||
height = _vm->_parse->parseValExpr();
|
height = _vm->_parse->parseValExpr();
|
||||||
|
|
||||||
|
_vm->_video->clearScreen();
|
||||||
|
|
||||||
// Lost in Time switches to 640x400x16 when showing the title screen
|
// Lost in Time switches to 640x400x16 when showing the title screen
|
||||||
if (_vm->getGameType() == kGameTypeLostInTime) {
|
if (_vm->getGameType() == kGameTypeLostInTime) {
|
||||||
|
|
||||||
if (videoMode == 0x10) {
|
if (videoMode == 0x10) {
|
||||||
|
|
||||||
width = _vm->_width = 640;
|
width = _vm->_width = 640;
|
||||||
height = _vm->_height = 400;
|
height = _vm->_height = 400;
|
||||||
_vm->_global->_colorCount = 16;
|
_vm->_global->_colorCount = 16;
|
||||||
_vm->_system->beginGFXTransaction();
|
|
||||||
_vm->_system->initSize(_vm->_width, _vm->_height);
|
_vm->_video->setSize(true);
|
||||||
_vm->initCommonGFX(true);
|
|
||||||
_vm->_system->endGFXTransaction();
|
|
||||||
} else if (_vm->_global->_videoMode == 0x10) {
|
} else if (_vm->_global->_videoMode == 0x10) {
|
||||||
|
|
||||||
if (width == -1)
|
if (width == -1)
|
||||||
width = 320;
|
width = 320;
|
||||||
if (height == -1)
|
if (height == -1)
|
||||||
|
@ -1407,10 +1411,9 @@ void Inter_v2::o2_initScreen() {
|
||||||
_vm->_width = 320;
|
_vm->_width = 320;
|
||||||
_vm->_height = 200;
|
_vm->_height = 200;
|
||||||
_vm->_global->_colorCount = 256;
|
_vm->_global->_colorCount = 256;
|
||||||
_vm->_system->beginGFXTransaction();
|
|
||||||
_vm->_system->initSize(_vm->_width, _vm->_height);
|
_vm->_video->setSize(false);
|
||||||
_vm->initCommonGFX(false);
|
|
||||||
_vm->_system->endGFXTransaction();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1428,11 +1431,47 @@ void Inter_v2::o2_initScreen() {
|
||||||
if (height > 0)
|
if (height > 0)
|
||||||
_vm->_video->_surfHeight = height;
|
_vm->_video->_surfHeight = height;
|
||||||
|
|
||||||
_vm->_video->_splitHeight1 =
|
if (videoMode == 0x18) {
|
||||||
MIN<int16>(_vm->_height, _vm->_video->_surfHeight - offY);
|
|
||||||
|
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->_splitHeight2 = offY;
|
||||||
_vm->_video->_splitStart = _vm->_video->_surfHeight - 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->_draw->closeScreen();
|
||||||
_vm->_util->clearPalette();
|
_vm->_util->clearPalette();
|
||||||
memset(_vm->_global->_redPalette, 0, 256);
|
memset(_vm->_global->_redPalette, 0, 256);
|
||||||
|
|
|
@ -533,7 +533,7 @@ void Mult_v2::playMultInit() {
|
||||||
_animArrayData = new Mult_AnimData[_objCount];
|
_animArrayData = new Mult_AnimData[_objCount];
|
||||||
|
|
||||||
memset(_objects, 0, _objCount * sizeof(Mult_Object));
|
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(_renderObjs, 0, _objCount * sizeof(Mult_Object *));
|
||||||
memset(_animArrayX, 0, _objCount * sizeof(int32));
|
memset(_animArrayX, 0, _objCount * sizeof(int32));
|
||||||
memset(_animArrayY, 0, _objCount * sizeof(int32));
|
memset(_animArrayY, 0, _objCount * sizeof(int32));
|
||||||
|
|
|
@ -128,11 +128,11 @@ void Util::processInput(bool scroll) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_vm->_global->_speedFactor = MIN(_fastMode + 1, 3);
|
_vm->_global->_speedFactor = MIN(_fastMode + 1, 3);
|
||||||
if (scroll && hasMove) {
|
if (hasMove && scroll) {
|
||||||
if (y >= (_vm->_height - _vm->_video->_splitHeight2)) {
|
x = CLIP(x, _vm->_global->_mouseMinX, _vm->_global->_mouseMaxX);
|
||||||
y = _vm->_height - _vm->_video->_splitHeight2 - 1;
|
y = CLIP(y, _vm->_global->_mouseMinY, _vm->_global->_mouseMaxY);
|
||||||
_vm->_util->setMousePos(x, y);
|
|
||||||
}
|
_vm->_util->setMousePos(x - _vm->_video->_screenDeltaX, y - _vm->_video->_screenDeltaY);
|
||||||
_vm->_game->evaluateScroll(x, y);
|
_vm->_game->evaluateScroll(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,15 +228,15 @@ int16 Util::checkKey(void) {
|
||||||
|
|
||||||
void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) {
|
void Util::getMouseState(int16 *pX, int16 *pY, int16 *pButtons) {
|
||||||
Common::Point mouse = g_system->getEventManager()->getMousePos();
|
Common::Point mouse = g_system->getEventManager()->getMousePos();
|
||||||
*pX = mouse.x + _vm->_video->_scrollOffsetX;
|
*pX = mouse.x + _vm->_video->_scrollOffsetX - _vm->_video->_screenDeltaX;
|
||||||
*pY = mouse.y + _vm->_video->_scrollOffsetY;
|
*pY = mouse.y + _vm->_video->_scrollOffsetY - _vm->_video->_screenDeltaY;
|
||||||
|
|
||||||
if (pButtons != 0)
|
if (pButtons != 0)
|
||||||
*pButtons = _mouseButtons;
|
*pButtons = _mouseButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Util::setMousePos(int16 x, int16 y) {
|
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) {
|
void Util::waitMouseUp(void) {
|
||||||
|
|
|
@ -95,6 +95,9 @@ Video::Video(GobEngine *vm) : _vm(vm) {
|
||||||
_splitHeight2 = 0;
|
_splitHeight2 = 0;
|
||||||
_splitStart = 0;
|
_splitStart = 0;
|
||||||
|
|
||||||
|
_screenDeltaX = 0;
|
||||||
|
_screenDeltaY = 0;
|
||||||
|
|
||||||
_curSparse = 0;
|
_curSparse = 0;
|
||||||
_lastSparse = 0xFFFFFFFF;
|
_lastSparse = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
@ -142,9 +145,7 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height,
|
||||||
|
|
||||||
if (flags & PRIMARY_SURFACE) {
|
if (flags & PRIMARY_SURFACE) {
|
||||||
_vm->_global->_primaryWidth = width;
|
_vm->_global->_primaryWidth = width;
|
||||||
_vm->_global->_mouseMaxCol = width;
|
|
||||||
_vm->_global->_primaryHeight = height;
|
_vm->_global->_primaryHeight = height;
|
||||||
_vm->_global->_mouseMaxRow = height;
|
|
||||||
|
|
||||||
descPtr = _vm->_global->_primarySurfDesc;
|
descPtr = _vm->_global->_primarySurfDesc;
|
||||||
descPtr->resize(width, height);
|
descPtr->resize(width, height);
|
||||||
|
@ -160,17 +161,41 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height,
|
||||||
return descPtr;
|
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) {
|
void Video::retrace(bool mouse) {
|
||||||
if (mouse)
|
if (mouse)
|
||||||
CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
|
CursorMan.showMouse((_vm->_draw->_showCursor & 2) != 0);
|
||||||
if (_vm->_global->_primarySurfDesc) {
|
if (_vm->_global->_primarySurfDesc) {
|
||||||
g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() +
|
int screenOffset = _scrollOffsetY * _surfWidth + _scrollOffsetX;
|
||||||
_scrollOffsetY * _surfWidth + _scrollOffsetX, _surfWidth,
|
int screenX = _screenDeltaX;
|
||||||
0, 0, _vm->_width, _splitHeight1);
|
int screenY = _screenDeltaY;
|
||||||
if (_splitHeight2 > 0)
|
int screenWidth = _vm->_width;
|
||||||
g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() +
|
int screenHeight = _splitHeight1;
|
||||||
_splitStart * _surfWidth, _surfWidth, 0,
|
|
||||||
_vm->_height - _splitHeight2, _vm->_width, _splitHeight2);
|
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();
|
g_system->updateScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,11 +104,17 @@ public:
|
||||||
int16 _splitHeight1;
|
int16 _splitHeight1;
|
||||||
int16 _splitHeight2;
|
int16 _splitHeight2;
|
||||||
int16 _splitStart;
|
int16 _splitStart;
|
||||||
|
int16 _screenDeltaX;
|
||||||
|
int16 _screenDeltaY;
|
||||||
|
|
||||||
void freeDriver();
|
void freeDriver();
|
||||||
void initPrimary(int16 mode);
|
void initPrimary(int16 mode);
|
||||||
SurfaceDesc *initSurfDesc(int16 vidMode, int16 width,
|
SurfaceDesc *initSurfDesc(int16 vidMode, int16 width,
|
||||||
int16 height, int16 flags);
|
int16 height, int16 flags);
|
||||||
|
|
||||||
|
void setSize(bool defaultTo1XScaler);
|
||||||
|
|
||||||
|
void clearScreen();
|
||||||
void retrace(bool mouse = true);
|
void retrace(bool mouse = true);
|
||||||
void waitRetrace(bool mouse = true);
|
void waitRetrace(bool mouse = true);
|
||||||
void sparseRetrace(int max);
|
void sparseRetrace(int max);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue