comparison xrogue/actions.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 e52a8a7ad4c5
comparison
equal deleted inserted replaced
219:f9ef86cf22b2 220:f54901b9c39b
22 #include "rogue.h" 22 #include "rogue.h"
23 23
24 int mf_count = 0; /* move_free counter - see actions.c(m_act()) */ 24 int mf_count = 0; /* move_free counter - see actions.c(m_act()) */
25 int mf_jmpcnt = 0; /* move_free counter for # of jumps */ 25 int mf_jmpcnt = 0; /* move_free counter for # of jumps */
26 26
27 void m_breathe(struct thing *tp);
28 void m_select(struct thing *th, bool flee);
29 void m_sonic(struct thing *tp);
30 void m_spell(struct thing *tp);
31 void m_summon(struct thing *tp);
32 bool m_use_it(struct thing *tp, bool flee, struct room *rer, struct room *ree);
33 bool m_use_pack(struct thing *monster, coord *defend_pos, int dist,
34 coord *shoot_dir);
35
27 /* 36 /*
28 * Did we disrupt a spell? 37 * Did we disrupt a spell?
29 */ 38 */
30 dsrpt_monster(tp, always, see_him) 39 void
31 register struct thing *tp; 40 dsrpt_monster(struct thing *tp, bool always, bool see_him)
32 bool always, see_him;
33 { 41 {
34 switch (tp->t_action) { 42 switch (tp->t_action) {
35 case A_SUMMON: 43 case A_SUMMON:
36 case A_MISSILE: 44 case A_MISSILE:
37 case A_SLOW: 45 case A_SLOW:
56 tp->t_no_move = movement(tp); 64 tp->t_no_move = movement(tp);
57 tp->t_using = NULL;/* Just to be on the safe side */ 65 tp->t_using = NULL;/* Just to be on the safe side */
58 } 66 }
59 } 67 }
60 68
61 dsrpt_player() 69 void
70 dsrpt_player(void)
62 { 71 {
63 int which, action; 72 int which, action;
64 struct linked_list *item; 73 struct linked_list *item;
65 struct object *obj; 74 struct object *obj;
66 75
85 when C_COUNT: /* counting of gold? */ 94 when C_COUNT: /* counting of gold? */
86 { 95 {
87 if (purse > 0) { 96 if (purse > 0) {
88 msg("Your gold goes flying everywhere!"); 97 msg("Your gold goes flying everywhere!");
89 do { 98 do {
90 item = spec_item(GOLD, NULL, NULL, NULL); 99 item = spec_item(GOLD, 0, 0, 0);
91 obj = OBJPTR(item); 100 obj = OBJPTR(item);
92 obj->o_count = min(purse, rnd(20)+1); 101 obj->o_count = min(purse, rnd(20)+1);
93 purse -= obj->o_count; 102 purse -= obj->o_count;
94 obj->o_pos = hero; 103 obj->o_pos = hero;
95 fall(item, FALSE); 104 fall(item, FALSE);
123 * m_act: 132 * m_act:
124 * If the critter isn't doing anything, choose an action for it. 133 * If the critter isn't doing anything, choose an action for it.
125 * Otherwise, let it perform its chosen action. 134 * Otherwise, let it perform its chosen action.
126 */ 135 */
127 136
128 m_act(tp) 137 void
129 register struct thing *tp; 138 m_act(struct thing *tp)
130 { 139 {
131 struct object *obj; 140 struct object *obj;
132 bool flee; /* Are we scared? */ 141 bool flee; /* Are we scared? */
133 142
134 /* What are we planning to do? */ 143 /* What are we planning to do? */
288 /* 297 /*
289 * m_breathe: 298 * m_breathe:
290 * Breathe in the chosen direction. 299 * Breathe in the chosen direction.
291 */ 300 */
292 301
293 m_breathe(tp) 302 void
294 register struct thing *tp; 303 m_breathe(struct thing *tp)
295 { 304 {
296 register int damage; 305 register int damage;
297 register char *breath = NULL; 306 register char *breath = NULL;
298 307
299 damage = tp->t_stats.s_hpt; 308 damage = tp->t_stats.s_hpt;
397 } 406 }
398 407
399 /* 408 /*
400 * m_select: 409 * m_select:
401 * Select an action for the monster. 410 * Select an action for the monster.
411 * flee: True if running away or player is inaccessible in wall
402 */ 412 */
403 413
404 m_select(th, flee) 414 void
405 register struct thing *th; 415 m_select(struct thing *th, bool flee)
406 register bool flee; /* True if running away or player is inaccessible in wall */
407 { 416 {
408 register struct room *rer, *ree; /* room of chaser, room of chasee */ 417 register struct room *rer, *ree; /* room of chaser, room of chasee */
409 int dist = INT_MIN; 418 int dist = INT_MIN;
410 int mindist = INT_MAX, maxdist = INT_MIN; 419 int mindist = INT_MAX, maxdist = INT_MIN;
411 bool rundoor; /* TRUE means run to a door */ 420 bool rundoor; /* TRUE means run to a door */
539 /* 548 /*
540 * m_sonic: 549 * m_sonic:
541 * The monster is sounding a sonic blast. 550 * The monster is sounding a sonic blast.
542 */ 551 */
543 552
544 m_sonic(tp) 553 void
545 register struct thing *tp; 554 m_sonic(struct thing *tp)
546 { 555 {
547 register int damage; 556 register int damage;
548 struct object blast = 557 struct object blast =
549 { 558 {
550 MISSILE, {0, 0}, 0, "", "150" , NULL, 0, 0, 0, 0 559 MISSILE, {0, 0}, 0, "", "150" , NULL, 0, 0, 0, 0
569 /* 578 /*
570 * m_spell: 579 * m_spell:
571 * The monster casts a spell. Currently this is limited to 580 * The monster casts a spell. Currently this is limited to
572 * magic missile. 581 * magic missile.
573 */ 582 */
574 m_spell(tp) 583 void
575 register struct thing *tp; 584 m_spell(struct thing *tp)
576 { 585 {
577 struct object missile = 586 struct object missile =
578 { 587 {
579 MISSILE, {0, 0}, 0, "", "0d4 " , NULL, 0, WS_MISSILE, 100, 1 588 MISSILE, {0, 0}, 0, "", "0d4 " , NULL, 0, WS_MISSILE, 100, 1
580 }; 589 };
592 /* 601 /*
593 * m_summon: 602 * m_summon:
594 * Summon aid. 603 * Summon aid.
595 */ 604 */
596 605
597 m_summon(tp) 606 void
598 register struct thing *tp; 607 m_summon(struct thing *tp)
599 { 608 {
600 register char *helpname, *mname; 609 register char *helpname, *mname;
601 int fail, numsum; 610 int fail, numsum;
602 register int which, i; 611 register int which, i;
603 612
666 * See if the monster (tp) has anything useful it can do 675 * See if the monster (tp) has anything useful it can do
667 * (ie. an ability or a weapon) other than just move. 676 * (ie. an ability or a weapon) other than just move.
668 */ 677 */
669 678
670 bool 679 bool
671 m_use_it(tp, flee, rer, ree) 680 m_use_it(struct thing *tp, bool flee, struct room *rer, struct room *ree)
672 register struct thing *tp;
673 bool flee;
674 register struct room *rer, *ree;
675 { 681 {
676 int dist; 682 int dist;
677 register coord *ee = tp->t_dest, *er = &tp->t_pos; 683 register coord *ee = tp->t_dest, *er = &tp->t_pos;
678 coord *shoot_dir = NULL; 684 coord *shoot_dir = NULL;
679 coord straight_dir; 685 coord straight_dir;
834 840
835 return(TRUE); 841 return(TRUE);
836 842
837 } 843 }
838 844
839 reap() 845 void
846 reap(void)
840 { 847 {
841 _t_free_list(&rlist); 848 _t_free_list(&rlist);
842 } 849 }
843 850
844 /* 851 /*
845 * runners: 852 * runners:
846 * Make all the awake monsters try to do something. 853 * Make all the awake monsters try to do something.
854 * segments: Number of segments since last called
847 */ 855 */
848 856
849 runners(segments) 857 int
850 int segments; /* Number of segments since last called */ 858 runners(int segments)
851 { 859 {
852 register struct linked_list *item; 860 register struct linked_list *item;
853 register struct thing *tp = NULL; 861 register struct thing *tp = NULL;
854 register int min_time = 20; /* Minimum time until a monster can act */ 862 register int min_time = 20; /* Minimum time until a monster can act */
855 863
959 /* 967 /*
960 * See if a monster has some magic it can use. Return TRUE if so. 968 * See if a monster has some magic it can use. Return TRUE if so.
961 * Only care about relics and wands for now. 969 * Only care about relics and wands for now.
962 */ 970 */
963 bool 971 bool
964 m_use_pack(monster, defend_pos, dist, shoot_dir) 972 m_use_pack(struct thing *monster, coord *defend_pos, int dist, coord *shoot_dir)
965 register struct thing *monster;
966 coord *defend_pos;
967 register int dist;
968 register coord *shoot_dir;
969 { 973 {
970 register struct object *obj; 974 register struct object *obj;
971 register struct linked_list *pitem, *relic, *stick; 975 register struct linked_list *pitem, *relic, *stick;
972 register int units = -1; 976 register int units = -1;
973 977