Mercurial > hg > early-roguelike
comparison xrogue/misc.c @ 220:f54901b9c39b
XRogue: convert to ANSI-style function declarations.
author | John "Elwin" Edwards |
---|---|
date | Wed, 02 Mar 2016 21:13:26 -0500 |
parents | cadff8f047a1 |
children | 7c1cb43f346e |
comparison
equal
deleted
inserted
replaced
219:f9ef86cf22b2 | 220:f54901b9c39b |
---|---|
21 /* | 21 /* |
22 * changeclass: | 22 * changeclass: |
23 * Change the player's class to the specified one. | 23 * Change the player's class to the specified one. |
24 */ | 24 */ |
25 | 25 |
26 changeclass(newclass) | 26 void |
27 long *newclass; | 27 changeclass(long *newclass) |
28 { | 28 { |
29 if (*newclass == player.t_ctype) { | 29 if (*newclass == player.t_ctype) { |
30 msg("You feel more skillful."); | 30 msg("You feel more skillful."); |
31 raise_level(); | 31 raise_level(); |
32 } | 32 } |
150 | 150 |
151 /* | 151 /* |
152 * Use the relic that our monster is wielding. | 152 * Use the relic that our monster is wielding. |
153 */ | 153 */ |
154 | 154 |
155 m_use_relic(monster) | 155 void |
156 register struct thing *monster; | 156 m_use_relic(struct thing *monster) |
157 { | 157 { |
158 register struct object *obj; | 158 register struct object *obj; |
159 | 159 |
160 /* Make sure we really have it */ | 160 /* Make sure we really have it */ |
161 if (monster->t_using) obj = OBJPTR(monster->t_using); | 161 if (monster->t_using) obj = OBJPTR(monster->t_using); |
179 hit_monster(unc(missile.o_pos), &missile, monster); | 179 hit_monster(unc(missile.o_pos), &missile, monster); |
180 monster->t_artifact = monster->t_artifact * 4 / 5; | 180 monster->t_artifact = monster->t_artifact * 4 / 5; |
181 } | 181 } |
182 when EMORI_CLOAK: | 182 when EMORI_CLOAK: |
183 debug("stunning with Emori's cloak"); | 183 debug("stunning with Emori's cloak"); |
184 do_zap(monster, obj, &monster->t_newpos, WS_PARALYZE, NULL); | 184 do_zap(monster, obj, &monster->t_newpos, WS_PARALYZE, 0); |
185 obj->o_charges = 0; | 185 obj->o_charges = 0; |
186 | 186 |
187 when ASMO_ROD: { | 187 when ASMO_ROD: { |
188 char *name; | 188 char *name; |
189 | 189 |
246 monster->t_using = NULL; | 246 monster->t_using = NULL; |
247 } | 247 } |
248 | 248 |
249 /* | 249 /* |
250 * add something to the contents of something else | 250 * add something to the contents of something else |
251 * bag: the holder of the items | |
252 * item: the item to put inside | |
251 */ | 253 */ |
252 | 254 |
253 put_contents(bag, item) | 255 void |
254 register struct object *bag; /* the holder of the items */ | 256 put_contents(struct object *bag, struct linked_list *item) |
255 register struct linked_list *item; /* the item to put inside */ | |
256 { | 257 { |
257 register struct linked_list *titem; | 258 register struct linked_list *titem; |
258 register struct object *tobj; | 259 register struct object *tobj; |
259 | 260 |
260 bag->o_ac++; | 261 bag->o_ac++; |
275 } | 276 } |
276 } | 277 } |
277 | 278 |
278 /* | 279 /* |
279 * remove something from something else | 280 * remove something from something else |
281 * bag: the holder of the items | |
280 */ | 282 */ |
281 | 283 |
282 take_contents(bag, item) | 284 void |
283 register struct object *bag; /* the holder of the items */ | 285 take_contents(struct object *bag, struct linked_list *item) |
284 register struct linked_list *item; | |
285 { | 286 { |
286 | 287 |
287 if (bag->o_ac <= 0) { | 288 if (bag->o_ac <= 0) { |
288 msg("Nothing to take out"); | 289 msg("Nothing to take out"); |
289 return; | 290 return; |
293 if (!add_pack(item, FALSE)) | 294 if (!add_pack(item, FALSE)) |
294 put_contents(bag, item); | 295 put_contents(bag, item); |
295 } | 296 } |
296 | 297 |
297 | 298 |
298 do_bag(item) | 299 void |
299 register struct linked_list *item; | 300 do_bag(struct linked_list *item) |
300 { | 301 { |
301 | 302 |
302 register struct linked_list *titem = NULL; | 303 register struct linked_list *titem = NULL; |
303 register struct object *obj, *tobj; | 304 register struct object *obj, *tobj; |
304 bool doit = TRUE; | 305 bool doit = TRUE; |
415 restscr(cw); | 416 restscr(cw); |
416 } | 417 } |
417 } | 418 } |
418 } | 419 } |
419 | 420 |
420 do_panic(who) | 421 void |
421 int who; /* Kind of monster to panic (all if who is NULL) */ | 422 do_panic(int who) |
422 { | 423 { |
424 /* who: kind of monster to panic (all if who is 0) */ | |
423 register int x,y; | 425 register int x,y; |
424 register struct linked_list *mon, *item; | 426 register struct linked_list *mon, *item; |
425 register struct thing *th; | 427 register struct thing *th; |
426 | 428 |
427 for (x = hero.x-2; x <= hero.x+2; x++) { | 429 for (x = hero.x-2; x <= hero.x+2; x++) { |
483 /* | 485 /* |
484 * print miscellaneous magic bonuses | 486 * print miscellaneous magic bonuses |
485 */ | 487 */ |
486 | 488 |
487 int | 489 int |
488 misc_name(str,obj) | 490 misc_name(char *str, struct object *obj) |
489 char *str; | |
490 register struct object *obj; | |
491 { | 491 { |
492 char buf1[LINELEN]; | 492 char buf1[LINELEN]; |
493 | 493 |
494 *str = 0; | 494 *str = 0; |
495 buf1[0] = 0; | 495 buf1[0] = 0; |
563 strcat(str, buf1); | 563 strcat(str, buf1); |
564 | 564 |
565 return(0); | 565 return(0); |
566 } | 566 } |
567 | 567 |
568 use_emori() | 568 void |
569 use_emori(void) | |
569 { | 570 { |
570 char selection; /* Cloak function */ | 571 char selection; /* Cloak function */ |
571 int state = 0; /* Menu state */ | 572 int state = 0; /* Menu state */ |
572 | 573 |
573 msg("What do you want to do? (* for a list): "); | 574 msg("What do you want to do? (* for a list): "); |
667 | 668 |
668 /* | 669 /* |
669 * try to write a scroll with the quill of Nagrom | 670 * try to write a scroll with the quill of Nagrom |
670 */ | 671 */ |
671 | 672 |
672 use_quill(obj) | 673 void |
673 struct object *obj; | 674 use_quill(struct object *obj) |
674 { | 675 { |
675 struct linked_list *item; | 676 struct linked_list *item; |
676 register int i, | 677 register int i, |
677 scroll_ability; | 678 scroll_ability; |
678 int which_scroll, | 679 int which_scroll, |
759 getyx(hw, dummy, curlen); | 760 getyx(hw, dummy, curlen); |
760 if (maxlen < curlen) maxlen = curlen; | 761 if (maxlen < curlen) maxlen = curlen; |
761 | 762 |
762 /* Should we overlay? */ | 763 /* Should we overlay? */ |
763 if (menu_overlay && MAXQUILL + 3 < lines - 3) { | 764 if (menu_overlay && MAXQUILL + 3 < lines - 3) { |
764 over_win(cw, hw, MAXQUILL + 5, maxlen + 3, 0, curlen, NULL); | 765 over_win(cw, hw, MAXQUILL + 5, maxlen + 3, 0, curlen, '\0'); |
765 } | 766 } |
766 else draw(hw); | 767 else draw(hw); |
767 } | 768 } |
768 | 769 |
769 if (!nohw) { | 770 if (!nohw) { |
787 if (maxlen < curlen) maxlen = curlen; | 788 if (maxlen < curlen) maxlen = curlen; |
788 | 789 |
789 /* Should we overlay? */ | 790 /* Should we overlay? */ |
790 if (menu_overlay && MAXQUILL + 3 < lines - 3) { | 791 if (menu_overlay && MAXQUILL + 3 < lines - 3) { |
791 over_win(cw, hw, MAXQUILL + 5, maxlen + 3, | 792 over_win(cw, hw, MAXQUILL + 5, maxlen + 3, |
792 0, curlen, NULL); | 793 0, curlen, '\0'); |
793 } | 794 } |
794 else draw(hw); | 795 else draw(hw); |
795 | 796 |
796 which_scroll = (int) (wgetch(cw) - 'a'); | 797 which_scroll = (int) (wgetch(cw) - 'a'); |
797 } | 798 } |
828 | 829 |
829 /* | 830 /* |
830 * Use something | 831 * Use something |
831 */ | 832 */ |
832 | 833 |
833 use_mm(which) | 834 void |
834 int which; | 835 use_mm(int which) |
835 { | 836 { |
836 register struct object *obj = NULL; | 837 register struct object *obj = NULL; |
837 register struct linked_list *item = NULL; | 838 register struct linked_list *item = NULL; |
838 bool is_mm; | 839 bool is_mm; |
839 | 840 |
905 /* Put monsters around us to sleep */ | 906 /* Put monsters around us to sleep */ |
906 read_scroll(S_HOLD, 0, FALSE); | 907 read_scroll(S_HOLD, 0, FALSE); |
907 when GERYON_HORN: | 908 when GERYON_HORN: |
908 /* Chase close monsters away */ | 909 /* Chase close monsters away */ |
909 msg("The horn blasts a shrill tone."); | 910 msg("The horn blasts a shrill tone."); |
910 do_panic(NULL); | 911 do_panic(0); |
911 when EYE_VECNA: | 912 when EYE_VECNA: |
912 msg("The pain slowly subsides.. "); | 913 msg("The pain slowly subsides.. "); |
913 when HEIL_ANKH: | 914 when HEIL_ANKH: |
914 msg("Your hand grows very warm. "); | 915 msg("Your hand grows very warm. "); |
915 when YENDOR_AMULET: | 916 when YENDOR_AMULET: |
932 case MM_JUG: | 933 case MM_JUG: |
933 if (obj->o_ac == JUG_EMPTY) { | 934 if (obj->o_ac == JUG_EMPTY) { |
934 msg("The jug is empty"); | 935 msg("The jug is empty"); |
935 break; | 936 break; |
936 } | 937 } |
937 quaff (obj->o_ac, NULL, NULL, FALSE); | 938 quaff (obj->o_ac, 0, 0, FALSE); |
938 obj->o_ac = JUG_EMPTY; | 939 obj->o_ac = JUG_EMPTY; |
939 fuse (alchemy, obj, ALCHEMYTIME, AFTER); | 940 fuse (alchemy, obj, ALCHEMYTIME, AFTER); |
940 if (!(obj->o_flags & ISKNOW)) | 941 if (!(obj->o_flags & ISKNOW)) |
941 whatis(item); | 942 whatis(item); |
942 | 943 |
1010 if (obj->o_charges <= 0) { | 1011 if (obj->o_charges <= 0) { |
1011 msg("The drum is broken."); | 1012 msg("The drum is broken."); |
1012 break; | 1013 break; |
1013 } | 1014 } |
1014 obj->o_charges--; | 1015 obj->o_charges--; |
1015 do_panic(NULL); | 1016 do_panic(0); |
1016 return; | 1017 return; |
1017 /* | 1018 /* |
1018 * dust of disappearance makes the player invisible for a while | 1019 * dust of disappearance makes the player invisible for a while |
1019 */ | 1020 */ |
1020 when MM_DISAPPEAR: | 1021 when MM_DISAPPEAR: |
1138 str = "flashes brightly"; | 1139 str = "flashes brightly"; |
1139 else | 1140 else |
1140 str = "vibrates softly"; | 1141 str = "vibrates softly"; |
1141 msg("You rub the crystal and it %s... ", str); | 1142 msg("You rub the crystal and it %s... ", str); |
1142 /* cure him */ | 1143 /* cure him */ |
1143 read_scroll(S_CURING, NULL, FALSE); | 1144 read_scroll(S_CURING, 0, FALSE); |
1144 /* give him weird hands */ | 1145 /* give him weird hands */ |
1145 turn_on(player, CANHUH); | 1146 turn_on(player, CANHUH); |
1146 msg("Your fingertips turn blue. "); | 1147 msg("Your fingertips turn blue. "); |
1147 /* add intelligence */ | 1148 /* add intelligence */ |
1148 if (player.t_ctype == C_MAGICIAN) { | 1149 if (player.t_ctype == C_MAGICIAN) { |
1216 * Return how long it takes to use an item. For now we only give time | 1217 * Return how long it takes to use an item. For now we only give time |
1217 * for MM, RELIC, SCROLL, and POTION items. | 1218 * for MM, RELIC, SCROLL, and POTION items. |
1218 */ | 1219 */ |
1219 | 1220 |
1220 int | 1221 int |
1221 usage_time(item) | 1222 usage_time(struct linked_list *item) |
1222 struct linked_list *item; | |
1223 { | 1223 { |
1224 register struct object *obj; | 1224 register struct object *obj; |
1225 register int units = -1; | 1225 register int units = -1; |
1226 | 1226 |
1227 obj = OBJPTR(item); | 1227 obj = OBJPTR(item); |