aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-19 18:41:35 +0100
committerEugene Sandulenko2016-02-14 17:12:48 +0100
commit750e44219f246c404b44170001287b1ffb64ec89 (patch)
treeaf6de776d05454c58f6c72f7692c202f4aed0927 /engines
parent876036230246418aa86711d33f485f5c83e769c4 (diff)
downloadscummvm-rg350-750e44219f246c404b44170001287b1ffb64ec89.tar.gz
scummvm-rg350-750e44219f246c404b44170001287b1ffb64ec89.tar.bz2
scummvm-rg350-750e44219f246c404b44170001287b1ffb64ec89.zip
WAGE: Dialog loop
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/dialog.cpp24
-rw-r--r--engines/wage/dialog.h10
-rw-r--r--engines/wage/wage.cpp16
-rw-r--r--engines/wage/wage.h4
4 files changed, 53 insertions, 1 deletions
diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp
index eb29f80cff..abd4d1b1c4 100644
--- a/engines/wage/dialog.cpp
+++ b/engines/wage/dialog.cpp
@@ -46,6 +46,7 @@
*/
#include "common/system.h"
+#include "common/events.h"
#include "wage/wage.h"
#include "wage/design.h"
@@ -132,4 +133,27 @@ void Dialog::drawOutline(Common::Rect &bounds, int *spec, int speclen) {
1, kColorBlack, _gui->_patterns, kPatternSolid);
}
+void Dialog::run() {
+ bool shouldQuit = false;
+
+ paint();
+
+ while (!shouldQuit) {
+ Common::Event event;
+
+ while (_gui->_engine->_eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_QUIT:
+ shouldQuit = true;
+ break;
+ default:
+ break;
+ }
+ }
+
+ g_system->updateScreen();
+ g_system->delayMillis(50);
+ }
+}
+
} // End of namespace Wage
diff --git a/engines/wage/dialog.h b/engines/wage/dialog.h
index 747d9dea05..7983417b47 100644
--- a/engines/wage/dialog.h
+++ b/engines/wage/dialog.h
@@ -53,6 +53,14 @@ namespace Wage {
struct DialogButton {
Common::String text;
Common::Rect bounds;
+
+ DialogButton(const char *t, int x1, int y1, int x2, int y2) {
+ text = t;
+ bounds.left = x1;
+ bounds.top = y1;
+ bounds.right = x2;
+ bounds.bottom = y2;
+ }
};
typedef Common::Array<DialogButton *> DialogButtonArray;
@@ -62,6 +70,8 @@ public:
Dialog(Gui *gui, const char *text, DialogButtonArray *buttons);
~Dialog();
+ void run();
+
private:
Gui *_gui;
Graphics::Surface _tempSurface;
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index db7e364fab..b8d0977853 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -54,6 +54,7 @@
#include "wage/wage.h"
#include "wage/entities.h"
#include "wage/gui.h"
+#include "wage/dialog.h"
#include "wage/script.h"
#include "wage/world.h"
@@ -139,6 +140,7 @@ void WageEngine::processEvents() {
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_QUIT:
+ gameOver();
_shouldQuit = true;
break;
case Common::EVENT_MOUSEMOVE:
@@ -217,7 +219,15 @@ void WageEngine::appendText(char *str) {
}
void WageEngine::gameOver() {
- warning("STUB: WageEngine::gameOver()");
+ DialogButtonArray buttons;
+
+ buttons.push_back(new DialogButton("OK", 112, 67, 68, 28));
+
+ Dialog gameOver(_gui, _world->_gameOverMessage->c_str(), &buttons);
+
+ gameOver.run();
+
+ doClose();
}
void WageEngine::performInitialSetup() {
@@ -278,6 +288,10 @@ void WageEngine::performInitialSetup() {
}
}
+void WageEngine::doClose() {
+ warning("STUB: doClose()");
+}
+
Scene *WageEngine::getSceneByName(String &location) {
Scene *scene;
if (location.equals("random@")) {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 245fc9ba18..0d540d3c0b 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -63,6 +63,7 @@ namespace Wage {
class Console;
class Chr;
class Designed;
+class Dialog;
class Gui;
class Obj;
class Scene;
@@ -107,6 +108,7 @@ const char *getGenderSpecificPronoun(int gender, bool capitalize);
typedef Common::Array<byte *> Patterns;
class WageEngine : public Engine {
+ friend class Dialog;
public:
WageEngine(OSystem *syst, const ADGameDescription *gameDesc);
~WageEngine();
@@ -135,6 +137,8 @@ private:
void performOffer(Chr *attacker, Chr *victim);
void performTake(Chr *npc, Obj *obj);
+ void doClose();
+
public:
Common::RandomSource *_rnd;