[Scummvm-cvs-logs] SF.net SVN: scummvm: [28988] scummvm/trunk/engines/scumm
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Thu Sep 20 22:50:38 CEST 2007
Revision: 28988
http://scummvm.svn.sourceforge.net/scummvm/?rev=28988&view=rev
Author: mthreepwood
Date: 2007-09-20 13:50:38 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
implement o72_debugInput (with some help from Kirben)
Modified Paths:
--------------
scummvm/trunk/engines/scumm/dialogs.cpp
scummvm/trunk/engines/scumm/dialogs.h
scummvm/trunk/engines/scumm/he/script_v72he.cpp
Modified: scummvm/trunk/engines/scumm/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.cpp 2007-09-20 18:18:10 UTC (rev 28987)
+++ scummvm/trunk/engines/scumm/dialogs.cpp 2007-09-20 20:50:38 UTC (rev 28988)
@@ -960,4 +960,30 @@
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
Modified: scummvm/trunk/engines/scumm/dialogs.h
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.h 2007-09-20 18:18:10 UTC (rev 28987)
+++ scummvm/trunk/engines/scumm/dialogs.h 2007-09-20 20:50:38 UTC (rev 28988)
@@ -262,6 +262,15 @@
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
Modified: scummvm/trunk/engines/scumm/he/script_v72he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v72he.cpp 2007-09-20 18:18:10 UTC (rev 28987)
+++ scummvm/trunk/engines/scumm/he/script_v72he.cpp 2007-09-20 20:50:38 UTC (rev 28988)
@@ -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_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));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list