Mercurial > hg > early-roguelike
comparison arogue7/monsters.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 | b786053d2f37 |
| children | e1cd27c5464f |
comparison
equal
deleted
inserted
replaced
| 218:56e748983fa8 | 219:f9ef86cf22b2 |
|---|---|
| 19 | 19 |
| 20 #include "curses.h" | 20 #include "curses.h" |
| 21 #include "rogue.h" | 21 #include "rogue.h" |
| 22 #include <ctype.h> | 22 #include <ctype.h> |
| 23 #include <string.h> | 23 #include <string.h> |
| 24 #include <stdlib.h> | |
| 24 | 25 |
| 25 | 26 |
| 26 /* | 27 /* |
| 27 * Check_residue takes care of any effect of the monster | 28 * Check_residue takes care of any effect of the monster |
| 28 */ | 29 */ |
| 29 check_residue(tp) | 30 void |
| 30 register struct thing *tp; | 31 check_residue(struct thing *tp) |
| 31 { | 32 { |
| 32 /* | 33 /* |
| 33 * Take care of special abilities | 34 * Take care of special abilities |
| 34 */ | 35 */ |
| 35 if (on(*tp, DIDHOLD) && (--hold_count == 0)) { | 36 if (on(*tp, DIDHOLD) && (--hold_count == 0)) { |
| 69 } | 70 } |
| 70 } | 71 } |
| 71 | 72 |
| 72 /* | 73 /* |
| 73 * Creat_mons creates the specified monster -- any if 0 | 74 * Creat_mons creates the specified monster -- any if 0 |
| 75 * person: Where to create next to | |
| 74 */ | 76 */ |
| 75 | 77 |
| 76 bool | 78 bool |
| 77 creat_mons(person, monster, report) | 79 creat_mons(struct thing *person, short monster, bool report) |
| 78 struct thing *person; /* Where to create next to */ | |
| 79 short monster; | |
| 80 bool report; | |
| 81 { | 80 { |
| 82 struct linked_list *nitem; | 81 struct linked_list *nitem; |
| 83 register struct thing *tp; | 82 register struct thing *tp; |
| 84 struct room *rp; | 83 struct room *rp; |
| 85 coord *mp; | 84 coord *mp; |
| 130 * Generate at least 'least' monsters for this single room level. | 129 * Generate at least 'least' monsters for this single room level. |
| 131 * 'Treas' indicates whether this is a "treasure" level. | 130 * 'Treas' indicates whether this is a "treasure" level. |
| 132 */ | 131 */ |
| 133 | 132 |
| 134 void | 133 void |
| 135 genmonsters(least, treas) | 134 genmonsters(int least, bool treas) |
| 136 register int least; | |
| 137 bool treas; | |
| 138 { | 135 { |
| 139 reg int i; | 136 reg int i; |
| 140 reg struct room *rp = &rooms[0]; | 137 reg struct room *rp = &rooms[0]; |
| 141 reg struct linked_list *item; | 138 reg struct linked_list *item; |
| 142 reg struct thing *mp; | 139 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 result = NLEVMONS*vlevel; | 184 result = NLEVMONS*vlevel; |
| 189 if (result > NUMMONST) result = NUMMONST; | 185 if (result > NUMMONST) result = NUMMONST; |
| 199 /* | 195 /* |
| 200 * new_monster: | 196 * new_monster: |
| 201 * Pick a new monster and add it to the list | 197 * Pick a new monster and add it to the list |
| 202 */ | 198 */ |
| 203 | 199 |
| 204 new_monster(item, type, cp, max_monster) | 200 void |
| 205 struct linked_list *item; | 201 new_monster(struct linked_list *item, short type, coord *cp, bool max_monster) |
| 206 short type; | |
| 207 coord *cp; | |
| 208 bool max_monster; | |
| 209 { | 202 { |
| 210 register struct thing *tp; | 203 register struct thing *tp; |
| 211 register struct monster *mp; | 204 register struct monster *mp; |
| 212 register char *ip, *hitp; | 205 register char *ip, *hitp; |
| 213 register int i, min_intel, max_intel; | 206 register int i, min_intel, max_intel; |
| 413 * Pick a monster to show up. The lower the level, | 406 * Pick a monster to show up. The lower the level, |
| 414 * the meaner the monster. | 407 * the meaner the monster. |
| 415 */ | 408 */ |
| 416 | 409 |
| 417 short | 410 short |
| 418 randmonster(wander, no_unique) | 411 randmonster(bool wander, bool no_unique) |
| 419 register bool wander, no_unique; | |
| 420 { | 412 { |
| 421 register int d, cur_level, range, i; | 413 register int d, cur_level, range, i; |
| 422 | 414 |
| 423 /* | 415 /* |
| 424 * Do we want a merchant? Merchant is always in place 'NUMMONST' | 416 * Do we want a merchant? Merchant is always in place 'NUMMONST' |
| 453 | 445 |
| 454 /* Sell displays a menu of goods from which the player may choose | 446 /* Sell displays a menu of goods from which the player may choose |
| 455 * to purchase something. | 447 * to purchase something. |
| 456 */ | 448 */ |
| 457 | 449 |
| 458 sell(tp) | 450 void |
| 459 register struct thing *tp; | 451 sell(struct thing *tp) |
| 460 { | 452 { |
| 461 register struct linked_list *item, *seller; | 453 register struct linked_list *item, *seller; |
| 462 register struct linked_list *sellpack; | 454 register struct linked_list *sellpack; |
| 463 register struct object *obj; | 455 register struct object *obj; |
| 464 register int worth, min_worth; | 456 register int worth, min_worth; |
| 549 | 541 |
| 550 /* | 542 /* |
| 551 * what to do when the hero steps next to a monster | 543 * what to do when the hero steps next to a monster |
| 552 */ | 544 */ |
| 553 struct linked_list * | 545 struct linked_list * |
| 554 wake_monster(y, x) | 546 wake_monster(int y, int x) |
| 555 int y, x; | |
| 556 { | 547 { |
| 557 register struct thing *tp; | 548 register struct thing *tp; |
| 558 register struct linked_list *it; | 549 register struct linked_list *it; |
| 559 register struct room *trp; | 550 register struct room *trp; |
| 560 register char *mname; | 551 register char *mname; |
| 747 /* | 738 /* |
| 748 * wanderer: | 739 * wanderer: |
| 749 * A wandering monster has awakened and is headed for the player | 740 * A wandering monster has awakened and is headed for the player |
| 750 */ | 741 */ |
| 751 | 742 |
| 752 wanderer() | 743 void |
| 744 wanderer(void) | |
| 753 { | 745 { |
| 754 register int i; | 746 register int i; |
| 755 register struct room *hr = roomin(&hero); | 747 register struct room *hr = roomin(&hero); |
| 756 register struct linked_list *item; | 748 register struct linked_list *item; |
| 757 register struct thing *tp; | 749 register struct thing *tp; |
