Merge the GCC5 and build fix branches.

This commit is contained in:
John "Elwin" Edwards 2016-03-02 21:28:34 -05:00
commit 8bf09d3064
184 changed files with 4881 additions and 3465 deletions

View file

@ -12,6 +12,7 @@
* See the file LICENSE.TXT for full copyright and licensing information. * See the file LICENSE.TXT for full copyright and licensing information.
*/ */
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include "curses.h" #include "curses.h"
@ -21,8 +22,8 @@
coord ch_ret; /* Where chasing takes you */ coord ch_ret; /* Where chasing takes you */
struct linked_list *get_hurl(struct thing *tp);
bool straight_shot(int ery, int erx, int eey, int eex, coord *shooting);
/* /*
@ -31,8 +32,7 @@ coord ch_ret; /* Where chasing takes you */
*/ */
bool bool
can_blink(tp) can_blink(struct thing *tp)
register struct thing *tp;
{ {
register int y, x, index=9; register int y, x, index=9;
coord tryp; /* To hold the coordinates for use in diag_ok */ coord tryp; /* To hold the coordinates for use in diag_ok */
@ -128,8 +128,7 @@ register struct thing *tp;
*/ */
coord * coord *
can_shoot(er, ee) can_shoot(coord *er, coord *ee)
register coord *er, *ee;
{ {
static coord shoot_dir; static coord shoot_dir;
@ -154,13 +153,11 @@ register coord *er, *ee;
* FALSE if we reach the goal. * FALSE if we reach the goal.
*/ */
chase(tp, ee, flee, mdead) /* flee: True if destination (ee) is player and monster is running
register struct thing *tp; * away or the player is in a wall and the monster can't get to it
register coord *ee; */
bool flee; /* True if destination (ee) is player and monster is running away bool
* or the player is in a wall and the monster can't get to it chase(struct thing *tp, coord *ee, bool flee, bool *mdead)
*/
bool *mdead;
{ {
int damage, dist, thisdist, monst_dist = MAXINT; int damage, dist, thisdist, monst_dist = MAXINT;
struct linked_list *weapon; struct linked_list *weapon;
@ -530,10 +527,10 @@ bool *mdead;
* do_chase: * do_chase:
* Make one thing chase another. * Make one thing chase another.
*/ */
/* flee: True if running away or player is inaccessible in wall */
do_chase(th, flee) void
register struct thing *th; do_chase(struct thing *th, bool flee)
register bool flee; /* True if running away or player is inaccessible in wall */
{ {
register struct room *rer, *ree, /* room of chaser, room of chasee */ register struct room *rer, *ree, /* room of chaser, room of chasee */
*orig_rer, /* Original room of chaser */ *orig_rer, /* Original room of chaser */
@ -830,8 +827,7 @@ register bool flee; /* True if running away or player is inaccessible in wall */
*/ */
struct linked_list * struct linked_list *
get_hurl(tp) get_hurl(struct thing *tp)
register struct thing *tp;
{ {
struct linked_list *arrow, *bolt, *rock; struct linked_list *arrow, *bolt, *rock;
register struct linked_list *pitem; register struct linked_list *pitem;
@ -861,7 +857,8 @@ register struct thing *tp;
* Make all the running monsters move. * Make all the running monsters move.
*/ */
runners() void
runners(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *tp = NULL; register struct thing *tp = NULL;
@ -935,9 +932,8 @@ runners()
* Set a monster running after something * Set a monster running after something
*/ */
runto(runner, spot) void
register struct thing *runner; runto(struct thing *runner, coord *spot)
coord *spot;
{ {
/* /*
* Start the beastie running * Start the beastie running
@ -959,9 +955,7 @@ coord *spot;
*/ */
bool bool
straight_shot(ery, erx, eey, eex, shooting) straight_shot(int ery, int erx, int eey, int eex, coord *shooting)
register int ery, erx, eey, eex;
register coord *shooting;
{ {
register int dy, dx; /* Deltas */ register int dy, dx; /* Deltas */
char ch; char ch;

View file

@ -21,12 +21,20 @@
#include "rogue.h" #include "rogue.h"
#include "mach_dep.h" #include "mach_dep.h"
void help(void);
void identify(void);
void d_level(void);
void u_level(void);
void shell(void);
void call(bool mark);
/* /*
* command: * command:
* Process the user commands * Process the user commands
*/ */
command() void
command(void)
{ {
register char ch; register char ch;
register int ntimes = 1; /* Number of player moves */ register int ntimes = 1; /* Number of player moves */
@ -207,8 +215,8 @@ command()
when 'I' : after = FALSE; picky_inven(); when 'I' : after = FALSE; picky_inven();
when 'd' : drop(NULL); when 'd' : drop(NULL);
when 'P' : grab(hero.y, hero.x); when 'P' : grab(hero.y, hero.x);
when 'q' : quaff(-1, NULL, TRUE); when 'q' : quaff(-1, 0, TRUE);
when 'r' : read_scroll(-1, NULL, TRUE); when 'r' : read_scroll(-1, 0, TRUE);
when 'e' : eat(); when 'e' : eat();
when 'w' : wield(); when 'w' : wield();
when 'W' : wear(); when 'W' : wear();
@ -228,7 +236,7 @@ command()
when 'G' : gsense(); when 'G' : gsense();
when '^' : set_trap(&player, hero.y, hero.x); when '^' : set_trap(&player, hero.y, hero.x);
when 's' : search(FALSE, FALSE); when 's' : search(FALSE, FALSE);
when 'z' : if (!do_zap(TRUE, NULL, FALSE)) when 'z' : if (!do_zap(TRUE, 0, FALSE))
after=FALSE; after=FALSE;
when 'p' : pray(); when 'p' : pray();
when 'C' : cast(); when 'C' : cast();
@ -475,8 +483,7 @@ quit(int sig)
*/ */
void void
bugkill(sig) bugkill(int sig)
int sig;
{ {
signal(sig, quit); /* If we get it again, give up */ signal(sig, quit); /* If we get it again, give up */
death(D_SIGNAL); /* Killed by a bug */ death(D_SIGNAL); /* Killed by a bug */
@ -488,8 +495,8 @@ int sig;
* Player gropes about him to find hidden things. * Player gropes about him to find hidden things.
*/ */
search(is_thief, door_chime) void
register bool is_thief, door_chime; search(bool is_thief, bool door_chime)
{ {
register int x, y; register int x, y;
register char ch, /* The trap or door character */ register char ch, /* The trap or door character */
@ -570,7 +577,8 @@ register bool is_thief, door_chime;
* Give single character help, or the whole mess if he wants it * Give single character help, or the whole mess if he wants it
*/ */
help() void
help(void)
{ {
register struct h_list *strp = helpstr; register struct h_list *strp = helpstr;
#ifdef WIZARD #ifdef WIZARD
@ -664,7 +672,8 @@ help()
* Tell the player what a certain thing is. * Tell the player what a certain thing is.
*/ */
identify() void
identify(void)
{ {
register char ch; register char ch;
const char *str; const char *str;
@ -726,7 +735,8 @@ identify()
* He wants to go down a level * He wants to go down a level
*/ */
d_level() void
d_level(void)
{ {
bool no_phase=FALSE; bool no_phase=FALSE;
@ -770,7 +780,8 @@ d_level()
* He wants to go up a level * He wants to go up a level
*/ */
u_level() void
u_level(void)
{ {
bool no_phase = FALSE; bool no_phase = FALSE;
register struct linked_list *item; register struct linked_list *item;
@ -828,7 +839,8 @@ u_level()
* Let him escape for a while * Let him escape for a while
*/ */
shell() void
shell(void)
{ {
/* /*
* Set the terminal back to original mode * Set the terminal back to original mode
@ -859,8 +871,8 @@ shell()
/* /*
* allow a user to call a potion, scroll, or ring something * allow a user to call a potion, scroll, or ring something
*/ */
call(mark) void
bool mark; call(bool mark)
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *item; register struct linked_list *item;

View file

@ -36,7 +36,7 @@ int fusecnt = 0;
* Find an empty slot in the daemon list * Find an empty slot in the daemon list
*/ */
struct delayed_action * struct delayed_action *
d_slot() d_slot(void)
{ {
reg int i; reg int i;
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -52,7 +52,7 @@ d_slot()
* Find an empty slot in the fuses list * Find an empty slot in the fuses list
*/ */
struct delayed_action * struct delayed_action *
f_slot() f_slot(void)
{ {
reg int i; reg int i;
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -70,8 +70,7 @@ f_slot()
* Find a particular slot in the table * Find a particular slot in the table
*/ */
struct delayed_action * struct delayed_action *
find_slot(func) find_slot(int (*func)())
reg int (*func)();
{ {
reg int i; reg int i;
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -87,6 +86,7 @@ reg int (*func)();
* start_daemon: * start_daemon:
* Start a daemon, takes a function. * Start a daemon, takes a function.
*/ */
void
start_daemon(int (*func)(), void *arg, int type) start_daemon(int (*func)(), void *arg, int type)
{ {
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -106,8 +106,8 @@ start_daemon(int (*func)(), void *arg, int type)
* kill_daemon: * kill_daemon:
* Remove a daemon from the list * Remove a daemon from the list
*/ */
kill_daemon(func) void
reg int (*func)(); kill_daemon(int (*func)())
{ {
reg struct delayed_action *dev; reg struct delayed_action *dev;
reg int i; reg int i;
@ -133,8 +133,8 @@ reg int (*func)();
* Run all the daemons that are active with the current flag, * Run all the daemons that are active with the current flag,
* passing the argument to the function. * passing the argument to the function.
*/ */
do_daemons(flag) void
reg int flag; do_daemons(int flag)
{ {
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -154,6 +154,7 @@ reg int flag;
* fuse: * fuse:
* Start a fuse to go off in a certain number of turns * Start a fuse to go off in a certain number of turns
*/ */
void
fuse(int (*func)(), void *arg, int time, int type) fuse(int (*func)(), void *arg, int time, int type)
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -173,8 +174,8 @@ fuse(int (*func)(), void *arg, int time, int type)
* lengthen: * lengthen:
* Increase the time until a fuse goes off * Increase the time until a fuse goes off
*/ */
lengthen(func, xtime) void
reg int (*func)(), xtime; lengthen(int (*func)(), int xtime)
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -188,8 +189,8 @@ reg int (*func)(), xtime;
* extinguish: * extinguish:
* Put out a fuse * Put out a fuse
*/ */
extinguish(func) void
reg int (*func)(); extinguish(int (*func)())
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -207,8 +208,8 @@ reg int (*func)();
* do_fuses: * do_fuses:
* Decrement counters and start needed fuses * Decrement counters and start needed fuses
*/ */
do_fuses(flag) void
reg int flag; do_fuses(int flag)
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -234,7 +235,8 @@ reg int flag;
* activity: * activity:
* Show wizard number of demaons and memory blocks used * Show wizard number of demaons and memory blocks used
*/ */
activity() void
activity(void)
{ {
sprintf(outstring,"Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", sprintf(outstring,"Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d",
demoncnt,fusecnt,total,md_memused()); demoncnt,fusecnt,total,md_memused());

View file

@ -22,8 +22,8 @@ int between = 0;
* A healing daemon that restors hit points after rest * A healing daemon that restors hit points after rest
*/ */
doctor(tp) void
register struct thing *tp; doctor(struct thing *tp)
{ {
register int ohp; register int ohp;
register int limit, new_points; register int limit, new_points;
@ -100,7 +100,8 @@ register struct thing *tp;
* Called when it is time to start rolling for wandering monsters * Called when it is time to start rolling for wandering monsters
*/ */
swander() void
swander(void)
{ {
start_daemon(rollwand, 0, BEFORE); start_daemon(rollwand, 0, BEFORE);
} }
@ -110,7 +111,8 @@ swander()
* Called to roll to see if a wandering monster starts up * Called to roll to see if a wandering monster starts up
*/ */
rollwand() void
rollwand(void)
{ {
if (++between >= 4) if (++between >= 4)
{ {
@ -128,7 +130,8 @@ rollwand()
/* /*
* this function is a daemon called each turn when the character is a thief * this function is a daemon called each turn when the character is a thief
*/ */
trap_look() void
trap_look(void)
{ {
if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl)) if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl))
search(TRUE, FALSE); search(TRUE, FALSE);
@ -139,7 +142,8 @@ trap_look()
* Release the poor player from his confusion * Release the poor player from his confusion
*/ */
unconfuse() void
unconfuse(void)
{ {
turn_off(player, ISHUH); turn_off(player, ISHUH);
msg("You feel less confused now"); msg("You feel less confused now");
@ -151,7 +155,8 @@ unconfuse()
* He lost his see invisible power * He lost his see invisible power
*/ */
unsee() void
unsee(void)
{ {
if (!ISWEARING(R_SEEINVIS)) { if (!ISWEARING(R_SEEINVIS)) {
turn_off(player, CANSEE); turn_off(player, CANSEE);
@ -164,7 +169,8 @@ unsee()
* Remove to-hit handicap from player * Remove to-hit handicap from player
*/ */
unstink() void
unstink(void)
{ {
turn_off(player, HASSTINK); turn_off(player, HASSTINK);
} }
@ -174,7 +180,8 @@ unstink()
* Player is no longer immune to confusion * Player is no longer immune to confusion
*/ */
unclrhead() void
unclrhead(void)
{ {
turn_off(player, ISCLEAR); turn_off(player, ISCLEAR);
msg("The blue aura about your head fades away."); msg("The blue aura about your head fades away.");
@ -185,7 +192,8 @@ unclrhead()
* Player can no longer walk through walls * Player can no longer walk through walls
*/ */
unphase() void
unphase(void)
{ {
turn_off(player, CANINWALL); turn_off(player, CANINWALL);
msg("Your dizzy feeling leaves you."); msg("Your dizzy feeling leaves you.");
@ -197,7 +205,8 @@ unphase()
* Player can no longer fly * Player can no longer fly
*/ */
land() void
land(void)
{ {
turn_off(player, ISFLY); turn_off(player, ISFLY);
msg("You regain your normal weight"); msg("You regain your normal weight");
@ -209,7 +218,8 @@ land()
* He gets his sight back * He gets his sight back
*/ */
sight() void
sight(void)
{ {
if (on(player, ISBLIND)) if (on(player, ISBLIND))
{ {
@ -225,7 +235,8 @@ sight()
* Restore player's strength * Restore player's strength
*/ */
res_strength() void
res_strength(void)
{ {
/* If lost_str is non-zero, restore that amount of strength, /* If lost_str is non-zero, restore that amount of strength,
@ -249,7 +260,8 @@ res_strength()
* End the hasting * End the hasting
*/ */
nohaste() void
nohaste(void)
{ {
turn_off(player, ISHASTE); turn_off(player, ISHASTE);
msg("You feel yourself slowing down."); msg("You feel yourself slowing down.");
@ -260,7 +272,8 @@ nohaste()
* End the slowing * End the slowing
*/ */
noslow() void
noslow(void)
{ {
turn_off(player, ISSLOW); turn_off(player, ISSLOW);
msg("You feel yourself speeding up."); msg("You feel yourself speeding up.");
@ -271,7 +284,8 @@ noslow()
* If this gets called, the player has suffocated * If this gets called, the player has suffocated
*/ */
suffocate() void
suffocate(void)
{ {
death(D_SUFFOCATION); death(D_SUFFOCATION);
} }
@ -279,7 +293,8 @@ suffocate()
/* /*
* digest the hero's food * digest the hero's food
*/ */
stomach() void
stomach(void)
{ {
register int oldfood, old_hunger, food_use, i; register int oldfood, old_hunger, food_use, i;
@ -335,7 +350,8 @@ stomach()
/* /*
* daemon for curing the diseased * daemon for curing the diseased
*/ */
cure_disease() void
cure_disease(void)
{ {
turn_off(player, HASDISEASE); turn_off(player, HASDISEASE);
if (off (player, HASINFEST)) if (off (player, HASINFEST))
@ -346,7 +362,8 @@ cure_disease()
/* /*
* daemon for adding back dexterity * daemon for adding back dexterity
*/ */
un_itch() void
un_itch(void)
{ {
if (--lost_dext < 1) { if (--lost_dext < 1) {
lost_dext = 0; lost_dext = 0;
@ -358,7 +375,8 @@ un_itch()
* appear: * appear:
* Become visible again * Become visible again
*/ */
appear() void
appear(void)
{ {
turn_off(player, ISINVIS); turn_off(player, ISINVIS);
PLAYER = VPLAYER; PLAYER = VPLAYER;
@ -369,7 +387,8 @@ appear()
* dust_appear: * dust_appear:
* dust of disappearance wears off * dust of disappearance wears off
*/ */
dust_appear() void
dust_appear(void)
{ {
turn_off(player, ISINVIS); turn_off(player, ISINVIS);
PLAYER = VPLAYER; PLAYER = VPLAYER;
@ -380,7 +399,8 @@ dust_appear()
* unchoke: * unchoke:
* the effects of "dust of choking and sneezing" wear off * the effects of "dust of choking and sneezing" wear off
*/ */
unchoke() void
unchoke(void)
{ {
if (!find_slot(unconfuse)) if (!find_slot(unconfuse))
turn_off(player, ISHUH); turn_off(player, ISHUH);
@ -392,8 +412,8 @@ unchoke()
/* /*
* make some potion for the guy in the Alchemy jug * make some potion for the guy in the Alchemy jug
*/ */
alchemy(obj) void
register struct object *obj; alchemy(struct object *obj)
{ {
register struct object *tobj = NULL; register struct object *tobj = NULL;
register struct linked_list *item; register struct linked_list *item;
@ -440,7 +460,8 @@ register struct object *obj;
* otto's irresistable dance wears off * otto's irresistable dance wears off
*/ */
undance() void
undance(void)
{ {
turn_off(player, ISDANCE); turn_off(player, ISDANCE);
msg ("Your feet take a break.....whew!"); msg ("Your feet take a break.....whew!");
@ -449,14 +470,16 @@ undance()
/* /*
* if he has our favorite necklace of strangulation then take damage every turn * if he has our favorite necklace of strangulation then take damage every turn
*/ */
strangle() void
strangle(void)
{ {
if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE); if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE);
} }
/* /*
* if he has on the gauntlets of fumbling he might drop his weapon each turn * if he has on the gauntlets of fumbling he might drop his weapon each turn
*/ */
fumble() void
fumble(void)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -474,14 +497,16 @@ fumble()
/* /*
* this is called each turn the hero has the ring of searching on * this is called each turn the hero has the ring of searching on
*/ */
ring_search() void
ring_search(void)
{ {
search(FALSE, FALSE); search(FALSE, FALSE);
} }
/* /*
* this is called each turn the hero has the ring of teleportation on * this is called each turn the hero has the ring of teleportation on
*/ */
ring_teleport() void
ring_teleport(void)
{ {
if (rnd(100) < 2) teleport(); if (rnd(100) < 2) teleport();
} }

View file

@ -15,12 +15,14 @@
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
int packweight(void);
/* /*
* updpack: * updpack:
* Update his pack weight and adjust fooduse accordingly * Update his pack weight and adjust fooduse accordingly
*/ */
updpack(getmax) void
int getmax; updpack(bool getmax)
{ {
reg int topcarry, curcarry; reg int topcarry, curcarry;
@ -45,7 +47,8 @@ int getmax;
* packweight: * packweight:
* Get the total weight of the hero's pack * Get the total weight of the hero's pack
*/ */
packweight() int
packweight(void)
{ {
reg struct object *obj; reg struct object *obj;
reg struct linked_list *pc; reg struct linked_list *pc;
@ -68,8 +71,8 @@ packweight()
* itemweight: * itemweight:
* Get the weight of an object * Get the weight of an object
*/ */
itemweight(wh) int
reg struct object *wh; itemweight(struct object *wh)
{ {
reg int weight; reg int weight;
reg int ac; reg int ac;
@ -99,7 +102,8 @@ reg struct object *wh;
* playenc: * playenc:
* Get hero's carrying ability above norm * Get hero's carrying ability above norm
*/ */
playenc() int
playenc(void)
{ {
return ((str_compute()-8)*50); return ((str_compute()-8)*50);
} }
@ -109,7 +113,8 @@ playenc()
* totalenc: * totalenc:
* Get total weight that the hero can carry * Get total weight that the hero can carry
*/ */
totalenc() int
totalenc(void)
{ {
reg int wtotal; reg int wtotal;
@ -130,18 +135,18 @@ totalenc()
* See if the hero can carry his pack * See if the hero can carry his pack
*/ */
wghtchk() void
wghtchk(void)
{ {
reg int dropchk, err = TRUE; reg int dropchk, err = TRUE;
reg char ch; reg char ch;
int wghtchk();
inwhgt = TRUE; inwhgt = TRUE;
if (pstats.s_pack > pstats.s_carry) { if (pstats.s_pack > pstats.s_carry) {
ch = CCHAR( mvwinch(stdscr, hero.y, hero.x) ); ch = CCHAR( mvwinch(stdscr, hero.y, hero.x) );
if((ch != FLOOR && ch != PASSAGE)) { if((ch != FLOOR && ch != PASSAGE)) {
extinguish(wghtchk); extinguish(wghtchk);
fuse(wghtchk,TRUE,1,AFTER); fuse(wghtchk,NULL,1,AFTER);
inwhgt = FALSE; inwhgt = FALSE;
return; return;
} }
@ -169,7 +174,8 @@ wghtchk()
* -1 hit for heavy pack weight * -1 hit for heavy pack weight
*/ */
hitweight() int
hitweight(void)
{ {
return(2 - foodlev); return(2 - foodlev);
} }

View file

@ -13,10 +13,27 @@
*/ */
#include "curses.h" #include "curses.h"
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
bool roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
bool hurl, struct object *cur_weapon, bool back_stab);
void hit(struct object *weapon, struct thing *tp, char *er, char *ee,
bool back_stab);
void miss(struct object *weapon, struct thing *tp, char *er, char *ee);
int dext_plus(int dexterity);
int str_plus(short str);
int add_dam(short str);
int hung_dam(void);
void thunk(struct object *weap, struct thing *tp, char *mname);
void m_thunk(struct object *weap, struct thing *tp, char *mname);
void bounce(struct object *weap, struct thing *tp, char *mname);
void m_bounce(struct object *weap, struct thing *tp, char *mname);
struct object *wield_weap(struct object *thrown, struct thing *mp);
void explode(struct thing *tp);
#define CONF_DAMAGE -1 #define CONF_DAMAGE -1
#define PARAL_DAMAGE -2 #define PARAL_DAMAGE -2
#define DEST_DAMAGE -3 #define DEST_DAMAGE -3
@ -35,10 +52,8 @@ static const struct matrix att_mat[5] = {
* The player attacks the monster. * The player attacks the monster.
*/ */
fight(mp, weap, thrown) bool
register coord *mp; fight(coord *mp, struct object *weap, bool thrown)
struct object *weap;
bool thrown;
{ {
register struct thing *tp; register struct thing *tp;
register struct linked_list *item; register struct linked_list *item;
@ -204,10 +219,8 @@ bool thrown;
* The monster attacks the player * The monster attacks the player
*/ */
attack(mp, weapon, thrown) bool
register struct thing *mp; attack(struct thing *mp, struct object *weapon, bool thrown)
register struct object *weapon;
bool thrown;
{ {
register const char *mname; register const char *mname;
register bool did_hit = FALSE; register bool did_hit = FALSE;
@ -708,9 +721,8 @@ bool thrown;
* returns true if the swing hits * returns true if the swing hits
*/ */
swing(class, at_lvl, op_arm, wplus) bool
short class; swing(short class, int at_lvl, int op_arm, int wplus)
int at_lvl, op_arm, wplus;
{ {
register int res = rnd(20)+1; register int res = rnd(20)+1;
register int need; register int need;
@ -730,12 +742,9 @@ int at_lvl, op_arm, wplus;
* Roll several attacks * Roll several attacks
*/ */
roll_em(att_er, def_er, weap, hurl, cur_weapon, back_stab) bool
struct thing *att_er, *def_er; roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
struct object *weap; bool hurl, struct object *cur_weapon, bool back_stab)
bool hurl;
struct object *cur_weapon;
bool back_stab;
{ {
register struct stats *att, *def; register struct stats *att, *def;
register char *cp = NULL; register char *cp = NULL;
@ -1028,9 +1037,7 @@ bool back_stab;
*/ */
char * char *
prname(who, upper) prname(char *who, bool upper)
register char *who;
bool upper;
{ {
static char tbuf[LINELEN]; static char tbuf[LINELEN];
@ -1054,11 +1061,8 @@ bool upper;
* Print a message to indicate a succesful hit * Print a message to indicate a succesful hit
*/ */
hit(weapon, tp, er, ee, back_stab) void
register struct object *weapon; hit(struct object *weapon, struct thing *tp, char *er, char *ee, bool back_stab)
register struct thing *tp;
register char *er, *ee;
bool back_stab;
{ {
register char *s = NULL; register char *s = NULL;
char char
@ -1114,10 +1118,8 @@ bool back_stab;
* Print a message to indicate a poor swing * Print a message to indicate a poor swing
*/ */
miss(weapon, tp, er, ee) void
register struct object *weapon; miss(struct object *weapon, struct thing *tp, char *er, char *ee)
register struct thing *tp;
register char *er, *ee;
{ {
register char *s = NULL; register char *s = NULL;
char char
@ -1161,8 +1163,8 @@ register char *er, *ee;
* compute to-hit bonus for dexterity * compute to-hit bonus for dexterity
*/ */
dext_plus(dexterity) int
register int dexterity; dext_plus(int dexterity)
{ {
return (dexterity > 10 ? (dexterity-13)/3 : (dexterity-10)/3); return (dexterity > 10 ? (dexterity-13)/3 : (dexterity-10)/3);
} }
@ -1173,8 +1175,8 @@ register int dexterity;
* compute armor class bonus for dexterity * compute armor class bonus for dexterity
*/ */
dext_prot(dexterity) int
register int dexterity; dext_prot(int dexterity)
{ {
return ((dexterity-10)/2); return ((dexterity-10)/2);
} }
@ -1183,8 +1185,8 @@ register int dexterity;
* compute bonus/penalties for strength on the "to hit" roll * compute bonus/penalties for strength on the "to hit" roll
*/ */
str_plus(str) int
register short str; str_plus(short str)
{ {
return((str-10)/3); return((str-10)/3);
} }
@ -1194,8 +1196,8 @@ register short str;
* compute additional damage done for exceptionally high or low strength * compute additional damage done for exceptionally high or low strength
*/ */
add_dam(str) int
register short str; add_dam(short str)
{ {
return((str-9)/2); return((str-9)/2);
} }
@ -1204,7 +1206,8 @@ register short str;
* hung_dam: * hung_dam:
* Calculate damage depending on players hungry state * Calculate damage depending on players hungry state
*/ */
hung_dam() int
hung_dam(void)
{ {
reg int howmuch = 0; reg int howmuch = 0;
@ -1222,11 +1225,10 @@ hung_dam()
* A missile hits a monster * A missile hits a monster
*/ */
thunk(weap, tp, mname) void
register struct object *weap; thunk(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp; /* Defender */
register char *mname;
{ {
/* tp: Defender */
char *def_name; /* Name of defender */ char *def_name; /* Name of defender */
/* What do we call the defender? */ /* What do we call the defender? */
@ -1251,10 +1253,8 @@ register char *mname;
* A missile from a monster hits the player * A missile from a monster hits the player
*/ */
m_thunk(weap, tp, mname) void
register struct object *weap; m_thunk(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp;
register char *mname;
{ {
char *att_name; /* Name of attacker */ char *att_name; /* Name of attacker */
@ -1280,11 +1280,10 @@ register char *mname;
* A missile misses a monster * A missile misses a monster
*/ */
bounce(weap, tp, mname) void
register struct object *weap; bounce(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp; /* Defender */
register char *mname;
{ {
/* tp: Defender */
char *def_name; /* Name of defender */ char *def_name; /* Name of defender */
/* What do we call the defender? */ /* What do we call the defender? */
@ -1309,10 +1308,8 @@ register char *mname;
A missle from a monster misses the player A missle from a monster misses the player
*/ */
m_bounce(weap, tp, mname) void
register struct object *weap; m_bounce(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp;
register char *mname;
{ {
char *att_name; /* Name of attacker */ char *att_name; /* Name of attacker */
@ -1339,8 +1336,8 @@ register char *mname;
* Returns true if an object radiates magic * Returns true if an object radiates magic
*/ */
is_magic(obj) bool
register struct object *obj; is_magic(struct object *obj)
{ {
switch (obj->o_type) switch (obj->o_type)
{ {
@ -1364,9 +1361,8 @@ register struct object *obj;
* Called to put a monster to death * Called to put a monster to death
*/ */
killed(item, pr, points) void
register struct linked_list *item; killed(struct linked_list *item, bool pr, bool points)
bool pr, points;
{ {
register struct thing *tp; register struct thing *tp;
register struct linked_list *pitem, *nexti; register struct linked_list *pitem, *nexti;
@ -1447,9 +1443,7 @@ bool pr, points;
*/ */
struct object * struct object *
wield_weap(thrown, mp) wield_weap(struct object *thrown, struct thing *mp)
struct object *thrown;
struct thing *mp;
{ {
int look_for = 0, /* The projectile weapon we are looking for */ int look_for = 0, /* The projectile weapon we are looking for */
new_rate, /* The rating of a prospective weapon */ new_rate, /* The rating of a prospective weapon */
@ -1529,8 +1523,8 @@ struct thing *mp;
return(candidate); return(candidate);
} }
explode(tp) void
register struct thing *tp; explode(struct thing *tp)
{ {
register int x,y, damage; register int x,y, damage;

View file

@ -97,10 +97,8 @@ char *metal[NMETAL] = {
* make sure all the percentages specified in the tables add up to the * make sure all the percentages specified in the tables add up to the
* right amounts * right amounts
*/ */
badcheck(name, magic, bound) void
char *name; badcheck(char *name, struct magic_item *magic, int bound)
register struct magic_item *magic;
register int bound;
{ {
register struct magic_item *end; register struct magic_item *end;
@ -120,7 +118,8 @@ register int bound;
* Initialize the potion color scheme for this time * Initialize the potion color scheme for this time
*/ */
init_colors() void
init_colors(void)
{ {
register int i, j; register int i, j;
bool used[NCOLORS]; bool used[NCOLORS];
@ -148,7 +147,8 @@ init_colors()
* Initialize the construction materials for wands and staffs * Initialize the construction materials for wands and staffs
*/ */
init_materials() void
init_materials(void)
{ {
register int i, j; register int i, j;
register char *str; register char *str;
@ -201,7 +201,8 @@ init_materials()
* do any initialization for miscellaneous magic * do any initialization for miscellaneous magic
*/ */
init_misc() void
init_misc(void)
{ {
register int i; register int i;
@ -221,7 +222,8 @@ init_misc()
* Generate the names of the various scrolls * Generate the names of the various scrolls
*/ */
init_names() void
init_names(void)
{ {
register int nsyl; register int nsyl;
register char *cp, *sp; register char *cp, *sp;
@ -258,7 +260,8 @@ init_names()
* roll up the rogue * roll up the rogue
*/ */
init_player() void
init_player(void)
{ {
int stat_total, ch = 0, wpt = 0, i, j; int stat_total, ch = 0, wpt = 0, i, j;
struct linked_list *weap_item, *armor_item, *food_item; struct linked_list *weap_item, *armor_item, *food_item;
@ -459,7 +462,8 @@ init_player()
* Initialize the ring stone setting scheme for this time * Initialize the ring stone setting scheme for this time
*/ */
init_stones() void
init_stones(void)
{ {
register int i, j; register int i, j;
bool used[NSTONES]; bool used[NSTONES];
@ -487,7 +491,8 @@ init_stones()
* init_things * init_things
* Initialize the probabilities for types of things * Initialize the probabilities for types of things
*/ */
init_things() void
init_things(void)
{ {
register struct magic_item *mp; register struct magic_item *mp;

View file

@ -18,6 +18,9 @@
#include <stdarg.h> #include <stdarg.h>
#include "rogue.h" #include "rogue.h"
void doadd(char *fmt, va_list ap);
void ministat(void);
/* /*
* msg: * msg:
* Display a message at the top of the screen. * Display a message at the top of the screen.
@ -27,6 +30,7 @@ static char msgbuf[BUFSIZ];
static int newpos = 0; static int newpos = 0;
/*VARARGS1*/ /*VARARGS1*/
void
msg(char *fmt, ...) msg(char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -54,6 +58,7 @@ msg(char *fmt, ...)
/* /*
* add things to the current message * add things to the current message
*/ */
void
addmsg(char *fmt, ...) addmsg(char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -66,7 +71,8 @@ addmsg(char *fmt, ...)
* Display a new msg (giving him a chance to see the previous one if it * Display a new msg (giving him a chance to see the previous one if it
* is up there with the --More--) * is up there with the --More--)
*/ */
endmsg() void
endmsg(void)
{ {
strncpy(huh, msgbuf, sizeof(huh)); strncpy(huh, msgbuf, sizeof(huh));
@ -96,6 +102,7 @@ endmsg()
draw(msgw); draw(msgw);
} }
void
doadd(char *fmt, va_list ap) doadd(char *fmt, va_list ap)
{ {
/* /*
@ -113,9 +120,8 @@ doadd(char *fmt, va_list ap)
* flgptr will be NULL if we don't know what the monster is yet! * flgptr will be NULL if we don't know what the monster is yet!
*/ */
step_ok(y, x, can_on_monst, flgptr) bool
register int y, x, can_on_monst; step_ok(int y, int x, int can_on_monst, struct thing *flgptr)
register struct thing *flgptr;
{ {
/* can_on_monst = MONSTOK if all we care about are physical obstacles */ /* can_on_monst = MONSTOK if all we care about are physical obstacles */
register struct linked_list *item; register struct linked_list *item;
@ -156,7 +162,8 @@ register struct thing *flgptr;
* returns true if it is ok for type to shoot over ch * returns true if it is ok for type to shoot over ch
*/ */
shoot_ok(ch) bool
shoot_ok(char ch)
{ {
switch (ch) switch (ch)
{ {
@ -177,7 +184,8 @@ shoot_ok(ch)
* getchar. * getchar.
*/ */
readchar() int
readchar(void)
{ {
int ch; int ch;
@ -195,10 +203,11 @@ readchar()
/* /*
* status: * status:
* Display the important stats line. Keep the cursor where it was. * Display the important stats line. Keep the cursor where it was.
* If display is TRUE, display unconditionally
*/ */
status(display) void
bool display; /* is TRUE, display unconditionally */ status(bool display)
{ {
register struct stats *stat_ptr, *max_ptr; register struct stats *stat_ptr, *max_ptr;
register int oy = 0, ox = 0, temp; register int oy = 0, ox = 0, temp;
@ -327,7 +336,8 @@ line_two:
wmove(cw, oy, ox); wmove(cw, oy, ox);
} }
ministat() void
ministat(void)
{ {
register int oy, ox, temp; register int oy, ox, temp;
static char buf[LINELEN]; static char buf[LINELEN];
@ -367,9 +377,8 @@ ministat()
* Sit around until the guy types the right key * Sit around until the guy types the right key
*/ */
wait_for(win,ch) void
WINDOW *win; wait_for(WINDOW *win, char ch)
register char ch;
{ {
register char c; register char c;
@ -386,9 +395,8 @@ register char ch;
* function used to display a window and wait before returning * function used to display a window and wait before returning
*/ */
show_win(scr, message) void
register WINDOW *scr; show_win(WINDOW *scr, char *message)
char *message;
{ {
mvwaddstr(scr, 0, 0, message); mvwaddstr(scr, 0, 0, message);
touchwin(scr); touchwin(scr);
@ -403,9 +411,8 @@ char *message;
* dbotline: * dbotline:
* Displays message on bottom line and waits for a space to return * Displays message on bottom line and waits for a space to return
*/ */
dbotline(scr,message) void
WINDOW *scr; dbotline(WINDOW *scr, char *message)
char *message;
{ {
mvwaddstr(scr,LINES-1,0,message); mvwaddstr(scr,LINES-1,0,message);
draw(scr); draw(scr);
@ -417,8 +424,8 @@ char *message;
* restscr: * restscr:
* Restores the screen to the terminal * Restores the screen to the terminal
*/ */
restscr(scr) void
WINDOW *scr; restscr(WINDOW *scr)
{ {
clearok(scr,TRUE); clearok(scr,TRUE);
touchwin(scr); touchwin(scr);
@ -431,10 +438,7 @@ WINDOW *scr;
*/ */
unsigned long unsigned long
netread(error, size, stream) netread(int *error, int size, FILE *stream)
int *error;
int size;
FILE *stream;
{ {
unsigned long result = 0L, /* What we read in */ unsigned long result = 0L, /* What we read in */
partial; /* Partial value */ partial; /* Partial value */
@ -469,12 +473,13 @@ FILE *stream;
/* /*
* netwrite: * netwrite:
* Write out a byte, short, or long machine independently. * Write out a byte, short, or long machine independently.
* value: What to write
* size: How much to write out
* stream: Where to write it
*/ */
netwrite(value, size, stream) int
unsigned long value; /* What to write */ netwrite(unsigned long value, int size, FILE *stream)
int size; /* How much to write out */
FILE *stream; /* Where to write it */
{ {
int i; /* Goes through value one byte at a time */ int i; /* Goes through value one byte at a time */
char outc; /* The next character to be written */ char outc; /* The next character to be written */

View file

@ -21,8 +21,8 @@
* Takes an item out of whatever linked list it might be in * Takes an item out of whatever linked list it might be in
*/ */
_detach(list, item) void
register struct linked_list **list, *item; _detach(struct linked_list **list, struct linked_list *item)
{ {
if (*list == item) if (*list == item)
*list = next(item); *list = next(item);
@ -37,8 +37,8 @@ register struct linked_list **list, *item;
* add an item to the head of a list * add an item to the head of a list
*/ */
_attach(list, item) void
register struct linked_list **list, *item; _attach(struct linked_list **list, struct linked_list *item)
{ {
if (*list != NULL) if (*list != NULL)
{ {
@ -60,8 +60,8 @@ register struct linked_list **list, *item;
* Throw the whole object list away * Throw the whole object list away
*/ */
_o_free_list(ptr) void
register struct linked_list **ptr; _o_free_list(struct linked_list **ptr)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -78,8 +78,8 @@ register struct linked_list **ptr;
* free up an item and its object(and maybe contents) * free up an item and its object(and maybe contents)
*/ */
o_discard(item) void
register struct linked_list *item; o_discard(struct linked_list *item)
{ {
register struct object *obj; register struct object *obj;
obj = OBJPTR(item); obj = OBJPTR(item);
@ -95,8 +95,8 @@ register struct linked_list *item;
* Throw the whole thing list away * Throw the whole thing list away
*/ */
_t_free_list(ptr) void
register struct linked_list **ptr; _t_free_list(struct linked_list **ptr)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -113,8 +113,8 @@ register struct linked_list **ptr;
* free up an item and its thing * free up an item and its thing
*/ */
t_discard(item) void
struct linked_list *item; t_discard(struct linked_list *item)
{ {
total -= 2; total -= 2;
FREE(item->l_data); FREE(item->l_data);
@ -126,8 +126,8 @@ struct linked_list *item;
* get rid of an item structure -- don't worry about contents * get rid of an item structure -- don't worry about contents
*/ */
destroy_item(item) void
register struct linked_list *item; destroy_item(struct linked_list *item)
{ {
total--; total--;
FREE(item); FREE(item);
@ -139,8 +139,7 @@ register struct linked_list *item;
*/ */
struct linked_list * struct linked_list *
new_item(size) new_item(int size)
int size;
{ {
register struct linked_list *item; register struct linked_list *item;
@ -158,7 +157,7 @@ int size;
*/ */
struct linked_list * struct linked_list *
creat_item() creat_item(void)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -169,8 +168,7 @@ creat_item()
} }
char * char *
new(size) new(int size)
int size;
{ {
register char *space = ALLOC(size); register char *space = ALLOC(size);
static char errbuf[LINELEN]; static char errbuf[LINELEN];

View file

@ -43,10 +43,10 @@ static char *funfruit[] = {
#define NFRUIT (sizeof(funfruit) / sizeof (char *)) #define NFRUIT (sizeof(funfruit) / sizeof (char *))
void open_records(void); void open_records(void);
bool holiday(void);
main(argc, argv, envp) int
char **argv; main(int argc, char *argv[], char *envp[])
char **envp;
{ {
register char *env; register char *env;
int lowtime; int lowtime;
@ -123,7 +123,6 @@ char **envp;
* Check for a network update * Check for a network update
*/ */
if (argc == 2 && strcmp(argv[1], "-u") == 0) { if (argc == 2 && strcmp(argv[1], "-u") == 0) {
unsigned long netread();
int errcheck, errors = 0; int errcheck, errors = 0;
unsigned long amount; unsigned long amount;
short monster; short monster;
@ -277,8 +276,8 @@ endit(int sig)
* Exit the program, printing a message. * Exit the program, printing a message.
*/ */
fatal(s) void
char *s; fatal(char *s)
{ {
clear(); clear();
move(LINES-2, 0); move(LINES-2, 0);
@ -294,8 +293,8 @@ char *s;
* Pick a very random number. * Pick a very random number.
*/ */
rnd(range) int
register int range; rnd(int range)
{ {
return(range == 0 ? 0 : md_rand() % range); return(range == 0 ? 0 : md_rand() % range);
} }
@ -305,8 +304,8 @@ register int range;
* roll a number of dice * roll a number of dice
*/ */
roll(number, sides) int
register int number, sides; roll(int number, int sides)
{ {
register int dtotal = 0; register int dtotal = 0;
@ -336,10 +335,11 @@ tstp(int a)
} }
# endif # endif
setup() void
setup(void)
{ {
#ifdef CHECKTIME #ifdef CHECKTIME
int checkout(); void checkout();
#endif #endif
#ifndef DUMP #ifndef DUMP
@ -392,7 +392,8 @@ setup()
* refreshing things and looking at the proper times. * refreshing things and looking at the proper times.
*/ */
playit() void
playit(void)
{ {
register char *opts; register char *opts;
@ -416,7 +417,8 @@ playit()
/* /*
* see if the system is being used too much for this game * see if the system is being used too much for this game
*/ */
too_much() bool
too_much(void)
{ {
#ifdef MAXLOAD #ifdef MAXLOAD
double avec[3]; double avec[3];
@ -435,7 +437,8 @@ too_much()
* author: * author:
* See if a user is an author of the program * See if a user is an author of the program
*/ */
author() bool
author(void)
{ {
switch (md_getuid()) { switch (md_getuid()) {
#if AUTHOR #if AUTHOR
@ -450,7 +453,24 @@ author()
#ifdef CHECKTIME #ifdef CHECKTIME
checkout() /*
* checkout()'s version of msg. If we are in the middle of a shell, do a
* printf instead of a msg to avoid the refresh.
*/
void
chmsg(char *fmt, int arg)
{
if (in_shell) {
printf(fmt, arg);
putchar('\n');
fflush(stdout);
}
else
msg(fmt, arg);
}
void
checkout(void)
{ {
static char *msgs[] = { static char *msgs[] = {
"The system is too loaded for games. Please leave in %d minutes", "The system is too loaded for games. Please leave in %d minutes",
@ -482,23 +502,6 @@ checkout()
alarm(CHECKTIME * 60); alarm(CHECKTIME * 60);
} }
} }
/*
* checkout()'s version of msg. If we are in the middle of a shell, do a
* printf instead of a msg to avoid the refresh.
*/
chmsg(fmt, arg)
char *fmt;
int arg;
{
if (in_shell) {
printf(fmt, arg);
putchar('\n');
fflush(stdout);
}
else
msg(fmt, arg);
}
#endif #endif
#ifdef LOADAV #ifdef LOADAV
@ -510,8 +513,8 @@ struct nlist avenrun =
"_avenrun" "_avenrun"
}; };
loadav(avg) void
reg double *avg; loadav(double *avg)
{ {
reg int kmem; reg int kmem;
@ -536,7 +539,8 @@ bad:
#include <sys/types.h> #include <sys/types.h>
#include <utmp.h> #include <utmp.h>
struct utmp buf; struct utmp buf;
ucount() int
ucount(void)
{ {
reg struct utmp *up; reg struct utmp *up;
reg FILE *utmp; reg FILE *utmp;
@ -559,7 +563,8 @@ ucount()
* holiday: * holiday:
* Returns TRUE when it is a good time to play rogue * Returns TRUE when it is a good time to play rogue
*/ */
holiday() bool
holiday(void)
{ {
time_t now; time_t now;
struct tm *localtime(); struct tm *localtime();

View file

@ -30,15 +30,20 @@ static char *frontier,
*bits; *bits;
static int maze_lines, static int maze_lines,
maze_cols; maze_cols;
char *moffset(),
*foffset(); void draw_maze(void);
int findcells(int y, int x);
char *foffset(int y, int x);
char *moffset(int y, int x);
void rmwall(int newy, int newx, int oldy, int oldx);
/* /*
* crankout: * crankout:
* Does actual drawing of maze to window * Does actual drawing of maze to window
*/ */
crankout() void
crankout(void)
{ {
reg int x, y; reg int x, y;
@ -71,7 +76,8 @@ crankout()
* domaze: * domaze:
* Draw the maze on this level. * Draw the maze on this level.
*/ */
do_maze() void
do_maze(void)
{ {
reg int least; reg int least;
reg struct room *rp; reg struct room *rp;
@ -95,7 +101,7 @@ do_maze()
/* /*
* add some gold to make it worth looking for * add some gold to make it worth looking for
*/ */
item = spec_item(GOLD, NULL, NULL, NULL); item = spec_item(GOLD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_count *= (rnd(10) + 1); /* add in one large hunk */ obj->o_count *= (rnd(10) + 1); /* add in one large hunk */
attach(lvl_obj, item); attach(lvl_obj, item);
@ -108,7 +114,7 @@ do_maze()
/* /*
* add in some food to make sure he has enough * add in some food to make sure he has enough
*/ */
item = spec_item(FOOD, NULL, NULL, NULL); item = spec_item(FOOD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
attach(lvl_obj, item); attach(lvl_obj, item);
do { do {
@ -133,7 +139,8 @@ do_maze()
* draw_maze: * draw_maze:
* Generate and draw the maze on the screen * Generate and draw the maze on the screen
*/ */
draw_maze() void
draw_maze(void)
{ {
reg int i, j, more; reg int i, j, more;
reg char *ptr; reg char *ptr;
@ -169,8 +176,8 @@ draw_maze()
* findcells: * findcells:
* Figure out cells to open up * Figure out cells to open up
*/ */
findcells(y,x) int
reg int x, y; findcells(int y, int x)
{ {
reg int rtpos, i; reg int rtpos, i;
@ -221,8 +228,7 @@ reg int x, y;
* Calculate memory address for frontier * Calculate memory address for frontier
*/ */
char * char *
foffset(y, x) foffset(int y, int x)
int y, x;
{ {
return (frontier + (y * maze_cols) + x); return (frontier + (y * maze_cols) + x);
@ -236,8 +242,7 @@ int y, x;
*/ */
bool bool
maze_view(y, x) maze_view(int y, int x)
int y, x;
{ {
register int start, goal, delta, ycheck = 0, xcheck = 0, absy, absx, see_radius; register int start, goal, delta, ycheck = 0, xcheck = 0, absy, absx, see_radius;
register bool row; register bool row;
@ -342,8 +347,7 @@ int y, x;
* Calculate memory address for bits * Calculate memory address for bits
*/ */
char * char *
moffset(y, x) moffset(int y, int x)
int y, x;
{ {
return (bits + (y * (COLS - 1)) + x); return (bits + (y * (COLS - 1)) + x);
@ -356,8 +360,8 @@ int y, x;
* rmwall: * rmwall:
* Removes appropriate walls from the maze * Removes appropriate walls from the maze
*/ */
rmwall(newy, newx, oldy, oldx) void
int newy, newx, oldy, oldx; rmwall(int newy, int newx, int oldy, int oldx)
{ {
reg int xdif,ydif; reg int xdif,ydif;

View file

@ -55,6 +55,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#if defined(_WIN32) && !defined(__MINGW32__) #if defined(_WIN32) && !defined(__MINGW32__)
#define PATH_MAX MAX_PATH #define PATH_MAX MAX_PATH
@ -81,7 +82,7 @@
#define MOD_MOVE(c) (toupper(c) ) #define MOD_MOVE(c) (toupper(c) )
void void
md_init() md_init(void)
{ {
#ifdef __INTERIX #ifdef __INTERIX
char *term; char *term;
@ -132,7 +133,7 @@ md_putchar(int c)
static int md_standout_mode = 0; static int md_standout_mode = 0;
int int
md_raw_standout() md_raw_standout(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
@ -155,7 +156,7 @@ md_raw_standout()
} }
int int
md_raw_standend() md_raw_standend(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
@ -223,7 +224,7 @@ md_fdopen(int fd, char *mode)
} }
int int
md_normaluser() md_normaluser(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
setuid(getuid()); setuid(getuid());
@ -232,7 +233,7 @@ md_normaluser()
} }
int int
md_getuid() md_getuid(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
return( getuid() ); return( getuid() );
@ -242,7 +243,7 @@ md_getuid()
} }
char * char *
md_getusername() md_getusername(void)
{ {
static char login[80]; static char login[80];
char *l = NULL; char *l = NULL;
@ -279,7 +280,7 @@ md_getusername()
} }
char * char *
md_gethomedir() md_gethomedir(void)
{ {
static char homedir[PATH_MAX]; static char homedir[PATH_MAX];
char *h = NULL; char *h = NULL;
@ -335,7 +336,7 @@ md_gethomedir()
} }
char * char *
md_getshell() md_getshell(void)
{ {
static char shell[PATH_MAX]; static char shell[PATH_MAX];
char *s = NULL; char *s = NULL;
@ -365,7 +366,7 @@ md_getshell()
} }
int int
md_shellescape() md_shellescape(void)
{ {
#if (!defined(_WIN32) && !defined(__DJGPP__)) #if (!defined(_WIN32) && !defined(__DJGPP__))
int ret_status; int ret_status;
@ -427,7 +428,7 @@ directory_exists(char *dirname)
} }
char * char *
md_getroguedir() md_getroguedir(void)
{ {
static char path[1024]; static char path[1024];
char *end,*home; char *end,*home;
@ -491,8 +492,7 @@ md_crypt(char *key, char *salt)
} }
char * char *
md_getpass(prompt) md_getpass(char *prompt)
char *prompt;
{ {
#ifdef _WIN32 #ifdef _WIN32
static char password_buffer[9]; static char password_buffer[9];
@ -587,7 +587,7 @@ md_htonl(unsigned long int x)
} }
int int
md_rand() md_rand(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
return(rand()); return(rand());
@ -597,8 +597,7 @@ md_rand()
} }
int int
md_srand(seed) md_srand(int seed)
register int seed;
{ {
#ifdef _WIN32 #ifdef _WIN32
srand(seed); srand(seed);
@ -608,7 +607,7 @@ register int seed;
} }
long long
md_memused() md_memused(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
MEMORYSTATUS stat; MEMORYSTATUS stat;
@ -622,7 +621,7 @@ md_memused()
} }
char * char *
md_gethostname() md_gethostname(void)
{ {
static char nodename[80]; static char nodename[80];
char *n = NULL; char *n = NULL;
@ -644,7 +643,7 @@ md_gethostname()
} }
int int
md_erasechar() md_erasechar(void)
{ {
#ifdef BSD #ifdef BSD
return(_tty.sg_erase); /* process erase character */ return(_tty.sg_erase); /* process erase character */
@ -656,7 +655,7 @@ md_erasechar()
} }
int int
md_killchar() md_killchar(void)
{ {
#ifdef BSD #ifdef BSD
return(_tty.sg_kill); return(_tty.sg_kill);
@ -673,8 +672,7 @@ md_killchar()
*/ */
char * char *
md_unctrl(ch) md_unctrl(char ch)
char ch;
{ {
#if USG5_0 #if USG5_0
extern char *_unctrl[]; /* Defined in curses library */ extern char *_unctrl[]; /* Defined in curses library */
@ -686,7 +684,7 @@ char ch;
} }
void void
md_flushinp() md_flushinp(void)
{ {
#ifdef BSD #ifdef BSD
ioctl(0, TIOCFLUSH); ioctl(0, TIOCFLUSH);

View file

@ -18,9 +18,7 @@
* See if a monster has some magic it can use. Use it and return TRUE if so. * See if a monster has some magic it can use. Use it and return TRUE if so.
*/ */
bool bool
m_use_item(monster, monst_pos, defend_pos) m_use_item(struct thing *monster, coord *monst_pos, coord *defend_pos)
register struct thing *monster;
register coord *monst_pos, *defend_pos;
{ {
register struct linked_list *pitem; register struct linked_list *pitem;
register struct object *obj; register struct object *obj;
@ -95,10 +93,11 @@ register coord *monst_pos, *defend_pos;
/* /*
* add something to the contents of something else * add something to the contents of something else
* bag: the holder of the items
* item: the item to put inside
*/ */
put_contents(bag, item) void
register struct object *bag; /* the holder of the items */ put_contents(struct object *bag, struct linked_list *item)
register struct linked_list *item; /* the item to put inside */
{ {
register struct linked_list *titem; register struct linked_list *titem;
register struct object *tobj; register struct object *tobj;
@ -123,10 +122,10 @@ register struct linked_list *item; /* the item to put inside */
/* /*
* remove something from something else * remove something from something else
* bag: the holder of the items
*/ */
take_contents(bag, item) void
register struct object *bag; /* the holder of the items */ take_contents(struct object *bag, struct linked_list *item)
register struct linked_list *item;
{ {
if (bag->o_ac <= 0) { if (bag->o_ac <= 0) {
@ -140,8 +139,8 @@ register struct linked_list *item;
} }
do_bag(item) void
register struct linked_list *item; do_bag(struct linked_list *item)
{ {
register struct linked_list *titem = NULL; register struct linked_list *titem = NULL;
@ -233,7 +232,8 @@ register struct linked_list *item;
} }
} }
do_panic() void
do_panic(void)
{ {
register int x,y; register int x,y;
register struct linked_list *mon; register struct linked_list *mon;
@ -272,8 +272,7 @@ do_panic()
* print miscellaneous magic bonuses * print miscellaneous magic bonuses
*/ */
char * char *
misc_name(obj) misc_name(struct object *obj)
register struct object *obj;
{ {
static char buf[LINELEN]; static char buf[LINELEN];
char buf1[LINELEN]; char buf1[LINELEN];
@ -340,7 +339,8 @@ register struct object *obj;
return buf; return buf;
} }
use_emori() void
use_emori(void)
{ {
char selection; /* Cloak function */ char selection; /* Cloak function */
int state = 0; /* Menu state */ int state = 0; /* Menu state */
@ -442,8 +442,8 @@ use_emori()
} }
} }
use_mm(which) void
int which; use_mm(int which)
{ {
register struct object *obj = NULL; register struct object *obj = NULL;
register struct linked_list *item = NULL; register struct linked_list *item = NULL;
@ -496,7 +496,7 @@ int which;
msg("The jug is empty"); msg("The jug is empty");
break; break;
} }
quaff (obj->o_ac, NULL, FALSE); quaff (obj->o_ac, 0, FALSE);
obj->o_ac = JUG_EMPTY; obj->o_ac = JUG_EMPTY;
fuse (alchemy, obj, ALCHEMYTIME, AFTER); fuse (alchemy, obj, ALCHEMYTIME, AFTER);
if (!(obj->o_flags & ISKNOW)) if (!(obj->o_flags & ISKNOW))

View file

@ -14,6 +14,7 @@
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -21,8 +22,8 @@
/* /*
* Check_residue takes care of any effect of the monster * Check_residue takes care of any effect of the monster
*/ */
check_residue(tp) void
register struct thing *tp; check_residue(struct thing *tp)
{ {
/* /*
* Take care of special abilities * Take care of special abilities
@ -63,13 +64,11 @@ register struct thing *tp;
/* /*
* Creat_mons creates the specified monster -- any if 0 * Creat_mons creates the specified monster -- any if 0
* person: Where to create next to
*/ */
bool bool
creat_mons(person, monster, report) creat_mons(struct thing *person, short monster, bool report)
struct thing *person; /* Where to create next to */
short monster;
bool report;
{ {
struct linked_list *nitem; struct linked_list *nitem;
register struct thing *tp; register struct thing *tp;
@ -121,9 +120,7 @@ bool report;
*/ */
void void
genmonsters(least, treas) genmonsters(int least, bool treas)
register int least;
bool treas;
{ {
reg int i; reg int i;
reg struct room *rp = &rooms[0]; reg struct room *rp = &rooms[0];
@ -166,8 +163,7 @@ bool treas;
*/ */
short short
id_monst(monster) id_monst(char monster)
register char monster;
{ {
register short result; register short result;
@ -187,11 +183,8 @@ register char monster;
* Pick a new monster and add it to the list * Pick a new monster and add it to the list
*/ */
new_monster(item, type, cp, max_monster) void
struct linked_list *item; new_monster(struct linked_list *item, short type, coord *cp, bool max_monster)
short type;
register coord *cp;
bool max_monster;
{ {
register struct thing *tp; register struct thing *tp;
register struct monster *mp; register struct monster *mp;
@ -379,8 +372,7 @@ bool max_monster;
*/ */
short short
randmonster(wander, no_unique) randmonster(bool wander, bool no_unique)
register bool wander, no_unique;
{ {
register int d, cur_level, range, i; register int d, cur_level, range, i;
@ -418,8 +410,8 @@ register bool wander, no_unique;
* to purchase something. * to purchase something.
*/ */
sell(tp) void
register struct thing *tp; sell(struct thing *tp)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;
@ -731,8 +723,7 @@ register struct thing *tp;
* what to do when the hero steps next to a monster * what to do when the hero steps next to a monster
*/ */
struct linked_list * struct linked_list *
wake_monster(y, x) wake_monster(int y, int x)
int y, x;
{ {
register struct thing *tp; register struct thing *tp;
register struct linked_list *it; register struct linked_list *it;
@ -957,7 +948,8 @@ int y, x;
* A wandering monster has awakened and is headed for the player * A wandering monster has awakened and is headed for the player
*/ */
wanderer() void
wanderer(void)
{ {
register int i; register int i;
register struct room *hr = roomin(&hero); register struct room *hr = roomin(&hero);

View file

@ -37,9 +37,8 @@ static const char Moves[3][3] = {
* The guy stepped on a trap.... Make him pay. * The guy stepped on a trap.... Make him pay.
*/ */
be_trapped(th, tc) char
register struct thing *th; be_trapped(struct thing *th, coord *tc)
register coord *tc;
{ {
register struct trap *tp; register struct trap *tp;
register char ch; register char ch;
@ -353,8 +352,7 @@ register coord *tc;
*/ */
bool bool
blue_light(blessed, cursed) blue_light(bool blessed, bool cursed)
bool blessed, cursed;
{ {
register struct room *rp; register struct room *rp;
bool ret_val=FALSE; /* Whether or not affect is known */ bool ret_val=FALSE; /* Whether or not affect is known */
@ -413,8 +411,8 @@ bool blessed, cursed;
* If not, if player came from a legal place, then try to turn him. * If not, if player came from a legal place, then try to turn him.
*/ */
corr_move(dy, dx) void
int dy, dx; corr_move(int dy, int dx)
{ {
int legal=0; /* Number of legal alternatives */ int legal=0; /* Number of legal alternatives */
register int y, x, /* Indexes though possible positions */ register int y, x, /* Indexes though possible positions */
@ -491,7 +489,8 @@ int dy, dx;
* dip_it: * dip_it:
* Dip an object into a magic pool * Dip an object into a magic pool
*/ */
dip_it() void
dip_it(void)
{ {
reg struct linked_list *what; reg struct linked_list *what;
reg struct object *ob; reg struct object *ob;
@ -667,8 +666,8 @@ dip_it()
* consequences (fighting, picking up, etc.) * consequences (fighting, picking up, etc.)
*/ */
do_move(dy, dx) void
int dy, dx; do_move(int dy, int dx)
{ {
register struct room *rp, *orp; register struct room *rp, *orp;
register char ch; register char ch;
@ -878,8 +877,8 @@ int dy, dx;
* Start the hero running * Start the hero running
*/ */
do_run(ch) void
char ch; do_run(char ch)
{ {
firstmove = TRUE; firstmove = TRUE;
running = TRUE; running = TRUE;
@ -894,11 +893,9 @@ char ch;
* Returns TRUE if it could find it, FALSE otherwise. * Returns TRUE if it could find it, FALSE otherwise.
*/ */
bool bool
getdelta(match, dy, dx) getdelta(char match, int *dy, int *dx)
char match;
int *dy, *dx;
{ {
register y, x; int y, x;
for (y = 0; y < 3; y++) for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++) for (x = 0; x < 3; x++)
@ -915,8 +912,8 @@ int *dy, *dx;
* isatrap: * isatrap:
* Returns TRUE if this character is some kind of trap * Returns TRUE if this character is some kind of trap
*/ */
isatrap(ch) bool
reg char ch; isatrap(char ch)
{ {
switch(ch) { switch(ch) {
case DARTTRAP: case DARTTRAP:
@ -936,8 +933,8 @@ reg char ch;
* If it is dark, remove anything that might move. * If it is dark, remove anything that might move.
*/ */
light(cp) void
coord *cp; light(coord *cp)
{ {
register struct room *rp; register struct room *rp;
register int j, k, x, y; register int j, k, x, y;
@ -1113,8 +1110,7 @@ coord *cp;
*/ */
bool bool
lit_room(rp) lit_room(struct room *rp)
register struct room *rp;
{ {
register struct linked_list *fire_item; register struct linked_list *fire_item;
register struct thing *fire_creature; register struct thing *fire_creature;
@ -1150,8 +1146,7 @@ register struct room *rp;
*/ */
coord * coord *
rndmove(who) rndmove(struct thing *who)
struct thing *who;
{ {
register int x, y; register int x, y;
register int ex, ey, nopen = 0; register int ex, ey, nopen = 0;
@ -1192,9 +1187,8 @@ struct thing *who;
* set a trap at (y, x) on screen. * set a trap at (y, x) on screen.
*/ */
set_trap(tp, y, x) void
register struct thing *tp; set_trap(struct thing *tp, int y, int x)
register int y, x;
{ {
register bool is_player = (tp == &player); register bool is_player = (tp == &player);
register char selection = rnd(7) + '1'; register char selection = rnd(7) + '1';
@ -1330,8 +1324,8 @@ register int y, x;
* returns what a certain thing will display as to the un-initiated * returns what a certain thing will display as to the un-initiated
*/ */
show(y, x) char
register int y, x; show(int y, int x)
{ {
register char ch = CCHAR( winat(y, x) ); register char ch = CCHAR( winat(y, x) );
register struct linked_list *it; register struct linked_list *it;
@ -1371,8 +1365,7 @@ register int y, x;
*/ */
struct trap * struct trap *
trap_at(y, x) trap_at(int y, int x)
register int y, x;
{ {
register struct trap *tp, *ep; register struct trap *tp, *ep;

View file

@ -16,8 +16,11 @@
#include "rogue.h" #include "rogue.h"
#define TERRASAVE 3 #define TERRASAVE 3
new_level(ltype) void put_things(LEVTYPE ltype);
LEVTYPE ltype; /* designates type of level to create */
/* ltype designates type of level to create */
void
new_level(LEVTYPE ltype)
{ {
register int rm = 0, i, cnt; register int rm = 0, i, cnt;
register char ch; register char ch;
@ -409,7 +412,8 @@ LEVTYPE ltype; /* designates type of level to create */
* Pick a room that is really there * Pick a room that is really there
*/ */
rnd_room() int
rnd_room(void)
{ {
register int rm; register int rm;
@ -425,10 +429,11 @@ rnd_room()
/* /*
* put_things: * put_things:
* put potions and scrolls on this level * put potions and scrolls on this level
* ltype: designates type of level to create
*/ */
put_things(ltype) void
LEVTYPE ltype; /* designates type of level to create */ put_things(LEVTYPE ltype)
{ {
register int i, rm, cnt; register int i, rm, cnt;
register struct object *cur; register struct object *cur;
@ -448,7 +453,7 @@ LEVTYPE ltype; /* designates type of level to create */
* Increasing chance after level 9 * Increasing chance after level 9
*/ */
if (ltype != MAZELEV && rnd(HARDER) < level - 8) { if (ltype != MAZELEV && rnd(HARDER) < level - 8) {
register j; register int j;
register struct room *rp; register struct room *rp;
/* Count the number of free spaces */ /* Count the number of free spaces */

View file

@ -35,16 +35,16 @@ struct optstruct {
typedef struct optstruct OPTION; typedef struct optstruct OPTION;
int put_bool(), int get_ro(WINDOW *win, int oy, int ox);
get_bool(), int get_restr(char *optstr, WINDOW *win);
put_str(), int get_score(char *optstr, WINDOW *win);
get_str(), void put_abil(int *ability, WINDOW *win);
get_restr(), void get_abil(int *abil, WINDOW *win);
get_score(), void put_quest(int *quest, WINDOW *win);
put_abil(), void get_quest(int *quest, WINDOW *win);
get_abil(), void put_bool(bool *b, WINDOW *win);
get_quest(), int get_bool(bool *bp, WINDOW *win);
put_quest(); void put_str(char *str, WINDOW *win);
OPTION optlist[] = { OPTION optlist[] = {
{"terse", "Terse output: ", {"terse", "Terse output: ",
@ -111,9 +111,8 @@ int get_score(char *optstr, WINDOW *win)
/* /*
* The ability field is read-only * The ability field is read-only
*/ */
get_abil(abil, win) void
int *abil; get_abil(int *abil, WINDOW *win)
WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
@ -125,9 +124,8 @@ WINDOW *win;
/* /*
* The quest field is read-only * The quest field is read-only
*/ */
get_quest(quest, win) void
int *quest; get_quest(int *quest, WINDOW *win)
WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
@ -141,9 +139,8 @@ WINDOW *win;
* "Get" a read-only value. * "Get" a read-only value.
*/ */
get_ro(win, oy, ox) int
WINDOW *win; get_ro(WINDOW *win, int oy, int ox)
register int oy, ox;
{ {
register int ny, nx; register int ny, nx;
register bool op_bad; register bool op_bad;
@ -180,9 +177,8 @@ register int oy, ox;
* allow changing a boolean option and print it out * allow changing a boolean option and print it out
*/ */
get_bool(bp, win) int
bool *bp; get_bool(bool *bp, WINDOW *win)
WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
register bool op_bad; register bool op_bad;
@ -230,9 +226,8 @@ WINDOW *win;
/* /*
* set a string option * set a string option
*/ */
get_str(opt, win) int
register char *opt; get_str(char *opt, WINDOW *win)
WINDOW *win;
{ {
register char *sp; register char *sp;
register int c, oy, ox; register int c, oy, ox;
@ -306,7 +301,8 @@ WINDOW *win;
/* /*
* print and then set options from the terminal * print and then set options from the terminal
*/ */
option() void
option(void)
{ {
register OPTION *op; register OPTION *op;
register int retval; register int retval;
@ -362,8 +358,8 @@ option()
* or the end of the entire option string. * or the end of the entire option string.
*/ */
parse_opts(str) void
register char *str; parse_opts(char *str)
{ {
register char *sp; register char *sp;
register OPTION *op; register OPTION *op;
@ -459,9 +455,8 @@ register char *str;
/* /*
* print the character type * print the character type
*/ */
put_abil(ability, win) void
int *ability; put_abil(int *ability, WINDOW *win)
WINDOW *win;
{ {
char *abil; char *abil;
@ -480,9 +475,8 @@ WINDOW *win;
* print out the quest * print out the quest
*/ */
put_quest(quest, win) void
int *quest; put_quest(int *quest, WINDOW *win)
WINDOW *win;
{ {
waddstr(win, rel_magic[*quest].mi_name); waddstr(win, rel_magic[*quest].mi_name);
} }
@ -491,9 +485,8 @@ WINDOW *win;
/* /*
* put out a boolean * put out a boolean
*/ */
put_bool(b, win) void
bool *b; put_bool(bool *b, WINDOW *win)
WINDOW *win;
{ {
waddstr(win, *b ? "True" : "False"); waddstr(win, *b ? "True" : "False");
} }
@ -504,9 +497,8 @@ WINDOW *win;
/* /*
* put out a string * put out a string
*/ */
put_str(str, win) void
char *str; put_str(char *str, WINDOW *win)
WINDOW *win;
{ {
waddstr(win, str); waddstr(win, str);
} }

View file

@ -11,7 +11,8 @@
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
extern char rnd_terrain(), get_terrain(); char rnd_terrain(void);
char get_terrain(char one, char two, char three, char four);
/* /*
* init_terrain: * init_terrain:
@ -19,7 +20,7 @@ extern char rnd_terrain(), get_terrain();
*/ */
void void
init_terrain() init_terrain(void)
{ {
register struct room *rp; register struct room *rp;
@ -38,11 +39,9 @@ init_terrain()
void void
do_terrain(basey, basex, deltay, deltax, fresh) do_terrain(int basey, int basex, int deltay, int deltax, bool fresh)
int basey, basex, deltay, deltax;
bool fresh;
{ {
register cury, curx; /* Current y and x positions */ int cury, curx; /* Current y and x positions */
/* Lay out the boundary */ /* Lay out the boundary */
for (cury=1; cury<LINES-2; cury++) { /* Vertical "walls" */ for (cury=1; cury<LINES-2; cury++) { /* Vertical "walls" */
@ -125,7 +124,7 @@ bool fresh;
*/ */
char char
rnd_terrain() rnd_terrain(void)
{ {
int chance = rnd(100); int chance = rnd(100);
@ -149,8 +148,7 @@ rnd_terrain()
*/ */
char char
get_terrain(one, two, three, four) get_terrain(char one, char two, char three, char four)
char one, two, three, four;
{ {
register int i; register int i;
int forest = 0, mountain = 0, lake = 0, meadow = 0, total = 0; int forest = 0, mountain = 0, lake = 0, meadow = 0, total = 0;
@ -203,8 +201,7 @@ char one, two, three, four;
*/ */
void void
lake_check(place) lake_check(coord *place)
coord *place;
{ {
NOOP(place); NOOP(place);
} }

View file

@ -18,15 +18,15 @@
char outstring[512]; /* ridiculously long string for use with msg */ char outstring[512]; /* ridiculously long string for use with msg */
bool is_type (struct object *obj, int type);
/* /*
* add_pack: * add_pack:
* Pick up an object and add it to the pack. If the argument is non-null * Pick up an object and add it to the pack. If the argument is non-null
* use it as the linked_list pointer instead of gettting it off the ground. * use it as the linked_list pointer instead of gettting it off the ground.
*/ */
bool bool
add_pack(item, silent, packret) add_pack(struct linked_list *item, bool silent, struct linked_list **packret)
register struct linked_list *item, **packret;
bool silent;
{ {
register struct linked_list *ip, *lp = NULL, *ap; register struct linked_list *ip, *lp = NULL, *ap;
register struct object *obj, *op = NULL; register struct object *obj, *op = NULL;
@ -305,9 +305,8 @@ picked_up:
* inventory: * inventory:
* list what is in the pack * list what is in the pack
*/ */
inventory(list, type) bool
register struct linked_list *list; inventory(struct linked_list *list, int type)
register int type;
{ {
register struct object *obj; register struct object *obj;
register char ch; register char ch;
@ -390,8 +389,8 @@ register int type;
* pick_up: * pick_up:
* Add something to characters pack. * Add something to characters pack.
*/ */
pick_up(ch) void
char ch; pick_up(char ch)
{ {
switch (ch) { switch (ch) {
default: default:
@ -416,7 +415,7 @@ char ch;
* Allow player to inventory a single item * Allow player to inventory a single item
*/ */
void void
picky_inven() picky_inven(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register char ch, mch; register char ch, mch;
@ -471,12 +470,10 @@ picky_inven()
/* /*
* get_item: * get_item:
* pick something out of a pack for a purpose * pick something out of a pack for a purpose
* purpose: NULL if we should be silent (no prompts) *
*/ */
struct linked_list * struct linked_list *
get_item(list, purpose, type) get_item(struct linked_list *list, char *purpose, int type)
reg struct linked_list *list;
char *purpose; /* NULL if we should be silent (no prompts) */
int type;
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -610,9 +607,8 @@ int type;
} }
} }
pack_char(list, obj) char
register struct object *obj; pack_char(struct linked_list *list, struct object *obj)
struct linked_list *list;
{ {
register struct linked_list *item; register struct linked_list *item;
register char c; register char c;
@ -634,8 +630,8 @@ struct linked_list *list;
* cur_null: * cur_null:
* This updates cur_weapon etc for dropping things * This updates cur_weapon etc for dropping things
*/ */
cur_null(op) void
reg struct object *op; cur_null(struct object *op)
{ {
if (op == cur_weapon) cur_weapon = NULL; if (op == cur_weapon) cur_weapon = NULL;
else if (op == cur_armor) cur_armor = NULL; else if (op == cur_armor) cur_armor = NULL;
@ -659,7 +655,8 @@ reg struct object *op;
* idenpack: * idenpack:
* Identify all the items in the pack * Identify all the items in the pack
*/ */
idenpack() void
idenpack(void)
{ {
reg struct linked_list *pc; reg struct linked_list *pc;
@ -667,9 +664,8 @@ idenpack()
whatis(pc); whatis(pc);
} }
is_type (obj, type) bool
register struct object *obj; is_type (struct object *obj, int type)
register int type;
{ {
register bool current; register bool current;
@ -804,8 +800,8 @@ register int type;
return(FALSE); return(FALSE);
} }
del_pack(item) void
register struct linked_list *item; del_pack(struct linked_list *item)
{ {
register struct object *obj; register struct object *obj;
@ -827,9 +823,8 @@ register struct linked_list *item;
* it to him. * it to him.
*/ */
carry_obj(mp, chance) void
register struct thing *mp; carry_obj(struct thing *mp, int chance)
int chance;
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -851,74 +846,74 @@ int chance;
* avoid it * avoid it
*/ */
if (on(*mp, CARRYDAGGER)) { if (on(*mp, CARRYDAGGER)) {
item = spec_item(RELIC, MUSTY_DAGGER, NULL, NULL); item = spec_item(RELIC, MUSTY_DAGGER, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYCLOAK)) { if (on(*mp, CARRYCLOAK)) {
item = spec_item(RELIC, EMORI_CLOAK, NULL, NULL); item = spec_item(RELIC, EMORI_CLOAK, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYANKH)) { if (on(*mp, CARRYANKH)) {
item = spec_item(RELIC, HEIL_ANKH, NULL, NULL); item = spec_item(RELIC, HEIL_ANKH, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYSTAFF)) { if (on(*mp, CARRYSTAFF)) {
item = spec_item(RELIC, MING_STAFF, NULL, NULL); item = spec_item(RELIC, MING_STAFF, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYWAND)) { if (on(*mp, CARRYWAND)) {
item = spec_item(RELIC, ORCUS_WAND, NULL, NULL); item = spec_item(RELIC, ORCUS_WAND, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYROD)) { if (on(*mp, CARRYROD)) {
item = spec_item(RELIC, ASMO_ROD, NULL, NULL); item = spec_item(RELIC, ASMO_ROD, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYAMULET)) { if (on(*mp, CARRYAMULET)) {
item = spec_item(RELIC, YENDOR_AMULET, NULL, NULL); item = spec_item(RELIC, YENDOR_AMULET, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYMANDOLIN)) { if (on(*mp, CARRYMANDOLIN)) {
item = spec_item(RELIC, BRIAN_MANDOLIN, NULL, NULL); item = spec_item(RELIC, BRIAN_MANDOLIN, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYMSTAR)) { if (on(*mp, CARRYMSTAR)) {
item = spec_item(RELIC, HRUGGEK_MSTAR, NULL, NULL); item = spec_item(RELIC, HRUGGEK_MSTAR, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYFLAIL)) { if (on(*mp, CARRYFLAIL)) {
item = spec_item(RELIC, YEENOGHU_FLAIL, NULL, NULL); item = spec_item(RELIC, YEENOGHU_FLAIL, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYHORN)) { if (on(*mp, CARRYHORN)) {
item = spec_item(RELIC, GERYON_HORN, NULL, NULL); item = spec_item(RELIC, GERYON_HORN, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
@ -927,7 +922,7 @@ int chance;
* If it carries gold, give it some * If it carries gold, give it some
*/ */
if (on(*mp, CARRYGOLD) && rnd(100) < chance) { if (on(*mp, CARRYGOLD) && rnd(100) < chance) {
item = spec_item(GOLD, NULL, NULL, NULL); item = spec_item(GOLD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_count = GOLDCALC + GOLDCALC; obj->o_count = GOLDCALC + GOLDCALC;
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
@ -938,7 +933,7 @@ int chance;
* If it carries food, give it some * If it carries food, give it some
*/ */
if (on(*mp, CARRYFOOD) && rnd(100) < chance) { if (on(*mp, CARRYFOOD) && rnd(100) < chance) {
item = spec_item(FOOD, NULL, NULL, NULL); item = spec_item(FOOD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_weight = things[TYP_FOOD].mi_wght; obj->o_weight = things[TYP_FOOD].mi_wght;
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
@ -1041,8 +1036,8 @@ int chance;
* he wants (* means everything). * he wants (* means everything).
*/ */
grab(y, x) int
register y, x; grab(int y, int x)
{ {
register struct linked_list *next_item, *item; register struct linked_list *next_item, *item;
register struct object *obj; register struct object *obj;

View file

@ -14,15 +14,20 @@
* See the file LICENSE.TXT for full copyright and licensing information. * See the file LICENSE.TXT for full copyright and licensing information.
*/ */
#include <stdlib.h>
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
void conn(int r1, int r2);
void door(struct room *rm, coord *cp);
/* /*
* do_passages: * do_passages:
* Draw all the passages on a level. * Draw all the passages on a level.
*/ */
do_passages() void
do_passages(void)
{ {
register struct rdes *r1, *r2 = NULL; register struct rdes *r1, *r2 = NULL;
register int i, j; register int i, j;
@ -130,8 +135,8 @@ do_passages()
* Draw a corridor from a room in a certain direction. * Draw a corridor from a room in a certain direction.
*/ */
conn(r1, r2) void
int r1, r2; conn(int r1, int r2)
{ {
register struct room *rpf, *rpt = NULL; register struct room *rpf, *rpt = NULL;
register char rmt; register char rmt;
@ -266,9 +271,8 @@ int r1, r2;
* also enters the door in the exits array of the room. * also enters the door in the exits array of the room.
*/ */
door(rm, cp) void
register struct room *rm; door(struct room *rm, coord *cp)
register coord *cp;
{ {
struct linked_list *newroom; struct linked_list *newroom;
coord *exit; coord *exit;

View file

@ -17,7 +17,8 @@
* cleric affecting undead * cleric affecting undead
*/ */
affect() void
affect(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *tp; register struct thing *tp;
@ -121,7 +122,8 @@ annoy:
/* /*
* the magic user is going to try and cast a spell * the magic user is going to try and cast a spell
*/ */
cast() void
cast(void)
{ {
register int i, num_spells, spell_ability; register int i, num_spells, spell_ability;
int which_spell; int which_spell;
@ -271,7 +273,8 @@ cast()
/* Constitution bonus */ /* Constitution bonus */
const_bonus() /* Hit point adjustment for changing levels */ int
const_bonus(void) /* Hit point adjustment for changing levels */
{ {
if (pstats.s_const > 6 && pstats.s_const <= 14) if (pstats.s_const > 6 && pstats.s_const <= 14)
return(0); return(0);
@ -290,7 +293,8 @@ const_bonus() /* Hit point adjustment for changing levels */
* Sense gold * Sense gold
*/ */
gsense() void
gsense(void)
{ {
/* Only thieves can do this */ /* Only thieves can do this */
if (player.t_ctype != C_THIEF) { if (player.t_ctype != C_THIEF) {
@ -324,7 +328,8 @@ gsense()
/* /*
* the cleric asks his deity for a spell * the cleric asks his deity for a spell
*/ */
pray() void
pray(void)
{ {
register int i, num_prayers, prayer_ability; register int i, num_prayers, prayer_ability;
int which_prayer; int which_prayer;
@ -488,7 +493,8 @@ pray()
* Steal in direction given in delta * Steal in direction given in delta
*/ */
steal() void
steal(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *tp; register struct thing *tp;

View file

@ -17,14 +17,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
void res_intelligence(void);
void res_wisdom(void);
/* /*
* Increase player's constitution * Increase player's constitution
*/ */
add_const(cursed) void
bool cursed; add_const(bool cursed)
{ {
/* Do the potion */ /* Do the potion */
if (cursed) { if (cursed) {
@ -47,8 +49,8 @@ bool cursed;
* Increase player's dexterity * Increase player's dexterity
*/ */
add_dexterity(cursed) void
bool cursed; add_dexterity(bool cursed)
{ {
int ring_str; /* Value of ring strengths */ int ring_str; /* Value of ring strengths */
@ -80,8 +82,8 @@ bool cursed;
* add a haste to the player * add a haste to the player
*/ */
add_haste(blessed) void
bool blessed; add_haste(bool blessed)
{ {
int hasttime; int hasttime;
@ -110,8 +112,8 @@ bool blessed;
/* /*
* Increase player's intelligence * Increase player's intelligence
*/ */
add_intelligence(cursed) void
bool cursed; add_intelligence(bool cursed)
{ {
int ring_str; /* Value of ring strengths */ int ring_str; /* Value of ring strengths */
@ -141,7 +143,8 @@ bool cursed;
/* /*
* this routine makes the hero move slower * this routine makes the hero move slower
*/ */
add_slow() void
add_slow(void)
{ {
if (on(player, ISHASTE)) { /* Already sped up */ if (on(player, ISHASTE)) { /* Already sped up */
extinguish(nohaste); extinguish(nohaste);
@ -164,8 +167,8 @@ add_slow()
* Increase player's strength * Increase player's strength
*/ */
add_strength(cursed) void
bool cursed; add_strength(bool cursed)
{ {
if (cursed) { if (cursed) {
@ -182,8 +185,8 @@ bool cursed;
* Increase player's wisdom * Increase player's wisdom
*/ */
add_wisdom(cursed) void
bool cursed; add_wisdom(bool cursed)
{ {
int ring_str; /* Value of ring strengths */ int ring_str; /* Value of ring strengths */
@ -215,8 +218,8 @@ bool cursed;
* Lower a level of experience * Lower a level of experience
*/ */
lower_level(who) void
short who; lower_level(short who)
{ {
int fewer, nsides = 0; int fewer, nsides = 0;
@ -239,10 +242,8 @@ short who;
death(who); death(who);
} }
quaff(which, flag, is_potion) void
int which; quaff(int which, int flag, bool is_potion)
int flag;
bool is_potion;
{ {
register struct object *obj = NULL; register struct object *obj = NULL;
register struct linked_list *item, *titem; register struct linked_list *item, *titem;
@ -625,8 +626,8 @@ bool is_potion;
* if called with zero the restore fully * if called with zero the restore fully
*/ */
res_dexterity(howmuch) void
int howmuch; res_dexterity(int howmuch)
{ {
short save_max; short save_max;
int ring_str; int ring_str;
@ -656,7 +657,8 @@ int howmuch;
* Restore player's intelligence * Restore player's intelligence
*/ */
res_intelligence() void
res_intelligence(void)
{ {
short save_max; short save_max;
int ring_str; int ring_str;
@ -680,7 +682,8 @@ res_intelligence()
* Restore player's wisdom * Restore player's wisdom
*/ */
res_wisdom() void
res_wisdom(void)
{ {
short save_max; short save_max;
int ring_str; int ring_str;

View file

@ -20,8 +20,8 @@
/* /*
* how much food does this ring use up? * how much food does this ring use up?
*/ */
ring_eat(hand) int
register int hand; ring_eat(int hand)
{ {
if (cur_ring[hand] == NULL) if (cur_ring[hand] == NULL)
return 0; return 0;
@ -45,8 +45,8 @@ register int hand;
return 0; return 0;
} }
ring_on(obj) void
register struct object *obj; ring_on(struct object *obj)
{ {
register int save_max; register int save_max;
char buf[LINELEN]; char buf[LINELEN];
@ -112,8 +112,7 @@ register struct object *obj;
* print ring bonuses * print ring bonuses
*/ */
char * char *
ring_num(obj) ring_num(struct object *obj)
register struct object *obj;
{ {
static char buf[5]; static char buf[5];
@ -147,7 +146,8 @@ register struct object *obj;
/* /*
* Return the effect of the specified ring * Return the effect of the specified ring
*/ */
ring_value(type) int
ring_value(int type)
{ {
int result = 0; int result = 0;

View file

@ -71,15 +71,17 @@ static char *rip[] = {
0 0
}; };
char *killname(); char *killname(short monst);
void scorein(struct sc_ent scores[], int fd);
void scoreout(struct sc_ent scores[], FILE *outf);
void showpack(char *howso);
int update(struct sc_ent top_ten[], unsigned long amount, short quest,
char *whoami, short flags, short level, short monst, short ctype,
char *system, char *login);
void void
byebye(sig) byebye(int sig)
int sig;
{ {
NOOP(sig); NOOP(sig);
if (!isendwin()) { if (!isendwin()) {
@ -96,8 +98,8 @@ int sig;
* Do something really fun when he dies * Do something really fun when he dies
*/ */
death(monst) void
register short monst; death(short monst)
{ {
register char **dp = rip, *killer; register char **dp = rip, *killer;
register struct tm *lt; register struct tm *lt;
@ -125,8 +127,7 @@ register short monst;
} }
char * char *
killname(monst) killname(short monst)
register short monst;
{ {
static char mons_name[LINELEN]; static char mons_name[LINELEN];
int i; int i;
@ -162,9 +163,8 @@ register short monst;
*/ */
/* VARARGS2 */ /* VARARGS2 */
score(amount, flags, monst) void
unsigned long amount; score(unsigned long amount, int flags, short monst)
short monst;
{ {
static struct sc_ent top_ten[NUMSCORE]; static struct sc_ent top_ten[NUMSCORE];
register struct sc_ent *scp; register struct sc_ent *scp;
@ -626,9 +626,8 @@ void writelog(unsigned long amount, int flags, short monst) {
* Convert a character string that has been translated from a * Convert a character string that has been translated from a
* score file by scoreout() back to a score file structure. * score file by scoreout() back to a score file structure.
*/ */
scorein(scores, fd) void
struct sc_ent scores[]; scorein(struct sc_ent scores[], int fd)
int fd;
{ {
int i; int i;
char scoreline[100]; char scoreline[100];
@ -652,9 +651,8 @@ int fd;
* this for compatibility sake since some machines write out fields in * this for compatibility sake since some machines write out fields in
* different orders. * different orders.
*/ */
scoreout(scores, outf) void
struct sc_ent scores[]; scoreout(struct sc_ent scores[], FILE *outf)
FILE *outf;
{ {
int i; int i;
char scoreline[100]; char scoreline[100];
@ -676,8 +674,8 @@ FILE *outf;
* showpack: * showpack:
* Display the contents of the hero's pack * Display the contents of the hero's pack
*/ */
showpack(howso) void
char *howso; showpack(char *howso)
{ {
reg char *iname; reg char *iname;
reg int cnt, packnum; reg int cnt, packnum;
@ -706,7 +704,8 @@ char *howso;
refresh(); refresh();
} }
total_winner() void
total_winner(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;
@ -760,11 +759,10 @@ total_winner()
exit(0); exit(0);
} }
update(top_ten, amount, quest, whoami, flags, level, monst, ctype, system, login) int
struct sc_ent top_ten[]; update(struct sc_ent top_ten[], unsigned long amount, short quest,
unsigned long amount; char *whoami, short flags, short level, short monst, short ctype,
short quest, flags, level, monst, ctype; char *system, char *login)
char *whoami, *system, *login;
{ {
register struct sc_ent *scp, *sc2; register struct sc_ent *scp, *sc2;
int retval=0; /* 1 if a change, 0 otherwise */ int retval=0; /* 1 if a change, 0 otherwise */

View file

@ -943,48 +943,260 @@ struct spells {
int s_flag; /* is the spell blessed/cursed? */ int s_flag; /* is the spell blessed/cursed? */
}; };
struct linked_list *find_mons(), *find_obj(), *get_item(), *new_item(), void _attach(struct linked_list **list, struct linked_list *item);
*new_thing(), *wake_monster(), *get_hurl(), void _detach(struct linked_list **list, struct linked_list *item);
*spec_item(), *creat_item(); void _o_free_list(struct linked_list **ptr);
struct object *wield_weap(); void _t_free_list(struct linked_list **ptr);
struct room *roomin(); int ac_compute(void);
struct trap *trap_at(); void activity(void);
void add_dexterity(bool cursed);
char *tr_name(), *new(), void add_intelligence(bool cursed);
*vowelstr(), *inv_name(), bool add_pack(struct linked_list *item, bool silent,
*ctime(), *num(), *ring_num(), *misc_num(), *blesscurse(), *typ_name(), struct linked_list **packret);
*weap_name(), *misc_name(); void add_slow(void);
coord *rndmove(), *can_shoot(), *fallpos(); void add_wisdom(bool cursed);
short randmonster(), id_monst(); void addmsg(char *fmt, ...);
void quit(int sig), tstp(int sig), auto_save(int sig), bugkill(int sig), endit(int sig); void affect(void);
int rnd(), wghtchk(), nohaste(), res_strength(), void aggravate(void);
doctor(), runners(), swander(), unconfuse(), unsee(), fumble(), void alchemy(struct object *obj);
unclrhead(), unphase(), noslow(), rollwand(), stomach(), sight(), void appear(void);
unstink(), suffocate(), cure_disease(), un_itch(), shoot_bolt(), bool attack(struct thing *mp, struct object *weapon, bool thrown);
appear(), dust_appear(), unchoke(), alchemy(), trap_look(), strangle(), void auto_save(int sig);
ring_teleport(), ring_search(), grab(); char be_trapped(struct thing *th, coord *tc);
bool blue_light(), can_blink(), creat_mons(), add_pack(), char *blesscurse(int flags);
straight_shot(), maze_view(), lit_room(), getdelta(), save_file(), bool blue_light(bool blessed, bool cursed);
save_game(); void bugkill(int sig);
long check_level(); void buy_it(void);
void byebye(int sig), genmonsters(); void byebye(int sig);
int land(), undance(); void cast(void);
bool can_blink(struct thing *tp);
coord *can_shoot(coord *er, coord *ee);
bool cansee(int y, int x);
void carry_obj(struct thing *mp, int chance);
long check_level(bool get_spells);
void check_residue(struct thing *tp);
void chg_str(int amt);
void command(void);
int const_bonus(void);
void corr_move(int dy, int dx);
struct linked_list *creat_item(void);
bool creat_mons(struct thing *person, short monster, bool report);
void create_obj(bool prompt, int which_item, int which_type);
void cur_null(struct object *op);
void cure_disease(void);
void dbotline(WINDOW *scr, char *message);
void death(short monst);
void del_pack(struct linked_list *item);
void destroy_item(struct linked_list *item);
int dex_compute(void);
int dext_prot(int dexterity);
bool diag_ok(coord *sp, coord *ep, struct thing *flgptr);
void dip_it(void);
void do_daemons(int flag);
void do_fuses(int flag);
void do_maze(void);
void do_motion(struct object *obj, int ydelta, int xdelta, struct thing *tp);
void do_move(int dy, int dx);
void do_passages(void);
void do_post(void);
void do_rooms(void);
void do_run(char ch);
void do_terrain(int basey, int basex, int deltay, int deltax, bool fresh);
bool do_zap(bool gotdir, int which, int flag);
void doctor(struct thing *tp);
void draw_room(struct room *rp);
bool drop(struct linked_list *item);
bool dropcheck(struct object *op);
void dust_appear(void);
void eat(void);
int encread(char *start, unsigned int size, int inf);
int encwrite(char *start, unsigned int size, FILE *outf);
void endit(int sig);
void endmsg(void);
void extinguish(int (*func)());
void fall(struct linked_list *item, bool pr);
coord *fallpos(coord *pos, bool be_clear, int range);
void fatal(char *s);
bool fight(coord *mp, struct object *weap, bool thrown);
struct linked_list *find_mons(int y, int x);
struct linked_list *find_obj(int y, int x);
struct delayed_action *find_slot(int (*func)());
void fix_stick(struct object *cur);
void fumble(void);
void fuse(int (*func)(), void *arg, int time, int type);
void genmonsters(int least, bool treas);
bool get_dir(void);
struct linked_list *get_item(struct linked_list *list, char *purpose, int type);
int get_str(char *opt, WINDOW *win);
int get_worth(struct object *obj);
int getbless(void);
int getdeath(void);
bool getdelta(char match, int *dy, int *dx);
int grab(int y, int x);
void gsense(void);
bool hit_monster(int y, int x, struct object *obj, struct thing *tp);
int hitweight(void);
short id_monst(char monster);
void idenpack(void);
void init_colors(void);
void init_materials(void);
void init_misc(void);
void init_names(void);
void init_player(void);
void init_stones(void);
void init_terrain(void);
void init_things(void);
void init_weapon(struct object *weap, char type);
char *inv_name(struct object *obj, bool drop);
bool inventory(struct linked_list *list, int type);
bool is_current(struct object *obj);
bool is_magic(struct object *obj);
bool isatrap(char ch);
int itemweight(struct object *wh);
void kill_daemon(int (*func)());
void killed(struct linked_list *item, bool pr, bool points);
void lake_check(coord *place);
void land(void);
void lengthen(int (*func)(), int xtime);
void light(coord *cp);
bool lit_room(struct room *rp);
void look(bool wakeup, bool runend);
void lower_level(short who);
bool m_use_item(struct thing *monster, coord *monst_pos, coord *defend_pos);
short makemonster(bool create);
bool maze_view(int y, int x);
char *misc_name(struct object *obj);
void missile(int ydelta, int xdelta, struct linked_list *item,
struct thing *tp);
void msg(char *fmt, ...);
unsigned long netread(int *error, int size, FILE *stream);
int netwrite(unsigned long value, int size, FILE *stream);
char *new(int size);
struct linked_list *new_item(int size);
void new_level(LEVTYPE ltype);
void new_monster(struct linked_list *item, short type, coord *cp,
bool max_monster);
struct linked_list *new_thing(int thing_type);
void nohaste(void);
void noslow(void);
char *num(int n1, int n2);
void o_discard(struct linked_list *item);
void option(void);
char pack_char(struct linked_list *list, struct object *obj);
void parse_opts(char *str);
bool passwd(void);
int pick_one(struct magic_item *magic, int nitems);
void pick_up(char ch);
void picky_inven(void);
void playit(void);
void pray(void);
bool price_it(void);
void quaff(int which, int flag, bool is_potion);
void quit(int sig);
void raise_level(bool get_spells);
short randmonster(bool wander, bool no_unique);
void read_scroll(int which, int flag, bool is_scroll);
int readchar(void);
void res_dexterity(int howmuch);
void res_strength(void);
bool restore(char *file, char **envp);
void restscr(WINDOW *scr);
int ring_eat(int hand);
char *ring_num(struct object *obj);
void ring_on(struct object *obj);
void ring_search(void);
void ring_teleport(void);
int ring_value(int type);
int rnd(int range);
void rnd_pos(struct room *rp, coord *cp);
int rnd_room(void);
coord *rndmove(struct thing *who);
int roll(int number, int sides);
void rollwand(void);
struct room *roomin(coord *cp);
int rs_restore_file(int inf);
int rs_save_file(FILE *savef);
void runners(void);
void runto(struct thing *runner, coord *spot);
bool save(int which, struct thing *who, int adj);
bool save_game(void);
void score(unsigned long amount, int flags, short monst);
void search(bool is_thief, bool door_chime);
char secretdoor(int y, int x);
void sell(struct thing *tp);
void sell_it(void);
void set_trap(struct thing *tp, int y, int x);
void setup(void);
bool shoot_bolt(struct thing *shooter, coord start, coord dir,
bool get_points, short reason, char *name, int damage);
bool shoot_ok(char ch);
char show(int y, int x);
void sight(void);
struct linked_list *spec_item(int type, int which, int hit, int damage);
void start_daemon(int (*func)(), void *arg, int type);
void status(bool display);
void steal(void);
bool step_ok(int y, int x, int can_on_monst, struct thing *flgptr);
void stomach(void);
int str_compute(void);
void strangle(void);
void strucpy(char *s1, char *s2, int len);
void suffocate(void);
void swander(void);
bool swing(short class, int at_lvl, int op_arm, int wplus);
void t_discard(struct linked_list *item);
void take_off(void);
int teleport(void);
void total_winner(void);
int totalenc(void);
char *tr_name(char ch);
struct trap *trap_at(int y, int x);
void trap_look(void);
void un_itch(void);
void unchoke(void);
void unclrhead(void);
void unconfuse(void);
void undance(void);
void unphase(void);
void unsee(void);
void unstink(void);
void updpack(bool getmax);
void use_mm(int which);
char *vowelstr(char *str);
void wait_for(WINDOW *win, char ch);
struct linked_list *wake_monster(int y, int x);
void waste_time(void);
char *weap_name(struct object *obj);
void wear(void);
void wghtchk(void);
void whatis(struct linked_list *what);
void wield(void);
void writelog(unsigned long amount, int flags, short monst); void writelog(unsigned long amount, int flags, short monst);
#ifdef CHECKTIME #ifdef CHECKTIME
int checkout(); int checkout();
#endif #endif
extern char *md_getusername(); extern char *md_getusername(void);
extern char *md_gethomedir(); extern char *md_gethomedir(void);
extern void md_flushinp(); extern void md_flushinp(void);
extern char *md_getshell(); extern char *md_getshell(void);
extern char *md_gethostname(); extern char *md_gethostname(void);
extern void md_dobinaryio(); extern char *md_getpass(char *prompt);
extern char *md_getpass(); extern char *md_crypt(char *key, char *salt);
extern char *md_crypt(); extern char *md_getroguedir(void);
extern char *md_getroguedir(); extern void md_init(void);
extern void md_init();
extern FILE * md_fdopen(int fd, char *mode); extern FILE * md_fdopen(int fd, char *mode);
extern int md_unlink(char *file); extern int md_unlink(char *file);
extern int md_normaluser(void);
extern int md_getuid(void);
extern long md_memused(void);
extern void md_reopen_score(void);
extern int md_readchar(WINDOW *win);
extern int md_shellescape(void);
extern int md_srand(int seed);
extern int md_rand(void);
extern int md_erasechar(void);
extern int md_killchar(void);
/* /*
* Now all the global variables * Now all the global variables

View file

@ -16,7 +16,11 @@
#include "rogue.h" #include "rogue.h"
#include <stdlib.h> #include <stdlib.h>
do_rooms() void horiz(int cnt);
void vert(int cnt);
void
do_rooms(void)
{ {
register int i; register int i;
register struct room *rp; register struct room *rp;
@ -99,7 +103,7 @@ do_rooms()
has_gold = TRUE; /* This room has gold in it */ has_gold = TRUE; /* This room has gold in it */
item = spec_item(GOLD, NULL, NULL, NULL); item = spec_item(GOLD, 0, 0, 0);
cur = OBJPTR(item); cur = OBJPTR(item);
/* Put the gold into the level list of items */ /* Put the gold into the level list of items */
@ -153,8 +157,8 @@ do_rooms()
* Draw a box around a room * Draw a box around a room
*/ */
draw_room(rp) void
register struct room *rp; draw_room(struct room *rp)
{ {
register int j, k; register int j, k;
@ -181,8 +185,8 @@ register struct room *rp;
* draw a horizontal line * draw a horizontal line
*/ */
horiz(cnt) void
register int cnt; horiz(int cnt)
{ {
while (cnt--) while (cnt--)
addch('-'); addch('-');
@ -193,9 +197,8 @@ register int cnt;
* pick a random spot in a room * pick a random spot in a room
*/ */
rnd_pos(rp, cp) void
register struct room *rp; rnd_pos(struct room *rp, coord *cp)
register coord *cp;
{ {
cp->x = rp->r_pos.x + rnd(rp->r_max.x-2) + 1; cp->x = rp->r_pos.x + rnd(rp->r_max.x-2) + 1;
cp->y = rp->r_pos.y + rnd(rp->r_max.y-2) + 1; cp->y = rp->r_pos.y + rnd(rp->r_max.y-2) + 1;
@ -210,8 +213,7 @@ register coord *cp;
*/ */
struct room * struct room *
roomin(cp) roomin(coord *cp)
register coord *cp;
{ {
register struct room *rp; register struct room *rp;
@ -226,8 +228,8 @@ register coord *cp;
* draw a vertical line * draw a vertical line
*/ */
vert(cnt) void
register int cnt; vert(int cnt)
{ {
register int x, y; register int x, y;

View file

@ -23,6 +23,8 @@
#include <signal.h> #include <signal.h>
#include "rogue.h" #include "rogue.h"
bool save_file(FILE *savef);
typedef struct stat STAT; typedef struct stat STAT;
extern char version[], encstr[]; extern char version[], encstr[];
@ -31,7 +33,7 @@ extern char version[], encstr[];
STAT sbuf; STAT sbuf;
bool bool
save_game() save_game(void)
{ {
register FILE *savef; register FILE *savef;
register int c; register int c;
@ -122,8 +124,7 @@ auto_save(int sig)
* write the saved game on the file * write the saved game on the file
*/ */
bool bool
save_file(savef) save_file(FILE *savef)
register FILE *savef;
{ {
int ret; int ret;
int slines = LINES; int slines = LINES;
@ -147,9 +148,8 @@ register FILE *savef;
return(ret); return(ret);
} }
restore(file, envp) bool
register char *file; restore(char *file, char **envp)
char **envp;
{ {
register int inf; register int inf;
#ifndef _AIX #ifndef _AIX
@ -264,13 +264,11 @@ char **envp;
/* /*
* perform an encrypted write * perform an encrypted write
*/ */
encwrite(start, size, outf) int
register char *start; encwrite(char *start, unsigned int size, FILE *outf)
register unsigned size;
register FILE *outf;
{ {
register char *ep; register char *ep;
register num_written = 0; register int num_written = 0;
ep = encstr; ep = encstr;
@ -288,10 +286,8 @@ register FILE *outf;
/* /*
* perform an encrypted read * perform an encrypted read
*/ */
encread(start, size, inf) int
register char *start; encread(char *start, unsigned int size, int inf)
register unsigned size;
register int inf;
{ {
register char *ep; register char *ep;
register int read_size; register int read_size;

View file

@ -23,7 +23,8 @@
/* /*
* let the hero get rid of some type of monster (but not a UNIQUE!) * let the hero get rid of some type of monster (but not a UNIQUE!)
*/ */
genocide() void
genocide(void)
{ {
register struct linked_list *ip; register struct linked_list *ip;
register struct thing *mp; register struct thing *mp;
@ -37,7 +38,7 @@ genocide()
/* Print out the monsters */ /* Print out the monsters */
while (num_monst > 0) { while (num_monst > 0) {
register left_limit; int left_limit;
if (num_monst < num_lines) left_limit = (num_monst+1)/2; if (num_monst < num_lines) left_limit = (num_monst+1)/2;
else left_limit = num_lines/2; else left_limit = num_lines/2;
@ -112,10 +113,8 @@ get_monst:
msg("You have wiped out the %s.", monsters[which_monst].m_name); msg("You have wiped out the %s.", monsters[which_monst].m_name);
} }
read_scroll(which, flag, is_scroll) void
register int which; read_scroll(int which, int flag, bool is_scroll)
int flag;
bool is_scroll;
{ {
register struct object *obj = NULL, *nobj; register struct object *obj = NULL, *nobj;
register struct linked_list *item, *nitem; register struct linked_list *item, *nitem;

View file

@ -64,6 +64,12 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
int rs_read_int(int inf, int *i);
int rs_write_int(FILE *savef, int c);
int list_size(struct linked_list *l);
int rs_write_object_list(FILE *savef, struct linked_list *l);
int rs_read_object_list(int inf, struct linked_list **list);
#define READSTAT (format_error || read_error ) #define READSTAT (format_error || read_error )
#define WRITESTAT (write_error) #define WRITESTAT (write_error)
@ -1712,6 +1718,7 @@ rs_read_rooms(int inf, struct room *r, int count)
return(READSTAT); return(READSTAT);
} }
int
rs_write_room_reference(FILE *savef, struct room *rp) rs_write_room_reference(FILE *savef, struct room *rp)
{ {
int i, room = -1; int i, room = -1;
@ -2224,7 +2231,7 @@ rs_read_thing(int inf, struct thing *t)
return(READSTAT); return(READSTAT);
} }
int void
rs_fix_thing(struct thing *t) rs_fix_thing(struct thing *t)
{ {
struct thing *tp; struct thing *tp;
@ -2434,6 +2441,7 @@ rs_save_file(FILE *savef)
return(WRITESTAT); return(WRITESTAT);
} }
int
rs_restore_file(int inf) rs_restore_file(int inf)
{ {
int i; int i;

View file

@ -18,14 +18,13 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
void drain(int ymin, int ymax, int xmin, int xmax);
/* /*
* zap a stick and see what happens * zap a stick and see what happens
*/ */
do_zap(gotdir, which, flag) bool
bool gotdir; do_zap(bool gotdir, int which, int flag)
int which;
int flag;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj = NULL; register struct object *obj = NULL;
@ -683,8 +682,8 @@ int flag;
* Do drain hit points from player shtick * Do drain hit points from player shtick
*/ */
drain(ymin, ymax, xmin, xmax) void
int ymin, ymax, xmin, xmax; drain(int ymin, int ymax, int xmin, int xmax)
{ {
register int i, j, count; register int i, j, count;
register struct thing *ick; register struct thing *ick;
@ -745,8 +744,8 @@ int ymin, ymax, xmin, xmax;
/* /*
* initialize a stick * initialize a stick
*/ */
fix_stick(cur) void
register struct object *cur; fix_stick(struct object *cur)
{ {
if (EQUAL(ws_type[cur->o_which], "staff")) { if (EQUAL(ws_type[cur->o_which], "staff")) {
cur->o_weight = 100; cur->o_weight = 100;
@ -787,13 +786,9 @@ register struct object *cur;
* given direction * given direction
*/ */
shoot_bolt(shooter, start, dir, get_points, reason, name, damage) bool
struct thing *shooter; shoot_bolt(struct thing *shooter, coord start, coord dir, bool get_points,
coord start, dir; short reason, char *name, int damage)
bool get_points;
short reason;
char *name;
int damage;
{ {
register char dirch = 0, ch; register char dirch = 0, ch;
register bool used, change; register bool used, change;

View file

@ -18,12 +18,13 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
int extras(void);
/* /*
* print out the number of charges on a stick * print out the number of charges on a stick
*/ */
char * char *
charge_str(obj) charge_str(struct object *obj)
register struct object *obj;
{ {
static char buf[20]; static char buf[20];
@ -41,9 +42,7 @@ register struct object *obj;
* inventory. * inventory.
*/ */
char * char *
inv_name(obj, drop) inv_name(struct object *obj, bool drop)
register struct object *obj;
bool drop;
{ {
register char *pb; register char *pb;
@ -296,8 +295,7 @@ bool drop;
* Return the name of a weapon. * Return the name of a weapon.
*/ */
char * char *
weap_name(obj) weap_name(struct object *obj)
register struct object *obj;
{ {
switch (obj->o_type) { switch (obj->o_type) {
case WEAPON: case WEAPON:
@ -325,8 +323,8 @@ register struct object *obj;
* drop: * drop:
* put something down * put something down
*/ */
drop(item) bool
struct linked_list *item; drop(struct linked_list *item)
{ {
register char ch = 0; register char ch = 0;
register struct linked_list *obj, *nobj; register struct linked_list *obj, *nobj;
@ -413,8 +411,8 @@ struct linked_list *item;
/* /*
* do special checks for dropping or unweilding|unwearing|unringing * do special checks for dropping or unweilding|unwearing|unringing
*/ */
dropcheck(op) bool
register struct object *op; dropcheck(struct object *op)
{ {
int save_max; int save_max;
@ -514,8 +512,7 @@ register struct object *op;
* return a new thing * return a new thing
*/ */
struct linked_list * struct linked_list *
new_thing(thing_type) new_thing(int thing_type)
int thing_type;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *cur; register struct object *cur;
@ -710,8 +707,7 @@ int thing_type;
* provide a new item tailored to specification * provide a new item tailored to specification
*/ */
struct linked_list * struct linked_list *
spec_item(type, which, hit, damage) spec_item(int type, int which, int hit, int damage)
int type, which, hit, damage;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;
@ -787,9 +783,8 @@ int type, which, hit, damage;
/* /*
* pick an item out of a list of nitems possible magic items * pick an item out of a list of nitems possible magic items
*/ */
pick_one(magic, nitems) int
register struct magic_item *magic; pick_one(struct magic_item *magic, int nitems)
int nitems;
{ {
register struct magic_item *end; register struct magic_item *end;
register int i; register int i;
@ -821,8 +816,7 @@ int nitems;
*/ */
char * char *
blesscurse(flags) blesscurse(int flags)
int flags;
{ {
if (flags & ISKNOW) { if (flags & ISKNOW) {
if (flags & ISCURSED) return("cursed "); if (flags & ISCURSED) return("cursed ");
@ -836,7 +830,8 @@ int flags;
* extras: * extras:
* Return the number of extra items to be created * Return the number of extra items to be created
*/ */
extras() int
extras(void)
{ {
reg int i; reg int i;

View file

@ -14,17 +14,20 @@
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
#include <ctype.h>
#include <string.h> #include <string.h>
bool open_market(void);
void trans_line(void);
char *typ_name(struct object *obj);
/* /*
* buy_it: * buy_it:
* Buy the item on which the hero stands * Buy the item on which the hero stands
*/ */
buy_it() void
buy_it(void)
{ {
reg int wh; reg int wh;
struct linked_list *item; struct linked_list *item;
@ -77,7 +80,8 @@ buy_it()
* do_post: * do_post:
* Put a trading post room and stuff on the screen * Put a trading post room and stuff on the screen
*/ */
do_post() void
do_post(void)
{ {
coord tp; coord tp;
reg int i; reg int i;
@ -124,8 +128,8 @@ do_post()
* get_worth: * get_worth:
* Calculate an objects worth in gold * Calculate an objects worth in gold
*/ */
get_worth(obj) int
reg struct object *obj; get_worth(struct object *obj)
{ {
reg int worth, wh; reg int worth, wh;
@ -195,7 +199,8 @@ reg struct object *obj;
* open_market: * open_market:
* Retruns TRUE when ok do to transacting * Retruns TRUE when ok do to transacting
*/ */
open_market() bool
open_market(void)
{ {
if (trader >= MAXPURCH && !wizard) { if (trader >= MAXPURCH && !wizard) {
msg("The market is closed. The stairs are that-a-way."); msg("The market is closed. The stairs are that-a-way.");
@ -210,7 +215,8 @@ open_market()
* price_it: * price_it:
* Price the object that the hero stands on * Price the object that the hero stands on
*/ */
price_it() bool
price_it(void)
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -244,7 +250,8 @@ price_it()
* sell_it: * sell_it:
* Sell an item to the trading post * Sell an item to the trading post
*/ */
sell_it() void
sell_it(void)
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -291,7 +298,8 @@ sell_it()
* trans_line: * trans_line:
* Show how many transactions the hero has left * Show how many transactions the hero has left
*/ */
trans_line() void
trans_line(void)
{ {
if (!wizard) if (!wizard)
sprintf(prbuf,"You have %d transactions remaining.", sprintf(prbuf,"You have %d transactions remaining.",
@ -309,8 +317,7 @@ trans_line()
* Return the name for this type of object * Return the name for this type of object
*/ */
char * char *
typ_name(obj) typ_name(struct object *obj)
reg struct object *obj;
{ {
static char buff[20]; static char buff[20];
reg int wh; reg int wh;

View file

@ -22,7 +22,8 @@
* aggravate all the monsters on this level * aggravate all the monsters on this level
*/ */
aggravate() void
aggravate(void)
{ {
register struct linked_list *mi; register struct linked_list *mi;
@ -35,8 +36,8 @@ aggravate()
* returns true if the hero can see a certain coordinate. * returns true if the hero can see a certain coordinate.
*/ */
cansee(y, x) bool
register int y, x; cansee(int y, int x)
{ {
register struct room *rer; register struct room *rer;
register int radius; register int radius;
@ -93,8 +94,7 @@ static struct {
}; };
long long
check_level(get_spells) check_level(bool get_spells)
bool get_spells;
{ {
register int i, j, add = 0; register int i, j, add = 0;
register unsigned long exp; register unsigned long exp;
@ -148,8 +148,8 @@ bool get_spells;
* it keeps track of the highest it has been, just in case * it keeps track of the highest it has been, just in case
*/ */
chg_str(amt) void
register int amt; chg_str(int amt)
{ {
register int ring_str; /* ring strengths */ register int ring_str; /* ring strengths */
register struct stats *ptr; /* for speed */ register struct stats *ptr; /* for speed */
@ -172,7 +172,7 @@ register int amt;
* this routine computes the players current AC without dex bonus's * this routine computes the players current AC without dex bonus's
*/ */
int int
ac_compute() ac_compute(void)
{ {
register int ac; register int ac;
@ -194,7 +194,8 @@ ac_compute()
/* /*
* this routine computes the players current strength * this routine computes the players current strength
*/ */
str_compute() int
str_compute(void)
{ {
if (cur_misc[WEAR_GAUNTLET] != NULL && if (cur_misc[WEAR_GAUNTLET] != NULL &&
cur_misc[WEAR_GAUNTLET]->o_which == MM_G_OGRE) { cur_misc[WEAR_GAUNTLET]->o_which == MM_G_OGRE) {
@ -210,7 +211,8 @@ str_compute()
/* /*
* this routine computes the players current dexterity * this routine computes the players current dexterity
*/ */
dex_compute() int
dex_compute(void)
{ {
if (cur_misc[WEAR_GAUNTLET] != NULL && if (cur_misc[WEAR_GAUNTLET] != NULL &&
cur_misc[WEAR_GAUNTLET]->o_which == MM_G_DEXTERITY) { cur_misc[WEAR_GAUNTLET]->o_which == MM_G_DEXTERITY) {
@ -229,9 +231,8 @@ dex_compute()
* Check to see if the move is legal if it is diagonal * Check to see if the move is legal if it is diagonal
*/ */
diag_ok(sp, ep, flgptr) bool
register coord *sp, *ep; diag_ok(coord *sp, coord *ep, struct thing *flgptr)
struct thing *flgptr;
{ {
register int numpaths = 0; register int numpaths = 0;
@ -252,7 +253,8 @@ struct thing *flgptr;
* He wants to eat something, so let him try * He wants to eat something, so let him try
*/ */
eat() void
eat(void)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -282,10 +284,7 @@ eat()
* pick a random position around the give (y, x) coordinates * pick a random position around the give (y, x) coordinates
*/ */
coord * coord *
fallpos(pos, be_clear, range) fallpos(coord *pos, bool be_clear, int range)
register coord *pos;
bool be_clear;
int range;
{ {
register int tried, i, j; register int tried, i, j;
register char ch; register char ch;
@ -364,9 +363,7 @@ int range;
*/ */
struct linked_list * struct linked_list *
find_mons(y, x) find_mons(int y, int x)
register int y;
register int x;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *th; register struct thing *th;
@ -386,9 +383,7 @@ register int x;
*/ */
struct linked_list * struct linked_list *
find_obj(y, x) find_obj(int y, int x)
register int y;
register int x;
{ {
register struct linked_list *obj; register struct linked_list *obj;
register struct object *op; register struct object *op;
@ -406,7 +401,8 @@ register int x;
/* /*
* set up the direction co_ordinate for use in varios "prefix" commands * set up the direction co_ordinate for use in varios "prefix" commands
*/ */
get_dir() bool
get_dir(void)
{ {
register char *prompt; register char *prompt;
register bool gotit; register bool gotit;
@ -446,8 +442,8 @@ get_dir()
/* /*
* see if the object is one of the currently used items * see if the object is one of the currently used items
*/ */
is_current(obj) bool
register struct object *obj; is_current(struct object *obj)
{ {
if (obj == NULL) if (obj == NULL)
return FALSE; return FALSE;
@ -483,11 +479,12 @@ register struct object *obj;
/* /*
* Look: * Look:
* A quick glance all around the player * A quick glance all around the player
* wakeup: Should we wake up monsters
* runend: At end of a run -- for mazes
*/ */
look(wakeup, runend) void
bool wakeup; /* Should we wake up monsters */ look(bool wakeup, bool runend)
bool runend; /* At end of a run -- for mazes */
{ {
register int x, y, radius; register int x, y, radius;
register char ch, och; register char ch, och;
@ -738,8 +735,8 @@ bool runend; /* At end of a run -- for mazes */
* The guy just magically went up a level. * The guy just magically went up a level.
*/ */
raise_level(get_spells) void
bool get_spells; raise_level(bool get_spells)
{ {
unsigned long test; /* Next level -- be sure it is not an overflow */ unsigned long test; /* Next level -- be sure it is not an overflow */
@ -766,11 +763,12 @@ static int st_matrix[5][5] = {
/* /*
* save: * save:
* See if a creature saves against something * See if a creature saves against something
* which: which type of save
* who: who is saving
* adj: saving throw adjustment
*/ */
save(which, who, adj) bool
int which; /* which type of save */ save(int which, struct thing *who, int adj)
struct thing *who; /* who is saving */
int adj; /* saving throw adjustment */
{ {
register int need, level; register int need, level;
@ -814,8 +812,8 @@ int adj; /* saving throw adjustment */
* Figure out what a secret door looks like. * Figure out what a secret door looks like.
*/ */
secretdoor(y, x) char
register int y, x; secretdoor(int y, int x)
{ {
register int i; register int i;
register struct room *rp; register struct room *rp;
@ -838,9 +836,8 @@ register int y, x;
/* /*
* copy string using unctrl for things * copy string using unctrl for things
*/ */
strucpy(s1, s2, len) void
register char *s1, *s2; strucpy(char *s1, char *s2, int len)
register int len;
{ {
register char *sp; register char *sp;
@ -859,8 +856,7 @@ register int len;
*/ */
char * char *
tr_name(ch) tr_name(char ch)
char ch;
{ {
register char *s = NULL; register char *s = NULL;
@ -890,8 +886,7 @@ char ch;
* for printfs: if string starts with a vowel, return "n" for an "an" * for printfs: if string starts with a vowel, return "n" for an "an"
*/ */
char * char *
vowelstr(str) vowelstr(char *str)
register char *str;
{ {
switch (*str) switch (*str)
{ {
@ -911,7 +906,8 @@ register char *str;
* Do nothing but let other things happen * Do nothing but let other things happen
*/ */
waste_time() void
waste_time(void)
{ {
if (inwhgt) /* if from wghtchk then done */ if (inwhgt) /* if from wghtchk then done */
return; return;

View file

@ -23,10 +23,8 @@
* do the actual motion on the screen done by an object traveling * do the actual motion on the screen done by an object traveling
* across the room * across the room
*/ */
do_motion(obj, ydelta, xdelta, tp) void
register struct object *obj; do_motion(struct object *obj, int ydelta, int xdelta, struct thing *tp)
register int ydelta, xdelta;
register struct thing *tp;
{ {
/* /*
@ -70,9 +68,8 @@ register struct thing *tp;
* Drop an item someplace around here. * Drop an item someplace around here.
*/ */
fall(item, pr) void
register struct linked_list *item; fall(struct linked_list *item, bool pr)
bool pr;
{ {
register struct object *obj; register struct object *obj;
register struct room *rp; register struct room *rp;
@ -116,10 +113,8 @@ bool pr;
* Does the missile hit the monster * Does the missile hit the monster
*/ */
hit_monster(y, x, obj, tp) bool
register int y, x; hit_monster(int y, int x, struct object *obj, struct thing *tp)
struct object *obj;
register struct thing *tp;
{ {
static coord mp; static coord mp;
@ -144,9 +139,8 @@ register struct thing *tp;
* Set up the initial goodies for a weapon * Set up the initial goodies for a weapon
*/ */
init_weapon(weap, type) void
register struct object *weap; init_weapon(struct object *weap, char type)
char type;
{ {
register struct init_weps *iwp; register struct init_weps *iwp;
@ -169,10 +163,8 @@ char type;
* Fire a missile in a given direction * Fire a missile in a given direction
*/ */
missile(ydelta, xdelta, item, tp) void
int ydelta, xdelta; missile(int ydelta, int xdelta, struct linked_list *item, struct thing *tp)
register struct linked_list *item;
register struct thing *tp;
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *nitem; register struct linked_list *nitem;
@ -247,8 +239,7 @@ register struct thing *tp;
*/ */
char * char *
num(n1, n2) num(int n1, int n2)
register int n1, n2;
{ {
static char numbuf[LINELEN]; static char numbuf[LINELEN];
@ -268,7 +259,8 @@ register int n1, n2;
* Pull out a certain weapon * Pull out a certain weapon
*/ */
wield() void
wield(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj, *oweapon; register struct object *obj, *oweapon;

View file

@ -23,7 +23,8 @@
* Get the armor off of the players back * Get the armor off of the players back
*/ */
take_off() void
take_off(void)
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *item; register struct linked_list *item;
@ -52,7 +53,8 @@ take_off()
* The player wants to wear something, so let him/her put it on. * The player wants to wear something, so let him/her put it on.
*/ */
wear() void
wear(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;

View file

@ -15,6 +15,7 @@
#include "curses.h" #include "curses.h"
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "rogue.h" #include "rogue.h"
@ -23,9 +24,8 @@
* create_obj: * create_obj:
* Create any object for wizard, scroll, magician, or cleric * Create any object for wizard, scroll, magician, or cleric
*/ */
create_obj(prompt, which_item, which_type) void
bool prompt; create_obj(bool prompt, int which_item, int which_type)
int which_item, which_type;
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -311,7 +311,8 @@ int which_item, which_type;
* getbless: * getbless:
* Get a blessing for a wizards object * Get a blessing for a wizards object
*/ */
getbless() int
getbless(void)
{ {
reg char bless; reg char bless;
@ -328,7 +329,8 @@ getbless()
/* /*
* get a non-monster death type * get a non-monster death type
*/ */
getdeath() int
getdeath(void)
{ {
register int i; register int i;
int which_death; int which_death;
@ -358,8 +360,8 @@ getdeath()
/* /*
* make a monster for the wizard * make a monster for the wizard
*/ */
makemonster(create) short
bool create; makemonster(bool create)
{ {
register int i; register int i;
register short which_monst; register short which_monst;
@ -368,7 +370,7 @@ bool create;
/* Print out the monsters */ /* Print out the monsters */
while (num_monst > 0) { while (num_monst > 0) {
register left_limit; register int left_limit;
if (num_monst < num_lines) left_limit = (num_monst+1)/2; if (num_monst < num_lines) left_limit = (num_monst+1)/2;
else left_limit = num_lines/2; else left_limit = num_lines/2;
@ -430,7 +432,8 @@ get_monst:
* see if user knows password * see if user knows password
*/ */
passwd() bool
passwd(void)
{ {
register char *sp, c; register char *sp, c;
char buf[LINELEN]; char buf[LINELEN];
@ -457,7 +460,8 @@ passwd()
* Bamf the hero someplace else * Bamf the hero someplace else
*/ */
teleport() int
teleport(void)
{ {
register struct room *new_rp, *old_rp = roomin(&hero); register struct room *new_rp, *old_rp = roomin(&hero);
register int rm; register int rm;
@ -525,8 +529,8 @@ teleport()
* What a certin object is * What a certin object is
*/ */
whatis(what) void
struct linked_list *what; whatis(struct linked_list *what)
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *item; register struct linked_list *item;

View file

@ -52,6 +52,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
unsigned long int md_htonl(unsigned long int x);
unsigned long int md_ntohl(unsigned long int x);
#ifdef DEBUG #ifdef DEBUG
# include <stdio.h> # include <stdio.h>
#endif #endif

View file

@ -18,12 +18,21 @@
#include "rogue.h" #include "rogue.h"
#define MAXINT INT_MAX #define MAXINT INT_MAX
#define MININT INT_MIN #define MININT INT_MIN
void m_breathe(struct thing *tp);
void m_select(struct thing *th, bool flee);
void m_sonic(struct thing *tp);
void m_spell(struct thing *tp);
void m_summon(struct thing *tp);
bool m_use_it(struct thing *tp, bool flee, struct room *rer, struct room *ree);
bool m_use_pack(struct thing *monster, coord *monst_pos, coord *defend_pos,
int dist, coord *shoot_dir);
/* /*
* Did we disrupt a spell? * Did we disrupt a spell?
*/ */
dsrpt_monster(tp, always, see_him) void
register struct thing *tp; dsrpt_monster(struct thing *tp, bool always, bool see_him)
bool always, see_him;
{ {
switch (tp->t_action) { switch (tp->t_action) {
case A_SUMMON: case A_SUMMON:
@ -52,7 +61,8 @@ bool always, see_him;
} }
} }
dsrpt_player() void
dsrpt_player(void)
{ {
int which, action; int which, action;
struct linked_list *item; struct linked_list *item;
@ -81,7 +91,7 @@ dsrpt_player()
if (purse > 0) { if (purse > 0) {
msg("Your gold goes flying everywhere!"); msg("Your gold goes flying everywhere!");
do { do {
item = spec_item(GOLD, NULL, NULL, NULL); item = spec_item(GOLD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_count = min(purse, rnd(10)+1); obj->o_count = min(purse, rnd(10)+1);
purse -= obj->o_count; purse -= obj->o_count;
@ -120,8 +130,8 @@ dsrpt_player()
* Otherwise, let it perform its chosen action. * Otherwise, let it perform its chosen action.
*/ */
m_act(tp) void
register struct thing *tp; m_act(struct thing *tp)
{ {
struct object *obj; struct object *obj;
bool flee; /* Are we scared? */ bool flee; /* Are we scared? */
@ -235,8 +245,8 @@ register struct thing *tp;
* Breathe in the chosen direction. * Breathe in the chosen direction.
*/ */
m_breathe(tp) void
register struct thing *tp; m_breathe(struct thing *tp)
{ {
register int damage; register int damage;
register char *breath = ""; register char *breath = "";
@ -344,11 +354,11 @@ register struct thing *tp;
/* /*
* m_select: * m_select:
* Select an action for the monster. * Select an action for the monster.
* flee: True if running away or player is inaccessible in wall
*/ */
m_select(th, flee) void
register struct thing *th; m_select(struct thing *th, bool flee)
register bool flee; /* True if running away or player is inaccessible in wall */
{ {
register struct room *rer, *ree; /* room of chaser, room of chasee */ register struct room *rer, *ree; /* room of chaser, room of chasee */
int dist = MININT; int dist = MININT;
@ -486,8 +496,8 @@ register bool flee; /* True if running away or player is inaccessible in wall */
* The monster is sounding a sonic blast. * The monster is sounding a sonic blast.
*/ */
m_sonic(tp) void
register struct thing *tp; m_sonic(struct thing *tp)
{ {
register int damage; register int damage;
static struct object blast = static struct object blast =
@ -515,8 +525,8 @@ register struct thing *tp;
* The monster casts a spell. Currently this is limited to * The monster casts a spell. Currently this is limited to
* magic missile. * magic missile.
*/ */
m_spell(tp) void
register struct thing *tp; m_spell(struct thing *tp)
{ {
static struct object missile = static struct object missile =
{ {
@ -538,8 +548,8 @@ register struct thing *tp;
* Summon aid. * Summon aid.
*/ */
m_summon(tp) void
register struct thing *tp; m_summon(struct thing *tp)
{ {
register char *helpname, *mname; register char *helpname, *mname;
int fail, numsum; int fail, numsum;
@ -612,10 +622,7 @@ register struct thing *tp;
*/ */
bool bool
m_use_it(tp, flee, rer, ree) m_use_it(struct thing *tp, bool flee, struct room *rer, struct room *ree)
register struct thing *tp;
bool flee;
register struct room *rer, *ree;
{ {
int dist; int dist;
register coord *ee = tp->t_dest, *er = &tp->t_pos; register coord *ee = tp->t_dest, *er = &tp->t_pos;
@ -777,14 +784,15 @@ register struct room *rer, *ree;
/* /*
* runners: * runners:
* Make all the awake monsters try to do something. * Make all the awake monsters try to do something.
* segments: Number of segments since last called
*/ */
runners(segments) int
int segments; /* Number of segments since last called */ runners(int segments)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *tp = NULL; register struct thing *tp = NULL;
register min_time = 20; /* Minimum time until a monster can act */ register int min_time = 20; /* Minimum time until a monster can act */
/* /*
* loop thru the list of running (wandering) monsters and see what * loop thru the list of running (wandering) monsters and see what
@ -870,11 +878,8 @@ int segments; /* Number of segments since last called */
* Only care about relics and wands for now. * Only care about relics and wands for now.
*/ */
bool bool
m_use_pack(monster, monst_pos, defend_pos, dist, shoot_dir) m_use_pack(struct thing *monster, coord *monst_pos, coord *defend_pos,
register struct thing *monster; int dist, coord *shoot_dir)
register coord *monst_pos, *defend_pos;
register int dist;
register coord *shoot_dir;
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *pitem, *relic, *stick; register struct linked_list *pitem, *relic, *stick;

View file

@ -19,11 +19,13 @@
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h>
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
#define MAXINT INT_MAX #define MAXINT INT_MAX
#define MININT INT_MIN #define MININT INT_MIN
bool straight_shot(int ery, int erx, int eey, int eex, coord *shooting);
/* /*
* Canblink checks if the monster can teleport (blink). If so, it will * Canblink checks if the monster can teleport (blink). If so, it will
@ -31,8 +33,7 @@
*/ */
bool bool
can_blink(tp) can_blink(struct thing *tp)
register struct thing *tp;
{ {
register int y, x, index=9; register int y, x, index=9;
coord tryp; /* To hold the coordinates for use in diag_ok */ coord tryp; /* To hold the coordinates for use in diag_ok */
@ -127,8 +128,7 @@ register struct thing *tp;
*/ */
coord * coord *
can_shoot(er, ee) can_shoot(coord *er, coord *ee)
register coord *er, *ee;
{ {
static coord shoot_dir; static coord shoot_dir;
@ -147,16 +147,14 @@ register coord *er, *ee;
* chase: * chase:
* Find the spot for the chaser(er) to move closer to the * Find the spot for the chaser(er) to move closer to the
* chasee(ee). Rer is the room of the chaser, and ree is the * chasee(ee). Rer is the room of the chaser, and ree is the
* room of the creature being chased (chasee). * room of the creature being chased (chasee). Flee is true if
* destination (ee) is player and monster is running away
* or the player is in a wall and the monster can't get to it
*/ */
chase(tp, ee, rer, ree, flee) void
register struct thing *tp; chase(struct thing *tp, coord *ee, struct room *rer, struct room *ree,
register coord *ee; bool flee)
register struct room *rer, *ree;
bool flee; /* True if destination (ee) is player and monster is running away
* or the player is in a wall and the monster can't get to it
*/
{ {
int dist, thisdist, monst_dist = MAXINT; int dist, thisdist, monst_dist = MAXINT;
register coord *er = &tp->t_pos; register coord *er = &tp->t_pos;
@ -494,8 +492,8 @@ bool flee; /* True if destination (ee) is player and monster is running away
* Make one thing chase another. * Make one thing chase another.
*/ */
do_chase(th) void
register struct thing *th; do_chase(struct thing *th)
{ {
register struct room *orig_rer, /* Original room of chaser */ register struct room *orig_rer, /* Original room of chaser */
*new_room; /* new room of monster */ *new_room; /* new room of monster */
@ -803,8 +801,7 @@ register struct thing *th;
*/ */
struct linked_list * struct linked_list *
get_hurl(tp) get_hurl(struct thing *tp)
register struct thing *tp;
{ {
struct linked_list *arrow=NULL, *bolt=NULL, *rock=NULL, struct linked_list *arrow=NULL, *bolt=NULL, *rock=NULL,
*spear = NULL, *dagger=NULL, *dart=NULL, *aklad=NULL; *spear = NULL, *dagger=NULL, *dart=NULL, *aklad=NULL;
@ -851,9 +848,8 @@ register struct thing *tp;
* Set a monster running after something * Set a monster running after something
*/ */
runto(runner, spot) void
register struct thing *runner; runto(struct thing *runner, coord *spot)
coord *spot;
{ {
if (on(*runner, ISSTONE)) if (on(*runner, ISSTONE))
return; return;
@ -881,9 +877,7 @@ coord *spot;
*/ */
bool bool
straight_shot(ery, erx, eey, eex, shooting) straight_shot(int ery, int erx, int eey, int eex, coord *shooting)
register int ery, erx, eey, eex;
register coord *shooting;
{ {
register int dy, dx; /* Deltas */ register int dy, dx; /* Deltas */
char ch; char ch;

View file

@ -29,12 +29,23 @@
extern struct uwdata wdata; extern struct uwdata wdata;
#endif #endif
void display(void);
void help(void);
void identify(char ch);
void d_level(void);
void u_level(void);
void shell(void);
void nameit(void);
void namemonst(void);
void count_gold(void);
/* /*
* command: * command:
* Process the user commands * Process the user commands
*/ */
command() void
command(void)
{ {
unsigned char ch; unsigned char ch;
struct linked_list *item; struct linked_list *item;
@ -267,8 +278,8 @@ command()
after = FALSE; after = FALSE;
} }
when C_COUNT : count_gold(); when C_COUNT : count_gold();
when C_QUAFF : quaff(-1, NULL, NULL, TRUE); when C_QUAFF : quaff(-1, 0, 0, TRUE);
when C_READ : read_scroll(-1, NULL, TRUE); when C_READ : read_scroll(-1, 0, TRUE);
when C_EAT : eat(); when C_EAT : eat();
when C_WIELD : wield(); when C_WIELD : wield();
when C_WEAR : wear(); when C_WEAR : wear();
@ -280,7 +291,7 @@ command()
when '>' : after = FALSE; d_level(); when '>' : after = FALSE; d_level();
when '<' : after = FALSE; u_level(); when '<' : after = FALSE; u_level();
when '?' : after = FALSE; help(); when '?' : after = FALSE; help();
when '/' : after = FALSE; identify(NULL); when '/' : after = FALSE; identify(0);
when C_USE : use_mm(-1); when C_USE : use_mm(-1);
when CTRL('T') : when CTRL('T') :
if (player.t_action == A_NIL) { if (player.t_action == A_NIL) {
@ -315,7 +326,7 @@ command()
search(FALSE, FALSE); search(FALSE, FALSE);
player.t_action = A_NIL; player.t_action = A_NIL;
} }
when C_ZAP : if (!player_zap(NULL, FALSE)) when C_ZAP : if (!player_zap(0, FALSE))
after=FALSE; after=FALSE;
when C_PRAY : pray(); when C_PRAY : pray();
when C_CHANT : chant(); when C_CHANT : chant();
@ -553,7 +564,8 @@ command()
* tell the player what is at a certain coordinates assuming * tell the player what is at a certain coordinates assuming
* it can be seen. * it can be seen.
*/ */
display() void
display(void)
{ {
coord c; coord c;
struct linked_list *item; struct linked_list *item;
@ -587,8 +599,7 @@ display()
*/ */
void void
quit(sig) quit(int sig)
int sig;
{ {
/* /*
* Reset the signal in case we got here via an interrupt * Reset the signal in case we got here via an interrupt
@ -628,8 +639,7 @@ int sig;
*/ */
void void
bugkill(sig) bugkill(int sig)
int sig;
{ {
signal(sig, quit); /* If we get it again, give up */ signal(sig, quit); /* If we get it again, give up */
death(D_SIGNAL); /* Killed by a bug */ death(D_SIGNAL); /* Killed by a bug */
@ -641,8 +651,8 @@ int sig;
* Player gropes about him to find hidden things. * Player gropes about him to find hidden things.
*/ */
search(is_thief, door_chime) void
register bool is_thief, door_chime; search(bool is_thief, bool door_chime)
{ {
register int x, y; register int x, y;
register char ch, /* The trap or door character */ register char ch, /* The trap or door character */
@ -752,7 +762,8 @@ register bool is_thief, door_chime;
* Give single character help, or the whole mess if he wants it * Give single character help, or the whole mess if he wants it
*/ */
help() void
help(void)
{ {
register struct h_list *strp = helpstr; register struct h_list *strp = helpstr;
#ifdef WIZARD #ifdef WIZARD
@ -844,8 +855,8 @@ help()
* Tell the player what a certain thing is. * Tell the player what a certain thing is.
*/ */
identify(ch) void
register char ch; identify(char ch)
{ {
register char *str; register char *str;
@ -907,6 +918,7 @@ register char ch;
* He wants to go down a level * He wants to go down a level
*/ */
void
d_level() d_level()
{ {
bool no_phase=FALSE; bool no_phase=FALSE;
@ -958,7 +970,8 @@ d_level()
* He wants to go up a level * He wants to go up a level
*/ */
u_level() void
u_level(void)
{ {
bool no_phase = FALSE; bool no_phase = FALSE;
register struct linked_list *item; register struct linked_list *item;
@ -1016,7 +1029,8 @@ u_level()
* Let him escape for a while * Let him escape for a while
*/ */
shell() void
shell(void)
{ {
register char *sh; register char *sh;
@ -1050,7 +1064,8 @@ shell()
/* /*
* see what we want to name -- an item or a monster. * see what we want to name -- an item or a monster.
*/ */
nameit() void
nameit(void)
{ {
char answer; char answer;
@ -1073,9 +1088,8 @@ nameit()
/* /*
* allow a user to call a potion, scroll, or ring something * allow a user to call a potion, scroll, or ring something
*/ */
nameitem(item, mark) void
struct linked_list *item; nameitem(struct linked_list *item, bool mark)
bool mark;
{ {
register struct object *obj; register struct object *obj;
register char **guess = NULL, *elsewise = NULL; register char **guess = NULL, *elsewise = NULL;
@ -1161,7 +1175,8 @@ bool mark;
/* Name a monster */ /* Name a monster */
namemonst() void
namemonst(void)
{ {
register struct thing *tp; register struct thing *tp;
struct linked_list *item; struct linked_list *item;
@ -1206,7 +1221,8 @@ namemonst()
msg("There is no monster there to name."); msg("There is no monster there to name.");
} }
count_gold() void
count_gold(void)
{ {
if (player.t_action != C_COUNT) { if (player.t_action != C_COUNT) {
msg("You take a break to count your money..."); msg("You take a break to count your money...");

View file

@ -44,7 +44,7 @@ int fusecnt = 0;
* Find an empty slot in the daemon list * Find an empty slot in the daemon list
*/ */
struct delayed_action * struct delayed_action *
d_slot() d_slot(void)
{ {
reg int i; reg int i;
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -60,7 +60,7 @@ d_slot()
* Find an empty slot in the fuses list * Find an empty slot in the fuses list
*/ */
struct delayed_action * struct delayed_action *
f_slot() f_slot(void)
{ {
reg int i; reg int i;
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -78,8 +78,7 @@ f_slot()
* Find a particular slot in the table * Find a particular slot in the table
*/ */
struct delayed_action * struct delayed_action *
find_slot(func) find_slot(int (*func)())
reg int (*func)();
{ {
reg int i; reg int i;
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -95,8 +94,8 @@ reg int (*func)();
* start_daemon: * start_daemon:
* Start a daemon, takes a function. * Start a daemon, takes a function.
*/ */
start_daemon(func, arg, type) void
reg int arg, type, (*func)(); start_daemon(int (*func)(), int arg, int type)
{ {
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -115,8 +114,8 @@ reg int arg, type, (*func)();
* kill_daemon: * kill_daemon:
* Remove a daemon from the list * Remove a daemon from the list
*/ */
kill_daemon(func) void
reg int (*func)(); kill_daemon(int (*func)())
{ {
reg struct delayed_action *dev; reg struct delayed_action *dev;
reg int i; reg int i;
@ -142,8 +141,8 @@ reg int (*func)();
* Run all the daemons that are active with the current flag, * Run all the daemons that are active with the current flag,
* passing the argument to the function. * passing the argument to the function.
*/ */
do_daemons(flag) void
reg int flag; do_daemons(int flag)
{ {
reg struct delayed_action *dev; reg struct delayed_action *dev;
@ -163,8 +162,8 @@ reg int flag;
* fuse: * fuse:
* Start a fuse to go off in a certain number of turns * Start a fuse to go off in a certain number of turns
*/ */
fuse(func, arg, time, type) void
reg int (*func)(), arg, time, type; fuse(int (*func)(), int arg, int time, int type)
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -183,8 +182,8 @@ reg int (*func)(), arg, time, type;
* lengthen: * lengthen:
* Increase the time until a fuse goes off * Increase the time until a fuse goes off
*/ */
lengthen(func, xtime) void
reg int (*func)(), xtime; lengthen(int (*func)(), int xtime)
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -198,8 +197,8 @@ reg int (*func)(), xtime;
* extinguish: * extinguish:
* Put out a fuse * Put out a fuse
*/ */
extinguish(func) void
reg int (*func)(); extinguish(int (*func)())
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -217,8 +216,8 @@ reg int (*func)();
* do_fuses: * do_fuses:
* Decrement counters and start needed fuses * Decrement counters and start needed fuses
*/ */
do_fuses(flag) void
reg int flag; do_fuses(int flag)
{ {
reg struct delayed_action *wire; reg struct delayed_action *wire;
@ -245,8 +244,9 @@ reg int flag;
* activity: * activity:
* Show wizard number of demaons and memory blocks used * Show wizard number of demaons and memory blocks used
*/ */
activity() void
activity(void)
{ {
msg("Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", msg("Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d",
demoncnt,fusecnt,total,md_memused(0)); demoncnt,fusecnt,total,md_memused());
} }

View file

@ -25,8 +25,8 @@
* A healing daemon that restors hit points after rest * A healing daemon that restors hit points after rest
*/ */
doctor(tp) void
register struct thing *tp; doctor(struct thing *tp)
{ {
register int ohp; register int ohp;
register int limit, new_points; register int limit, new_points;
@ -108,7 +108,8 @@ register struct thing *tp;
* Called when it is time to start rolling for wandering monsters * Called when it is time to start rolling for wandering monsters
*/ */
swander() void
swander(void)
{ {
start_daemon(rollwand, 0, BEFORE); start_daemon(rollwand, 0, BEFORE);
} }
@ -120,7 +121,8 @@ swander()
int between = 0; int between = 0;
rollwand() void
rollwand(void)
{ {
if (++between >= 4) if (++between >= 4)
@ -140,7 +142,8 @@ rollwand()
/* /*
* this function is a daemon called each turn when the character is a thief * this function is a daemon called each turn when the character is a thief
*/ */
trap_look() void
trap_look(void)
{ {
if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl)) if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl))
search(TRUE, FALSE); search(TRUE, FALSE);
@ -151,7 +154,8 @@ trap_look()
* Release the poor player from his confusion * Release the poor player from his confusion
*/ */
unconfuse() void
unconfuse(void)
{ {
turn_off(player, ISHUH); turn_off(player, ISHUH);
msg("You feel less confused now"); msg("You feel less confused now");
@ -162,7 +166,8 @@ unconfuse()
* unsee: * unsee:
* He lost his see invisible power * He lost his see invisible power
*/ */
unsee() void
unsee(void)
{ {
if (!ISWEARING(R_SEEINVIS)) { if (!ISWEARING(R_SEEINVIS)) {
turn_off(player, CANSEE); turn_off(player, CANSEE);
@ -175,7 +180,8 @@ unsee()
* Remove to-hit handicap from player * Remove to-hit handicap from player
*/ */
unstink() void
unstink(void)
{ {
turn_off(player, HASSTINK); turn_off(player, HASSTINK);
} }
@ -185,7 +191,8 @@ unstink()
* Player is no longer immune to confusion * Player is no longer immune to confusion
*/ */
unclrhead() void
unclrhead(void)
{ {
turn_off(player, ISCLEAR); turn_off(player, ISCLEAR);
msg("The blue aura about your head fades away."); msg("The blue aura about your head fades away.");
@ -196,7 +203,8 @@ unclrhead()
* Player can no longer walk through walls * Player can no longer walk through walls
*/ */
unphase() void
unphase(void)
{ {
turn_off(player, CANINWALL); turn_off(player, CANINWALL);
msg("Your dizzy feeling leaves you."); msg("Your dizzy feeling leaves you.");
@ -208,7 +216,8 @@ unphase()
* Player can no longer fly * Player can no longer fly
*/ */
land() void
land(void)
{ {
turn_off(player, ISFLY); turn_off(player, ISFLY);
msg("You regain your normal weight"); msg("You regain your normal weight");
@ -220,7 +229,8 @@ land()
* He gets his sight back * He gets his sight back
*/ */
sight() void
sight(void)
{ {
if (on(player, ISBLIND)) if (on(player, ISBLIND))
{ {
@ -237,8 +247,7 @@ sight()
*/ */
void void
res_strength(howmuch) res_strength(int howmuch)
int howmuch;
{ {
/* If lost_str is non-zero, restore that amount of strength, /* If lost_str is non-zero, restore that amount of strength,
@ -262,7 +271,8 @@ int howmuch;
* End the hasting * End the hasting
*/ */
nohaste() void
nohaste(void)
{ {
turn_off(player, ISHASTE); turn_off(player, ISHASTE);
msg("You feel yourself slowing down."); msg("You feel yourself slowing down.");
@ -273,7 +283,8 @@ nohaste()
* End the slowing * End the slowing
*/ */
noslow() void
noslow(void)
{ {
turn_off(player, ISSLOW); turn_off(player, ISSLOW);
msg("You feel yourself speeding up."); msg("You feel yourself speeding up.");
@ -284,7 +295,8 @@ noslow()
* If this gets called, the player has suffocated * If this gets called, the player has suffocated
*/ */
suffocate() void
suffocate(void)
{ {
death(D_SUFFOCATION); death(D_SUFFOCATION);
} }
@ -292,7 +304,8 @@ suffocate()
/* /*
* digest the hero's food * digest the hero's food
*/ */
stomach() void
stomach(void)
{ {
register int oldfood, old_hunger, food_use, i; register int oldfood, old_hunger, food_use, i;
@ -368,7 +381,8 @@ stomach()
/* /*
* daemon for curing the diseased * daemon for curing the diseased
*/ */
cure_disease() void
cure_disease(void)
{ {
turn_off(player, HASDISEASE); turn_off(player, HASDISEASE);
if (off (player, HASINFEST)) if (off (player, HASINFEST))
@ -380,7 +394,8 @@ cure_disease()
* appear: * appear:
* Become visible again * Become visible again
*/ */
appear() void
appear(void)
{ {
turn_off(player, ISINVIS); turn_off(player, ISINVIS);
PLAYER = VPLAYER; PLAYER = VPLAYER;
@ -391,7 +406,8 @@ appear()
* dust_appear: * dust_appear:
* dust of disappearance wears off * dust of disappearance wears off
*/ */
dust_appear() void
dust_appear(void)
{ {
turn_off(player, ISINVIS); turn_off(player, ISINVIS);
PLAYER = VPLAYER; PLAYER = VPLAYER;
@ -402,7 +418,8 @@ dust_appear()
* unchoke: * unchoke:
* the effects of "dust of choking and sneezing" wear off * the effects of "dust of choking and sneezing" wear off
*/ */
unchoke() void
unchoke(void)
{ {
if (!find_slot(unconfuse)) if (!find_slot(unconfuse))
turn_off(player, ISHUH); turn_off(player, ISHUH);
@ -414,8 +431,8 @@ unchoke()
/* /*
* make some potion for the guy in the Alchemy jug * make some potion for the guy in the Alchemy jug
*/ */
alchemy(obj) void
register struct object *obj; alchemy(struct object *obj)
{ {
register struct object *tobj = NULL; register struct object *tobj = NULL;
register struct linked_list *item; register struct linked_list *item;
@ -464,7 +481,8 @@ register struct object *obj;
* otto's irresistable dance wears off * otto's irresistable dance wears off
*/ */
undance() void
undance(void)
{ {
turn_off(player, ISDANCE); turn_off(player, ISDANCE);
msg ("Your feet take a break.....whew!"); msg ("Your feet take a break.....whew!");
@ -473,14 +491,16 @@ undance()
/* /*
* if he has our favorite necklace of strangulation then take damage every turn * if he has our favorite necklace of strangulation then take damage every turn
*/ */
strangle() void
strangle(void)
{ {
if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE); if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE);
} }
/* /*
* if he has on the gauntlets of fumbling he might drop his weapon each turn * if he has on the gauntlets of fumbling he might drop his weapon each turn
*/ */
fumble() void
fumble(void)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -519,21 +539,24 @@ fumble()
/* /*
* this is called each turn the hero has the ring of searching on * this is called each turn the hero has the ring of searching on
*/ */
ring_search() void
ring_search(void)
{ {
search(FALSE, FALSE); search(FALSE, FALSE);
} }
/* /*
* this is called each turn the hero has the ring of teleportation on * this is called each turn the hero has the ring of teleportation on
*/ */
ring_teleport() void
ring_teleport(void)
{ {
if (rnd(100) < 2) teleport(); if (rnd(100) < 2) teleport();
} }
/* /*
* this is called to charge up the quill of Nagrom * this is called to charge up the quill of Nagrom
*/ */
quill_charge() void
quill_charge(void)
{ {
register struct object *tobj = NULL; register struct object *tobj = NULL;
register struct linked_list *item; register struct linked_list *item;
@ -556,7 +579,8 @@ quill_charge()
/* /*
* take the skills away gained (or lost) by the potion of skills * take the skills away gained (or lost) by the potion of skills
*/ */
unskill() void
unskill(void)
{ {
if (pstats.s_lvladj != 0) { if (pstats.s_lvladj != 0) {
pstats.s_lvl -= pstats.s_lvladj; pstats.s_lvl -= pstats.s_lvladj;
@ -569,8 +593,8 @@ unskill()
* charge up the cloak of Emori * charge up the cloak of Emori
*/ */
cloak_charge(obj) void
register struct object *obj; cloak_charge(struct object *obj)
{ {
if (obj->o_charges < 1) if (obj->o_charges < 1)
obj->o_charges = 1; obj->o_charges = 1;
@ -580,7 +604,8 @@ register struct object *obj;
* nofire: * nofire:
* He lost his fire resistance * He lost his fire resistance
*/ */
nofire() void
nofire(void)
{ {
if (!ISWEARING(R_FIRE)) { if (!ISWEARING(R_FIRE)) {
turn_off(player, NOFIRE); turn_off(player, NOFIRE);
@ -592,7 +617,8 @@ nofire()
* nocold: * nocold:
* He lost his cold resistance * He lost his cold resistance
*/ */
nocold() void
nocold(void)
{ {
if (!ISWEARING(R_WARMTH)) { if (!ISWEARING(R_WARMTH)) {
turn_off(player, NOCOLD); turn_off(player, NOCOLD);
@ -604,7 +630,8 @@ nocold()
* nobolt: * nobolt:
* He lost his protection from lightning * He lost his protection from lightning
*/ */
nobolt() void
nobolt(void)
{ {
turn_off(player, NOBOLT); turn_off(player, NOBOLT);
msg("Your skin looses its bluish tint"); msg("Your skin looses its bluish tint");
@ -613,8 +640,8 @@ nobolt()
* eat_gold: * eat_gold:
* an artifact eats gold * an artifact eats gold
*/ */
eat_gold(obj) void
register struct object *obj; eat_gold(struct object *obj)
{ {
if (purse == 1) if (purse == 1)
msg("%s demand you find more gold", inv_name(obj, FALSE)); msg("%s demand you find more gold", inv_name(obj, FALSE));
@ -628,36 +655,39 @@ register struct object *obj;
/* /*
* give the hero back some spell points * give the hero back some spell points
*/ */
spell_recovery() void
spell_recovery(void)
{ {
int time; int time;
time = SPELLTIME - max(17-pstats.s_intel, 0); time = SPELLTIME - max(17-pstats.s_intel, 0);
time = max(time, 5); time = max(time, 5);
if (spell_power > 0) spell_power--; if (spell_power > 0) spell_power--;
fuse(spell_recovery, NULL, time, AFTER); fuse(spell_recovery, 0, time, AFTER);
} }
/* /*
* give the hero back some prayer points * give the hero back some prayer points
*/ */
prayer_recovery() void
prayer_recovery(void)
{ {
int time; int time;
time = SPELLTIME - max(17-pstats.s_wisdom, 0); time = SPELLTIME - max(17-pstats.s_wisdom, 0);
time = max(time, 5); time = max(time, 5);
if (pray_time > 0) pray_time--; if (pray_time > 0) pray_time--;
fuse(prayer_recovery, NULL, time, AFTER); fuse(prayer_recovery, 0, time, AFTER);
} }
/* /*
* give the hero back some chant points * give the hero back some chant points
*/ */
chant_recovery() void
chant_recovery(void)
{ {
int time; int time;
time = SPELLTIME - max(17-pstats.s_wisdom, 0); time = SPELLTIME - max(17-pstats.s_wisdom, 0);
time = max(time, 5); time = max(time, 5);
if (chant_time > 0) chant_time--; if (chant_time > 0) chant_time--;
fuse(chant_recovery, NULL, time, AFTER); fuse(chant_recovery, 0, time, AFTER);
} }

View file

@ -20,7 +20,8 @@
* He wants to eat something, so let him try * He wants to eat something, so let him try
*/ */
eat() void
eat(void)
{ {
register struct linked_list *item; register struct linked_list *item;
int which; int which;

View file

@ -21,11 +21,9 @@
* Check for effects of one thing hitting another thing. Return * Check for effects of one thing hitting another thing. Return
* the reason code if the defender is killed. Otherwise return 0. * the reason code if the defender is killed. Otherwise return 0.
*/ */
effect(att, def, weap, thrown, see_att, see_def) int
register struct thing *att, *def; effect(struct thing *att, struct thing *def, struct object *weap, bool thrown,
struct object *weap; bool see_att, bool see_def)
bool thrown;
register bool see_att, see_def;
{ {
register bool att_player, def_player; register bool att_player, def_player;
char attname[LINELEN+1], defname[LINELEN+1]; char attname[LINELEN+1], defname[LINELEN+1];

View file

@ -20,13 +20,14 @@
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
int packweight(struct thing *tp);
/* /*
* updpack: * updpack:
* Update his pack weight and adjust fooduse accordingly * Update his pack weight and adjust fooduse accordingly
*/ */
updpack(getmax, tp) void
int getmax; updpack(int getmax, struct thing *tp)
struct thing *tp;
{ {
reg int topcarry, curcarry; reg int topcarry, curcarry;
@ -55,8 +56,8 @@ struct thing *tp;
* packweight: * packweight:
* Get the total weight of the hero's pack * Get the total weight of the hero's pack
*/ */
packweight(tp) int
register struct thing *tp; packweight(struct thing *tp)
{ {
reg struct object *obj; reg struct object *obj;
reg struct linked_list *pc; reg struct linked_list *pc;
@ -92,8 +93,8 @@ register struct thing *tp;
* itemweight: * itemweight:
* Get the weight of an object * Get the weight of an object
*/ */
itemweight(wh) int
reg struct object *wh; itemweight(struct object *wh)
{ {
reg int weight; reg int weight;
reg int ac; reg int ac;
@ -123,8 +124,8 @@ reg struct object *wh;
* playenc: * playenc:
* Get hero's carrying ability above norm * Get hero's carrying ability above norm
*/ */
playenc(tp) int
register struct thing *tp; playenc(struct thing *tp)
{ {
register int strength; register int strength;
@ -139,8 +140,8 @@ register struct thing *tp;
* totalenc: * totalenc:
* Get total weight that the hero can carry * Get total weight that the hero can carry
*/ */
totalenc(tp) int
register struct thing *tp; totalenc(struct thing *tp)
{ {
reg int wtotal; reg int wtotal;
@ -162,11 +163,11 @@ register struct thing *tp;
* See if the hero can carry his pack * See if the hero can carry his pack
*/ */
wghtchk() void
wghtchk(void)
{ {
reg int dropchk, err = TRUE; reg int dropchk, err = TRUE;
reg char ch; reg char ch;
int wghtchk();
inwhgt = TRUE; inwhgt = TRUE;
if (pstats.s_pack > pstats.s_carry) { if (pstats.s_pack > pstats.s_carry) {
@ -201,7 +202,8 @@ wghtchk()
* -1 hit for heavy pack weight * -1 hit for heavy pack weight
*/ */
hitweight() int
hitweight(void)
{ {
return(2 - foodlev); return(2 - foodlev);
} }

View file

@ -20,9 +20,18 @@
#include "curses.h" #include "curses.h"
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include "rogue.h" #include "rogue.h"
int hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee, bool back_stab, bool thrown, bool short_msg); bool roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
bool hurl, struct object *cur_weapon, bool back_stab);
void hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool back_stab, bool thrown, bool short_msg);
void miss(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool thrown, bool short_msg);
int add_dam(short str);
int hung_dam(void);
#define CONF_DAMAGE -1 #define CONF_DAMAGE -1
#define PARAL_DAMAGE -2 #define PARAL_DAMAGE -2
#define DEST_DAMAGE -3 #define DEST_DAMAGE -3
@ -31,9 +40,8 @@ int hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee, b
/* /*
* returns true if player has a any chance to hit the monster * returns true if player has a any chance to hit the monster
*/ */
player_can_hit(tp, weap) bool
register struct thing *tp; player_can_hit(struct thing *tp, struct object *weap)
register struct object *weap;
{ {
if (off(*tp, CMAGICHIT) && off(*tp, BMAGICHIT) && off(*tp, MAGICHIT)) if (off(*tp, CMAGICHIT) && off(*tp, BMAGICHIT) && off(*tp, MAGICHIT))
return(TRUE); return(TRUE);
@ -61,10 +69,8 @@ register struct object *weap;
* The player attacks the monster. * The player attacks the monster.
*/ */
fight(mp, weap, thrown) bool
register coord *mp; fight(coord *mp, struct object *weap, bool thrown)
struct object *weap;
bool thrown;
{ {
register struct thing *tp; register struct thing *tp;
register struct linked_list *item; register struct linked_list *item;
@ -225,10 +231,8 @@ bool thrown;
* The monster attacks the player * The monster attacks the player
*/ */
attack(mp, weapon, thrown) bool
register struct thing *mp; attack(struct thing *mp, struct object *weapon, bool thrown)
register struct object *weapon;
bool thrown;
{ {
register char *mname; register char *mname;
register bool see_att, did_hit = FALSE; register bool see_att, did_hit = FALSE;
@ -301,9 +305,8 @@ bool thrown;
* returns true if the swing hits * returns true if the swing hits
*/ */
swing(class, at_lvl, op_arm, wplus) bool
short class; swing(short class, int at_lvl, int op_arm, int wplus)
int at_lvl, op_arm, wplus;
{ {
register int res = rnd(20)+1; register int res = rnd(20)+1;
register int need; register int need;
@ -323,12 +326,9 @@ int at_lvl, op_arm, wplus;
* Roll several attacks * Roll several attacks
*/ */
roll_em(att_er, def_er, weap, hurl, cur_weapon, back_stab) bool
struct thing *att_er, *def_er; roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
struct object *weap; bool hurl, struct object *cur_weapon, bool back_stab)
bool hurl;
struct object *cur_weapon;
bool back_stab;
{ {
register struct stats *att, *def; register struct stats *att, *def;
register char *cp = NULL; register char *cp = NULL;
@ -700,9 +700,7 @@ bool back_stab;
*/ */
char * char *
prname(who, upper) prname(char *who, bool upper)
register char *who;
bool upper;
{ {
static char tbuf[LINELEN]; static char tbuf[LINELEN];
@ -727,11 +725,9 @@ bool upper;
* Print a message to indicate a succesful hit * Print a message to indicate a succesful hit
*/ */
hit(weapon, see_att, see_def, er, ee, back_stab, thrown, short_msg) void
register struct object *weapon; hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool see_att, see_def; bool back_stab, bool thrown, bool short_msg)
register char *er, *ee;
bool back_stab, thrown, short_msg;
{ {
register char *s = ""; register char *s = "";
char att_name[LINELEN], /* Name of attacker */ char att_name[LINELEN], /* Name of attacker */
@ -791,11 +787,9 @@ bool back_stab, thrown, short_msg;
* Print a message to indicate a poor swing * Print a message to indicate a poor swing
*/ */
miss(weapon, see_att, see_def, er, ee, thrown, short_msg) void
register struct object *weapon; miss(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool see_att, see_def; bool thrown, bool short_msg)
register char *er, *ee;
bool thrown, short_msg;
{ {
register char *s = ""; register char *s = "";
char char
@ -836,8 +830,8 @@ bool thrown, short_msg;
* compute to-hit bonus for dexterity * compute to-hit bonus for dexterity
*/ */
dext_plus(dexterity) int
register int dexterity; dext_plus(int dexterity)
{ {
return (dexterity > 10 ? (dexterity-13)/3 : (dexterity-10)/3); return (dexterity > 10 ? (dexterity-13)/3 : (dexterity-10)/3);
} }
@ -848,8 +842,8 @@ register int dexterity;
* compute armor class bonus for dexterity * compute armor class bonus for dexterity
*/ */
dext_prot(dexterity) int
register int dexterity; dext_prot(int dexterity)
{ {
return ((dexterity-10)/2); return ((dexterity-10)/2);
} }
@ -858,8 +852,8 @@ register int dexterity;
* compute bonus/penalties for strength on the "to hit" roll * compute bonus/penalties for strength on the "to hit" roll
*/ */
str_plus(str) int
register short str; str_plus(short str)
{ {
return((str-10)/3); return((str-10)/3);
} }
@ -869,8 +863,8 @@ register short str;
* compute additional damage done for exceptionally high or low strength * compute additional damage done for exceptionally high or low strength
*/ */
add_dam(str) int
register short str; add_dam(short str)
{ {
return((str-9)/2); return((str-9)/2);
} }
@ -879,7 +873,8 @@ register short str;
* hung_dam: * hung_dam:
* Calculate damage depending on players hungry state * Calculate damage depending on players hungry state
*/ */
hung_dam() int
hung_dam(void)
{ {
reg int howmuch; reg int howmuch;
@ -897,12 +892,11 @@ hung_dam()
/* /*
* thunk: * thunk:
* A missile hits a monster * A missile hits a monster
* tp: defender
*/ */
thunk(weap, tp, mname) void
register struct object *weap; thunk(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp; /* Defender */
register char *mname;
{ {
char *def_name; /* Name of defender */ char *def_name; /* Name of defender */
@ -924,10 +918,8 @@ register char *mname;
* A missile from a monster hits the player * A missile from a monster hits the player
*/ */
m_thunk(weap, tp, mname) void
register struct object *weap; m_thunk(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp;
register char *mname;
{ {
char *att_name; /* Name of attacker */ char *att_name; /* Name of attacker */
@ -947,12 +939,11 @@ register char *mname;
/* /*
* bounce: * bounce:
* A missile misses a monster * A missile misses a monster
* tp: defender
*/ */
bounce(weap, tp, mname) void
register struct object *weap; bounce(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp; /* Defender */
register char *mname;
{ {
char *def_name; /* Name of defender */ char *def_name; /* Name of defender */
@ -974,10 +965,8 @@ register char *mname;
* A missle from a monster misses the player * A missle from a monster misses the player
*/ */
m_bounce(weap, tp, mname) void
register struct object *weap; m_bounce(struct object *weap, struct thing *tp, char *mname)
register struct thing *tp;
register char *mname;
{ {
char *att_name; /* Name of attacker */ char *att_name; /* Name of attacker */
@ -1001,8 +990,8 @@ register char *mname;
* Returns true if an object radiates magic * Returns true if an object radiates magic
*/ */
is_magic(obj) bool
register struct object *obj; is_magic(struct object *obj)
{ {
switch (obj->o_type) switch (obj->o_type)
{ {
@ -1028,9 +1017,8 @@ register struct object *obj;
int chance = 0;/* cumulative chance for goodies to loose it */ int chance = 0;/* cumulative chance for goodies to loose it */
killed(item, pr, points, treasure) void
register struct linked_list *item; killed(struct linked_list *item, bool pr, bool points, bool treasure)
bool pr, points, treasure;
{ {
register struct thing *tp, *mp; register struct thing *tp, *mp;
register struct linked_list *pitem, *nexti, *mitem; register struct linked_list *pitem, *nexti, *mitem;
@ -1137,9 +1125,7 @@ bool pr, points, treasure;
*/ */
struct linked_list * struct linked_list *
wield_weap(thrown, mp) wield_weap(struct object *thrown, struct thing *mp)
struct object *thrown;
struct thing *mp;
{ {
int look_for, /* The projectile weapon we are looking for */ int look_for, /* The projectile weapon we are looking for */
new_rate, /* The rating of a prospective weapon */ new_rate, /* The rating of a prospective weapon */
@ -1220,8 +1206,9 @@ struct thing *mp;
return(candidate); return(candidate);
} }
explode(tp)
register struct thing *tp; void
explode(struct thing *tp)
{ {
register int x,y, damage; register int x,y, damage;
@ -1275,11 +1262,8 @@ register struct thing *tp;
* Called when one monster attacks another monster. * Called when one monster attacks another monster.
*/ */
skirmish(attacker, mp, weap, thrown) bool
register struct thing *attacker; skirmish(struct thing *attacker, coord *mp, struct object *weap, bool thrown)
register coord *mp;
struct object *weap;
bool thrown;
{ {
register struct thing *defender; register struct thing *defender;
register struct linked_list *item; register struct linked_list *item;

View file

@ -117,10 +117,8 @@ static bool used[MAX3(NCOLORS, NSTONES, NWOOD)];
* make sure all the percentages specified in the tables add up to the * make sure all the percentages specified in the tables add up to the
* right amounts * right amounts
*/ */
badcheck(name, magic, bound) void
char *name; badcheck(char *name, struct magic_item *magic, int bound)
register struct magic_item *magic;
register int bound;
{ {
register struct magic_item *end; register struct magic_item *end;
@ -140,7 +138,8 @@ register int bound;
* Initialize the potion color scheme for this time * Initialize the potion color scheme for this time
*/ */
init_colors() void
init_colors(void)
{ {
register int i, j; register int i, j;
@ -166,7 +165,8 @@ init_colors()
* do any initialization for food * do any initialization for food
*/ */
init_foods() void
init_foods(void)
{ {
register int i; register int i;
@ -182,7 +182,8 @@ init_foods()
* Initialize the construction materials for wands and staffs * Initialize the construction materials for wands and staffs
*/ */
init_materials() void
init_materials(void)
{ {
register int i, j; register int i, j;
register char *str; register char *str;
@ -232,7 +233,8 @@ init_materials()
* do any initialization for miscellaneous magic * do any initialization for miscellaneous magic
*/ */
init_misc() void
init_misc(void)
{ {
register int i; register int i;
@ -250,7 +252,8 @@ init_misc()
* Generate the names of the various scrolls * Generate the names of the various scrolls
*/ */
init_names() void
init_names(void)
{ {
register int nsyl; register int nsyl;
register char *cp, *sp; register char *cp, *sp;
@ -287,7 +290,8 @@ init_names()
* roll up the rogue * roll up the rogue
*/ */
init_player() void
init_player(void)
{ {
int stat_total, round, minimum, maximum, ch, i, j; int stat_total, round, minimum, maximum, ch, i, j;
short do_escape, *our_stats[NUMABILITIES-1]; short do_escape, *our_stats[NUMABILITIES-1];
@ -587,7 +591,8 @@ init_player()
* Initialize the ring stone setting scheme for this time * Initialize the ring stone setting scheme for this time
*/ */
init_stones() void
init_stones(void)
{ {
register int i, j; register int i, j;
@ -613,7 +618,8 @@ init_stones()
* init_things * init_things
* Initialize the probabilities for types of things * Initialize the probabilities for types of things
*/ */
init_things() void
init_things(void)
{ {
register struct magic_item *mp; register struct magic_item *mp;

View file

@ -30,7 +30,10 @@
static char msgbuf[BUFSIZ]; static char msgbuf[BUFSIZ];
static int newpos = 0; static int newpos = 0;
void doadd(char *fmt, va_list ap);
/*VARARGS1*/ /*VARARGS1*/
void
msg(char *fmt, ...) msg(char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -58,6 +61,7 @@ msg(char *fmt, ...)
/* /*
* add things to the current message * add things to the current message
*/ */
void
addmsg(char *fmt, ...) addmsg(char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -71,7 +75,8 @@ addmsg(char *fmt, ...)
* Display a new msg (giving him a chance to see the previous one if it * Display a new msg (giving him a chance to see the previous one if it
* is up there with the --More--) * is up there with the --More--)
*/ */
endmsg() void
endmsg(void)
{ {
/* Needed to track where we are for 5.0 (PC) curses */ /* Needed to track where we are for 5.0 (PC) curses */
register int x, y; register int x, y;
@ -111,6 +116,7 @@ endmsg()
draw(msgw); draw(msgw);
} }
void
doadd(char *fmt, va_list ap) doadd(char *fmt, va_list ap)
{ {
@ -127,9 +133,8 @@ doadd(char *fmt, va_list ap)
* flgptr will be NULL if we don't know what the monster is yet! * flgptr will be NULL if we don't know what the monster is yet!
*/ */
step_ok(y, x, can_on_monst, flgptr) bool
register int y, x, can_on_monst; step_ok(int y, int x, int can_on_monst, struct thing *flgptr)
register struct thing *flgptr;
{ {
/* can_on_monst = MONSTOK if all we care about are physical obstacles */ /* can_on_monst = MONSTOK if all we care about are physical obstacles */
register struct linked_list *item; register struct linked_list *item;
@ -188,7 +193,8 @@ register struct thing *flgptr;
* returns true if it is ok for type to shoot over ch * returns true if it is ok for type to shoot over ch
*/ */
shoot_ok(ch) bool
shoot_ok(char ch)
{ {
switch (ch) switch (ch)
{ {
@ -209,7 +215,8 @@ shoot_ok(ch)
* getchar. * getchar.
*/ */
readchar() int
readchar(void)
{ {
int ch; int ch;
@ -227,10 +234,11 @@ readchar()
/* /*
* status: * status:
* Display the important stats line. Keep the cursor where it was. * Display the important stats line. Keep the cursor where it was.
* display: if TRUE, display unconditionally
*/ */
status(display) void
bool display; /* is TRUE, display unconditionally */ status(bool display)
{ {
register struct stats *stat_ptr, *max_ptr; register struct stats *stat_ptr, *max_ptr;
register int oy, ox, temp; register int oy, ox, temp;
@ -358,8 +366,8 @@ line_two:
* wait_for * wait_for
* Sit around until the guy types the right key * Sit around until the guy types the right key
*/ */
wait_for(ch) void
register char ch; wait_for(char ch)
{ {
register char c; register char c;
@ -383,10 +391,9 @@ register char ch;
* typed and then redraw the starting screen. * typed and then redraw the starting screen.
*/ */
over_win(oldwin, newin, maxy, maxx, cursory, cursorx, redraw) void
WINDOW *oldwin, *newin; over_win(WINDOW *oldwin, WINDOW *newin, int maxy, int maxx, int cursory,
int maxy, maxx, cursory, cursorx; int cursorx, char redraw)
char redraw;
{ {
static char blanks[LINELEN+1]; static char blanks[LINELEN+1];
register int line, i; register int line, i;
@ -436,9 +443,8 @@ char redraw;
* function used to display a window and wait before returning * function used to display a window and wait before returning
*/ */
show_win(scr, message) void
register WINDOW *scr; show_win(WINDOW *scr, char *message)
char *message;
{ {
mvwaddstr(scr, 0, 0, message); mvwaddstr(scr, 0, 0, message);
touchwin(scr); touchwin(scr);
@ -453,9 +459,8 @@ char *message;
* dbotline: * dbotline:
* Displays message on bottom line and waits for a space to return * Displays message on bottom line and waits for a space to return
*/ */
dbotline(scr,message) void
WINDOW *scr; dbotline(WINDOW *scr, char *message)
char *message;
{ {
mvwaddstr(scr,lines-1,0,message); mvwaddstr(scr,lines-1,0,message);
draw(scr); draw(scr);
@ -467,8 +472,8 @@ char *message;
* restscr: * restscr:
* Restores the screen to the terminal * Restores the screen to the terminal
*/ */
restscr(scr) void
WINDOW *scr; restscr(WINDOW *scr)
{ {
clearok(scr,TRUE); clearok(scr,TRUE);
touchwin(scr); touchwin(scr);
@ -481,10 +486,7 @@ WINDOW *scr;
*/ */
unsigned long unsigned long
netread(error, size, stream) netread(int *error, int size, FILE *stream)
int *error;
int size;
FILE *stream;
{ {
unsigned long result = 0L, /* What we read in */ unsigned long result = 0L, /* What we read in */
partial; /* Partial value */ partial; /* Partial value */
@ -519,12 +521,13 @@ FILE *stream;
/* /*
* netwrite: * netwrite:
* Write out a byte, short, or long machine independently. * Write out a byte, short, or long machine independently.
* value: What to write
* size: How much to write out
* stream: Where to write it
*/ */
netwrite(value, size, stream) int
unsigned long value; /* What to write */ netwrite(unsigned long value, int size, FILE *stream)
int size; /* How much to write out */
FILE *stream; /* Where to write it */
{ {
int i; /* Goes through value one byte at a time */ int i; /* Goes through value one byte at a time */
char outc; /* The next character to be written */ char outc; /* The next character to be written */

View file

@ -21,13 +21,16 @@
#include <stdlib.h> #include <stdlib.h>
#include "rogue.h" #include "rogue.h"
void r_discard(struct linked_list *item);
void t_discard(struct linked_list *item);
/* /*
* detach: * detach:
* Takes an item out of whatever linked list it might be in * Takes an item out of whatever linked list it might be in
*/ */
_detach(list, item) void
register struct linked_list **list, *item; _detach(struct linked_list **list, struct linked_list *item)
{ {
if (*list == item) if (*list == item)
*list = next(item); *list = next(item);
@ -42,8 +45,8 @@ register struct linked_list **list, *item;
* add an item to the head of a list * add an item to the head of a list
*/ */
_attach(list, item) void
register struct linked_list **list, *item; _attach(struct linked_list **list, struct linked_list *item)
{ {
if (*list != NULL) if (*list != NULL)
{ {
@ -65,8 +68,8 @@ register struct linked_list **list, *item;
* Throw the whole object list away * Throw the whole object list away
*/ */
_o_free_list(ptr) void
register struct linked_list **ptr; _o_free_list(struct linked_list **ptr)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -83,8 +86,8 @@ register struct linked_list **ptr;
* free up an item and its object(and maybe contents) * free up an item and its object(and maybe contents)
*/ */
o_discard(item) void
register struct linked_list *item; o_discard(struct linked_list *item)
{ {
register struct object *obj; register struct object *obj;
@ -101,8 +104,8 @@ register struct linked_list *item;
* Throw the whole list of room exits away * Throw the whole list of room exits away
*/ */
_r_free_list(ptr) void
register struct linked_list **ptr; _r_free_list(struct linked_list **ptr)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -119,8 +122,8 @@ register struct linked_list **ptr;
* free up an item and its room * free up an item and its room
*/ */
r_discard(item) void
register struct linked_list *item; r_discard(struct linked_list *item)
{ {
total -= 2; total -= 2;
FREE(DOORPTR(item)); FREE(DOORPTR(item));
@ -132,8 +135,8 @@ register struct linked_list *item;
* Throw the whole thing list away * Throw the whole thing list away
*/ */
_t_free_list(ptr) void
register struct linked_list **ptr; _t_free_list(struct linked_list **ptr)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -150,8 +153,8 @@ register struct linked_list **ptr;
* free up an item and its thing * free up an item and its thing
*/ */
t_discard(item) void
register struct linked_list *item; t_discard(struct linked_list *item)
{ {
register struct thing *tp; register struct thing *tp;
@ -167,8 +170,8 @@ register struct linked_list *item;
* get rid of an item structure -- don't worry about contents * get rid of an item structure -- don't worry about contents
*/ */
destroy_item(item) void
register struct linked_list *item; destroy_item(struct linked_list *item)
{ {
total--; total--;
FREE(item); FREE(item);
@ -180,8 +183,7 @@ register struct linked_list *item;
*/ */
struct linked_list * struct linked_list *
new_item(size) new_item(int size)
int size;
{ {
register struct linked_list *item; register struct linked_list *item;
@ -199,7 +201,7 @@ int size;
*/ */
struct linked_list * struct linked_list *
creat_item() creat_item(void)
{ {
register struct linked_list *item; register struct linked_list *item;
@ -210,8 +212,7 @@ creat_item()
} }
char * char *
new(size) new(int size)
int size;
{ {
register char *space = ALLOC(size); register char *space = ALLOC(size);
static char errbuf[LINELEN]; static char errbuf[LINELEN];

View file

@ -32,10 +32,19 @@ extern char oldtext[WTXTNUM][WTXTLEN];
#endif #endif
void open_records(void); void open_records(void);
bool too_much(void);
bool author(void);
void chmsg(char *fmt, int arg);
#ifdef MAXPROCESSES
int loadav(void);
#endif
#ifdef MAXUSERS
int ucount(void);
#endif
bool holiday(void);
main(argc, argv, envp) int
char **argv; main(int argc, char *argv[], char *envp[])
char **envp;
{ {
register char *env; register char *env;
int lowtime; int lowtime;
@ -419,8 +428,7 @@ char **envp;
*/ */
void void
endit(sig) endit(int sig)
int sig;
{ {
fatal("Ok, if you want to exit that badly, I'll have to allow it\n"); fatal("Ok, if you want to exit that badly, I'll have to allow it\n");
} }
@ -430,8 +438,8 @@ int sig;
* Exit the program, printing a message. * Exit the program, printing a message.
*/ */
fatal(s) void
char *s; fatal(char *s)
{ {
clear(); clear();
move(lines-2, 0); move(lines-2, 0);
@ -449,8 +457,8 @@ char *s;
* rnd: * rnd:
* Pick a very random number. * Pick a very random number.
*/ */
rnd(range) int
register int range; rnd(int range)
{ {
return(range <= 0 ? 0 : md_rand() % range); return(range <= 0 ? 0 : md_rand() % range);
} }
@ -460,8 +468,8 @@ register int range;
* roll a number of dice * roll a number of dice
*/ */
roll(number, sides) int
register int number, sides; roll(int number, int sides)
{ {
register int dtotal = 0; register int dtotal = 0;
@ -474,8 +482,7 @@ register int number, sides;
* handle stop and start signals * handle stop and start signals
*/ */
void void
tstp(sig) tstp(int sig)
int sig;
{ {
mvcur(0, cols - 1, lines - 1, 0); mvcur(0, cols - 1, lines - 1, 0);
endwin(); endwin();
@ -493,7 +500,8 @@ int sig;
} }
# endif # endif
setup() void
setup(void)
{ {
#ifdef CHECKTIME #ifdef CHECKTIME
int checkout(); int checkout();
@ -563,7 +571,8 @@ open_records(void)
* refreshing things and looking at the proper times. * refreshing things and looking at the proper times.
*/ */
playit() void
playit(void)
{ {
register char *opts; register char *opts;
@ -585,7 +594,8 @@ playit()
/* /*
* see if the system is being used too much for this game * see if the system is being used too much for this game
*/ */
too_much() bool
too_much(void)
{ {
#if MAXPROCESSES #if MAXPROCESSES
if (loadav() > MAXPROCESSES) if (loadav() > MAXPROCESSES)
@ -602,7 +612,8 @@ too_much()
* author: * author:
* See if a user is an author of the program * See if a user is an author of the program
*/ */
author() bool
author(void)
{ {
switch (md_getuid()) { switch (md_getuid()) {
#if AUTHOR #if AUTHOR
@ -653,9 +664,8 @@ checkout()
* checkout()'s version of msg. If we are in the middle of a shell, do a * checkout()'s version of msg. If we are in the middle of a shell, do a
* printf instead of a msg to avoid the refresh. * printf instead of a msg to avoid the refresh.
*/ */
chmsg(fmt, arg) void
char *fmt; chmsg(char *fmt, int arg)
int arg;
{ {
if (in_shell) { if (in_shell) {
printf(fmt, arg); printf(fmt, arg);
@ -671,7 +681,8 @@ int arg;
#include <fcntl.h> #include <fcntl.h>
loadav() int
loadav(void)
{ {
char *sarcmd = "sar -v | cut -c17-20 | tail -2"; char *sarcmd = "sar -v | cut -c17-20 | tail -2";
char *gettycmd = "grep getty /etc/inittab | wc -l"; char *gettycmd = "grep getty /etc/inittab | wc -l";
@ -724,7 +735,9 @@ loadav()
#include <sys/types.h> #include <sys/types.h>
#include <utmp.h> #include <utmp.h>
struct utmp buf; struct utmp buf;
ucount()
int
ucount(void)
{ {
reg struct utmp *up; reg struct utmp *up;
reg FILE *utmp; reg FILE *utmp;
@ -751,7 +764,8 @@ ucount()
* holiday: * holiday:
* Returns TRUE when it is a good time to play rogue * Returns TRUE when it is a good time to play rogue
*/ */
holiday() bool
holiday(void)
{ {
#ifdef CHECKTIME #ifdef CHECKTIME
long now; long now;

View file

@ -30,15 +30,20 @@ static char *frontier,
*bits; *bits;
static int maze_lines, static int maze_lines,
maze_cols; maze_cols;
char *moffset(),
*foffset(); void draw_maze(void);
int findcells(int y, int x);
char *foffset(int y, int x);
char *moffset(int y, int x);
void rmwall(int newy, int newx, int oldy, int oldx);
/* /*
* crankout: * crankout:
* Does actual drawing of maze to window * Does actual drawing of maze to window
*/ */
crankout() void
crankout(void)
{ {
reg int x, y; reg int x, y;
@ -71,7 +76,8 @@ crankout()
* domaze: * domaze:
* Draw the maze on this level. * Draw the maze on this level.
*/ */
do_maze() void
do_maze(void)
{ {
reg int least; reg int least;
reg struct room *rp; reg struct room *rp;
@ -95,7 +101,7 @@ do_maze()
/* /*
* add some gold to make it worth looking for * add some gold to make it worth looking for
*/ */
item = spec_item(GOLD, NULL, NULL, NULL); item = spec_item(GOLD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_count *= (rnd(5) + 5); /* add in one large hunk */ obj->o_count *= (rnd(5) + 5); /* add in one large hunk */
attach(lvl_obj, item); attach(lvl_obj, item);
@ -108,7 +114,7 @@ do_maze()
/* /*
* add in some food to make sure he has enough * add in some food to make sure he has enough
*/ */
item = spec_item(FOOD, NULL, NULL, NULL); item = spec_item(FOOD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
attach(lvl_obj, item); attach(lvl_obj, item);
do { do {
@ -133,7 +139,8 @@ do_maze()
* draw_maze: * draw_maze:
* Generate and draw the maze on the screen * Generate and draw the maze on the screen
*/ */
draw_maze() void
draw_maze(void)
{ {
reg int i, j, more; reg int i, j, more;
reg char *ptr; reg char *ptr;
@ -169,8 +176,8 @@ draw_maze()
* findcells: * findcells:
* Figure out cells to open up * Figure out cells to open up
*/ */
findcells(y,x) int
reg int x, y; findcells(int y, int x)
{ {
reg int rtpos, i; reg int rtpos, i;
@ -221,8 +228,7 @@ reg int x, y;
* Calculate memory address for frontier * Calculate memory address for frontier
*/ */
char * char *
foffset(y, x) foffset(int y, int x)
int y, x;
{ {
return (frontier + (y * maze_cols) + x); return (frontier + (y * maze_cols) + x);
@ -236,8 +242,7 @@ int y, x;
*/ */
bool bool
maze_view(y, x) maze_view(int y, int x)
int y, x;
{ {
register int start, goal, delta, ycheck, xcheck, absy, absx, see_radius; register int start, goal, delta, ycheck, xcheck, absy, absx, see_radius;
register bool row; register bool row;
@ -341,8 +346,7 @@ int y, x;
* Calculate memory address for bits * Calculate memory address for bits
*/ */
char * char *
moffset(y, x) moffset(int y, int x)
int y, x;
{ {
return (bits + (y * (cols - 1)) + x); return (bits + (y * (cols - 1)) + x);
@ -355,8 +359,8 @@ int y, x;
* rmwall: * rmwall:
* Removes appropriate walls from the maze * Removes appropriate walls from the maze
*/ */
rmwall(newy, newx, oldy, oldx) void
int newy, newx, oldy, oldx; rmwall(int newy, int newx, int oldy, int oldx)
{ {
reg int xdif,ydif; reg int xdif,ydif;

View file

@ -65,6 +65,7 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <ctype.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
@ -74,7 +75,7 @@
#define MOD_MOVE(c) (toupper(c) ) #define MOD_MOVE(c) (toupper(c) )
void void
md_init() md_init(void)
{ {
#ifdef __INTERIX #ifdef __INTERIX
char *term; char *term;
@ -107,7 +108,7 @@ md_putchar(int c)
static int md_standout_mode = 0; static int md_standout_mode = 0;
int int
md_raw_standout() md_raw_standout(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
@ -130,7 +131,7 @@ md_raw_standout()
} }
int int
md_raw_standend() md_raw_standend(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
@ -209,7 +210,7 @@ md_creat(char *file, int mode)
int int
md_normaluser() md_normaluser(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
setuid(getuid()); setuid(getuid());
@ -218,7 +219,7 @@ md_normaluser()
} }
int int
md_getuid() md_getuid(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
return( getuid() ); return( getuid() );
@ -228,7 +229,7 @@ md_getuid()
} }
char * char *
md_getusername() md_getusername(void)
{ {
static char login[80]; static char login[80];
char *l = NULL; char *l = NULL;
@ -263,7 +264,7 @@ md_getusername()
} }
char * char *
md_gethomedir() md_gethomedir(void)
{ {
static char homedir[PATH_MAX]; static char homedir[PATH_MAX];
char *h = NULL; char *h = NULL;
@ -318,7 +319,7 @@ md_gethomedir()
} }
char * char *
md_getshell() md_getshell(void)
{ {
static char shell[PATH_MAX]; static char shell[PATH_MAX];
char *s = NULL; char *s = NULL;
@ -346,7 +347,7 @@ md_getshell()
} }
int int
md_shellescape() md_shellescape(void)
{ {
#if (!defined(_WIN32) && !defined(__DJGPP__)) #if (!defined(_WIN32) && !defined(__DJGPP__))
int ret_status; int ret_status;
@ -408,7 +409,7 @@ directory_exists(char *dirname)
} }
char * char *
md_getroguedir() md_getroguedir(void)
{ {
static char path[1024]; static char path[1024];
char *end,*home; char *end,*home;
@ -472,8 +473,7 @@ md_crypt(char *key, char *salt)
} }
char * char *
md_getpass(prompt) md_getpass(char *prompt)
char *prompt;
{ {
#ifdef _WIN32 #ifdef _WIN32
static char password_buffer[9]; static char password_buffer[9];
@ -568,7 +568,7 @@ md_htonl(unsigned long int x)
} }
int int
md_rand() md_rand(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
return(rand()); return(rand());
@ -578,8 +578,7 @@ md_rand()
} }
int int
md_srand(seed) md_srand(int seed)
register int seed;
{ {
#ifdef _WIN32 #ifdef _WIN32
srand(seed); srand(seed);
@ -589,7 +588,7 @@ register int seed;
} }
long long
md_memused() md_memused(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
MEMORYSTATUS stat; MEMORYSTATUS stat;
@ -603,7 +602,7 @@ md_memused()
} }
char * char *
md_gethostname() md_gethostname(void)
{ {
static char nodename[80]; static char nodename[80];
char *n = NULL; char *n = NULL;
@ -625,7 +624,7 @@ md_gethostname()
} }
int int
md_erasechar() md_erasechar(void)
{ {
#ifdef BSD #ifdef BSD
return(_tty.sg_erase); /* process erase character */ return(_tty.sg_erase); /* process erase character */
@ -637,7 +636,7 @@ md_erasechar()
} }
int int
md_killchar() md_killchar(void)
{ {
#ifdef BSD #ifdef BSD
return(_tty.sg_kill); return(_tty.sg_kill);
@ -654,8 +653,7 @@ md_killchar()
*/ */
char * char *
md_unctrl(ch) md_unctrl(char ch)
char ch;
{ {
#if USG5_0 #if USG5_0
extern char *_unctrl[]; /* Defined in curses library */ extern char *_unctrl[]; /* Defined in curses library */
@ -667,7 +665,7 @@ char ch;
} }
void void
md_flushinp() md_flushinp(void)
{ {
#ifdef BSD #ifdef BSD
ioctl(0, TIOCFLUSH); ioctl(0, TIOCFLUSH);

View file

@ -15,6 +15,7 @@
#include "curses.h" #include "curses.h"
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include "rogue.h" #include "rogue.h"
#ifdef PC7300 #ifdef PC7300
#include "menu.h" #include "menu.h"
@ -29,8 +30,8 @@
* Change the player's class to the specified one. * Change the player's class to the specified one.
*/ */
changeclass(newclass) void
int newclass; changeclass(int newclass)
{ {
if (newclass == player.t_ctype) { if (newclass == player.t_ctype) {
msg("You feel more skillful."); msg("You feel more skillful.");
@ -132,8 +133,8 @@ int newclass;
/* /*
* Use the relic that our monster is wielding. * Use the relic that our monster is wielding.
*/ */
m_use_relic(monster) void
register struct thing *monster; m_use_relic(struct thing *monster)
{ {
register struct object *obj; register struct object *obj;
@ -161,7 +162,7 @@ register struct thing *monster;
} }
when EMORI_CLOAK: when EMORI_CLOAK:
debug("stunning with Emori's cloak"); debug("stunning with Emori's cloak");
do_zap(monster, obj, &monster->t_newpos, WS_PARALYZE, NULL); do_zap(monster, obj, &monster->t_newpos, WS_PARALYZE, 0);
obj->o_charges = 0; obj->o_charges = 0;
when ASMO_ROD: { when ASMO_ROD: {
@ -228,10 +229,11 @@ register struct thing *monster;
/* /*
* add something to the contents of something else * add something to the contents of something else
* bag: the holder of the items
* item: the item to put inside
*/ */
put_contents(bag, item) void
register struct object *bag; /* the holder of the items */ put_contents(struct object *bag, struct linked_list *item)
register struct linked_list *item; /* the item to put inside */
{ {
register struct linked_list *titem; register struct linked_list *titem;
register struct object *tobj; register struct object *tobj;
@ -256,10 +258,10 @@ register struct linked_list *item; /* the item to put inside */
/* /*
* remove something from something else * remove something from something else
* bag: the holder of the items
*/ */
take_contents(bag, item) void
register struct object *bag; /* the holder of the items */ take_contents(struct object *bag, struct linked_list *item)
register struct linked_list *item;
{ {
if (bag->o_ac <= 0) { if (bag->o_ac <= 0) {
@ -273,8 +275,8 @@ register struct linked_list *item;
} }
do_bag(item) void
register struct linked_list *item; do_bag(struct linked_list *item)
{ {
register struct linked_list *titem = NULL; register struct linked_list *titem = NULL;
@ -395,8 +397,9 @@ register struct linked_list *item;
} }
} }
do_panic(who) /* who: Kind of monster to panic (all if who is NULL) */
int who; /* Kind of monster to panic (all if who is NULL) */ void
do_panic(int who)
{ {
register int x,y; register int x,y;
register struct linked_list *mon, *item; register struct linked_list *mon, *item;
@ -460,8 +463,7 @@ int who; /* Kind of monster to panic (all if who is NULL) */
* print miscellaneous magic bonuses * print miscellaneous magic bonuses
*/ */
char * char *
misc_name(obj) misc_name(struct object *obj)
register struct object *obj;
{ {
static char buf[LINELEN]; static char buf[LINELEN];
char buf1[LINELEN]; char buf1[LINELEN];
@ -523,7 +525,8 @@ register struct object *obj;
return buf; return buf;
} }
use_emori() void
use_emori(void)
{ {
char selection; /* Cloak function */ char selection; /* Cloak function */
int state = 0; /* Menu state */ int state = 0; /* Menu state */
@ -633,8 +636,8 @@ static char Displines[MAXQUILL+1][LINELEN+1]; /* The lines themselves */
/* /*
* try to write a scroll with the quill of Nagrom * try to write a scroll with the quill of Nagrom
*/ */
use_quill(obj) void
struct object *obj; use_quill(struct object *obj)
{ {
struct linked_list *item; struct linked_list *item;
register int i, register int i,
@ -766,7 +769,7 @@ struct object *obj;
#endif #endif
/* Should we overlay? */ /* Should we overlay? */
if (menu_overlay && MAXQUILL + 3 < lines / 2) { if (menu_overlay && MAXQUILL + 3 < lines / 2) {
over_win(cw, hw, MAXQUILL + 5, maxlen + 3, 0, curlen, NULL); over_win(cw, hw, MAXQUILL + 5, maxlen + 3, 0, curlen, '\0');
} }
else draw(hw); else draw(hw);
} }
@ -795,7 +798,7 @@ struct object *obj;
/* Should we overlay? */ /* Should we overlay? */
if (menu_overlay && MAXQUILL + 3 < lines / 2) { if (menu_overlay && MAXQUILL + 3 < lines / 2) {
over_win(cw, hw, MAXQUILL + 5, maxlen + 3, over_win(cw, hw, MAXQUILL + 5, maxlen + 3,
0, curlen, NULL); 0, curlen, '\0');
} }
else draw(hw); else draw(hw);
@ -835,8 +838,8 @@ got_scroll:
} }
} }
use_mm(which) void
int which; use_mm(int which)
{ {
register struct object *obj = NULL; register struct object *obj = NULL;
register struct linked_list *item = NULL; register struct linked_list *item = NULL;
@ -915,7 +918,7 @@ int which;
when GERYON_HORN: when GERYON_HORN:
/* Chase close monsters away */ /* Chase close monsters away */
msg("The horn blasts a shrill tone."); msg("The horn blasts a shrill tone.");
do_panic(NULL); do_panic(0);
when HEIL_ANKH: when HEIL_ANKH:
case YENDOR_AMULET: case YENDOR_AMULET:
case STONEBONES_AMULET: case STONEBONES_AMULET:
@ -938,7 +941,7 @@ int which;
msg("The jug is empty"); msg("The jug is empty");
break; break;
} }
quaff (obj->o_ac, NULL, NULL, FALSE); quaff (obj->o_ac, 0, 0, FALSE);
obj->o_ac = JUG_EMPTY; obj->o_ac = JUG_EMPTY;
fuse (alchemy, obj, ALCHEMYTIME, AFTER); fuse (alchemy, obj, ALCHEMYTIME, AFTER);
if (!(obj->o_flags & ISKNOW)) if (!(obj->o_flags & ISKNOW))
@ -1008,7 +1011,7 @@ int which;
break; break;
} }
obj->o_charges--; obj->o_charges--;
do_panic(NULL); do_panic(0);
/* /*
* dust of disappearance makes the player invisible for a while * dust of disappearance makes the player invisible for a while
*/ */
@ -1124,8 +1127,7 @@ int which;
*/ */
int int
usage_time(item) usage_time(struct linked_list *item)
struct linked_list *item;
{ {
register struct object *obj; register struct object *obj;
register int units = -1; register int units = -1;

View file

@ -21,13 +21,14 @@
#include "rogue.h" #include "rogue.h"
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
/* /*
* Check_residue takes care of any effect of the monster * Check_residue takes care of any effect of the monster
*/ */
check_residue(tp) void
register struct thing *tp; check_residue(struct thing *tp)
{ {
/* /*
* Take care of special abilities * Take care of special abilities
@ -71,13 +72,11 @@ register struct thing *tp;
/* /*
* Creat_mons creates the specified monster -- any if 0 * Creat_mons creates the specified monster -- any if 0
* person: Where to create next to
*/ */
bool bool
creat_mons(person, monster, report) creat_mons(struct thing *person, short monster, bool report)
struct thing *person; /* Where to create next to */
short monster;
bool report;
{ {
struct linked_list *nitem; struct linked_list *nitem;
register struct thing *tp; register struct thing *tp;
@ -132,9 +131,7 @@ bool report;
*/ */
void void
genmonsters(least, treas) genmonsters(int least, bool treas)
register int least;
bool treas;
{ {
reg int i; reg int i;
reg struct room *rp = &rooms[0]; reg struct room *rp = &rooms[0];
@ -180,8 +177,7 @@ bool treas;
*/ */
short short
id_monst(monster) id_monst(char monster)
register char monster;
{ {
register short result; register short result;
@ -201,11 +197,8 @@ register char monster;
* Pick a new monster and add it to the list * Pick a new monster and add it to the list
*/ */
new_monster(item, type, cp, max_monster) void
struct linked_list *item; new_monster(struct linked_list *item, short type, coord *cp, bool max_monster)
short type;
coord *cp;
bool max_monster;
{ {
register struct thing *tp; register struct thing *tp;
register struct monster *mp; register struct monster *mp;
@ -415,8 +408,7 @@ bool max_monster;
*/ */
short short
randmonster(wander, no_unique) randmonster(bool wander, bool no_unique)
register bool wander, no_unique;
{ {
register int d, cur_level, range, i; register int d, cur_level, range, i;
@ -455,8 +447,8 @@ register bool wander, no_unique;
* to purchase something. * to purchase something.
*/ */
sell(tp) void
register struct thing *tp; sell(struct thing *tp)
{ {
register struct linked_list *item, *seller; register struct linked_list *item, *seller;
register struct linked_list *sellpack; register struct linked_list *sellpack;
@ -551,8 +543,7 @@ register struct thing *tp;
* what to do when the hero steps next to a monster * what to do when the hero steps next to a monster
*/ */
struct linked_list * struct linked_list *
wake_monster(y, x) wake_monster(int y, int x)
int y, x;
{ {
register struct thing *tp; register struct thing *tp;
register struct linked_list *it; register struct linked_list *it;
@ -749,7 +740,8 @@ int y, x;
* A wandering monster has awakened and is headed for the player * A wandering monster has awakened and is headed for the player
*/ */
wanderer() void
wanderer(void)
{ {
register int i; register int i;
register struct room *hr = roomin(&hero); register struct room *hr = roomin(&hero);

View file

@ -19,6 +19,7 @@
#include "curses.h" #include "curses.h"
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include "rogue.h" #include "rogue.h"
#ifdef PC7300 #ifdef PC7300
#include "menu.h" #include "menu.h"
@ -41,9 +42,8 @@ static char Moves[3][3] = {
* The guy stepped on a trap.... Make him pay. * The guy stepped on a trap.... Make him pay.
*/ */
be_trapped(th, tc) char
register struct thing *th; be_trapped(struct thing *th, coord *tc)
register coord *tc;
{ {
register struct trap *tp; register struct trap *tp;
register char ch, *mname = ""; register char ch, *mname = "";
@ -426,8 +426,7 @@ register coord *tc;
*/ */
bool bool
blue_light(blessed, cursed) blue_light(bool blessed, bool cursed)
bool blessed, cursed;
{ {
register struct room *rp; register struct room *rp;
bool ret_val=FALSE; /* Whether or not affect is known */ bool ret_val=FALSE; /* Whether or not affect is known */
@ -486,8 +485,8 @@ bool blessed, cursed;
* If not, if player came from a legal place, then try to turn him. * If not, if player came from a legal place, then try to turn him.
*/ */
corr_move(dy, dx) void
int dy, dx; corr_move(int dy, int dx)
{ {
int legal=0; /* Number of legal alternatives */ int legal=0; /* Number of legal alternatives */
register int y, x, /* Indexes though possible positions */ register int y, x, /* Indexes though possible positions */
@ -564,7 +563,8 @@ int dy, dx;
* dip_it: * dip_it:
* Dip an object into a magic pool * Dip an object into a magic pool
*/ */
dip_it() void
dip_it(void)
{ {
reg struct linked_list *what; reg struct linked_list *what;
reg struct object *ob; reg struct object *ob;
@ -758,8 +758,8 @@ dip_it()
* consequences (fighting, picking up, etc.) * consequences (fighting, picking up, etc.)
*/ */
do_move(dy, dx) void
int dy, dx; do_move(int dy, int dx)
{ {
register struct room *rp, *orp; register struct room *rp, *orp;
register char ch; register char ch;
@ -1103,8 +1103,8 @@ int dy, dx;
* Start the hero running * Start the hero running
*/ */
do_run(ch) void
char ch; do_run(char ch)
{ {
firstmove = TRUE; firstmove = TRUE;
running = TRUE; running = TRUE;
@ -1119,11 +1119,9 @@ char ch;
* Returns TRUE if it could find it, FALSE otherwise. * Returns TRUE if it could find it, FALSE otherwise.
*/ */
bool bool
getdelta(match, dy, dx) getdelta(char match, int *dy, int *dx)
char match;
int *dy, *dx;
{ {
register y, x; int y, x;
for (y = 0; y < 3; y++) for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++) for (x = 0; x < 3; x++)
@ -1140,8 +1138,8 @@ int *dy, *dx;
* isatrap: * isatrap:
* Returns TRUE if this character is some kind of trap * Returns TRUE if this character is some kind of trap
*/ */
isatrap(ch) bool
reg char ch; isatrap(char ch)
{ {
switch(ch) { switch(ch) {
case DARTTRAP: case DARTTRAP:
@ -1161,8 +1159,8 @@ reg char ch;
* If it is dark, remove anything that might move. * If it is dark, remove anything that might move.
*/ */
light(cp) void
coord *cp; light(coord *cp)
{ {
register struct room *rp; register struct room *rp;
register int j, k, x, y; register int j, k, x, y;
@ -1338,8 +1336,7 @@ coord *cp;
*/ */
bool bool
lit_room(rp) lit_room(struct room *rp)
register struct room *rp;
{ {
register struct linked_list *fire_item; register struct linked_list *fire_item;
register struct thing *fire_creature; register struct thing *fire_creature;
@ -1376,8 +1373,7 @@ register struct room *rp;
*/ */
short short
movement(tp) movement(struct thing *tp)
register struct thing *tp;
{ {
register int result; register int result;
register int carry; /* Percentage carried */ register int carry; /* Percentage carried */
@ -1441,8 +1437,7 @@ register struct thing *tp;
*/ */
coord * coord *
rndmove(who) rndmove(struct thing *who)
struct thing *who;
{ {
register int x, y; register int x, y;
register int ex, ey, nopen = 0; register int ex, ey, nopen = 0;
@ -1506,9 +1501,8 @@ static char Displines[TRAPTYPES+1][TRAPWIDTH+TRAPPREFIX+1];
* set a trap at (y, x) on screen. * set a trap at (y, x) on screen.
*/ */
set_trap(tp, y, x) void
register struct thing *tp; set_trap(struct thing *tp, int y, int x)
register int y, x;
{ {
register bool is_player = (tp == &player); register bool is_player = (tp == &player);
register int selection = rnd(TRAPTYPES-WIZARDTRAPS) + '1'; register int selection = rnd(TRAPTYPES-WIZARDTRAPS) + '1';
@ -1613,7 +1607,7 @@ register int y, x;
* Put out the selection. The longest line is * Put out the selection. The longest line is
* the prompt line (39 characters long). * the prompt line (39 characters long).
*/ */
over_win(cw, hw, num_traps + 3, 41, 0, 39, NULL); over_win(cw, hw, num_traps + 3, 41, 0, 39, '\0');
else else
draw(hw); draw(hw);
state = 1; /* Now in prompt window */ state = 1; /* Now in prompt window */
@ -1673,7 +1667,7 @@ register int y, x;
* Put out the selection. The longest line is * Put out the selection. The longest line is
* the prompt line (43 characters long). * the prompt line (43 characters long).
*/ */
over_win(cw, hw, num_traps+3, 45, 0, 43, NULL); over_win(cw, hw, num_traps+3, 45, 0, 43, '\0');
else else
draw(hw); draw(hw);
} }
@ -1743,8 +1737,8 @@ register int y, x;
* returns what a certain thing will display as to the un-initiated * returns what a certain thing will display as to the un-initiated
*/ */
show(y, x) char
register int y, x; show(int y, int x)
{ {
register char ch = CCHAR( winat(y, x) ); register char ch = CCHAR( winat(y, x) );
register struct linked_list *it; register struct linked_list *it;
@ -1784,8 +1778,7 @@ register int y, x;
*/ */
struct trap * struct trap *
trap_at(y, x) trap_at(int y, int x)
register int y, x;
{ {
register struct trap *tp, *ep; register struct trap *tp, *ep;
@ -1803,11 +1796,12 @@ register int y, x;
* Calculate how many segments it will take to swing the given * Calculate how many segments it will take to swing the given
* weapon (note that the weapon may actually be a stick or * weapon (note that the weapon may actually be a stick or
* even something else). * even something else).
* wielder: Who's wielding the weapon
* weap: The weapon
*/ */
weap_move(wielder, weap) int
register struct thing *wielder; /* Who's wielding the weapon */ weap_move(struct thing *wielder, struct object *weap)
register struct object *weap; /* The weapon */
{ {
register int weap_rate; register int weap_rate;
int dexterity; int dexterity;

View file

@ -16,14 +16,16 @@
#include "rogue.h" #include "rogue.h"
#define TERRASAVE 3 #define TERRASAVE 3
void put_things(LEVTYPE ltype);
/* /*
* new_level: * new_level:
* Dig and draw a new level * Dig and draw a new level
* * ltype: designates type of level to create
*/ */
new_level(ltype) void
LEVTYPE ltype; /* designates type of level to create */ new_level(LEVTYPE ltype)
{ {
register int rm, i, cnt; register int rm, i, cnt;
register char ch; register char ch;
@ -434,14 +436,15 @@ LEVTYPE ltype; /* designates type of level to create */
status(TRUE); status(TRUE);
/* Do we sense any food on this level? */ /* Do we sense any food on this level? */
if (cur_relic[SURTUR_RING]) quaff(P_FFIND, NULL, NULL, FALSE); if (cur_relic[SURTUR_RING]) quaff(P_FFIND, 0, 0, FALSE);
} }
/* /*
* Pick a room that is really there * Pick a room that is really there
*/ */
rnd_room() int
rnd_room(void)
{ {
register int rm; register int rm;
@ -457,10 +460,11 @@ rnd_room()
/* /*
* put_things: * put_things:
* put potions and scrolls on this level * put potions and scrolls on this level
* ltype: designates type of level to create
*/ */
put_things(ltype) void
LEVTYPE ltype; /* designates type of level to create */ put_things(LEVTYPE ltype)
{ {
register int i, rm, cnt; register int i, rm, cnt;
register struct object *cur; register struct object *cur;
@ -478,7 +482,7 @@ LEVTYPE ltype; /* designates type of level to create */
* There is a chance that there is a treasure room on this level * There is a chance that there is a treasure room on this level
*/ */
if (ltype != MAZELEV && rnd(HARDER) < level - 10) { if (ltype != MAZELEV && rnd(HARDER) < level - 10) {
register j; int j;
register struct room *rp; register struct room *rp;
/* Count the number of free spaces */ /* Count the number of free spaces */

View file

@ -40,14 +40,15 @@ struct optstruct {
typedef struct optstruct OPTION; typedef struct optstruct OPTION;
int put_bool(), void put_bool(bool *b, WINDOW *win);
get_bool(), int get_bool(bool *bp, WINDOW *win);
put_str(), void put_str(char *str, WINDOW *win);
get_str(), int get_str(char *opt, WINDOW *win);
put_abil(), void put_abil(int *ability, WINDOW *win);
get_abil(), void get_abil(int *abil, WINDOW *win);
get_quest(), void put_quest(int *quest, WINDOW *win);
put_quest(); void get_quest(int *quest, WINDOW *win);
int get_ro(WINDOW *win, int oy, int ox);
int get_str_prot(char *opt, WINDOW *win); int get_str_prot(char *opt, WINDOW *win);
int get_score(char *opt, WINDOW *win); int get_score(char *opt, WINDOW *win);
@ -83,9 +84,8 @@ OPTION optlist[] = {
/* /*
* The ability field is read-only * The ability field is read-only
*/ */
get_abil(abil, win) void
int *abil; get_abil(int *abil, WINDOW *win)
WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
@ -97,9 +97,8 @@ WINDOW *win;
/* /*
* The quest field is read-only * The quest field is read-only
*/ */
get_quest(quest, win) void
int *quest; get_quest(int *quest, WINDOW *win)
WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
@ -113,9 +112,8 @@ WINDOW *win;
* "Get" a read-only value. * "Get" a read-only value.
*/ */
get_ro(win, oy, ox) int
WINDOW *win; get_ro(WINDOW *win, int oy, int ox)
register int oy, ox;
{ {
register int ny, nx; register int ny, nx;
register bool op_bad; register bool op_bad;
@ -152,9 +150,8 @@ register int oy, ox;
* allow changing a boolean option and print it out * allow changing a boolean option and print it out
*/ */
get_bool(bp, win) int
bool *bp; get_bool(bool *bp, WINDOW *win)
WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
register bool op_bad; register bool op_bad;
@ -202,9 +199,8 @@ WINDOW *win;
/* /*
* set a string option * set a string option
*/ */
get_str(opt, win) int
register char *opt; get_str(char *opt, WINDOW *win)
WINDOW *win;
{ {
register char *sp; register char *sp;
register int c, oy, ox; register int c, oy, ox;
@ -278,7 +274,8 @@ WINDOW *win;
/* /*
* print and then set options from the terminal * print and then set options from the terminal
*/ */
option() void
option(void)
{ {
register OPTION *op; register OPTION *op;
register int retval; register int retval;
@ -334,8 +331,8 @@ option()
* or the end of the entire option string. * or the end of the entire option string.
*/ */
parse_opts(str) void
register char *str; parse_opts(char *str)
{ {
register char *sp; register char *sp;
register OPTION *op; register OPTION *op;
@ -428,9 +425,8 @@ register char *str;
/* /*
* print the character type * print the character type
*/ */
put_abil(ability, win) void
int *ability; put_abil(int *ability, WINDOW *win)
WINDOW *win;
{ {
waddstr(win, char_class[*ability].name); waddstr(win, char_class[*ability].name);
} }
@ -440,9 +436,8 @@ WINDOW *win;
* print out the quest * print out the quest
*/ */
put_quest(quest, win) void
int *quest; put_quest(int *quest, WINDOW *win)
WINDOW *win;
{ {
waddstr(win, rel_magic[*quest].mi_name); waddstr(win, rel_magic[*quest].mi_name);
} }
@ -451,9 +446,8 @@ WINDOW *win;
/* /*
* put out a boolean * put out a boolean
*/ */
put_bool(b, win) void
bool *b; put_bool(bool *b, WINDOW *win)
WINDOW *win;
{ {
waddstr(win, *b ? "True" : "False"); waddstr(win, *b ? "True" : "False");
} }
@ -464,9 +458,8 @@ WINDOW *win;
/* /*
* put out a string * put out a string
*/ */
put_str(str, win) void
char *str; put_str(char *str, WINDOW *win)
WINDOW *win;
{ {
waddstr(win, str); waddstr(win, str);
} }

View file

@ -15,7 +15,8 @@
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
extern char rnd_terrain(), get_terrain(); char rnd_terrain(void);
char get_terrain(char one, char two, char three, char four);
/* /*
* init_terrain: * init_terrain:
@ -23,7 +24,7 @@ extern char rnd_terrain(), get_terrain();
*/ */
void void
init_terrain() init_terrain(void)
{ {
register struct room *rp; register struct room *rp;
@ -42,11 +43,9 @@ init_terrain()
void void
do_terrain(basey, basex, deltay, deltax, fresh) do_terrain(int basey, int basex, int deltay, int deltax, bool fresh)
int basey, basex, deltay, deltax;
bool fresh;
{ {
register cury, curx; /* Current y and x positions */ register int cury, curx; /* Current y and x positions */
/* Lay out the boundary */ /* Lay out the boundary */
for (cury=1; cury<lines-2; cury++) { /* Vertical "walls" */ for (cury=1; cury<lines-2; cury++) { /* Vertical "walls" */
@ -129,7 +128,7 @@ bool fresh;
*/ */
char char
rnd_terrain() rnd_terrain(void)
{ {
int chance = rnd(100); int chance = rnd(100);
@ -153,8 +152,7 @@ rnd_terrain()
*/ */
char char
get_terrain(one, two, three, four) get_terrain(char one, char two, char three, char four)
char one, two, three, four;
{ {
register int i; register int i;
int forest = 0, mountain = 0, lake = 0, meadow = 0, total = 0; int forest = 0, mountain = 0, lake = 0, meadow = 0, total = 0;
@ -207,7 +205,6 @@ char one, two, three, four;
*/ */
void void
lake_check(place) lake_check(coord *place)
coord *place;
{ {
} }

View file

@ -20,6 +20,8 @@
#include "menu.h" #include "menu.h"
#endif #endif
bool is_type (struct object *obj, int type);
/* /*
* Routines to deal with the pack * Routines to deal with the pack
*/ */
@ -30,9 +32,7 @@
* use it as the linked_list pointer instead of gettting it off the ground. * use it as the linked_list pointer instead of gettting it off the ground.
*/ */
bool bool
add_pack(item, silent, packret) add_pack(struct linked_list *item, bool silent, struct linked_list **packret)
register struct linked_list *item, **packret;
bool silent;
{ {
register struct linked_list *ip, *lp = NULL, *ap; register struct linked_list *ip, *lp = NULL, *ap;
register struct object *obj, *op = NULL; register struct object *obj, *op = NULL;
@ -372,9 +372,8 @@ static char Displines[MAXPACK+1][LINELEN+1]; /* The lines themselves */
* inventory: * inventory:
* list what is in the pack * list what is in the pack
*/ */
inventory(list, type) bool
register struct linked_list *list; inventory(struct linked_list *list, int type)
register int type;
{ {
register struct object *obj; register struct object *obj;
register char ch; register char ch;
@ -511,7 +510,7 @@ register int type;
* Allow player to inventory a single item * Allow player to inventory a single item
*/ */
void void
picky_inven() picky_inven(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register char ch, mch; register char ch, mch;
@ -565,13 +564,11 @@ picky_inven()
/* /*
* get_item: * get_item:
* pick something out of a pack for a purpose * pick something out of a pack for a purpose
* purpose: NULL if we should be silent (no prompts)
*/ */
struct linked_list * struct linked_list *
get_item(list, purpose, type, askfirst, showcost) get_item(struct linked_list *list, char *purpose, int type, bool askfirst,
reg struct linked_list *list; bool showcost)
char *purpose; /* NULL if we should be silent (no prompts) */
int type;
bool askfirst, showcost;
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -754,7 +751,7 @@ bool askfirst, showcost;
#endif #endif
/* Write the screen */ /* Write the screen */
if ((menu_overlay && cnt < lines / 2 + 2) || cnt == 1) { if ((menu_overlay && cnt < lines / 2 + 2) || cnt == 1) {
over_win(cw, hw, cnt + 2, maxx + 3, cnt, curx, NULL); over_win(cw, hw, cnt + 2, maxx + 3, cnt, curx, '\0');
cnt = -1; /* Indicate we used over_win */ cnt = -1; /* Indicate we used over_win */
} }
else draw(hw); else draw(hw);
@ -812,9 +809,8 @@ bool askfirst, showcost;
} }
} }
pack_char(list, obj) char
register struct object *obj; pack_char(struct linked_list *list, struct object *obj)
struct linked_list *list;
{ {
register struct linked_list *item; register struct linked_list *item;
register char c; register char c;
@ -836,8 +832,8 @@ struct linked_list *list;
* cur_null: * cur_null:
* This updates cur_weapon etc for dropping things * This updates cur_weapon etc for dropping things
*/ */
cur_null(op) void
reg struct object *op; cur_null(struct object *op)
{ {
if (op == cur_weapon) cur_weapon = NULL; if (op == cur_weapon) cur_weapon = NULL;
else if (op == cur_armor) cur_armor = NULL; else if (op == cur_armor) cur_armor = NULL;
@ -861,7 +857,8 @@ reg struct object *op;
* idenpack: * idenpack:
* Identify all the items in the pack * Identify all the items in the pack
*/ */
idenpack() void
idenpack(void)
{ {
reg struct linked_list *pc; reg struct linked_list *pc;
@ -869,9 +866,8 @@ idenpack()
whatis(pc); whatis(pc);
} }
is_type (obj, type) bool
register struct object *obj; is_type (struct object *obj, int type)
register int type;
{ {
register bool current; register bool current;
@ -1024,8 +1020,8 @@ register int type;
return(FALSE); return(FALSE);
} }
del_pack(item) void
register struct linked_list *item; del_pack(struct linked_list *item)
{ {
register struct object *obj; register struct object *obj;
@ -1047,9 +1043,8 @@ register struct linked_list *item;
* it to him. * it to him.
*/ */
carry_obj(mp, chance) void
register struct thing *mp; carry_obj(struct thing *mp, int chance)
int chance;
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -1072,75 +1067,75 @@ int chance;
*/ */
if (on(*mp, ISUNIQUE)) { if (on(*mp, ISUNIQUE)) {
if (on(*mp, CARRYMDAGGER)) { if (on(*mp, CARRYMDAGGER)) {
item = spec_item(RELIC, MUSTY_DAGGER, NULL, NULL); item = spec_item(RELIC, MUSTY_DAGGER, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYCLOAK)) { if (on(*mp, CARRYCLOAK)) {
item = spec_item(RELIC, EMORI_CLOAK, NULL, NULL); item = spec_item(RELIC, EMORI_CLOAK, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYANKH)) { if (on(*mp, CARRYANKH)) {
item = spec_item(RELIC, HEIL_ANKH, NULL, NULL); item = spec_item(RELIC, HEIL_ANKH, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYSTAFF)) { if (on(*mp, CARRYSTAFF)) {
item = spec_item(RELIC, MING_STAFF, NULL, NULL); item = spec_item(RELIC, MING_STAFF, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYWAND)) { if (on(*mp, CARRYWAND)) {
item = spec_item(RELIC, ORCUS_WAND, NULL, NULL); item = spec_item(RELIC, ORCUS_WAND, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYROD)) { if (on(*mp, CARRYROD)) {
item = spec_item(RELIC, ASMO_ROD, NULL, NULL); item = spec_item(RELIC, ASMO_ROD, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYYAMULET)) { if (on(*mp, CARRYYAMULET)) {
item = spec_item(RELIC, YENDOR_AMULET, NULL, NULL); item = spec_item(RELIC, YENDOR_AMULET, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYBAMULET)) { if (on(*mp, CARRYBAMULET)) {
item = spec_item(RELIC, STONEBONES_AMULET, NULL, NULL); item = spec_item(RELIC, STONEBONES_AMULET, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYMANDOLIN)) { if (on(*mp, CARRYMANDOLIN)) {
item = spec_item(RELIC, BRIAN_MANDOLIN, NULL, NULL); item = spec_item(RELIC, BRIAN_MANDOLIN, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYEYE)) { if (on(*mp, CARRYEYE)) {
item = spec_item(RELIC, EYE_VECNA, NULL, NULL); item = spec_item(RELIC, EYE_VECNA, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYAXE)) { if (on(*mp, CARRYAXE)) {
item = spec_item(RELIC, AXE_AKLAD, NULL, NULL); item = spec_item(RELIC, AXE_AKLAD, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
@ -1148,7 +1143,7 @@ int chance;
if (on(*mp, CARRYQUILL)) { if (on(*mp, CARRYQUILL)) {
register int i, howmany; register int i, howmany;
item = spec_item(RELIC, QUILL_NAGROM, NULL, NULL); item = spec_item(RELIC, QUILL_NAGROM, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
obj->o_charges = rnd(QUILLCHARGES); obj->o_charges = rnd(QUILLCHARGES);
@ -1165,25 +1160,25 @@ int chance;
} }
} }
if (on(*mp, CARRYMSTAR)) { if (on(*mp, CARRYMSTAR)) {
item = spec_item(RELIC, HRUGGEK_MSTAR, NULL, NULL); item = spec_item(RELIC, HRUGGEK_MSTAR, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYFLAIL)) { if (on(*mp, CARRYFLAIL)) {
item = spec_item(RELIC, YEENOGHU_FLAIL, NULL, NULL); item = spec_item(RELIC, YEENOGHU_FLAIL, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYHORN)) { if (on(*mp, CARRYHORN)) {
item = spec_item(RELIC, GERYON_HORN, NULL, NULL); item = spec_item(RELIC, GERYON_HORN, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
} }
if (on(*mp, CARRYSURTURRING)) { if (on(*mp, CARRYSURTURRING)) {
item = spec_item(RELIC, SURTUR_RING, NULL, NULL); item = spec_item(RELIC, SURTUR_RING, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
attach(mp->t_pack, item); attach(mp->t_pack, item);
@ -1193,7 +1188,7 @@ int chance;
* If it carries gold, give it some * If it carries gold, give it some
*/ */
if (on(*mp, CARRYGOLD) && rnd(100) < chance) { if (on(*mp, CARRYGOLD) && rnd(100) < chance) {
item = spec_item(GOLD, NULL, NULL, NULL); item = spec_item(GOLD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_count = GOLDCALC + GOLDCALC; obj->o_count = GOLDCALC + GOLDCALC;
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
@ -1204,7 +1199,7 @@ int chance;
* If it carries food, give it some * If it carries food, give it some
*/ */
if (on(*mp, CARRYFOOD) && rnd(100) < chance) { if (on(*mp, CARRYFOOD) && rnd(100) < chance) {
item = spec_item(FOOD, NULL, NULL, NULL); item = spec_item(FOOD, 0, 0, 0);
obj = OBJPTR(item); obj = OBJPTR(item);
obj->o_weight = things[TYP_FOOD].mi_wght; obj->o_weight = things[TYP_FOOD].mi_wght;
obj->o_pos = mp->t_pos; obj->o_pos = mp->t_pos;
@ -1328,8 +1323,8 @@ int chance;
* he wants (* means everything). * he wants (* means everything).
*/ */
grab(y, x) int
register y, x; grab(int y, int x)
{ {
register struct linked_list *next_item, *item; register struct linked_list *next_item, *item;
register struct object *obj; register struct object *obj;
@ -1398,7 +1393,7 @@ register y, x;
* to he right. * to he right.
*/ */
if (menu_overlay && num_there < lines / 2 + 2) { if (menu_overlay && num_there < lines / 2 + 2) {
over_win(cw, hw, num_there + 2, maxlen + 3, num_there, curlen, NULL); over_win(cw, hw, num_there + 2, maxlen + 3, num_there, curlen, '\0');
pagecnt = -1; /* Indicate we used over_win */ pagecnt = -1; /* Indicate we used over_win */
} }
else draw(hw); /* write screen */ else draw(hw); /* write screen */
@ -1446,7 +1441,7 @@ register y, x;
*/ */
if (menu_overlay && num_there < lines / 2 + 2) { if (menu_overlay && num_there < lines / 2 + 2) {
over_win(cw, hw, num_there + 2, maxlen + 3, over_win(cw, hw, num_there + 2, maxlen + 3,
num_there, 49, NULL); num_there, 49, '\0');
cnt = -1; /* Indicate we used over_win */ cnt = -1; /* Indicate we used over_win */
} }
else draw(hw); /* write screen */ else draw(hw); /* write screen */
@ -1485,8 +1480,8 @@ register y, x;
* Create a pack for sellers (a la quartermaster) * Create a pack for sellers (a la quartermaster)
*/ */
make_sell_pack(tp) void
struct thing *tp; make_sell_pack(struct thing *tp)
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;

View file

@ -18,15 +18,20 @@
* @(#)passages.c 3.4 (Berkeley) 6/15/81 * @(#)passages.c 3.4 (Berkeley) 6/15/81
*/ */
#include <stdlib.h>
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
void conn(int r1, int r2);
void door(struct room *rm, coord *cp);
/* /*
* do_passages: * do_passages:
* Draw all the passages on a level. * Draw all the passages on a level.
*/ */
do_passages() void
do_passages(void)
{ {
register struct rdes *r1, *r2 = NULL; register struct rdes *r1, *r2 = NULL;
register int i, j; register int i, j;
@ -134,8 +139,8 @@ do_passages()
* Draw a corridor from a room in a certain direction. * Draw a corridor from a room in a certain direction.
*/ */
conn(r1, r2) void
int r1, r2; conn(int r1, int r2)
{ {
register struct room *rpf, *rpt = NULL; register struct room *rpf, *rpt = NULL;
register char rmt; register char rmt;
@ -348,9 +353,8 @@ int r1, r2;
* also enters the door in the exits array of the room. * also enters the door in the exits array of the room.
*/ */
door(rm, cp) void
register struct room *rm; door(struct room *rm, coord *cp)
register coord *cp;
{ {
struct linked_list *newroom; struct linked_list *newroom;
coord *exit; coord *exit;

View file

@ -18,19 +18,23 @@
*/ */
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
#ifdef PC7300 #ifdef PC7300
#include "menu.h" #include "menu.h"
#endif #endif
bool pick_spell(struct spells spells[], int ability, int num_spells, int power,
char *prompt, char *type);
/* /*
* affect: * affect:
* cleric affecting undead * cleric affecting undead
*/ */
affect() void
affect(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *tp; register struct thing *tp;
@ -147,7 +151,8 @@ annoy:
/* /*
* the magic user is going to try and cast a spell * the magic user is going to try and cast a spell
*/ */
cast() void
cast(void)
{ {
int spell_ability, int spell_ability,
which_spell, which_spell,
@ -202,7 +207,7 @@ cast()
if (magic_spells[which_spell].s_type == TYP_POTION) if (magic_spells[which_spell].s_type == TYP_POTION)
quaff( magic_spells[which_spell].s_which, quaff( magic_spells[which_spell].s_which,
NULL, 0,
magic_spells[which_spell].s_flag, magic_spells[which_spell].s_flag,
FALSE); FALSE);
else if (magic_spells[which_spell].s_type == TYP_SCROLL) else if (magic_spells[which_spell].s_type == TYP_SCROLL)
@ -222,7 +227,8 @@ cast()
/* /*
* the druid asks his deity for a spell * the druid asks his deity for a spell
*/ */
chant() void
chant(void)
{ {
register int num_chants, register int num_chants,
chant_ability, chant_ability,
@ -290,7 +296,7 @@ chant()
if (druid_spells[which_chant].s_type == TYP_POTION) if (druid_spells[which_chant].s_type == TYP_POTION)
quaff( druid_spells[which_chant].s_which, quaff( druid_spells[which_chant].s_which,
NULL, 0,
druid_spells[which_chant].s_flag, druid_spells[which_chant].s_flag,
FALSE); FALSE);
else if (druid_spells[which_chant].s_type == TYP_SCROLL) else if (druid_spells[which_chant].s_type == TYP_SCROLL)
@ -309,7 +315,8 @@ chant()
/* Constitution bonus */ /* Constitution bonus */
const_bonus() /* Hit point adjustment for changing levels */ int
const_bonus(void) /* Hit point adjustment for changing levels */
{ {
register int bonus; register int bonus;
if (pstats.s_const > 6 && pstats.s_const <= 14) if (pstats.s_const > 6 && pstats.s_const <= 14)
@ -343,7 +350,8 @@ const_bonus() /* Hit point adjustment for changing levels */
* Sense gold * Sense gold
*/ */
gsense() void
gsense(void)
{ {
/* Only thieves can do this */ /* Only thieves can do this */
if (player.t_ctype != C_THIEF && player.t_ctype != C_ASSASIN) { if (player.t_ctype != C_THIEF && player.t_ctype != C_ASSASIN) {
@ -351,13 +359,14 @@ gsense()
return; return;
} }
read_scroll(S_GFIND, NULL, FALSE); read_scroll(S_GFIND, 0, FALSE);
} }
/* /*
* the cleric asks his deity for a spell * the cleric asks his deity for a spell
*/ */
pray() void
pray(void)
{ {
register int num_prayers, register int num_prayers,
prayer_ability, prayer_ability,
@ -430,7 +439,7 @@ pray()
if (cleric_spells[which_prayer].s_type == TYP_POTION) if (cleric_spells[which_prayer].s_type == TYP_POTION)
quaff( cleric_spells[which_prayer].s_which, quaff( cleric_spells[which_prayer].s_which,
NULL, 0,
cleric_spells[which_prayer].s_flag, cleric_spells[which_prayer].s_flag,
FALSE); FALSE);
else if (cleric_spells[which_prayer].s_type == TYP_SCROLL) else if (cleric_spells[which_prayer].s_type == TYP_SCROLL)
@ -454,7 +463,8 @@ pray()
* Steal in direction given in delta * Steal in direction given in delta
*/ */
steal() void
steal(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *tp; register struct thing *tp;
@ -586,14 +596,16 @@ static char Displines[MAXSPELLS+1][LINELEN+1]; /* The lines themselves */
/* /*
* this routine lets the player pick the spell that they * this routine lets the player pick the spell that they
* want to cast regardless of character class * want to cast regardless of character class
* spells: spell list
* ability: spell ability
* num_spells: number of spells that can be cast
* power: spell power
* prompt: prompt for spell list
* type: type of thing--> spell, prayer, chant
*/ */
pick_spell(spells, ability, num_spells, power, prompt, type) bool
struct spells spells[]; /* spell list */ pick_spell(struct spells spells[], int ability, int num_spells, int power,
int ability; /* spell ability */ char *prompt, char *type)
int num_spells; /* number of spells that can be cast */
int power; /* spell power */
char *prompt; /* prompt for spell list */
char *type; /* type of thing--> spell, prayer, chant */
{ {
bool nohw = FALSE; bool nohw = FALSE;
register int i; register int i;
@ -754,7 +766,7 @@ char *type; /* type of thing--> spell, prayer, chant */
#endif #endif
/* Should we overlay? */ /* Should we overlay? */
if (menu_overlay && num_spells + 3 < lines / 2) { if (menu_overlay && num_spells + 3 < lines / 2) {
over_win(cw, hw, num_spells + 5, maxlen + 3, 0, curlen, NULL); over_win(cw, hw, num_spells + 5, maxlen + 3, 0, curlen, '\0');
} }
else draw(hw); else draw(hw);
} }
@ -780,7 +792,7 @@ char *type; /* type of thing--> spell, prayer, chant */
/* Should we overlay? */ /* Should we overlay? */
if (menu_overlay && num_spells + 3 < lines / 2) { if (menu_overlay && num_spells + 3 < lines / 2) {
over_win(cw, hw, num_spells + 5, maxlen + 3, over_win(cw, hw, num_spells + 5, maxlen + 3,
0, curlen, NULL); 0, curlen, '\0');
} }
else draw(hw); else draw(hw);

View file

@ -46,8 +46,7 @@ void (*res_abil[NUMABILITIES])() = {
*/ */
void void
add_constitution(change) add_constitution(int change)
int change;
{ {
/* Do the potion */ /* Do the potion */
if (change < 0) { if (change < 0) {
@ -71,8 +70,7 @@ int change;
*/ */
void void
add_charisma(change) add_charisma(int change)
int change;
{ {
/* Do the potion */ /* Do the potion */
if (change < 0) msg("You feel less attractive now."); if (change < 0) msg("You feel less attractive now.");
@ -92,8 +90,7 @@ int change;
*/ */
void void
add_dexterity(change) add_dexterity(int change)
int change;
{ {
int ring_str; /* Value of ring strengths */ int ring_str; /* Value of ring strengths */
@ -123,8 +120,8 @@ int change;
* add a haste to the player * add a haste to the player
*/ */
add_haste(blessed) void
bool blessed; add_haste(bool blessed)
{ {
int hasttime; int hasttime;
@ -161,8 +158,7 @@ bool blessed;
* Increase player's intelligence * Increase player's intelligence
*/ */
void void
add_intelligence(change) add_intelligence(int change)
int change;
{ {
int ring_str; /* Value of ring strengths */ int ring_str; /* Value of ring strengths */
@ -190,7 +186,8 @@ int change;
/* /*
* this routine makes the hero move slower * this routine makes the hero move slower
*/ */
add_slow() void
add_slow(void)
{ {
/* monks cannot be slowed or hasted */ /* monks cannot be slowed or hasted */
if (player.t_ctype == C_MONK || ISWEARING(R_FREEDOM)) { if (player.t_ctype == C_MONK || ISWEARING(R_FREEDOM)) {
@ -219,8 +216,7 @@ add_slow()
*/ */
void void
add_strength(change) add_strength(int change)
int change;
{ {
if (change < 0) { if (change < 0) {
@ -238,8 +234,7 @@ int change;
*/ */
void void
add_wisdom(change) add_wisdom(int change)
int change;
{ {
int ring_str; /* Value of ring strengths */ int ring_str; /* Value of ring strengths */
@ -264,11 +259,8 @@ int change;
pstats.s_wisdom += ring_str; pstats.s_wisdom += ring_str;
} }
quaff(which, kind, flags, is_potion) void
int which; quaff(int which, int kind, int flags, bool is_potion)
int kind;
int flags;
bool is_potion;
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *item, *titem; register struct linked_list *item, *titem;
@ -869,8 +861,7 @@ bool is_potion;
*/ */
void void
res_dexterity(howmuch) res_dexterity(int howmuch)
int howmuch;
{ {
short save_max; short save_max;
int ring_str; int ring_str;
@ -903,8 +894,7 @@ int howmuch;
*/ */
void void
res_intelligence(howmuch) res_intelligence(int howmuch)
int howmuch;
{ {
short save_max; short save_max;
int ring_str; int ring_str;
@ -931,8 +921,7 @@ int howmuch;
*/ */
void void
res_wisdom(howmuch) res_wisdom(int howmuch)
int howmuch;
{ {
short save_max; short save_max;
int ring_str; int ring_str;
@ -959,8 +948,7 @@ int howmuch;
*/ */
void void
res_constitution(howmuch) res_constitution(int howmuch)
int howmuch;
{ {
if (howmuch > 0) if (howmuch > 0)
pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const); pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const);
@ -972,8 +960,7 @@ int howmuch;
*/ */
void void
res_charisma(howmuch) res_charisma(int howmuch)
int howmuch;
{ {
if (howmuch > 0) if (howmuch > 0)
pstats.s_charisma = pstats.s_charisma =

View file

@ -12,6 +12,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
@ -23,8 +24,8 @@
/* /*
* how much food does this ring use up? * how much food does this ring use up?
*/ */
ring_eat(hand) int
register int hand; ring_eat(int hand)
{ {
if (cur_ring[hand] == NULL) if (cur_ring[hand] == NULL)
return 0; return 0;
@ -48,8 +49,8 @@ register int hand;
return 0; return 0;
} }
ring_on(item) void
register struct linked_list *item; ring_on(struct linked_list *item)
{ {
register struct object *obj; register struct object *obj;
register int save_max; register int save_max;
@ -111,8 +112,7 @@ register struct linked_list *item;
* print ring bonuses * print ring bonuses
*/ */
char * char *
ring_num(obj) ring_num(struct object *obj)
register struct object *obj;
{ {
static char buf[5]; static char buf[5];
@ -146,7 +146,8 @@ register struct object *obj;
/* /*
* Return the effect of the specified ring * Return the effect of the specified ring
*/ */
ring_value(type) int
ring_value(int type)
{ {
int result = 0; int result = 0;

View file

@ -91,15 +91,15 @@ static char *rip[] = {
0 0
}; };
char *killname(); char *killname(short monst);
void showpack(char *howso);
int update(struct sc_ent top_ten[], unsigned long amount, short quest,
char *whoami, short flags, short level, short monst, short ctype,
char *system, char *login);
void void
byebye(sig) byebye(int sig)
int sig;
{ {
if (!isendwin()) { if (!isendwin()) {
clear(); clear();
@ -118,8 +118,8 @@ int sig;
* Do something really fun when he dies * Do something really fun when he dies
*/ */
death(monst) void
register short monst; death(short monst)
{ {
register char **dp = rip, *killer; register char **dp = rip, *killer;
register struct tm *lt; register struct tm *lt;
@ -154,7 +154,8 @@ register short monst;
/* /*
* Restore window characteristics on a hard window terminal (PC7300). * Restore window characteristics on a hard window terminal (PC7300).
*/ */
endhardwin() void
endhardwin(void)
{ {
register int i; register int i;
struct utdata labelbuf; struct utdata labelbuf;
@ -172,8 +173,7 @@ endhardwin()
#endif #endif
char * char *
killname(monst) killname(short monst)
register short monst;
{ {
static char mons_name[LINELEN]; static char mons_name[LINELEN];
int i; int i;
@ -249,9 +249,8 @@ writelog(unsigned long amount, int flags, short monst)
*/ */
/* VARARGS2 */ /* VARARGS2 */
score(amount, flags, monst) void
unsigned long amount; score(unsigned long amount, int flags, short monst)
short monst;
{ {
static struct sc_ent top_ten[NUMSCORE]; static struct sc_ent top_ten[NUMSCORE];
register struct sc_ent *scp; register struct sc_ent *scp;
@ -672,11 +671,10 @@ short monst;
* scorein: * scorein:
* Convert a character string that has been translated from a * Convert a character string that has been translated from a
* score file by scoreout() back to a score file structure. * score file by scoreout() back to a score file structure.
* num_bytes: Number of bytes of input that we want to convert
*/ */
scorein(input, scores, num_bytes) void
unsigned char *input; scorein(unsigned char *input, struct sc_ent scores[], int num_bytes)
struct sc_ent scores[];
int num_bytes; /* Number of bytes of input that we want to convert */
{ {
register int i, j; register int i, j;
unsigned long *lptr; unsigned long *lptr;
@ -731,9 +729,8 @@ int num_bytes; /* Number of bytes of input that we want to convert */
* this for compatibility sake since some machines write out fields in * this for compatibility sake since some machines write out fields in
* different orders. * different orders.
*/ */
scoreout(scores, output) void
struct sc_ent scores[]; scoreout(struct sc_ent scores[], unsigned char *output)
unsigned char *output;
{ {
register int i, j; register int i, j;
unsigned long *lptr; unsigned long *lptr;
@ -783,8 +780,8 @@ unsigned char *output;
* showpack: * showpack:
* Display the contents of the hero's pack * Display the contents of the hero's pack
*/ */
showpack(howso) void
char *howso; showpack(char *howso)
{ {
reg char *iname; reg char *iname;
reg int cnt, packnum; reg int cnt, packnum;
@ -813,7 +810,8 @@ char *howso;
refresh(); refresh();
} }
total_winner() void
total_winner(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;
@ -876,11 +874,10 @@ total_winner()
exit(0); exit(0);
} }
update(top_ten, amount, quest, whoami, flags, level, monst, ctype, system, login) int
struct sc_ent top_ten[]; update(struct sc_ent top_ten[], unsigned long amount, short quest, char *whoami,
unsigned long amount; short flags, short level, short monst, short ctype, char *system,
short quest, flags, level, monst, ctype; char *login)
char *whoami, *system, *login;
{ {
register struct sc_ent *scp, *sc2; register struct sc_ent *scp, *sc2;
int retval=0; /* 1 if a change, 0 otherwise */ int retval=0; /* 1 if a change, 0 otherwise */

View file

@ -1121,45 +1121,317 @@ struct delayed_action {
int d_time; int d_time;
} ; } ;
struct linked_list *find_mons(), *find_obj(), *get_item(), *new_item(), void _attach(struct linked_list **list, struct linked_list *item);
*new_thing(), *wake_monster(), *get_hurl(), void _detach(struct linked_list **list, struct linked_list *item);
*spec_item(), *creat_item(), *wield_weap(); void _o_free_list(struct linked_list **ptr);
struct room *roomin(); void _r_free_list(struct linked_list **ptr);
struct trap *trap_at(); void _t_free_list(struct linked_list **ptr);
int ac_compute(bool ignoremetal);
void activity(void);
void add_charisma(int change);
void add_constitution(int change);
void add_dexterity(int change);
void add_haste(bool blessed);
void add_intelligence(int change);
bool add_pack(struct linked_list *item, bool silent,
struct linked_list **packret);
void add_slow(void);
void add_strength(int change);
void add_wisdom(int change);
void addmsg(char *fmt, ...);
void affect(void);
void aggravate(bool do_uniques, bool do_good);
void alchemy(struct object *obj);
void appear(void);
bool attack(struct thing *mp, struct object *weapon, bool thrown);
void auto_save(int sig);
char be_trapped(struct thing *th, coord *tc);
bool blue_light(bool blessed, bool cursed);
void bugkill(int sig);
void buy_it(void);
void byebye(int sig);
bool can_blink(struct thing *tp);
coord *can_shoot(coord *er, coord *ee);
bool cansee(int y, int x);
void carry_obj(struct thing *mp, int chance);
void cast(void);
void changeclass(int newclass);
void chant(void);
void chant_recovery(void);
void chase(struct thing *tp, coord *ee, struct room *rer, struct room *ree,
bool flee);
long check_level(void);
void check_residue(struct thing *tp);
void chg_str(int amt);
void cloak_charge(struct object *obj);
void command(void);
void confus_player(void);
int const_bonus(void);
void corr_move(int dy, int dx);
struct linked_list *creat_item(void);
bool creat_mons(struct thing *person, short monster, bool report);
void create_obj(bool prompt, int which_item, int which_type);
void cur_null(struct object *op);
void cure_disease(void);
void dbotline(WINDOW *scr, char *message);
void death(short monst);
void del_pack(struct linked_list *item);
void destroy_item(struct linked_list *item);
int dex_compute(void);
int dext_plus(int dexterity);
int dext_prot(int dexterity);
bool diag_ok(coord *sp, coord *ep, struct thing *flgptr);
void dip_it(void);
void do_chase(struct thing *th);
void do_daemons(int flag);
void do_fuses(int flag);
void do_maze(void);
void do_motion(struct object *obj, int ydelta, int xdelta, struct thing *tp);
void do_move(int dy, int dx);
void do_passages(void);
void do_post(bool startup);
void do_rooms(void);
void do_run(char ch);
void do_terrain(int basey, int basex, int deltay, int deltax, bool fresh);
void do_zap(struct thing *zapper, struct object *obj, coord *direction,
int which, int flags);
void doctor(struct thing *tp);
coord *doorway(struct room *rp, coord *door);
void draw_room(struct room *rp);
int dress_units(struct linked_list *item);
bool drop(struct linked_list *item);
bool dropcheck(struct object *op);
void dsrpt_monster(struct thing *tp, bool always, bool see_him);
void dsrpt_player(void);
void dust_appear(void);
void eat(void);
void eat_gold(struct object *obj);
int effect(struct thing *att, struct thing *def, struct object *weap,
bool thrown, bool see_att, bool see_def);
int encread(char *start, unsigned int size, int inf);
int encwrite(char *start, unsigned int size, int outf);
void endmsg(void);
void explode(struct thing *tp);
void extinguish(int (*func)());
void fall(struct linked_list *item, bool pr);
coord *fallpos(coord *pos, bool be_clear, int range);
void fatal(char *s);
bool fight(coord *mp, struct object *weap, bool thrown);
struct linked_list *find_mons(int y, int x);
struct linked_list *find_obj(int y, int x);
struct delayed_action *find_slot(int (*func)());
int findmindex(char *name);
void fix_stick(struct object *cur);
void fumble(void);
void fuse(int (*func)(), int arg, int time, int type);
void genmonsters(int least, bool treas);
coord get_coordinates(void);
bool get_dir(coord *direction);
struct linked_list *get_hurl(struct thing *tp);
struct linked_list *get_item(struct linked_list *list, char *purpose, int type,
bool askfirst, bool showcost);
int get_str(char *opt, WINDOW *win);
int get_worth(struct object *obj);
int getdeath(void);
bool getdelta(char match, int *dy, int *dx);
int grab(int y, int x);
void gsense(void);
bool hit_monster(int y, int x, struct object *obj, struct thing *tp);
int hitweight(void);
short id_monst(char monster);
void idenpack(void);
void init_colors(void);
void init_foods(void);
void init_materials(void);
void init_misc(void);
void init_names(void);
void init_player(void);
void init_stones(void);
void init_terrain(void);
void init_things(void);
void init_weapon(struct object *weap, char type);
char *inv_name(struct object *obj, bool drop);
bool inventory(struct linked_list *list, int type);
bool is_current(struct object *obj);
bool is_magic(struct object *obj);
bool isatrap(char ch);
int itemweight(struct object *wh);
void kill_daemon(int (*func)());
void killed(struct linked_list *item, bool pr, bool points, bool treasure);
void lake_check(coord *place);
void land(void);
void lengthen(int (*func)(), int xtime);
void light(coord *cp);
bool lit_room(struct room *rp);
void look(bool wakeup, bool runend);
void lower_level(short who);
void m_use_relic(struct thing *monster);
void m_use_wand(struct thing *monster);
void make_sell_pack(struct thing *tp);
short makemonster(bool showall, char *label, char *action) ;
bool maze_view(int y, int x);
char *misc_name(struct object *obj);
void missile(int ydelta, int xdelta, struct linked_list *item,
struct thing *tp);
char *monster_name(struct thing *tp);
bool move_hero(int why);
short movement(struct thing *tp);
void msg(char *fmt, ...);
void nameitem(struct linked_list *item, bool mark);
bool need_dir(int type, int which);
unsigned long netread(int *error, int size, FILE *stream);
int netwrite(unsigned long value, int size, FILE *stream);
char *new(int size);
struct linked_list *new_item(int size);
void new_level(LEVTYPE ltype);
void new_monster(struct linked_list *item, short type, coord *cp,
bool max_monster);
struct linked_list *new_thing(int thing_type, bool allow_curse);
void nobolt(void);
void nocold(void);
void nofire(void);
void nohaste(void);
void noslow(void);
char *num(int n1, int n2);
void o_discard(struct linked_list *item);
void option(void);
void over_win(WINDOW *oldwin, WINDOW *newin, int maxy, int maxx, int cursory,
int cursorx, char redraw);
char pack_char(struct linked_list *list, struct object *obj);
void parse_opts(char *str);
bool passwd(void);
void picky_inven(void);
bool player_zap(int which, int flag);
void playit(void);
void pray(void);
void prayer_recovery(void);
bool price_it(void);
char *prname(char *who, bool upper);
void quaff(int which, int kind, int flags, bool is_potion);
void quill_charge(void);
void quit(int sig);
void raise_level(void);
short randmonster(bool wander, bool no_unique);
void read_scroll(int which, int flag, bool is_scroll);
int readchar(void);
void res_charisma(int howmuch);
void res_constitution(int howmuch);
void res_dexterity(int howmuch);
void res_intelligence(int howmuch);
void res_strength(int howmuch);
void res_wisdom(int howmuch);
bool restore(char *file, char *envp[]);
void restscr(WINDOW *scr);
int ring_eat(int hand);
char *ring_num(struct object *obj);
int ring_value(int type);
void ring_on(struct linked_list *item);
void ring_search(void);
void ring_teleport(void);
int rnd(int range);
void rnd_pos(struct room *rp, coord *cp);
int rnd_room(void);
coord *rndmove(struct thing *who);
int roll(int number, int sides);
void rollwand(void);
struct room *roomin(coord *cp);
int rs_restore_file(int inf);
int rs_save_file(FILE *savef);
int runners(int segments);
void runto(struct thing *runner, coord *spot);
bool save(int which, struct thing *who, int adj);
bool save_game(void);
void score(unsigned long amount, int flags, short monst);
void search(bool is_thief, bool door_chime);
char secretdoor(int y, int x);
void sell(struct thing *tp);
void sell_it(void);
void set_trap(struct thing *tp, int y, int x);
void setup(void);
void shoot_bolt(struct thing *shooter, coord start, coord dir,
bool get_points, short reason, char *name, int damage);
bool shoot_ok(char ch);
char show(int y, int x);
void sight(void);
bool skirmish(struct thing *attacker, coord *mp, struct object *weap,
bool thrown);
struct linked_list *spec_item(int type, int which, int hit, int damage);
void spell_recovery(void);
void start_daemon(int (*func)(), int arg, int type);
void status(bool display);
void steal(void);
bool step_ok(int y, int x, int can_on_monst, struct thing *flgptr);
void stomach(void);
int str_compute(void);
int str_plus(short str);
void strangle(void);
void strucpy(char *s1, char *s2, int len);
void suffocate(void);
void swander(void);
bool swing(short class, int at_lvl, int op_arm, int wplus);
void take_off(void);
int teleport(void);
void total_winner(void);
int totalenc(struct thing *tp);
char *tr_name(char ch);
struct trap *trap_at(int y, int x);
void trap_look(void);
void updpack(int getmax, struct thing *tp);
void unclrhead(void);
void unchoke(void);
void unconfuse(void);
void undance(void);
void unphase(void);
void unsee(void);
void unskill(void);
void unstink(void);
int usage_time(struct linked_list *item);
void use_mm(int which);
char *vowelstr(char *str);
void wait_for(char ch);
struct linked_list *wake_monster(int y, int x);
void wake_room(struct room *rp);
void wanderer(void);
void waste_time(void);
int weap_move(struct thing *wielder, struct object *weap);
char *weap_name(struct object *obj);
void wear(void);
void wghtchk(void);
void whatis(struct linked_list *what);
void wield(void);
struct linked_list *wield_weap(struct object *thrown, struct thing *mp);
void writelog(unsigned long amount, int flags, short monst);
/* char *malloc(), *getenv(), *tr_name(), *new(), *sprintf(), */ char *md_crypt(char *key, char *salt);
char *getenv(), *tr_name(), *new(), int md_erasechar(void);
*vowelstr(), *inv_name(), *strcpy(), *strcat(); FILE *md_fdopen(int fd, char *mode);
char *num(), *ring_num(), *misc_num(), *blesscurse(), *p_kind(), int md_fileno(FILE *fp);
*typ_name(), *prname(), *monster_name(), *weap_name(), *misc_name(); void md_flushinp(void);
coord *rndmove(), *can_shoot(), *fallpos(), *doorway(), get_coordinates(); char *md_gethomedir(void);
short randmonster(), id_monst(), movement(); char *md_gethostname(void);
void quit(int), auto_save(int), bugkill(int), endit(int), tstp(int), char *md_getpass(char *prompt);
byebye(int); char *md_getroguedir(void);
int nohaste(), spell_recovery(), int md_getuid(void);
doctor(), runners(), swander(), unconfuse(), unsee(), fumble(), char *md_getusername(void);
unclrhead(), unphase(), noslow(), rollwand(), stomach(), sight(), void md_init(void);
unstink(), suffocate(), cure_disease(), shoot_bolt(), changeclass(), int md_killchar(void);
appear(), dust_appear(), unchoke(), alchemy(), trap_look(), strangle(), long md_memused(void);
ring_teleport(), ring_search(), grab(), dsrpt_player(), quill_charge(), int md_normaluser(void);
make_sell_pack(), unskill(), findmindex(), nobolt(), nofire(), nocold(), int md_rand(void);
usage_time(), eat_gold(), chant_recovery(), prayer_recovery(), void md_reopen_score(void);
dsrpt_monster(); int md_readchar(WINDOW *win);
bool blue_light(), can_blink(), creat_mons(), add_pack(), int md_shellescape(void);
straight_shot(), maze_view(), lit_room(), getdelta(), save_file(), int md_srand(int seed);
save_game(), m_use_it(), m_use_pack(), get_dir(), need_dir(); int md_unlink(char *file);
long lseek(), check_level(); int md_unlink_open_file(char *file, int inf);
void genmonsters(),
add_intelligence(), add_strength(), add_wisdom(), add_dexterity(),
add_constitution(), add_charisma(), res_intelligence(), res_strength(int),
res_wisdom(), res_dexterity(), res_constitution(), res_charisma();
void writelog(unsigned long amount, int flags, short monst);
#ifdef CHECKTIME #ifdef CHECKTIME
int checkout(); int checkout();
#endif #endif
#ifdef PC7300
void endhardwin(void);
#endif
/* /*
* Now all the global variables * Now all the global variables
@ -1297,11 +1569,7 @@ extern void (*add_abil[NUMABILITIES])(); /* Functions to change abilities */
extern void (*res_abil[NUMABILITIES])(); /* Functions to change abilities */ extern void (*res_abil[NUMABILITIES])(); /* Functions to change abilities */
extern int cNCOLORS, cNWOOD, cNMETAL, cNSTONES; extern int cNCOLORS, cNWOOD, cNMETAL, cNSTONES;
extern char *rainbow[], *stones[], *wood[], *metal[]; extern char *rainbow[], *stones[], *wood[], *metal[];
extern int land(), wghtchk(), undance(), cloak_charge(struct object *);
extern struct delayed_action d_list[MAXDAEMONS]; extern struct delayed_action d_list[MAXDAEMONS];
extern struct delayed_action f_list[MAXFUSES]; extern struct delayed_action f_list[MAXFUSES];
extern int demoncnt, fusecnt, between, chance; extern int demoncnt, fusecnt, between, chance;
#define CCHAR(x) ( (char) (x & A_CHARTEXT) ) #define CCHAR(x) ( (char) (x & A_CHARTEXT) )
extern char *md_gethostname(), *md_getusername(), *md_gethomedir(), *md_getroguedir(), *md_crypt();
extern FILE * md_fdopen(int fd, char *mode);
extern int md_fileno(FILE *fp);

View file

@ -21,7 +21,11 @@
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
do_rooms() void horiz(int cnt);
void vert(int cnt);
void
do_rooms(void)
{ {
register int i; register int i;
register struct room *rp; register struct room *rp;
@ -108,7 +112,7 @@ do_rooms()
has_gold = TRUE; /* This room has gold in it */ has_gold = TRUE; /* This room has gold in it */
item = spec_item(GOLD, NULL, NULL, NULL); item = spec_item(GOLD, 0, 0, 0);
cur = OBJPTR(item); cur = OBJPTR(item);
/* Put the gold into the level list of items */ /* Put the gold into the level list of items */
@ -178,9 +182,7 @@ do_rooms()
*/ */
coord * coord *
doorway(rp, door) doorway(struct room *rp, coord *door)
register struct room *rp;
register coord *door;
{ {
register int misses = 0; register int misses = 0;
static coord answer; static coord answer;
@ -209,8 +211,8 @@ register coord *door;
* Draw a box around a room * Draw a box around a room
*/ */
draw_room(rp) void
register struct room *rp; draw_room(struct room *rp)
{ {
register int j, k; register int j, k;
@ -237,8 +239,8 @@ register struct room *rp;
* draw a horizontal line * draw a horizontal line
*/ */
horiz(cnt) void
register int cnt; horiz(int cnt)
{ {
while (cnt--) while (cnt--)
addch('-'); addch('-');
@ -249,9 +251,8 @@ register int cnt;
* pick a random spot in a room * pick a random spot in a room
*/ */
rnd_pos(rp, cp) void
register struct room *rp; rnd_pos(struct room *rp, coord *cp)
register coord *cp;
{ {
cp->x = rp->r_pos.x + rnd(rp->r_max.x-2) + 1; cp->x = rp->r_pos.x + rnd(rp->r_max.x-2) + 1;
cp->y = rp->r_pos.y + rnd(rp->r_max.y-2) + 1; cp->y = rp->r_pos.y + rnd(rp->r_max.y-2) + 1;
@ -266,8 +267,7 @@ register coord *cp;
*/ */
struct room * struct room *
roomin(cp) roomin(coord *cp)
register coord *cp;
{ {
register struct room *rp; register struct room *rp;
@ -282,8 +282,8 @@ register coord *cp;
* draw a vertical line * draw a vertical line
*/ */
vert(cnt) void
register int cnt; vert(int cnt)
{ {
register int x, y; register int x, y;

View file

@ -42,6 +42,8 @@ extern struct uwdata wdata;
#define ENCWRITE encwrite #define ENCWRITE encwrite
#endif #endif
bool save_file(int savefd);
typedef struct stat STAT; typedef struct stat STAT;
extern char version[], encstr[]; extern char version[], encstr[];
@ -51,7 +53,7 @@ extern int errno;
STAT sbuf; STAT sbuf;
bool bool
save_game() save_game(void)
{ {
register int savefd; register int savefd;
register int c; register int c;
@ -122,8 +124,7 @@ gotfile:
* recieved * recieved
*/ */
void void
auto_save(sig) auto_save(int sig)
int sig;
{ {
register int savefd; register int savefd;
register int i; register int i;
@ -145,8 +146,7 @@ int sig;
* write the saved game on the file * write the saved game on the file
*/ */
bool bool
save_file(savefd) save_file(int savefd)
register int savefd;
{ {
register unsigned num_to_write, num_written; register unsigned num_to_write, num_written;
FILE *savef; FILE *savef;
@ -167,9 +167,8 @@ register int savefd;
else return(FALSE); else return(FALSE);
} }
restore(file, envp) bool
register char *file; restore(char *file, char *envp[])
char **envp;
{ {
register int inf; register int inf;
extern char **environ; extern char **environ;
@ -265,10 +264,8 @@ char **envp;
/* /*
* perform an encrypted write * perform an encrypted write
*/ */
encwrite(start, size, outf) int
register char *start; encwrite(char *start, unsigned int size, int outf)
register unsigned size;
register int outf;
{ {
register char *ep; register char *ep;
register int i = 0; register int i = 0;
@ -298,10 +295,8 @@ register int outf;
/* /*
* perform an encrypted read * perform an encrypted read
*/ */
encread(start, size, inf) int
register char *start; encread(char *start, unsigned int size, int inf)
register unsigned size;
register int inf;
{ {
register char *ep; register char *ep;
register int read_size; register int read_size;

View file

@ -20,12 +20,14 @@
#include "curses.h" #include "curses.h"
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <string.h>
#include "rogue.h" #include "rogue.h"
/* /*
* let the hero get rid of some type of monster (but not a UNIQUE!) * let the hero get rid of some type of monster (but not a UNIQUE!)
*/ */
genocide() void
genocide(void)
{ {
register struct linked_list *ip; register struct linked_list *ip;
register struct thing *mp; register struct thing *mp;
@ -57,10 +59,8 @@ genocide()
msg("You have wiped out the %s.", monsters[which_monst].m_name); msg("You have wiped out the %s.", monsters[which_monst].m_name);
} }
read_scroll(which, flag, is_scroll) void
register int which; read_scroll(int which, int flag, bool is_scroll)
int flag;
bool is_scroll;
{ {
register struct object *obj = NULL, *nobj; register struct object *obj = NULL, *nobj;
register struct linked_list *item, *nitem; register struct linked_list *item, *nitem;

View file

@ -73,6 +73,12 @@ static int format_error = FALSE;
static int endian = 0x01020304; static int endian = 0x01020304;
#define big_endian ( *((char *)&endian) == 0x01 ) #define big_endian ( *((char *)&endian) == 0x01 )
int list_size(struct linked_list *l);
int rs_write_int(FILE *savef, int c);
int rs_read_int(int inf, int *i);
int rs_write_object_list(FILE *savef, struct linked_list *l);
int rs_read_object_list(int inf, struct linked_list **list);
int int
rs_write(FILE *savef, void *ptr, size_t size) rs_write(FILE *savef, void *ptr, size_t size)
{ {
@ -2346,7 +2352,7 @@ rs_read_thing(int inf, struct thing *t)
return(READSTAT); return(READSTAT);
} }
int void
rs_fix_thing(struct thing *t) rs_fix_thing(struct thing *t)
{ {
struct thing *tp; struct thing *tp;

View file

@ -22,16 +22,14 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
void drain(int ymin, int ymax, int xmin, int xmax);
/* /*
* zap a stick and see what happens * zap a stick and see what happens
*/ */
do_zap(zapper, obj, direction, which, flags) void
struct thing *zapper; do_zap(struct thing *zapper, struct object *obj, coord *direction, int which,
struct object *obj; int flags)
coord *direction;
int which;
int flags;
{ {
register struct linked_list *item = NULL; register struct linked_list *item = NULL;
register struct thing *tp; register struct thing *tp;
@ -499,7 +497,7 @@ int flags;
if (pstats.s_hpt <= 0) { if (pstats.s_hpt <= 0) {
msg("Your life has been sucked from you -- More --"); msg("Your life has been sucked from you -- More --");
wait_for(' '); wait_for(' ');
death(zapper); death(zapper->t_index);
} }
else else
msg("You feel a great drain on your system"); msg("You feel a great drain on your system");
@ -625,8 +623,8 @@ int flags;
* Do drain hit points from player shtick * Do drain hit points from player shtick
*/ */
drain(ymin, ymax, xmin, xmax) void
int ymin, ymax, xmin, xmax; drain(int ymin, int ymax, int xmin, int xmax)
{ {
register int i, j, count; register int i, j, count;
register struct thing *ick; register struct thing *ick;
@ -698,8 +696,8 @@ int ymin, ymax, xmin, xmax;
/* /*
* initialize a stick * initialize a stick
*/ */
fix_stick(cur) void
register struct object *cur; fix_stick(struct object *cur)
{ {
if (EQUAL(ws_type[cur->o_which], "staff")) { if (EQUAL(ws_type[cur->o_which], "staff")) {
cur->o_weight = 100; cur->o_weight = 100;
@ -738,8 +736,8 @@ register struct object *cur;
/* /*
* Use the wand that our monster is wielding. * Use the wand that our monster is wielding.
*/ */
m_use_wand(monster) void
register struct thing *monster; m_use_wand(struct thing *monster)
{ {
register struct object *obj; register struct object *obj;
@ -764,14 +762,16 @@ register struct thing *monster;
*/ */
msg("%s points a %s at you!", prname(monster_name(monster), TRUE), msg("%s points a %s at you!", prname(monster_name(monster), TRUE),
ws_type[obj->o_which]); ws_type[obj->o_which]);
do_zap(monster, obj, &monster->t_newpos, obj->o_which, NULL); do_zap(monster, obj, &monster->t_newpos, obj->o_which, 0);
monster->t_wand /= 2; /* chance lowers with each use */ monster->t_wand /= 2; /* chance lowers with each use */
} }
/*
* type: type of item, NULL means stick
* which: which item
*/
bool bool
need_dir(type, which) need_dir(int type, int which)
int type, /* type of item, NULL means stick */
which; /* which item */
{ {
if (type == STICK || type == 0) { if (type == STICK || type == 0) {
switch (which) { switch (which) {
@ -799,9 +799,8 @@ return (FALSE); /* hope we don't get here */
/* /*
* let the player zap a stick and see what happens * let the player zap a stick and see what happens
*/ */
player_zap(which, flag) bool
int which; player_zap(int which, int flag)
int flag;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;
@ -868,13 +867,9 @@ int flag;
* given direction * given direction
*/ */
shoot_bolt(shooter, start, dir, get_points, reason, name, damage) void
struct thing *shooter; shoot_bolt(struct thing *shooter, coord start, coord dir, bool get_points,
coord start, dir; short reason, char *name, int damage)
bool get_points;
short reason;
char *name;
int damage;
{ {
register char dirch, ch; register char dirch, ch;
register bool used, change; register bool used, change;

View file

@ -23,12 +23,16 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
int pick_one(struct magic_item *magic, int nitems);
char *blesscurse(int flags);
char *p_kind(struct object *obj);
int extras(void);
/* /*
* print out the number of charges on a stick * print out the number of charges on a stick
*/ */
char * char *
charge_str(obj) charge_str(struct object *obj)
register struct object *obj;
{ {
static char buf[20]; static char buf[20];
@ -46,9 +50,7 @@ register struct object *obj;
* inventory. * inventory.
*/ */
char * char *
inv_name(obj, drop) inv_name(struct object *obj, bool drop)
register struct object *obj;
bool drop;
{ {
register char *pb; register char *pb;
@ -324,8 +326,7 @@ bool drop;
* Return the name of a weapon. * Return the name of a weapon.
*/ */
char * char *
weap_name(obj) weap_name(struct object *obj)
register struct object *obj;
{ {
switch (obj->o_type) { switch (obj->o_type) {
case WEAPON: case WEAPON:
@ -357,8 +358,8 @@ register struct object *obj;
* drop: * drop:
* put something down * put something down
*/ */
drop(item) bool
struct linked_list *item; drop(struct linked_list *item)
{ {
register char ch; register char ch;
register struct linked_list *obj, *nobj; register struct linked_list *obj, *nobj;
@ -464,8 +465,8 @@ struct linked_list *item;
/* /*
* do special checks for dropping or unweilding|unwearing|unringing * do special checks for dropping or unweilding|unwearing|unringing
*/ */
dropcheck(op) bool
register struct object *op; dropcheck(struct object *op)
{ {
int save_max; int save_max;
@ -566,9 +567,7 @@ register struct object *op;
* return a new thing * return a new thing
*/ */
struct linked_list * struct linked_list *
new_thing(thing_type, allow_curse) new_thing(int thing_type, bool allow_curse)
int thing_type;
bool allow_curse;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *cur; register struct object *cur;
@ -779,8 +778,7 @@ bool allow_curse;
* provide a new item tailored to specification * provide a new item tailored to specification
*/ */
struct linked_list * struct linked_list *
spec_item(type, which, hit, damage) spec_item(int type, int which, int hit, int damage)
int type, which, hit, damage;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;
@ -858,9 +856,8 @@ int type, which, hit, damage;
/* /*
* pick an item out of a list of nitems possible magic items * pick an item out of a list of nitems possible magic items
*/ */
pick_one(magic, nitems) int
register struct magic_item *magic; pick_one(struct magic_item *magic, int nitems)
int nitems;
{ {
register struct magic_item *end; register struct magic_item *end;
register int i; register int i;
@ -889,8 +886,7 @@ int nitems;
*/ */
char * char *
blesscurse(flags) blesscurse(int flags)
int flags;
{ {
if (flags & ISKNOW) { if (flags & ISKNOW) {
if (flags & ISCURSED) return("cursed "); if (flags & ISCURSED) return("cursed ");
@ -903,11 +899,11 @@ int flags;
/* /*
* p_kind returns the type of potion for some types of identified potions; * p_kind returns the type of potion for some types of identified potions;
* otherwise, it returns the color. * otherwise, it returns the color.
* We assume that obj points to a potion
*/ */
char * char *
p_kind(obj) p_kind(struct object *obj)
struct object *obj; /* We assume that obj points to a potion */
{ {
if (obj->o_which == P_ABIL) return(abilities[obj->o_kind]); if (obj->o_which == P_ABIL) return(abilities[obj->o_kind]);
else return(p_colors[obj->o_which]); else return(p_colors[obj->o_which]);
@ -917,7 +913,8 @@ struct object *obj; /* We assume that obj points to a potion */
* extras: * extras:
* Return the number of extra items to be created * Return the number of extra items to be created
*/ */
extras() int
extras(void)
{ {
reg int i; reg int i;

View file

@ -16,18 +16,22 @@
* Anything to do with trading posts * Anything to do with trading posts
*/ */
#include <ctype.h>
#include <string.h>
#include "curses.h" #include "curses.h"
#include "rogue.h" #include "rogue.h"
bool open_market(void);
void trans_line(void);
char *typ_name(struct object *obj);
/* /*
* buy_it: * buy_it:
* Buy the item on which the hero stands * Buy the item on which the hero stands
*/ */
buy_it() void
buy_it(void)
{ {
reg int wh; reg int wh;
struct linked_list *item; struct linked_list *item;
@ -79,9 +83,10 @@ buy_it()
/* /*
* do_post: * do_post:
* Put a trading post room and stuff on the screen * Put a trading post room and stuff on the screen
* startup: True if equipping the player at the beginning of the game
*/ */
do_post(startup) void
bool startup; /* True if equipping the player at the beginning of the game */ do_post(bool startup)
{ {
coord tp; coord tp;
reg int i, j, k; reg int i, j, k;
@ -322,8 +327,8 @@ bool startup; /* True if equipping the player at the beginning of the game */
* get_worth: * get_worth:
* Calculate an objects worth in gold * Calculate an objects worth in gold
*/ */
get_worth(obj) int
reg struct object *obj; get_worth(struct object *obj)
{ {
reg int worth, wh; reg int worth, wh;
@ -393,7 +398,8 @@ reg struct object *obj;
* open_market: * open_market:
* Retruns TRUE when ok do to transacting * Retruns TRUE when ok do to transacting
*/ */
open_market() bool
open_market(void)
{ {
if (trader >= MAXPURCH && !wizard && level != 0) { if (trader >= MAXPURCH && !wizard && level != 0) {
msg("The market is closed. The stairs are that-a-way."); msg("The market is closed. The stairs are that-a-way.");
@ -408,7 +414,8 @@ open_market()
* price_it: * price_it:
* Price the object that the hero stands on * Price the object that the hero stands on
*/ */
price_it() bool
price_it(void)
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -445,7 +452,8 @@ price_it()
* sell_it: * sell_it:
* Sell an item to the trading post * Sell an item to the trading post
*/ */
sell_it() void
sell_it(void)
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -491,7 +499,8 @@ sell_it()
* trans_line: * trans_line:
* Show how many transactions the hero has left * Show how many transactions the hero has left
*/ */
trans_line() void
trans_line(void)
{ {
if (level == 0) if (level == 0)
sprintf(prbuf, "You are welcome to spend whatever you have."); sprintf(prbuf, "You are welcome to spend whatever you have.");
@ -511,8 +520,7 @@ trans_line()
* Return the name for this type of object * Return the name for this type of object
*/ */
char * char *
typ_name(obj) typ_name(struct object *obj)
reg struct object *obj;
{ {
static char buff[20]; static char buff[20];
reg int wh; reg int wh;

View file

@ -35,8 +35,7 @@ extern struct uwdata wdata;
* this routine computes the players current AC without dex bonus's * this routine computes the players current AC without dex bonus's
*/ */
int int
ac_compute(ignoremetal) ac_compute(bool ignoremetal)
bool ignoremetal;
{ {
register int ac; register int ac;
@ -69,8 +68,8 @@ bool ignoremetal;
* aggravate all the monsters on this level * aggravate all the monsters on this level
*/ */
aggravate(do_uniques, do_good) void
bool do_uniques, do_good; aggravate(bool do_uniques, bool do_good)
{ {
register struct linked_list *mi; register struct linked_list *mi;
register struct thing *thingptr; register struct thing *thingptr;
@ -87,8 +86,8 @@ bool do_uniques, do_good;
* returns true if the hero can see a certain coordinate. * returns true if the hero can see a certain coordinate.
*/ */
cansee(y, x) bool
register int y, x; cansee(int y, int x)
{ {
register struct room *rer; register struct room *rer;
register int radius; register int radius;
@ -134,7 +133,7 @@ register int y, x;
* further levels * further levels
*/ */
long long
check_level() check_level(void)
{ {
register int i, j, add = 0; register int i, j, add = 0;
register unsigned long exp; register unsigned long exp;
@ -178,8 +177,8 @@ check_level()
* it keeps track of the highest it has been, just in case * it keeps track of the highest it has been, just in case
*/ */
chg_str(amt) void
register int amt; chg_str(int amt)
{ {
register int ring_str; /* ring strengths */ register int ring_str; /* ring strengths */
register struct stats *ptr; /* for speed */ register struct stats *ptr; /* for speed */
@ -201,7 +200,8 @@ register int amt;
/* /*
* let's confuse the player * let's confuse the player
*/ */
confus_player() void
confus_player(void)
{ {
if (off(player, ISCLEAR)) if (off(player, ISCLEAR))
{ {
@ -218,7 +218,8 @@ confus_player()
/* /*
* this routine computes the players current dexterity * this routine computes the players current dexterity
*/ */
dex_compute() int
dex_compute(void)
{ {
if (cur_misc[WEAR_GAUNTLET] != NULL && if (cur_misc[WEAR_GAUNTLET] != NULL &&
cur_misc[WEAR_GAUNTLET]->o_which == MM_G_DEXTERITY) { cur_misc[WEAR_GAUNTLET]->o_which == MM_G_DEXTERITY) {
@ -236,9 +237,8 @@ dex_compute()
* Check to see if the move is legal if it is diagonal * Check to see if the move is legal if it is diagonal
*/ */
diag_ok(sp, ep, flgptr) bool
register coord *sp, *ep; diag_ok(coord *sp, coord *ep, struct thing *flgptr)
struct thing *flgptr;
{ {
register int numpaths = 0; register int numpaths = 0;
@ -258,10 +258,7 @@ struct thing *flgptr;
* pick a random position around the give (y, x) coordinates * pick a random position around the give (y, x) coordinates
*/ */
coord * coord *
fallpos(pos, be_clear, range) fallpos(coord *pos, bool be_clear, int range)
register coord *pos;
bool be_clear;
int range;
{ {
register int tried, i, j; register int tried, i, j;
register char ch; register char ch;
@ -339,8 +336,8 @@ int range;
* Find the index into the monster table of a monster given its name. * Find the index into the monster table of a monster given its name.
*/ */
findmindex(name) int
char *name; findmindex(char *name)
{ {
int which; int which;
@ -361,9 +358,7 @@ char *name;
*/ */
struct linked_list * struct linked_list *
find_mons(y, x) find_mons(int y, int x)
register int y;
register int x;
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *th; register struct thing *th;
@ -383,9 +378,7 @@ register int x;
*/ */
struct linked_list * struct linked_list *
find_obj(y, x) find_obj(int y, int x)
register int y;
register int x;
{ {
register struct linked_list *obj; register struct linked_list *obj;
register struct object *op; register struct object *op;
@ -403,7 +396,7 @@ register int x;
* get coordinates from the player using the cursor keys (or mouse) * get coordinates from the player using the cursor keys (or mouse)
*/ */
coord coord
get_coordinates() get_coordinates(void)
{ {
register int which; register int which;
coord c; coord c;
@ -550,8 +543,7 @@ get_coordinates()
* set up the direction co_ordinate for use in various "prefix" commands * set up the direction co_ordinate for use in various "prefix" commands
*/ */
bool bool
get_dir(direction) get_dir(coord *direction)
coord *direction;
{ {
register char *prompt; register char *prompt;
register bool gotit; register bool gotit;
@ -610,8 +602,8 @@ coord *direction;
/* /*
* see if the object is one of the currently used items * see if the object is one of the currently used items
*/ */
is_current(obj) bool
register struct object *obj; is_current(struct object *obj)
{ {
if (obj == NULL) if (obj == NULL)
return FALSE; return FALSE;
@ -650,11 +642,12 @@ register struct object *obj;
/* /*
* Look: * Look:
* A quick glance all around the player * A quick glance all around the player
* wakeup: Should we wake up monsters
* runend: At end of a run -- for mazes
*/ */
look(wakeup, runend) void
bool wakeup; /* Should we wake up monsters */ look(bool wakeup, bool runend)
bool runend; /* At end of a run -- for mazes */
{ {
register int x, y, radius; register int x, y, radius;
register char ch, och; register char ch, och;
@ -938,8 +931,8 @@ bool runend; /* At end of a run -- for mazes */
* Lower a level of experience * Lower a level of experience
*/ */
lower_level(who) void
short who; lower_level(short who)
{ {
int fewer, nsides; int fewer, nsides;
unsigned int exp; unsigned int exp;
@ -971,8 +964,7 @@ short who;
* print out the name of a monster * print out the name of a monster
*/ */
char * char *
monster_name(tp) monster_name(struct thing *tp)
register struct thing *tp;
{ {
prbuf[0] = '\0'; prbuf[0] = '\0';
if (on(*tp, ISFLEE) || on(*tp, WASTURNED)) if (on(*tp, ISFLEE) || on(*tp, WASTURNED))
@ -1003,8 +995,7 @@ register struct thing *tp;
*/ */
bool bool
move_hero(why) move_hero(int why)
int why;
{ {
char *action = ""; char *action = "";
char which; char which;
@ -1049,7 +1040,8 @@ int why;
* The guy just magically went up a level. * The guy just magically went up a level.
*/ */
raise_level() void
raise_level(void)
{ {
unsigned long test; /* Next level -- be sure it is not an overflow */ unsigned long test; /* Next level -- be sure it is not an overflow */
@ -1081,11 +1073,12 @@ static int st_matrix[NUM_CHARTYPES][5] = {
/* /*
* save: * save:
* See if a creature saves against something * See if a creature saves against something
* which: which type of save
* who: who is saving
* adj: saving throw adjustment
*/ */
save(which, who, adj) bool
int which; /* which type of save */ save(int which, struct thing *who, int adj)
struct thing *who; /* who is saving */
int adj; /* saving throw adjustment */
{ {
register int need, level, protect; register int need, level, protect;
@ -1144,8 +1137,8 @@ int adj; /* saving throw adjustment */
* Figure out what a secret door looks like. * Figure out what a secret door looks like.
*/ */
secretdoor(y, x) char
register int y, x; secretdoor(int y, int x)
{ {
register int i; register int i;
register struct room *rp; register struct room *rp;
@ -1168,7 +1161,8 @@ register int y, x;
/* /*
* this routine computes the players current strength * this routine computes the players current strength
*/ */
str_compute() int
str_compute(void)
{ {
if (cur_misc[WEAR_GAUNTLET] != NULL && if (cur_misc[WEAR_GAUNTLET] != NULL &&
cur_misc[WEAR_GAUNTLET]->o_which == MM_G_OGRE) { cur_misc[WEAR_GAUNTLET]->o_which == MM_G_OGRE) {
@ -1184,9 +1178,8 @@ str_compute()
/* /*
* copy string using unctrl for things * copy string using unctrl for things
*/ */
strucpy(s1, s2, len) void
register char *s1, *s2; strucpy(char *s1, char *s2, int len)
register int len;
{ {
register char *sp; register char *sp;
@ -1204,8 +1197,7 @@ register int len;
*/ */
char * char *
tr_name(ch) tr_name(char ch)
char ch;
{ {
register char *s = ""; register char *s = "";
@ -1235,8 +1227,7 @@ char ch;
* for printfs: if string starts with a vowel, return "n" for an "an" * for printfs: if string starts with a vowel, return "n" for an "an"
*/ */
char * char *
vowelstr(str) vowelstr(char *str)
register char *str;
{ {
switch (*str) switch (*str)
{ {
@ -1254,8 +1245,8 @@ register char *str;
/* /*
* wake up a room full (hopefully) of creatures * wake up a room full (hopefully) of creatures
*/ */
wake_room(rp) void
register struct room *rp; wake_room(struct room *rp)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct thing *tp; register struct thing *tp;
@ -1273,7 +1264,8 @@ register struct room *rp;
* Do nothing but let other things happen * Do nothing but let other things happen
*/ */
waste_time() void
waste_time(void)
{ {
if (inwhgt) /* if from wghtchk then done */ if (inwhgt) /* if from wghtchk then done */
return; return;

View file

@ -22,10 +22,8 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
boomerang(ydelta, xdelta, item, tp) void
int ydelta, xdelta; boomerang(int ydelta, int xdelta, struct linked_list *item, struct thing *tp)
register struct linked_list *item;
register struct thing *tp;
{ {
register struct object *obj; register struct object *obj;
struct thing midpoint; struct thing midpoint;
@ -56,10 +54,8 @@ register struct thing *tp;
* across the room. Note that we should not look at any field in * across the room. Note that we should not look at any field in
* tp other than t_pos unless we change boomerang(). * tp other than t_pos unless we change boomerang().
*/ */
do_motion(obj, ydelta, xdelta, tp) void
register struct object *obj; do_motion(struct object *obj, int ydelta, int xdelta, struct thing *tp)
register int ydelta, xdelta;
register struct thing *tp;
{ {
/* /*
@ -115,9 +111,8 @@ register struct thing *tp;
* Drop an item someplace around here. * Drop an item someplace around here.
*/ */
fall(item, pr) void
register struct linked_list *item; fall(struct linked_list *item, bool pr)
bool pr;
{ {
register struct object *obj; register struct object *obj;
register struct room *rp; register struct room *rp;
@ -170,10 +165,8 @@ bool pr;
* Does the missile hit the monster * Does the missile hit the monster
*/ */
hit_monster(y, x, obj, tp) bool
register int y, x; hit_monster(int y, int x, struct object *obj, struct thing *tp)
struct object *obj;
register struct thing *tp;
{ {
static coord mp; static coord mp;
@ -203,9 +196,8 @@ register struct thing *tp;
* Set up the initial goodies for a weapon * Set up the initial goodies for a weapon
*/ */
init_weapon(weap, type) void
register struct object *weap; init_weapon(struct object *weap, char type)
char type;
{ {
register struct init_weps *iwp; register struct init_weps *iwp;
@ -228,10 +220,8 @@ char type;
* Fire a missile in a given direction * Fire a missile in a given direction
*/ */
missile(ydelta, xdelta, item, tp) void
int ydelta, xdelta; missile(int ydelta, int xdelta, struct linked_list *item, struct thing *tp)
register struct linked_list *item;
register struct thing *tp;
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *nitem; register struct linked_list *nitem;
@ -303,8 +293,7 @@ register struct thing *tp;
*/ */
char * char *
num(n1, n2) num(int n1, int n2)
register int n1, n2;
{ {
static char numbuf[LINELEN]; static char numbuf[LINELEN];
@ -324,7 +313,8 @@ register int n1, n2;
* Pull out a certain weapon * Pull out a certain weapon
*/ */
wield() void
wield(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj, *oweapon; register struct object *obj, *oweapon;

View file

@ -26,7 +26,8 @@
* Get the armor off of the players back * Get the armor off of the players back
*/ */
take_off() void
take_off(void)
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *item; register struct linked_list *item;
@ -75,7 +76,8 @@ take_off()
* The player wants to wear something, so let him/her put it on. * The player wants to wear something, so let him/her put it on.
*/ */
wear() void
wear(void)
{ {
register struct linked_list *item; register struct linked_list *item;
register struct object *obj; register struct object *obj;
@ -389,8 +391,8 @@ wear()
* How many movements periods does it take to put on or remove the * How many movements periods does it take to put on or remove the
* given item of "clothing"? * given item of "clothing"?
*/ */
dress_units(item) int
struct linked_list *item; dress_units(struct linked_list *item)
{ {
register struct object *obj; register struct object *obj;

View file

@ -19,20 +19,21 @@
#include "curses.h" #include "curses.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include "rogue.h" #include "rogue.h"
#ifdef PC7300 #ifdef PC7300
#include "menu.h" #include "menu.h"
#endif #endif
int getbless(void);
/* /*
* create_obj: * create_obj:
* Create any object for wizard, scroll, magician, or cleric * Create any object for wizard, scroll, magician, or cleric
*/ */
create_obj(prompt, which_item, which_type) void
bool prompt; create_obj(bool prompt, int which_item, int which_type)
int which_item, which_type;
{ {
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
@ -329,7 +330,8 @@ int which_item, which_type;
* getbless: * getbless:
* Get a blessing for a wizards object * Get a blessing for a wizards object
*/ */
getbless() int
getbless(void)
{ {
reg char bless; reg char bless;
@ -346,7 +348,8 @@ getbless()
/* /*
* get a non-monster death type * get a non-monster death type
*/ */
getdeath() int
getdeath(void)
{ {
register int i; register int i;
int which_death; int which_death;
@ -381,10 +384,10 @@ static char Displines[NUMMONST+1][LINELEN+1]; /* The lines themselves */
/* /*
* make a monster for the wizard * make a monster for the wizard
* showall -> show uniques and genocided creatures
*/ */
makemonster(showall, label, action) short
bool showall; /* showall -> show uniques and genocided creatures */ makemonster(bool showall, char *label, char *action)
char *label, *action;
{ {
#ifdef PC7300 #ifdef PC7300
register int nextmonst; register int nextmonst;
@ -439,7 +442,7 @@ char *label, *action;
/* Print out the monsters */ /* Print out the monsters */
while (num_monst > 0) { while (num_monst > 0) {
register left_limit; int left_limit;
if (num_monst < num_lines) left_limit = (num_monst+1)/2; if (num_monst < num_lines) left_limit = (num_monst+1)/2;
else left_limit = num_lines/2; else left_limit = num_lines/2;
@ -508,7 +511,8 @@ get_monst:
* see if user knows password * see if user knows password
*/ */
passwd() bool
passwd(void)
{ {
register char *sp, c; register char *sp, c;
char buf[LINELEN], *crypt(); char buf[LINELEN], *crypt();
@ -535,7 +539,8 @@ passwd()
* Bamf the hero someplace else * Bamf the hero someplace else
*/ */
teleport() int
teleport(void)
{ {
register struct room *new_rp = NULL, *old_rp = roomin(&hero); register struct room *new_rp = NULL, *old_rp = roomin(&hero);
register int rm, which; register int rm, which;
@ -636,8 +641,8 @@ teleport()
* What a certin object is * What a certin object is
*/ */
whatis(what) void
struct linked_list *what; whatis(struct linked_list *what)
{ {
register struct object *obj; register struct object *obj;
register struct linked_list *item; register struct linked_list *item;

View file

@ -25,9 +25,8 @@ WINDOW *mw; /* Used to store mosnters */
FILE *scoreboard = NULL; FILE *scoreboard = NULL;
FILE *logfi = NULL; FILE *logfi = NULL;
main(argc, argv, envp) int
char **argv; main(int argc, char *argv[], char *envp[])
char **envp;
{ {
char *env; char *env;
struct linked_list *item; struct linked_list *item;

View file

@ -16,7 +16,8 @@
* wear: * wear:
* The player wants to wear something, so let him/her put it on. * The player wants to wear something, so let him/her put it on.
*/ */
wear() void
wear(void)
{ {
register THING *obj; register THING *obj;
register char *sp; register char *sp;
@ -50,7 +51,8 @@ wear()
* take_off: * take_off:
* Get the armor off of the players back * Get the armor off of the players back
*/ */
take_off() void
take_off(void)
{ {
register THING *obj; register THING *obj;
@ -77,7 +79,8 @@ take_off()
* waste_time: * waste_time:
* Do nothing but let other things happen * Do nothing but let other things happen
*/ */
waste_time() void
waste_time(void)
{ {
do_daemons(BEFORE); do_daemons(BEFORE);
do_fuses(BEFORE); do_fuses(BEFORE);

View file

@ -10,6 +10,7 @@
* See the file LICENSE.TXT for full copyright and licensing information. * See the file LICENSE.TXT for full copyright and licensing information.
*/ */
#include <stdlib.h>
#include <curses.h> #include <curses.h>
#include "rogue.h" #include "rogue.h"
@ -17,11 +18,16 @@
coord ch_ret; /* Where chasing takes you */ coord ch_ret; /* Where chasing takes you */
bool chase(THING *tp, coord *ee);
int do_chase(THING *th);
coord *find_dest(THING *tp);
/* /*
* runners: * runners:
* Make all the running monsters move. * Make all the running monsters move.
*/ */
runners() void
runners(void)
{ {
register THING *tp; register THING *tp;
register THING *ntp; register THING *ntp;
@ -46,8 +52,8 @@ runners()
* do_chase: * do_chase:
* Make one thing chase another. * Make one thing chase another.
*/ */
do_chase(th) int
register THING *th; do_chase(THING *th)
{ {
register struct room *rer, *ree; /* room of chaser, room of chasee */ register struct room *rer, *ree; /* room of chaser, room of chasee */
register int mindist = 32767, i, dist; register int mindist = 32767, i, dist;
@ -184,8 +190,8 @@ over:
* see_monst: * see_monst:
* Return TRUE if the hero can see the monster * Return TRUE if the hero can see the monster
*/ */
see_monst(mp) bool
register THING *mp; see_monst(THING *mp)
{ {
if (on(player, ISBLIND)) if (on(player, ISBLIND))
return FALSE; return FALSE;
@ -203,9 +209,8 @@ register THING *mp;
* Set a mosnter running after something or stop it from running * Set a mosnter running after something or stop it from running
* (for when it dies) * (for when it dies)
*/ */
runto(runner, spot) void
register coord *runner; runto(coord *runner, coord *spot)
coord *spot;
{ {
register THING *tp; register THING *tp;
@ -234,9 +239,8 @@ coord *spot;
* chasee(ee). Returns TRUE if we want to keep on chasing later * chasee(ee). Returns TRUE if we want to keep on chasing later
* FALSE if we reach the goal. * FALSE if we reach the goal.
*/ */
chase(tp, ee) bool
THING *tp; chase(THING *tp, coord *ee)
coord *ee;
{ {
register int x, y; register int x, y;
register int dist, thisdist; register int dist, thisdist;
@ -339,8 +343,7 @@ coord *ee;
* in any room. * in any room.
*/ */
struct room * struct room *
roomin(cp) roomin(coord *cp)
register coord *cp;
{ {
register struct room *rp; register struct room *rp;
register char *fp; register char *fp;
@ -360,8 +363,8 @@ register coord *cp;
* diag_ok: * diag_ok:
* Check to see if the move is legal if it is diagonal * Check to see if the move is legal if it is diagonal
*/ */
diag_ok(sp, ep) bool
register coord *sp, *ep; diag_ok(coord *sp, coord *ep)
{ {
if (ep->x == sp->x || ep->y == sp->y) if (ep->x == sp->x || ep->y == sp->y)
return TRUE; return TRUE;
@ -372,8 +375,8 @@ register coord *sp, *ep;
* cansee: * cansee:
* Returns true if the hero can see a certain coordinate. * Returns true if the hero can see a certain coordinate.
*/ */
cansee(y, x) bool
register int y, x; cansee(int y, int x)
{ {
register struct room *rer; register struct room *rer;
coord tp; coord tp;
@ -396,8 +399,7 @@ register int y, x;
* find the proper destination for the monster * find the proper destination for the monster
*/ */
coord * coord *
find_dest(tp) find_dest(THING *tp)
register THING *tp;
{ {
register THING *obj; register THING *obj;
register int prob; register int prob;

View file

@ -19,15 +19,30 @@
char countch, direction, newcount = FALSE; char countch, direction, newcount = FALSE;
void call(void);
void d_level(void);
void help(void);
void identify(void);
void illcom(char ch);
void search(void);
void u_level(void);
#ifdef WIZARD
extern void add_pass(void);
extern void create_obj(void);
extern bool passwd(void);
extern void show_map(void);
#endif
/* /*
* command: * command:
* Process the user commands * Process the user commands
*/ */
command() void
command(void)
{ {
register char ch; register char ch;
register int ntimes = 1; /* Number of player moves */ register int ntimes = 1; /* Number of player moves */
char *unctrol();
if (on(player, ISHASTE)) if (on(player, ISHASTE))
ntimes++; ntimes++;
@ -344,8 +359,8 @@ command()
* illcom: * illcom:
* What to do with an illegal command * What to do with an illegal command
*/ */
illcom(ch) void
char ch; illcom(char ch)
{ {
save_msg = FALSE; save_msg = FALSE;
count = 0; count = 0;
@ -357,7 +372,8 @@ char ch;
* search: * search:
* Player gropes about him to find hidden things. * Player gropes about him to find hidden things.
*/ */
search() void
search(void)
{ {
register int y, x; register int y, x;
register char *fp; register char *fp;
@ -400,7 +416,8 @@ search()
* help: * help:
* Give single character help, or the whole mess if he wants it * Give single character help, or the whole mess if he wants it
*/ */
help() void
help(void)
{ {
register const struct h_list *strp = helpstr; register const struct h_list *strp = helpstr;
register char helpch; register char helpch;
@ -457,7 +474,8 @@ help()
* identify: * identify:
* Tell the player what a certain thing is. * Tell the player what a certain thing is.
*/ */
identify() void
identify(void)
{ {
register char ch; register char ch;
register const char *str; register const char *str;
@ -502,7 +520,8 @@ identify()
* d_level: * d_level:
* He wants to go down a level * He wants to go down a level
*/ */
d_level() void
d_level(void)
{ {
if (chat(hero.y, hero.x) != STAIRS) if (chat(hero.y, hero.x) != STAIRS)
msg("I see no way down"); msg("I see no way down");
@ -517,7 +536,8 @@ d_level()
* u_level: * u_level:
* He wants to go up a level * He wants to go up a level
*/ */
u_level() void
u_level(void)
{ {
if (chat(hero.y, hero.x) == STAIRS) if (chat(hero.y, hero.x) == STAIRS)
if (amulet) if (amulet)
@ -538,7 +558,8 @@ u_level()
* call: * call:
* Allow a user to call a potion, scroll, or ring something * Allow a user to call a potion, scroll, or ring something
*/ */
call() void
call(void)
{ {
register THING *obj; register THING *obj;
register char **guess; register char **guess;

View file

@ -29,7 +29,7 @@ struct delayed_action d_list[MAXDAEMONS] = {
* Find an empty slot in the daemon/fuse list * Find an empty slot in the daemon/fuse list
*/ */
struct delayed_action * struct delayed_action *
d_slot() d_slot(void)
{ {
register int i; register int i;
register struct delayed_action *dev; register struct delayed_action *dev;
@ -48,8 +48,7 @@ d_slot()
* Find a particular slot in the table * Find a particular slot in the table
*/ */
struct delayed_action * struct delayed_action *
find_slot(func) find_slot(int (*func)())
register int (*func)();
{ {
register int i; register int i;
register struct delayed_action *dev; register struct delayed_action *dev;
@ -64,8 +63,8 @@ register int (*func)();
* start_daemon: * start_daemon:
* Start a daemon, takes a function. * Start a daemon, takes a function.
*/ */
start_daemon(func, arg, type) void
int (*func)(), arg, type; start_daemon(int (*func)(), int arg, int type)
{ {
register struct delayed_action *dev; register struct delayed_action *dev;
@ -80,8 +79,8 @@ int (*func)(), arg, type;
* kill_daemon: * kill_daemon:
* Remove a daemon from the list * Remove a daemon from the list
*/ */
kill_daemon(func) void
int (*func)(); kill_daemon(int (*func)())
{ {
register struct delayed_action *dev; register struct delayed_action *dev;
@ -98,8 +97,8 @@ int (*func)();
* Run all the daemons that are active with the current flag, * Run all the daemons that are active with the current flag,
* passing the argument to the function. * passing the argument to the function.
*/ */
do_daemons(flag) void
register int flag; do_daemons(int flag)
{ {
register struct delayed_action *dev; register struct delayed_action *dev;
@ -118,8 +117,8 @@ register int flag;
* fuse: * fuse:
* Start a fuse to go off in a certain number of turns * Start a fuse to go off in a certain number of turns
*/ */
fuse(func, arg, time, type) void
int (*func)(), arg, time, type; fuse(int (*func)(), int arg, int time, int type)
{ {
register struct delayed_action *wire; register struct delayed_action *wire;
@ -134,9 +133,8 @@ int (*func)(), arg, time, type;
* lengthen: * lengthen:
* Increase the time until a fuse goes off * Increase the time until a fuse goes off
*/ */
lengthen(func, xtime) void
int (*func)(); lengthen(int (*func)(), int xtime)
int xtime;
{ {
register struct delayed_action *wire; register struct delayed_action *wire;
@ -149,8 +147,8 @@ int xtime;
* extinguish: * extinguish:
* Put out a fuse * Put out a fuse
*/ */
extinguish(func) void
int (*func)(); extinguish(int (*func)())
{ {
register struct delayed_action *wire; register struct delayed_action *wire;
@ -163,8 +161,8 @@ int (*func)();
* do_fuses: * do_fuses:
* Decrement counters and start needed fuses * Decrement counters and start needed fuses
*/ */
do_fuses(flag) void
register int flag; do_fuses(int flag)
{ {
register struct delayed_action *wire; register struct delayed_action *wire;

View file

@ -19,7 +19,8 @@ int between = 0;
* doctor: * doctor:
* A healing daemon that restors hit points after rest * A healing daemon that restors hit points after rest
*/ */
doctor() void
doctor(void)
{ {
register int lv, ohp; register int lv, ohp;
@ -50,7 +51,8 @@ doctor()
* Swander: * Swander:
* Called when it is time to start rolling for wandering monsters * Called when it is time to start rolling for wandering monsters
*/ */
swander() void
swander(void)
{ {
start_daemon(rollwand, 0, BEFORE); start_daemon(rollwand, 0, BEFORE);
} }
@ -59,7 +61,8 @@ swander()
* rollwand: * rollwand:
* Called to roll to see if a wandering monster starts up * Called to roll to see if a wandering monster starts up
*/ */
rollwand() void
rollwand(void)
{ {
if (++between >= 4) if (++between >= 4)
{ {
@ -77,7 +80,8 @@ rollwand()
* unconfuse: * unconfuse:
* Release the poor player from his confusion * Release the poor player from his confusion
*/ */
unconfuse() void
unconfuse(void)
{ {
player.t_flags &= ~ISHUH; player.t_flags &= ~ISHUH;
msg("you feel less confused now"); msg("you feel less confused now");
@ -87,7 +91,8 @@ unconfuse()
* unsee: * unsee:
* Turn off the ability to see invisible * Turn off the ability to see invisible
*/ */
unsee() void
unsee(void)
{ {
register THING *th; register THING *th;
@ -104,7 +109,8 @@ unsee()
* sight: * sight:
* He gets his sight back * He gets his sight back
*/ */
sight() void
sight(void)
{ {
if (on(player, ISBLIND)) if (on(player, ISBLIND))
{ {
@ -120,7 +126,8 @@ sight()
* nohaste: * nohaste:
* End the hasting * End the hasting
*/ */
nohaste() void
nohaste(void)
{ {
player.t_flags &= ~ISHASTE; player.t_flags &= ~ISHASTE;
msg("you feel yourself slowing down"); msg("you feel yourself slowing down");
@ -130,7 +137,8 @@ nohaste()
* stomach: * stomach:
* Digest the hero's food * Digest the hero's food
*/ */
stomach() void
stomach(void)
{ {
register int oldfood; register int oldfood;

View file

@ -52,17 +52,9 @@ extern WINDOW *hw;
* Function types * Function types
*/ */
char *charge_str(), *ctime(), *getenv(), *inv_name(), char *ctime(), *getenv();
*killname(), *nothing(), *num(), *ring_num(),
*tr_name(),
*unctrol(), *vowelstr();
void leave(int), quit(int), tstp(), auto_save(int), endit(int); void tstp(), endit(int);
int doctor(), nohaste(),
rollwand(), runners(), sight(), stomach(), swander(),
turn_see(), unconfuse(), unsee();
void checkout();
long lseek(); long lseek();
@ -86,6 +78,18 @@ extern bool got_genocide;
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
extern int md_erasechar(void);
extern FILE *md_fdopen(int fd, char *mode); extern FILE *md_fdopen(int fd, char *mode);
extern int md_fileno(FILE *fp);
extern char *md_getusername(int uid); extern char *md_getusername(int uid);
extern char *md_gethomedir(); extern char *md_gethomedir();
extern int md_getuid(void);
extern void md_ignore_signals(void);
extern void md_init(void);
extern int md_killchar(void);
extern void md_normaluser(void);
extern int md_readchar(WINDOW *win);
extern int md_shellescape(void);
extern void md_sleep(int s);
extern int md_unlink(char *file);
extern int md_unlink_open_file(char *file, int inf);

View file

@ -10,6 +10,7 @@
* See the file LICENSE.TXT for full copyright and licensing information. * See the file LICENSE.TXT for full copyright and licensing information.
*/ */
#include <stdlib.h>
#include <curses.h> #include <curses.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -20,15 +21,20 @@ long e_levels[] = {
40920L, 81920L, 163840L, 327680L, 655360L, 1310720L, 2621440L, 0L 40920L, 81920L, 163840L, 327680L, 655360L, 1310720L, 2621440L, 0L
}; };
bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl);
void hit(char *er, char *ee);
void miss(char *er, char *ee);
int str_plus(str_t str);
int add_dam(str_t str);
void thunk(THING *weap, const char *mname);
void bounce(THING *weap, const char *mname);
/* /*
* fight: * fight:
* The player attacks the monster. * The player attacks the monster.
*/ */
fight(mp, mn, weap, thrown) bool
register coord *mp; fight(coord *mp, char mn, THING *weap, bool thrown)
char mn;
register THING *weap;
bool thrown;
{ {
register THING *tp; register THING *tp;
register bool did_hit = TRUE; register bool did_hit = TRUE;
@ -96,8 +102,8 @@ bool thrown;
* attack: * attack:
* The monster attacks the player * The monster attacks the player
*/ */
attack(mp) int
register THING *mp; attack(THING *mp)
{ {
register const char *mname; register const char *mname;
@ -295,8 +301,8 @@ register THING *mp;
* swing: * swing:
* Returns true if the swing hits * Returns true if the swing hits
*/ */
swing(at_lvl, op_arm, wplus) bool
int at_lvl, op_arm, wplus; swing(int at_lvl, int op_arm, int wplus)
{ {
register int res = rnd(20); register int res = rnd(20);
register int need = (20 - at_lvl) - op_arm; register int need = (20 - at_lvl) - op_arm;
@ -308,7 +314,8 @@ int at_lvl, op_arm, wplus;
* check_level: * check_level:
* Check to see if the guy has gone up a level. * Check to see if the guy has gone up a level.
*/ */
check_level() void
check_level(void)
{ {
register int i, add, olevel; register int i, add, olevel;
@ -332,9 +339,8 @@ check_level()
* roll_em: * roll_em:
* Roll several attacks * Roll several attacks
*/ */
roll_em(thatt, thdef, weap, hurl) bool
THING *thatt, *thdef, *weap; roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl)
bool hurl;
{ {
register struct stats *att, *def; register struct stats *att, *def;
register char *cp; register char *cp;
@ -440,9 +446,7 @@ bool hurl;
* The print name of a combatant * The print name of a combatant
*/ */
char * char *
prname(who, upper) prname(char *who, bool upper)
register char *who;
bool upper;
{ {
static char tbuf[MAXSTR]; static char tbuf[MAXSTR];
@ -465,8 +469,8 @@ bool upper;
* hit: * hit:
* Print a message to indicate a succesful hit * Print a message to indicate a succesful hit
*/ */
hit(er, ee) void
register char *er, *ee; hit(char *er, char *ee)
{ {
register char *s = ""; register char *s = "";
@ -491,8 +495,8 @@ register char *er, *ee;
* miss: * miss:
* Print a message to indicate a poor swing * Print a message to indicate a poor swing
*/ */
miss(er, ee) void
register char *er, *ee; miss(char *er, char *ee)
{ {
register char *s = ""; register char *s = "";
@ -514,9 +518,8 @@ register char *er, *ee;
* save_throw: * save_throw:
* See if a creature save against something * See if a creature save against something
*/ */
save_throw(which, tp) bool
int which; save_throw(int which, THING *tp)
THING *tp;
{ {
register int need; register int need;
@ -528,8 +531,8 @@ THING *tp;
* save: * save:
* See if he saves against various nasty things * See if he saves against various nasty things
*/ */
save(which) bool
register int which; save(int which)
{ {
if (which == VS_MAGIC) if (which == VS_MAGIC)
{ {
@ -545,8 +548,8 @@ register int which;
* str_plus: * str_plus:
* Compute bonus/penalties for strength on the "to hit" roll * Compute bonus/penalties for strength on the "to hit" roll
*/ */
str_plus(str) int
register str_t str; str_plus(str_t str)
{ {
if (str == 31) if (str == 31)
return 3; return 3;
@ -563,9 +566,9 @@ register str_t str;
* add_dam: * add_dam:
* Compute additional damage done for exceptionally high or low strength * Compute additional damage done for exceptionally high or low strength
*/ */
add_dam(str) int
register str_t str; add_dam(str_t str)
{ {
if (str == 31) if (str == 31)
return 6; return 6;
if (str > 21) if (str > 21)
@ -587,7 +590,8 @@ register str_t str;
* raise_level: * raise_level:
* The guy just magically went up a level. * The guy just magically went up a level.
*/ */
raise_level() void
raise_level(void)
{ {
pstats.s_exp = e_levels[pstats.s_lvl-1] + 1L; pstats.s_exp = e_levels[pstats.s_lvl-1] + 1L;
check_level(); check_level();
@ -597,9 +601,8 @@ raise_level()
* thunk: * thunk:
* A missile hits a monster * A missile hits a monster
*/ */
thunk(weap, mname) void
register THING *weap; thunk(THING *weap, const char *mname)
register const char *mname;
{ {
if (weap->o_type == WEAPON) if (weap->o_type == WEAPON)
addmsg("the %s hits ", w_names[weap->o_which]); addmsg("the %s hits ", w_names[weap->o_which]);
@ -615,9 +618,8 @@ register const char *mname;
* bounce: * bounce:
* A missile misses a monster * A missile misses a monster
*/ */
bounce(weap, mname) void
register THING *weap; bounce(THING *weap, const char *mname)
register const char *mname;
{ {
if (weap->o_type == WEAPON) if (weap->o_type == WEAPON)
addmsg("the %s misses ", w_names[weap->o_which]); addmsg("the %s misses ", w_names[weap->o_which]);
@ -633,10 +635,8 @@ register const char *mname;
* remove: * remove:
* Remove a monster from the screen * Remove a monster from the screen
*/ */
remove_monster(mp, tp, waskill) void
register coord *mp; remove_monster(coord *mp, THING *tp, bool waskill)
register THING *tp;
bool waskill;
{ {
register THING *obj, *nexti; register THING *obj, *nexti;
@ -660,8 +660,8 @@ bool waskill;
* is_magic: * is_magic:
* Returns true if an object radiates magic * Returns true if an object radiates magic
*/ */
is_magic(obj) bool
register THING *obj; is_magic(THING *obj)
{ {
switch (obj->o_type) switch (obj->o_type)
{ {
@ -683,9 +683,8 @@ register THING *obj;
* killed: * killed:
* Called to put a monster to death * Called to put a monster to death
*/ */
killed(tp, pr) void
register THING *tp; killed(THING *tp, bool pr)
bool pr;
{ {
pstats.s_exp += tp->t_stats.s_exp; pstats.s_exp += tp->t_stats.s_exp;
/* /*

View file

@ -16,11 +16,16 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
#ifdef WIZARD
void badcheck(char *name, struct magic_item *magic, int bound);
#endif
/* /*
* init_player: * init_player:
* Roll up the rogue * Roll up the rogue
*/ */
init_player() void
init_player(void)
{ {
register THING *obj; register THING *obj;
@ -236,7 +241,8 @@ const char *metal[NMETAL] = {
* init_things * init_things
* Initialize the probabilities for types of things * Initialize the probabilities for types of things
*/ */
init_things() void
init_things(void)
{ {
register struct magic_item *mp; register struct magic_item *mp;
@ -251,7 +257,8 @@ init_things()
* init_colors: * init_colors:
* Initialize the potion color scheme for this time * Initialize the potion color scheme for this time
*/ */
init_colors() void
init_colors(void)
{ {
register int i, j; register int i, j;
bool used[NCOLORS]; bool used[NCOLORS];
@ -281,7 +288,8 @@ init_colors()
*/ */
#define MAXNAME 40 /* Max number of characters in a name */ #define MAXNAME 40 /* Max number of characters in a name */
init_names() void
init_names(void)
{ {
register int nsyl; register int nsyl;
register char *cp; register char *cp;
@ -322,7 +330,8 @@ init_names()
* init_stones: * init_stones:
* Initialize the ring stone setting scheme for this time * Initialize the ring stone setting scheme for this time
*/ */
init_stones() void
init_stones(void)
{ {
register int i, j; register int i, j;
bool used[NSTONES]; bool used[NSTONES];
@ -351,7 +360,8 @@ init_stones()
* init_materials: * init_materials:
* Initialize the construction materials for wands and staffs * Initialize the construction materials for wands and staffs
*/ */
init_materials() void
init_materials(void)
{ {
register int i, j; register int i, j;
register const char *str; register const char *str;
@ -402,10 +412,8 @@ init_materials()
* badcheck: * badcheck:
* Check to see if a series of probabilities sums to 100 * Check to see if a series of probabilities sums to 100
*/ */
badcheck(name, magic, bound) void
char *name; badcheck(char *name, struct magic_item *magic, int bound)
register struct magic_item *magic;
register int bound;
{ {
register struct magic_item *end; register struct magic_item *end;

View file

@ -16,6 +16,8 @@
#include "rogue.h" #include "rogue.h"
#include <stdarg.h> #include <stdarg.h>
void doadd(char *fmt, va_list ap);
/* /*
* msg: * msg:
* Display a message at the top of the screen. * Display a message at the top of the screen.
@ -23,6 +25,7 @@
static char msgbuf[BUFSIZ]; static char msgbuf[BUFSIZ];
static int newpos = 0; static int newpos = 0;
void
msg(char *fmt, ...) msg(char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -50,6 +53,7 @@ msg(char *fmt, ...)
* Add things to the current message * Add things to the current message
*/ */
void
addmsg(char *fmt, ...) addmsg(char *fmt, ...)
{ {
va_list ap; va_list ap;
@ -65,7 +69,8 @@ addmsg(char *fmt, ...)
* if it is up there with the --More--) * if it is up there with the --More--)
*/ */
endmsg() void
endmsg(void)
{ {
if (save_msg) if (save_msg)
{ {
@ -99,6 +104,7 @@ endmsg()
* Perform an add onto the message buffer * Perform an add onto the message buffer
*/ */
void
doadd(char *fmt, va_list ap) doadd(char *fmt, va_list ap)
{ {
vsprintf(&msgbuf[newpos], fmt, ap); vsprintf(&msgbuf[newpos], fmt, ap);
@ -109,7 +115,8 @@ doadd(char *fmt, va_list ap)
* step_ok: * step_ok:
* Returns true if it is ok to step on ch * Returns true if it is ok to step on ch
*/ */
step_ok(ch) bool
step_ok(char ch)
{ {
switch (ch) switch (ch)
{ {
@ -127,8 +134,8 @@ step_ok(ch)
* Flushes stdout so that screen is up to date and then returns * Flushes stdout so that screen is up to date and then returns
* getchar(). * getchar().
*/ */
readcharw(win) int
WINDOW *win; readcharw(WINDOW *win)
{ {
int ch; int ch;
@ -143,14 +150,14 @@ WINDOW *win;
return(ch); return(ch);
} }
readchar() int
readchar(void)
{ {
return( readcharw(stdscr) ); return( readcharw(stdscr) );
} }
char * char *
unctrol(ch) unctrol(char ch)
char ch;
{ {
return( (char *) unctrl(ch) ); return( (char *) unctrl(ch) );
} }
@ -159,7 +166,8 @@ char ch;
* status: * status:
* Display the important stats line. Keep the cursor where it was. * Display the important stats line. Keep the cursor where it was.
*/ */
status() void
status(void)
{ {
register int oy, ox, temp; register int oy, ox, temp;
static int hpwidth = 0, s_hungry; static int hpwidth = 0, s_hungry;
@ -215,15 +223,14 @@ status()
wait_for(ch) void
register char ch; wait_for(char ch)
{ {
w_wait_for(stdscr, ch); w_wait_for(stdscr, ch);
} }
w_wait_for(win,ch) void
WINDOW *win; w_wait_for(WINDOW *win, char ch)
register char ch;
{ {
register char c; register char c;
@ -239,9 +246,8 @@ register char ch;
* show_win: * show_win:
* Function used to display a window and wait before returning * Function used to display a window and wait before returning
*/ */
show_win(scr, message) void
register WINDOW *scr; show_win(WINDOW *scr, char *message)
char *message;
{ {
mvwaddstr(scr, 0, 0, message); mvwaddstr(scr, 0, 0, message);
touchwin(scr); touchwin(scr);

View file

@ -18,8 +18,8 @@
* detach: * detach:
* Takes an item out of whatever linked list it might be in * Takes an item out of whatever linked list it might be in
*/ */
_detach(list, item) void
register THING **list, *item; _detach(THING **list, THING *item)
{ {
if (*list == item) if (*list == item)
*list = next(item); *list = next(item);
@ -33,8 +33,8 @@ register THING **list, *item;
* _attach: * _attach:
* add an item to the head of a list * add an item to the head of a list
*/ */
_attach(list, item) void
register THING **list, *item; _attach(THING **list, THING *item)
{ {
if (*list != NULL) if (*list != NULL)
{ {
@ -54,8 +54,8 @@ register THING **list, *item;
* _free_list: * _free_list:
* Throw the whole blamed thing away * Throw the whole blamed thing away
*/ */
_free_list(ptr) void
register THING **ptr; _free_list(THING **ptr)
{ {
register THING *item; register THING *item;
@ -71,8 +71,8 @@ register THING **ptr;
* discard: * discard:
* Free up an item * Free up an item
*/ */
discard(item) void
register THING *item; discard(THING *item)
{ {
total--; total--;
free((char *) item); free((char *) item);
@ -83,7 +83,7 @@ register THING *item;
* Get a new item with a specified size * Get a new item with a specified size
*/ */
THING * THING *
new_item() new_item(void)
{ {
register THING *item; register THING *item;

View file

@ -47,11 +47,17 @@ static char *lockfile = LOCKFILE;
#endif #endif
#endif #endif
int too_much(void);
bool author(void);
void checkout(int s);
void chmsg(char *fmt, int arg);
/* /*
* init_check: * init_check:
* Check out too see if it is proper to play the game now * Check out too see if it is proper to play the game now
*/ */
init_check() void
init_check(void)
{ {
if (too_much()) if (too_much())
{ {
@ -70,7 +76,8 @@ init_check()
* Open up the score file for future use, and then * Open up the score file for future use, and then
* setuid(getuid()) in case we are running setuid. * setuid(getuid()) in case we are running setuid.
*/ */
open_score() void
open_score(void)
{ {
#ifdef SCOREFILE #ifdef SCOREFILE
fd = open(SCOREFILE, O_RDWR | O_CREAT, 0666 ); fd = open(SCOREFILE, O_RDWR | O_CREAT, 0666 );
@ -82,7 +89,8 @@ open_score()
return; return;
} }
void open_log(void) void
open_log(void)
{ {
#ifdef LOGFILE #ifdef LOGFILE
lfd = open(LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0666); lfd = open(LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0666);
@ -96,12 +104,10 @@ void open_log(void)
* setup: * setup:
* Get starting setup for all games * Get starting setup for all games
*/ */
setup() void
setup(void)
{ {
void auto_save(), quit(), endit(), tstp(); void auto_save(), quit(), endit(), tstp();
#ifdef CHECKTIME
int checkout();
#endif
/* /*
* make sure that large terminals don't overflow the bounds * make sure that large terminals don't overflow the bounds
@ -158,7 +164,8 @@ setup()
* start_score: * start_score:
* Start the scoring sequence * Start the scoring sequence
*/ */
start_score() void
start_score(void)
{ {
#ifdef SIGALRM #ifdef SIGALRM
signal(SIGALRM, SIG_IGN); signal(SIGALRM, SIG_IGN);
@ -169,8 +176,8 @@ start_score()
* issymlink: * issymlink:
* See if the file has a symbolic link * See if the file has a symbolic link
*/ */
issymlink(sp) bool
char *sp; issymlink(char *sp)
{ {
#ifdef S_IFLNK #ifdef S_IFLNK
struct stat sbuf2; struct stat sbuf2;
@ -188,7 +195,8 @@ char *sp;
* too_much: * too_much:
* See if the system is being used too much for this game * See if the system is being used too much for this game
*/ */
too_much() int
too_much(void)
{ {
#ifdef MAXLOAD #ifdef MAXLOAD
double avec[3]; double avec[3];
@ -208,7 +216,8 @@ too_much()
* author: * author:
* See if a user is an author of the program * See if a user is an author of the program
*/ */
author() bool
author(void)
{ {
#ifdef WIZARD #ifdef WIZARD
if (wizard) if (wizard)
@ -246,7 +255,7 @@ checkout(int s)
if (author()) if (author())
{ {
num_checks = 1; num_checks = 1;
chmsg("The load is rather high, O exaulted one"); chmsg("The load is rather high, O exaulted one", 0);
} }
else if (num_checks++ == 3) else if (num_checks++ == 3)
fatal("Sorry. You took to long. You are dead\n"); fatal("Sorry. You took to long. You are dead\n");
@ -265,7 +274,7 @@ checkout(int s)
if (num_checks) if (num_checks)
{ {
num_checks = 0; num_checks = 0;
chmsg("The load has dropped back down. You have a reprieve"); chmsg("The load has dropped back down. You have a reprieve", 0);
} }
#ifdef CHECKTIME #ifdef CHECKTIME
#ifdef SIGALRM #ifdef SIGALRM
@ -280,9 +289,8 @@ checkout(int s)
* checkout()'s version of msg. If we are in the middle of a * checkout()'s version of msg. If we are in the middle of a
* shell, do a printf instead of a msg to avoid the refresh. * shell, do a printf instead of a msg to avoid the refresh.
*/ */
chmsg(fmt, arg) void
char *fmt; chmsg(char *fmt, int arg)
int arg;
{ {
if (in_shell) if (in_shell)
{ {
@ -299,7 +307,8 @@ int arg;
* lock the score file. If it takes too long, ask the user if * lock the score file. If it takes too long, ask the user if
* they care to wait. Return TRUE if the lock is successful. * they care to wait. Return TRUE if the lock is successful.
*/ */
lock_sc() bool
lock_sc(void)
{ {
#ifdef SCOREFILE #ifdef SCOREFILE
#ifdef LOCKFILE #ifdef LOCKFILE
@ -361,7 +370,8 @@ over:
* unlock_sc: * unlock_sc:
* Unlock the score file * Unlock the score file
*/ */
unlock_sc() void
unlock_sc(void)
{ {
#ifdef SCOREFILE #ifdef SCOREFILE
#ifdef LOCKFILE #ifdef LOCKFILE
@ -374,7 +384,8 @@ unlock_sc()
* flush_type: * flush_type:
* Flush typeahead for traps, etc. * Flush typeahead for traps, etc.
*/ */
flush_type() void
flush_type(void)
{ {
flushinp(); flushinp();
} }

View file

@ -18,15 +18,15 @@
#include <signal.h> #include <signal.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <time.h>
#include "rogue.h" #include "rogue.h"
/* /*
* main: * main:
* The main program, of course * The main program, of course
*/ */
main(argc, argv, envp) int
char **argv; main(int argc, char *argv[], char *envp[])
char **envp;
{ {
register char *env; register char *env;
int lowtime; int lowtime;
@ -113,7 +113,7 @@ char **envp;
if (argc == 2 && strcmp(argv[1], "-s") == 0) if (argc == 2 && strcmp(argv[1], "-s") == 0)
{ {
noscore = TRUE; noscore = TRUE;
score(0, -1); score(0, -1, 0);
exit(0); exit(0);
} }
init_check(); /* check for legal startup */ init_check(); /* check for legal startup */
@ -227,8 +227,8 @@ endit(int a)
* fatal: * fatal:
* Exit the program, printing a message. * Exit the program, printing a message.
*/ */
fatal(s) void
char *s; fatal(char *s)
{ {
clear(); clear();
move(LINES-2, 0); move(LINES-2, 0);
@ -242,8 +242,8 @@ char *s;
* rnd: * rnd:
* Pick a very random number. * Pick a very random number.
*/ */
rnd(range) int
register int range; rnd(int range)
{ {
return range == 0 ? 0 : abs((int) RN) % range; return range == 0 ? 0 : abs((int) RN) % range;
} }
@ -252,8 +252,8 @@ register int range;
* roll: * roll:
* Roll a number of dice * Roll a number of dice
*/ */
roll(number, sides) int
register int number, sides; roll(int number, int sides)
{ {
register int dtotal = 0; register int dtotal = 0;
@ -299,7 +299,8 @@ tstp(int a)
* The main loop of the program. Loop until the game is over, * The main loop of the program. Loop until the game is over,
* refreshing things and looking at the proper times. * refreshing things and looking at the proper times.
*/ */
playit() void
playit(void)
{ {
register char *opts; register char *opts;
@ -352,7 +353,7 @@ quit(int a)
move(LINES - 1, 0); move(LINES - 1, 0);
refresh(); refresh();
writelog(purse, 1, 0); writelog(purse, 1, 0);
score(purse, 1); score(purse, 1, 0);
printf("[Press return to exit]\n"); printf("[Press return to exit]\n");
fflush(NULL); fflush(NULL);
getchar(); getchar();
@ -391,7 +392,8 @@ leave(int sig)
* shell: * shell:
* Let him escape for a while * Let him escape for a while
*/ */
shell() void
shell(void)
{ {
/* /*
* Set the terminal back to original mode * Set the terminal back to original mode

View file

@ -59,6 +59,7 @@
char *strdup(const char *s); char *strdup(const char *s);
#endif #endif
#include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -85,7 +86,7 @@ char *strdup(const char *s);
#define MOD_MOVE(c) (toupper(c) ) #define MOD_MOVE(c) (toupper(c) )
void void
md_init() md_init(void)
{ {
#ifdef __INTERIX #ifdef __INTERIX
char *term; char *term;
@ -104,7 +105,7 @@ md_init()
} }
int int
md_hasclreol() md_hasclreol(void)
{ {
#ifdef CE #ifdef CE
return((CE != NULL) && (*CE != 0)); return((CE != NULL) && (*CE != 0));
@ -126,7 +127,7 @@ md_putchar(int c)
static int md_standout_mode = 0; static int md_standout_mode = 0;
void void
md_raw_standout() md_raw_standout(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
@ -149,7 +150,7 @@ md_raw_standout()
} }
void void
md_raw_standend() md_raw_standend(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
CONSOLE_SCREEN_BUFFER_INFO csbiInfo; CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
@ -230,7 +231,7 @@ md_creat(char *file, int mode)
void void
md_normaluser() md_normaluser(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
setuid(getuid()); setuid(getuid());
@ -239,7 +240,7 @@ md_normaluser()
} }
int int
md_getuid() md_getuid(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
return( getuid() ); return( getuid() );
@ -296,7 +297,7 @@ md_getusername(int uid)
} }
char * char *
md_gethomedir() md_gethomedir(void)
{ {
static char homedir[PATH_MAX]; static char homedir[PATH_MAX];
char *h = NULL; char *h = NULL;
@ -348,7 +349,7 @@ md_sleep(int s)
} }
char * char *
md_getshell() md_getshell(void)
{ {
static char shell[PATH_MAX]; static char shell[PATH_MAX];
char *s = NULL; char *s = NULL;
@ -378,7 +379,7 @@ md_getshell()
} }
void void
md_ignore_signals() md_ignore_signals(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
int i; int i;
@ -395,7 +396,7 @@ md_ignore_signals()
} }
int int
md_shellescape() md_shellescape(void)
{ {
#if (!defined(_WIN32) && !defined(__DJGPP__)) #if (!defined(_WIN32) && !defined(__DJGPP__))
int ret_status; int ret_status;
@ -465,7 +466,7 @@ md_getrealname(int uid)
#endif #endif
} }
extern char *xcrypt(char *key, char *salt); extern char *xcrypt(const char *key, const char *setting);
char * char *
md_crypt(char *key, char *salt) md_crypt(char *key, char *salt)
@ -569,7 +570,7 @@ md_htonl(unsigned long int x)
} }
int int
md_ucount() md_ucount(void)
{ {
#ifdef __DJGPP__ #ifdef __DJGPP__
return(1); return(1);
@ -606,7 +607,7 @@ md_getloadavg(double *avg)
} }
long long
md_random() md_random(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
return(rand()); return(rand());
@ -626,7 +627,7 @@ md_srandom(unsigned x)
} }
int int
md_rand() md_rand(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
return(rand()); return(rand());
@ -656,7 +657,7 @@ md_strdup(const char *s)
} }
long long
md_memused() md_memused(void)
{ {
#ifdef _WIN32 #ifdef _WIN32
MEMORYSTATUS stat; MEMORYSTATUS stat;
@ -670,7 +671,7 @@ md_memused()
} }
int int
md_erasechar() md_erasechar(void)
{ {
#ifdef BSD #ifdef BSD
return(_tty.sg_erase); /* process erase character */ return(_tty.sg_erase); /* process erase character */
@ -682,7 +683,7 @@ md_erasechar()
} }
int int
md_killchar() md_killchar(void)
{ {
#ifdef BSD #ifdef BSD
return(_tty.sg_kill); return(_tty.sg_kill);
@ -711,7 +712,7 @@ md_unctrl(char ch)
} }
void void
md_flushinp() md_flushinp(void)
{ {
#ifdef BSD #ifdef BSD
ioctl(0, TIOCFLUSH); ioctl(0, TIOCFLUSH);
@ -1012,7 +1013,7 @@ int undo[5];
int uindex = -1; int uindex = -1;
int int
reread() reread(void)
{ {
int redo; int redo;
@ -1046,6 +1047,7 @@ md_readchar(WINDOW *win)
int mode2 = M_NORMAL; int mode2 = M_NORMAL;
int nodelayf = 0; int nodelayf = 0;
int count = 0; int count = 0;
extern void auto_save(int sig);
for(;;) for(;;)
{ {

View file

@ -21,8 +21,7 @@
* Print the name of a trap * Print the name of a trap
*/ */
char * char *
tr_name(type) tr_name(char type)
char type;
{ {
switch (type) switch (type)
{ {
@ -47,8 +46,8 @@ char type;
* look: * look:
* A quick glance all around the player * A quick glance all around the player
*/ */
look(wakeup) void
bool wakeup; look(bool wakeup)
{ {
register int x, y; register int x, y;
register unsigned char ch; register unsigned char ch;
@ -204,8 +203,7 @@ bool wakeup;
* Find the unclaimed object at y, x * Find the unclaimed object at y, x
*/ */
THING * THING *
find_obj(y, x) find_obj(int y, int x)
register int y, x;
{ {
register THING *op; register THING *op;
@ -225,7 +223,8 @@ register int y, x;
* eat: * eat:
* She wants to eat something, so let her try * She wants to eat something, so let her try
*/ */
eat() void
eat(void)
{ {
register THING *obj; register THING *obj;
@ -272,8 +271,8 @@ eat()
* Used to modify the playes strength. It keeps track of the * Used to modify the playes strength. It keeps track of the
* highest it has been, just in case * highest it has been, just in case
*/ */
chg_str(amt) void
register int amt; chg_str(int amt)
{ {
str_t comp; str_t comp;
@ -293,9 +292,8 @@ register int amt;
* add_str: * add_str:
* Perform the actual add, checking upper and lower bound limits * Perform the actual add, checking upper and lower bound limits
*/ */
add_str(sp, amt) void
register str_t *sp; add_str(str_t *sp, int amt)
int amt;
{ {
if ((*sp += amt) < 3) if ((*sp += amt) < 3)
*sp = 3; *sp = 3;
@ -307,8 +305,8 @@ int amt;
* add_haste: * add_haste:
* Add a haste to the player * Add a haste to the player
*/ */
add_haste(potion) bool
bool potion; add_haste(bool potion)
{ {
if (on(player, ISHASTE)) if (on(player, ISHASTE))
{ {
@ -332,7 +330,8 @@ bool potion;
* aggravate: * aggravate:
* Aggravate all the monsters on this level * Aggravate all the monsters on this level
*/ */
aggravate() void
aggravate(void)
{ {
register THING *mi; register THING *mi;
@ -346,8 +345,7 @@ aggravate()
* "an". * "an".
*/ */
char * char *
vowelstr(str) vowelstr(char *str)
register char *str;
{ {
switch (*str) switch (*str)
{ {
@ -366,8 +364,8 @@ register char *str;
* is_current: * is_current:
* See if the object is one of the currently used items * See if the object is one of the currently used items
*/ */
is_current(obj) bool
register THING *obj; is_current(THING *obj)
{ {
if (obj == NULL) if (obj == NULL)
return FALSE; return FALSE;
@ -387,7 +385,8 @@ register THING *obj;
* Set up the direction co_ordinate for use in varios "prefix" * Set up the direction co_ordinate for use in varios "prefix"
* commands * commands
*/ */
get_dir() bool
get_dir(void)
{ {
register char *prompt; register char *prompt;
register bool gotit; register bool gotit;
@ -430,8 +429,8 @@ get_dir()
* sign: * sign:
* Return the sign of the number * Return the sign of the number
*/ */
sign(nm) int
register int nm; sign(int nm)
{ {
if (nm < 0) if (nm < 0)
return -1; return -1;
@ -443,8 +442,8 @@ register int nm;
* spread: * spread:
* Give a spread around a given number (+/- 10%) * Give a spread around a given number (+/- 10%)
*/ */
spread(nm) int
register int nm; spread(int nm)
{ {
return nm - nm / 10 + rnd(nm / 5); return nm - nm / 10 + rnd(nm / 5);
} }
@ -453,9 +452,8 @@ register int nm;
* call_it: * call_it:
* Call an object something after use. * Call an object something after use.
*/ */
call_it(know, guess) void
register bool know; call_it(bool know, char **guess)
register char **guess;
{ {
if (know && *guess) if (know && *guess)
{ {

View file

@ -15,6 +15,8 @@
#include <ctype.h> #include <ctype.h>
#include "rogue.h" #include "rogue.h"
int exp_add(THING *tp);
/* /*
* List of monsters in rough order of vorpalness * List of monsters in rough order of vorpalness
* *
@ -39,8 +41,8 @@ char wand_mons[] = {
* Pick a monster to show up. The lower the level, * Pick a monster to show up. The lower the level,
* the meaner the monster. * the meaner the monster.
*/ */
randmonster(wander) char
bool wander; randmonster(bool wander)
{ {
register int d; register int d;
register char *mons; register char *mons;
@ -61,10 +63,8 @@ bool wander;
* new_monster: * new_monster:
* Pick a new monster and add it to the list * Pick a new monster and add it to the list
*/ */
new_monster(tp, type, cp) void
register THING *tp; new_monster(THING *tp, char type, coord *cp)
char type;
register coord *cp;
{ {
register struct monster *mp; register struct monster *mp;
register int lev_add; register int lev_add;
@ -109,8 +109,8 @@ register coord *cp;
* expadd: * expadd:
* Experience to add for this monster's level/hit points * Experience to add for this monster's level/hit points
*/ */
exp_add(tp) int
register THING *tp; exp_add(THING *tp)
{ {
register int mod; register int mod;
@ -129,7 +129,8 @@ register THING *tp;
* wanderer: * wanderer:
* Create a new wandering monster and aim it at the player * Create a new wandering monster and aim it at the player
*/ */
wanderer() void
wanderer(void)
{ {
register int i; register int i;
register struct room *rp; register struct room *rp;
@ -166,8 +167,7 @@ wanderer()
* What to do when the hero steps next to a monster * What to do when the hero steps next to a monster
*/ */
THING * THING *
wake_monster(y, x) wake_monster(int y, int x)
int y, x;
{ {
register THING *tp; register THING *tp;
register struct room *rp; register struct room *rp;
@ -226,7 +226,8 @@ int y, x;
* genocide: * genocide:
* Wipe one monster out of existence (for now...) * Wipe one monster out of existence (for now...)
*/ */
genocide() void
genocide(void)
{ {
register THING *mp; register THING *mp;
register char c; register char c;
@ -270,8 +271,8 @@ genocide()
* give_pack: * give_pack:
* Give a pack to a monster if it deserves one * Give a pack to a monster if it deserves one
*/ */
give_pack(tp) void
register THING *tp; give_pack(THING *tp)
{ {
if (rnd(100) < monsters[tp->t_type-'A'].m_carry) if (rnd(100) < monsters[tp->t_type-'A'].m_carry)
attach(tp->t_pack, new_thing()); attach(tp->t_pack, new_thing());

View file

@ -14,6 +14,9 @@
#include <ctype.h> #include <ctype.h>
#include "rogue.h" #include "rogue.h"
void turnref(void);
char be_trapped(coord *tc);
/* /*
* Used to hold the new hero position * Used to hold the new hero position
*/ */
@ -24,8 +27,8 @@ coord nh;
* do_run: * do_run:
* Start the hero running * Start the hero running
*/ */
do_run(ch) void
char ch; do_run(char ch)
{ {
running = TRUE; running = TRUE;
after = FALSE; after = FALSE;
@ -37,8 +40,8 @@ char ch;
* Check to see that a move is legal. If it is handle the * Check to see that a move is legal. If it is handle the
* consequences (fighting, picking up, etc.) * consequences (fighting, picking up, etc.)
*/ */
do_move(dy, dx) void
int dy, dx; do_move(int dy, int dx)
{ {
register char ch, fl; register char ch, fl;
@ -189,7 +192,8 @@ move_stuff:
* turnref: * turnref:
* Decide whether to refresh at a passage turning or not * Decide whether to refresh at a passage turning or not
*/ */
turnref() void
turnref(void)
{ {
register int index; register int index;
@ -211,8 +215,8 @@ turnref()
* Called to illuminate a room. If it is dark, remove anything * Called to illuminate a room. If it is dark, remove anything
* that might move. * that might move.
*/ */
door_open(rp) void
struct room *rp; door_open(struct room *rp)
{ {
register int j, k; register int j, k;
register char ch; register char ch;
@ -238,8 +242,8 @@ struct room *rp;
* be_trapped: * be_trapped:
* The guy stepped on a trap.... Make him pay. * The guy stepped on a trap.... Make him pay.
*/ */
be_trapped(tc) char
register coord *tc; be_trapped(coord *tc)
{ {
register char tr; register char tr;
register int index; register int index;
@ -316,8 +320,7 @@ register coord *tc;
* Move in a random direction if the monster/person is confused * Move in a random direction if the monster/person is confused
*/ */
coord * coord *
rndmove(who) rndmove(THING *who)
THING *who;
{ {
register int x, y; register int x, y;
register char ch; register char ch;

View file

@ -11,6 +11,7 @@
* See the file LICENSE.TXT for full copyright and licensing information. * See the file LICENSE.TXT for full copyright and licensing information.
*/ */
#include <stdlib.h>
#include <time.h> #include <time.h>
#include <curses.h> #include <curses.h>
#include <string.h> #include <string.h>
@ -20,7 +21,11 @@
#define MAXTREAS 10 /* maximum number of treasures in a treasure room */ #define MAXTREAS 10 /* maximum number of treasures in a treasure room */
#define MINTREAS 2 /* minimum number of treasures in a treasure room */ #define MINTREAS 2 /* minimum number of treasures in a treasure room */
new_level() void put_things(void);
void treas_room(void);
void
new_level(void)
{ {
register int rm, i; register int rm, i;
register THING *tp; register THING *tp;
@ -112,7 +117,8 @@ new_level()
* rnd_room: * rnd_room:
* Pick a room that is really there * Pick a room that is really there
*/ */
rnd_room() int
rnd_room(void)
{ {
register int rm; register int rm;
@ -127,7 +133,8 @@ rnd_room()
* put_things: * put_things:
* Put potions and scrolls on this level * Put potions and scrolls on this level
*/ */
put_things() void
put_things(void)
{ {
register int i; register int i;
register THING *cur; register THING *cur;
@ -197,7 +204,8 @@ put_things()
*/ */
#define MAXTRIES 10 /* max number of tries to put down a monster */ #define MAXTRIES 10 /* max number of tries to put down a monster */
treas_room() void
treas_room(void)
{ {
register int nm, index; register int nm, index;
register THING *tp; register THING *tp;

View file

@ -36,7 +36,10 @@ typedef struct optstruct OPTION;
int allowchange(OPTION *opt); int allowchange(OPTION *opt);
int put_bool(), get_bool(), put_str(), get_str(); void put_bool(bool *b);
void put_str(char *str);
int get_bool(bool *bp, WINDOW *win);
int get_str(char *opt, WINDOW *win);
OPTION optlist[] = { OPTION optlist[] = {
{"terse", "Terse output: ", {"terse", "Terse output: ",
@ -63,7 +66,8 @@ OPTION optlist[] = {
* option: * option:
* Print and then set options from the terminal * Print and then set options from the terminal
*/ */
option() void
option(void)
{ {
register OPTION *op; register OPTION *op;
register int retval; register int retval;
@ -125,8 +129,8 @@ option()
* put_bool * put_bool
* Put out a boolean * Put out a boolean
*/ */
put_bool(b) void
bool *b; put_bool(bool *b)
{ {
waddstr(hw, *b ? "True" : "False"); waddstr(hw, *b ? "True" : "False");
} }
@ -135,8 +139,8 @@ bool *b;
* put_str: * put_str:
* Put out a string * Put out a string
*/ */
put_str(str) void
char *str; put_str(char *str)
{ {
waddstr(hw, str); waddstr(hw, str);
} }
@ -145,9 +149,8 @@ char *str;
* get_bool: * get_bool:
* Allow changing a boolean option and print it out * Allow changing a boolean option and print it out
*/ */
get_bool(bp, win) int
bool *bp; get_bool(bool *bp, WINDOW *win)
WINDOW *win;
{ {
register int oy, ox; register int oy, ox;
register bool op_bad; register bool op_bad;
@ -196,9 +199,8 @@ WINDOW *win;
*/ */
#define MAXINP 50 /* max string to read from terminal or environment */ #define MAXINP 50 /* max string to read from terminal or environment */
get_str(opt, win) int
register char *opt; get_str(char *opt, WINDOW *win)
WINDOW *win;
{ {
register char *sp; register char *sp;
register int c, oy, ox; register int c, oy, ox;
@ -274,9 +276,8 @@ WINDOW *win;
* get_num: * get_num:
* Get a numeric option * Get a numeric option
*/ */
get_num(opt, win) int
short *opt; get_num(short *opt, WINDOW *win)
WINDOW *win;
{ {
register int i; register int i;
char buf[MAXSTR]; char buf[MAXSTR];
@ -295,8 +296,8 @@ WINDOW *win;
* being "name=....", with the string being defined up to a comma * being "name=....", with the string being defined up to a comma
* or the end of the entire option string. * or the end of the entire option string.
*/ */
parse_opts(str) void
register char *str; parse_opts(char *str)
{ {
register char *sp; register char *sp;
register OPTION *op; register OPTION *op;
@ -373,9 +374,8 @@ register char *str;
* strucpy: * strucpy:
* Copy string using unctrol for things * Copy string using unctrol for things
*/ */
strucpy(s1, s2, len) void
register char *s1, *s2; strucpy(char *s1, char *s2, int len)
register int len;
{ {
if (len > MAXINP) if (len > MAXINP)
len = MAXINP; len = MAXINP;

View file

@ -14,14 +14,16 @@
#include <ctype.h> #include <ctype.h>
#include "rogue.h" #include "rogue.h"
void money(int value);
/* /*
* update_mdest: * update_mdest:
* Called after picking up an object, before discarding it. * Called after picking up an object, before discarding it.
* If this was the object of something's desire, that monster will * If this was the object of something's desire, that monster will
* get mad and run at the hero * get mad and run at the hero
*/ */
update_mdest(obj) void
register THING *obj; update_mdest(THING *obj)
{ {
register THING *mp; register THING *mp;
@ -36,9 +38,8 @@ register THING *obj;
* non-null use it as the linked_list pointer instead of gettting * non-null use it as the linked_list pointer instead of gettting
* it off the ground. * it off the ground.
*/ */
add_pack(obj, silent) void
register THING *obj; add_pack(THING *obj, bool silent)
bool silent;
{ {
register THING *op, *lp = NULL; register THING *op, *lp = NULL;
register bool exact, from_floor; register bool exact, from_floor;
@ -216,9 +217,8 @@ picked_up:
* inventory: * inventory:
* List what is in the pack * List what is in the pack
*/ */
inventory(list, type) bool
THING *list; inventory(THING *list, int type)
int type;
{ {
register char ch; register char ch;
register int n_objs; register int n_objs;
@ -253,8 +253,8 @@ int type;
* pick_up: * pick_up:
* Add something to characters pack. * Add something to characters pack.
*/ */
pick_up(ch) void
char ch; pick_up(char ch)
{ {
register THING *obj, *mp; register THING *obj, *mp;
@ -290,7 +290,8 @@ char ch;
* picky_inven: * picky_inven:
* Allow player to inventory a single item * Allow player to inventory a single item
*/ */
picky_inven() void
picky_inven(void)
{ {
register THING *obj; register THING *obj;
register char ch, mch; register char ch, mch;
@ -325,9 +326,7 @@ picky_inven()
* Pick something out of a pack for a purpose * Pick something out of a pack for a purpose
*/ */
THING * THING *
get_item(purpose, type) get_item(char *purpose, int type)
char *purpose;
int type;
{ {
register THING *obj; register THING *obj;
register char ch, och; register char ch, och;
@ -384,8 +383,8 @@ int type;
* pack_char: * pack_char:
* Return which character would address a pack object * Return which character would address a pack object
*/ */
pack_char(obj) char
register THING *obj; pack_char(THING *obj)
{ {
register THING *item; register THING *item;
register char c; register char c;
@ -403,8 +402,8 @@ register THING *obj;
* money: * money:
* Add or subtract gold from the pack * Add or subtract gold from the pack
*/ */
money(value) void
register int value; money(int value)
{ {
register char floor; register char floor;

View file

@ -10,14 +10,21 @@
* See the file LICENSE.TXT for full copyright and licensing information. * See the file LICENSE.TXT for full copyright and licensing information.
*/ */
#include <stdlib.h>
#include <curses.h> #include <curses.h>
#include "rogue.h" #include "rogue.h"
void conn(int r1, int r2);
void door(struct room *rm, coord *cp);
void passnum(void);
void numpass(int y, int x);
/* /*
* do_passages: * do_passages:
* Draw all the passages on a level. * Draw all the passages on a level.
*/ */
do_passages() void
do_passages(void)
{ {
register struct rdes *r1, *r2 = NULL; register struct rdes *r1, *r2 = NULL;
register int i, j; register int i, j;
@ -125,8 +132,8 @@ do_passages()
* conn: * conn:
* Draw a corridor from a room in a certain direction. * Draw a corridor from a room in a certain direction.
*/ */
conn(r1, r2) void
int r1, r2; conn(int r1, int r2)
{ {
register struct room *rpf, *rpt = NULL; register struct room *rpf, *rpt = NULL;
register char rmt; register char rmt;
@ -269,9 +276,8 @@ int r1, r2;
* Add a door or possibly a secret door. Also enters the door in * Add a door or possibly a secret door. Also enters the door in
* the exits array of the room. * the exits array of the room.
*/ */
door(rm, cp) void
register struct room *rm; door(struct room *rm, coord *cp)
register coord *cp;
{ {
register int index; register int index;
@ -291,7 +297,8 @@ register coord *cp;
* add_pass: * add_pass:
* Add the passages to the current window (wizard command) * Add the passages to the current window (wizard command)
*/ */
add_pass() void
add_pass(void)
{ {
register int y, x, ch; register int y, x, ch;
@ -309,7 +316,8 @@ add_pass()
static int pnum; static int pnum;
static bool newpnum; static bool newpnum;
passnum() void
passnum(void)
{ {
register struct room *rp; register struct room *rp;
register int i; register int i;
@ -330,8 +338,8 @@ passnum()
* numpass: * numpass:
* Number a passageway square and its brethren * Number a passageway square and its brethren
*/ */
numpass(y, x) void
register int y, x; numpass(int y, int x)
{ {
register char *fp; register char *fp;
register struct room *rp; register struct room *rp;

View file

@ -17,7 +17,8 @@
* quaff: * quaff:
* Quaff a potion from the pack * Quaff a potion from the pack
*/ */
quaff() void
quaff(void)
{ {
register THING *obj, *th; register THING *obj, *th;
register bool discardit = FALSE; register bool discardit = FALSE;
@ -203,7 +204,8 @@ quaff()
* invis_on: * invis_on:
* Turn on the ability to see invisible * Turn on the ability to see invisible
*/ */
invis_on() void
invis_on(void)
{ {
register THING *th; register THING *th;
@ -220,8 +222,8 @@ invis_on()
* see_monst: * see_monst:
* Put on or off seeing monsters on this level * Put on or off seeing monsters on this level
*/ */
turn_see(turn_off) bool
register bool turn_off; turn_see(bool turn_off)
{ {
register THING *mp; register THING *mp;
register bool can_see, add_new; register bool can_see, add_new;

View file

@ -14,11 +14,14 @@
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
int gethand(void);
/* /*
* ring_on: * ring_on:
* Put a ring on a hand * Put a ring on a hand
*/ */
ring_on() void
ring_on(void)
{ {
register THING *obj; register THING *obj;
register int ring; register int ring;
@ -88,7 +91,8 @@ ring_on()
* ring_off: * ring_off:
* Take off a ring * Take off a ring
*/ */
ring_off() void
ring_off(void)
{ {
register int ring; register int ring;
register THING *obj; register THING *obj;
@ -125,7 +129,8 @@ ring_off()
* gethand: * gethand:
* Which hand is the hero interested in? * Which hand is the hero interested in?
*/ */
gethand() int
gethand(void)
{ {
register int c; register int c;
@ -153,8 +158,8 @@ gethand()
* ring_eat: * ring_eat:
* How much food does this ring use up? * How much food does this ring use up?
*/ */
ring_eat(hand) int
register int hand; ring_eat(int hand)
{ {
if (cur_ring[hand] == NULL) if (cur_ring[hand] == NULL)
return 0; return 0;
@ -186,8 +191,7 @@ register int hand;
* Print ring bonuses * Print ring bonuses
*/ */
char * char *
ring_num(obj) ring_num(THING *obj)
register THING *obj;
{ {
static char buf[5]; static char buf[5];

View file

@ -19,6 +19,8 @@
#include <stdlib.h> #include <stdlib.h>
#include "rogue.h" #include "rogue.h"
char *killname(char monst, bool doart);
static char *rip[] = { static char *rip[] = {
" __________", " __________",
" / \\", " / \\",
@ -41,9 +43,8 @@ static char *rip[] = {
* Figure score and post it. * Figure score and post it.
*/ */
/* VARARGS2 */ /* VARARGS2 */
score(amount, flags, monst) void
int amount, flags; score(int amount, int flags, char monst)
char monst;
{ {
register struct sc_ent *scp; register struct sc_ent *scp;
register int i; register int i;
@ -297,8 +298,8 @@ void writelog(int amount, int flags, char monst)
* death: * death:
* Do something really fun when he dies * Do something really fun when he dies
*/ */
death(monst) void
register char monst; death(char monst)
{ {
register char **dp = rip, *killer; register char **dp = rip, *killer;
register struct tm *lt; register struct tm *lt;
@ -341,7 +342,8 @@ register char monst;
* total_winner: * total_winner:
* Code for a winner * Code for a winner
*/ */
total_winner() void
total_winner(void)
{ {
register THING *obj; register THING *obj;
register int worth = 0; register int worth = 0;
@ -461,9 +463,7 @@ total_winner()
* Convert a code to a monster name * Convert a code to a monster name
*/ */
char * char *
killname(monst, doart) killname(char monst, bool doart)
register char monst;
bool doart;
{ {
register const char *sp; register const char *sp;
register bool article; register bool article;

Some files were not shown because too many files have changed in this diff Show more