X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/d4bc69f1955dbd6fab42819a95454e96b66a74aa..4506ee6421a65ebf465cb3e1124f0ba604dbcb20:/rogue/message.c diff --git a/rogue/message.c b/rogue/message.c index 2bdcd3b2..17af007c 100644 --- a/rogue/message.c +++ b/rogue/message.c @@ -1,6 +1,8 @@ +/* $NetBSD: message.c,v 1.8 2000/07/10 10:19:27 itojun Exp $ */ + /* - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Timothy C. Stoehr. @@ -34,9 +36,13 @@ * SUCH DAMAGE. */ +#include #ifndef lint -/*static char sccsid[] = "from: @(#)message.c 5.3 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: message.c,v 1.3 1993/08/10 16:33:14 mycroft Exp $"; +#if 0 +static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: message.c,v 1.8 2000/07/10 10:19:27 itojun Exp $"); +#endif #endif /* not lint */ /* @@ -51,24 +57,20 @@ static char rcsid[] = "$Id: message.c,v 1.3 1993/08/10 16:33:14 mycroft Exp $"; * */ -#include -#include #include +#include #include "rogue.h" char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""}; short msg_col = 0, imsg = -1; boolean msg_cleared = 1, rmsg = 0; char hunger_str[8] = ""; -char *more = "-more-"; - -extern boolean cant_int, did_int, interrupted, save_is_interactive; -extern short add_strength; -extern short cur_level; +const char *more = "-more-"; +void message(msg, intrpt) -char *msg; -boolean intrpt; + const char *msg; + boolean intrpt; { cant_int = 1; @@ -100,12 +102,13 @@ boolean intrpt; if (did_int) { did_int = 0; - onintr(); + onintr(0); } } +void remessage(c) -short c; + short c; { if (imsg != -1) { check_message(); @@ -120,6 +123,7 @@ short c; } } +void check_message() { if (msg_cleared) { @@ -131,11 +135,13 @@ check_message() msg_cleared = 1; } +int get_input_line(prompt, insert, buf, if_cancelled, add_blank, do_echo) -char *prompt, *buf, *insert; -char *if_cancelled; -boolean add_blank; -boolean do_echo; + const char *prompt, *insert; + char *buf; + const char *if_cancelled; + boolean add_blank; + boolean do_echo; { short ch; short i = 0, n; @@ -189,38 +195,42 @@ boolean do_echo; return(i); } +int rgetchar() { - register ch; + int ch; for(;;) { ch = getchar(); -#ifdef VREPRINT - if (ch == origtermio.c_cc[VREPRINT]) + switch(ch) { + case '\022': wrefresh(curscr); - else -#endif -#ifdef VSUSP - if (ch == origtermio.c_cc[VSUSP]) { - printf(CL); + break; +#ifdef UNIX_BSD4_2 + case '\032': + printf("%s", CL); fflush(stdout); - kill(0, SIGTSTP); - } else + tstp(); + break; #endif - if (ch == '&') + case '&': save_screen(); - else + break; + default: return(ch); + } } } + /* Level: 99 Gold: 999999 Hp: 999(999) Str: 99(99) Arm: 99 Exp: 21/10000000 Hungry 0 5 1 5 2 5 3 5 4 5 5 5 6 5 7 5 */ +void print_stats(stat_mask) -register stat_mask; + int stat_mask; { char buf[16]; boolean label; @@ -305,9 +315,10 @@ register stat_mask; refresh(); } +void pad(s, n) -char *s; -short n; + const char *s; + short n; { short i; @@ -316,6 +327,7 @@ short n; } } +void save_screen() { FILE *fp; @@ -344,6 +356,7 @@ save_screen() } } +void sound_bell() { putchar(7); @@ -352,15 +365,16 @@ sound_bell() boolean is_digit(ch) -short ch; + short ch; { return((ch >= '0') && (ch <= '9')); } +int r_index(str, ch, last) -char *str; -int ch; -boolean last; + const char *str; + int ch; + boolean last; { int i = 0;