Mercurial > hg > early-roguelike
comparison arogue7/player.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 | adfa37e67084 |
| children | e52a8a7ad4c5 |
comparison
equal
deleted
inserted
replaced
| 218:56e748983fa8 | 219:f9ef86cf22b2 |
|---|---|
| 16 /* | 16 /* |
| 17 * This file contains functions for dealing with special player abilities | 17 * This file contains functions for dealing with special player abilities |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #include <ctype.h> | 20 #include <ctype.h> |
| 21 #include <string.h> | |
| 21 #include "curses.h" | 22 #include "curses.h" |
| 22 #include "rogue.h" | 23 #include "rogue.h" |
| 23 #ifdef PC7300 | 24 #ifdef PC7300 |
| 24 #include "menu.h" | 25 #include "menu.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 28 bool pick_spell(struct spells spells[], int ability, int num_spells, int power, | |
| 29 char *prompt, char *type); | |
| 27 | 30 |
| 28 /* | 31 /* |
| 29 * affect: | 32 * affect: |
| 30 * cleric affecting undead | 33 * cleric affecting undead |
| 31 */ | 34 */ |
| 32 | 35 |
| 33 affect() | 36 void |
| 37 affect(void) | |
| 34 { | 38 { |
| 35 register struct linked_list *item; | 39 register struct linked_list *item; |
| 36 register struct thing *tp; | 40 register struct thing *tp; |
| 37 register char *mname; | 41 register char *mname; |
| 38 bool see; | 42 bool see; |
| 145 } | 149 } |
| 146 | 150 |
| 147 /* | 151 /* |
| 148 * the magic user is going to try and cast a spell | 152 * the magic user is going to try and cast a spell |
| 149 */ | 153 */ |
| 150 cast() | 154 void |
| 155 cast(void) | |
| 151 { | 156 { |
| 152 int spell_ability, | 157 int spell_ability, |
| 153 which_spell, | 158 which_spell, |
| 154 num_spells; | 159 num_spells; |
| 155 | 160 |
| 200 | 205 |
| 201 msg("Your spell is successful."); | 206 msg("Your spell is successful."); |
| 202 | 207 |
| 203 if (magic_spells[which_spell].s_type == TYP_POTION) | 208 if (magic_spells[which_spell].s_type == TYP_POTION) |
| 204 quaff( magic_spells[which_spell].s_which, | 209 quaff( magic_spells[which_spell].s_which, |
| 205 NULL, | 210 0, |
| 206 magic_spells[which_spell].s_flag, | 211 magic_spells[which_spell].s_flag, |
| 207 FALSE); | 212 FALSE); |
| 208 else if (magic_spells[which_spell].s_type == TYP_SCROLL) | 213 else if (magic_spells[which_spell].s_type == TYP_SCROLL) |
| 209 read_scroll( magic_spells[which_spell].s_which, | 214 read_scroll( magic_spells[which_spell].s_which, |
| 210 magic_spells[which_spell].s_flag, | 215 magic_spells[which_spell].s_flag, |
| 220 } | 225 } |
| 221 | 226 |
| 222 /* | 227 /* |
| 223 * the druid asks his deity for a spell | 228 * the druid asks his deity for a spell |
| 224 */ | 229 */ |
| 225 chant() | 230 void |
| 231 chant(void) | |
| 226 { | 232 { |
| 227 register int num_chants, | 233 register int num_chants, |
| 228 chant_ability, | 234 chant_ability, |
| 229 which_chant; | 235 which_chant; |
| 230 | 236 |
| 288 | 294 |
| 289 msg("Your chant has been granted."); | 295 msg("Your chant has been granted."); |
| 290 | 296 |
| 291 if (druid_spells[which_chant].s_type == TYP_POTION) | 297 if (druid_spells[which_chant].s_type == TYP_POTION) |
| 292 quaff( druid_spells[which_chant].s_which, | 298 quaff( druid_spells[which_chant].s_which, |
| 293 NULL, | 299 0, |
| 294 druid_spells[which_chant].s_flag, | 300 druid_spells[which_chant].s_flag, |
| 295 FALSE); | 301 FALSE); |
| 296 else if (druid_spells[which_chant].s_type == TYP_SCROLL) | 302 else if (druid_spells[which_chant].s_type == TYP_SCROLL) |
| 297 read_scroll( druid_spells[which_chant].s_which, | 303 read_scroll( druid_spells[which_chant].s_which, |
| 298 druid_spells[which_chant].s_flag, | 304 druid_spells[which_chant].s_flag, |
| 307 chant_time += druid_spells[which_chant].s_cost; | 313 chant_time += druid_spells[which_chant].s_cost; |
| 308 } | 314 } |
| 309 | 315 |
| 310 /* Constitution bonus */ | 316 /* Constitution bonus */ |
| 311 | 317 |
| 312 const_bonus() /* Hit point adjustment for changing levels */ | 318 int |
| 319 const_bonus(void) /* Hit point adjustment for changing levels */ | |
| 313 { | 320 { |
| 314 register int bonus; | 321 register int bonus; |
| 315 if (pstats.s_const > 6 && pstats.s_const <= 14) | 322 if (pstats.s_const > 6 && pstats.s_const <= 14) |
| 316 bonus = 0; | 323 bonus = 0; |
| 317 else if (pstats.s_const > 14) | 324 else if (pstats.s_const > 14) |
| 341 /* | 348 /* |
| 342 * gsense: | 349 * gsense: |
| 343 * Sense gold | 350 * Sense gold |
| 344 */ | 351 */ |
| 345 | 352 |
| 346 gsense() | 353 void |
| 354 gsense(void) | |
| 347 { | 355 { |
| 348 /* Only thieves can do this */ | 356 /* Only thieves can do this */ |
| 349 if (player.t_ctype != C_THIEF && player.t_ctype != C_ASSASIN) { | 357 if (player.t_ctype != C_THIEF && player.t_ctype != C_ASSASIN) { |
| 350 msg("You seem to have no gold sense."); | 358 msg("You seem to have no gold sense."); |
| 351 return; | 359 return; |
| 352 } | 360 } |
| 353 | 361 |
| 354 read_scroll(S_GFIND, NULL, FALSE); | 362 read_scroll(S_GFIND, 0, FALSE); |
| 355 } | 363 } |
| 356 | 364 |
| 357 /* | 365 /* |
| 358 * the cleric asks his deity for a spell | 366 * the cleric asks his deity for a spell |
| 359 */ | 367 */ |
| 360 pray() | 368 void |
| 369 pray(void) | |
| 361 { | 370 { |
| 362 register int num_prayers, | 371 register int num_prayers, |
| 363 prayer_ability, | 372 prayer_ability, |
| 364 which_prayer; | 373 which_prayer; |
| 365 | 374 |
| 428 | 437 |
| 429 msg("Your prayer has been granted."); | 438 msg("Your prayer has been granted."); |
| 430 | 439 |
| 431 if (cleric_spells[which_prayer].s_type == TYP_POTION) | 440 if (cleric_spells[which_prayer].s_type == TYP_POTION) |
| 432 quaff( cleric_spells[which_prayer].s_which, | 441 quaff( cleric_spells[which_prayer].s_which, |
| 433 NULL, | 442 0, |
| 434 cleric_spells[which_prayer].s_flag, | 443 cleric_spells[which_prayer].s_flag, |
| 435 FALSE); | 444 FALSE); |
| 436 else if (cleric_spells[which_prayer].s_type == TYP_SCROLL) | 445 else if (cleric_spells[which_prayer].s_type == TYP_SCROLL) |
| 437 read_scroll( cleric_spells[which_prayer].s_which, | 446 read_scroll( cleric_spells[which_prayer].s_which, |
| 438 cleric_spells[which_prayer].s_flag, | 447 cleric_spells[which_prayer].s_flag, |
| 452 /* | 461 /* |
| 453 * steal: | 462 * steal: |
| 454 * Steal in direction given in delta | 463 * Steal in direction given in delta |
| 455 */ | 464 */ |
| 456 | 465 |
| 457 steal() | 466 void |
| 467 steal(void) | |
| 458 { | 468 { |
| 459 register struct linked_list *item; | 469 register struct linked_list *item; |
| 460 register struct thing *tp; | 470 register struct thing *tp; |
| 461 register char *mname; | 471 register char *mname; |
| 462 coord new_pos; | 472 coord new_pos; |
| 584 #endif | 594 #endif |
| 585 | 595 |
| 586 /* | 596 /* |
| 587 * this routine lets the player pick the spell that they | 597 * this routine lets the player pick the spell that they |
| 588 * want to cast regardless of character class | 598 * want to cast regardless of character class |
| 599 * spells: spell list | |
| 600 * ability: spell ability | |
| 601 * num_spells: number of spells that can be cast | |
| 602 * power: spell power | |
| 603 * prompt: prompt for spell list | |
| 604 * type: type of thing--> spell, prayer, chant | |
| 589 */ | 605 */ |
| 590 pick_spell(spells, ability, num_spells, power, prompt, type) | 606 bool |
| 591 struct spells spells[]; /* spell list */ | 607 pick_spell(struct spells spells[], int ability, int num_spells, int power, |
| 592 int ability; /* spell ability */ | 608 char *prompt, char *type) |
| 593 int num_spells; /* number of spells that can be cast */ | |
| 594 int power; /* spell power */ | |
| 595 char *prompt; /* prompt for spell list */ | |
| 596 char *type; /* type of thing--> spell, prayer, chant */ | |
| 597 { | 609 { |
| 598 bool nohw = FALSE; | 610 bool nohw = FALSE; |
| 599 register int i; | 611 register int i; |
| 600 int curlen, | 612 int curlen, |
| 601 maxlen, | 613 maxlen, |
| 752 goto got_spell; | 764 goto got_spell; |
| 753 } | 765 } |
| 754 #endif | 766 #endif |
| 755 /* Should we overlay? */ | 767 /* Should we overlay? */ |
| 756 if (menu_overlay && num_spells + 3 < lines / 2) { | 768 if (menu_overlay && num_spells + 3 < lines / 2) { |
| 757 over_win(cw, hw, num_spells + 5, maxlen + 3, 0, curlen, NULL); | 769 over_win(cw, hw, num_spells + 5, maxlen + 3, 0, curlen, '\0'); |
| 758 } | 770 } |
| 759 else draw(hw); | 771 else draw(hw); |
| 760 } | 772 } |
| 761 | 773 |
| 762 if (!nohw) { | 774 if (!nohw) { |
| 778 if (maxlen < curlen) maxlen = curlen; | 790 if (maxlen < curlen) maxlen = curlen; |
| 779 | 791 |
| 780 /* Should we overlay? */ | 792 /* Should we overlay? */ |
| 781 if (menu_overlay && num_spells + 3 < lines / 2) { | 793 if (menu_overlay && num_spells + 3 < lines / 2) { |
| 782 over_win(cw, hw, num_spells + 5, maxlen + 3, | 794 over_win(cw, hw, num_spells + 5, maxlen + 3, |
| 783 0, curlen, NULL); | 795 0, curlen, '\0'); |
| 784 } | 796 } |
| 785 else draw(hw); | 797 else draw(hw); |
| 786 | 798 |
| 787 which_spell = (int) (readchar() - 'a'); | 799 which_spell = (int) (readchar() - 'a'); |
| 788 } | 800 } |
