comparison xrogue/monsters.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents e6179860cb76
children 7c1cb43f346e
comparison
equal deleted inserted replaced
219:f9ef86cf22b2 220:f54901b9c39b
17 */ 17 */
18 18
19 #include <curses.h> 19 #include <curses.h>
20 #include <ctype.h> 20 #include <ctype.h>
21 #include <string.h> 21 #include <string.h>
22 #include <stdlib.h>
22 #include "rogue.h" 23 #include "rogue.h"
23 24
24 /* 25 /*
25 * Check_residue takes care of any effect of the monster 26 * Check_residue takes care of any effect of the monster
26 */ 27 */
27 28
28 check_residue(tp) 29 void
29 register struct thing *tp; 30 check_residue(struct thing *tp)
30 { 31 {
31 /* 32 /*
32 * Take care of special abilities 33 * Take care of special abilities
33 */ 34 */
34 if (on(*tp, DIDHOLD) && (--hold_count == 0)) { 35 if (on(*tp, DIDHOLD) && (--hold_count == 0)) {
68 } 69 }
69 } 70 }
70 71
71 /* 72 /*
72 * Creat_mons creates the specified monster -- any if 0 73 * Creat_mons creates the specified monster -- any if 0
74 * person: where to create next to
73 */ 75 */
74 76
75 bool 77 bool
76 creat_mons(person, monster, report) 78 creat_mons(struct thing *person, short monster, bool report)
77 struct thing *person; /* Where to create next to */
78 short monster;
79 bool report;
80 { 79 {
81 struct linked_list *nitem; 80 struct linked_list *nitem;
82 register struct thing *tp; 81 register struct thing *tp;
83 struct room *rp; 82 struct room *rp;
84 coord *mp; 83 coord *mp;
129 * Generate at least 'least' monsters for this single room level. 128 * Generate at least 'least' monsters for this single room level.
130 * 'Treas' indicates whether this is a "treasure" level. 129 * 'Treas' indicates whether this is a "treasure" level.
131 */ 130 */
132 131
133 void 132 void
134 genmonsters(least, treas) 133 genmonsters(int least, bool treas)
135 register int least;
136 bool treas;
137 { 134 {
138 reg int i; 135 reg int i;
139 reg struct room *rp = &rooms[0]; 136 reg struct room *rp = &rooms[0];
140 reg struct linked_list *item; 137 reg struct linked_list *item;
141 reg struct thing *mp; 138 reg struct thing *mp;
178 /* 175 /*
179 * id_monst returns the index of the monster given its letter 176 * id_monst returns the index of the monster given its letter
180 */ 177 */
181 178
182 short 179 short
183 id_monst(monster) 180 id_monst(char monster)
184 register char monster;
185 { 181 {
186 register short result; 182 register short result;
187 183
188 if (levtype == OUTSIDE) { 184 if (levtype == OUTSIDE) {
189 result = NLEVMONS*vlevel + (NUMMONST-NUMDINOS-1); 185 result = NLEVMONS*vlevel + (NUMMONST-NUMDINOS-1);
213 /* 209 /*
214 * new_monster: 210 * new_monster:
215 * Pick a new monster and add it to the list 211 * Pick a new monster and add it to the list
216 */ 212 */
217 213
218 new_monster(item, type, cp, max_monster) 214 void
219 struct linked_list *item; 215 new_monster(struct linked_list *item, short type, coord *cp, bool max_monster)
220 short type;
221 coord *cp;
222 bool max_monster;
223 { 216 {
224 register struct thing *tp; 217 register struct thing *tp;
225 register struct monster *mp; 218 register struct monster *mp;
226 register char *ip, *hitp; 219 register char *ip, *hitp;
227 register int i, min_intel, max_intel; 220 register int i, min_intel, max_intel;
426 * Pick a monster to show up. The lower the level, 419 * Pick a monster to show up. The lower the level,
427 * the meaner the monster. 420 * the meaner the monster.
428 */ 421 */
429 422
430 short 423 short
431 randmonster(wander, no_unique) 424 randmonster(bool wander, bool no_unique)
432 register bool wander, no_unique;
433 { 425 {
434 register int d, cur_level, range, i; 426 register int d, cur_level, range, i;
435 427
436 /* 428 /*
437 * Do we want a merchant? Merchant is always in place 'NUMMONST' 429 * Do we want a merchant? Merchant is always in place 'NUMMONST'
489 481
490 /* Sell displays a menu of goods from which the player may choose 482 /* Sell displays a menu of goods from which the player may choose
491 * to purchase something. 483 * to purchase something.
492 */ 484 */
493 485
494 sell(tp) 486 void
495 register struct thing *tp; 487 sell(struct thing *tp)
496 { 488 {
497 register struct linked_list *item, *seller; 489 register struct linked_list *item, *seller;
498 register struct linked_list *sellpack; 490 register struct linked_list *sellpack;
499 register struct object *obj; 491 register struct object *obj;
500 register long worth, min_worth; 492 register long worth, min_worth;
586 /* 578 /*
587 * what to do when the hero steps next to a monster 579 * what to do when the hero steps next to a monster
588 */ 580 */
589 581
590 struct linked_list * 582 struct linked_list *
591 wake_monster(y, x) 583 wake_monster(int y, int x)
592 int y, x;
593 { 584 {
594 register struct thing *tp; 585 register struct thing *tp;
595 register struct linked_list *it; 586 register struct linked_list *it;
596 register struct room *trp; 587 register struct room *trp;
597 register char *mname; 588 register char *mname;
784 /* 775 /*
785 * wanderer: 776 * wanderer:
786 * A wandering monster has awakened and is headed for the player 777 * A wandering monster has awakened and is headed for the player
787 */ 778 */
788 779
789 wanderer() 780 void
781 wanderer(void)
790 { 782 {
791 register int i; 783 register int i;
792 register struct room *hr = roomin(&hero); 784 register struct room *hr = roomin(&hero);
793 register struct linked_list *item; 785 register struct linked_list *item;
794 register struct thing *tp; 786 register struct thing *tp;