aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/macventure/dialog.cpp34
-rw-r--r--engines/macventure/dialog.h4
-rw-r--r--engines/macventure/gui.cpp32
-rw-r--r--engines/macventure/gui.h3
-rw-r--r--engines/macventure/macventure.cpp22
-rw-r--r--engines/macventure/macventure.h3
-rw-r--r--engines/macventure/script.cpp1
7 files changed, 73 insertions, 26 deletions
diff --git a/engines/macventure/dialog.cpp b/engines/macventure/dialog.cpp
index 78fb942db1..3a09feffd5 100644
--- a/engines/macventure/dialog.cpp
+++ b/engines/macventure/dialog.cpp
@@ -41,13 +41,26 @@ struct PrebuiltDialog {
PrebuiltDialog prebuiltDialogs[kPrebuiltDialogCount] = {
{/* kSaveAsDialog */
- Common::Rect(0, 146, 456, 254),
- { {kDEButton, "YES", kDANone, Common::Point(24, 68), 120, 22},
- {kDEButton, "NO", kDACloseDialog, Common::Point(168, 68), 120, 22},
- {kDEButton, "CANCEL", kDACloseDialog, Common::Point(312, 68), 120, 22},
- {kDEPlainText, "Save As...", kDANone, Common::Point(100, 10), 340, 38},
- {kDETextInput, "", kDANone, Common::Point(100, 30), 340, 20},
- {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}}
+ Common::Rect(0, 146, 456, 254),
+ {
+ {kDEButton, "YES", kDANone, Common::Point(24, 68), 120, 22},
+ {kDEButton, "NO", kDACloseDialog, Common::Point(168, 68), 120, 22},
+ {kDEButton, "CANCEL", kDACloseDialog, Common::Point(312, 68), 120, 22},
+ {kDEPlainText, "Save As...", kDANone, Common::Point(100, 10), 340, 38},
+ {kDETextInput, "", kDANone, Common::Point(100, 30), 340, 20},
+ {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
+ }
+ },
+
+ { /* kSpeakDialog */
+ Common::Rect(20, 92, 400, 200),
+ {
+ {kDEButton, "OK", kDASubmit, Common::Point(10, 70), 50, 20},
+ {kDEButton, "CANCEL", kDACloseDialog, Common::Point(96, 70), 50, 20},
+ {kDEPlainText, "What would you like to say?", kDANone, Common::Point(10, 10), 400, 20},
+ {kDETextInput, "", kDANone, Common::Point(10, 25), 350, 40},
+ {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
+ }
}
};
@@ -75,6 +88,10 @@ void Dialog::handleDialogAction(DialogElement *trigger, DialogAction action) {
case kDACloseDialog:
_gui->closeDialog();
break;
+ case kDASubmit:
+ _gui->setTextInput(_userInput);
+ _gui->closeDialog();
+ break;
}
}
@@ -122,7 +139,6 @@ void Dialog::localize(Common::Point &point) {
void Dialog::setUserInput(Common::String content) {
_userInput = content;
- debug(2, "Set user input: %s", _userInput.c_str());
}
void Dialog::addPrebuiltElement(const MacVenture::PrebuiltDialogElement &element) {
@@ -211,7 +227,7 @@ bool DialogPlainText::doProcessEvent(MacVenture::Dialog *dialog, Common::Event e
void DialogPlainText::doDraw(MacVenture::Dialog *dialog, Graphics::ManagedSurface &target) {
// Draw contents
dialog->getFont().drawString(
- &target, _text, _bounds.left, _bounds.top, _bounds.width(), kColorBlack);
+ &target, _text, _bounds.left, _bounds.top, _bounds.width(), kColorBlack, Graphics::kTextAlignCenter);
}
diff --git a/engines/macventure/dialog.h b/engines/macventure/dialog.h
index fa17432018..1dbebf77f2 100644
--- a/engines/macventure/dialog.h
+++ b/engines/macventure/dialog.h
@@ -37,11 +37,13 @@ class DialogElement;
enum DialogAction {
kDANone,
- kDACloseDialog
+ kDACloseDialog,
+ kDASubmit
};
enum PrebuiltDialogs {
kSaveAsDialog = 0,
+ kSpeakDialog = 1,
kPrebuiltDialogCount
};
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 4b01f8bca9..d8deb4b568 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -31,6 +31,8 @@
namespace MacVenture {
+#define MACVENTURE_DEBUG_GUI true
+
enum MenuAction;
enum {
@@ -333,8 +335,8 @@ WindowReference Gui::createInventoryWindow(ObjID objRef) {
newWindow->setDimensions(newData.bounds);
newWindow->setCallback(inventoryWindowCallback, this);
- loadBorder(newWindow, "border_no_scroll_inac.bmp", false);
- loadBorder(newWindow, "border_no_scroll_act.bmp", true);
+ //loadBorder(newWindow, "border_no_scroll_inac.bmp", false);
+ //loadBorder(newWindow, "border_no_scroll_act.bmp", true);
_inventoryWindows.push_back(newWindow);
debug("Create new inventory window. Reference: %d", newData.refcon);
@@ -658,11 +660,9 @@ void Gui::drawObjectsInWindow(WindowReference target, Graphics::ManagedSurface *
surface, pos.x, pos.y, kBlitOR);
// For test
- surface->frameRect(Common::Rect(
- pos.x,
- pos.y,
- pos.x + _assets[child]->getWidth() + 1,
- pos.y + _assets[child]->getHeight() + 1), kColorGreen);
+ if (MACVENTURE_DEBUG_GUI) {
+ surface->frameRect(_engine->getObjBounds(child), kColorGreen);
+ }
}
}
@@ -802,11 +802,25 @@ void Gui::printText(const Common::String & text) {
_consoleText->printLine(text, _outConsoleWindow->getDimensions().width());
}
+void Gui::setTextInput(Common::String str) {
+ _engine->setTextInput(str);
+}
+
void Gui::closeDialog() {
delete _dialog;
_dialog = nullptr;
}
+void Gui::getTextFromUser() {
+ if (_dialog) {
+ delete _dialog;
+ }
+ _dialog = new Dialog(this, kSpeakDialog);
+ // Hack to pause the engine
+ _engine->clickToContinue();
+}
+
+
void Gui::moveDraggedObject(Common::Point target) {
Common::Point newPos = target + _draggedObj.mouseOffset;
bool movement = false;
@@ -1125,8 +1139,8 @@ bool Gui::tryCloseWindow(WindowReference winID) {
Common::Point Gui::getObjMeasures(ObjID obj) {
ensureAssetLoaded(obj);
- uint w = _assets[obj]->getWidth();
- uint h = _assets[obj]->getHeight();
+ int w = MAX(0, (int)_assets[obj]->getWidth());
+ int h = MAX(0, (int)_assets[obj]->getHeight());
return Common::Point(w, h);
}
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index 046e7e516c..f800aeb835 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -246,6 +246,9 @@ public:
void updateExit(ObjID id);
void printText(const Common::String &text);
+
+ void getTextFromUser();
+ void setTextInput(Common::String str);
void closeDialog();
// Ugly switches
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index b6db45c93a..1fca4288e8 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -372,11 +372,25 @@ void MacVentureEngine::updateWindow(WindowReference winID) {
bool MacVentureEngine::showTextEntry(ObjID text, ObjID srcObj, ObjID destObj) {
debug("Showing speech dialog, asset %d from %d to %d", text, srcObj, destObj);
- _userInput = Common::String("epor");
- warning("Show text entry: not fully implemented");
+ _gui->getTextFromUser();
+
+ // HACK WITH FLAGS
+ _prepared = false;
+ warning("Show text entry: not fully tested");
return true;
}
+void MacVentureEngine::setTextInput(Common::String content) {
+ // HACK WITH FLAGS
+ _prepared = true;
+ _userInput = content;
+ _clickToContinue = false;
+}
+
+Common::String MacVentureEngine::getUserInput() {
+ return _userInput;
+}
+
const GlobalSettings& MacVentureEngine::getGlobalSettings() const {
return _globalSettings;
}
@@ -591,10 +605,6 @@ Common::String MacVentureEngine::getNoun(ObjID ndx) {
return _decodingIndirectArticles->getString(ndx);
}
-Common::String MacVentureEngine::getUserInput() {
- return _userInput;
-}
-
void MacVentureEngine::highlightExit(ObjID objID) {
//ObjID ctl = _gui->getWinChild(obj);
/*if (ctl) {
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index 71c3cbea8b..f6a3ea66af 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -186,6 +186,8 @@ public:
void updateWindow(WindowReference winID);
bool showTextEntry(ObjID text, ObjID srcObj, ObjID destObj);
+ void setTextInput(Common::String content);
+ Common::String getUserInput();
// Data retrieval
bool isPaused();
@@ -201,7 +203,6 @@ public:
uint getPrefixNdx(ObjID obj);
Common::String getPrefixString(uint flag, ObjID obj);
Common::String getNoun(ObjID ndx);
- Common::String getUserInput();
// Attributes consult
Common::Point getObjPosition(ObjID objID);
diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp
index 794bbdde60..fdb470ca48 100644
--- a/engines/macventure/script.cpp
+++ b/engines/macventure/script.cpp
@@ -32,6 +32,7 @@ namespace MacVenture {
ScriptEngine::ScriptEngine(MacVentureEngine * engine, World * world) {
_engine = engine;
_world = world;
+ // HACK
_scripts = new Container("Shadowgate II/Shadow Filter");
}