diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1998-08-22 08:56:02 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1998-08-22 08:56:02 +0000 |
commit | 6910826c1b27cf6a9d4cb8400743d571d3c9a27b (patch) | |
tree | 9562c830236235b683790903daad5db093658719 | |
parent | 92cf145f2c1e59139400da3a8db7b06cc24b7b54 (diff) |
More largely NetBSD-inspired code cleanup
35 files changed, 1260 insertions, 666 deletions
diff --git a/games/random/random.6 b/games/random/random.6 index 5d238367454..f4cd2c57b10 100644 --- a/games/random/random.6 +++ b/games/random/random.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: random.6,v 1.2 1995/04/22 07:44:04 cgd Exp $ +.\" $OpenBSD: random.6,v 1.2 1998/08/22 08:55:21 pjanzen Exp $ .\" .\" Copyright (c) 1994 .\" The Regents of the University of California. All rights reserved. @@ -40,7 +40,7 @@ .Nm random .Nd random lines from a file or random numbers .Sh SYNOPSIS -.Nm random +.Nm .Op Fl er .Op Ar denominator .Sh DESCRIPTION @@ -57,7 +57,7 @@ The options are as follows: If the .Fl e option is specified, -.Nm random +.Nm does not read or write anything, and simply exits with a random exit value of 0 to .Ar denominator diff --git a/games/random/random.c b/games/random/random.c index 94238dea7e7..b65e2c721e3 100644 --- a/games/random/random.c +++ b/games/random/random.c @@ -1,3 +1,4 @@ +/* $OpenBSD: random.c,v 1.6 1998/08/22 08:55:22 pjanzen Exp $ */ /* $NetBSD: random.c,v 1.3 1995/04/22 07:44:05 cgd Exp $ */ /* @@ -46,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)random.c 8.5 (Berkeley) 4/5/94"; #else -static char rcsid[] = "$NetBSD: random.c,v 1.3 1995/04/22 07:44:05 cgd Exp $"; +static char rcsid[] = "$OpenBSD: random.c,v 1.6 1998/08/22 08:55:22 pjanzen Exp $"; #endif #endif /* not lint */ @@ -69,7 +70,6 @@ main(argc, argv) int argc; char *argv[]; { - extern int optind; double denom; int ch, random_exit, selected, unbuffer_output; char *ep; @@ -79,7 +79,7 @@ main(argc, argv) setgid(getgid()); random_exit = unbuffer_output = 0; - while ((ch = getopt(argc, argv, "er")) != -1) + while ((ch = getopt(argc, argv, "erh")) != -1) switch (ch) { case 'e': random_exit = 1; @@ -88,7 +88,7 @@ main(argc, argv) unbuffer_output = 1; break; default: - case '?': + case '?': case 'h': usage(); /* NOTREACHED */ } diff --git a/games/robots/main.c b/games/robots/main.c index a2adddc02cf..b1f98dec7d4 100644 --- a/games/robots/main.c +++ b/games/robots/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.6 1998/07/09 04:34:16 pjanzen Exp $ */ +/* $OpenBSD: main.c,v 1.7 1998/08/22 08:55:54 pjanzen Exp $ */ /* $NetBSD: main.c,v 1.5 1995/04/22 10:08:54 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.6 1998/07/09 04:34:16 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.7 1998/08/22 08:55:54 pjanzen Exp $"; #endif #endif /* not lint */ @@ -62,9 +62,8 @@ main(ac, av) int score_wfd; /* high score writable file descriptor */ int score_err = 0; /* hold errno from score file open */ - if ((score_wfd = open(Scorefile, O_RDWR)) < 0) { + if ((score_wfd = open(Scorefile, O_RDWR)) < 0) score_err = errno; - } /* revoke */ setegid(getgid()); @@ -76,16 +75,15 @@ main(ac, av) for (++av; ac > 1 && *av[0]; av++, ac--) if (av[0][0] != '-') { Scorefile = av[0]; - sp = strrchr(Scorefile, '/'); - if (sp == NULL) - sp = Scorefile; if (score_wfd >= 0) close(score_wfd); - /* This file is in the current directory */ - /* and requires no special privileges: */ + /* This file requires no special privileges. */ if ((score_wfd = open(Scorefile, O_RDWR)) < 0) score_err = errno; #ifdef FANCY + sp = strrchr(Scorefile, '/'); + if (sp == NULL) + sp = Scorefile; if (strcmp(sp, "pattern_roll") == 0) Pattern_roll = TRUE; else if (strcmp(sp, "stand_still") == 0) @@ -112,7 +110,7 @@ main(ac, av) Teleport = TRUE; break; default: - fprintf(stderr, "robots: unknown option: %c\n", *sp); + warnx("unknown option: %c", *sp); bad_arg = TRUE; break; } @@ -127,10 +125,9 @@ main(ac, av) exit(0); } - if (score_wfd < 0) { - fprintf(stderr, "%s: %s\n", Scorefile, strerror(score_err)); - exit(1); - } + if (score_wfd < 0) + warnx("%s: %s; no scores will be saved", Scorefile, + strerror(score_err)); initscr(); signal(SIGINT, quit); @@ -140,9 +137,7 @@ main(ac, av) if (LINES != Y_SIZE || COLS != X_SIZE) { if (LINES < Y_SIZE || COLS < X_SIZE) { endwin(); - printf("Need at least a %dx%d screen\n", - Y_SIZE, X_SIZE); - exit(1); + errx(1, "Need at least a %dx%d screen", Y_SIZE, X_SIZE); } delwin(stdscr); stdscr = newwin(Y_SIZE, X_SIZE, 0, 0); diff --git a/games/robots/make_level.c b/games/robots/make_level.c index f93534d911f..72b670b5747 100644 --- a/games/robots/make_level.c +++ b/games/robots/make_level.c @@ -1,4 +1,4 @@ -/* $OpenBSD: make_level.c,v 1.2 1998/07/09 04:34:17 pjanzen Exp $ */ +/* $OpenBSD: make_level.c,v 1.3 1998/08/22 08:55:55 pjanzen Exp $ */ /* $NetBSD: make_level.c,v 1.3 1995/04/22 10:08:56 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)make_level.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: make_level.c,v 1.2 1998/07/09 04:34:17 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: make_level.c,v 1.3 1998/08/22 08:55:55 pjanzen Exp $"; #endif #endif /* not lint */ @@ -70,7 +70,7 @@ make_level() cp->y = -1; My_pos.y = -1; - bzero(Field, sizeof Field); + memset(Field, 0, sizeof Field); Min.y = Y_FIELDSIZE; Min.x = X_FIELDSIZE; Max.y = 0; diff --git a/games/robots/pathnames.h b/games/robots/pathnames.h index 258225c60ac..64484f201e8 100644 --- a/games/robots/pathnames.h +++ b/games/robots/pathnames.h @@ -1,3 +1,4 @@ +/* $OpenBSD: pathnames.h,v 1.2 1998/08/22 08:55:56 pjanzen Exp $ */ /* $NetBSD: pathnames.h,v 1.3 1995/04/22 10:09:01 cgd Exp $ */ /*- diff --git a/games/robots/play_level.c b/games/robots/play_level.c index 07450f00f2a..2746053e1e4 100644 --- a/games/robots/play_level.c +++ b/games/robots/play_level.c @@ -1,4 +1,4 @@ -/* $OpenBSD: play_level.c,v 1.2 1998/07/09 04:34:20 pjanzen Exp $ */ +/* $OpenBSD: play_level.c,v 1.3 1998/08/22 08:55:57 pjanzen Exp $ */ /* $NetBSD: play_level.c,v 1.3 1995/04/22 10:09:03 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)play_level.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: play_level.c,v 1.3 1995/04/22 10:09:03 cgd Exp $"; +static char rcsid[] = "$OpenBSD: play_level.c,v 1.3 1998/08/22 08:55:57 pjanzen Exp $"; #endif #endif /* not lint */ diff --git a/games/robots/robots.6 b/games/robots/robots.6 index e3864d49748..b9decdb1b88 100644 --- a/games/robots/robots.6 +++ b/games/robots/robots.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: robots.6,v 1.4 1995/04/22 10:09:09 cgd Exp $ +.\" $OpenBSD: robots.6,v 1.2 1998/08/22 08:55:59 pjanzen Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,7 +40,7 @@ .Nm robots .Nd fight off villainous robots .Sh SYNOPSIS -.Nm robots +.Nm .Op Fl sjta .Op Ar scorefile .Sh DESCRIPTION @@ -119,7 +119,7 @@ you take the risk of dying by miscalculation. Only five scores are allowed per user on the score file. If you make it into the score file, you will be shown the list at the end of the game. -If an alternate score file is specified, that will be used instead of the +If an alternative score file is specified, that will be used instead of the standard file for scores. .Pp The options are diff --git a/games/robots/robots.h b/games/robots/robots.h index 38f4aac49b3..c660acf4211 100644 --- a/games/robots/robots.h +++ b/games/robots/robots.h @@ -1,4 +1,4 @@ -/* $OpenBSD: robots.h,v 1.2 1998/07/09 04:34:24 pjanzen Exp $ */ +/* $OpenBSD: robots.h,v 1.3 1998/08/22 08:56:00 pjanzen Exp $ */ /* $NetBSD: robots.h,v 1.5 1995/04/24 12:24:54 cgd Exp $ */ /* @@ -128,7 +128,7 @@ bool eaten __P((COORD *)); void flush_in __P((void)); void get_move __P((void)); void init_field __P((void)); -bool jumping __P((void)); +bool jumping __P((void)); void make_level __P((void)); void move_robots __P((int)); bool must_telep __P((void)); diff --git a/games/robots/score.c b/games/robots/score.c index 46b4d20c217..e03b4135ca8 100644 --- a/games/robots/score.c +++ b/games/robots/score.c @@ -1,4 +1,4 @@ -/* $OpenBSD: score.c,v 1.4 1998/07/09 04:34:25 pjanzen Exp $ */ +/* $OpenBSD: score.c,v 1.5 1998/08/22 08:56:01 pjanzen Exp $ */ /* $NetBSD: score.c,v 1.3 1995/04/22 10:09:12 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: score.c,v 1.4 1998/07/09 04:34:25 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: score.c,v 1.5 1998/08/22 08:56:01 pjanzen Exp $"; #endif #endif /* not lint */ @@ -71,6 +71,8 @@ score(score_wfd) static int numscores, max_uid; Newscore = FALSE; + if (inf < 0) + return; if (read(inf, &max_uid, sizeof max_uid) == sizeof max_uid) read(inf, Top, sizeof Top); diff --git a/games/rogue/Makefile b/games/rogue/Makefile index 36a1f52fcd3..8b007e4e65e 100644 --- a/games/rogue/Makefile +++ b/games/rogue/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 1998/07/24 00:10:40 millert Exp $ +# $OpenBSD: Makefile,v 1.5 1998/08/22 08:55:24 pjanzen Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 PROG= rogue @@ -6,8 +6,8 @@ CFLAGS+=-DUNIX -fwritable-strings SRCS= curses.c hit.c init.c inventory.c level.c machdep.c main.c \ message.c monster.c move.c object.c pack.c play.c random.c ring.c \ room.c save.c score.c spec_hit.c throw.c trap.c use.c zap.c -DPADD= ${LIBCURSES} ${LIBCOMPAT} -LDADD= -lcurses -lcompat +DPADD= ${LIBCURSES} +LDADD= -lcurses HIDEGAME=hidegame MAN= rogue.6 @@ -15,4 +15,12 @@ MAN= rogue.6 SUBDIR+= USD.doc .endif +beforeinstall: + @if [ ! -f ${DESTDIR}/var/games/rogue.scores ]; then \ + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 664 \ + /dev/null ${DESTDIR}/var/games/rogue.scores ; \ + else \ + true ; \ + fi + .include <bsd.prog.mk> diff --git a/games/rogue/curses.c b/games/rogue/curses.c index bbae37b5d50..c66e3b67284 100644 --- a/games/rogue/curses.c +++ b/games/rogue/curses.c @@ -1,3 +1,4 @@ +/* $OpenBSD: curses.c,v 1.3 1998/08/22 08:55:25 pjanzen Exp $ */ /* $NetBSD: curses.c,v 1.3 1995/04/22 10:27:27 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)curses.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: curses.c,v 1.3 1995/04/22 10:27:27 cgd Exp $"; +static char rcsid[] = "$OpenBSD: curses.c,v 1.3 1998/08/22 08:55:25 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: curses.c,v 1.3 1995/04/22 10:27:27 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -86,8 +87,6 @@ static char rcsid[] = "$NetBSD: curses.c,v 1.3 1995/04/22 10:27:27 cgd Exp $"; #include <stdio.h> #include "rogue.h" -boolean tc_tname(); - #define BS 010 #define LF 012 #define CR 015 @@ -134,6 +133,7 @@ char *SE = ""; short cur_row; short cur_col; +void initscr() { clear(); @@ -141,38 +141,43 @@ initscr() printf("%s%s", TI, VS); } +void endwin() { printf("%s%s", TE, VE); md_cbreak_no_echo_nonl(0); } +void move(row, col) -short row, col; + short row, col; { curscr->_cury = row; curscr->_curx = col; screen_dirty = 1; } +void mvaddstr(row, col, str) -short row, col; -char *str; + short row, col; + char *str; { move(row, col); addstr(str); } +void addstr(str) -char *str; + char *str; { while (*str) { addch((int) *str++); } } +void addch(ch) -register int ch; + int ch; { short row, col; @@ -187,17 +192,19 @@ register int ch; screen_dirty = 1; } +void mvaddch(row, col, ch) -short row, col; -int ch; + short row, col; + int ch; { move(row, col); addch(ch); } +void refresh() { - register i, j, line; + int i, j, line; short old_row, old_col, first_row; if (screen_dirty) { @@ -223,8 +230,9 @@ refresh() } } +void wrefresh(scr) -WINDOW *scr; + WINDOW *scr; { short i, col; @@ -252,13 +260,15 @@ WINDOW *scr; scr = scr; /* make lint happy */ } +int mvinch(row, col) -short row, col; + short row, col; { move(row, col); return((int) buffer[row][col]); } +void clear() { printf("%s", CL); @@ -268,6 +278,7 @@ clear() clear_buffers(); } +void clrtoeol() { short row, col; @@ -280,34 +291,40 @@ clrtoeol() lines_dirty[row] = 1; } +void standout() { buf_stand_out = 1; } +void standend() { buf_stand_out = 0; } +void crmode() { md_cbreak_no_echo_nonl(1); } +void noecho() { /* crmode() takes care of this */ } +void nonl() { /* crmode() takes care of this */ } +void clear_buffers() { - register i, j; + int i, j; screen_dirty = 0; @@ -320,8 +337,10 @@ clear_buffers() } } +void put_char_at(row, col, ch) -register row, col, ch; + short row, col; + int ch; { put_cursor(row, col); put_st_char(ch); @@ -329,10 +348,11 @@ register row, col, ch; cur_col++; } +void put_cursor(row, col) -register row, col; + short row, col; { - register i, rdif, cdif; + int i, rdif, cdif; short ch, t; rdif = (row > cur_row) ? row - cur_row : cur_row - row; @@ -383,8 +403,9 @@ register row, col; } } +void put_st_char(ch) -register ch; + int ch; { if ((ch & ST_MASK) && (!term_stand_out)) { ch &= ~ST_MASK; @@ -399,13 +420,14 @@ register ch; } } +void get_term_info() { FILE *fp; char *term, *tcf; char buf[BUFLEN]; - if (tcf = md_getenv("TERMCAP")) { + if ((tcf = md_getenv("TERMCAP"))) { if (strlen(tcf) > 40) { clean_up("TERMCAP file name too long"); } @@ -435,9 +457,9 @@ get_term_info() boolean tc_tname(fp, term, buf) -FILE *fp; -char *term; -char *buf; + FILE *fp; + char *term; + char *buf; { short i, j; boolean found = 0; @@ -474,9 +496,10 @@ char *buf; return(found); } +void tc_gtdata(fp, buf) -FILE *fp; -char *buf; + FILE *fp; + char *buf; { short i; boolean first = 1; @@ -534,9 +557,10 @@ char *buf; tc_cmget(); } +void tc_gets(ibuf, tcstr) -char *ibuf; -char **tcstr; + char *ibuf; + char **tcstr; { short i, j, k, n; char obuf[BUFLEN]; @@ -610,9 +634,10 @@ char **tcstr; (void) strcpy(*tcstr, obuf); } +void tc_gnum(ibuf, n) -char *ibuf; -int *n; + char *ibuf; + int *n; { short i; int r = 0; @@ -626,6 +651,7 @@ int *n; *n = r; } +void tstp() { endwin(); @@ -637,6 +663,7 @@ tstp() md_slurp(); } +void tc_cmget() { short i = 0, j = 0, rc_spec = 0; diff --git a/games/rogue/hit.c b/games/rogue/hit.c index c9113b314c7..3f5c68ed071 100644 --- a/games/rogue/hit.c +++ b/games/rogue/hit.c @@ -1,3 +1,4 @@ +/* $OpenBSD: hit.c,v 1.3 1998/08/22 08:55:26 pjanzen Exp $ */ /* $NetBSD: hit.c,v 1.3 1995/04/22 10:27:30 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)hit.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: hit.c,v 1.3 1995/04/22 10:27:30 cgd Exp $"; +static char rcsid[] = "$OpenBSD: hit.c,v 1.3 1998/08/22 08:55:26 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: hit.c,v 1.3 1995/04/22 10:27:30 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -61,12 +62,9 @@ static char rcsid[] = "$NetBSD: hit.c,v 1.3 1995/04/22 10:27:30 cgd Exp $"; object *fight_monster = 0; char hit_message[80] = ""; -extern short halluc, blind, cur_level; -extern short add_strength, ring_exp, r_rings; -extern boolean being_held, interrupted, wizard, con_mon; - +void mon_hit(monster) -register object *monster; + object *monster; { short damage, hit_chance; char *mn; @@ -92,7 +90,8 @@ register object *monster; if (!rand_percent(hit_chance)) { if (!fight_monster) { - sprintf(hit_message + strlen(hit_message), "the %s misses", mn); + sprintf(hit_message + strlen(hit_message), + "the %s misses", mn); message(hit_message, 1); hit_message[0] = 0; } @@ -126,9 +125,10 @@ register object *monster; } } +void rogue_hit(monster, force_hit) -register object *monster; -boolean force_hit; + object *monster; + boolean force_hit; { short damage, hit_chance; @@ -164,10 +164,11 @@ RET: check_gold_seeker(monster); } } +void rogue_damage(d, monster, other) -short d; -object *monster; -short other; + short d; + object *monster; + short other; { if (d >= rogue.hp_current) { rogue.hp_current = 0; @@ -180,11 +181,12 @@ short other; } } +int get_damage(ds, r) -char *ds; -boolean r; + char *ds; + boolean r; { - register i = 0, j, n, d, total = 0; + int i = 0, j, n, d, total = 0; while (ds[i]) { n = get_number(ds+i); @@ -206,12 +208,13 @@ boolean r; return(total); } +int get_w_damage(obj) -object *obj; + object *obj; { char new_damage[12]; - register to_hit, damage; - register i = 0; + int to_hit, damage; + int i = 0; if ((!obj) || (obj->what_is != WEAPON)) { return(-1); @@ -225,11 +228,12 @@ object *obj; return(get_damage(new_damage, 1)); } +int get_number(s) -register char *s; + char *s; { - register i = 0; - register total = 0; + int i = 0; + int total = 0; while ((s[i] >= '0') && (s[i] <= '9')) { total = (10 * total) + (s[i] - '0'); @@ -240,7 +244,7 @@ register char *s; long lget_number(s) -char *s; + char *s; { short i = 0; long total = 0; @@ -252,8 +256,9 @@ char *s; return(total); } +int to_hit(obj) -object *obj; + object *obj; { if (!obj) { return(1); @@ -261,6 +266,7 @@ object *obj; return(get_number(obj->damage) + obj->hit_enchant); } +int damage_for_strength() { short strength; @@ -291,9 +297,10 @@ damage_for_strength() return(8); } +int mon_damage(monster, damage) -object *monster; -short damage; + object *monster; + short damage; { char *mn; short row, col; @@ -324,8 +331,9 @@ short damage; return(1); } +void fight(to_the_death) -boolean to_the_death; + boolean to_the_death; { short ch, c, d; short row, col; @@ -375,10 +383,11 @@ boolean to_the_death; } } +void get_dir_rc(dir, row, col, allow_off_screen) -short dir; -short *row, *col; -short allow_off_screen; + short dir; + short *row, *col; + short allow_off_screen; { switch(dir) { case LEFT: @@ -428,8 +437,9 @@ short allow_off_screen; } } +int get_hit_chance(weapon) -object *weapon; + object *weapon; { short hit_chance; @@ -439,8 +449,9 @@ object *weapon; return(hit_chance); } +int get_weapon_damage(weapon) -object *weapon; + object *weapon; { short damage; @@ -450,8 +461,9 @@ object *weapon; return(damage); } +void s_con_mon(monster) -object *monster; + object *monster; { if (con_mon) { monster->m_flags |= CONFUSED; diff --git a/games/rogue/init.c b/games/rogue/init.c index 75a66d1d6f0..f413d0c3338 100644 --- a/games/rogue/init.c +++ b/games/rogue/init.c @@ -1,3 +1,4 @@ +/* $OpenBSD: init.c,v 1.4 1998/08/22 08:55:27 pjanzen Exp $ */ /* $NetBSD: init.c,v 1.4 1995/04/28 23:49:19 mycroft Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/04/28 23:49:19 mycroft Exp $"; +static char rcsid[] = "$OpenBSD: init.c,v 1.4 1998/08/22 08:55:27 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,12 +53,10 @@ static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/04/28 23:49:19 mycroft Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ -#include <stdio.h> -#include <unistd.h> #include "rogue.h" char login_name[MAX_OPT_LEN]; @@ -75,14 +74,10 @@ char *error_file = "rogue.esave"; char *byebye_string = "Okay, bye bye!"; gid_t gid, egid; -extern char *fruit; -extern char *save_file; -extern short party_room; -extern boolean jump; - +int init(argc, argv) -int argc; -char *argv[]; + int argc; + char *argv[]; { char *pn; int seed; @@ -107,7 +102,7 @@ char *argv[]; initscr(); if ((LINES < DROWS) || (COLS < DCOLS)) { - clean_up("must be played on 24 x 80 screen"); + clean_up("must be played on 24 x 80 screen (or larger)"); } start_window(); init_curses = 1; @@ -134,6 +129,7 @@ char *argv[]; return(0); } +void player_init() { object *obj; @@ -182,8 +178,9 @@ player_init() (void) add_to_pack(obj, &rogue.pack, 1); } +void clean_up(estr) -char *estr; + char *estr; { if (save_is_interactive) { if (init_curses) { @@ -196,6 +193,7 @@ char *estr; md_exit(0); } +void start_window() { crmode(); @@ -205,13 +203,15 @@ start_window() #endif } +void stop_window() { endwin(); } void -byebye() +byebye(dummy) + int dummy; { md_ignore_signals(); if (ask_quit) { @@ -223,7 +223,8 @@ byebye() } void -onintr() +onintr(dummy) + int dummy; { md_ignore_signals(); if (cant_int) { @@ -236,16 +237,18 @@ onintr() } void -error_save() +error_save(dummy) + int dummy; { save_is_interactive = 0; save_into_file(error_file); clean_up(""); } +void do_args(argc, argv) -int argc; -char *argv[]; + int argc; + char *argv[]; { short i, j; @@ -264,11 +267,12 @@ char *argv[]; } } +void do_opts() { char *eptr; - if (eptr = md_getenv("ROGUEOPTS")) { + if ((eptr = md_getenv("ROGUEOPTS"))) { for (;;) { while ((*eptr) == ' ') { eptr++; @@ -311,9 +315,10 @@ do_opts() init_str(&fruit, "slime-mold"); } +void env_get_value(s, e, add_blank) -char **s, *e; -boolean add_blank; + char **s, *e; + boolean add_blank; { short i = 0; char *t; @@ -337,8 +342,9 @@ boolean add_blank; (*s)[i] = '\0'; } +void init_str(str, dflt) -char **str, *dflt; + char **str, *dflt; { if (!(*str)) { *str = md_malloc(MAX_OPT_LEN + 2); diff --git a/games/rogue/inventory.c b/games/rogue/inventory.c index bb6ae627a93..f31d6e5590a 100644 --- a/games/rogue/inventory.c +++ b/games/rogue/inventory.c @@ -1,3 +1,4 @@ +/* $OpenBSD: inventory.c,v 1.3 1998/08/22 08:55:28 pjanzen Exp $ */ /* $NetBSD: inventory.c,v 1.3 1995/04/22 10:27:35 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: inventory.c,v 1.3 1995/04/22 10:27:35 cgd Exp $"; +static char rcsid[] = "$OpenBSD: inventory.c,v 1.3 1998/08/22 08:55:28 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: inventory.c,v 1.3 1995/04/22 10:27:35 cgd Exp $" * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -163,62 +164,60 @@ struct id_com_s { }; struct id_com_s com_id_tab[COMS] = { - '?', "? prints help", - 'r', "r read scroll", - '/', "/ identify object", - 'e', "e eat food", - 'h', "h left ", - 'w', "w wield a weapon", - 'j', "j down", - 'W', "W wear armor", - 'k', "k up", - 'T', "T take armor off", - 'l', "l right", - 'P', "P put on ring", - 'y', "y up & left", - 'R', "R remove ring", - 'u', "u up & right", - 'd', "d drop object", - 'b', "b down & left", - 'c', "c call object", - 'n', "n down & right", - NULL, "<SHIFT><dir>: run that way", - ')', ") print current weapon", - NULL, "<CTRL><dir>: run till adjacent", - ']', "] print current armor", - 'f', "f<dir> fight till death or near death", - '=', "= print current rings", - 't', "t<dir> throw something", - '\001', "^A print Hp-raise average", - 'm', "m<dir> move onto without picking up", - 'z', "z<dir> zap a wand in a direction", - 'o', "o examine/set options", - '^', "^<dir> identify trap type", - '\022', "^R redraw screen", - '&', "& save screen into 'rogue.screen'", - 's', "s search for trap/secret door", - '\020', "^P repeat last message", - '>', "> go down a staircase", - '\033', "^[ cancel command", - '<', "< go up a staircase", - 'S', "S save game", - '.', ". rest for a turn", - 'Q', "Q quit", - ',', ", pick something up", - '!', "! shell escape", - 'i', "i inventory", - 'F', "F<dir> fight till either of you dies", - 'I', "I inventory single item", - 'v', "v print version number", - 'q', "q quaff potion" + {'?', "? prints help"}, + {'r', "r read scroll"}, + {'/', "/ identify object"}, + {'e', "e eat food"}, + {'h', "h left "}, + {'w', "w wield a weapon"}, + {'j', "j down"}, + {'W', "W wear armor"}, + {'k', "k up"}, + {'T', "T take armor off"}, + {'l', "l right"}, + {'P', "P put on ring"}, + {'y', "y up & left"}, + {'R', "R remove ring"}, + {'u', "u up & right"}, + {'d', "d drop object"}, + {'b', "b down & left"}, + {'c', "c call object"}, + {'n', "n down & right"}, + {'\0', "<SHIFT><dir>: run that way"}, + {')', ") print current weapon"}, + {'\0', "<CTRL><dir>: run till adjacent"}, + {']', "] print current armor"}, + {'f', "f<dir> fight till death or near death"}, + {'=', "= print current rings"}, + {'t', "t<dir> throw something"}, + {'\001', "^A print Hp-raise average"}, + {'m', "m<dir> move onto without picking up"}, + {'z', "z<dir> zap a wand in a direction"}, + {'o', "o examine/set options"}, + {'^', "^<dir> identify trap type"}, + {'\022', "^R redraw screen"}, + {'&', "& save screen into 'rogue.screen'"}, + {'s', "s search for trap/secret door"}, + {'\020', "^P repeat last message"}, + {'>', "> go down a staircase"}, + {'\033', "^[ cancel command"}, + {'<', "< go up a staircase"}, + {'S', "S save game"}, + {'.', ". rest for a turn"}, + {'Q', "Q quit"}, + {',', ", pick something up"}, + {'!', "! shell escape"}, + {'i', "i inventory"}, + {'F', "F<dir> fight till either of you dies"}, + {'I', "I inventory single item"}, + {'v', "v print version number"}, + {'q', "q quaff potion"} }; -extern boolean wizard; -extern char *m_names[], *more; - +void inventory(pack, mask) -object *pack; -unsigned short mask; + object *pack; + unsigned short mask; { object *obj; short i = 0, j, maxlen = 0, n; @@ -271,6 +270,7 @@ unsigned short mask; } } +void id_com() { int ch = 0; @@ -288,7 +288,7 @@ id_com() { char save[(((COMS / 2) + (COMS % 2)) + 1)][DCOLS]; short rows = (((COMS / 2) + (COMS % 2)) + 1); - boolean need_two_screens; + boolean need_two_screens = FALSE; if (rows > LINES) { need_two_screens = 1; @@ -347,8 +347,9 @@ MORE: } } +int pr_com_id(ch) -int ch; + int ch; { int i; @@ -360,9 +361,10 @@ int ch; return(1); } +int get_com_id(index, ch) -int *index; -short ch; + int *index; + short ch; { short i; @@ -375,8 +377,9 @@ short ch; return(0); } +int pr_motion_char(ch) -int ch; + int ch; { if ( (ch == 'J') || (ch == 'K') || @@ -399,7 +402,7 @@ int ch; if (ch <= '\031') { ch += 96; - (void) strcpy(until, "until adjascent"); + (void) strcpy(until, "until adjacent"); } else { ch += 32; until[0] = '\0'; @@ -414,6 +417,7 @@ int ch; } } +void mix_colors() { short i, j, k; @@ -428,6 +432,7 @@ mix_colors() } } +void make_scroll_titles() { short i, j, n; @@ -446,9 +451,10 @@ make_scroll_titles() } } +void get_desc(obj, desc) -object *obj; -char *desc; + object *obj; + char *desc; { char *item_name; struct id *id_table; @@ -609,6 +615,7 @@ ANA: } } +void get_wand_and_ring_materials() { short i, j; @@ -637,8 +644,9 @@ get_wand_and_ring_materials() } } +void single_inv(ichar) -short ichar; + short ichar; { short ch; char desc[DCOLS]; @@ -663,7 +671,7 @@ short ichar; struct id * get_id_table(obj) -object *obj; + object *obj; { switch(obj->what_is) { case SCROL: @@ -682,8 +690,9 @@ object *obj; return((struct id *) 0); } +void inv_armor_weapon(is_weapon) -boolean is_weapon; + boolean is_weapon; { if (is_weapon) { if (rogue.weapon) { @@ -700,6 +709,7 @@ boolean is_weapon; } } +void id_type() { char *id; diff --git a/games/rogue/level.c b/games/rogue/level.c index 1c524fce273..a150002e685 100644 --- a/games/rogue/level.c +++ b/games/rogue/level.c @@ -1,3 +1,4 @@ +/* $OpenBSD: level.c,v 1.3 1998/08/22 08:55:29 pjanzen Exp $ */ /* $NetBSD: level.c,v 1.3 1995/04/22 10:27:37 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)level.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: level.c,v 1.3 1995/04/22 10:27:37 cgd Exp $"; +static char rcsid[] = "$OpenBSD: level.c,v 1.3 1998/08/22 08:55:29 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: level.c,v 1.3 1995/04/22 10:27:37 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -93,10 +94,7 @@ long level_points[MAX_EXP_LEVEL] = { short random_rooms[MAXROOMS] = {3, 7, 5, 2, 0, 6, 1, 4, 8}; -extern boolean being_held, wizard, detect_monster; -extern boolean see_invisible; -extern short bear_trap, levitate, extra_hp, less_hp, cur_room; - +void make_level() { short i, j; @@ -194,8 +192,9 @@ make_level() } } +void make_room(rn, r1, r2, r3) -short rn, r1, r2, r3; + short rn, r1, r2, r3; { short left_col, right_col, top_row, bottom_row; short width, height; @@ -264,6 +263,8 @@ short rn, r1, r2, r3; right_col = get_rand(DCOLS-11, DCOLS-1); rn = 0; goto B; + default: + clean_up("failed makeroom()"); } height = get_rand(4, (bottom_row - top_row + 1)); width = get_rand(7, (right_col - left_col - 2)); @@ -303,8 +304,9 @@ END: rooms[rn].right_col = right_col; } +int connect_rooms(room1, room2) -short room1, room2; + short room1, room2; { short row1, col1, row2, col2, dir; @@ -350,6 +352,7 @@ short room1, room2; return(1); } +void clear_level() { short i, j; @@ -376,10 +379,11 @@ clear_level() clear(); } +void put_door(rm, dir, row, col) -room *rm; -short dir; -short *row, *col; + room *rm; + short dir; + short *row, *col; { short wall_width; @@ -413,8 +417,9 @@ short *row, *col; rm->doors[dir/2].door_col = *col; } +void draw_simple_passage(row1, col1, row2, col2, dir) -short row1, col1, row2, col2, dir; + short row1, col1, row2, col2, dir; { short i, middle, t; @@ -454,16 +459,21 @@ short row1, col1, row2, col2, dir; } } +int same_row(room1, room2) + int room1, room2; { return((room1 / 3) == (room2 / 3)); } +int same_col(room1, room2) + int room1, room2; { return((room1 % 3) == (room2 % 3)); } +void add_mazes() { short i, j; @@ -495,6 +505,7 @@ add_mazes() } } +void fill_out_level() { short i, rn; @@ -515,9 +526,10 @@ fill_out_level() } } +void fill_it(rn, do_rec_de) -int rn; -boolean do_rec_de; + int rn; + boolean do_rec_de; { short i, tunnel_dir, door_dir, drow, dcol; short target_room, rooms_found = 0; @@ -576,10 +588,11 @@ boolean do_rec_de; } } +void recursive_deadend(rn, offsets, srow, scol) -short rn; -short *offsets; -short srow, scol; + short rn; + short *offsets; + short srow, scol; { short i, de; short drow, dcol, tunnel_dir; @@ -613,9 +626,9 @@ short srow, scol; boolean mask_room(rn, row, col, mask) -short rn; -short *row, *col; -unsigned short mask; + short rn; + short *row, *col; + unsigned short mask; { short i, j; @@ -631,8 +644,9 @@ unsigned short mask; return(0); } +void make_maze(r, c, tr, br, lc, rc) -short r, c, tr, br, lc, rc; + short r, c, tr, br, lc, rc; { char dirs[4]; short i, t; @@ -696,8 +710,9 @@ short r, c, tr, br, lc, rc; } } +void hide_boxed_passage(row1, col1, row2, col2, n) -short row1, col1, row2, col2, n; + short row1, col1, row2, col2, n; { short i, j, t; short row, col, row_cut, col_cut; @@ -731,8 +746,9 @@ short row1, col1, row2, col2, n; } } +void put_player(nr) -short nr; /* try not to put in this room */ + short nr; /* try not to put in this room */ { short rn = nr, misses; short row, col; @@ -763,6 +779,7 @@ short nr; /* try not to put in this room */ mvaddch(rogue.row, rogue.col, rogue.fchar); } +int drop_check() { if (wizard) { @@ -779,6 +796,7 @@ drop_check() return(0); } +int check_up() { if (!wizard) { @@ -801,9 +819,10 @@ check_up() return(0); } +void add_exp(e, promotion) -int e; -boolean promotion; + int e; + boolean promotion; { char mbuf[40]; short new_exp; @@ -832,8 +851,9 @@ boolean promotion; } } +int get_exp_level(e) -long e; + long e; { short i; @@ -845,6 +865,7 @@ long e; return(i+1); } +int hp_raise() { int hp; @@ -853,6 +874,7 @@ hp_raise() return(hp); } +void show_average_hp() { char mbuf[80]; @@ -872,6 +894,7 @@ show_average_hp() message(mbuf, 0); } +void mix_random_rooms() { short i, t; diff --git a/games/rogue/machdep.c b/games/rogue/machdep.c index 4704986cfc8..014e2a6247e 100644 --- a/games/rogue/machdep.c +++ b/games/rogue/machdep.c @@ -1,3 +1,4 @@ +/* $OpenBSD: machdep.c,v 1.4 1998/08/22 08:55:31 pjanzen Exp $ */ /* $NetBSD: machdep.c,v 1.5 1995/04/28 23:49:22 mycroft Exp $ */ /* @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: machdep.c,v 1.5 1995/04/28 23:49:22 mycroft Exp * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -97,8 +98,8 @@ static char rcsid[] = "$NetBSD: machdep.c,v 1.5 1995/04/28 23:49:22 mycroft Exp #ifdef UNIX -#include <stdio.h> #include <sys/types.h> +#include <sys/wait.h> #include <sys/file.h> #include <sys/stat.h> #include <pwd.h> @@ -112,7 +113,9 @@ static char rcsid[] = "$NetBSD: machdep.c,v 1.5 1995/04/28 23:49:22 mycroft Exp #endif #include <signal.h> +#include <stdlib.h> #include <termios.h> +#include <unistd.h> #include "rogue.h" #include "pathnames.h" @@ -128,6 +131,7 @@ static char rcsid[] = "$NetBSD: machdep.c,v 1.5 1995/04/28 23:49:22 mycroft Exp * big deal. */ +void md_slurp() { (void)fpurge(stdin); @@ -149,6 +153,7 @@ md_slurp() * input, this is not usually critical. */ +void md_heed_signals() { signal(SIGINT, onintr); @@ -168,6 +173,7 @@ md_heed_signals() * file, corruption. */ +void md_ignore_signals() { signal(SIGQUIT, SIG_IGN); @@ -186,7 +192,7 @@ md_ignore_signals() int md_get_file_id(fname) -char *fname; + char *fname; { struct stat sbuf; @@ -206,7 +212,7 @@ char *fname; int md_link_count(fname) -char *fname; + char *fname; { struct stat sbuf; @@ -228,10 +234,11 @@ char *fname; * saved-game files and play them. */ +void md_gct(rt_buf) -struct rogue_time *rt_buf; + struct rogue_time *rt_buf; { - struct tm *t, *localtime(); + struct tm *t; time_t seconds; time(&seconds); @@ -261,9 +268,10 @@ struct rogue_time *rt_buf; * saved-games that have been modified. */ +void md_gfmt(fname, rt_buf) -char *fname; -struct rogue_time *rt_buf; + char *fname; + struct rogue_time *rt_buf; { struct stat sbuf; time_t seconds; @@ -294,7 +302,7 @@ struct rogue_time *rt_buf; boolean md_df(fname) -char *fname; + char *fname; { if (unlink(fname)) { return(0); @@ -330,8 +338,9 @@ md_gln() * delaying execution, which is useful to this program at some times. */ +void md_sleep(nsecs) -int nsecs; + int nsecs; { (void) sleep(nsecs); } @@ -375,10 +384,9 @@ int nsecs; char * md_getenv(name) -char *name; + char *name; { char *value; - char *getenv(); value = getenv(name); @@ -395,9 +403,8 @@ char *name; char * md_malloc(n) -int n; + int n; { - char *malloc(); char *t; t = malloc(n); @@ -422,6 +429,7 @@ int n; * exactly the same way given the same input. */ +int md_gseed() { return(getpid()); @@ -434,8 +442,9 @@ md_gseed() * hang when it should quit. */ +void md_exit(status) -int status; + int status; { exit(status); } @@ -451,8 +460,9 @@ int status; * the lock is released. */ +void md_lock(l) -boolean l; + boolean l; { extern gid_t gid, egid; static int fd; @@ -484,19 +494,21 @@ boolean l; * The effective user id is restored after the shell completes. */ +void md_shell(shell) -char *shell; + char *shell; { - long w[2]; + int w; if (!fork()) { - int uid; - - uid = getuid(); - setuid(uid); +/* int uid; *** No longer needed *** + * + * uid = getuid(); + * setuid(uid); + */ execl(shell, shell, 0); } - wait(w); + wait(&w); } /* If you have a viable curses/termlib library, then use it and don't bother @@ -535,8 +547,9 @@ char *shell; * */ +void md_cbreak_no_echo_nonl(on) -boolean on; + boolean on; { struct termios tty_buf; static struct termios tty_save; @@ -583,6 +596,7 @@ md_gdtcf() * */ +void md_tstp() { #ifdef UNIX_BSD4_2 diff --git a/games/rogue/main.c b/games/rogue/main.c index 27783c5559f..e3b336998f1 100644 --- a/games/rogue/main.c +++ b/games/rogue/main.c @@ -1,3 +1,4 @@ +/* $OpenBSD: main.c,v 1.3 1998/08/22 08:55:32 pjanzen Exp $ */ /* $NetBSD: main.c,v 1.3 1995/04/22 10:27:41 cgd Exp $ */ /* @@ -46,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: main.c,v 1.3 1995/04/22 10:27:41 cgd Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.3 1998/08/22 08:55:32 pjanzen Exp $"; #endif #endif /* not lint */ @@ -58,17 +59,16 @@ static char rcsid[] = "$NetBSD: main.c,v 1.3 1995/04/22 10:27:41 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ #include "rogue.h" -extern short party_room; - +int main(argc, argv) -int argc; -char *argv[]; + int argc; + char *argv[]; { if (init(argc, argv)) { /* restored game */ goto PL; diff --git a/games/rogue/message.c b/games/rogue/message.c index e9048afd9ba..56fae2991fc 100644 --- a/games/rogue/message.c +++ b/games/rogue/message.c @@ -1,3 +1,4 @@ +/* $OpenBSD: message.c,v 1.3 1998/08/22 08:55:33 pjanzen Exp $ */ /* $NetBSD: message.c,v 1.5 1995/04/22 10:27:43 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)message.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: message.c,v 1.5 1995/04/22 10:27:43 cgd Exp $"; +static char rcsid[] = "$OpenBSD"; #endif #endif /* not lint */ @@ -52,13 +53,12 @@ static char rcsid[] = "$NetBSD: message.c,v 1.5 1995/04/22 10:27:43 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ -#include <stdio.h> -#include <termios.h> #include <signal.h> +#include <termios.h> #include "rogue.h" char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""}; @@ -67,13 +67,10 @@ 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; - +void message(msg, intrpt) -char *msg; -boolean intrpt; + char *msg; + boolean intrpt; { cant_int = 1; @@ -105,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(); @@ -125,6 +123,7 @@ short c; } } +void check_message() { if (msg_cleared) { @@ -136,11 +135,12 @@ 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; + char *prompt, *buf, *insert; + char *if_cancelled; + boolean add_blank; + boolean do_echo; { short ch; short i = 0, n; @@ -194,9 +194,10 @@ boolean do_echo; return(i); } +int rgetchar() { - register ch; + int ch; for(;;) { ch = getchar(); @@ -220,17 +221,19 @@ rgetchar() } } } + /* 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; - int row = DROWS - 1; + short row = DROWS - 1; label = (stat_mask & STAT_LABEL) ? 1 : 0; @@ -311,9 +314,10 @@ register stat_mask; refresh(); } +void pad(s, n) -char *s; -short n; + char *s; + short n; { short i; @@ -322,6 +326,7 @@ short n; } } +void save_screen() { FILE *fp; @@ -350,6 +355,7 @@ save_screen() } } +void sound_bell() { putchar(7); @@ -358,15 +364,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; + char *str; + int ch; + boolean last; { int i = 0; diff --git a/games/rogue/monster.c b/games/rogue/monster.c index 968e153d284..b634a1eb6f2 100644 --- a/games/rogue/monster.c +++ b/games/rogue/monster.c @@ -1,3 +1,4 @@ +/* $OpenBSD: monster.c,v 1.3 1998/08/22 08:55:34 pjanzen Exp $ */ /* $NetBSD: monster.c,v 1.3 1995/04/22 10:27:45 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)monster.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: monster.c,v 1.3 1995/04/22 10:27:45 cgd Exp $"; +static char rcsid[] = "$OpenBSD: monster.c,v 1.3 1998/08/22 08:55:34 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: monster.c,v 1.3 1995/04/22 10:27:45 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -123,12 +124,7 @@ object mon_tab[MONSTERS] = { {(ASLEEP|WAKENS|WANDERS),"1d7",21,'Z',8,5,14,69,0,0,0,0,0} }; -extern short cur_level; -extern short cur_room, party_room; -extern short blind, halluc, haste_self; -extern boolean detect_monster, see_invisible, r_see_invisible; -extern short stealthy; - +void put_mons() { short i; @@ -150,8 +146,8 @@ put_mons() object * gr_monster(monster, mn) -register object *monster; -register mn; + object *monster; + int mn; { if (!monster) { monster = alloc_object(); @@ -175,9 +171,10 @@ register mn; return(monster); } +void mv_mons() { - register object *monster, *next_monster; + object *monster, *next_monster; boolean flew; if (haste_self % 2) { @@ -220,8 +217,9 @@ NM: monster = next_monster; } } +void party_monsters(rn, n) -int rn, n; + int rn, n; { short i, j; short row, col; @@ -260,12 +258,13 @@ int rn, n; } } +char gmc_row_col(row, col) -register row, col; + short row, col; { - register object *monster; + object *monster; - if (monster = object_at(&level_monsters, row, col)) { + if ((monster = object_at(&level_monsters, row, col))) { if ((!(detect_monster || see_invisible || r_see_invisible) && (monster->m_flags & INVISIBLE)) || blind) { return(monster->trail_char); @@ -279,8 +278,9 @@ register row, col; } } +char gmc(monster) -object *monster; + object *monster; { if ((!(detect_monster || see_invisible || r_see_invisible) && (monster->m_flags & INVISIBLE)) @@ -293,9 +293,10 @@ object *monster; return(monster->m_char); } +void mv_1_monster(monster, row, col) -register object *monster; -short row, col; + object *monster; + short row, col; { short i, n; boolean tried[6]; @@ -432,9 +433,10 @@ O: } } +int mtry(monster, row, col) -register object *monster; -register short row, col; + object *monster; + short row, col; { if (mon_can_go(monster, row, col)) { move_mon_to(monster, row, col); @@ -443,12 +445,13 @@ register short row, col; return(0); } +void move_mon_to(monster, row, col) -register object *monster; -register short row, col; + object *monster; + short row, col; { short c; - register mrow, mcol; + short mrow, mcol; mrow = monster->row; mcol = monster->col; @@ -493,9 +496,10 @@ register short row, col; } } +int mon_can_go(monster, row, col) -register object *monster; -register short row, col; + object *monster; + short row, col; { object *obj; short dr, dc; @@ -534,18 +538,20 @@ register short row, col; return(1); } +void wake_up(monster) -object *monster; + object *monster; { if (!(monster->m_flags & NAPPING)) { monster->m_flags &= (~(ASLEEP | IMITATES | WAKENS)); } } +void wake_room(rn, entering, row, col) -short rn; -boolean entering; -short row, col; + short rn; + boolean entering; + short row, col; { object *monster; short wake_percent; @@ -580,7 +586,7 @@ short row, col; char * mon_name(monster) -object *monster; + object *monster; { short ch; @@ -596,8 +602,9 @@ object *monster; return(m_names[ch]); } +int rogue_is_around(row, col) -register row, col; + short row, col; { short rdif, cdif, retval; @@ -608,6 +615,7 @@ register row, col; return(retval); } +void wanderer() { object *monster; @@ -638,6 +646,7 @@ wanderer() } } +void show_monsters() { object *monster; @@ -659,6 +668,7 @@ show_monsters() } } +void create_monster() { short row, col; @@ -694,9 +704,10 @@ create_monster() } } +void put_m_at(row, col, monster) -short row, col; -object *monster; + short row, col; + object *monster; { monster->row = row; monster->col = col; @@ -706,8 +717,9 @@ object *monster; aim_monster(monster); } +void aim_monster(monster) -object *monster; + object *monster; { short i, rn, d, r; @@ -724,10 +736,11 @@ object *monster; } } +int rogue_can_see(row, col) -register row, col; + short row, col; { - register retval; + int retval; retval = !blind && (((get_room_number(row, col) == cur_room) && @@ -737,8 +750,9 @@ register row, col; return(retval); } +int move_confused(monster) -object *monster; + object *monster; { short i, row, col; @@ -767,8 +781,9 @@ object *monster; return(0); } +int flit(monster) -object *monster; + object *monster; { short i, row, col; @@ -793,6 +808,7 @@ object *monster; return(1); } +char gr_obj_char() { short r; @@ -803,8 +819,9 @@ gr_obj_char() return(rs[r]); } +int no_room_for_monster(rn) -int rn; + int rn; { short i, j; @@ -818,6 +835,7 @@ int rn; return(1); } +void aggravate() { object *monster; @@ -838,7 +856,8 @@ aggravate() boolean mon_sees(monster, row, col) -object *monster; + object *monster; + short row, col; { short rn, rdif, cdif, retval; @@ -856,6 +875,7 @@ object *monster; return(retval); } +void mv_aquatars() { object *monster; diff --git a/games/rogue/move.c b/games/rogue/move.c index 42c08ecf787..55d08206df9 100644 --- a/games/rogue/move.c +++ b/games/rogue/move.c @@ -1,3 +1,4 @@ +/* $OpenBSD: move.c,v 1.3 1998/08/22 08:55:35 pjanzen Exp $ */ /* $NetBSD: move.c,v 1.3 1995/04/22 10:27:47 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: move.c,v 1.3 1995/04/22 10:27:47 cgd Exp $"; +static char rcsid[] = "$OpenBSD: move.c,v 1.3 1998/08/22 08:55:35 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: move.c,v 1.3 1995/04/22 10:27:47 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -62,15 +63,9 @@ short m_moves = 0; boolean jump = 0; char *you_can_move_again = "you can move again"; -extern short cur_room, halluc, blind, levitate; -extern short cur_level, max_level; -extern short bear_trap, haste_self, confused; -extern short e_rings, regeneration, auto_search; -extern char hunger_str[]; -extern boolean being_held, interrupted, r_teleport, passgo; - +int one_move_rogue(dirch, pickup) -short dirch, pickup; + short dirch, pickup; { short row, col; object *obj; @@ -141,7 +136,7 @@ short dirch, pickup; return(STOPPED_ON_SOMETHING); } if (pickup && !levitate) { - if (obj = pick_up(row, col, &status)) { + if ((obj = pick_up(row, col, &status))) { get_desc(obj, desc); if (obj->what_is == GOLD) { free_object(obj); @@ -182,8 +177,9 @@ MVED: if (reg_move()) { /* fainted from hunger */ return((confused ? STOPPED_ON_SOMETHING : MOVED)); } +void multiple_move_rogue(dirch) -short dirch; + short dirch; { short row, col; short m; @@ -229,8 +225,9 @@ short dirch; } } +boolean is_passable(row, col) -register row, col; + short row, col; { if ((row < MIN_ROW) || (row > (DROWS - 2)) || (col < 0) || (col > (DCOLS-1))) { @@ -242,8 +239,9 @@ register row, col; return(dungeon[row][col] & (FLOOR | TUNNEL | DOOR | STAIRS | TRAP)); } +boolean next_to_something(drow, dcol) -register drow, dcol; + short drow, dcol; { short i, j, i_end, j_end, row, col; short pass_count = 0; @@ -303,7 +301,9 @@ register drow, dcol; return(0); } +boolean can_move(row1, col1, row2, col2) + short row1, col1, row2, col2; { if (!is_passable(row2, col2)) { return(0); @@ -319,6 +319,7 @@ can_move(row1, col1, row2, col2) return(1); } +void move_onto() { short ch, d; @@ -339,8 +340,8 @@ move_onto() boolean is_direction(c, d) -short c; -short *d; + short c; + short *d; { switch(c) { case 'h': @@ -377,9 +378,9 @@ short *d; boolean check_hunger(msg_only) -boolean msg_only; + boolean msg_only; { - register short i, n; + short i, n; boolean fainted = 0; if (rogue.moves_left == HUNGRY) { @@ -501,7 +502,9 @@ reg_move() return(fainted); } +void rest(count) + int count; { int i; @@ -515,6 +518,7 @@ rest(count) } } +char gr_dir() { short d; @@ -550,6 +554,7 @@ gr_dir() return(d); } +void heal() { static short heal_exp = -1, n, c = 0; @@ -604,7 +609,7 @@ heal() if (++c >= n) { c = 0; rogue.hp_current++; - if (alt = !alt) { + if ((alt = !alt)) { rogue.hp_current++; } if ((rogue.hp_current += regeneration) > rogue.hp_max) { @@ -614,9 +619,9 @@ heal() } } -static boolean +boolean can_turn(nrow, ncol) -short nrow, ncol; + short nrow, ncol; { if ((dungeon[nrow][ncol] & TUNNEL) && is_passable(nrow, ncol)) { return(1); @@ -624,12 +629,13 @@ short nrow, ncol; return(0); } +void turn_passage(dir, fast) -short dir; -boolean fast; + short dir; + boolean fast; { short crow = rogue.row, ccol = rogue.col, turns = 0; - short ndir; + short ndir = 0; if ((dir != 'h') && can_turn(crow, ccol + 1)) { turns++; diff --git a/games/rogue/object.c b/games/rogue/object.c index 03b63a5c18b..a74bb3a7077 100644 --- a/games/rogue/object.c +++ b/games/rogue/object.c @@ -1,3 +1,4 @@ +/* $OpenBSD: object.c,v 1.3 1998/08/22 08:55:36 pjanzen Exp $ */ /* $NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)object.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $"; +static char rcsid[] = "$OpenBSD: object.c,v 1.3 1998/08/22 08:55:36 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -65,13 +66,18 @@ object *free_list = (object *) 0; char *fruit = (char *) 0; fighter rogue = { - INIT_AW, /* armor, weapon */ - INIT_RINGS, /* rings */ - INIT_HP, /* Hp current,max */ - INIT_STR, /* Str current,max */ + INIT_AW, /* armor */ + INIT_AW, /* weapon */ + INIT_RINGS, /* left ring */ + INIT_RINGS, /* right ring */ + INIT_HP, /* Hp current */ + INIT_HP, /* Hp max */ + INIT_STR, /* Str current */ + INIT_STR, /* Str max */ INIT_PACK, /* pack */ INIT_GOLD, /* gold */ - INIT_EXP, /* exp level,points */ + INIT_EXPLEVEL, /* exp level */ + INIT_EXP, /* exp points */ 0, 0, /* row, col */ INIT_CHAR, /* char */ INIT_MOVES /* moves */ @@ -159,11 +165,7 @@ struct id id_rings[RINGS] = { {270, " ", "of searching ",0}, }; -extern short cur_level, max_level; -extern short party_room; -extern char *error_file; -extern boolean is_wood[]; - +void put_objects() { short i, n; @@ -186,6 +188,7 @@ put_objects() put_gold(); } +void put_gold() { short i, j; @@ -215,9 +218,10 @@ put_gold() } } +void plant_gold(row, col, is_maze) -short row, col; -boolean is_maze; + short row, col; + boolean is_maze; { object *obj; @@ -232,8 +236,10 @@ boolean is_maze; (void) add_to_pack(obj, &level_objects, 0); } +void place_at(obj, row, col) -object *obj; + object *obj; + short row, col; { obj->row = row; obj->col = col; @@ -243,8 +249,8 @@ object *obj; object * object_at(pack, row, col) -register object *pack; -short row, col; + object *pack; + short row, col; { object *obj = (object *) 0; @@ -274,8 +280,9 @@ get_letter_object(ch) return(obj); } +void free_stuff(objlist) -object *objlist; + object *objlist; { object *obj; @@ -289,7 +296,7 @@ object *objlist; char * name_of(obj) -object *obj; + object *obj; { char *retstring; @@ -409,8 +416,9 @@ gr_what_is() return(what_is); } +void gr_scroll(obj) -object *obj; + object *obj; { short percent; @@ -447,8 +455,9 @@ object *obj; } } +void gr_potion(obj) -object *obj; + object *obj; { short percent; @@ -487,9 +496,10 @@ object *obj; } } +void gr_weapon(obj, assign_wk) -object *obj; -int assign_wk; + object *obj; + int assign_wk; { short percent; short i; @@ -511,13 +521,13 @@ int assign_wk; percent = get_rand(1, 96); blessing = get_rand(1, 3); - if (percent <= 16) { - increment = 1; - } else if (percent <= 32) { - increment = -1; - obj->is_cursed = 1; - } if (percent <= 32) { + if (percent <= 16) { + increment = 1; + } else { + increment = -1; + obj->is_cursed = 1; + } for (i = 0; i < blessing; i++) { if (coin_toss()) { obj->hit_enchant += increment; @@ -552,8 +562,9 @@ int assign_wk; } } +void gr_armor(obj) -object *obj; + object *obj; { short percent; short blessing; @@ -578,17 +589,19 @@ object *obj; } } +void gr_wand(obj) -object *obj; + object *obj; { obj->what_is = WAND; obj->which_kind = get_rand(0, (WANDS - 1)); obj->class = get_rand(3, 7); } +void get_food(obj, force_ration) -object *obj; -boolean force_ration; + object *obj; + boolean force_ration; { obj->what_is = FOOD; @@ -599,6 +612,7 @@ boolean force_ration; } } +void put_stairs() { short row, col; @@ -607,8 +621,9 @@ put_stairs() dungeon[row][col] |= STAIRS; } +int get_armor_class(obj) -object *obj; + object *obj; { if (obj) { return(obj->class + obj->d_enchant); @@ -637,13 +652,15 @@ alloc_object() return(obj); } +void free_object(obj) -object *obj; + object *obj; { obj->next_object = free_list; free_list = obj; } +void make_party() { short n; @@ -656,6 +673,7 @@ make_party() } } +void show_objects() { object *obj; @@ -671,7 +689,8 @@ show_objects() rc = get_mask_char(obj->what_is); if (dungeon[row][col] & MONSTER) { - if (monster = object_at(&level_monsters, row, col)) { + if ((monster = + object_at(&level_monsters, row, col))) { monster->trail_char = rc; } } @@ -693,6 +712,7 @@ show_objects() } } +void put_amulet() { object *obj; @@ -702,8 +722,9 @@ put_amulet() rand_place(obj); } +void rand_place(obj) -object *obj; + object *obj; { short row, col; @@ -711,12 +732,14 @@ object *obj; place_at(obj, row, col); } +void c_object_for_wizard() { short ch, max, wk; object *obj; char buf[80]; + max = 0; if (pack_count((object *) 0) >= MAX_PACK_COUNT) { message("pack full", 0); return; diff --git a/games/rogue/pack.c b/games/rogue/pack.c index 5151e5d8c77..cf0003b7f16 100644 --- a/games/rogue/pack.c +++ b/games/rogue/pack.c @@ -1,3 +1,4 @@ +/* $OpenBSD: pack.c,v 1.3 1998/08/22 08:55:38 pjanzen Exp $ */ /* $NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $ */ /* @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -60,16 +61,14 @@ static char rcsid[] = "$NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $"; char *curse_message = "you can't, it appears to be cursed"; -extern short levitate; - object * add_to_pack(obj, pack, condense) -object *obj, *pack; + object *obj, *pack; { object *op; if (condense) { - if (op = check_duplicate(obj, pack)) { + if ((op = check_duplicate(obj, pack))) { free_object(obj); return(op); } else { @@ -90,8 +89,9 @@ object *obj, *pack; return(obj); } +void take_from_pack(obj, pack) -object *obj, *pack; + object *obj, *pack; { while (pack->next_object != obj) { pack = pack->next_object; @@ -105,7 +105,7 @@ object *obj, *pack; object * pick_up(row, col, status) -short *status; + short row, col, *status; { object *obj; @@ -150,6 +150,7 @@ short *status; return(obj); } +void drop() { object *obj, *new; @@ -214,7 +215,7 @@ drop() object * check_duplicate(obj, pack) -object *obj, *pack; + object *obj, *pack; { object *op; @@ -246,10 +247,11 @@ object *obj, *pack; return(0); } +short next_avail_ichar() { - register object *obj; - register i; + object *obj; + int i; boolean ichars[26]; for (i = 0; i < 26; i++) { @@ -268,14 +270,16 @@ next_avail_ichar() return('?'); } +void wait_for_ack() { while (rgetchar() != ' ') ; } +short pack_letter(prompt, mask) -char *prompt; -unsigned short mask; + char *prompt; + unsigned short mask; { short ch; unsigned short tmask = mask; @@ -310,6 +314,7 @@ unsigned short mask; return(ch); } +void take_off() { char desc[DCOLS]; @@ -333,10 +338,11 @@ take_off() } } +void wear() { short ch; - register object *obj; + object *obj; char desc[DCOLS]; if (rogue.armor) { @@ -365,8 +371,9 @@ wear() (void) reg_move(); } +void unwear(obj) -object *obj; + object *obj; { if (obj) { obj->in_use_flags &= (~BEING_WORN); @@ -374,18 +381,20 @@ object *obj; rogue.armor = (object *) 0; } +void do_wear(obj) -object *obj; + object *obj; { rogue.armor = obj; obj->in_use_flags |= BEING_WORN; obj->identified = 1; } +void wield() { short ch; - register object *obj; + object *obj; char desc[DCOLS]; if (rogue.weapon && rogue.weapon->is_cursed) { @@ -419,15 +428,17 @@ wield() } } +void do_wield(obj) -object *obj; + object *obj; { rogue.weapon = obj; obj->in_use_flags |= BEING_WIELDED; } +void unwield(obj) -object *obj; + object *obj; { if (obj) { obj->in_use_flags &= (~BEING_WIELDED); @@ -435,10 +446,11 @@ object *obj; rogue.weapon = (object *) 0; } +void call_it() { short ch; - register object *obj; + object *obj; struct id *id_table; char buf[MAX_TITLE_LENGTH+2]; @@ -463,8 +475,9 @@ call_it() } } +short pack_count(new_obj) -object *new_obj; + object *new_obj; { object *obj; short count = 0; @@ -492,8 +505,8 @@ object *new_obj; boolean mask_pack(pack, mask) -object *pack; -unsigned short mask; + object *pack; + unsigned short mask; { while (pack->next_object) { pack = pack->next_object; @@ -504,9 +517,10 @@ unsigned short mask; return(0); } +boolean is_pack_letter(c, mask) -short *c; -unsigned short *mask; + short *c; + unsigned short *mask; { if (((*c == '?') || (*c == '!') || (*c == ':') || (*c == '=') || (*c == ')') || (*c == ']') || (*c == '/') || (*c == ','))) { @@ -542,11 +556,13 @@ unsigned short *mask; return(((*c >= 'a') && (*c <= 'z')) || (*c == CANCEL) || (*c == LIST)); } +boolean has_amulet() { return(mask_pack(&rogue.pack, AMULET)); } +void kick_into_pack() { object *obj; @@ -556,7 +572,7 @@ kick_into_pack() if (!(dungeon[rogue.row][rogue.col] & OBJECT)) { message("nothing here", 0); } else { - if (obj = pick_up(rogue.row, rogue.col, &stat)) { + if ((obj = pick_up(rogue.row, rogue.col, &stat))) { get_desc(obj, desc); if (obj->what_is == GOLD) { message(desc, 0); diff --git a/games/rogue/play.c b/games/rogue/play.c index 0106446901b..9bd41cc9bcd 100644 --- a/games/rogue/play.c +++ b/games/rogue/play.c @@ -1,3 +1,4 @@ +/* $OpenBSD: play.c,v 1.3 1998/08/22 08:55:39 pjanzen Exp $ */ /* $NetBSD: play.c,v 1.3 1995/04/22 10:28:04 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: play.c,v 1.3 1995/04/22 10:28:04 cgd Exp $"; +static char rcsid[] = "$OpenBSD: play.c,v 1.3 1998/08/22 08:55:39 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: play.c,v 1.3 1995/04/22 10:28:04 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -61,10 +62,7 @@ static char rcsid[] = "$NetBSD: play.c,v 1.3 1995/04/22 10:28:04 cgd Exp $"; boolean interrupted = 0; char *unknown_command = "unknown command"; -extern short party_room, bear_trap; -extern char hit_message[]; -extern boolean wizard, trap_door; - +void play_level() { short ch; diff --git a/games/rogue/random.c b/games/rogue/random.c index 3f549c3755f..b9cbcf3f6b9 100644 --- a/games/rogue/random.c +++ b/games/rogue/random.c @@ -1,3 +1,4 @@ +/* $OpenBSD: random.c,v 1.3 1998/08/22 08:55:40 pjanzen Exp $ */ /* $NetBSD: random.c,v 1.3 1995/04/22 10:28:06 cgd Exp $ */ /* @@ -40,10 +41,12 @@ #if 0 static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: random.c,v 1.3 1995/04/22 10:28:06 cgd Exp $"; +static char rcsid[] = "$OpenBSD: random.c,v 1.3 1998/08/22 08:55:40 pjanzen Exp $"; #endif #endif /* not lint */ +#include "rogue.h" + /* * random.c * @@ -52,12 +55,12 @@ static char rcsid[] = "$NetBSD: random.c,v 1.3 1995/04/22 10:28:06 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ static long rntb[32] = { - 3, 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, + 3, 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5, 0xf103bc02, 0x48f340fb, 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd, 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88, 0xe369735d, @@ -74,11 +77,11 @@ static int rand_deg = 31; static int rand_sep = 3; static long *end_ptr = &rntb[32]; +void srrandom(x) -int x; + int x; { - register int i; - long rrandom(); + int i; state[0] = (long) x; if (rand_type != 0) { @@ -115,10 +118,11 @@ rrandom() return(i); } +int get_rand(x, y) -register int x, y; + int x, y; { - register int r, t; + int r, t; long lr; if (x > y) { @@ -133,14 +137,15 @@ register int x, y; return(r); } +int rand_percent(percentage) -register int percentage; + int percentage; { return(get_rand(1, 100) <= percentage); } +int coin_toss() { - return(((rrandom() & 01) ? 1 : 0)); } diff --git a/games/rogue/ring.c b/games/rogue/ring.c index 2d8059a9468..f570cf02650 100644 --- a/games/rogue/ring.c +++ b/games/rogue/ring.c @@ -1,4 +1,4 @@ -/* $NetBSD: ring.c,v 1.3 1995/04/22 10:28:09 cgd Exp $ */ +/* $OpenBSD: ring.c,v 1.3 1998/08/22 08:55:41 pjanzen Exp $ */ /* * Copyright (c) 1988, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)ring.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: ring.c,v 1.3 1995/04/22 10:28:09 cgd Exp $"; +static char rcsid[] = "$OpenBSD: ring.c,v 1.3 1998/08/22 08:55:41 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +52,7 @@ static char rcsid[] = "$NetBSD: ring.c,v 1.3 1995/04/22 10:28:09 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -72,9 +72,7 @@ boolean r_see_invisible; boolean sustain_strength; boolean maintain_armor; -extern char *curse_message; -extern boolean wizard; - +void put_on_ring() { short ch; @@ -135,9 +133,10 @@ put_on_ring() * serious problems when do_put_on() is called from read_pack() in restore(). */ +void do_put_on(ring, on_left) -object *ring; -boolean on_left; + object *ring; + boolean on_left; { if (on_left) { ring->in_use_flags |= ON_LEFT_HAND; @@ -148,6 +147,7 @@ boolean on_left; } } +void remove_ring() { boolean left = 0, right = 0; @@ -155,6 +155,7 @@ remove_ring() char buf[DCOLS]; object *ring; + ring = NULL; if (r_rings == 0) { inv_rings(); } else if (rogue.left_ring && !rogue.right_ring) { @@ -197,8 +198,9 @@ remove_ring() } } +void un_put_on(ring) -object *ring; + object *ring; { if (ring && (ring->in_use_flags & ON_LEFT_HAND)) { ring->in_use_flags &= (~ON_LEFT_HAND); @@ -210,9 +212,10 @@ object *ring; ring_stats(1); } +void gr_ring(ring, assign_wk) -object *ring; -boolean assign_wk; + object *ring; + boolean assign_wk; { ring->what_is = RING; if (assign_wk) { @@ -251,6 +254,7 @@ boolean assign_wk; } } +void inv_rings() { char buf[DCOLS]; @@ -276,8 +280,9 @@ inv_rings() } } +void ring_stats(pr) -boolean pr; + boolean pr; { short i; object *ring; diff --git a/games/rogue/rogue.6 b/games/rogue/rogue.6 index 001a871972f..940c66bbdf0 100644 --- a/games/rogue/rogue.6 +++ b/games/rogue/rogue.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: rogue.6,v 1.5 1995/04/22 10:28:12 cgd Exp $ +.\" $OpenBSD: rogue.6,v 1.2 1998/08/22 08:55:42 pjanzen Exp $ .\" .\" Copyright (c) 1988, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,7 +40,7 @@ .Nm rogue .Nd Exploring The Dungeons of Doom .Sh SYNOPSIS -.Nm /usr/games/rogue +.Nm .Op Fl s .Op Ar save_file .\" .Op Fl r @@ -66,7 +66,7 @@ among heroes. .Pp When the game ends, either by your death, when you quit, or if you (by some miracle) manage to win, -.Nm rogue +.Nm will give you a list of the top-ten scorers. The scoring is based entirely upon how much gold you get. There is a 10% penalty for getting yourself killed. diff --git a/games/rogue/rogue.h b/games/rogue/rogue.h index e3632952dc2..983b2991c1b 100644 --- a/games/rogue/rogue.h +++ b/games/rogue/rogue.h @@ -1,3 +1,4 @@ +/* $OpenBSD: rogue.h,v 1.3 1998/08/22 08:55:43 pjanzen Exp $ */ /* $NetBSD: rogue.h,v 1.4 1995/04/24 12:25:04 cgd Exp $ */ /* @@ -5,7 +6,7 @@ * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by - * Timoth C. Stoehr. + * Timothy C. Stoehr. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,7 +47,7 @@ * 1.) This notice shall not be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. */ #define boolean char @@ -155,13 +156,13 @@ #define RATION 0 #define FRUIT 1 -#define NOT_USED ((unsigned short) 0) +#define NOT_USED ((unsigned short) 0) #define BEING_WIELDED ((unsigned short) 01) -#define BEING_WORN ((unsigned short) 02) +#define BEING_WORN ((unsigned short) 02) #define ON_LEFT_HAND ((unsigned short) 04) #define ON_RIGHT_HAND ((unsigned short) 010) #define ON_EITHER_HAND ((unsigned short) 014) -#define BEING_USED ((unsigned short) 017) +#define BEING_USED ((unsigned short) 017) #define NO_TRAP -1 #define TRAP_DOOR 0 @@ -175,9 +176,9 @@ #define STEALTH_FACTOR 3 #define R_TELE_PERCENT 8 -#define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */ -#define IDENTIFIED ((unsigned short) 01) -#define CALLED ((unsigned short) 02) +#define UNIDENTIFIED ((unsigned short) 00) /* MUST BE ZERO! */ +#define IDENTIFIED ((unsigned short) 01) +#define CALLED ((unsigned short) 02) #define DROWS 24 #define DCOLS 80 @@ -245,15 +246,16 @@ struct obj { /* comment is monster meaning */ typedef struct obj object; -#define INIT_AW (object*)0,(object*)0 -#define INIT_RINGS (object*)0,(object*)0 -#define INIT_HP 12,12 -#define INIT_STR 16,16 -#define INIT_EXP 1,0 -#define INIT_PACK {0} -#define INIT_GOLD 0 -#define INIT_CHAR '@' -#define INIT_MOVES 1250 +#define INIT_AW (object*)0 +#define INIT_RINGS (object*)0 +#define INIT_HP 12 +#define INIT_STR 16 +#define INIT_EXPLEVEL 1 +#define INIT_EXP 0 +#define INIT_PACK {0} +#define INIT_GOLD 0 +#define INIT_CHAR '@' +#define INIT_MOVES 1250 struct fightr { object *armor; @@ -426,42 +428,6 @@ extern object level_monsters; #define MIN_ROW 1 -/* external routine declarations. - */ -#include <string.h> - -char *mon_name(); -char *get_ench_color(); -char *name_of(); -char *md_gln(); -char *md_getenv(); -char *md_malloc(); -boolean is_direction(); -boolean mon_sees(); -boolean mask_pack(); -boolean mask_room(); -boolean is_digit(); -boolean check_hunger(); -boolean reg_move(); -boolean md_df(); -boolean has_been_touched(); -object *add_to_pack(); -object *alloc_object(); -object *get_letter_object(); -object *gr_monster(); -object *get_thrown_at_monster(); -object *get_zapped_monster(); -object *check_duplicate(); -object *gr_object(); -object *object_at(); -object *pick_up(); -struct id *get_id_table(); -unsigned short gr_what_is(); -long rrandom(); -long lget_number(); -long xxx(); -void byebye(), onintr(), error_save(); - struct rogue_time { short year; /* >= 1987 */ short month; /* 1 - 12 */ @@ -479,12 +445,410 @@ struct _win_st { typedef struct _win_st WINDOW; +#ifndef FALSE +#define FALSE 0 +#endif + extern int LINES, COLS; extern WINDOW *curscr; extern char *CL; -char *md_gdtcf(); +void initscr __P((void)); +void endwin __P((void)); +void move __P((short, short)); +void mvaddstr __P((short, short, char *)); +void addstr __P((char *)); +void addch __P((int)); +void mvaddch __P((short, short, int)); +void refresh __P((void)); +void wrefresh __P((WINDOW *scr)); +int mvinch __P((short, short)); +void clear __P((void)); +void clrtoeol __P((void)); +void standout __P((void)); +void standend __P((void)); +void crmode __P((void)); +void noecho __P((void)); +void nonl __P((void)); +void clear_buffers __P((void)); +void put_char_at __P((short, short, int)); +void put_cursor __P((short, short)); +void put_st_char __P((int)); +void get_term_info __P((void)); +boolean tc_tname __P((FILE *, char *, char *)); +void tc_gtdata __P((FILE *, char *)); +void tc_gets __P((char *, char **)); +void tc_gnum __P((char *, int *)); +void tstp __P((void)); +void tc_cmget __P((void)); #else #include <curses.h> #endif + +/* + * external routine declarations. + */ +#include <sys/types.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +object *alloc_object __P((void)); +object *check_duplicate __P((object *, object *)); +char *get_ench_color __P((void)); +object *get_letter_object __P((int)); +object *get_thrown_at_monster __P((object *, short, short *, short *)); +object *get_zapped_monster __P((short, short *, short *)); +object *gr_monster __P((object *, int)); +object *gr_object __P((void)); +char *md_getenv __P((char *)); +char *md_gln __P((void)); +char *md_malloc __P((int)); +char *mon_name __P((object *)); +char *name_of __P((object *)); +object *object_at __P((object *, short, short)); +object *pick_up __P((short, short, short *)); +void add_exp __P((int, boolean)); +void add_mazes __P((void)); +void add_traps __P((void)); +void aggravate __P((void)); +void aim_monster __P((object *)); +void bounce __P((short, short, short, short, short)); +void byebye __P((int)); +void c_object_for_wizard __P((void)); +void call_it __P((void)); +boolean can_move __P((short, short, short, short)); +boolean can_turn __P((short, short)); +void center __P((short, char *)); +void check_gold_seeker __P((object *)); +boolean check_hunger __P((boolean)); +boolean check_imitator __P((object *)); +void check_message __P((void)); +int check_up __P((void)); +void clean_up __P((char *)); +void clear_level __P((void)); +void cnfs __P((void)); +int coin_toss __P((void)); +int connect_rooms __P((short, short)); +void cough_up __P((object *)); +void create_monster __P((void)); +int damage_for_strength __P((void)); +void darken_room __P((short)); +void disappear __P((object *)); +void do_args __P((int, char **)); +void do_opts __P((void)); +void do_put_on __P((object *, boolean)); +void do_shell __P((void)); +void do_wear __P((object *)); +void do_wield __P((object *)); +void dr_course __P((object *, boolean, short, short)); +void drain_life __P((void)); +void draw_magic_map __P((void)); +void draw_simple_passage __P((short, short, short, short, short)); +void drop __P((void)); +int drop_check __P((void)); +void drop_level __P((void)); +void eat __P((void)); +void edit_opts __P((void)); +void env_get_value __P((char **, char *, boolean)); +void error_save __P((int)); +void fight __P((int)); +void fill_it __P((int, boolean)); +void fill_out_level __P((void)); +boolean flame_broil __P((object *)); +int flit __P((object *)); +void flop_weapon __P((object *, short, short)); +void free_object __P((object *)); +void free_stuff __P((object *)); +void freeze __P((object *)); +int get_armor_class __P((object *)); +int get_com_id __P((int *, short)); +int get_damage __P((char *, boolean)); +void get_desc __P((object *, char *)); +int get_dir __P((short, short, short, short)); +void get_dir_rc __P((short, short *, short *, short)); +char get_dungeon_char __P((short, short)); +int get_exp_level __P((long)); +void get_food __P((object *, boolean)); +int get_hit_chance __P((object *)); +int get_input_line __P((char *, char *, char *, char *, boolean, boolean)); +char get_mask_char __P((unsigned short)); +int get_number __P((char *)); +boolean get_oth_room __P((short, short *, short *)); +int get_rand __P((int, int)); +short get_room_number __P((short, short)); +int get_value __P((object *)); +int get_w_damage __P((object *)); +void get_wand_and_ring_materials __P((void)); +int get_weapon_damage __P((object *)); +char gmc __P((object *)); +char gmc_row_col __P((short, short)); +void go_blind __P((void)); +boolean gold_at __P((short, short)); +void gr_armor __P((object *)); +char gr_dir __P((void)); +char gr_obj_char __P((void)); +void gr_potion __P((object *)); +void gr_ring __P((object *, boolean)); +short gr_room __P((void)); +void gr_row_col __P((short *, short *, unsigned short)); +void gr_scroll __P((object *)); +void gr_wand __P((object *)); +void gr_weapon __P((object *, int)); +void hallucinate __P((void)); +boolean has_amulet __P((void)); +boolean has_been_touched __P((struct rogue_time *, struct rogue_time *)); +void heal __P((void)); +void hide_boxed_passage __P((short, short, short, short, short)); +void hold_monster __P((void)); +int hp_raise __P((void)); +void id_all __P((void)); +void id_com __P((void)); +void id_trap __P((void)); +void id_type __P((void)); +void idntfy __P((void)); +boolean imitating __P((short, short)); +int init __P((int, char **)); +void init_str __P((char **, char *)); +void insert_score __P((char [][], char [][], char *, short, short, object *, int)); +void inv_armor_weapon __P((boolean)); +void inv_rings __P((void)); +void inventory __P((object *, unsigned short)); +boolean is_all_connected __P((void)); +boolean is_digit __P((int)); +boolean is_direction __P((short, short *)); +boolean is_pack_letter __P((short *, unsigned short *)); +boolean is_passable __P((short, short)); +boolean is_vowel __P((short)); +void kick_into_pack __P((void)); +void killed_by __P((object *, short)); +long lget_number __P((char *)); +void light_passage __P((short, short)); +void light_up_room __P((int)); +boolean m_confuse __P((object *)); +void make_level __P((void)); +void make_maze __P((short, short, short, short, short, short)); +void make_party __P((void)); +void make_room __P((short, short, short, short)); +void make_scroll_titles __P((void)); +boolean mask_pack __P((object *, unsigned short)); +boolean mask_room __P((short, short *, short *, unsigned short)); +void md_cbreak_no_echo_nonl __P((boolean)); +boolean md_df __P((char *)); +void md_exit __P((int)); +void md_gct __P((struct rogue_time *)); +char *md_gdtcf __P((void)); +int md_get_file_id __P((char *)); +void md_gfmt __P((char *, struct rogue_time *)); +int md_gseed __P((void)); +void md_heed_signals __P((void)); +void md_ignore_signals __P((void)); +int md_link_count __P((char *)); +void md_lock __P((boolean)); +void md_shell __P((char *)); +void md_sleep __P((int)); +void md_slurp __P((void)); +void md_tstp __P((void)); +void message __P((char *, boolean)); +void mix_colors __P((void)); +void mix_colors __P((void)); +void mix_random_rooms __P((void)); +int mon_can_go __P((object *, short, short)); +int mon_damage __P((object *, short)); +void mon_hit __P((object *)); +boolean mon_sees __P((object *, short, short)); +int move_confused __P((object *)); +void move_mon_to __P((object *, short, short)); +void move_onto __P((void)); +int mtry __P((object *, short, short)); +void multiple_move_rogue __P((short)); +void mv_1_monster __P((object *, short, short)); +void mv_aquatars __P((void)); +void mv_mons __P((void)); +int name_cmp __P((char *, char *)); +short next_avail_ichar __P((void)); +boolean next_to_something __P((short, short)); +void nickize __P((char *, char *, char *)); +int no_room_for_monster __P((int)); +int one_move_rogue __P((short, short)); +void onintr __P((int)); +void opt_erase __P((int)); +void opt_go __P((int)); +void opt_show __P((int)); +short pack_count __P((object *)); +short pack_letter __P((char *, unsigned short)); +void pad __P((char *, short)); +void party_monsters __P((int, int)); +short party_objects __P((int)); +void place_at __P((object *, short, short)); +void plant_gold __P((short, short, boolean)); +void play_level __P((void)); +void player_init __P((void)); +void player_init __P((void)); +void potion_heal __P((int)); +int pr_com_id __P((int)); +int pr_motion_char __P((int)); +void print_stats __P((int)); +void put_amulet __P((void)); +void put_door __P((room *, short, short *, short *)); +void put_gold __P((void)); +void put_m_at __P((short, short, object *)); +void put_mons __P((void)); +void put_objects __P((void)); +void put_on_ring __P((void)); +void put_player __P((short)); +void put_scores __P((object *, short)); +void put_stairs __P((void)); +void quaff __P((void)); +void quit __P((boolean)); +int r_index __P((char *, int, boolean)); +void r_read __P((FILE *, char *, int)); +void r_write __P((FILE *, char *, int)); +void rand_around __P((short, short *, short *)); +int rand_percent __P((int)); +void rand_place __P((object *)); +void read_pack __P((object *, FILE *, boolean)); +void read_scroll __P((void)); +void read_string __P((char *, FILE *)); +void recursive_deadend __P((short, short *, short, short)); +boolean reg_move __P((void)); +void relight __P((void)); +void remessage __P((short)); +void remove_ring __P((void)); +void rest __P((int)); +void restore __P((char *)); +int rgetchar __P((void)); +void ring_stats __P((boolean)); +int rogue_can_see __P((short, short)); +void rogue_damage __P((short, object *, short)); +void rogue_hit __P((object *, boolean)); +int rogue_is_around __P((short, short)); +long rrandom __P((void)); +void rust __P((object *)); +void rw_dungeon __P((FILE *, boolean)); +void rw_id __P((struct id *, FILE *, int, boolean)); +void rw_rooms __P((FILE *, boolean)); +void s_con_mon __P((object *)); +int same_col __P((int, int)); +int same_row __P((int, int)); +void save_game __P((void)); +void save_into_file __P((char *)); +void save_screen __P((void)); +void search __P((short, boolean)); +boolean seek_gold __P((object *)); +void sell_pack __P((void)); +void sf_error __P((void)); +void show_average_hp __P((void)); +void show_monsters __P((void)); +void show_objects __P((void)); +void show_traps __P((void)); +void single_inv __P((short)); +void sound_bell __P((void)); +void special_hit __P((object *)); +void srrandom __P((int)); +void start_window __P((void)); +void start_window __P((void)); +void steal_gold __P((object *)); +void steal_item __P((object *)); +void sting __P((object *)); +void stop_window __P((void)); +void stop_window __P((void)); +void take_a_nap __P((void)); +void take_from_pack __P((object *, object *)); +void take_off __P((void)); +void tele __P((void)); +void tele_away __P((object *)); +void throw __P((void)); +boolean throw_at_monster __P((object *, object *)); +int to_hit __P((object *)); +short trap_at __P((short, short)); +void trap_player __P((short, short)); +boolean try_to_cough __P((short, short, object *)); +void turn_passage __P((short, boolean)); +void un_put_on __P((object *)); +void unblind __P((void)); +void unconfuse __P((void)); +void uncurse_all __P((void)); +void unhallucinate __P((void)); +void unwear __P((object *)); +void unwield __P((object *)); +void vanish __P((object *, short, object *)); +void visit_rooms __P((int)); +void wait_for_ack __P((void)); +void wake_room __P((short, boolean, short, short)); +void wake_up __P((object *)); +void wanderer __P((void)); +void wdrain_life __P((object *)); +void wear __P((void)); +void wield __P((void)); +void win __P((void)); +void wizardize __P((void)); +void write_pack __P((object *, FILE *)); +void write_string __P((char *, FILE *)); +long xxx __P((boolean)); +void xxxx __P((char *, short)); +void zap_monster __P((object *, unsigned short)); +void zapp __P((void)); +object *add_to_pack __P((object *, object *, int)); +struct id *get_id_table __P((object *)); +unsigned short gr_what_is __P((void)); + +extern boolean ask_quit; +extern boolean being_held; +extern boolean cant_int; +extern boolean con_mon; +extern boolean detect_monster; +extern boolean did_int; +extern boolean interrupted; +extern boolean is_wood[]; +extern boolean jump; +extern boolean maintain_armor; +extern boolean mon_disappeared; +extern boolean msg_cleared; +extern boolean no_skull; +extern boolean passgo; +extern boolean r_see_invisible; +extern boolean r_teleport; +extern boolean save_is_interactive; +extern boolean score_only; +extern boolean see_invisible; +extern boolean sustain_strength; +extern boolean trap_door; +extern boolean wizard; +extern char hit_message[]; +extern char hunger_str[]; +extern char login_name[]; +extern char *byebye_string; +extern char *curse_message; +extern char *error_file; +extern char *fruit; +extern char *m_names[]; +extern char *more; +extern char *new_level_message; +extern char *nick_name; +extern char *press_space; +extern char *save_file; +extern char *you_can_move_again; +extern long level_points[]; +extern short add_strength; +extern short auto_search; +extern short bear_trap; +extern short blind; +extern short confused; +extern short cur_level; +extern short cur_room; +extern short e_rings; +extern short extra_hp; +extern short foods; +extern short halluc; +extern short haste_self; +extern short less_hp; +extern short levitate; +extern short m_moves; +extern short max_level; +extern short party_room; +extern short r_rings; +extern short regeneration; +extern short ring_exp; +extern short stealthy; diff --git a/games/rogue/room.c b/games/rogue/room.c index 83d061fa5e1..09e130c93ec 100644 --- a/games/rogue/room.c +++ b/games/rogue/room.c @@ -1,3 +1,4 @@ +/* $OpenBSD: room.c,v 1.3 1998/08/22 08:55:45 pjanzen Exp $ */ /* $NetBSD: room.c,v 1.3 1995/04/22 10:28:17 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: room.c,v 1.3 1995/04/22 10:28:17 cgd Exp $"; +static char rcsid[] = "$OpenBSD: room.c,v 1.3 1998/08/22 08:55:45 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: room.c,v 1.3 1995/04/22 10:28:17 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -61,10 +62,6 @@ static char rcsid[] = "$NetBSD: room.c,v 1.3 1995/04/22 10:28:17 cgd Exp $"; room rooms[MAXROOMS]; boolean rooms_visited[MAXROOMS]; -extern short blind; -extern boolean detect_monster, jump, passgo, no_skull, ask_quit; -extern char *nick_name, *fruit, *save_file, *press_space; - #define NOPTS 7 struct option { @@ -103,8 +100,9 @@ struct option { } }; +void light_up_room(rn) -int rn; + int rn; { short i, j; @@ -116,7 +114,7 @@ int rn; if (dungeon[i][j] & MONSTER) { object *monster; - if (monster = object_at(&level_monsters, i, j)) { + if ((monster = object_at(&level_monsters, i, j))) { dungeon[monster->row][monster->col] &= (~MONSTER); monster->trail_char = get_dungeon_char(monster->row, monster->col); @@ -130,7 +128,9 @@ int rn; } } +void light_passage(row, col) + short row, col; { short i, j, i_end, j_end; @@ -149,8 +149,9 @@ light_passage(row, col) } } +void darken_room(rn) -short rn; + short rn; { short i, j; @@ -173,10 +174,11 @@ short rn; } } +char get_dungeon_char(row, col) -register row, col; + short row, col; { - register unsigned short mask = dungeon[row][col]; + unsigned short mask = dungeon[row][col]; if (mask & MONSTER) { return(gmc_row_col(row, col)); @@ -221,8 +223,9 @@ register row, col; return(' '); } +char get_mask_char(mask) -register unsigned short mask; + unsigned short mask; { switch(mask) { case SCROL: @@ -248,9 +251,10 @@ register unsigned short mask; } } +void gr_row_col(row, col, mask) -short *row, *col; -unsigned short mask; + short *row, *col; + unsigned short mask; { short rn; short r, c; @@ -269,6 +273,7 @@ unsigned short mask; *col = c; } +short gr_room() { short i; @@ -280,7 +285,9 @@ gr_room() return(i); } +short party_objects(rn) + int rn; { short i, j, nf = 0; object *obj; @@ -312,8 +319,9 @@ party_objects(rn) return(nf); } +short get_room_number(row, col) -register row, col; + short row, col; { short i; @@ -326,10 +334,12 @@ register row, col; return(NO_ROOM); } +boolean is_all_connected() { short i, starting_room; + starting_room = 0; for (i = 0; i < MAXROOMS; i++) { rooms_visited[i] = 0; if (rooms[i].is_room & (R_ROOM | R_MAZE)) { @@ -347,8 +357,9 @@ is_all_connected() return(1); } +void visit_rooms(rn) -int rn; + int rn; { short i; short oth_rn; @@ -363,6 +374,7 @@ int rn; } } +void draw_magic_map() { short i, j, ch, och; @@ -399,7 +411,8 @@ draw_magic_map() if (s & MONSTER) { object *monster; - if (monster = object_at(&level_monsters, i, j)) { + if ((monster = object_at(&level_monsters, i, j))) + { monster->trail_char = ch; } } @@ -409,10 +422,11 @@ draw_magic_map() } } +void dr_course(monster, entering, row, col) -object *monster; -boolean entering; -short row, col; + object *monster; + boolean entering; + short row, col; { short i, j, k, rn; short r, rr; @@ -483,8 +497,9 @@ short row, col; } } +boolean get_oth_room(rn, row, col) -short rn, *row, *col; + short rn, *row, *col; { short d = -1; @@ -505,6 +520,7 @@ short rn, *row, *col; return(0); } +void edit_opts() { char save[NOPTS+1][DCOLS]; @@ -603,8 +619,9 @@ CH: } } +void opt_show(i) -int i; + int i; { char *s; struct option *opt = &options[i]; @@ -619,8 +636,9 @@ int i; addstr(s); } +void opt_erase(i) -int i; + int i; { struct option *opt = &options[i]; @@ -628,12 +646,14 @@ int i; clrtoeol(); } +void opt_go(i) -int i; + int i; { move(i, strlen(options[i].prompt)); } +void do_shell() { #ifdef UNIX diff --git a/games/rogue/save.c b/games/rogue/save.c index 73008b3987c..b75aa7c37ab 100644 --- a/games/rogue/save.c +++ b/games/rogue/save.c @@ -1,3 +1,4 @@ +/* $OpenBSD: save.c,v 1.4 1998/08/22 08:55:46 pjanzen Exp $ */ /* $NetBSD: save.c,v 1.3 1995/04/22 10:28:21 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: save.c,v 1.3 1995/04/22 10:28:21 cgd Exp $"; +static char rcsid[] = "$OpenBSD: save.c,v 1.4 1998/08/22 08:55:46 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: save.c,v 1.3 1995/04/22 10:28:21 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -62,29 +63,7 @@ static char rcsid[] = "$NetBSD: save.c,v 1.3 1995/04/22 10:28:21 cgd Exp $"; short write_failed = 0; char *save_file = (char *) 0; -extern boolean detect_monster; -extern short cur_level, max_level; -extern char hunger_str[]; -extern char login_name[]; -extern short party_room; -extern short foods; -extern boolean is_wood[]; -extern short cur_room; -extern boolean being_held; -extern short bear_trap; -extern short halluc; -extern short blind; -extern short confused; -extern short levitate; -extern short haste_self; -extern boolean see_invisible; -extern boolean detect_monster; -extern boolean wizard; -extern boolean score_only; -extern short m_moves; - -extern boolean msg_cleared; - +void save_game() { char fname[64]; @@ -98,8 +77,9 @@ save_game() save_into_file(fname); } +void save_into_file(sfile) -char *sfile; + char *sfile; { FILE *fp; int file_id; @@ -108,7 +88,7 @@ char *sfile; struct rogue_time rt_buf; if (sfile[0] == '~') { - if (hptr = md_getenv("HOME")) { + if ((hptr = md_getenv("HOME"))) { if (strlen(hptr) + strlen(sfile+1) < sizeof(name_buffer)) { (void) strcpy(name_buffer, hptr); (void) strcat(name_buffer, sfile+1); @@ -172,8 +152,9 @@ char *sfile; } } +void restore(fname) -char *fname; + char *fname; { FILE *fp; struct rogue_time saved_time, mod_time; @@ -252,23 +233,25 @@ char *fname; fclose(fp); } +void write_pack(pack, fp) -object *pack; -FILE *fp; + object *pack; + FILE *fp; { object t; - while (pack = pack->next_object) { + while ((pack = pack->next_object)) { r_write(fp, (char *) pack, sizeof(object)); } t.ichar = t.what_is = 0; r_write(fp, (char *) &t, sizeof(object)); } +void read_pack(pack, fp, is_rogue) -object *pack; -FILE *fp; -boolean is_rogue; + object *pack; + FILE *fp; + boolean is_rogue; { object read_obj, *new_obj; @@ -295,9 +278,10 @@ boolean is_rogue; } } +void rw_dungeon(fp, rw) -FILE *fp; -boolean rw; + FILE *fp; + boolean rw; { short i, j; char buf[DCOLS]; @@ -319,11 +303,12 @@ boolean rw; } } +void rw_id(id_table, fp, n, wr) -struct id id_table[]; -FILE *fp; -int n; -boolean wr; + struct id id_table[]; + FILE *fp; + int n; + boolean wr; { short i; @@ -342,9 +327,10 @@ boolean wr; } } +void write_string(s, fp) -char *s; -FILE *fp; + char *s; + FILE *fp; { short n; @@ -354,9 +340,10 @@ FILE *fp; r_write(fp, s, n); } +void read_string(s, fp) -char *s; -FILE *fp; + char *s; + FILE *fp; { short n; @@ -365,9 +352,10 @@ FILE *fp; xxxx(s, n); } +void rw_rooms(fp, rw) -FILE *fp; -boolean rw; + FILE *fp; + boolean rw; { short i; @@ -377,20 +365,22 @@ boolean rw; } } +void r_read(fp, buf, n) -FILE *fp; -char *buf; -int n; + FILE *fp; + char *buf; + int n; { if (fread(buf, sizeof(char), n, fp) != n) { clean_up("read() failed, don't know why"); } } +void r_write(fp, buf, n) -FILE *fp; -char *buf; -int n; + FILE *fp; + char *buf; + int n; { if (!write_failed) { if (fwrite(buf, sizeof(char), n, fp) != n) { @@ -403,7 +393,7 @@ int n; boolean has_been_touched(saved_time, mod_time) -struct rogue_time *saved_time, *mod_time; + struct rogue_time *saved_time, *mod_time; { if (saved_time->year < mod_time->year) { return(1); diff --git a/games/rogue/score.c b/games/rogue/score.c index 01e5a5ed5f2..6f90dfa0087 100644 --- a/games/rogue/score.c +++ b/games/rogue/score.c @@ -1,3 +1,4 @@ +/* $OpenBSD: score.c,v 1.4 1998/08/22 08:55:47 pjanzen Exp $ */ /* $NetBSD: score.c,v 1.5 1995/04/22 10:28:26 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: score.c,v 1.5 1995/04/22 10:28:26 cgd Exp $"; +static char rcsid[] = "$OpenBSD: score.c,v 1.4 1998/08/22 08:55:47 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: score.c,v 1.5 1995/04/22 10:28:26 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -60,15 +61,10 @@ static char rcsid[] = "$NetBSD: score.c,v 1.5 1995/04/22 10:28:26 cgd Exp $"; #include "rogue.h" #include "pathnames.h" -extern char login_name[]; -extern char *m_names[]; -extern short max_level; -extern boolean score_only, no_skull, msg_cleared; -extern char *byebye_string, *nick_name; - +void killed_by(monster, other) -object *monster; -short other; + object *monster; + short other; { char buf[128]; @@ -134,6 +130,7 @@ short other; put_scores(monster, other); } +void win() { unwield(rogue.weapon); /* disarm and relax */ @@ -157,8 +154,9 @@ win() put_scores((object *) 0, WIN); } +void quit(from_intrpt) -boolean from_intrpt; + boolean from_intrpt; { char buf[128]; short i, orow, ocol; @@ -198,9 +196,10 @@ boolean from_intrpt; killed_by((object *) 0, QUIT); } +void put_scores(monster, other) -object *monster; -short other; + object *monster; + short other; { short i, n, rank = 10, x, ne = 0, found_player = -1; char scores[10][82]; @@ -278,8 +277,8 @@ short other; rank = ne; } if (rank < 10) { - insert_score(scores, n_names, nick_name, rank, ne, monster, - other); + insert_score(scores, n_names, nick_name, rank, ne, + monster, other); if (ne < 10) { ne++; } @@ -328,12 +327,13 @@ short other; clean_up(""); } +void insert_score(scores, n_names, n_name, rank, n, monster, other) -char scores[][82]; -char n_names[][30]; -char *n_name; -short rank, n; -object *monster; + char scores[][82]; + char n_names[][30]; + char *n_name; + short rank, n; + object *monster; { short i; char buf[128]; @@ -346,7 +346,8 @@ object *monster; } } } - sprintf(buf, "%2d %6d %s: ", rank+1, rogue.gold, login_name); + sprintf(buf, "%2d %6ld %s: ", rank+1, (long)rogue.gold, + login_name); if (other) { switch(other) { @@ -390,8 +391,9 @@ object *monster; (void) strcpy(n_names[rank], n_name); } +boolean is_vowel(ch) -short ch; + short ch; { return( (ch == 'a') || (ch == 'e') || @@ -400,6 +402,7 @@ short ch; (ch == 'u') ); } +void sell_pack() { object *obj; @@ -432,12 +435,14 @@ sell_pack() message("", 0); } +int get_value(obj) -object *obj; + object *obj; { short wc; int val; + val = 0; wc = obj->which_kind; switch(obj->what_is) { @@ -479,6 +484,7 @@ object *obj; return(val); } +void id_all() { short i; @@ -500,8 +506,9 @@ id_all() } } +int name_cmp(s1, s2) -char *s1, *s2; + char *s1, *s2; { short i = 0; int r; @@ -515,9 +522,10 @@ char *s1, *s2; return(r); } +void xxxx(buf, n) -char *buf; -short n; + char *buf; + short n; { short i; unsigned char c; @@ -533,7 +541,7 @@ short n; long xxx(st) -boolean st; + boolean st; { static long f, s; long r; @@ -549,8 +557,9 @@ boolean st; return(r); } +void nickize(buf, score, n_name) -char *buf, *score, *n_name; + char *buf, *score, *n_name; { short i = 15, j; @@ -574,9 +583,10 @@ char *buf, *score, *n_name; } } +void center(row, buf) -short row; -char *buf; + short row; + char *buf; { short margin; @@ -584,6 +594,7 @@ char *buf; mvaddstr(row, margin, buf); } +void sf_error() { md_lock(0); diff --git a/games/rogue/spec_hit.c b/games/rogue/spec_hit.c index 7893d32667f..b5544c7e2d0 100644 --- a/games/rogue/spec_hit.c +++ b/games/rogue/spec_hit.c @@ -1,3 +1,4 @@ +/* $OpenBSD: spec_hit.c,v 1.3 1998/08/22 08:55:48 pjanzen Exp $ */ /* $NetBSD: spec_hit.c,v 1.3 1995/04/22 10:28:29 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)spec_hit.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: spec_hit.c,v 1.3 1995/04/22 10:28:29 cgd Exp $"; +static char rcsid[] = "$OpenBSD: spec_hit.c,v 1.3 1998/08/22 08:55:48 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: spec_hit.c,v 1.3 1995/04/22 10:28:29 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -61,14 +62,9 @@ static char rcsid[] = "$NetBSD: spec_hit.c,v 1.3 1995/04/22 10:28:29 cgd Exp $"; short less_hp = 0; boolean being_held; -extern short cur_level, max_level, blind, levitate, ring_exp; -extern long level_points[]; -extern boolean detect_monster, mon_disappeared; -extern boolean sustain_strength, maintain_armor; -extern char *you_can_move_again; - +void special_hit(monster) -object *monster; + object *monster; { if ((monster->m_flags & CONFUSED) && rand_percent(66)) { return; @@ -98,8 +94,9 @@ object *monster; } } +void rust(monster) -object *monster; + object *monster; { if ((!rogue.armor) || (get_armor_class(rogue.armor) <= 1) || (rogue.armor->which_kind == LEATHER)) { @@ -117,8 +114,9 @@ object *monster; } } +void freeze(monster) -object *monster; + object *monster; { short freeze_percent = 99; short i, n; @@ -150,8 +148,9 @@ object *monster; } } +void steal_gold(monster) -object *monster; + object *monster; { int amount; @@ -170,11 +169,12 @@ object *monster; disappear(monster); } +void steal_item(monster) -object *monster; + object *monster; { object *obj; - short i, n, t; + short i, n, t = 0; char desc[80]; boolean has_something = 0; @@ -224,8 +224,9 @@ DSPR: disappear(monster); } +void disappear(monster) -object *monster; + object *monster; { short row, col; @@ -241,8 +242,9 @@ object *monster; mon_disappeared = 1; } +void cough_up(monster) -object *monster; + object *monster; { object *obj; short row, col, i, n; @@ -285,11 +287,13 @@ object *monster; free_object(obj); } +boolean try_to_cough(row, col, obj) -short row, col; -object *obj; + short row, col; + object *obj; { - if ((row < MIN_ROW) || (row > (DROWS-2)) || (col < 0) || (col>(DCOLS-1))) { + if ((row < MIN_ROW) || + (row > (DROWS-2)) || (col < 0) || (col>(DCOLS-1))) { return(0); } if ((!(dungeon[row][col] & (OBJECT | STAIRS | TRAP))) && @@ -304,8 +308,9 @@ object *obj; return(0); } +boolean seek_gold(monster) -object *monster; + object *monster; { short i, j, rn, s; @@ -336,8 +341,9 @@ object *monster; return(0); } +boolean gold_at(row, col) -short row, col; + short row, col; { if (dungeon[row][col] & OBJECT) { object *obj; @@ -350,14 +356,16 @@ short row, col; return(0); } +void check_gold_seeker(monster) -object *monster; + object *monster; { monster->m_flags &= (~SEEKS_GOLD); } +boolean check_imitator(monster) -object *monster; + object *monster; { char msg[80]; @@ -375,13 +383,14 @@ object *monster; return(0); } +boolean imitating(row, col) -register short row, col; + short row, col; { if (dungeon[row][col] & MONSTER) { - object *object_at(), *monster; + object *monster; - if (monster = object_at(&level_monsters, row, col)) { + if ((monster = object_at(&level_monsters, row, col))) { if (monster->m_flags & IMITATES) { return(1); } @@ -390,8 +399,9 @@ register short row, col; return(0); } +void sting(monster) -object *monster; + object *monster; { short sting_chance = 35; char msg[80]; @@ -413,6 +423,7 @@ object *monster; } } +void drop_level() { int hp; @@ -432,6 +443,7 @@ drop_level() add_exp(1, 0); } +void drain_life() { short n; @@ -460,8 +472,9 @@ drain_life() print_stats((STAT_STRENGTH | STAT_HP)); } +boolean m_confuse(monster) -object *monster; + object *monster; { char msg[80]; @@ -482,8 +495,9 @@ object *monster; return(0); } +boolean flame_broil(monster) -object *monster; + object *monster; { short row, col, dir; @@ -508,8 +522,9 @@ object *monster; return(1); } +int get_dir(srow, scol, drow, dcol) -short srow, scol, drow, dcol; + short srow, scol, drow, dcol; { if (srow == drow) { if (scol < dcol) { diff --git a/games/rogue/throw.c b/games/rogue/throw.c index 399ddeacabb..e6e11dfe7e0 100644 --- a/games/rogue/throw.c +++ b/games/rogue/throw.c @@ -1,3 +1,4 @@ +/* $OpenBSD: throw.c,v 1.3 1998/08/22 08:55:49 pjanzen Exp $ */ /* $NetBSD: throw.c,v 1.3 1995/04/22 10:28:32 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)throw.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: throw.c,v 1.3 1995/04/22 10:28:32 cgd Exp $"; +static char rcsid[] = "$OpenBSD: throw.c,v 1.3 1998/08/22 08:55:49 pjanzen Exp $"; #endif #endif /* not lint */ @@ -52,16 +53,13 @@ static char rcsid[] = "$NetBSD: throw.c,v 1.3 1995/04/22 10:28:32 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ #include "rogue.h" -extern short cur_room; -extern char *curse_message; -extern char hit_message[]; - +void throw() { short wch, d; @@ -125,8 +123,9 @@ throw() vanish(weapon, 1, &rogue.pack); } +boolean throw_at_monster(monster, weapon) -object *monster, *weapon; + object *monster, *weapon; { short damage, hit_chance; short t; @@ -162,9 +161,9 @@ object *monster, *weapon; object * get_thrown_at_monster(obj, dir, row, col) -object *obj; -short dir; -short *row, *col; + object *obj; + short dir; + short *row, *col; { short orow, ocol; short i, ch; @@ -205,9 +204,10 @@ short *row, *col; return(0); } +void flop_weapon(weapon, row, col) -object *weapon; -short row, col; + object *weapon; + short row, col; { object *new_weapon, *monster; short i = 0; @@ -264,8 +264,9 @@ short row, col; } } +void rand_around(i, r, c) -short i, *r, *c; + short i, *r, *c; { static char* pos = "\010\007\001\003\004\005\002\006\0"; static short row, col; diff --git a/games/rogue/trap.c b/games/rogue/trap.c index 7cfa6eb893e..a6775824cdc 100644 --- a/games/rogue/trap.c +++ b/games/rogue/trap.c @@ -1,3 +1,4 @@ +/* $OpenBSD: trap.c,v 1.3 1998/08/22 08:55:50 pjanzen Exp $ */ /* $NetBSD: trap.c,v 1.3 1995/04/22 10:28:35 cgd Exp $ */ /* @@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: trap.c,v 1.3 1995/04/22 10:28:35 cgd Exp $"; * 1.) No portion of this notice shall be removed. * 2.) Credit shall not be taken for the creation of this source. * 3.) This code is not to be traded, sold, or used for personal - * gain or profit. + * gain or profit. * */ @@ -77,15 +78,9 @@ char *trap_strings[TRAPS * 2] = { "a gush of water hits you on the head" }; -extern short cur_level, party_room; -extern char *new_level_message; -extern boolean interrupted; -extern short ring_exp; -extern boolean sustain_strength; -extern short blind; - +short trap_at(row, col) -register row, col; + short row, col; { short i; @@ -97,8 +92,9 @@ register row, col; return(NO_TRAP); } +void trap_player(row, col) -short row, col; + short row, col; { short t; @@ -149,6 +145,7 @@ short row, col; } } +void add_traps() { short i, n, tries = 0; @@ -193,6 +190,7 @@ add_traps() } } +void id_trap() { short dir, row, col, d, t; @@ -220,6 +218,7 @@ id_trap() } } +void show_traps() { short i, j; @@ -233,9 +232,10 @@ show_traps() } } +void search(n, is_auto) -short n; -boolean is_auto; + short n; + boolean is_auto; { short s, i, j, row, col, t; short shown = 0, found = 0; diff --git a/games/rogue/use.c b/games/rogue/use.c index e089c12d500..e6126d108bb 100644 --- a/games/rogue/use.c +++ b/games/rogue/use.c @@ -1,3 +1,4 @@ +/* $OpenBSD: use.c,v 1.4 1998/08/22 08:55:51 pjanzen Exp $ */ /* $NetBSD: use.c,v 1.3 1995/04/22 10:28:38 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)use.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: use.c,v 1.3 1995/04/22 10:28:38 cgd Exp $"; +static char rcsid[] = "$OpenBSD: use.c,v 1.4 1998/08/22 08:55:51 pjanzen Exp $"; #endif #endif /* not lint */ @@ -69,14 +70,7 @@ boolean detect_monster = 0; boolean con_mon = 0; char *strange_feeling = "you have a strange feeling for a moment, then it passes"; -extern short bear_trap; -extern char hunger_str[]; -extern short cur_room; -extern long level_points[]; -extern boolean being_held; -extern char *fruit, *you_can_move_again; -extern boolean sustain_strength; - +void quaff() { short ch; @@ -190,6 +184,7 @@ quaff() vanish(obj, 1, &rogue.pack); } +void read_scroll() { short ch; @@ -302,10 +297,11 @@ read_scroll() * arrow (or whatever) in the quiver. It will only decrement the count. */ +void vanish(obj, rm, pack) -object *obj; -short rm; -object *pack; + object *obj; + short rm; + object *pack; { if (obj->quantity > 1) { obj->quantity--; @@ -325,7 +321,9 @@ object *pack; } } +void potion_heal(extra) + int extra; { float ratio; short add; @@ -370,6 +368,7 @@ potion_heal(extra) } } +void idntfy() { short ch; @@ -397,6 +396,7 @@ AGAIN: message(desc, 0); } +void eat() { short ch; @@ -438,6 +438,7 @@ eat() vanish(obj, 1, &rogue.pack); } +void hold_monster() { short i, j; @@ -470,6 +471,7 @@ hold_monster() } } +void tele() { mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col)); @@ -482,6 +484,7 @@ tele() bear_trap = 0; } +void hallucinate() { object *obj, *monster; @@ -511,6 +514,7 @@ hallucinate() } } +void unhallucinate() { halluc = 0; @@ -518,6 +522,7 @@ unhallucinate() message("everything looks SO boring now", 1); } +void unblind() { blind = 0; @@ -531,6 +536,7 @@ unblind() } } +void relight() { if (cur_room == PASSAGE) { @@ -541,6 +547,7 @@ relight() mvaddch(rogue.row, rogue.col, rogue.fchar); } +void take_a_nap() { short i; @@ -555,6 +562,7 @@ take_a_nap() message(you_can_move_again, 0); } +void go_blind() { short i, j; @@ -597,11 +605,13 @@ get_ench_color() return("blue "); } +void cnfs() { confused += get_rand(12, 22); } +void unconfuse() { char msg[80]; @@ -611,6 +621,7 @@ unconfuse() message(msg, 1); } +void uncurse_all() { object *obj; diff --git a/games/rogue/zap.c b/games/rogue/zap.c index 9bda4dddac2..eeb2070d4c3 100644 --- a/games/rogue/zap.c +++ b/games/rogue/zap.c @@ -1,3 +1,4 @@ +/* $OpenBSD: zap.c,v 1.3 1998/08/22 08:55:53 pjanzen Exp $ */ /* $NetBSD: zap.c,v 1.3 1995/04/22 10:28:41 cgd Exp $ */ /* @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)zap.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: zap.c,v 1.3 1995/04/22 10:28:41 cgd Exp $"; +static char rcsid[] = "$OpenBSD: zap.c,v 1.3 1998/08/22 08:55:53 pjanzen Exp $"; #endif #endif /* not lint */ @@ -60,9 +61,7 @@ static char rcsid[] = "$NetBSD: zap.c,v 1.3 1995/04/22 10:28:41 cgd Exp $"; boolean wizard = 0; -extern boolean being_held, score_only, detect_monster; -extern short cur_room; - +void zapp() { short wch; @@ -119,8 +118,8 @@ zapp() object * get_zapped_monster(dir, row, col) -short dir; -short *row, *col; + short dir; + short *row, *col; { short orow, ocol; @@ -140,9 +139,10 @@ short *row, *col; } } +void zap_monster(monster, kind) -object *monster; -unsigned short kind; + object *monster; + unsigned short kind; { short row, col; object *nm; @@ -207,8 +207,9 @@ unsigned short kind; } } +void tele_away(monster) -object *monster; + object *monster; { short row, col; @@ -226,6 +227,7 @@ object *monster; } } +void wizardize() { char buf[100]; @@ -248,8 +250,9 @@ wizardize() } } +void wdrain_life(monster) -object *monster; + object *monster; { short hp; object *lmon, *nm; @@ -277,8 +280,9 @@ object *monster; relight(); } +void bounce(ball, dir, row, col, r) -short ball, dir, row, col, r; + short ball, dir, row, col, r; { short orow, ocol; char buf[DCOLS], *s; |