# HG changeset patch # User John "Elwin" Edwards # Date 1456971206 18000 # Node ID f54901b9c39b5524f204a28f4888dccbe083eb4c # Parent f9ef86cf22b2ba32d379afa3c16c92cbcc1b46f1 XRogue: convert to ANSI-style function declarations. diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/actions.c --- a/xrogue/actions.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/actions.c Wed Mar 02 21:13:26 2016 -0500 @@ -24,12 +24,20 @@ int mf_count = 0; /* move_free counter - see actions.c(m_act()) */ int mf_jmpcnt = 0; /* move_free counter for # of jumps */ +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 *defend_pos, int dist, + coord *shoot_dir); + /* * Did we disrupt a spell? */ -dsrpt_monster(tp, always, see_him) -register struct thing *tp; -bool always, see_him; +void +dsrpt_monster(struct thing *tp, bool always, bool see_him) { switch (tp->t_action) { case A_SUMMON: @@ -58,7 +66,8 @@ } } -dsrpt_player() +void +dsrpt_player(void) { int which, action; struct linked_list *item; @@ -87,7 +96,7 @@ if (purse > 0) { msg("Your gold goes flying everywhere!"); do { - item = spec_item(GOLD, NULL, NULL, NULL); + item = spec_item(GOLD, 0, 0, 0); obj = OBJPTR(item); obj->o_count = min(purse, rnd(20)+1); purse -= obj->o_count; @@ -125,8 +134,8 @@ * Otherwise, let it perform its chosen action. */ -m_act(tp) -register struct thing *tp; +void +m_act(struct thing *tp) { struct object *obj; bool flee; /* Are we scared? */ @@ -290,8 +299,8 @@ * Breathe in the chosen direction. */ -m_breathe(tp) -register struct thing *tp; +void +m_breathe(struct thing *tp) { register int damage; register char *breath = NULL; @@ -399,11 +408,11 @@ /* * m_select: * Select an action for the monster. + * flee: True if running away or player is inaccessible in wall */ -m_select(th, flee) -register struct thing *th; -register bool flee; /* True if running away or player is inaccessible in wall */ +void +m_select(struct thing *th, bool flee) { register struct room *rer, *ree; /* room of chaser, room of chasee */ int dist = INT_MIN; @@ -541,8 +550,8 @@ * The monster is sounding a sonic blast. */ -m_sonic(tp) -register struct thing *tp; +void +m_sonic(struct thing *tp) { register int damage; struct object blast = @@ -571,8 +580,8 @@ * The monster casts a spell. Currently this is limited to * magic missile. */ -m_spell(tp) -register struct thing *tp; +void +m_spell(struct thing *tp) { struct object missile = { @@ -594,8 +603,8 @@ * Summon aid. */ -m_summon(tp) -register struct thing *tp; +void +m_summon(struct thing *tp) { register char *helpname, *mname; int fail, numsum; @@ -668,10 +677,7 @@ */ bool -m_use_it(tp, flee, rer, ree) -register struct thing *tp; -bool flee; -register struct room *rer, *ree; +m_use_it(struct thing *tp, bool flee, struct room *rer, struct room *ree) { int dist; register coord *ee = tp->t_dest, *er = &tp->t_pos; @@ -836,7 +842,8 @@ } -reap() +void +reap(void) { _t_free_list(&rlist); } @@ -844,10 +851,11 @@ /* * runners: * Make all the awake monsters try to do something. + * segments: Number of segments since last called */ -runners(segments) -int segments; /* Number of segments since last called */ +int +runners(int segments) { register struct linked_list *item; register struct thing *tp = NULL; @@ -961,11 +969,7 @@ * Only care about relics and wands for now. */ bool -m_use_pack(monster, defend_pos, dist, shoot_dir) -register struct thing *monster; -coord *defend_pos; -register int dist; -register coord *shoot_dir; +m_use_pack(struct thing *monster, coord *defend_pos, int dist, coord *shoot_dir) { register struct object *obj; register struct linked_list *pitem, *relic, *stick; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/bolt.c --- a/xrogue/bolt.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/bolt.c Wed Mar 02 21:13:26 2016 -0500 @@ -18,6 +18,7 @@ #include #include +#include #include "rogue.h" /* @@ -25,13 +26,9 @@ * given direction */ -shoot_bolt(shooter, start, dir, get_points, reason, name, damage) -struct thing *shooter; -coord start, dir; -bool get_points; -short reason; -char *name; -int damage; +void +shoot_bolt(struct thing *shooter, coord start, coord dir, bool get_points, + short reason, char *name, int damage) { unsigned char dirch = 0, ch; bool used, change, see_him; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/chase.c --- a/xrogue/chase.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/chase.c Wed Mar 02 21:13:26 2016 -0500 @@ -19,16 +19,18 @@ #include #include #include +#include #include "rogue.h" +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 * try to blink the monster next to the player. */ bool -can_blink(tp) -register struct thing *tp; +can_blink(struct thing *tp) { register int y, x, index=9; coord tryp; /* To hold the coordinates for use in diag_ok */ @@ -123,8 +125,7 @@ */ int -can_shoot(er, ee, shoot_dir) -register coord *er, *ee, *shoot_dir; +can_shoot(coord *er, coord *ee, coord *shoot_dir) { /* * They must be in the same room or very close (at door) @@ -150,15 +151,13 @@ * 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 * room of the creature being chased (chasee). + * 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 */ -chase(tp, ee, rer, ree, flee) -register struct thing *tp; -register coord *ee; -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 - */ +void +chase(struct thing *tp, coord *ee, struct room *rer, struct room *ree, + bool flee) { int dist, thisdist, monst_dist = INT_MAX; register coord *er = &tp->t_pos; @@ -495,8 +494,8 @@ * Make one thing chase another. */ -do_chase(th) -register struct thing *th; +void +do_chase(struct thing *th) { register struct room *orig_rer, /* Original room of chaser */ *new_room; /* new room of monster */ @@ -812,8 +811,7 @@ */ struct linked_list * -get_hurl(tp) -register struct thing *tp; +get_hurl(struct thing *tp) { struct linked_list *arrow=NULL, *bolt=NULL, *rock=NULL, *spear = NULL, *dagger=NULL, *dart=NULL, *aklad=NULL; @@ -860,9 +858,8 @@ * Set a monster running after something */ -runto(runner, spot) -register struct thing *runner; -coord *spot; +void +runto(struct thing *runner, coord *spot) { if (on(*runner, ISSTONE)) return; @@ -888,9 +885,7 @@ */ bool -straight_shot(ery, erx, eey, eex, shooting) -register int ery, erx, eey, eex; -register coord *shooting; +straight_shot(int ery, int erx, int eey, int eex, coord *shooting) { register int dy, dx; /* Deltas */ unsigned char ch; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/command.c --- a/xrogue/command.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/command.c Wed Mar 02 21:13:26 2016 -0500 @@ -24,12 +24,21 @@ #include "mach_dep.h" #include "rogue.h" +void display(void); +void d_level(void); +void u_level(void); +void shell(void); +void nameit(void); +void namemonst(void); +void count_gold(void); + /* * command: * Process the user commands */ -command() +void +command(void) { unsigned int ch; struct linked_list *item; @@ -288,7 +297,7 @@ else { after = FALSE; player.t_action = A_NIL; - fright(); + fright(NULL); } when 'g' : /* Give command: give slime-molds to monsters */ if (player.t_action == A_NIL) { @@ -298,7 +307,7 @@ else { after = FALSE; player.t_action = A_NIL; - give(); + give(NULL); } when 'G' : if (player.t_action == A_NIL) { @@ -357,14 +366,14 @@ /* when '\\' : after = FALSE; ident_hero(); */ when '\\' : msg("Charon (the Boatman) looks at you... "); - when '/' : after = FALSE; identify(NULL); + when '/' : after = FALSE; identify('\0'); when C_COUNT : count_gold(); when C_DIP : dip_it(); when C_DROP : player.t_action = C_DROP; drop((struct linked_list *)NULL); when C_EAT : eat(); - when C_QUAFF : quaff(-1, NULL, NULL, TRUE); - when C_READ : read_scroll(-1, NULL, TRUE); + when C_QUAFF : quaff(-1, 0, 0, TRUE); + when C_READ : read_scroll(-1, 0, TRUE); when C_SETTRAP : set_trap(&player, hero.y, hero.x); when C_SEARCH : if (player.t_action == A_NIL) { @@ -379,7 +388,7 @@ when C_USE : use_mm(-1); when C_WEAR : wear(); when C_WIELD : wield(); - when C_ZAP : if (!player_zap(NULL, FALSE)) after=FALSE; + when C_ZAP : if (!player_zap(0, FALSE)) after=FALSE; when C_CAST : cast(); when C_CHANT : chant(); when C_PRAY : pray(); @@ -638,7 +647,8 @@ * tell the player what is at a certain coordinates assuming * it can be seen. */ -display() +void +display(void) { coord c; struct linked_list *item; @@ -673,8 +683,7 @@ /*UNUSED*/ void -quit(sig) -int sig; +quit(int sig) { register int oy, ox; @@ -727,8 +736,8 @@ * killed by a program bug instead of voluntarily. */ -bugkill(sig) -int sig; +void +bugkill(int sig) { signal(sig, quit); /* If we get it again, give up */ if (levtype == OUTSIDE) { @@ -748,8 +757,8 @@ * Player gropes about him to find hidden things. */ -search(is_thief, door_chime) -register bool is_thief, door_chime; +void +search(bool is_thief, bool door_chime) { register int x, y; register char ch, /* The trap or door character */ @@ -861,7 +870,8 @@ * He wants to go down a level */ -d_level() +void +d_level(void) { bool no_phase=FALSE; char position = winat(hero.y, hero.x); @@ -962,7 +972,8 @@ * He wants to go up a level */ -u_level() +void +u_level(void) { bool no_phase = FALSE; register struct linked_list *item; @@ -1053,7 +1064,8 @@ * Let him escape for a while */ -shell() +void +shell(void) { /* * Set the terminal back to original mode @@ -1079,7 +1091,8 @@ /* * see what we want to name -- an item or a monster. */ -nameit() +void +nameit(void) { char answer; @@ -1103,9 +1116,8 @@ * allow a user to call a potion, scroll, or ring something */ -nameitem(item, mark) -struct linked_list *item; -bool mark; +void +nameitem(struct linked_list *item, bool mark) { register struct object *obj; register char **guess = NULL, *elsewise = NULL; @@ -1191,7 +1203,8 @@ /* Name a monster */ -namemonst() +void +namemonst(void) { register struct thing *tp; struct linked_list *item; @@ -1236,7 +1249,8 @@ msg("There is no monster there to name."); } -count_gold() +void +count_gold(void) { if (player.t_action != C_COUNT) { msg("You take a break to count your money.. "); @@ -1259,7 +1273,8 @@ * Teleport somewhere, anywhere... */ -do_teleport() +void +do_teleport(void) { int tlev; prbuf[0] = '\0'; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/daemon.c --- a/xrogue/daemon.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/daemon.c Wed Mar 02 21:13:26 2016 -0500 @@ -41,7 +41,7 @@ * Find an empty slot in the daemon list */ struct delayed_action * -d_slot() +d_slot(void) { reg int i; reg struct delayed_action *dev; @@ -57,7 +57,7 @@ * Find an empty slot in the fuses list */ struct delayed_action * -f_slot() +f_slot(void) { reg int i; reg struct delayed_action *dev; @@ -74,8 +74,7 @@ */ struct delayed_action * -find_slot(func) -reg int (*func)(); +find_slot(int (*func)()) { reg int i; reg struct delayed_action *dev; @@ -91,9 +90,8 @@ * Start a daemon, takes a function. */ -start_daemon(dfunc, arg, type) -reg VOID *arg; -reg int type, (*dfunc)(); +void +start_daemon(int (*dfunc)(), VOID *arg, int type) { reg struct delayed_action *dev; @@ -112,8 +110,8 @@ * Remove a daemon from the list */ -kill_daemon(dfunc) -reg int (*dfunc)(); +void +kill_daemon(int (*dfunc)()) { reg struct delayed_action *dev; reg int i; @@ -140,8 +138,8 @@ * passing the argument to the function. */ -do_daemons(flag) -reg int flag; +void +do_daemons(int flag) { struct delayed_action *dev; int i; @@ -165,9 +163,8 @@ * Start a fuse to go off in a certain number of turns */ -fuse(dfunc, arg, time, type) -VOID *arg; -reg int (*dfunc)(), time, type; +void +fuse(int (*dfunc)(), VOID *arg, int time, int type) { reg struct delayed_action *wire; @@ -186,8 +183,8 @@ * Increase the time until a fuse goes off */ -lengthen(dfunc, xtime) -reg int (*dfunc)(), xtime; +void +lengthen(int (*dfunc)(), int xtime) { reg struct delayed_action *wire; @@ -201,8 +198,8 @@ * Put out a fuse */ -extinguish(dfunc) -reg int (*dfunc)(); +void +extinguish(int (*dfunc)()) { reg struct delayed_action *wire; @@ -220,8 +217,8 @@ * Decrement counters and start needed fuses */ -do_fuses(flag) -reg int flag; +void +do_fuses(int flag) { struct delayed_action *wire; int i; @@ -250,7 +247,8 @@ * Show wizard number of demaons and memory blocks used */ -activity() +void +activity(void) { msg("Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", demoncnt,fusecnt,total,md_memused()); diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/daemons.c --- a/xrogue/daemons.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/daemons.c Wed Mar 02 21:13:26 2016 -0500 @@ -24,8 +24,8 @@ * A healing daemon that restors hit points after rest */ -doctor(tp) -register struct thing *tp; +void +doctor(struct thing *tp) { register int ohp; register int limit, new_points; @@ -111,7 +111,8 @@ * Called when it is time to start rolling for wandering monsters */ -swander() +void +swander(void) { start_daemon(rollwand, (VOID *)NULL, BEFORE); } @@ -123,7 +124,8 @@ int between = 0; -rollwand() +void +rollwand(void) { if (++between >= 4) @@ -145,7 +147,8 @@ * 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)) search(TRUE, FALSE); @@ -156,7 +159,8 @@ * Release the poor player from his confusion */ -unconfuse() +void +unconfuse(void) { turn_off(player, ISHUH); msg("You feel less confused now"); @@ -167,7 +171,8 @@ * He lost his see invisible power */ -unsee() +void +unsee(void) { if (!ISWEARING(R_SEEINVIS)) { turn_off(player, CANSEE); @@ -180,7 +185,8 @@ * Remove to-hit handicap from player */ -unstink() +void +unstink(void) { turn_off(player, HASSTINK); } @@ -190,7 +196,8 @@ * Player is no longer immune to confusion */ -unclrhead() +void +unclrhead(void) { turn_off(player, ISCLEAR); msg("The blue aura about your head fades away."); @@ -201,7 +208,8 @@ * Player can no longer walk through walls */ -unphase() +void +unphase(void) { turn_off(player, CANINWALL); msg("Your dizzy feeling leaves you."); @@ -215,7 +223,7 @@ */ int -land() +land(void) { turn_off(player, ISFLY); msg("You regain your normal weight"); @@ -228,7 +236,8 @@ * He gets his sight back */ -sight() +void +sight(void) { if (on(player, ISBLIND)) { @@ -245,8 +254,7 @@ */ int -res_strength(howmuch) -long howmuch; +res_strength(long howmuch) { /* If lost_str is non-zero, restore that amount of strength, @@ -271,7 +279,8 @@ * End the hasting */ -nohaste() +void +nohaste(void) { turn_off(player, ISHASTE); msg("You feel yourself slowing down."); @@ -282,7 +291,8 @@ * End the slowing */ -noslow() +void +noslow(void) { turn_off(player, ISSLOW); msg("You feel yourself speeding up."); @@ -293,7 +303,8 @@ * If this gets called, the player has suffocated */ -suffocate() +void +suffocate(void) { pstats.s_hpt = -1; death(D_SUFFOCATION); @@ -303,7 +314,8 @@ * digest the hero's food */ -stomach() +void +stomach(void) { register int oldfood, old_hunger, food_use, i; @@ -387,7 +399,8 @@ * daemon for curing the diseased */ -cure_disease() +void +cure_disease(void) { turn_off(player, HASDISEASE); if (off (player, HASINFEST)) @@ -400,7 +413,8 @@ * Become visible again */ -appear() +void +appear(void) { turn_off(player, ISINVIS); PLAYER = VPLAYER; @@ -413,7 +427,8 @@ * dust of disappearance wears off */ -dust_appear() +void +dust_appear(void) { turn_off(player, ISINVIS); PLAYER = VPLAYER; @@ -426,7 +441,8 @@ * the effects of "dust of choking and sneezing" wear off */ -unchoke() +void +unchoke(void) { if (!find_slot(unconfuse)) turn_off(player, ISHUH); @@ -440,8 +456,8 @@ * make some potion for the guy in the Alchemy jug */ -alchemy(obj) -register struct object *obj; +void +alchemy(struct object *obj) { register struct object *tobj = NULL; register struct linked_list *item; @@ -492,7 +508,7 @@ */ int -undance() +undance(void) { turn_off(player, ISDANCE); msg ("Your feet take a break.....whew!"); @@ -503,7 +519,8 @@ * if he has our favorite necklace of strangulation then take damage every turn */ -strangle() +void +strangle(void) { if ((pstats.s_hpt -= 6) <= 0) { pstats.s_hpt = -1; @@ -515,7 +532,8 @@ * if he has on the gauntlets of fumbling he might drop his weapon each turn */ -fumble() +void +fumble(void) { register struct linked_list *item; @@ -557,7 +575,8 @@ * it's a lot like trap_look() */ -ring_search() +void +ring_search(void) { if (rnd(75) < (2*dex_compute() + 5*pstats.s_lvl)) search(TRUE, FALSE); else search(FALSE, FALSE); @@ -567,7 +586,8 @@ * this is called each turn the hero has the ring of teleportation on */ -ring_teleport() +void +ring_teleport(void) { if (rnd(100) < 3) teleport(); } @@ -576,7 +596,8 @@ * this is called to charge up the quill of Nagrom */ -quill_charge() +void +quill_charge(void) { register struct object *tobj = NULL; register struct linked_list *item; @@ -601,7 +622,8 @@ * take the skills away gained (or lost) by the potion of skills */ -unskill() +void +unskill(void) { if (pstats.s_lvladj != 0) { pstats.s_lvl -= pstats.s_lvladj; @@ -616,8 +638,7 @@ */ int -cloak_charge(obj) -register struct object *obj; +cloak_charge(struct object *obj) { if (obj->o_charges < 1) obj->o_charges = 1; @@ -629,7 +650,8 @@ * He lost his fire resistance */ -nofire() +void +nofire(void) { if (!ISWEARING(R_FIRE)) { turn_off(player, NOFIRE); @@ -642,7 +664,8 @@ * He lost his cold resistance */ -nocold() +void +nocold(void) { if (!ISWEARING(R_WARMTH)) { turn_off(player, NOCOLD); @@ -655,7 +678,8 @@ * He lost his protection from lightning */ -nobolt() +void +nobolt(void) { turn_off(player, NOBOLT); msg("Your skin loses its bluish tint"); @@ -666,8 +690,8 @@ * an artifact eats gold */ -eat_gold(obj) -register struct object *obj; +void +eat_gold(struct object *obj) { if (purse == 250) msg("%s.. Bids you to find some more gold. ", inv_name(obj, FALSE)); @@ -691,7 +715,8 @@ * give the hero back some spell points */ -spell_recovery() +void +spell_recovery(void) { int time; @@ -705,7 +730,8 @@ * give the hero back some prayer points */ -prayer_recovery() +void +prayer_recovery(void) { int time; @@ -719,7 +745,8 @@ * give the hero back some chant points */ -chant_recovery() +void +chant_recovery(void) { int time; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/eat.c --- a/xrogue/eat.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/eat.c Wed Mar 02 21:13:26 2016 -0500 @@ -24,7 +24,8 @@ * He wants to eat something, so let him try */ -eat() +void +eat(void) { register struct linked_list *item; int which; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/effects.c --- a/xrogue/effects.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/effects.c Wed Mar 02 21:13:26 2016 -0500 @@ -26,11 +26,9 @@ * the reason code if the defender is killed. Otherwise return 0. */ -effect(att, def, weap, thrown, see_att, see_def) -register struct thing *att, *def; -struct object *weap; -bool thrown; -register bool see_att, see_def; +int +effect(struct thing *att, struct thing *def, struct object *weap, bool thrown, + bool see_att, bool see_def) { register bool att_player, def_player; char attname[LINELEN+1], defname[LINELEN+1]; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/encumb.c --- a/xrogue/encumb.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/encumb.c Wed Mar 02 21:13:26 2016 -0500 @@ -15,14 +15,15 @@ #include #include "rogue.h" +int packweight(struct thing *tp); + /* * updpack: * Update his pack weight and adjust fooduse accordingly */ -updpack(getmax, tp) -int getmax; -struct thing *tp; +void +updpack(int getmax, struct thing *tp) { reg int topcarry, curcarry; @@ -52,8 +53,8 @@ * Get the total weight of the hero's pack */ -packweight(tp) -register struct thing *tp; +int +packweight(struct thing *tp) { reg struct object *obj; reg struct linked_list *pc; @@ -89,8 +90,8 @@ * Get the weight of an object */ -itemweight(wh) -reg struct object *wh; +int +itemweight(struct object *wh) { reg int weight; reg int ac; @@ -120,8 +121,8 @@ * Get hero's carrying ability above norm */ -playenc(tp) -register struct thing *tp; +int +playenc(struct thing *tp) { register int strength; @@ -136,8 +137,8 @@ * Get total weight that the hero can carry */ -totalenc(tp) -register struct thing *tp; +int +totalenc(struct thing *tp) { reg int wtotal; @@ -157,11 +158,11 @@ * See if the hero can carry his pack */ -wghtchk() +void +wghtchk(void) { reg int dropchk, err = TRUE; reg char ch; - int wghtchk(); inwhgt = TRUE; if (pstats.s_pack > pstats.s_carry) { @@ -195,7 +196,8 @@ * -1 hit for heavy pack weight */ -hitweight() +int +hitweight(void) { return(2 - foodlev); } diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/fight.c --- a/xrogue/fight.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/fight.c Wed Mar 02 21:13:26 2016 -0500 @@ -19,6 +19,7 @@ #include #include #include +#include #include "rogue.h" #define CONF_DAMAGE -1 @@ -26,15 +27,23 @@ #define DEST_DAMAGE -3 #define DRAIN_DAMAGE -4 +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); + int killed_chance = 0; /* cumulative chance for goodies to loose it */ /* * returns true if player has a any chance to hit the monster */ -player_can_hit(tp, weap) -register struct thing *tp; -register struct object *weap; +bool +player_can_hit(struct thing *tp, struct object *weap) { if (off(*tp, CMAGICHIT) && off(*tp, BMAGICHIT) && off(*tp, MAGICHIT)) return(TRUE); @@ -62,10 +71,8 @@ * The player attacks the monster. */ -fight(mp, weap, thrown) -register coord *mp; -struct object *weap; -bool thrown; +bool +fight(coord *mp, struct object *weap, bool thrown) { register struct thing *tp; register struct linked_list *item; @@ -226,10 +233,8 @@ * The monster attacks the player */ -attack(mp, weapon, thrown) -register struct thing *mp; -register struct object *weapon; -bool thrown; +bool +attack(struct thing *mp, struct object *weapon, bool thrown) { register char *mname; register bool see_att, did_hit = FALSE; @@ -305,9 +310,8 @@ * returns true if the swing hits */ -swing(class, at_lvl, op_arm, wplus) -short class; -int at_lvl, op_arm, wplus; +bool +swing(short class, int at_lvl, int op_arm, int wplus) { register int res = rnd(20)+1; register int need; @@ -327,12 +331,9 @@ * Roll several attacks */ -roll_em(att_er, def_er, weap, hurl, cur_weapon, back_stab) -struct thing *att_er, *def_er; -struct object *weap; -bool hurl; -struct object *cur_weapon; -bool back_stab; +bool +roll_em(struct thing *att_er, struct thing *def_er, struct object *weap, + bool hurl, struct object *cur_weapon, bool back_stab) { register struct stats *att, *def; register char *cp = NULL; @@ -739,9 +740,7 @@ */ char * -prname(who, upper) -register char *who; -bool upper; +prname(char *who, bool upper) { static char tbuf[LINELEN]; @@ -766,11 +765,9 @@ * Print a message to indicate a succesful hit */ -hit(weapon, see_att, see_def, er, ee, back_stab, thrown, short_msg) -register struct object *weapon; -bool see_att, see_def; -register char *er, *ee; -bool back_stab, thrown, short_msg; +void +hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee, + bool back_stab, bool thrown, bool short_msg) { register char *s = NULL; char att_name[LINELEN], /* Name of attacker */ @@ -830,11 +827,9 @@ * Print a message to indicate a poor swing */ -miss(weapon, see_att, see_def, er, ee, thrown, short_msg) -register struct object *weapon; -bool see_att, see_def; -register char *er, *ee; -bool thrown, short_msg; +void +miss(struct object *weapon, bool see_att, bool see_def, char *er, char *ee, + bool thrown, bool short_msg) { register char *s = NULL; char att_name[LINELEN], /* Name of attacker */ @@ -874,8 +869,8 @@ * compute to-hit bonus for dexterity */ -dext_plus(dexterity) -register int dexterity; +int +dext_plus(int dexterity) { return (dexterity > 10 ? (dexterity-13)/3 : (dexterity-10)/3); } @@ -886,8 +881,8 @@ * compute armor class bonus for dexterity */ -dext_prot(dexterity) -register int dexterity; +int +dext_prot(int dexterity) { return ((dexterity-10)/2); } @@ -897,8 +892,8 @@ * compute bonus/penalties for strength on the "to hit" roll */ -str_plus(str) -register short str; +int +str_plus(short str) { return((str-10)/3); } @@ -908,8 +903,8 @@ * compute additional damage done for exceptionally high or low strength */ -add_dam(str) -register short str; +int +add_dam(short str) { return((str-9)/2); } @@ -919,7 +914,8 @@ * Calculate damage depending on players hungry state */ -hung_dam() +int +hung_dam(void) { reg int howmuch = 0; @@ -938,8 +934,8 @@ * Returns true if an object radiates magic */ -is_magic(obj) -register struct object *obj; +bool +is_magic(struct object *obj) { switch (obj->o_type) { @@ -963,9 +959,8 @@ * Called to put a monster to death */ -killed(item, pr, points, treasure) -register struct linked_list *item; -bool pr, points, treasure; +void +killed(struct linked_list *item, bool pr, bool points, bool treasure) { register struct thing *tp, *mp; register struct linked_list *pitem, *nexti, *mitem; @@ -1115,9 +1110,7 @@ */ struct linked_list * -wield_weap(thrown, mp) -struct object *thrown; -struct thing *mp; +wield_weap(struct object *thrown, struct thing *mp) { int look_for = 0, /* The projectile weapon we are looking for */ new_rate, /* The rating of a prospective weapon */ @@ -1198,8 +1191,9 @@ return(candidate); } -explode(tp) -register struct thing *tp; + +void +explode(struct thing *tp) { register int x,y, damage; @@ -1253,11 +1247,8 @@ * Called when one monster attacks another monster. */ -skirmish(attacker, mp, weap, thrown) -register struct thing *attacker; -register coord *mp; -struct object *weap; -bool thrown; +bool +skirmish(struct thing *attacker, coord *mp, struct object *weap, bool thrown) { register struct thing *defender; register struct linked_list *item; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/help.c --- a/xrogue/help.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/help.c Wed Mar 02 21:13:26 2016 -0500 @@ -299,7 +299,8 @@ 0, 0 }; -ident_hero() +void +ident_hero(void) { bool doit = TRUE; @@ -475,7 +476,8 @@ * Real Help */ -help() +void +help(void) { register struct h_list *strp = helpstr; register struct item_list *itemp = item_help; @@ -587,8 +589,8 @@ * Tell the player what a certain thing is. */ -identify(ch) -register unsigned char ch; +void +identify(unsigned char ch) { register char *str = NULL; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/init.c --- a/xrogue/init.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/init.c Wed Mar 02 21:13:26 2016 -0500 @@ -105,10 +105,8 @@ * right amounts */ -badcheck(name, magic, bound) -char *name; -register struct magic_item *magic; -register int bound; +void +badcheck(char *name, struct magic_item *magic, int bound) { register struct magic_item *end; @@ -128,7 +126,8 @@ * Initialize the potion color scheme for this time */ -init_colors() +void +init_colors(void) { register int i; register char *str; @@ -152,7 +151,8 @@ * do any initialization for food */ -init_foods() +void +init_foods(void) { register int i; @@ -168,7 +168,8 @@ * Initialize the construction materials for wands and staffs */ -init_materials() +void +init_materials(void) { register int i; register char *str; @@ -203,7 +204,8 @@ * do any initialization for miscellaneous magic */ -init_misc() +void +init_misc(void) { register int i; @@ -221,7 +223,8 @@ * Generate the names of the various scrolls */ -init_names() +void +init_names(void) { register int nsyl; register char *cp, *sp; @@ -258,7 +261,8 @@ * roll up the rogue */ -init_player() +void +init_player(void) { int stat_total, round = 0, minimum, maximum, ch, i, j = 0; short do_escape, *our_stats[NUMABILITIES-1]; @@ -790,7 +794,8 @@ * Initialize the ring stone setting scheme for this time */ -init_stones() +void +init_stones(void) { register int i; register char *str; @@ -815,7 +820,8 @@ * Initialize the probabilities for types of things */ -init_things() +void +init_things(void) { register struct magic_item *mp; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/io.c --- a/xrogue/io.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/io.c Wed Mar 02 21:13:26 2016 -0500 @@ -22,6 +22,8 @@ #include #include "rogue.h" +void doadd(char *fmt, va_list ap); + /* * msg: * Display a message at the top of the screen. @@ -77,7 +79,8 @@ * player with the --More-- string. Then erase the message. */ -rmmsg() +void +rmmsg(void) { if (mpos) { wclear(msgw); @@ -96,7 +99,8 @@ * is up there with the --More--) */ -endmsg() +void +endmsg(void) { /* Needed to track where we are for 5.0 (PC) curses */ register int x, y; @@ -141,6 +145,7 @@ draw(msgw); } +void doadd(char *fmt, va_list ap) { vsprintf((char *) &msgbuf[newpos], fmt, ap); @@ -153,9 +158,8 @@ * flgptr will be NULL if we don't know what the monster is yet! */ -step_ok(y, x, can_on_monst, flgptr) -register int y, x, can_on_monst; -register struct thing *flgptr; +bool +step_ok(int y, int x, int can_on_monst, struct thing *flgptr) { /* can_on_monst = MONSTOK if all we care about are physical obstacles */ register struct linked_list *item; @@ -222,6 +226,7 @@ * returns true if it is ok for type to shoot over ch */ +bool shoot_ok(int ch) { switch (ch) @@ -240,10 +245,11 @@ /* * status: * Display the important stats line. Keep the cursor where it was. + * display: is TRUE, display unconditionally */ -status(display) -bool display; /* is TRUE, display unconditionally */ +void +status(bool display) { register struct stats *stat_ptr, *max_ptr; register int oy = 0, ox = 0, temp; @@ -377,8 +383,8 @@ * Sit around until the guy types the right key */ -wait_for(ch) -register char ch; +void +wait_for(char ch) { register char c; @@ -407,10 +413,9 @@ * typed and then redraw the starting screen. */ -over_win(oldwin, newin, maxy, maxx, cursory, cursorx, redraw) -WINDOW *oldwin, *newin; -int maxy, maxx, cursory, cursorx; -char redraw; +void +over_win(WINDOW *oldwin, WINDOW *newin, int maxy, int maxx, int cursory, + int cursorx, char redraw) { char blanks[LINELEN+1]; register int line, i; @@ -460,9 +465,8 @@ * function used to display a window and wait before returning */ -show_win(scr, message) -register WINDOW *scr; -char *message; +void +show_win(WINDOW *scr, char *message) { mvwaddstr(scr, 0, 0, message); touchwin(scr); @@ -477,9 +481,8 @@ * Displays message on bottom line and waits for a space to return */ -dbotline(scr,message) -WINDOW *scr; -char *message; +void +dbotline(WINDOW *scr, char *message) { mvwaddstr(scr,lines-1,0,message); draw(scr); @@ -491,8 +494,8 @@ * Restores the screen to the terminal */ -restscr(scr) -WINDOW *scr; +void +restscr(WINDOW *scr) { clearok(scr,TRUE); touchwin(scr); @@ -506,10 +509,7 @@ */ unsigned long -netread(error, size, stream) -int *error; -int size; -FILE *stream; +netread(int *error, int size, FILE *stream) { unsigned long result = 0L, /* What we read in */ partial; /* Partial value */ @@ -542,12 +542,13 @@ /* * netwrite: * 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) -unsigned long value; /* What to write */ -int size; /* How much to write out */ -FILE *stream; /* Where to write it */ +int +netwrite(unsigned long value, int size, FILE *stream) { int i; /* Goes through value one byte at a time */ char outc; /* The next character to be written */ diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/list.c --- a/xrogue/list.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/list.c Wed Mar 02 21:13:26 2016 -0500 @@ -21,13 +21,16 @@ #include #include "rogue.h" +void r_discard(struct linked_list *item); +void t_discard(struct linked_list *item); + /* * detach: * Takes an item out of whatever linked list it might be in */ -_detach(list, item) -register struct linked_list **list, *item; +void +_detach(struct linked_list **list, struct linked_list *item) { if (*list == item) *list = next(item); @@ -42,8 +45,8 @@ * add an item to the head of a list */ -_attach(list, item) -register struct linked_list **list, *item; +void +_attach(struct linked_list **list, struct linked_list *item) { if (*list != NULL) { @@ -65,8 +68,8 @@ * Throw the whole object list away */ -_o_free_list(ptr) -register struct linked_list **ptr; +void +_o_free_list(struct linked_list **ptr) { register struct linked_list *item; @@ -83,8 +86,8 @@ * free up an item and its object(and maybe contents) */ -o_discard(item) -register struct linked_list *item; +void +o_discard(struct linked_list *item) { register struct object *obj; @@ -102,8 +105,8 @@ discard the item (monster) itself as that belong to mlist. */ -_r_free_fire_list(ptr) -register struct linked_list **ptr; +void +_r_free_fire_list(struct linked_list **ptr) { register struct linked_list *item; @@ -119,8 +122,8 @@ * Throw the whole list of room exits away */ -_r_free_list(ptr) -register struct linked_list **ptr; +void +_r_free_list(struct linked_list **ptr) { register struct linked_list *item; @@ -137,8 +140,8 @@ * free up an item and its room */ -r_discard(item) -register struct linked_list *item; +void +r_discard(struct linked_list *item) { total -= 2; FREE(DOORPTR(item)); @@ -150,8 +153,8 @@ * Throw the whole thing list away */ -_t_free_list(ptr) -register struct linked_list **ptr; +void +_t_free_list(struct linked_list **ptr) { register struct linked_list *item; @@ -168,8 +171,8 @@ * free up an item and its thing */ -t_discard(item) -register struct linked_list *item; +void +t_discard(struct linked_list *item) { register struct thing *tp; @@ -187,8 +190,8 @@ * get rid of an item structure -- don't worry about contents */ -destroy_item(item) -register struct linked_list *item; +void +destroy_item(struct linked_list *item) { total--; FREE(item); @@ -200,8 +203,7 @@ */ struct linked_list * -new_item(size) -int size; +new_item(int size) { register struct linked_list *item; @@ -220,7 +222,7 @@ */ struct linked_list * -creat_item() +creat_item(void) { register struct linked_list *item; @@ -231,8 +233,7 @@ } char * -new(size) -int size; +new(int size) { register char *space = ALLOC(size); diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/main.c --- a/xrogue/main.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/main.c Wed Mar 02 21:13:26 2016 -0500 @@ -27,10 +27,13 @@ #include "rogue.h" void open_records(void); +bool too_much(void); +bool author(void); +bool playtime(void); +bool betaover(void); -main(argc, argv, envp) -char **argv; -char **envp; +int +main(int argc, char *argv[], char *envp[]) { register char *env; time_t now; @@ -283,10 +286,8 @@ * Exit the program abnormally. */ -/*UNUSED*/ void -endit(sig) -int sig; +endit(int sig) { NOOP(sig); fatal("Ok, if you want to exit that badly, I'll have to allow it\n"); @@ -297,8 +298,8 @@ * Exit the program, printing a message. */ -fatal(s) -char *s; +void +fatal(char *s) { clear(); move(lines-2, 0); @@ -313,8 +314,8 @@ * Pick a very random number. */ -rnd(range) -register int range; +int +rnd(int range) { return( md_rand(range) ); } @@ -324,8 +325,8 @@ * roll a number of dice */ -roll(number, sides) -register int number, sides; +int +roll(int number, int sides) { register int dtotal = 0; @@ -334,7 +335,8 @@ return dtotal; } -setup() +void +setup(void) { md_setup(); } @@ -345,7 +347,8 @@ * refreshing things and looking at the proper times. */ -playit() +void +playit(void) { register char *opts; @@ -366,7 +369,8 @@ * see if the system is being used too much for this game */ -too_much() +bool +too_much(void) { /* we no longer do load checking or user counts */ return(FALSE); @@ -377,7 +381,8 @@ * See if a user is an author of the program */ -author() +bool +author(void) { switch (md_getuid()) { case 0: /* always OK for root to play */ @@ -392,7 +397,8 @@ * Returns TRUE when it is a good time to play rogue */ -playtime() +bool +playtime(void) { /* we no longer do playtime checking */ @@ -404,14 +410,15 @@ * Returns TRUE if the test period of this version of the game is over */ -betaover() +bool +betaover(void) { return(FALSE); } -exit_game(flag) -int flag; +void +exit_game(int flag) { int i; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/maze.c --- a/xrogue/maze.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/maze.c Wed Mar 02 21:13:26 2016 -0500 @@ -27,8 +27,11 @@ static char *maze_frontier, *maze_bits; static int maze_lines, maze_cols; -static char *moffset(), *foffset(); -static int rmwall(),findcells(),crankout(),draw_maze(); +static char *moffset(int y, int x); +static char *foffset(int y, int x); +static void rmwall(int newy, int newx, int oldy, int oldx); +static void draw_maze(void); +static int findcells(int y, int x); /* * crankout: @@ -36,7 +39,8 @@ */ static -crankout() +void +crankout(void) { reg int x, y; @@ -70,7 +74,8 @@ * Draw the maze on this level. */ -do_maze() +void +do_maze(void) { reg int least; reg struct room *rp; @@ -94,7 +99,7 @@ /* * 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->o_count *= (rnd(50) + 50); /* add in one large hunk */ attach(lvl_obj, item); @@ -107,7 +112,7 @@ /* * 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); attach(lvl_obj, item); do { @@ -146,7 +151,8 @@ */ static -draw_maze() +void +draw_maze(void) { reg int i, j, more; reg char *ptr; @@ -183,8 +189,8 @@ * Figure out cells to open up */ -static findcells(y,x) -reg int x, y; +static int +findcells(int y, int x) { reg int rtpos, i; @@ -236,8 +242,7 @@ */ static char * -foffset(y, x) -int y, x; +foffset(int y, int x) { return (maze_frontier + (y * maze_cols) + x); @@ -251,8 +256,7 @@ */ bool -maze_view(y, x) -int y, x; +maze_view(int y, int x) { register int start, goal, delta, ycheck = 0, xcheck = 0, absy, absx, see_radius; register bool row; @@ -360,8 +364,7 @@ */ static char * -moffset(y, x) -int y, x; +moffset(int y, int x) { return (maze_bits + (y * (cols - 1)) + x); } @@ -371,8 +374,8 @@ * Removes appropriate walls from the maze */ static -rmwall(newy, newx, oldy, oldx) -int newy, newx, oldy, oldx; +void +rmwall(int newy, int newx, int oldy, int oldx) { reg int xdif,ydif; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/misc.c --- a/xrogue/misc.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/misc.c Wed Mar 02 21:13:26 2016 -0500 @@ -23,8 +23,8 @@ * Change the player's class to the specified one. */ -changeclass(newclass) -long *newclass; +void +changeclass(long *newclass) { if (*newclass == player.t_ctype) { msg("You feel more skillful."); @@ -152,8 +152,8 @@ * Use the relic that our monster is wielding. */ -m_use_relic(monster) -register struct thing *monster; +void +m_use_relic(struct thing *monster) { register struct object *obj; @@ -181,7 +181,7 @@ } when EMORI_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; when ASMO_ROD: { @@ -248,11 +248,12 @@ /* * add something to the contents of something else + * bag: the holder of the items + * item: the item to put inside */ -put_contents(bag, item) -register struct object *bag; /* the holder of the items */ -register struct linked_list *item; /* the item to put inside */ +void +put_contents(struct object *bag, struct linked_list *item) { register struct linked_list *titem; register struct object *tobj; @@ -277,11 +278,11 @@ /* * remove something from something else + * bag: the holder of the items */ -take_contents(bag, item) -register struct object *bag; /* the holder of the items */ -register struct linked_list *item; +void +take_contents(struct object *bag, struct linked_list *item) { if (bag->o_ac <= 0) { @@ -295,8 +296,8 @@ } -do_bag(item) -register struct linked_list *item; +void +do_bag(struct linked_list *item) { register struct linked_list *titem = NULL; @@ -417,9 +418,10 @@ } } -do_panic(who) -int who; /* Kind of monster to panic (all if who is NULL) */ +void +do_panic(int who) { + /* who: kind of monster to panic (all if who is 0) */ register int x,y; register struct linked_list *mon, *item; register struct thing *th; @@ -485,9 +487,7 @@ */ int -misc_name(str,obj) -char *str; -register struct object *obj; +misc_name(char *str, struct object *obj) { char buf1[LINELEN]; @@ -565,7 +565,8 @@ return(0); } -use_emori() +void +use_emori(void) { char selection; /* Cloak function */ int state = 0; /* Menu state */ @@ -669,8 +670,8 @@ * try to write a scroll with the quill of Nagrom */ -use_quill(obj) -struct object *obj; +void +use_quill(struct object *obj) { struct linked_list *item; register int i, @@ -761,7 +762,7 @@ /* Should we overlay? */ if (menu_overlay && MAXQUILL + 3 < lines - 3) { - 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); } @@ -789,7 +790,7 @@ /* Should we overlay? */ if (menu_overlay && MAXQUILL + 3 < lines - 3) { over_win(cw, hw, MAXQUILL + 5, maxlen + 3, - 0, curlen, NULL); + 0, curlen, '\0'); } else draw(hw); @@ -830,8 +831,8 @@ * Use something */ -use_mm(which) -int which; +void +use_mm(int which) { register struct object *obj = NULL; register struct linked_list *item = NULL; @@ -907,7 +908,7 @@ when GERYON_HORN: /* Chase close monsters away */ msg("The horn blasts a shrill tone."); - do_panic(NULL); + do_panic(0); when EYE_VECNA: msg("The pain slowly subsides.. "); when HEIL_ANKH: @@ -934,7 +935,7 @@ msg("The jug is empty"); break; } - quaff (obj->o_ac, NULL, NULL, FALSE); + quaff (obj->o_ac, 0, 0, FALSE); obj->o_ac = JUG_EMPTY; fuse (alchemy, obj, ALCHEMYTIME, AFTER); if (!(obj->o_flags & ISKNOW)) @@ -1012,7 +1013,7 @@ break; } obj->o_charges--; - do_panic(NULL); + do_panic(0); return; /* * dust of disappearance makes the player invisible for a while @@ -1140,7 +1141,7 @@ str = "vibrates softly"; msg("You rub the crystal and it %s... ", str); /* cure him */ - read_scroll(S_CURING, NULL, FALSE); + read_scroll(S_CURING, 0, FALSE); /* give him weird hands */ turn_on(player, CANHUH); msg("Your fingertips turn blue. "); @@ -1218,8 +1219,7 @@ */ int -usage_time(item) -struct linked_list *item; +usage_time(struct linked_list *item) { register struct object *obj; register int units = -1; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/monsters.c --- a/xrogue/monsters.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/monsters.c Wed Mar 02 21:13:26 2016 -0500 @@ -19,14 +19,15 @@ #include #include #include +#include #include "rogue.h" /* * Check_residue takes care of any effect of the monster */ -check_residue(tp) -register struct thing *tp; +void +check_residue(struct thing *tp) { /* * Take care of special abilities @@ -70,13 +71,11 @@ /* * Creat_mons creates the specified monster -- any if 0 + * person: where to create next to */ bool -creat_mons(person, monster, report) -struct thing *person; /* Where to create next to */ -short monster; -bool report; +creat_mons(struct thing *person, short monster, bool report) { struct linked_list *nitem; register struct thing *tp; @@ -131,9 +130,7 @@ */ void -genmonsters(least, treas) -register int least; -bool treas; +genmonsters(int least, bool treas) { reg int i; reg struct room *rp = &rooms[0]; @@ -180,8 +177,7 @@ */ short -id_monst(monster) -register char monster; +id_monst(char monster) { register short result; @@ -215,11 +211,8 @@ * Pick a new monster and add it to the list */ -new_monster(item, type, cp, max_monster) -struct linked_list *item; -short type; -coord *cp; -bool max_monster; +void +new_monster(struct linked_list *item, short type, coord *cp, bool max_monster) { register struct thing *tp; register struct monster *mp; @@ -428,8 +421,7 @@ */ short -randmonster(wander, no_unique) -register bool wander, no_unique; +randmonster(bool wander, bool no_unique) { register int d, cur_level, range, i; @@ -491,8 +483,8 @@ * to purchase something. */ -sell(tp) -register struct thing *tp; +void +sell(struct thing *tp) { register struct linked_list *item, *seller; register struct linked_list *sellpack; @@ -588,8 +580,7 @@ */ struct linked_list * -wake_monster(y, x) -int y, x; +wake_monster(int y, int x) { register struct thing *tp; register struct linked_list *it; @@ -786,7 +777,8 @@ * A wandering monster has awakened and is headed for the player */ -wanderer() +void +wanderer(void) { register int i; register struct room *hr = roomin(&hero); diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/move.c --- a/xrogue/move.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/move.c Wed Mar 02 21:13:26 2016 -0500 @@ -18,6 +18,7 @@ #include #include +#include #include "rogue.h" /* @@ -37,9 +38,8 @@ * The guy stepped on a trap.... Make him pay. */ -be_trapped(th, tc) -register struct thing *th; -register coord *tc; +char +be_trapped(struct thing *th, coord *tc) { register struct trap *tp; register char ch, *mname = NULL; @@ -504,8 +504,7 @@ */ bool -blue_light(blessed, cursed) -bool blessed, cursed; +blue_light(bool blessed, bool cursed) { register struct room *rp; bool ret_val=FALSE; /* Whether or not affect is known */ @@ -563,8 +562,8 @@ * If not, if player came from a legal place, then try to turn him. */ -corr_move(dy, dx) -int dy, dx; +void +corr_move(int dy, int dx) { int legal=0; /* Number of legal alternatives */ register int y, x, /* Indexes though possible positions */ @@ -642,7 +641,8 @@ * Dip an object into a magic pool */ -dip_it() +void +dip_it(void) { reg struct linked_list *what; reg struct object *ob; @@ -839,8 +839,8 @@ * consequences (fighting, picking up, etc.) */ -do_move(dy, dx) -int dy, dx; +void +do_move(int dy, int dx) { register struct room *rp, *orp; register unsigned char ch; @@ -1189,8 +1189,8 @@ * Start the hero running */ -do_run(ch) -char ch; +void +do_run(char ch) { firstmove = TRUE; running = TRUE; @@ -1206,9 +1206,7 @@ */ bool -getdelta(match, dy, dx) -char match; -int *dy, *dx; +getdelta(char match, int *dy, int *dx) { register int y, x; @@ -1228,8 +1226,8 @@ * Returns TRUE if this character is some kind of trap */ -isatrap(ch) -reg char ch; +bool +isatrap(char ch) { switch(ch) { case WORMHOLE: @@ -1250,8 +1248,8 @@ * If it is dark, remove anything that might move. */ -light(cp) -coord *cp; +void +light(coord *cp) { register struct room *rp; register int j, k, x, y; @@ -1428,8 +1426,7 @@ */ bool -lit_room(rp) -register struct room *rp; +lit_room(struct room *rp) { register struct linked_list *fire_item; register struct thing *fire_creature; @@ -1466,8 +1463,7 @@ */ short -movement(tp) -register struct thing *tp; +movement(struct thing *tp) { register int result; register int carry; /* Percentage carried */ @@ -1531,8 +1527,7 @@ */ coord -rndmove(who) -struct thing *who; +rndmove(struct thing *who) { register int x, y; register int ex, ey, nopen = 0; @@ -1586,9 +1581,8 @@ * set a trap at (y, x) on screen. */ -set_trap(tp, y, x) -register struct thing *tp; -register int y, x; +void +set_trap(struct thing *tp, int y, int x) { register bool is_player = (tp == &player); register int selection = rnd(TRAPTYPES-WIZARDTRAPS) + '1'; @@ -1645,7 +1639,7 @@ * Put out the selection. The longest line is * 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 draw(hw); state = 1; /* Now in prompt window */ @@ -1705,7 +1699,7 @@ * Put out the selection. The longest line is * 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 draw(hw); } @@ -1778,8 +1772,8 @@ * returns what a certain thing will display as to the un-initiated */ -show(y, x) -register int y, x; +char +show(int y, int x) { register unsigned char ch = winat(y, x); register struct linked_list *it; @@ -1819,8 +1813,7 @@ */ struct trap * -trap_at(y, x) -register int y, x; +trap_at(int y, int x) { register struct trap *tp, *ep; @@ -1838,11 +1831,12 @@ * Calculate how many segments it will take to swing the given * weapon (note that the weapon may actually be a stick or * even something else). + * wielder: Who's wielding the weapon + * weap: The weapon */ -weap_move(wielder, weap) -register struct thing *wielder; /* Who's wielding the weapon */ -register struct object *weap; /* The weapon */ +int +weap_move(struct thing *wielder, struct object *weap) { register int weap_rate; int dexterity; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/n_level.c --- a/xrogue/n_level.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/n_level.c Wed Mar 02 21:13:26 2016 -0500 @@ -20,13 +20,16 @@ #include "rogue.h" #define TERRASAVE 3 +void put_things(LEVTYPE ltype); + /* * new_level: * Dig and draw a new level + * ltype: designates type of level to create */ -new_level(ltype) -LEVTYPE ltype; /* designates type of level to create */ +void +new_level(LEVTYPE ltype) { register int rm = 0, i, cnt; register unsigned char ch; @@ -464,14 +467,15 @@ /* Do we sense any food on this level? */ if (cur_relic[SURTUR_RING]) - quaff(P_FFIND, NULL, NULL, FALSE); + quaff(P_FFIND, 0, 0, FALSE); } /* * Pick a room that is really there */ -rnd_room() +int +rnd_room(void) { register int rm; @@ -487,10 +491,11 @@ /* * put_things: * put potions and scrolls on this level + * ltype: designates type of level to create */ -put_things(ltype) -LEVTYPE ltype; /* designates type of level to create */ +void +put_things(LEVTYPE ltype) { register int i, rm, cnt; register struct object *cur; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/network.h --- a/xrogue/network.h Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/network.h Wed Mar 02 21:13:26 2016 -0500 @@ -30,6 +30,6 @@ char *rogue; }; extern struct network Network[]; -extern unsigned long netread(); -extern unsigned long netwrite(); +extern unsigned long netread(int *error, int size, FILE *stream); +extern int netwrite(unsigned long value, int size, FILE *stream); diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/options.c --- a/xrogue/options.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/options.c Wed Mar 02 21:13:26 2016 -0500 @@ -41,16 +41,16 @@ typedef struct optstruct OPTION; -int put_bool(), - get_bool(), - put_str(), - get_str(), - put_abil(), - get_abil(), - get_quest(), - put_quest(), - get_default(); - +int get_ro(WINDOW *win, int oy, int ox); +void put_bool(bool *b, WINDOW *win); +int get_bool(bool *bp, WINDOW *win); +void put_str(char *str, WINDOW *win); +int get_str(char *opt, WINDOW *win); +void put_abil(int *ability, WINDOW *win); +void get_abil(int *abil, WINDOW *win); +void put_quest(int *quest, WINDOW *win); +void get_quest(int *quest, WINDOW *win); +void get_default(bool *bp, WINDOW *win); int get_str_prot(char *opt, WINDOW *win); int get_score(char *opt, WINDOW *win); bool allowchange(OPTION *op); @@ -88,9 +88,8 @@ * The default attribute field is read-only */ -get_default(bp, win) -bool *bp; -WINDOW *win; +void +get_default(bool *bp, WINDOW *win) { register int oy, ox; @@ -103,9 +102,8 @@ * The ability (class) field is read-only */ -get_abil(abil, win) -int *abil; -WINDOW *win; +void +get_abil(int *abil, WINDOW *win) { register int oy, ox; @@ -118,9 +116,8 @@ * The quest field is read-only */ -get_quest(quest, win) -int *quest; -WINDOW *win; +void +get_quest(int *quest, WINDOW *win) { register int oy, ox; @@ -134,9 +131,8 @@ * "Get" a read-only value. */ -get_ro(win, oy, ox) -WINDOW *win; -register int oy, ox; +int +get_ro(WINDOW *win, int oy, int ox) { register int ny, nx; register bool op_bad; @@ -173,9 +169,8 @@ * allow changing a boolean option and print it out */ -get_bool(bp, win) -bool *bp; -WINDOW *win; +int +get_bool(bool *bp, WINDOW *win) { register int oy, ox; register bool op_bad; @@ -223,9 +218,8 @@ * set a string option */ -get_str(opt, win) -register char *opt; -WINDOW *win; +int +get_str(char *opt, WINDOW *win) { register char *sp; register int c, oy, ox; @@ -298,7 +292,8 @@ * print and then set options from the terminal */ -option() +void +option(void) { register OPTION *op; register int retval; @@ -356,8 +351,8 @@ * or the end of the entire option string. */ -parse_opts(str) -register char *str; +void +parse_opts(char *str) { register char *sp; register OPTION *op; @@ -466,9 +461,8 @@ * print the character type */ -put_abil(ability, win) -int *ability; -WINDOW *win; +void +put_abil(int *ability, WINDOW *win) { waddstr(win, char_class[*ability].name); } @@ -477,9 +471,8 @@ * print out the quest */ -put_quest(quest, win) -int *quest; -WINDOW *win; +void +put_quest(int *quest, WINDOW *win) { waddstr(win, rel_magic[*quest].mi_name); } @@ -488,9 +481,8 @@ * put out a boolean */ -put_bool(b, win) -bool *b; -WINDOW *win; +void +put_bool(bool *b, WINDOW *win) { waddstr(win, *b ? "True" : "False"); } @@ -499,9 +491,8 @@ * put out a string */ -put_str(str, win) -char *str; -WINDOW *win; +void +put_str(char *str, WINDOW *win) { waddstr(win, str); } diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/outside.c --- a/xrogue/outside.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/outside.c Wed Mar 02 21:13:26 2016 -0500 @@ -15,7 +15,8 @@ #include #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: @@ -23,7 +24,7 @@ */ void -init_terrain() +init_terrain(void) { register struct room *rp; @@ -40,9 +41,7 @@ } void -do_terrain(basey, basex, deltay, deltax, fresh) -int basey, basex, deltay, deltax; -bool fresh; +do_terrain(int basey, int basex, int deltay, int deltax, bool fresh) { register int cury, curx; /* Current y and x positions */ @@ -140,7 +139,7 @@ */ char -rnd_terrain() +rnd_terrain(void) { int chance = rnd(100); @@ -164,8 +163,7 @@ */ char -get_terrain(one, two, three, four) -char one, two, three, four; +get_terrain(char one, char two, char three, char four) { register int i; int forest = 0, mountain = 0, lake = 0, meadow = 0, total = 0; diff -r f9ef86cf22b2 -r f54901b9c39b xrogue/pack.c --- a/xrogue/pack.c Fri Feb 19 21:02:28 2016 -0500 +++ b/xrogue/pack.c Wed Mar 02 21:13:26 2016 -0500 @@ -21,6 +21,8 @@ #include #include "rogue.h" +bool is_type(struct object *obj, int type); + /* * add_pack: * Pick up an object and add it to the pack. If the argument is non-null @@ -28,9 +30,7 @@ */ bool -add_pack(item, silent) -register struct linked_list *item; -bool silent; +add_pack(struct linked_list *item, bool silent) { register struct linked_list *ip, *lp = NULL, *ap; register struct object *obj, *op = NULL; @@ -462,9 +462,8 @@ * list what is in the pack */ -inventory(list, type) -register struct linked_list *list; -register int type; +bool +inventory(struct linked_list *list, int type) { register struct object *obj; register char ch; @@ -563,7 +562,7 @@ */ void -picky_inven() +picky_inven(void) { register struct linked_list *item; register char ch, mch; @@ -616,14 +615,12 @@ /* * get_item: * pick something out of a pack for a purpose + * purpose: NULL if we should be silent (no prompts) */ struct linked_list * -get_item(list, purpose, type, askfirst, showcost) -reg struct linked_list *list; -char *purpose; /* NULL if we should be silent (no prompts) */ -int type; -bool askfirst, showcost; +get_item(struct linked_list *list, char *purpose, int type, bool askfirst, + bool showcost) { reg struct linked_list *item; reg struct object *obj; @@ -755,7 +752,7 @@ /* Write the screen */ if ((menu_overlay && cnt < lines - 3) || 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 */ } else draw(hw); @@ -814,9 +811,8 @@ } } -pack_char(list, obj) -register struct object *obj; -struct linked_list *list; +char +pack_char(struct linked_list *list, struct object *obj) { register struct linked_list *item; register char c; @@ -838,8 +834,8 @@ * This updates cur_weapon etc for dropping things */ -cur_null(op) -reg struct object *op; +void +cur_null(struct object *op) { if (op == cur_weapon) cur_weapon = NULL; else if (op == cur_armor) cur_armor = NULL; @@ -864,7 +860,8 @@ * Identify all the items in the pack