aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan3/glkio.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2019-07-03 21:56:09 -0700
committerPaul Gilbert2019-07-06 15:27:09 -0700
commitefdf25b3d28113b01e18ef0c69221194a1100e9e (patch)
treeb602ca9f6b29b4a4ecd4eb4047e5fd1163353047 /engines/glk/alan3/glkio.cpp
parent0f0c2c97e13d01cd77ba9fb489aec77398ce6945 (diff)
downloadscummvm-rg350-efdf25b3d28113b01e18ef0c69221194a1100e9e.tar.gz
scummvm-rg350-efdf25b3d28113b01e18ef0c69221194a1100e9e.tar.bz2
scummvm-rg350-efdf25b3d28113b01e18ef0c69221194a1100e9e.zip
GLK: ALAN3: Move term.cpp code into glkio.cpp
Diffstat (limited to 'engines/glk/alan3/glkio.cpp')
-rw-r--r--engines/glk/alan3/glkio.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/engines/glk/alan3/glkio.cpp b/engines/glk/alan3/glkio.cpp
index 6cc264f30a..f36c396ed0 100644
--- a/engines/glk/alan3/glkio.cpp
+++ b/engines/glk/alan3/glkio.cpp
@@ -20,15 +20,19 @@
*
*/
-#include "glk/alan3/alan3.h"
#include "glk/alan3/glkio.h"
#include "glk/alan3/acode.h"
+#include "glk/alan3/current.h"
+#include "glk/alan3/instance.h"
+#include "glk/alan3/options.h"
+#include "glk/alan3/output.h"
namespace Glk {
namespace Alan3 {
winid_t glkMainWin;
winid_t glkStatusWin;
+bool onStatusLine;
void glkio_printf(const char *fmt, ...) {
// If there's a savegame being loaded from the launcher, ignore any text out
@@ -97,5 +101,38 @@ void setStyle(int style) {
}
}
+void statusline(CONTEXT) {
+ uint32 glkWidth;
+ char line[100];
+ int pcol = col;
+
+ if (!statusLineOption) return;
+ if (glkStatusWin == NULL)
+ return;
+
+ g_vm->glk_set_window(glkStatusWin);
+ g_vm->glk_window_clear(glkStatusWin);
+ g_vm->glk_window_get_size(glkStatusWin, &glkWidth, NULL);
+
+ onStatusLine = TRUE;
+ col = 1;
+ g_vm->glk_window_move_cursor(glkStatusWin, 1, 0);
+ CALL1(sayInstance, where(HERO, /*TRUE*/ TRANSITIVE))
+
+ // TODO Add status message1 & 2 as author customizable messages
+ if (header->maximumScore > 0)
+ sprintf(line, "Score %d(%d)/%d moves", current.score, (int)header->maximumScore, current.tick);
+ else
+ sprintf(line, "%d moves", current.tick);
+ g_vm->glk_window_move_cursor(glkStatusWin, glkWidth - strlen(line) - 1, 0);
+ g_vm->glk_put_string(line);
+ needSpace = FALSE;
+
+ col = pcol;
+ onStatusLine = FALSE;
+
+ g_vm->glk_set_window(glkMainWin);
+}
+
} // End of namespace Alan3
} // End of namespace Glk