XRogue: convert to ANSI-style function declarations.
This commit is contained in:
parent
e8e6e604c3
commit
2853120387
41 changed files with 1281 additions and 908 deletions
105
xrogue/fight.c
105
xrogue/fight.c
|
|
@ -19,6 +19,7 @@
|
|||
#include <curses.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#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 @@ register struct object *weap;
|
|||
* 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 @@ 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 char *mname;
|
||||
register bool see_att, did_hit = FALSE;
|
||||
|
|
@ -305,9 +310,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;
|
||||
|
|
@ -327,12 +331,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;
|
||||
|
|
@ -739,9 +740,7 @@ bool back_stab;
|
|||
*/
|
||||
|
||||
char *
|
||||
prname(who, upper)
|
||||
register char *who;
|
||||
bool upper;
|
||||
prname(char *who, bool upper)
|
||||
{
|
||||
static char tbuf[LINELEN];
|
||||
|
||||
|
|
@ -766,11 +765,9 @@ bool upper;
|
|||
* 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 @@ bool back_stab, thrown, short_msg;
|
|||
* 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 @@ bool thrown, short_msg;
|
|||
* 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 @@ register int dexterity;
|
|||
* 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 @@ 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);
|
||||
}
|
||||
|
|
@ -908,8 +903,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);
|
||||
}
|
||||
|
|
@ -919,7 +914,8 @@ register short str;
|
|||
* Calculate damage depending on players hungry state
|
||||
*/
|
||||
|
||||
hung_dam()
|
||||
int
|
||||
hung_dam(void)
|
||||
{
|
||||
reg int howmuch = 0;
|
||||
|
||||
|
|
@ -938,8 +934,8 @@ hung_dam()
|
|||
* 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 @@ register struct object *obj;
|
|||
* 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 @@ bool pr, points, treasure;
|
|||
*/
|
||||
|
||||
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 @@ struct thing *mp;
|
|||
|
||||
return(candidate);
|
||||
}
|
||||
explode(tp)
|
||||
register struct thing *tp;
|
||||
|
||||
void
|
||||
explode(struct thing *tp)
|
||||
{
|
||||
|
||||
register int x,y, damage;
|
||||
|
|
@ -1253,11 +1247,8 @@ register struct thing *tp;
|
|||
* 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue