aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-21 11:09:29 +0100
committerEugene Sandulenko2016-02-14 17:12:49 +0100
commit936609fb11e9a75f7cb5b2f0d5e22c94a7e0ff80 (patch)
tree6d77aafda7145d305a5ed419954080cf4fbd86c7
parentc7eed7f0ad4b3c23694c1b97578a4b8b86be54f9 (diff)
downloadscummvm-rg350-936609fb11e9a75f7cb5b2f0d5e22c94a7e0ff80.tar.gz
scummvm-rg350-936609fb11e9a75f7cb5b2f0d5e22c94a7e0ff80.tar.bz2
scummvm-rg350-936609fb11e9a75f7cb5b2f0d5e22c94a7e0ff80.zip
WAGE: Implemented saveDialog()
-rw-r--r--engines/wage/dialog.cpp17
-rw-r--r--engines/wage/dialog.h2
-rw-r--r--engines/wage/wage.cpp17
-rw-r--r--engines/wage/wage.h1
4 files changed, 26 insertions, 11 deletions
diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp
index a02058c331..b58e4af680 100644
--- a/engines/wage/dialog.cpp
+++ b/engines/wage/dialog.cpp
@@ -56,24 +56,23 @@
namespace Wage {
enum {
- kDialogWidth = 199,
kDialogHeight = 113
};
-Dialog::Dialog(Gui *gui, const char *text, DialogButtonArray *buttons) : _gui(gui), _text(text), _buttons(buttons) {
+Dialog::Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, int defaultButton) :
+ _gui(gui), _text(text), _buttons(buttons), _defaultButton(defaultButton) {
assert(_gui->_engine);
assert(_gui->_engine->_world);
_font = getDialogFont();
- _tempSurface.create(kDialogWidth, kDialogHeight, Graphics::PixelFormat::createFormatCLUT8());
+ _tempSurface.create(width, kDialogHeight, Graphics::PixelFormat::createFormatCLUT8());
- _bbox.left = (_gui->_screen.w - kDialogWidth) / 2;
+ _bbox.left = (_gui->_screen.w - width) / 2;
_bbox.top = (_gui->_screen.h - kDialogHeight) / 2;
- _bbox.right = (_gui->_screen.w + kDialogWidth) / 2;
+ _bbox.right = (_gui->_screen.w + width) / 2;
_bbox.bottom = (_gui->_screen.h + kDialogHeight) / 2;
- _defaultButton = -1;
_pressedButton = -1;
_mouseOverPressedButton = false;
@@ -81,9 +80,6 @@ Dialog::Dialog(Gui *gui, const char *text, DialogButtonArray *buttons) : _gui(gu
// Adjust button positions
for (int i = 0; i < _buttons->size(); i++)
_buttons->operator[](i)->bounds.translate(_bbox.left, _bbox.top);
-
- if (_buttons->size() == 1)
- _defaultButton = 0;
}
Dialog::~Dialog() {
@@ -151,8 +147,11 @@ void Dialog::run() {
while (_gui->_engine->_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
+ _gui->_engine->_shouldQuit = true;
shouldQuit = true;
break;
+ case Common::EVENT_MOUSEMOVE:
+
default:
break;
}
diff --git a/engines/wage/dialog.h b/engines/wage/dialog.h
index 6e972e252b..1dc777712f 100644
--- a/engines/wage/dialog.h
+++ b/engines/wage/dialog.h
@@ -67,7 +67,7 @@ typedef Common::Array<DialogButton *> DialogButtonArray;
class Dialog {
public:
- Dialog(Gui *gui, const char *text, DialogButtonArray *buttons);
+ Dialog(Gui *gui, int width, const char *text, DialogButtonArray *buttons, int defaultButton);
~Dialog();
void run();
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 9cb3a01739..9ecd4c7d5b 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -140,6 +140,7 @@ void WageEngine::processEvents() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
+ saveDialog();
_shouldQuit = true;
break;
case Common::EVENT_MOUSEMOVE:
@@ -222,13 +223,27 @@ void WageEngine::gameOver() {
buttons.push_back(new DialogButton("OK", 66, 67, 68, 28));
- Dialog gameOver(_gui, _world->_gameOverMessage->c_str(), &buttons);
+ Dialog gameOver(_gui, 199, _world->_gameOverMessage->c_str(), &buttons, 0);
gameOver.run();
doClose();
}
+void WageEngine::saveDialog() {
+ DialogButtonArray buttons;
+
+ buttons.push_back(new DialogButton("No", 19, 67, 68, 28));
+ buttons.push_back(new DialogButton("Yes", 112, 67, 68, 28));
+ buttons.push_back(new DialogButton("Cancel", 205, 67, 68, 28));
+
+ Dialog save(_gui, 291, "Save changes before closing?", &buttons, 1);
+
+ save.run();
+
+ doClose();
+}
+
void WageEngine::performInitialSetup() {
debug(5, "Resetting Objs: %d", _world->_orderedObjs.size());
for (uint i = 0; i < _world->_orderedObjs.size() - 1; i++)
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 06304d0752..122eced2a2 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -162,6 +162,7 @@ public:
void appendText(String &str);
void appendText(char *str);
void gameOver();
+ void saveDialog();
Obj *getOffer();
Chr *getMonster();
void processEvents();