# HG changeset patch # User John "Elwin" Edwards # Date 1455933748 18000 # Node ID f9ef86cf22b2ba32d379afa3c16c92cbcc1b46f1 # Parent 56e748983fa8affc0aa3aa415a48904c473189c5 Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default. diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/actions.c --- a/arogue7/actions.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/actions.c Fri Feb 19 21:02:28 2016 -0500 @@ -18,12 +18,21 @@ #include "rogue.h" #define MAXINT INT_MAX #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? */ -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: @@ -52,7 +61,8 @@ } } -dsrpt_player() +void +dsrpt_player(void) { int which, action; struct linked_list *item; @@ -81,7 +91,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(10)+1); purse -= obj->o_count; @@ -120,8 +130,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? */ @@ -235,8 +245,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 = ""; @@ -344,11 +354,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 = MININT; @@ -486,8 +496,8 @@ * The monster is sounding a sonic blast. */ -m_sonic(tp) -register struct thing *tp; +void +m_sonic(struct thing *tp) { register int damage; static struct object blast = @@ -515,8 +525,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) { static struct object missile = { @@ -538,8 +548,8 @@ * Summon aid. */ -m_summon(tp) -register struct thing *tp; +void +m_summon(struct thing *tp) { register char *helpname, *mname; int fail, numsum; @@ -612,10 +622,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; @@ -777,14 +784,15 @@ /* * 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; - 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 @@ -870,11 +878,8 @@ * Only care about relics and wands for now. */ bool -m_use_pack(monster, monst_pos, defend_pos, dist, shoot_dir) -register struct thing *monster; -register coord *monst_pos, *defend_pos; -register int dist; -register coord *shoot_dir; +m_use_pack(struct thing *monster, coord *monst_pos, coord *defend_pos, + int dist, coord *shoot_dir) { register struct object *obj; register struct linked_list *pitem, *relic, *stick; diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/chase.c --- a/arogue7/chase.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/chase.c Fri Feb 19 21:02:28 2016 -0500 @@ -19,11 +19,13 @@ #include #include +#include #include "curses.h" #include "rogue.h" #define MAXINT INT_MAX #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 @@ -31,8 +33,7 @@ */ 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 */ @@ -127,8 +128,7 @@ */ coord * -can_shoot(er, ee) -register coord *er, *ee; +can_shoot(coord *er, coord *ee) { static coord shoot_dir; @@ -147,16 +147,14 @@ * chase: * 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). + * 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) -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 = MAXINT; register coord *er = &tp->t_pos; @@ -494,8 +492,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 */ @@ -803,8 +801,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; @@ -851,9 +848,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; @@ -881,9 +877,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 */ char ch; diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/command.c --- a/arogue7/command.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/command.c Fri Feb 19 21:02:28 2016 -0500 @@ -29,12 +29,23 @@ extern struct uwdata wdata; #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: * Process the user commands */ -command() +void +command(void) { unsigned char ch; struct linked_list *item; @@ -267,8 +278,8 @@ after = FALSE; } when C_COUNT : count_gold(); - 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_EAT : eat(); when C_WIELD : wield(); when C_WEAR : wear(); @@ -280,7 +291,7 @@ when '>' : after = FALSE; d_level(); when '<' : after = FALSE; u_level(); when '?' : after = FALSE; help(); - when '/' : after = FALSE; identify(NULL); + when '/' : after = FALSE; identify(0); when C_USE : use_mm(-1); when CTRL('T') : if (player.t_action == A_NIL) { @@ -315,7 +326,7 @@ search(FALSE, FALSE); player.t_action = A_NIL; } - when C_ZAP : if (!player_zap(NULL, FALSE)) + when C_ZAP : if (!player_zap(0, FALSE)) after=FALSE; when C_PRAY : pray(); when C_CHANT : chant(); @@ -553,7 +564,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; @@ -587,8 +599,7 @@ */ void -quit(sig) -int sig; +quit(int sig) { /* * Reset the signal in case we got here via an interrupt @@ -628,8 +639,7 @@ */ void -bugkill(sig) -int sig; +bugkill(int sig) { signal(sig, quit); /* If we get it again, give up */ death(D_SIGNAL); /* Killed by a bug */ @@ -641,8 +651,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 */ @@ -752,7 +762,8 @@ * Give single character help, or the whole mess if he wants it */ -help() +void +help(void) { register struct h_list *strp = helpstr; #ifdef WIZARD @@ -844,8 +855,8 @@ * Tell the player what a certain thing is. */ -identify(ch) -register char ch; +void +identify(char ch) { register char *str; @@ -907,6 +918,7 @@ * He wants to go down a level */ +void d_level() { bool no_phase=FALSE; @@ -958,7 +970,8 @@ * He wants to go up a level */ -u_level() +void +u_level(void) { bool no_phase = FALSE; register struct linked_list *item; @@ -1016,7 +1029,8 @@ * Let him escape for a while */ -shell() +void +shell(void) { register char *sh; @@ -1050,7 +1064,8 @@ /* * see what we want to name -- an item or a monster. */ -nameit() +void +nameit(void) { char answer; @@ -1073,9 +1088,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; @@ -1161,7 +1175,8 @@ /* Name a monster */ -namemonst() +void +namemonst(void) { register struct thing *tp; struct linked_list *item; @@ -1206,7 +1221,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..."); diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/daemon.c --- a/arogue7/daemon.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/daemon.c Fri Feb 19 21:02:28 2016 -0500 @@ -44,7 +44,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; @@ -60,7 +60,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; @@ -78,8 +78,7 @@ * Find a particular slot in the table */ struct delayed_action * -find_slot(func) -reg int (*func)(); +find_slot(int (*func)()) { reg int i; reg struct delayed_action *dev; @@ -95,8 +94,8 @@ * start_daemon: * Start a daemon, takes a function. */ -start_daemon(func, arg, type) -reg int arg, type, (*func)(); +void +start_daemon(int (*func)(), int arg, int type) { reg struct delayed_action *dev; @@ -115,8 +114,8 @@ * kill_daemon: * Remove a daemon from the list */ -kill_daemon(func) -reg int (*func)(); +void +kill_daemon(int (*func)()) { reg struct delayed_action *dev; reg int i; @@ -142,8 +141,8 @@ * Run all the daemons that are active with the current flag, * passing the argument to the function. */ -do_daemons(flag) -reg int flag; +void +do_daemons(int flag) { reg struct delayed_action *dev; @@ -163,8 +162,8 @@ * fuse: * Start a fuse to go off in a certain number of turns */ -fuse(func, arg, time, type) -reg int (*func)(), arg, time, type; +void +fuse(int (*func)(), int arg, int time, int type) { reg struct delayed_action *wire; @@ -183,8 +182,8 @@ * lengthen: * Increase the time until a fuse goes off */ -lengthen(func, xtime) -reg int (*func)(), xtime; +void +lengthen(int (*func)(), int xtime) { reg struct delayed_action *wire; @@ -198,8 +197,8 @@ * extinguish: * Put out a fuse */ -extinguish(func) -reg int (*func)(); +void +extinguish(int (*func)()) { reg struct delayed_action *wire; @@ -217,8 +216,8 @@ * do_fuses: * Decrement counters and start needed fuses */ -do_fuses(flag) -reg int flag; +void +do_fuses(int flag) { reg struct delayed_action *wire; @@ -245,8 +244,9 @@ * activity: * 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(0)); + demoncnt,fusecnt,total,md_memused()); } diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/daemons.c --- a/arogue7/daemons.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/daemons.c Fri Feb 19 21:02:28 2016 -0500 @@ -25,8 +25,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; @@ -108,7 +108,8 @@ * Called when it is time to start rolling for wandering monsters */ -swander() +void +swander(void) { start_daemon(rollwand, 0, BEFORE); } @@ -120,7 +121,8 @@ int between = 0; -rollwand() +void +rollwand(void) { if (++between >= 4) @@ -140,7 +142,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); @@ -151,7 +154,8 @@ * Release the poor player from his confusion */ -unconfuse() +void +unconfuse(void) { turn_off(player, ISHUH); msg("You feel less confused now"); @@ -162,7 +166,8 @@ * unsee: * He lost his see invisible power */ -unsee() +void +unsee(void) { if (!ISWEARING(R_SEEINVIS)) { turn_off(player, CANSEE); @@ -175,7 +180,8 @@ * Remove to-hit handicap from player */ -unstink() +void +unstink(void) { turn_off(player, HASSTINK); } @@ -185,7 +191,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."); @@ -196,7 +203,8 @@ * Player can no longer walk through walls */ -unphase() +void +unphase(void) { turn_off(player, CANINWALL); msg("Your dizzy feeling leaves you."); @@ -208,7 +216,8 @@ * Player can no longer fly */ -land() +void +land(void) { turn_off(player, ISFLY); msg("You regain your normal weight"); @@ -220,7 +229,8 @@ * He gets his sight back */ -sight() +void +sight(void) { if (on(player, ISBLIND)) { @@ -237,8 +247,7 @@ */ void -res_strength(howmuch) -int howmuch; +res_strength(int howmuch) { /* If lost_str is non-zero, restore that amount of strength, @@ -262,7 +271,8 @@ * End the hasting */ -nohaste() +void +nohaste(void) { turn_off(player, ISHASTE); msg("You feel yourself slowing down."); @@ -273,7 +283,8 @@ * End the slowing */ -noslow() +void +noslow(void) { turn_off(player, ISSLOW); msg("You feel yourself speeding up."); @@ -284,7 +295,8 @@ * If this gets called, the player has suffocated */ -suffocate() +void +suffocate(void) { death(D_SUFFOCATION); } @@ -292,7 +304,8 @@ /* * digest the hero's food */ -stomach() +void +stomach(void) { register int oldfood, old_hunger, food_use, i; @@ -368,7 +381,8 @@ /* * daemon for curing the diseased */ -cure_disease() +void +cure_disease(void) { turn_off(player, HASDISEASE); if (off (player, HASINFEST)) @@ -380,7 +394,8 @@ * appear: * Become visible again */ -appear() +void +appear(void) { turn_off(player, ISINVIS); PLAYER = VPLAYER; @@ -391,7 +406,8 @@ * dust_appear: * dust of disappearance wears off */ -dust_appear() +void +dust_appear(void) { turn_off(player, ISINVIS); PLAYER = VPLAYER; @@ -402,7 +418,8 @@ * unchoke: * the effects of "dust of choking and sneezing" wear off */ -unchoke() +void +unchoke(void) { if (!find_slot(unconfuse)) turn_off(player, ISHUH); @@ -414,8 +431,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; @@ -464,7 +481,8 @@ * otto's irresistable dance wears off */ -undance() +void +undance(void) { turn_off(player, ISDANCE); msg ("Your feet take a break.....whew!"); @@ -473,14 +491,16 @@ /* * 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 he has on the gauntlets of fumbling he might drop his weapon each turn */ -fumble() +void +fumble(void) { register struct linked_list *item; @@ -519,21 +539,24 @@ /* * this is called each turn the hero has the ring of searching on */ -ring_search() +void +ring_search(void) { search(FALSE, FALSE); } /* * this is called each turn the hero has the ring of teleportation on */ -ring_teleport() +void +ring_teleport(void) { if (rnd(100) < 2) teleport(); } /* * 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; @@ -556,7 +579,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; @@ -569,8 +593,8 @@ * charge up the cloak of Emori */ -cloak_charge(obj) -register struct object *obj; +void +cloak_charge(struct object *obj) { if (obj->o_charges < 1) obj->o_charges = 1; @@ -580,7 +604,8 @@ * nofire: * He lost his fire resistance */ -nofire() +void +nofire(void) { if (!ISWEARING(R_FIRE)) { turn_off(player, NOFIRE); @@ -592,7 +617,8 @@ * nocold: * He lost his cold resistance */ -nocold() +void +nocold(void) { if (!ISWEARING(R_WARMTH)) { turn_off(player, NOCOLD); @@ -604,7 +630,8 @@ * nobolt: * He lost his protection from lightning */ -nobolt() +void +nobolt(void) { turn_off(player, NOBOLT); msg("Your skin looses its bluish tint"); @@ -613,8 +640,8 @@ * eat_gold: * an artifact eats gold */ -eat_gold(obj) -register struct object *obj; +void +eat_gold(struct object *obj) { if (purse == 1) msg("%s demand you find more gold", inv_name(obj, FALSE)); @@ -628,36 +655,39 @@ /* * give the hero back some spell points */ -spell_recovery() +void +spell_recovery(void) { int time; time = SPELLTIME - max(17-pstats.s_intel, 0); time = max(time, 5); 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 */ -prayer_recovery() +void +prayer_recovery(void) { int time; time = SPELLTIME - max(17-pstats.s_wisdom, 0); time = max(time, 5); 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 */ -chant_recovery() +void +chant_recovery(void) { int time; time = SPELLTIME - max(17-pstats.s_wisdom, 0); time = max(time, 5); if (chant_time > 0) chant_time--; - fuse(chant_recovery, NULL, time, AFTER); + fuse(chant_recovery, 0, time, AFTER); } diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/eat.c --- a/arogue7/eat.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/eat.c Fri Feb 19 21:02:28 2016 -0500 @@ -20,7 +20,8 @@ * He wants to eat something, so let him try */ -eat() +void +eat(void) { register struct linked_list *item; int which; diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/effects.c --- a/arogue7/effects.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/effects.c Fri Feb 19 21:02:28 2016 -0500 @@ -21,11 +21,9 @@ * Check for effects of one thing hitting another thing. Return * 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 56e748983fa8 -r f9ef86cf22b2 arogue7/encumb.c --- a/arogue7/encumb.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/encumb.c Fri Feb 19 21:02:28 2016 -0500 @@ -20,13 +20,14 @@ #include "curses.h" #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; @@ -55,8 +56,8 @@ * packweight: * 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; @@ -92,8 +93,8 @@ * itemweight: * Get the weight of an object */ -itemweight(wh) -reg struct object *wh; +int +itemweight(struct object *wh) { reg int weight; reg int ac; @@ -123,8 +124,8 @@ * playenc: * Get hero's carrying ability above norm */ -playenc(tp) -register struct thing *tp; +int +playenc(struct thing *tp) { register int strength; @@ -139,8 +140,8 @@ * totalenc: * Get total weight that the hero can carry */ -totalenc(tp) -register struct thing *tp; +int +totalenc(struct thing *tp) { reg int wtotal; @@ -162,11 +163,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) { @@ -201,7 +202,8 @@ * -1 hit for heavy pack weight */ -hitweight() +int +hitweight(void) { return(2 - foodlev); } diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/fight.c --- a/arogue7/fight.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/fight.c Fri Feb 19 21:02:28 2016 -0500 @@ -20,9 +20,18 @@ #include "curses.h" #include #include +#include #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 PARAL_DAMAGE -2 #define DEST_DAMAGE -3 @@ -31,9 +40,8 @@ /* * 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); @@ -61,10 +69,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; @@ -225,10 +231,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; @@ -301,9 +305,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; @@ -323,12 +326,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; @@ -700,9 +700,7 @@ */ char * -prname(who, upper) -register char *who; -bool upper; +prname(char *who, bool upper) { static char tbuf[LINELEN]; @@ -727,11 +725,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 = ""; char att_name[LINELEN], /* Name of attacker */ @@ -791,11 +787,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 = ""; char @@ -836,8 +830,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); } @@ -848,8 +842,8 @@ * compute armor class bonus for dexterity */ -dext_prot(dexterity) -register int dexterity; +int +dext_prot(int dexterity) { return ((dexterity-10)/2); } @@ -858,8 +852,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); } @@ -869,8 +863,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); } @@ -879,7 +873,8 @@ * hung_dam: * Calculate damage depending on players hungry state */ -hung_dam() +int +hung_dam(void) { reg int howmuch; @@ -897,12 +892,11 @@ /* * thunk: * A missile hits a monster + * tp: defender */ -thunk(weap, tp, mname) -register struct object *weap; -register struct thing *tp; /* Defender */ -register char *mname; +void +thunk(struct object *weap, struct thing *tp, char *mname) { char *def_name; /* Name of defender */ @@ -924,10 +918,8 @@ * A missile from a monster hits the player */ -m_thunk(weap, tp, mname) -register struct object *weap; -register struct thing *tp; -register char *mname; +void +m_thunk(struct object *weap, struct thing *tp, char *mname) { char *att_name; /* Name of attacker */ @@ -947,12 +939,11 @@ /* * bounce: * A missile misses a monster + * tp: defender */ -bounce(weap, tp, mname) -register struct object *weap; -register struct thing *tp; /* Defender */ -register char *mname; +void +bounce(struct object *weap, struct thing *tp, char *mname) { char *def_name; /* Name of defender */ @@ -974,10 +965,8 @@ * A missle from a monster misses the player */ -m_bounce(weap, tp, mname) -register struct object *weap; -register struct thing *tp; -register char *mname; +void +m_bounce(struct object *weap, struct thing *tp, char *mname) { char *att_name; /* Name of attacker */ @@ -1001,8 +990,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) { @@ -1028,9 +1017,8 @@ int chance = 0;/* cumulative chance for goodies to loose it */ -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; @@ -1137,9 +1125,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, /* The projectile weapon we are looking for */ new_rate, /* The rating of a prospective weapon */ @@ -1220,8 +1206,9 @@ return(candidate); } -explode(tp) -register struct thing *tp; + +void +explode(struct thing *tp) { register int x,y, damage; @@ -1275,11 +1262,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 56e748983fa8 -r f9ef86cf22b2 arogue7/init.c --- a/arogue7/init.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/init.c Fri Feb 19 21:02:28 2016 -0500 @@ -117,10 +117,8 @@ * make sure all the percentages specified in the tables add up to the * 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; @@ -140,7 +138,8 @@ * Initialize the potion color scheme for this time */ -init_colors() +void +init_colors(void) { register int i, j; @@ -166,7 +165,8 @@ * do any initialization for food */ -init_foods() +void +init_foods(void) { register int i; @@ -182,7 +182,8 @@ * Initialize the construction materials for wands and staffs */ -init_materials() +void +init_materials(void) { register int i, j; register char *str; @@ -232,7 +233,8 @@ * do any initialization for miscellaneous magic */ -init_misc() +void +init_misc(void) { register int i; @@ -250,7 +252,8 @@ * Generate the names of the various scrolls */ -init_names() +void +init_names(void) { register int nsyl; register char *cp, *sp; @@ -287,7 +290,8 @@ * roll up the rogue */ -init_player() +void +init_player(void) { int stat_total, round, minimum, maximum, ch, i, j; short do_escape, *our_stats[NUMABILITIES-1]; @@ -587,7 +591,8 @@ * Initialize the ring stone setting scheme for this time */ -init_stones() +void +init_stones(void) { register int i, j; @@ -613,7 +618,8 @@ * init_things * Initialize the probabilities for types of things */ -init_things() +void +init_things(void) { register struct magic_item *mp; diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/io.c --- a/arogue7/io.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/io.c Fri Feb 19 21:02:28 2016 -0500 @@ -30,7 +30,10 @@ static char msgbuf[BUFSIZ]; static int newpos = 0; +void doadd(char *fmt, va_list ap); + /*VARARGS1*/ +void msg(char *fmt, ...) { va_list ap; @@ -58,6 +61,7 @@ /* * add things to the current message */ +void addmsg(char *fmt, ...) { va_list ap; @@ -71,7 +75,8 @@ * Display a new msg (giving him a chance to see the previous one if it * 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; @@ -111,6 +116,7 @@ draw(msgw); } +void doadd(char *fmt, va_list ap) { @@ -127,9 +133,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; @@ -188,7 +193,8 @@ * returns true if it is ok for type to shoot over ch */ -shoot_ok(ch) +bool +shoot_ok(char ch) { switch (ch) { @@ -209,7 +215,8 @@ * getchar. */ -readchar() +int +readchar(void) { int ch; @@ -227,10 +234,11 @@ /* * status: * Display the important stats line. Keep the cursor where it was. + * display: if 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, ox, temp; @@ -358,8 +366,8 @@ * wait_for * Sit around until the guy types the right key */ -wait_for(ch) -register char ch; +void +wait_for(char ch) { register char c; @@ -383,10 +391,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) { static char blanks[LINELEN+1]; register int line, i; @@ -436,9 +443,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); @@ -453,9 +459,8 @@ * dbotline: * 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); @@ -467,8 +472,8 @@ * restscr: * Restores the screen to the terminal */ -restscr(scr) -WINDOW *scr; +void +restscr(WINDOW *scr) { clearok(scr,TRUE); touchwin(scr); @@ -481,10 +486,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 */ @@ -519,12 +521,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 56e748983fa8 -r f9ef86cf22b2 arogue7/list.c --- a/arogue7/list.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/list.c Fri Feb 19 21:02:28 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; @@ -101,8 +104,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; @@ -119,8 +122,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)); @@ -132,8 +135,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; @@ -150,8 +153,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; @@ -167,8 +170,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); @@ -180,8 +183,7 @@ */ struct linked_list * -new_item(size) -int size; +new_item(int size) { register struct linked_list *item; @@ -199,7 +201,7 @@ */ struct linked_list * -creat_item() +creat_item(void) { register struct linked_list *item; @@ -210,8 +212,7 @@ } char * -new(size) -int size; +new(int size) { register char *space = ALLOC(size); static char errbuf[LINELEN]; diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/main.c --- a/arogue7/main.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/main.c Fri Feb 19 21:02:28 2016 -0500 @@ -32,10 +32,19 @@ #endif 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) -char **argv; -char **envp; +int +main(int argc, char *argv[], char *envp[]) { register char *env; int lowtime; @@ -419,8 +428,7 @@ */ void -endit(sig) -int sig; +endit(int sig) { fatal("Ok, if you want to exit that badly, I'll have to allow it\n"); } @@ -430,8 +438,8 @@ * Exit the program, printing a message. */ -fatal(s) -char *s; +void +fatal(char *s) { clear(); move(lines-2, 0); @@ -449,8 +457,8 @@ * rnd: * Pick a very random number. */ -rnd(range) -register int range; +int +rnd(int range) { return(range <= 0 ? 0 : md_rand() % range); } @@ -460,8 +468,8 @@ * roll a number of dice */ -roll(number, sides) -register int number, sides; +int +roll(int number, int sides) { register int dtotal = 0; @@ -474,8 +482,7 @@ * handle stop and start signals */ void -tstp(sig) -int sig; +tstp(int sig) { mvcur(0, cols - 1, lines - 1, 0); endwin(); @@ -493,7 +500,8 @@ } # endif -setup() +void +setup(void) { #ifdef CHECKTIME int checkout(); @@ -563,7 +571,8 @@ * refreshing things and looking at the proper times. */ -playit() +void +playit(void) { register char *opts; @@ -585,7 +594,8 @@ /* * see if the system is being used too much for this game */ -too_much() +bool +too_much(void) { #if MAXPROCESSES if (loadav() > MAXPROCESSES) @@ -602,7 +612,8 @@ * author: * See if a user is an author of the program */ -author() +bool +author(void) { switch (md_getuid()) { #if AUTHOR @@ -653,9 +664,8 @@ * 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; +void +chmsg(char *fmt, int arg) { if (in_shell) { printf(fmt, arg); @@ -671,7 +681,8 @@ #include -loadav() +int +loadav(void) { char *sarcmd = "sar -v | cut -c17-20 | tail -2"; char *gettycmd = "grep getty /etc/inittab | wc -l"; @@ -724,7 +735,9 @@ #include #include struct utmp buf; -ucount() + +int +ucount(void) { reg struct utmp *up; reg FILE *utmp; @@ -751,7 +764,8 @@ * holiday: * Returns TRUE when it is a good time to play rogue */ -holiday() +bool +holiday(void) { #ifdef CHECKTIME long now; diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/maze.c --- a/arogue7/maze.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/maze.c Fri Feb 19 21:02:28 2016 -0500 @@ -30,15 +30,20 @@ *bits; static int maze_lines, 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: * Does actual drawing of maze to window */ -crankout() +void +crankout(void) { reg int x, y; @@ -71,7 +76,8 @@ * domaze: * Draw the maze on this level. */ -do_maze() +void +do_maze(void) { reg int least; reg struct room *rp; @@ -95,7 +101,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(5) + 5); /* add in one large hunk */ attach(lvl_obj, item); @@ -108,7 +114,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 { @@ -133,7 +139,8 @@ * draw_maze: * Generate and draw the maze on the screen */ -draw_maze() +void +draw_maze(void) { reg int i, j, more; reg char *ptr; @@ -169,8 +176,8 @@ * findcells: * Figure out cells to open up */ -findcells(y,x) -reg int x, y; +int +findcells(int y, int x) { reg int rtpos, i; @@ -221,8 +228,7 @@ * Calculate memory address for frontier */ char * -foffset(y, x) -int y, x; +foffset(int y, int x) { return (frontier + (y * maze_cols) + x); @@ -236,8 +242,7 @@ */ bool -maze_view(y, x) -int y, x; +maze_view(int y, int x) { register int start, goal, delta, ycheck, xcheck, absy, absx, see_radius; register bool row; @@ -341,8 +346,7 @@ * Calculate memory address for bits */ char * -moffset(y, x) -int y, x; +moffset(int y, int x) { return (bits + (y * (cols - 1)) + x); @@ -355,8 +359,8 @@ * rmwall: * Removes appropriate walls from the maze */ -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 56e748983fa8 -r f9ef86cf22b2 arogue7/mdport.c --- a/arogue7/mdport.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/mdport.c Fri Feb 19 21:02:28 2016 -0500 @@ -65,6 +65,7 @@ #endif #include +#include #include #include #include @@ -74,7 +75,7 @@ #define MOD_MOVE(c) (toupper(c) ) void -md_init() +md_init(void) { #ifdef __INTERIX char *term; @@ -107,7 +108,7 @@ static int md_standout_mode = 0; int -md_raw_standout() +md_raw_standout(void) { #ifdef _WIN32 CONSOLE_SCREEN_BUFFER_INFO csbiInfo; @@ -130,7 +131,7 @@ } int -md_raw_standend() +md_raw_standend(void) { #ifdef _WIN32 CONSOLE_SCREEN_BUFFER_INFO csbiInfo; @@ -209,7 +210,7 @@ int -md_normaluser() +md_normaluser(void) { #ifndef _WIN32 setuid(getuid()); @@ -218,7 +219,7 @@ } int -md_getuid() +md_getuid(void) { #ifndef _WIN32 return( getuid() ); @@ -228,7 +229,7 @@ } char * -md_getusername() +md_getusername(void) { static char login[80]; char *l = NULL; @@ -263,7 +264,7 @@ } char * -md_gethomedir() +md_gethomedir(void) { static char homedir[PATH_MAX]; char *h = NULL; @@ -318,7 +319,7 @@ } char * -md_getshell() +md_getshell(void) { static char shell[PATH_MAX]; char *s = NULL; @@ -346,7 +347,7 @@ } int -md_shellescape() +md_shellescape(void) { #if (!defined(_WIN32) && !defined(__DJGPP__)) int ret_status; @@ -408,7 +409,7 @@ } char * -md_getroguedir() +md_getroguedir(void) { static char path[1024]; char *end,*home; @@ -472,8 +473,7 @@ } char * -md_getpass(prompt) -char *prompt; +md_getpass(char *prompt) { #ifdef _WIN32 static char password_buffer[9]; @@ -568,7 +568,7 @@ } int -md_rand() +md_rand(void) { #ifdef _WIN32 return(rand()); @@ -578,8 +578,7 @@ } int -md_srand(seed) -register int seed; +md_srand(int seed) { #ifdef _WIN32 srand(seed); @@ -589,7 +588,7 @@ } long -md_memused() +md_memused(void) { #ifdef _WIN32 MEMORYSTATUS stat; @@ -603,7 +602,7 @@ } char * -md_gethostname() +md_gethostname(void) { static char nodename[80]; char *n = NULL; @@ -625,7 +624,7 @@ } int -md_erasechar() +md_erasechar(void) { #ifdef BSD return(_tty.sg_erase); /* process erase character */ @@ -637,7 +636,7 @@ } int -md_killchar() +md_killchar(void) { #ifdef BSD return(_tty.sg_kill); @@ -654,8 +653,7 @@ */ char * -md_unctrl(ch) -char ch; +md_unctrl(char ch) { #if USG5_0 extern char *_unctrl[]; /* Defined in curses library */ @@ -667,7 +665,7 @@ } void -md_flushinp() +md_flushinp(void) { #ifdef BSD ioctl(0, TIOCFLUSH); diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/misc.c --- a/arogue7/misc.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/misc.c Fri Feb 19 21:02:28 2016 -0500 @@ -15,6 +15,7 @@ #include "curses.h" #include #include +#include #include "rogue.h" #ifdef PC7300 #include "menu.h" @@ -29,8 +30,8 @@ * Change the player's class to the specified one. */ -changeclass(newclass) -int newclass; +void +changeclass(int newclass) { if (newclass == player.t_ctype) { msg("You feel more skillful."); @@ -132,8 +133,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; @@ -161,7 +162,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: { @@ -228,10 +229,11 @@ /* * 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; @@ -256,10 +258,10 @@ /* * 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) { @@ -273,8 +275,8 @@ } -do_bag(item) -register struct linked_list *item; +void +do_bag(struct linked_list *item) { register struct linked_list *titem = NULL; @@ -395,8 +397,9 @@ } } -do_panic(who) -int who; /* Kind of monster to panic (all if who is NULL) */ +/* who: Kind of monster to panic (all if who is NULL) */ +void +do_panic(int who) { register int x,y; register struct linked_list *mon, *item; @@ -460,8 +463,7 @@ * print miscellaneous magic bonuses */ char * -misc_name(obj) -register struct object *obj; +misc_name(struct object *obj) { static char buf[LINELEN]; char buf1[LINELEN]; @@ -523,7 +525,8 @@ return buf; } -use_emori() +void +use_emori(void) { char selection; /* Cloak function */ int state = 0; /* Menu state */ @@ -633,8 +636,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, @@ -766,7 +769,7 @@ #endif /* Should we overlay? */ 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); } @@ -795,7 +798,7 @@ /* Should we overlay? */ if (menu_overlay && MAXQUILL + 3 < lines / 2) { over_win(cw, hw, MAXQUILL + 5, maxlen + 3, - 0, curlen, NULL); + 0, curlen, '\0'); } else draw(hw); @@ -835,8 +838,8 @@ } } -use_mm(which) -int which; +void +use_mm(int which) { register struct object *obj = NULL; register struct linked_list *item = NULL; @@ -915,7 +918,7 @@ when GERYON_HORN: /* Chase close monsters away */ msg("The horn blasts a shrill tone."); - do_panic(NULL); + do_panic(0); when HEIL_ANKH: case YENDOR_AMULET: case STONEBONES_AMULET: @@ -938,7 +941,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)) @@ -1008,7 +1011,7 @@ break; } obj->o_charges--; - do_panic(NULL); + do_panic(0); /* * dust of disappearance makes the player invisible for a while */ @@ -1124,8 +1127,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 56e748983fa8 -r f9ef86cf22b2 arogue7/monsters.c --- a/arogue7/monsters.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/monsters.c Fri Feb 19 21:02:28 2016 -0500 @@ -21,13 +21,14 @@ #include "rogue.h" #include #include +#include /* * 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 @@ -71,13 +72,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; @@ -132,9 +131,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; @@ -201,11 +197,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; @@ -415,8 +408,7 @@ */ short -randmonster(wander, no_unique) -register bool wander, no_unique; +randmonster(bool wander, bool no_unique) { register int d, cur_level, range, i; @@ -455,8 +447,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; @@ -551,8 +543,7 @@ * what to do when the hero steps next to a monster */ 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; @@ -749,7 +740,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 56e748983fa8 -r f9ef86cf22b2 arogue7/move.c --- a/arogue7/move.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/move.c Fri Feb 19 21:02:28 2016 -0500 @@ -19,6 +19,7 @@ #include "curses.h" #include +#include #include "rogue.h" #ifdef PC7300 #include "menu.h" @@ -41,9 +42,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 = ""; @@ -426,8 +426,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 */ @@ -486,8 +485,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 */ @@ -564,7 +563,8 @@ * dip_it: * Dip an object into a magic pool */ -dip_it() +void +dip_it(void) { reg struct linked_list *what; reg struct object *ob; @@ -758,8 +758,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 char ch; @@ -1103,8 +1103,8 @@ * Start the hero running */ -do_run(ch) -char ch; +void +do_run(char ch) { firstmove = TRUE; running = TRUE; @@ -1119,11 +1119,9 @@ * Returns TRUE if it could find it, FALSE otherwise. */ bool -getdelta(match, dy, dx) -char match; -int *dy, *dx; +getdelta(char match, int *dy, int *dx) { - register y, x; + int y, x; for (y = 0; y < 3; y++) for (x = 0; x < 3; x++) @@ -1140,8 +1138,8 @@ * isatrap: * Returns TRUE if this character is some kind of trap */ -isatrap(ch) -reg char ch; +bool +isatrap(char ch) { switch(ch) { case DARTTRAP: @@ -1161,8 +1159,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; @@ -1338,8 +1336,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; @@ -1376,8 +1373,7 @@ */ short -movement(tp) -register struct thing *tp; +movement(struct thing *tp) { register int result; register int carry; /* Percentage carried */ @@ -1441,8 +1437,7 @@ */ coord * -rndmove(who) -struct thing *who; +rndmove(struct thing *who) { register int x, y; register int ex, ey, nopen = 0; @@ -1506,9 +1501,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'; @@ -1613,7 +1607,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 */ @@ -1673,7 +1667,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); } @@ -1743,8 +1737,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 char ch = CCHAR( winat(y, x) ); register struct linked_list *it; @@ -1784,8 +1778,7 @@ */ struct trap * -trap_at(y, x) -register int y, x; +trap_at(int y, int x) { register struct trap *tp, *ep; @@ -1803,11 +1796,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 56e748983fa8 -r f9ef86cf22b2 arogue7/new_level.c --- a/arogue7/new_level.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/new_level.c Fri Feb 19 21:02:28 2016 -0500 @@ -16,14 +16,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, i, cnt; register char ch; @@ -434,14 +436,15 @@ status(TRUE); /* 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 */ -rnd_room() +int +rnd_room(void) { register int rm; @@ -457,10 +460,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; @@ -478,7 +482,7 @@ * There is a chance that there is a treasure room on this level */ if (ltype != MAZELEV && rnd(HARDER) < level - 10) { - register j; + int j; register struct room *rp; /* Count the number of free spaces */ diff -r 56e748983fa8 -r f9ef86cf22b2 arogue7/options.c --- a/arogue7/options.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/options.c Fri Feb 19 21:02:28 2016 -0500 @@ -40,14 +40,15 @@ typedef struct optstruct OPTION; -int put_bool(), - get_bool(), - put_str(), - get_str(), - put_abil(), - get_abil(), - get_quest(), - put_quest(); +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); +int get_ro(WINDOW *win, int oy, int ox); int get_str_prot(char *opt, WINDOW *win); int get_score(char *opt, WINDOW *win); @@ -83,9 +84,8 @@ /* * The ability field is read-only */ -get_abil(abil, win) -int *abil; -WINDOW *win; +void +get_abil(int *abil, WINDOW *win) { register int oy, ox; @@ -97,9 +97,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; @@ -113,9 +112,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; @@ -152,9 +150,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; @@ -202,9 +199,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; @@ -278,7 +274,8 @@ /* * print and then set options from the terminal */ -option() +void +option(void) { register OPTION *op; register int retval; @@ -334,8 +331,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; @@ -428,9 +425,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); } @@ -440,9 +436,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); } @@ -451,9 +446,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"); } @@ -464,9 +458,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 56e748983fa8 -r f9ef86cf22b2 arogue7/outside.c --- a/arogue7/outside.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/outside.c Fri Feb 19 21:02:28 2016 -0500 @@ -15,7 +15,8 @@ #include "curses.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: @@ -23,7 +24,7 @@ */ void -init_terrain() +init_terrain(void) { register struct room *rp; @@ -42,11 +43,9 @@ 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 cury, curx; /* Current y and x positions */ + register int cury, curx; /* Current y and x positions */ /* Lay out the boundary */ for (cury=1; cury