WARNSify (not an insignificant task...)

This commit is contained in:
lukem 1997-10-12 11:45:01 +00:00
parent 93cacd961e
commit 2736b51163
25 changed files with 1139 additions and 602 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: curses.c,v 1.3 1995/04/22 10:27:27 cgd Exp $ */
/* $NetBSD: curses.c,v 1.4 1997/10/12 11:45:01 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: curses.c,v 1.4 1997/10/12 11:45:01 lukem Exp $");
#endif
#endif /* not lint */
@ -172,7 +173,7 @@ char *str;
}
addch(ch)
register int ch;
int ch;
{
short row, col;
@ -197,7 +198,7 @@ int ch;
refresh()
{
register i, j, line;
int i, j, line;
short old_row, old_col, first_row;
if (screen_dirty) {
@ -307,7 +308,7 @@ nonl()
clear_buffers()
{
register i, j;
int i, j;
screen_dirty = 0;
@ -321,7 +322,7 @@ clear_buffers()
}
put_char_at(row, col, ch)
register row, col, ch;
int row, col, ch;
{
put_cursor(row, col);
put_st_char(ch);
@ -330,9 +331,9 @@ register row, col, ch;
}
put_cursor(row, col)
register row, col;
int row, col;
{
register i, rdif, cdif;
int i, rdif, cdif;
short ch, t;
rdif = (row > cur_row) ? row - cur_row : cur_row - row;
@ -384,7 +385,7 @@ register row, col;
}
put_st_char(ch)
register ch;
int ch;
{
if ((ch & ST_MASK) && (!term_stand_out)) {
ch &= ~ST_MASK;
@ -697,4 +698,4 @@ tc_cmget()
cm_end[j] = 0;
}
#endif
#endif /* CURSES */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hit.c,v 1.3 1995/04/22 10:27:30 cgd Exp $ */
/* $NetBSD: hit.c,v 1.4 1997/10/12 11:45:05 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: hit.c,v 1.4 1997/10/12 11:45:05 lukem Exp $");
#endif
#endif /* not lint */
@ -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;
@ -333,6 +341,7 @@ boolean to_the_death;
short possible_damage;
object *monster;
ch = 0;
while (!is_direction(ch = rgetchar(), &d)) {
sound_bell();
if (first_miss) {
@ -375,10 +384,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 +438,9 @@ short allow_off_screen;
}
}
int
get_hit_chance(weapon)
object *weapon;
object *weapon;
{
short hit_chance;
@ -439,8 +450,9 @@ object *weapon;
return(hit_chance);
}
int
get_weapon_damage(weapon)
object *weapon;
object *weapon;
{
short damage;
@ -450,8 +462,9 @@ object *weapon;
return(damage);
}
void
s_con_mon(monster)
object *monster;
object *monster;
{
if (con_mon) {
monster->m_flags |= CONFUSED;

View File

@ -1,4 +1,4 @@
/* $NetBSD: init.c,v 1.4 1995/04/28 23:49:19 mycroft Exp $ */
/* $NetBSD: init.c,v 1.5 1997/10/12 11:45:08 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: init.c,v 1.5 1997/10/12 11:45:08 lukem Exp $");
#endif
#endif /* not lint */
@ -56,7 +57,6 @@ static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/04/28 23:49:19 mycroft Exp $";
*
*/
#include <stdio.h>
#include "rogue.h"
char login_name[MAX_OPT_LEN];
@ -73,18 +73,15 @@ boolean passgo = 0;
char *error_file = "rogue.esave";
char *byebye_string = "Okay, bye bye!";
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;
seed = 0;
pn = md_gln();
if ((!pn) || (strlen(pn) >= MAX_OPT_LEN)) {
clean_up("Hey! Who are you?");
@ -129,6 +126,7 @@ char *argv[];
return(0);
}
void
player_init()
{
object *obj;
@ -177,8 +175,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) {
@ -191,6 +190,7 @@ char *estr;
md_exit(0);
}
void
start_window()
{
crmode();
@ -200,13 +200,15 @@ start_window()
#endif
}
void
stop_window()
{
endwin();
}
void
byebye()
byebye(dummy)
int dummy;
{
md_ignore_signals();
if (ask_quit) {
@ -218,7 +220,8 @@ byebye()
}
void
onintr()
onintr(dummy)
int dummy;
{
md_ignore_signals();
if (cant_int) {
@ -231,16 +234,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;
@ -259,11 +264,12 @@ char *argv[];
}
}
void
do_opts()
{
char *eptr;
if (eptr = md_getenv("ROGUEOPTS")) {
if ((eptr = md_getenv("ROGUEOPTS")) != NULL) {
for (;;) {
while ((*eptr) == ' ') {
eptr++;
@ -306,9 +312,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;
@ -332,8 +339,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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: inventory.c,v 1.4 1997/05/17 19:26:24 pk Exp $ */
/* $NetBSD: inventory.c,v 1.5 1997/10/12 11:45:11 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)inventory.c 8.1 (Berkeley) 5/31/93";
#else
static char rcsid[] = "$NetBSD: inventory.c,v 1.4 1997/05/17 19:26:24 pk Exp $";
__RCSID("$NetBSD: inventory.c,v 1.5 1997/10/12 11:45:11 lukem Exp $");
#endif
#endif /* not lint */
@ -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",
'\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"
{'?', "? 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') ||
@ -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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: level.c,v 1.3 1995/04/22 10:27:37 cgd Exp $ */
/* $NetBSD: level.c,v 1.4 1997/10/12 11:45:16 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: level.c,v 1.4 1997/10/12 11:45:16 lukem Exp $");
#endif
#endif /* not lint */
@ -93,16 +94,14 @@ 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;
short must_1, must_2, must_3;
boolean big_room;
must_2 = must_3 = 0;
if (cur_level < LAST_DUNGEON) {
cur_level++;
}
@ -194,14 +193,16 @@ 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;
short row_offset, col_offset;
short i, j, ch;
left_col = right_col = top_row = bottom_row = 0;
switch(rn) {
case 0:
left_col = 0;
@ -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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.5 1995/04/28 23:49:22 mycroft Exp $ */
/* $NetBSD: machdep.c,v 1.6 1997/10/12 11:45:19 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)machdep.c 8.1 (Berkeley) 5/31/93";
#else
static char rcsid[] = "$NetBSD: machdep.c,v 1.5 1995/04/28 23:49:22 mycroft Exp $";
__RCSID("$NetBSD: machdep.c,v 1.6 1997/10/12 11:45:19 lukem Exp $");
#endif
#endif /* not lint */
@ -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;
@ -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;
{
static int fd;
short tries;
@ -480,10 +490,11 @@ 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;
@ -492,7 +503,7 @@ char *shell;
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
@ -531,8 +542,9 @@ char *shell;
*
*/
void
md_cbreak_no_echo_nonl(on)
boolean on;
boolean on;
{
struct termios tty_buf;
static struct termios tty_save;
@ -579,6 +591,7 @@ md_gdtcf()
*
*/
void
md_tstp()
{
#ifdef UNIX_BSD4_2

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.3 1995/04/22 10:27:41 cgd Exp $ */
/* $NetBSD: main.c,v 1.4 1997/10/12 11:45:22 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,17 +36,17 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
__COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#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 $";
__RCSID("$NetBSD: main.c,v 1.4 1997/10/12 11:45:22 lukem Exp $");
#endif
#endif /* not lint */
@ -64,11 +64,12 @@ static char rcsid[] = "$NetBSD: main.c,v 1.3 1995/04/22 10:27:41 cgd Exp $";
#include "rogue.h"
extern short party_room;
int main __P((int, char **));
int
main(argc, argv)
int argc;
char *argv[];
int argc;
char *argv[];
{
if (init(argc, argv)) { /* restored game */
goto PL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: message.c,v 1.5 1995/04/22 10:27:43 cgd Exp $ */
/* $NetBSD: message.c,v 1.6 1997/10/12 11:45:25 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: message.c,v 1.6 1997/10/12 11:45:25 lukem Exp $");
#endif
#endif /* not lint */
@ -56,9 +57,8 @@ static char rcsid[] = "$NetBSD: message.c,v 1.5 1995/04/22 10:27:43 cgd Exp $";
*
*/
#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,13 +221,15 @@ 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;
@ -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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: monster.c,v 1.3 1995/04/22 10:27:45 cgd Exp $ */
/* $NetBSD: monster.c,v 1.4 1997/10/12 11:45:28 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: monster.c,v 1.4 1997/10/12 11:45:28 lukem Exp $");
#endif
#endif /* not lint */
@ -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,14 +217,16 @@ NM: monster = next_monster;
}
}
void
party_monsters(rn, n)
int rn, n;
int rn, n;
{
short i, j;
short row, col;
object *monster;
boolean found;
row = col = 0;
n += n;
for (i = 0; i < MONSTERS; i++) {
@ -260,12 +259,13 @@ int rn, n;
}
}
char
gmc_row_col(row, col)
register row, col;
int row, col;
{
register object *monster;
object *monster;
if (monster = object_at(&level_monsters, row, col)) {
if ((monster = object_at(&level_monsters, row, col)) != NULL) {
if ((!(detect_monster || see_invisible || r_see_invisible) &&
(monster->m_flags & INVISIBLE)) || blind) {
return(monster->trail_char);
@ -279,8 +279,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 +294,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 +434,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 +446,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;
int mrow, mcol;
mrow = monster->row;
mcol = monster->col;
@ -493,9 +497,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 +539,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 +587,7 @@ short row, col;
char *
mon_name(monster)
object *monster;
object *monster;
{
short ch;
@ -596,8 +603,9 @@ object *monster;
return(m_names[ch]);
}
int
rogue_is_around(row, col)
register row, col;
int row, col;
{
short rdif, cdif, retval;
@ -608,6 +616,7 @@ register row, col;
return(retval);
}
void
wanderer()
{
object *monster;
@ -638,6 +647,7 @@ wanderer()
}
}
void
show_monsters()
{
object *monster;
@ -659,6 +669,7 @@ show_monsters()
}
}
void
create_monster()
{
short row, col;
@ -694,9 +705,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 +718,9 @@ object *monster;
aim_monster(monster);
}
void
aim_monster(monster)
object *monster;
object *monster;
{
short i, rn, d, r;
@ -724,10 +737,11 @@ object *monster;
}
}
int
rogue_can_see(row, col)
register row, col;
int row, col;
{
register retval;
int retval;
retval = !blind &&
(((get_room_number(row, col) == cur_room) &&
@ -737,8 +751,9 @@ register row, col;
return(retval);
}
int
move_confused(monster)
object *monster;
object *monster;
{
short i, row, col;
@ -767,8 +782,9 @@ object *monster;
return(0);
}
int
flit(monster)
object *monster;
object *monster;
{
short i, row, col;
@ -793,6 +809,7 @@ object *monster;
return(1);
}
char
gr_obj_char()
{
short r;
@ -803,8 +820,9 @@ gr_obj_char()
return(rs[r]);
}
int
no_room_for_monster(rn)
int rn;
int rn;
{
short i, j;
@ -818,6 +836,7 @@ int rn;
return(1);
}
void
aggravate()
{
object *monster;
@ -838,7 +857,7 @@ aggravate()
boolean
mon_sees(monster, row, col)
object *monster;
object *monster;
{
short rn, rdif, cdif, retval;
@ -856,6 +875,7 @@ object *monster;
return(retval);
}
void
mv_aquatars()
{
object *monster;

View File

@ -1,4 +1,4 @@
/* $NetBSD: move.c,v 1.3 1995/04/22 10:27:47 cgd Exp $ */
/* $NetBSD: move.c,v 1.4 1997/10/12 11:45:31 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: move.c,v 1.4 1997/10/12 11:45:31 lukem Exp $");
#endif
#endif /* not lint */
@ -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)) != NULL) {
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;
int 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;
int 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)
int 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) != 0) {
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++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: object.c,v 1.3 1995/04/22 10:27:50 cgd Exp $ */
/* $NetBSD: object.c,v 1.4 1997/10/12 11:45:34 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: object.c,v 1.4 1997/10/12 11:45:34 lukem Exp $");
#endif
#endif /* not lint */
@ -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,9 @@ boolean is_maze;
(void) add_to_pack(obj, &level_objects, 0);
}
void
place_at(obj, row, col)
object *obj;
object *obj;
{
obj->row = row;
obj->col = col;
@ -243,8 +248,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 +279,9 @@ get_letter_object(ch)
return(obj);
}
void
free_stuff(objlist)
object *objlist;
object *objlist;
{
object *obj;
@ -289,7 +295,7 @@ object *objlist;
char *
name_of(obj)
object *obj;
object *obj;
{
char *retstring;
@ -409,8 +415,9 @@ gr_what_is()
return(what_is);
}
void
gr_scroll(obj)
object *obj;
object *obj;
{
short percent;
@ -447,8 +454,9 @@ object *obj;
}
}
void
gr_potion(obj)
object *obj;
object *obj;
{
short percent;
@ -487,9 +495,10 @@ object *obj;
}
}
void
gr_weapon(obj, assign_wk)
object *obj;
int assign_wk;
object *obj;
int assign_wk;
{
short percent;
short i;
@ -552,8 +561,9 @@ int assign_wk;
}
}
void
gr_armor(obj)
object *obj;
object *obj;
{
short percent;
short blessing;
@ -578,17 +588,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 +611,7 @@ boolean force_ration;
}
}
void
put_stairs()
{
short row, col;
@ -607,8 +620,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 +651,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 +672,7 @@ make_party()
}
}
void
show_objects()
{
object *obj;
@ -671,7 +688,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)) != NULL) {
monster->trail_char = rc;
}
}
@ -693,6 +711,7 @@ show_objects()
}
}
void
put_amulet()
{
object *obj;
@ -702,8 +721,9 @@ put_amulet()
rand_place(obj);
}
void
rand_place(obj)
object *obj;
object *obj;
{
short row, col;
@ -711,12 +731,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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $ */
/* $NetBSD: pack.c,v 1.4 1997/10/12 11:45:37 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93";
#else
static char rcsid[] = "$NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $";
__RCSID("$NetBSD: pack.c,v 1.4 1997/10/12 11:45:37 lukem Exp $");
#endif
#endif /* not lint */
@ -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)) != NULL) {
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 *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)) != NULL) {
get_desc(obj, desc);
if (obj->what_is == GOLD) {
message(desc, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: play.c,v 1.3 1995/04/22 10:28:04 cgd Exp $ */
/* $NetBSD: play.c,v 1.4 1997/10/12 11:45:40 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: play.c,v 1.4 1997/10/12 11:45:40 lukem Exp $");
#endif
#endif /* not lint */
@ -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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: random.c,v 1.3 1995/04/22 10:28:06 cgd Exp $ */
/* $NetBSD: random.c,v 1.4 1997/10/12 11:45:43 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,14 +36,17 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: random.c,v 1.4 1997/10/12 11:45:43 lukem Exp $");
#endif
#endif /* not lint */
#include "rogue.h"
/*
* random.c
*
@ -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));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ring.c,v 1.3 1995/04/22 10:28:09 cgd Exp $ */
/* $NetBSD: ring.c,v 1.4 1997/10/12 11:45:47 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: ring.c,v 1.4 1997/10/12 11:45:47 lukem Exp $");
#endif
#endif /* not lint */
@ -72,9 +73,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 +134,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 +148,7 @@ boolean on_left;
}
}
void
remove_ring()
{
boolean left = 0, right = 0;
@ -155,6 +156,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 +199,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 +213,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 +255,7 @@ boolean assign_wk;
}
}
void
inv_rings()
{
char buf[DCOLS];
@ -276,8 +281,9 @@ inv_rings()
}
}
void
ring_stats(pr)
boolean pr;
boolean pr;
{
short i;
object *ring;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rogue.6,v 1.5 1995/04/22 10:28:12 cgd Exp $
.\" $NetBSD: rogue.6,v 1.6 1997/10/12 11:45:49 lukem Exp $
.\"
.\" Copyright (c) 1988, 1993
.\" The Regents of the University of California. All rights reserved.
@ -40,13 +40,13 @@
.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
.\" .Op Fl d
.Sh DESCRIPTION
.Nm Rogue
.Nm
is a computer fantasy game with a new twist. It is crt oriented and the
object of the game is to survive the attacks of various monsters and get
a lot of gold, rather than the puzzle solving orientation of most computer
@ -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.

View File

@ -1,11 +1,11 @@
/* $NetBSD: rogue.h,v 1.4 1995/04/24 12:25:04 cgd Exp $ */
/* $NetBSD: rogue.h,v 1.5 1997/10/12 11:45:52 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
* 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
@ -155,13 +155,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 +175,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 +245,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 +427,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 */
@ -483,8 +448,371 @@ extern int LINES, COLS;
extern WINDOW *curscr;
extern char *CL;
char *md_gdtcf();
#else
#include <curses.h>
#endif
/*
* external routine declarations.
*/
#include <stdio.h>
#include <string.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((int, int, 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((int, int, int, int));
boolean can_turn __P((int, int));
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((int, int));
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((int, int));
void go_blind __P((void));
boolean gold_at __P((int, int));
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((int, int, int, int, int));
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((int, int));
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((int, int));
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((int, int));
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 *, int, int));
int mon_damage __P((object *, short));
void mon_hit __P((object *));
boolean mon_sees __P((object *, int, int));
int move_confused __P((object *));
void move_mon_to __P((object *, int, int));
void move_onto __P((void));
int mtry __P((object *, int, int));
void multiple_move_rogue __P((short));
void mv_1_monster __P((object *, int, int));
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((int, int));
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 *, int, int));
void plant_gold __P((int, int, 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((int, int, 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((int, int));
void rogue_damage __P((short, object *, short));
void rogue_hit __P((object *, boolean));
int rogue_is_around __P((int, int));
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((int, int));
void trap_player __P((int, int));
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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: room.c,v 1.3 1995/04/22 10:28:17 cgd Exp $ */
/* $NetBSD: room.c,v 1.4 1997/10/12 11:45:56 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: room.c,v 1.4 1997/10/12 11:45:56 lukem Exp $");
#endif
#endif /* not lint */
@ -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,8 @@ 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)) != NULL) {
dungeon[monster->row][monster->col] &= (~MONSTER);
monster->trail_char =
get_dungeon_char(monster->row, monster->col);
@ -130,6 +129,7 @@ int rn;
}
}
void
light_passage(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,13 +285,16 @@ gr_room()
return(i);
}
short
party_objects(rn)
int rn;
{
short i, j, nf = 0;
object *obj;
short n, N, row, col;
boolean found;
row = col = 0;
N = ((rooms[rn].bottom_row - rooms[rn].top_row) - 1) *
((rooms[rn].right_col - rooms[rn].left_col) - 1);
n = get_rand(5, 10);
@ -312,8 +320,9 @@ party_objects(rn)
return(nf);
}
short
get_room_number(row, col)
register row, col;
int row, col;
{
short i;
@ -326,10 +335,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 +358,9 @@ is_all_connected()
return(1);
}
void
visit_rooms(rn)
int rn;
int rn;
{
short i;
short oth_rn;
@ -363,6 +375,7 @@ int rn;
}
}
void
draw_magic_map()
{
short i, j, ch, och;
@ -399,8 +412,11 @@ draw_magic_map()
if (s & MONSTER) {
object *monster;
if (monster = object_at(&level_monsters, i, j)) {
monster->trail_char = ch;
if ((monster = object_at(
&level_monsters, i, j))
!= NULL) {
monster->trail_char =
ch;
}
}
}
@ -409,10 +425,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 +500,9 @@ short row, col;
}
}
boolean
get_oth_room(rn, row, col)
short rn, *row, *col;
short rn, *row, *col;
{
short d = -1;
@ -505,6 +523,7 @@ short rn, *row, *col;
return(0);
}
void
edit_opts()
{
char save[NOPTS+1][DCOLS];
@ -603,8 +622,9 @@ CH:
}
}
void
opt_show(i)
int i;
int i;
{
char *s;
struct option *opt = &options[i];
@ -619,8 +639,9 @@ int i;
addstr(s);
}
void
opt_erase(i)
int i;
int i;
{
struct option *opt = &options[i];
@ -628,12 +649,14 @@ int i;
clrtoeol();
}
void
opt_go(i)
int i;
int i;
{
move(i, strlen(options[i].prompt));
}
void
do_shell()
{
#ifdef UNIX

View File

@ -1,4 +1,4 @@
/* $NetBSD: save.c,v 1.3 1995/04/22 10:28:21 cgd Exp $ */
/* $NetBSD: save.c,v 1.4 1997/10/12 11:45:58 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: save.c,v 1.4 1997/10/12 11:45:58 lukem Exp $");
#endif
#endif /* not lint */
@ -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")) != NULL) {
(void) strcpy(name_buffer, hptr);
(void) strcat(name_buffer, sfile+1);
sfile = name_buffer;
@ -167,8 +147,9 @@ char *sfile;
}
}
void
restore(fname)
char *fname;
char *fname;
{
FILE *fp;
struct rogue_time saved_time, mod_time;
@ -176,6 +157,7 @@ char *fname;
char tbuf[40];
int new_file_id, saved_file_id;
fp = NULL;
if ( ((new_file_id = md_get_file_id(fname)) == -1) ||
((fp = fopen(fname, "r")) == NULL)) {
clean_up("cannot open file");
@ -247,23 +229,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) != NULL) {
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;
@ -290,9 +274,10 @@ boolean is_rogue;
}
}
void
rw_dungeon(fp, rw)
FILE *fp;
boolean rw;
FILE *fp;
boolean rw;
{
short i, j;
char buf[DCOLS];
@ -314,11 +299,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;
@ -337,9 +323,10 @@ boolean wr;
}
}
void
write_string(s, fp)
char *s;
FILE *fp;
char *s;
FILE *fp;
{
short n;
@ -349,9 +336,10 @@ FILE *fp;
r_write(fp, s, n);
}
void
read_string(s, fp)
char *s;
FILE *fp;
char *s;
FILE *fp;
{
short n;
@ -360,9 +348,10 @@ FILE *fp;
xxxx(s, n);
}
void
rw_rooms(fp, rw)
FILE *fp;
boolean rw;
FILE *fp;
boolean rw;
{
short i;
@ -372,20 +361,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) {
@ -398,7 +389,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);

