home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
TOP
/
USR
/
SRC
/
yahtzee.t.Z
/
yahtzee.t
/
help.c
< prev
next >
Wrap
Text File
|
1988-07-28
|
2KB
|
83 lines
/* help.c
* interactive help routines available at all stages of play.
*/
#include <curses.h>
#include "defs.h"
#include "help.h"
extern int BadStandout;
/* help_out is the main help routine, 'help_scr' is the number of the
* help page to be displayed (see help.h), the window that help is
* requested for is 'screen' (this will be overwritten and must be
* redrawn at the end of this procedure) */
help_out(help_scr, screen)
int help_scr;
WINDOW *screen;
{
int tmp_y, tmp_x, i;
char ch;
WINDOW *help;
/* move the cursor to the top of the back window as initialisation
* of this routine can take a few seconds on a slow machine (leaving
* an impatient user wondering what key to hit to get help working) */
getyx(screen, tmp_y, tmp_x);
wmove(screen, 0, 0);
wrefresh(screen);
/* create the help window */
help = newwin(max_lines, max_cols, 4, 15);
BoxUp(help, max_lines, max_cols);
/* move the relevant data to the window */
for (i = 0; help_words[help_scr][i][0] != '\0'; ++i)
mvwaddstr(help, i + 1, 1, help_words[help_scr][i]);
mvwaddstr(help, max_lines - 2, 1, "--(q)uit--");
#ifndef SYS5_3
wrefresh(help);
#endif
do
{
ch = wgetch(help);
switch (ch)
{
case Form_Feed : redraw(help);
break;
case '?' : help_out(5, help);
break;
case 'b' : rools(help);
break;
case 's' : dis_score(help);
break;
case '!' : shell(help);
break;
case 'v' : version(help);
break;
#if defined(SYS5) || defined(SYS5_3)
case '$' : shwin(help);
break;
case 'q' :
case ' ' : break;
default : flash();
break;
#endif
}
} while (ch != 'q' && ch != ' ');
/* remove the input prompt */
mvwaddstr(help, max_lines - 2, 1, " ");
wmove(help, 0, 0);
wrefresh(help);
/* get rid of help window */
delwin(help);
/* restore previous window */
touchwin(screen);
wmove(screen, tmp_y, tmp_x);
wrefresh(screen);
}