aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/monitor.cpp
diff options
context:
space:
mode:
authorBertrand Augereau2011-11-18 07:48:07 +0100
committerBertrand Augereau2011-11-18 08:25:39 +0100
commit26dd3f52f21d71f3fe054a5cb917639d93b598a4 (patch)
treea556bf978f00a58a1b6e19c152982f1f872288d6 /engines/dreamweb/monitor.cpp
parent2631da94099b8ecabf3e5cb571bb5aa087dbf467 (diff)
downloadscummvm-rg350-26dd3f52f21d71f3fe054a5cb917639d93b598a4.tar.gz
scummvm-rg350-26dd3f52f21d71f3fe054a5cb917639d93b598a4.tar.bz2
scummvm-rg350-26dd3f52f21d71f3fe054a5cb917639d93b598a4.zip
DREAMWEB: 'input' ported to C++
Diffstat (limited to 'engines/dreamweb/monitor.cpp')
-rw-r--r--engines/dreamweb/monitor.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 8c21a5b455..5da481a60f 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -105,5 +105,58 @@ void DreamGenContext::printlogo() {
showcurrentfile();
}
+void DreamGenContext::input() {
+ char *inputLine = (char *)cs.ptr(kInputline, 64);
+ memset(inputLine, 0, 64);
+ data.word(kCurpos) = 0;
+ ds = data.word(kTempcharset);
+ {
+ uint16 x = data.word(kMonadx);
+ uint8 width, height;
+ printchar((Frame *)segRef(data.word(kTempcharset)).ptr(0, 0), &x, data.word(kMonady), '>', 0, &width, &height);
+ }
+ multidump(data.word(kMonadx), data.word(kMonady), 6, 8);
+ data.word(kMonadx) += 6;
+ data.word(kCurslocx) = data.word(kMonadx);
+ data.word(kCurslocy) = data.word(kMonady);
+ while (true) {
+ printcurs();
+ vsync();
+ delcurs();
+ readkey();
+ uint8 currentKey = data.byte(kCurrentkey);
+ if (currentKey == 0)
+ continue;
+ if (currentKey == 13)
+ return;
+ if (currentKey == 8) {
+ if (data.word(kCurpos) > 0)
+ delchar();
+ continue;
+ }
+ if (data.word(kCurpos) == 28)
+ continue;
+ if ((currentKey == 32) && (data.word(kCurpos) == 0))
+ continue;
+ al = currentKey;
+ makecaps();
+ currentKey = al;
+ inputLine[data.word(kCurpos) * 2 + 0] = currentKey;
+ if (currentKey > 'Z')
+ continue;
+ multiget(segRef(data.word(kMapstore)).ptr(data.word(kCurpos) * 256, 0), data.word(kMonadx), data.word(kMonady), 8, 8);
+ uint8 charWidth;
+ {
+ uint16 x = data.word(kMonadx);
+ uint8 height;
+ printchar((Frame *)segRef(data.word(kTempcharset)).ptr(0, 0), &x, data.word(kMonady), currentKey, 0, &charWidth, &height);
+ }
+ inputLine[data.word(kCurpos) * 2 + 1] = charWidth;
+ data.word(kMonadx) += charWidth;
+ ++data.word(kCurpos);
+ data.word(kCurslocx) += charWidth;
+ }
+}
+
} /*namespace dreamgen */