Advanced Rogue 5: convert to ANSI function declarations.

This still leaves over a thousand lines of warning messages, mostly
related to the return types of daemons and fuses.
This commit is contained in:
John "Elwin" Edwards 2016-02-07 14:39:21 -05:00
parent 59f448e92e
commit f38b2223c8
37 changed files with 977 additions and 733 deletions

View file

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