Mercurial > hg > early-roguelike
comparison 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 |
comparison
equal
deleted
inserted
replaced
218:56e748983fa8 | 219:f9ef86cf22b2 |
---|---|
16 #include <limits.h> | 16 #include <limits.h> |
17 #include "curses.h" | 17 #include "curses.h" |
18 #include "rogue.h" | 18 #include "rogue.h" |
19 #define MAXINT INT_MAX | 19 #define MAXINT INT_MAX |
20 #define MININT INT_MIN | 20 #define MININT INT_MIN |
21 | |
22 void m_breathe(struct thing *tp); | |
23 void m_select(struct thing *th, bool flee); | |
24 void m_sonic(struct thing *tp); | |
25 void m_spell(struct thing *tp); | |
26 void m_summon(struct thing *tp); | |
27 bool m_use_it(struct thing *tp, bool flee, struct room *rer, struct room *ree); | |
28 bool m_use_pack(struct thing *monster, coord *monst_pos, coord *defend_pos, | |
29 int dist, coord *shoot_dir); | |
30 | |
21 /* | 31 /* |
22 * Did we disrupt a spell? | 32 * Did we disrupt a spell? |
23 */ | 33 */ |
24 dsrpt_monster(tp, always, see_him) | 34 void |
25 register struct thing *tp; | 35 dsrpt_monster(struct thing *tp, bool always, bool see_him) |
26 bool always, see_him; | |
27 { | 36 { |
28 switch (tp->t_action) { | 37 switch (tp->t_action) { |
29 case A_SUMMON: | 38 case A_SUMMON: |
30 case A_MISSILE: | 39 case A_MISSILE: |
31 case A_SLOW: | 40 case A_SLOW: |
50 tp->t_no_move = movement(tp); | 59 tp->t_no_move = movement(tp); |
51 tp->t_using = NULL;/* Just to be on the safe side */ | 60 tp->t_using = NULL;/* Just to be on the safe side */ |
52 } | 61 } |
53 } | 62 } |
54 | 63 |
55 dsrpt_player() | 64 void |
65 dsrpt_player(void) | |
56 { | 66 { |
57 int which, action; | 67 int which, action; |
58 struct linked_list *item; | 68 struct linked_list *item; |
59 struct object *obj; | 69 struct object *obj; |
60 | 70 |
79 when C_COUNT: /* counting of gold? */ | 89 when C_COUNT: /* counting of gold? */ |
80 { | 90 { |
81 if (purse > 0) { | 91 if (purse > 0) { |
82 msg("Your gold goes flying everywhere!"); | 92 msg("Your gold goes flying everywhere!"); |
83 do { | 93 do { |
84 item = spec_item(GOLD, NULL, NULL, NULL); | 94 item = spec_item(GOLD, 0, 0, 0); |
85 obj = OBJPTR(item); | 95 obj = OBJPTR(item); |
86 obj->o_count = min(purse, rnd(10)+1); | 96 obj->o_count = min(purse, rnd(10)+1); |
87 purse -= obj->o_count; | 97 purse -= obj->o_count; |
88 obj->o_pos = hero; | 98 obj->o_pos = hero; |
89 fall(item, FALSE); | 99 fall(item, FALSE); |
118 * m_act: | 128 * m_act: |
119 * If the critter isn't doing anything, choose an action for it. | 129 * If the critter isn't doing anything, choose an action for it. |
120 * Otherwise, let it perform its chosen action. | 130 * Otherwise, let it perform its chosen action. |
121 */ | 131 */ |
122 | 132 |
123 m_act(tp) | 133 void |
124 register struct thing *tp; | 134 m_act(struct thing *tp) |
125 { | 135 { |
126 struct object *obj; | 136 struct object *obj; |
127 bool flee; /* Are we scared? */ | 137 bool flee; /* Are we scared? */ |
128 | 138 |
129 /* What are we planning to do? */ | 139 /* What are we planning to do? */ |
233 /* | 243 /* |
234 * m_breathe: | 244 * m_breathe: |
235 * Breathe in the chosen direction. | 245 * Breathe in the chosen direction. |
236 */ | 246 */ |
237 | 247 |
238 m_breathe(tp) | 248 void |
239 register struct thing *tp; | 249 m_breathe(struct thing *tp) |
240 { | 250 { |
241 register int damage; | 251 register int damage; |
242 register char *breath = ""; | 252 register char *breath = ""; |
243 | 253 |
244 damage = tp->t_stats.s_hpt; | 254 damage = tp->t_stats.s_hpt; |
342 } | 352 } |
343 | 353 |
344 /* | 354 /* |
345 * m_select: | 355 * m_select: |
346 * Select an action for the monster. | 356 * Select an action for the monster. |
347 */ | 357 * flee: True if running away or player is inaccessible in wall |
348 | 358 */ |
349 m_select(th, flee) | 359 |
350 register struct thing *th; | 360 void |
351 register bool flee; /* True if running away or player is inaccessible in wall */ | 361 m_select(struct thing *th, bool flee) |
352 { | 362 { |
353 register struct room *rer, *ree; /* room of chaser, room of chasee */ | 363 register struct room *rer, *ree; /* room of chaser, room of chasee */ |
354 int dist = MININT; | 364 int dist = MININT; |
355 int mindist = MAXINT, maxdist = MININT; | 365 int mindist = MAXINT, maxdist = MININT; |
356 bool rundoor; /* TRUE means run to a door */ | 366 bool rundoor; /* TRUE means run to a door */ |
484 /* | 494 /* |
485 * m_sonic: | 495 * m_sonic: |
486 * The monster is sounding a sonic blast. | 496 * The monster is sounding a sonic blast. |
487 */ | 497 */ |
488 | 498 |
489 m_sonic(tp) | 499 void |
490 register struct thing *tp; | 500 m_sonic(struct thing *tp) |
491 { | 501 { |
492 register int damage; | 502 register int damage; |
493 static struct object blast = | 503 static struct object blast = |
494 { | 504 { |
495 MISSILE, {0, 0}, "", 0, "", "150" , NULL, 0, 0, 0, 0 | 505 MISSILE, {0, 0}, "", 0, "", "150" , NULL, 0, 0, 0, 0 |
513 /* | 523 /* |
514 * m_spell: | 524 * m_spell: |
515 * The monster casts a spell. Currently this is limited to | 525 * The monster casts a spell. Currently this is limited to |
516 * magic missile. | 526 * magic missile. |
517 */ | 527 */ |
518 m_spell(tp) | 528 void |
519 register struct thing *tp; | 529 m_spell(struct thing *tp) |
520 { | 530 { |
521 static struct object missile = | 531 static struct object missile = |
522 { | 532 { |
523 MISSILE, {0, 0}, "", 0, "", "0d4 " , NULL, 0, WS_MISSILE, 100, 1 | 533 MISSILE, {0, 0}, "", 0, "", "0d4 " , NULL, 0, WS_MISSILE, 100, 1 |
524 }; | 534 }; |
536 /* | 546 /* |
537 * m_summon: | 547 * m_summon: |
538 * Summon aid. | 548 * Summon aid. |
539 */ | 549 */ |
540 | 550 |
541 m_summon(tp) | 551 void |
542 register struct thing *tp; | 552 m_summon(struct thing *tp) |
543 { | 553 { |
544 register char *helpname, *mname; | 554 register char *helpname, *mname; |
545 int fail, numsum; | 555 int fail, numsum; |
546 register int which, i; | 556 register int which, i; |
547 | 557 |
610 * See if the monster (tp) has anything useful it can do | 620 * See if the monster (tp) has anything useful it can do |
611 * (ie. an ability or a weapon) other than just move. | 621 * (ie. an ability or a weapon) other than just move. |
612 */ | 622 */ |
613 | 623 |
614 bool | 624 bool |
615 m_use_it(tp, flee, rer, ree) | 625 m_use_it(struct thing *tp, bool flee, struct room *rer, struct room *ree) |
616 register struct thing *tp; | |
617 bool flee; | |
618 register struct room *rer, *ree; | |
619 { | 626 { |
620 int dist; | 627 int dist; |
621 register coord *ee = tp->t_dest, *er = &tp->t_pos; | 628 register coord *ee = tp->t_dest, *er = &tp->t_pos; |
622 coord *shoot_dir; | 629 coord *shoot_dir; |
623 struct linked_list *weapon; | 630 struct linked_list *weapon; |
775 } | 782 } |
776 | 783 |
777 /* | 784 /* |
778 * runners: | 785 * runners: |
779 * Make all the awake monsters try to do something. | 786 * Make all the awake monsters try to do something. |
780 */ | 787 * segments: Number of segments since last called |
781 | 788 */ |
782 runners(segments) | 789 |
783 int segments; /* Number of segments since last called */ | 790 int |
791 runners(int segments) | |
784 { | 792 { |
785 register struct linked_list *item; | 793 register struct linked_list *item; |
786 register struct thing *tp = NULL; | 794 register struct thing *tp = NULL; |
787 register min_time = 20; /* Minimum time until a monster can act */ | 795 register int min_time = 20; /* Minimum time until a monster can act */ |
788 | 796 |
789 /* | 797 /* |
790 * loop thru the list of running (wandering) monsters and see what | 798 * loop thru the list of running (wandering) monsters and see what |
791 * each one will do this time. | 799 * each one will do this time. |
792 * | 800 * |
868 /* | 876 /* |
869 * See if a monster has some magic it can use. Return TRUE if so. | 877 * See if a monster has some magic it can use. Return TRUE if so. |
870 * Only care about relics and wands for now. | 878 * Only care about relics and wands for now. |
871 */ | 879 */ |
872 bool | 880 bool |
873 m_use_pack(monster, monst_pos, defend_pos, dist, shoot_dir) | 881 m_use_pack(struct thing *monster, coord *monst_pos, coord *defend_pos, |
874 register struct thing *monster; | 882 int dist, coord *shoot_dir) |
875 register coord *monst_pos, *defend_pos; | |
876 register int dist; | |
877 register coord *shoot_dir; | |
878 { | 883 { |
879 register struct object *obj; | 884 register struct object *obj; |
880 register struct linked_list *pitem, *relic, *stick; | 885 register struct linked_list *pitem, *relic, *stick; |
881 register int units = -1; | 886 register int units = -1; |
882 | 887 |