aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure
diff options
context:
space:
mode:
authorBorja Lorente2016-07-22 12:45:54 +0200
committerBorja Lorente2016-08-14 18:58:34 +0200
commit87c6265582f6efa31f6a8dcc77ffe509c3720010 (patch)
tree8bd717e8fb061fee8eb41c4064c23a85e9537e3e /engines/macventure
parent2dfbfdbaba780ec4598556299af967f7eb0abf63 (diff)
downloadscummvm-rg350-87c6265582f6efa31f6a8dcc77ffe509c3720010.tar.gz
scummvm-rg350-87c6265582f6efa31f6a8dcc77ffe509c3720010.tar.bz2
scummvm-rg350-87c6265582f6efa31f6a8dcc77ffe509c3720010.zip
MACVENTURE: Fix window borders
Diffstat (limited to 'engines/macventure')
-rw-r--r--engines/macventure/gui.cpp47
-rw-r--r--engines/macventure/gui.h2
-rw-r--r--engines/macventure/windows.cpp2
3 files changed, 32 insertions, 19 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 6fcd48c9fc..37aef21110 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -215,40 +215,40 @@ void Gui::initWindows() {
_controlsWindow->setDimensions(getWindowData(kCommandsWindow).bounds);
_controlsWindow->setActive(false);
_controlsWindow->setCallback(commandsWindowCallback, this);
- loadBorder(_controlsWindow, "border_command.bmp", false);
- loadBorder(_controlsWindow, "border_command.bmp", true);
+ loadBorder(_controlsWindow, "border_command.bmp", false, findWindowData(kCommandsWindow).type);
+ loadBorder(_controlsWindow, "border_command.bmp", true, findWindowData(kCommandsWindow).type);
// Main Game Window
_mainGameWindow = _wm.addWindow(true, true, true);
_mainGameWindow->setDimensions(getWindowData(kMainGameWindow).bounds);
_mainGameWindow->setActive(false);
_mainGameWindow->setCallback(mainGameWindowCallback, this);
- //loadBorder(_mainGameWindow, "border_no_scroll_inac.bmp", false);
- //loadBorder(_mainGameWindow, "border_no_scroll_act.bmp", true);
+ loadBorder(_mainGameWindow, "border_no_scroll_inac.bmp", false, findWindowData(kMainGameWindow).type);
+ loadBorder(_mainGameWindow, "border_no_scroll_act.bmp", true, findWindowData(kMainGameWindow).type);
// In-game Output Console
_outConsoleWindow = _wm.addWindow(false, true, true);
_outConsoleWindow->setDimensions(getWindowData(kOutConsoleWindow).bounds);
_outConsoleWindow->setActive(false);
_outConsoleWindow->setCallback(outConsoleWindowCallback, this);
- loadBorder(_outConsoleWindow, "border_left_scroll_inac.bmp", false);
- loadBorder(_outConsoleWindow, "border_left_scroll_inac.bmp", true);
+ loadBorder(_outConsoleWindow, "border_left_scroll_inac.bmp", false, findWindowData(kOutConsoleWindow).type);
+ loadBorder(_outConsoleWindow, "border_left_scroll_inac.bmp", true, findWindowData(kOutConsoleWindow).type);
// Self Window
_selfWindow = _wm.addWindow(false, true, false);
_selfWindow->setDimensions(getWindowData(kSelfWindow).bounds);
_selfWindow->setActive(false);
_selfWindow->setCallback(selfWindowCallback, this);
- loadBorder(_selfWindow, "border_none.bmp", false);
- loadBorder(_selfWindow, "border_none.bmp", true);
+ loadBorder(_selfWindow, "border_none.bmp", false, findWindowData(kSelfWindow).type);
+ loadBorder(_selfWindow, "border_none.bmp", true, findWindowData(kSelfWindow).type);
// Exits Window
_exitsWindow = _wm.addWindow(false, false, false);
_exitsWindow->setDimensions(getWindowData(kExitsWindow).bounds);
_exitsWindow->setActive(false);
_exitsWindow->setCallback(exitsWindowCallback, this);
- loadBorder(_exitsWindow, "border_no_scroll_inac.bmp", false);
- loadBorder(_exitsWindow, "border_no_scroll_act.bmp", true);
+ loadBorder(_exitsWindow, "border_no_scroll_inac.bmp", false, findWindowData(kExitsWindow).type);
+ loadBorder(_exitsWindow, "border_no_scroll_act.bmp", true, findWindowData(kExitsWindow).type);
}
const WindowData& Gui::getWindowData(WindowReference reference) {
@@ -336,15 +336,15 @@ WindowReference Gui::createInventoryWindow(ObjID objRef) {
newWindow->setDimensions(newData.bounds);
newWindow->setCallback(inventoryWindowCallback, this);
newWindow->setCloseable(true);
- //loadBorder(newWindow, "border_no_scroll_inac.bmp", false);
- //loadBorder(newWindow, "border_no_scroll_act.bmp", true);
+ loadBorder(newWindow, "border_both_scroll_inac.bmp", false, newData.type);
+ loadBorder(newWindow, "border_both_scroll_inac.bmp", true, newData.type);
_inventoryWindows.push_back(newWindow);
debug("Create new inventory window. Reference: %d", newData.refcon);
return newData.refcon;
}
-void Gui::loadBorder(Graphics::MacWindow * target, Common::String filename, bool active) {
+void Gui::loadBorder(Graphics::MacWindow *target, Common::String filename, bool active, MVWindowType type) {
Common::File borderfile;
if (!borderfile.open(filename)) {
@@ -358,8 +358,9 @@ void Gui::loadBorder(Graphics::MacWindow * target, Common::String filename, bool
Graphics::TransparentSurface *surface = new Graphics::TransparentSurface();
if (stream) {
+ BorderBounds bbs = borderBounds(type);
debug(4, "Loading %s border from %s", (active ? "active" : "inactive"), filename.c_str());
- target->loadBorder(*stream, active);
+ target->loadBorder(*stream, active, bbs.leftOffset, bbs.rightOffset, bbs.topOffset, bbs.bottomOffset);
delete stream;
}
@@ -575,6 +576,15 @@ void Gui::drawMainGameWindow() {
}
drawObjectsInWindow(kMainGameWindow, _mainGameWindow->getSurface());
+ if (MACVENTURE_DEBUG_GUI) {
+ Graphics::MacWindow *win = findWindow(data.refcon);
+ Common::Rect innerDims = win->getInnerDimensions();
+ int x = win->getDimensions().left;
+ int y = win->getDimensions().top;
+ innerDims.translate(-x, -y);
+ win->getSurface()->frameRect(innerDims, kColorGreen);
+ }
+
findWindow(kMainGameWindow)->setDirty(true);
}
@@ -599,8 +609,11 @@ void Gui::drawInventories() {
drawObjectsInWindow(data.refcon, srf);
if (MACVENTURE_DEBUG_GUI) {
- Common::Rect innerDims = findWindow(data.refcon)->getInnerDimensions();
- innerDims = Common::Rect(17, 17, innerDims.width() + 17, innerDims.height() + 17);
+ Graphics::MacWindow *win = findWindow(data.refcon);
+ Common::Rect innerDims = win->getInnerDimensions();
+ int x = win->getDimensions().left;
+ int y = win->getDimensions().top;
+ innerDims.translate(-x, -y);
srf->frameRect(innerDims, kColorGreen);
}
@@ -1322,7 +1335,7 @@ bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) {
if (_engine->needsClickToContinue())
return true;
- if (event.type == Common::EVENT_LBUTTONDOWN) {
+ if (event.type == Common::EVENT_LBUTTONDOWN && click == kBorderInner) {
// Find the appropriate window
WindowReference ref = findWindowAtPoint(event.mouse);
if (ref == kNoWindow) return false;
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index 95e1480762..90f2f42991 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -203,7 +203,7 @@ private: // Methods
bool loadMenus();
bool loadWindows();
bool loadControls();
- void loadBorder(Graphics::MacWindow * target, Common::String filename, bool active);
+ void loadBorder(Graphics::MacWindow * target, Common::String filename, bool active, MVWindowType type);
void loadGraphics();
// Drawers
diff --git a/engines/macventure/windows.cpp b/engines/macventure/windows.cpp
index 33a63709d2..c89fa9397c 100644
--- a/engines/macventure/windows.cpp
+++ b/engines/macventure/windows.cpp
@@ -40,7 +40,7 @@ BorderBounds borderBounds(MVWindowType type) {
case MacVenture::kMovableDBox:
break;
case MacVenture::kZoomDoc:
- return BorderBounds(1, 19, 16, 1);
+ return BorderBounds(1, 19, 16, 16);
case MacVenture::kZoomNoGrow:
break;
case MacVenture::kRDoc16: