Mercurial > hg > early-roguelike
diff arogue7/actions.c @ 219:f9ef86cf22b2
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.
author | John "Elwin" Edwards |
---|---|
date | Fri, 19 Feb 2016 21:02:28 -0500 |
parents | 1cd604c827a3 |
children |
line wrap: on
line diff
--- 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;