summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-12 12:16:38 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-12 12:16:38 +0000
commitf36c1880d545d8ce809306ef2bb945e1bb15c591 (patch)
tree16b156d95aa4e472e5067951ed08ec2733cbc254 /crawl-ref
parentcd0a4992ef7e9a53aa8325a6527f4a64bce323fd (diff)
downloadcrawl-ref-f36c1880d545d8ce809306ef2bb945e1bb15c591.tar.gz
crawl-ref-f36c1880d545d8ce809306ef2bb945e1bb15c591.zip
Fixed compile issues on DOS.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@841 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/libdos.cc41
-rw-r--r--crawl-ref/source/libutil.cc1
2 files changed, 36 insertions, 6 deletions
diff --git a/crawl-ref/source/libdos.cc b/crawl-ref/source/libdos.cc
index ba1e177c77..dc50480c38 100644
--- a/crawl-ref/source/libdos.cc
+++ b/crawl-ref/source/libdos.cc
@@ -8,6 +8,7 @@
// Every .cc must include AppHdr or bad things happen.
#include "AppHdr.h"
+#include "externs.h"
#include <termios.h>
#include <conio.h>
@@ -25,9 +26,40 @@ void init_libdos()
void clear_message_window()
{
- window(1, 18, 78, 25);
+ window(1, VIEW_EY + 1, get_number_of_cols(), get_number_of_lines());
clrscr();
- window(1, 1, 80, 25);
+ window(1, 1, get_number_of_cols(), get_number_of_lines());
+}
+
+static void scroll_message_window()
+{
+ const int x = wherex(), y = wherey();
+
+ textcolor(LIGHTGREY);
+ movetext(1, VIEW_EY + 2, get_number_of_cols(), get_number_of_lines(),
+ 1, VIEW_EY + 1);
+ gotoxy(1, get_number_of_lines());
+ clreol();
+
+ // Cursor also scrolls up so prompts don't look brain-damaged.
+ if (y == get_number_of_lines())
+ gotoxy(x, y - 1);
+}
+
+extern int get_message_window_height();
+void message_out(int which_line, int colour, const char *s, int firstcol,
+ bool newline)
+{
+ if (!firstcol)
+ firstcol = Options.delay_message_clear? 2 : 1;
+
+ gotoxy(firstcol, which_line + VIEW_EY + 1);
+ textcolor(colour);
+
+ cprintf("%s", s);
+
+ if (newline && which_line == get_message_window_height() - 1)
+ scroll_message_window();
}
void set_cursor_enabled(bool enabled)
@@ -44,10 +76,7 @@ bool is_cursor_enabled()
// This will force the cursor down to the next line.
void clear_to_end_of_line()
{
- const int pos = wherex();
- const int cols = get_number_of_cols();
- if (pos <= cols)
- cprintf("%*s", cols - pos + 1, "");
+ clreol();
}
int get_number_of_lines()
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 5e2752de6d..0a7caaaaa4 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -17,6 +17,7 @@
#include "libutil.h"
#include "externs.h"
#include "macro.h"
+#include "stuff.h"
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>