Mercurial > hg > early-roguelike
comparison srogue/monsters.c @ 217:94a0d9dd5ce1
Super-Rogue: convert to ANSI-style function declarations.
This fixes most of the build warnings.
author | John "Elwin" Edwards |
---|---|
date | Sun, 31 Jan 2016 13:45:07 -0500 |
parents | 7bdac632ab9d |
children | e7aab31362af |
comparison
equal
deleted
inserted
replaced
216:b24545357d2e | 217:94a0d9dd5ce1 |
---|---|
12 * All rights reserved. | 12 * All rights reserved. |
13 * | 13 * |
14 * See the file LICENSE.TXT for full copyright and licensing information. | 14 * See the file LICENSE.TXT for full copyright and licensing information. |
15 */ | 15 */ |
16 | 16 |
17 #include <string.h> | |
17 #include "rogue.h" | 18 #include "rogue.h" |
18 #include <ctype.h> | 19 #include <ctype.h> |
19 #include "rogue.ext" | 20 #include "rogue.ext" |
20 | 21 |
21 /* | 22 /* |
22 * rnd_mon: | 23 * rnd_mon: |
23 * Pick a monster to show up. The lower the level, | 24 * Pick a monster to show up. The lower the level, |
24 * the meaner the monster. | 25 * the meaner the monster. |
25 */ | 26 */ |
26 rnd_mon(wander,baddie) | 27 char |
27 bool wander; | 28 rnd_mon(bool wander, bool baddie) |
28 bool baddie; /* TRUE when from a polymorph stick */ | 29 { |
29 { | 30 /* baddie; TRUE when from a polymorph stick */ |
30 reg int i, ok, cnt; | 31 reg int i, ok, cnt; |
31 | 32 |
32 cnt = 0; | 33 cnt = 0; |
33 if (levcount == 0) /* if only asmodeus possible */ | 34 if (levcount == 0) /* if only asmodeus possible */ |
34 return(MAXMONS); | 35 return(MAXMONS); |
58 | 59 |
59 /* | 60 /* |
60 * lev_mon: | 61 * lev_mon: |
61 * This gets all monsters possible on this level | 62 * This gets all monsters possible on this level |
62 */ | 63 */ |
63 lev_mon() | 64 void |
65 lev_mon(void) | |
64 { | 66 { |
65 reg int i; | 67 reg int i; |
66 reg struct monster *mm; | 68 reg struct monster *mm; |
67 | 69 |
68 levcount = 0; | 70 levcount = 0; |
81 /* | 83 /* |
82 * new_monster: | 84 * new_monster: |
83 * Pick a new monster and add it to the list | 85 * Pick a new monster and add it to the list |
84 */ | 86 */ |
85 struct linked_list * | 87 struct linked_list * |
86 new_monster(type, cp, treas) | 88 new_monster(char type, struct coord *cp, bool treas) |
87 struct coord *cp; | |
88 bool treas; | |
89 char type; | |
90 { | 89 { |
91 reg struct linked_list *item; | 90 reg struct linked_list *item; |
92 reg struct thing *tp; | 91 reg struct thing *tp; |
93 reg struct monster *mp; | 92 reg struct monster *mp; |
94 reg struct stats *st; | 93 reg struct stats *st; |
189 | 188 |
190 /* | 189 /* |
191 * wanderer: | 190 * wanderer: |
192 * A wandering monster has awakened and is headed for the player | 191 * A wandering monster has awakened and is headed for the player |
193 */ | 192 */ |
194 wanderer() | 193 void |
194 wanderer(void) | |
195 { | 195 { |
196 reg int ch = '-'; | 196 reg int ch = '-'; |
197 reg struct room *rp, *hr = player.t_room; | 197 reg struct room *rp, *hr = player.t_room; |
198 reg struct linked_list *item; | 198 reg struct linked_list *item; |
199 reg struct thing *tp; | 199 reg struct thing *tp; |
215 /* | 215 /* |
216 * wake_monster: | 216 * wake_monster: |
217 * What to do when the hero steps next to a monster | 217 * What to do when the hero steps next to a monster |
218 */ | 218 */ |
219 struct linked_list * | 219 struct linked_list * |
220 wake_monster(y, x) | 220 wake_monster(int y, int x) |
221 int y, x; | |
222 { | 221 { |
223 reg struct thing *tp; | 222 reg struct thing *tp; |
224 reg struct linked_list *it; | 223 reg struct linked_list *it; |
225 reg struct room *rp; | 224 reg struct room *rp; |
226 reg char ch; | 225 reg char ch; |
277 | 276 |
278 /* | 277 /* |
279 * genocide: | 278 * genocide: |
280 * Eradicate a monster forevermore | 279 * Eradicate a monster forevermore |
281 */ | 280 */ |
282 genocide() | 281 void |
282 genocide(void) | |
283 { | 283 { |
284 reg struct linked_list *ip, *nip; | 284 reg struct linked_list *ip, *nip; |
285 reg struct thing *mp; | 285 reg struct thing *mp; |
286 struct monster *mm; | 286 struct monster *mm; |
287 reg int i, ii, c; | 287 reg int i, ii, c; |
329 | 329 |
330 /* | 330 /* |
331 * unhold: | 331 * unhold: |
332 * Release the player from being held | 332 * Release the player from being held |
333 */ | 333 */ |
334 unhold(whichmon) | 334 void |
335 char whichmon; | 335 unhold(char whichmon) |
336 { | 336 { |
337 switch (whichmon) { | 337 switch (whichmon) { |
338 case 'F': | 338 case 'F': |
339 fung_hit = 0; | 339 fung_hit = 0; |
340 strcpy(monsters[midx('F')].m_stats.s_dmg, "000d0"); | 340 strcpy(monsters[midx('F')].m_stats.s_dmg, "000d0"); |
345 | 345 |
346 /* | 346 /* |
347 * midx: | 347 * midx: |
348 * This returns an index to 'whichmon' | 348 * This returns an index to 'whichmon' |
349 */ | 349 */ |
350 midx(whichmon) | 350 int |
351 char whichmon; | 351 midx(char whichmon) |
352 { | 352 { |
353 if (isupper(whichmon)) | 353 if (isupper(whichmon)) |
354 return(whichmon - 'A'); /* 0 to 25 for uppercase */ | 354 return(whichmon - 'A'); /* 0 to 25 for uppercase */ |
355 else if (islower(whichmon)) | 355 else if (islower(whichmon)) |
356 return(whichmon - 'a' + 26); /* 26 to 51 for lowercase */ | 356 return(whichmon - 'a' + 26); /* 26 to 51 for lowercase */ |
361 /* | 361 /* |
362 * monhurt: | 362 * monhurt: |
363 * See when monster should run or fight. Return | 363 * See when monster should run or fight. Return |
364 * TRUE if hit points less than acceptable. | 364 * TRUE if hit points less than acceptable. |
365 */ | 365 */ |
366 monhurt(th) | 366 bool |
367 struct thing *th; | 367 monhurt(struct thing *th) |
368 { | 368 { |
369 reg int ewis, crithp, f1, f2; | 369 reg int ewis, crithp, f1, f2; |
370 reg struct stats *st; | 370 reg struct stats *st; |
371 | 371 |
372 st = &th->t_stats; | 372 st = &th->t_stats; |