View File

@ -1,4 +1,4 @@
/* $NetBSD: score.c,v 1.5 1995/04/22 10:28:26 cgd Exp $ */
/* $NetBSD: score.c,v 1.6 1997/10/12 11:46:01 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: score.c,v 1.6 1997/10/12 11:46:01 lukem Exp $");
#endif
#endif /* not lint */
@ -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,13 +154,16 @@ win()
put_scores((object *) 0, WIN);
}
void
quit(from_intrpt)
boolean from_intrpt;
boolean from_intrpt;
{
char buf[128];
short i, orow, ocol;
boolean mc;
orow = ocol = 0;
mc = FALSE;
md_ignore_signals();
if (from_intrpt) {
@ -198,9 +198,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];
@ -274,8 +275,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++;
}
@ -324,12 +325,14 @@ 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;
int other;
{
short i;
char buf[128];
@ -342,7 +345,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) {
@ -386,8 +390,9 @@ object *monster;
(void) strcpy(n_names[rank], n_name);
}
boolean
is_vowel(ch)
short ch;
short ch;
{
return( (ch == 'a') ||
(ch == 'e') ||
@ -396,6 +401,7 @@ short ch;
(ch == 'u') );
}
void
sell_pack()
{
object *obj;
@ -428,12 +434,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) {
@ -475,6 +483,7 @@ object *obj;
return(val);
}
void
id_all()
{
short i;
@ -496,8 +505,9 @@ id_all()
}
}
int
name_cmp(s1, s2)
char *s1, *s2;
char *s1, *s2;
{
short i = 0;
int r;
@ -511,9 +521,10 @@ char *s1, *s2;
return(r);
}
void
xxxx(buf, n)
char *buf;
short n;
char *buf;
short n;
{
short i;
unsigned char c;
@ -529,7 +540,7 @@ short n;
long
xxx(st)
boolean st;
boolean st;
{
static long f, s;
long r;
@ -545,8 +556,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;
@ -570,9 +582,10 @@ char *buf, *score, *n_name;
}
}
void
center(row, buf)
short row;
char *buf;
short row;
char *buf;
{
short margin;
@ -580,6 +593,7 @@ char *buf;
mvaddstr(row, margin, buf);
}
void
sf_error()
{
md_lock(0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: spec_hit.c,v 1.3 1995/04/22 10:28:29 cgd Exp $ */
/* $NetBSD: spec_hit.c,v 1.4 1997/10/12 11:46:04 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: spec_hit.c,v 1.4 1997/10/12 11:46:04 lukem Exp $");
#endif
#endif /* not lint */
@ -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)) != NULL) {
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) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: throw.c,v 1.3 1995/04/22 10:28:32 cgd Exp $ */
/* $NetBSD: throw.c,v 1.4 1997/10/12 11:46:07 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: throw.c,v 1.4 1997/10/12 11:46:07 lukem Exp $");
#endif
#endif /* not lint */
@ -58,10 +59,7 @@ static char rcsid[] = "$NetBSD: throw.c,v 1.3 1995/04/22 10:28:32 cgd Exp $";
#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;
@ -241,7 +241,8 @@ short row, col;
dch = get_dungeon_char(row, col);
if (mon) {
mch = mvinch(row, col);
if (monster = object_at(&level_monsters, row, col)) {
if ((monster = object_at(&level_monsters,
row, col)) != NULL) {
monster->trail_char = dch;
}
if ((mch < 'A') || (mch > 'Z')) {
@ -264,8 +265,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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.3 1995/04/22 10:28:35 cgd Exp $ */
/* $NetBSD: trap.c,v 1.4 1997/10/12 11:46:09 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)trap.c 8.1 (Berkeley) 5/31/93";
#else
static char rcsid[] = "$NetBSD: trap.c,v 1.3 1995/04/22 10:28:35 cgd Exp $";
__RCSID("$NetBSD: trap.c,v 1.4 1997/10/12 11:46:09 lukem Exp $");
#endif
#endif /* not lint */
@ -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;
int 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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: use.c,v 1.3 1995/04/22 10:28:38 cgd Exp $ */
/* $NetBSD: use.c,v 1.4 1997/10/12 11:46:11 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: use.c,v 1.4 1997/10/12 11:46:11 lukem 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;

View File

@ -1,4 +1,4 @@
/* $NetBSD: zap.c,v 1.3 1995/04/22 10:28:41 cgd Exp $ */
/* $NetBSD: zap.c,v 1.4 1997/10/12 11:46:15 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#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 $";
__RCSID("$NetBSD: zap.c,v 1.4 1997/10/12 11:46:15 lukem 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;