comparison arogue7/sticks.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 e1cd27c5464f
comparison
equal deleted inserted replaced
218:56e748983fa8 219:f9ef86cf22b2
20 #include "curses.h" 20 #include "curses.h"
21 #include <ctype.h> 21 #include <ctype.h>
22 #include <string.h> 22 #include <string.h>
23 #include "rogue.h" 23 #include "rogue.h"
24 24
25 void drain(int ymin, int ymax, int xmin, int xmax);
25 26
26 /* 27 /*
27 * zap a stick and see what happens 28 * zap a stick and see what happens
28 */ 29 */
29 do_zap(zapper, obj, direction, which, flags) 30 void
30 struct thing *zapper; 31 do_zap(struct thing *zapper, struct object *obj, coord *direction, int which,
31 struct object *obj; 32 int flags)
32 coord *direction;
33 int which;
34 int flags;
35 { 33 {
36 register struct linked_list *item = NULL; 34 register struct linked_list *item = NULL;
37 register struct thing *tp; 35 register struct thing *tp;
38 register int y, x, bonus; 36 register int y, x, bonus;
39 struct linked_list *nitem; 37 struct linked_list *nitem;
497 } 495 }
498 pstats.s_hpt /= 2; 496 pstats.s_hpt /= 2;
499 if (pstats.s_hpt <= 0) { 497 if (pstats.s_hpt <= 0) {
500 msg("Your life has been sucked from you -- More --"); 498 msg("Your life has been sucked from you -- More --");
501 wait_for(' '); 499 wait_for(' ');
502 death(zapper); 500 death(zapper->t_index);
503 } 501 }
504 else 502 else
505 msg("You feel a great drain on your system"); 503 msg("You feel a great drain on your system");
506 } 504 }
507 if (tp == NULL) 505 if (tp == NULL)
623 /* 621 /*
624 * drain: 622 * drain:
625 * Do drain hit points from player shtick 623 * Do drain hit points from player shtick
626 */ 624 */
627 625
628 drain(ymin, ymax, xmin, xmax) 626 void
629 int ymin, ymax, xmin, xmax; 627 drain(int ymin, int ymax, int xmin, int xmax)
630 { 628 {
631 register int i, j, count; 629 register int i, j, count;
632 register struct thing *ick; 630 register struct thing *ick;
633 register struct linked_list *item; 631 register struct linked_list *item;
634 632
696 } 694 }
697 695
698 /* 696 /*
699 * initialize a stick 697 * initialize a stick
700 */ 698 */
701 fix_stick(cur) 699 void
702 register struct object *cur; 700 fix_stick(struct object *cur)
703 { 701 {
704 if (EQUAL(ws_type[cur->o_which], "staff")) { 702 if (EQUAL(ws_type[cur->o_which], "staff")) {
705 cur->o_weight = 100; 703 cur->o_weight = 100;
706 cur->o_charges = 5 + rnd(10); 704 cur->o_charges = 5 + rnd(10);
707 strncpy(cur->o_damage, "2d3", sizeof(cur->o_damage)); 705 strncpy(cur->o_damage, "2d3", sizeof(cur->o_damage));
736 } 734 }
737 735
738 /* 736 /*
739 * Use the wand that our monster is wielding. 737 * Use the wand that our monster is wielding.
740 */ 738 */
741 m_use_wand(monster) 739 void
742 register struct thing *monster; 740 m_use_wand(struct thing *monster)
743 { 741 {
744 register struct object *obj; 742 register struct object *obj;
745 743
746 /* Make sure we really have it */ 744 /* Make sure we really have it */
747 if (monster->t_using) 745 if (monster->t_using)
762 * assume all blessed sticks are normal for now. 760 * assume all blessed sticks are normal for now.
763 * Note that we don't get here if the wand is cursed. 761 * Note that we don't get here if the wand is cursed.
764 */ 762 */
765 msg("%s points a %s at you!", prname(monster_name(monster), TRUE), 763 msg("%s points a %s at you!", prname(monster_name(monster), TRUE),
766 ws_type[obj->o_which]); 764 ws_type[obj->o_which]);
767 do_zap(monster, obj, &monster->t_newpos, obj->o_which, NULL); 765 do_zap(monster, obj, &monster->t_newpos, obj->o_which, 0);
768 monster->t_wand /= 2; /* chance lowers with each use */ 766 monster->t_wand /= 2; /* chance lowers with each use */
769 } 767 }
770 768
769 /*
770 * type: type of item, NULL means stick
771 * which: which item
772 */
771 bool 773 bool
772 need_dir(type, which) 774 need_dir(int type, int which)
773 int type, /* type of item, NULL means stick */
774 which; /* which item */
775 { 775 {
776 if (type == STICK || type == 0) { 776 if (type == STICK || type == 0) {
777 switch (which) { 777 switch (which) {
778 case WS_LIGHT: 778 case WS_LIGHT:
779 case WS_DRAIN: 779 case WS_DRAIN:
797 return (FALSE); /* hope we don't get here */ 797 return (FALSE); /* hope we don't get here */
798 } 798 }
799 /* 799 /*
800 * let the player zap a stick and see what happens 800 * let the player zap a stick and see what happens
801 */ 801 */
802 player_zap(which, flag) 802 bool
803 int which; 803 player_zap(int which, int flag)
804 int flag;
805 { 804 {
806 register struct linked_list *item; 805 register struct linked_list *item;
807 register struct object *obj; 806 register struct object *obj;
808 807
809 obj = NULL; 808 obj = NULL;
866 /* 865 /*
867 * shoot_bolt fires a bolt from the given starting point in the 866 * shoot_bolt fires a bolt from the given starting point in the
868 * given direction 867 * given direction
869 */ 868 */
870 869
871 shoot_bolt(shooter, start, dir, get_points, reason, name, damage) 870 void
872 struct thing *shooter; 871 shoot_bolt(struct thing *shooter, coord start, coord dir, bool get_points,
873 coord start, dir; 872 short reason, char *name, int damage)
874 bool get_points;
875 short reason;
876 char *name;
877 int damage;
878 { 873 {
879 register char dirch, ch; 874 register char dirch, ch;
880 register bool used, change; 875 register bool used, change;
881 register short y, x, bounces; 876 register short y, x, bounces;
882 coord pos; 877 coord pos;