scrolling message window and show –more– only when the message window is filled with new messages since the last mesclr (as suggested by Eidolos/doy on ##crawl).
This currently works only on curses (breaks the DOS and Windows compiles), I'm working on fixing that. There are also some cursor glitches with prompts at the bottom of the message window that I need to fix.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@837 c06c8d41-db1a-0410-9941-cceddc491573
GCIZIUXO5TYROKDUYB3HAY7H7MRDTJNM7HR7DGSH7KXDIZC2LCDAC
D27U7RT2C77NEUBP6JCSQJ2DRCJVHOXUO2PFZ45VFYMEVMKI4TSAC
NKX44AETZPMMRL4WO3OAVR2PSPTTX5PBEM77JH3L3DIPRZZJ34RQC
YRY2TC3VHOYE47M23UJGUWDGF7H7WGU7WLWI4SUNM4EDNTGUPHGAC
OFAVQUIGMKBKXMEMRMNPHJK75RNXJVN3OYWNBKCT6EUUAG6U23DAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
22RFWMSJGG26Z2MQEEXGKVTFSTLREHQIG46WYOTMDRKI5YVMRNVAC
TOKBONNNPTP2CIEHMMR4QAJZTXYETS55OGGDA6FY6NIMNDYMWJDAC
//---------------------------------------------------------------
//
// get_number_of_lines
//
// Made this a function instead of a #define. This should help
// considering the fact that the curses version is a macro
// (curses tends to be implemented with a large number of
// preprocessor macros, which can wreak havoc with things
// like the C++ string class, so we want to isolate that
// away to keep portability up).
//
// Other OSes might want to hook into reading system environment
// variables or player set options to determine the screen size
// (see the Options and SysEnv structures, as well as initfile.cc).
//
// This might be better to move to the lib*.cc files, but we
// don't really have a standard API defined for them, or the
// all important libdos.cc. It would be a good idea to eventually
// head that way. -- bwr
//
//---------------------------------------------------------------
int get_number_of_lines(void)
{
#ifdef UNIX
return (get_number_of_lines_from_curses());
#else
return (25);
#endif
}
#ifdef DOS_TERM
window(1, 18, 78, 25);
clrscr();
window(1, 1, 80, 25);
#endif
#ifdef PLAIN_TERM
int startLine = 18;
gotoxy(1, startLine);
#ifdef UNIX
clear_to_end_of_screen();
#else
int numLines = get_number_of_lines() - startLine + 1;
char blankline[81];
memset(blankline, ' ', sizeof blankline);
blankline[80] = 0;
for (int i = 0; i < numLines; i++)
{
cprintf( blankline );
if (i < numLines - 1)
{
cprintf(EOL);
}
}
#endif
#endif
clear_message_window();
need_prefix = false;
int get_number_of_cols()
{
return (80);
}
static WINDOW *Message_Window;
static void setup_message_window()
{
extern int get_message_window_height();
Message_Window = newwin( get_message_window_height(), get_number_of_cols(),
VIEW_EY, 0 );
if (!Message_Window)
{
fprintf(stderr, "Unable to create message window!");
exit(1);
}
scrollok(Message_Window, true);
idlok(Message_Window, true);
}
void clear_message_window()
{
wattrset( Message_Window, curs_fg_attr(LIGHTGREY) );
werase( Message_Window );
wrefresh( Message_Window );
}
void message_out(int which_line, int color, const char *s, int firstcol,
bool newline)
{
extern int get_message_window_height();
wattrset( Message_Window, curs_fg_attr(color) );
if (!firstcol)
firstcol = Options.delay_message_clear? 1 : 0;
else
firstcol--;
mvwaddstr(Message_Window, which_line, firstcol, s);
if (newline && which_line == get_message_window_height() - 1)
scroll(Message_Window);
wrefresh(Message_Window);
}
int get_number_of_lines()
{
return (25);
}
int get_number_of_cols()
{
return (80);
}