aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-08-05 18:15:20 +0200
committerBorja Lorente2016-08-14 19:01:01 +0200
commit28bf4f11683eb165805e6f94e32ccf07819ed44c (patch)
tree30e6e45b57525f8422cc9f8656e2efe8f78ca3f1
parent47916aca622f42fe210e7d4738c91f3aca3e9fb2 (diff)
downloadscummvm-rg350-28bf4f11683eb165805e6f94e32ccf07819ed44c.tar.gz
scummvm-rg350-28bf4f11683eb165805e6f94e32ccf07819ed44c.tar.bz2
scummvm-rg350-28bf4f11683eb165805e6f94e32ccf07819ed44c.zip
MACVENTURE: Fix some of the offsets
-rw-r--r--engines/macventure/datafiles.cpp2
-rw-r--r--engines/macventure/gui.cpp37
-rw-r--r--engines/macventure/windows.cpp11
-rw-r--r--engines/macventure/windows.h2
4 files changed, 33 insertions, 19 deletions
diff --git a/engines/macventure/datafiles.cpp b/engines/macventure/datafiles.cpp
index 71407a7557..77ecaee626 100644
--- a/engines/macventure/datafiles.cpp
+++ b/engines/macventure/datafiles.cpp
@@ -50,6 +50,8 @@ Common::String windowTypeName(MVWindowType windowType) {
return "ZoomDoc";
case kZoomNoGrow:
return "ZoomNoGrow";
+ case kInvWindow:
+ return "InvWindow";
case kRDoc16:
return "RDoc16";
case kRDoc4:
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 0f5a264d61..4c69923672 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -218,7 +218,11 @@ void Gui::initWindows() {
// In-game Output Console
_outConsoleWindow = _wm.addWindow(true, true, false);
- _outConsoleWindow->setDimensions(getWindowData(kOutConsoleWindow).bounds);
+ // HACK We have to hand-create the dimensions, otherwise they don't fit
+ const WindowData &wd = getWindowData(kOutConsoleWindow);
+ Common::Rect dimensions = wd.bounds;
+ dimensions.setWidth(dimensions.width() - borderBounds(wd.type).rightOffset);
+ _outConsoleWindow->setDimensions(dimensions);
_outConsoleWindow->setActive(false);
_outConsoleWindow->setCallback(outConsoleWindowCallback, this);
loadBorders(_outConsoleWindow, findWindowData(kOutConsoleWindow).type);
@@ -306,15 +310,15 @@ WindowReference Gui::createInventoryWindow(ObjID objRef) {
if (_windowData->back().refcon < 0x80) { // There is already another inventory window
newData.bounds = _windowData->back().bounds; // Inventory windows are always last
newData.bounds.translate(newData.bounds.left + settings.invOffsetX, newData.bounds.top + settings.invOffsetY);
- }
- else {
+ } else {
+ BorderBounds bbs = borderBounds(kInvWindow);
newData.bounds = Common::Rect(
- settings.invLeft,
- settings.invTop,
+ settings.invLeft - bbs.leftOffset,
+ settings.invTop - bbs.topOffset,
settings.invLeft + settings.invWidth,
settings.invTop + settings.invHeight);
}
- newData.type = kZoomDoc;
+ newData.type = kInvWindow;
newData.hasCloseBox = true;
newData.visible = true;
newData.objRef = objRef;
@@ -431,11 +435,13 @@ bool Gui::loadWindows() {
bottom = res->readUint16BE();
right = res->readUint16BE();
data.type = (MVWindowType)res->readUint16BE();
+ BorderBounds bbs = borderBounds(data.type);
data.bounds = Common::Rect(
- left - borderBounds(data.type).leftOffset,
- top - borderBounds(data.type).topOffset,
- right + borderBounds(data.type).rightOffset * 2,
- bottom + borderBounds(data.type).bottomOffset * 2);
+ left - bbs.leftOffset,
+ top - bbs.topOffset,
+ right + bbs.rightOffset,
+ bottom + bbs.bottomOffset);
+
data.visible = res->readUint16BE();
data.hasCloseBox = res->readUint16BE();
data.refcon = (WindowReference)id; id++;
@@ -492,11 +498,14 @@ bool Gui::loadControls() {
res->read(data.title, data.titleLength);
data.title[data.titleLength] = '\0';
}
- if (data.type != kControlExitBox)
- data.border = commandsBorder;
+ if (data.type != kControlExitBox) {
+ BorderBounds bbs = borderBounds(getWindowData(kCommandsWindow).type);
+ // We just want to move the button, not change it's size
+ data.bounds = Common::Rect(left + bbs.leftOffset, top + bbs.topOffset, right + bbs.leftOffset, bottom + bbs.topOffset);
+ } else {
+ data.bounds = Common::Rect(left, top, right, bottom);
+ }
- Common::Rect bounds(left, top, right, bottom); // For some reason, if I remove this it segfaults
- data.bounds = Common::Rect(left + data.border, top + data.border, right + data.border, bottom + data.border);
i++;
}
diff --git a/engines/macventure/windows.cpp b/engines/macventure/windows.cpp
index 9825349641..b3d544924f 100644
--- a/engines/macventure/windows.cpp
+++ b/engines/macventure/windows.cpp
@@ -31,22 +31,23 @@ BorderBounds borderBounds(MVWindowType type) {
case MacVenture::kDBox:
break;
case MacVenture::kPlainDBox:
- return BorderBounds(1, 1, 1, 2);
+ return BorderBounds(3, 3, 3, 3);
case MacVenture::kAltBox:
return BorderBounds(0, 0, 0, 0); // Hand-tested
- break;
case MacVenture::kNoGrowDoc:
- return BorderBounds(1, 17, 1, 1);
+ return BorderBounds(1, 20, 1, 1);
case MacVenture::kMovableDBox:
break;
case MacVenture::kZoomDoc:
- return BorderBounds(1, 19, 17, 17);
+ return BorderBounds(1, 20, 17, 1);
case MacVenture::kZoomNoGrow:
break;
+ case MacVenture::kInvWindow:
+ return BorderBounds(1, 20, 17, 17);
case MacVenture::kRDoc16:
break;
case MacVenture::kRDoc4:
- return BorderBounds(1, 19, 1, 1);
+ return BorderBounds(1, 20, 1, 1);
case MacVenture::kRDoc6:
break;
case MacVenture::kRDoc10:
diff --git a/engines/macventure/windows.h b/engines/macventure/windows.h
index 79b2798a2b..fe3f9275d0 100644
--- a/engines/macventure/windows.h
+++ b/engines/macventure/windows.h
@@ -50,6 +50,8 @@ enum MVWindowType {
kMovableDBox = 0x05,
kZoomDoc = 0x08,
kZoomNoGrow = 0x0c,
+ // WebVenture assigns arbitrary kinds post-loading
+ kInvWindow = 0x0e,
kRDoc16 = 0x10,
kRDoc4 = 0x12,
kRDoc6 = 0x14,