aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMatthew Hoops2007-09-20 20:50:38 +0000
committerMatthew Hoops2007-09-20 20:50:38 +0000
commitf3175861ba23318520a9044d8c35c33a083847cc (patch)
tree38b5ba0fb889b8d4a436d46bdb0880616e92adb8 /engines/scumm
parent14b89bcf466acc2c4c9267f4986082c7dcf7ac1f (diff)
downloadscummvm-rg350-f3175861ba23318520a9044d8c35c33a083847cc.tar.gz
scummvm-rg350-f3175861ba23318520a9044d8c35c33a083847cc.tar.bz2
scummvm-rg350-f3175861ba23318520a9044d8c35c33a083847cc.zip
implement o72_debugInput (with some help from Kirben)
svn-id: r28988
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/dialogs.cpp26
-rw-r--r--engines/scumm/dialogs.h9
-rw-r--r--engines/scumm/he/script_v72he.cpp14
3 files changed, 46 insertions, 3 deletions
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 828c665c5f..a2b68a5f8d 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -960,4 +960,30 @@ void Indy3IQPointsDialog::handleKeyDown(Common::KeyState state) {
ScummDialog::handleKeyDown(state);
}
+DebugInputDialog::DebugInputDialog(ScummEngine *scumm, char* text)
+ : InfoDialog(scumm, text) {
+ mainText = text;
+ done = 0;
+}
+
+void DebugInputDialog::handleKeyDown(Common::KeyState state) {
+ if (state.keycode == Common::KEYCODE_BACKSPACE && buffer.size() > 0) {
+ buffer.deleteLastChar();
+ Common::String total = mainText + ' ' + buffer;
+ setInfoText(total);
+ draw();
+ reflowLayout();
+ } else if (state.keycode == Common::KEYCODE_RETURN) {
+ done = 1;
+ close();
+ return;
+ } else if ((state.ascii >= '0' && state.ascii <= '9') || (state.ascii >= 'A' && state.ascii <= 'Z') || (state.ascii >= 'a' && state.ascii <= 'z') || state.ascii == '.' || state.ascii == ' ') {
+ buffer += state.ascii;
+ Common::String total = mainText + ' ' + buffer;
+ draw();
+ reflowLayout();
+ setInfoText(total);
+ }
+}
+
} // End of namespace Scumm
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index 23c63d8992..b4cf8b1f85 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -262,6 +262,15 @@ public:
virtual void handleKeyDown(Common::KeyState state);
};
+class DebugInputDialog : public InfoDialog {
+public:
+ DebugInputDialog(ScummEngine *scumm, char* text);
+ virtual void handleKeyDown(Common::KeyState state);
+ bool done;
+ Common::String buffer;
+ Common::String mainText;
+};
+
} // End of namespace Scumm
#endif
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index 5db2ae74ec..df70fb7b0d 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -31,6 +31,7 @@
#include "scumm/actor.h"
#include "scumm/charset.h"
+#include "scumm/dialogs.h"
#include "scumm/file.h"
#include "scumm/he/intern_he.h"
#include "scumm/object.h"
@@ -1692,13 +1693,20 @@ void ScummEngine_v72he::o72_drawWizImage() {
void ScummEngine_v72he::o72_debugInput() {
byte string[255];
+ byte *debugInputString;
copyScriptString(string, sizeof(string));
- debug(0,"o72_debugInput: String %s", string);
- // TODO: Request input and store string result in array
+ DebugInputDialog dialog(this, (char*)string);
+ runDialog(dialog);
+ while (!dialog.done) {
+ parseEvents();
+ dialog.handleKeyDown(_keyPressed);
+ }
+
writeVar(0, 0);
- defineArray(0, kStringArray, 0, 0, 0, 0);
+ debugInputString = defineArray(0, kStringArray, 0, 0, 0, dialog.buffer.size());
+ memcpy(debugInputString, dialog.buffer.c_str(), dialog.buffer.size());
push(readVar(0));
}