comparison arogue7/daemons.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
23 /* 23 /*
24 * doctor: 24 * doctor:
25 * A healing daemon that restors hit points after rest 25 * A healing daemon that restors hit points after rest
26 */ 26 */
27 27
28 doctor(tp) 28 void
29 register struct thing *tp; 29 doctor(struct thing *tp)
30 { 30 {
31 register int ohp; 31 register int ohp;
32 register int limit, new_points; 32 register int limit, new_points;
33 register struct stats *curp; /* current stats pointer */ 33 register struct stats *curp; /* current stats pointer */
34 register struct stats *maxp; /* max stats pointer */ 34 register struct stats *maxp; /* max stats pointer */
106 /* 106 /*
107 * Swander: 107 * Swander:
108 * Called when it is time to start rolling for wandering monsters 108 * Called when it is time to start rolling for wandering monsters
109 */ 109 */
110 110
111 swander() 111 void
112 swander(void)
112 { 113 {
113 start_daemon(rollwand, 0, BEFORE); 114 start_daemon(rollwand, 0, BEFORE);
114 } 115 }
115 116
116 /* 117 /*
118 * Called to roll to see if a wandering monster starts up 119 * Called to roll to see if a wandering monster starts up
119 */ 120 */
120 121
121 int between = 0; 122 int between = 0;
122 123
123 rollwand() 124 void
125 rollwand(void)
124 { 126 {
125 127
126 if (++between >= 4) 128 if (++between >= 4)
127 { 129 {
128 /* Theives may not awaken a monster */ 130 /* Theives may not awaken a monster */
138 } 140 }
139 } 141 }
140 /* 142 /*
141 * this function is a daemon called each turn when the character is a thief 143 * this function is a daemon called each turn when the character is a thief
142 */ 144 */
143 trap_look() 145 void
146 trap_look(void)
144 { 147 {
145 if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl)) 148 if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl))
146 search(TRUE, FALSE); 149 search(TRUE, FALSE);
147 } 150 }
148 151
149 /* 152 /*
150 * unconfuse: 153 * unconfuse:
151 * Release the poor player from his confusion 154 * Release the poor player from his confusion
152 */ 155 */
153 156
154 unconfuse() 157 void
158 unconfuse(void)
155 { 159 {
156 turn_off(player, ISHUH); 160 turn_off(player, ISHUH);
157 msg("You feel less confused now"); 161 msg("You feel less confused now");
158 } 162 }
159 163
160 164
161 /* 165 /*
162 * unsee: 166 * unsee:
163 * He lost his see invisible power 167 * He lost his see invisible power
164 */ 168 */
165 unsee() 169 void
170 unsee(void)
166 { 171 {
167 if (!ISWEARING(R_SEEINVIS)) { 172 if (!ISWEARING(R_SEEINVIS)) {
168 turn_off(player, CANSEE); 173 turn_off(player, CANSEE);
169 msg("The tingling feeling leaves your eyes"); 174 msg("The tingling feeling leaves your eyes");
170 } 175 }
173 /* 178 /*
174 * unstink: 179 * unstink:
175 * Remove to-hit handicap from player 180 * Remove to-hit handicap from player
176 */ 181 */
177 182
178 unstink() 183 void
184 unstink(void)
179 { 185 {
180 turn_off(player, HASSTINK); 186 turn_off(player, HASSTINK);
181 } 187 }
182 188
183 /* 189 /*
184 * unclrhead: 190 * unclrhead:
185 * Player is no longer immune to confusion 191 * Player is no longer immune to confusion
186 */ 192 */
187 193
188 unclrhead() 194 void
195 unclrhead(void)
189 { 196 {
190 turn_off(player, ISCLEAR); 197 turn_off(player, ISCLEAR);
191 msg("The blue aura about your head fades away."); 198 msg("The blue aura about your head fades away.");
192 } 199 }
193 200
194 /* 201 /*
195 * unphase: 202 * unphase:
196 * Player can no longer walk through walls 203 * Player can no longer walk through walls
197 */ 204 */
198 205
199 unphase() 206 void
207 unphase(void)
200 { 208 {
201 turn_off(player, CANINWALL); 209 turn_off(player, CANINWALL);
202 msg("Your dizzy feeling leaves you."); 210 msg("Your dizzy feeling leaves you.");
203 if (!step_ok(hero.y, hero.x, NOMONST, &player)) death(D_PETRIFY); 211 if (!step_ok(hero.y, hero.x, NOMONST, &player)) death(D_PETRIFY);
204 } 212 }
206 /* 214 /*
207 * land: 215 * land:
208 * Player can no longer fly 216 * Player can no longer fly
209 */ 217 */
210 218
211 land() 219 void
220 land(void)
212 { 221 {
213 turn_off(player, ISFLY); 222 turn_off(player, ISFLY);
214 msg("You regain your normal weight"); 223 msg("You regain your normal weight");
215 running = FALSE; 224 running = FALSE;
216 } 225 }
218 /* 227 /*
219 * sight: 228 * sight:
220 * He gets his sight back 229 * He gets his sight back
221 */ 230 */
222 231
223 sight() 232 void
233 sight(void)
224 { 234 {
225 if (on(player, ISBLIND)) 235 if (on(player, ISBLIND))
226 { 236 {
227 extinguish(sight); 237 extinguish(sight);
228 turn_off(player, ISBLIND); 238 turn_off(player, ISBLIND);
235 * res_strength: 245 * res_strength:
236 * Restore player's strength 246 * Restore player's strength
237 */ 247 */
238 248
239 void 249 void
240 res_strength(howmuch) 250 res_strength(int howmuch)
241 int howmuch;
242 { 251 {
243 252
244 /* If lost_str is non-zero, restore that amount of strength, 253 /* If lost_str is non-zero, restore that amount of strength,
245 * else all of it 254 * else all of it
246 */ 255 */
260 /* 269 /*
261 * nohaste: 270 * nohaste:
262 * End the hasting 271 * End the hasting
263 */ 272 */
264 273
265 nohaste() 274 void
275 nohaste(void)
266 { 276 {
267 turn_off(player, ISHASTE); 277 turn_off(player, ISHASTE);
268 msg("You feel yourself slowing down."); 278 msg("You feel yourself slowing down.");
269 } 279 }
270 280
271 /* 281 /*
272 * noslow: 282 * noslow:
273 * End the slowing 283 * End the slowing
274 */ 284 */
275 285
276 noslow() 286 void
287 noslow(void)
277 { 288 {
278 turn_off(player, ISSLOW); 289 turn_off(player, ISSLOW);
279 msg("You feel yourself speeding up."); 290 msg("You feel yourself speeding up.");
280 } 291 }
281 292
282 /* 293 /*
283 * suffocate: 294 * suffocate:
284 * If this gets called, the player has suffocated 295 * If this gets called, the player has suffocated
285 */ 296 */
286 297
287 suffocate() 298 void
299 suffocate(void)
288 { 300 {
289 death(D_SUFFOCATION); 301 death(D_SUFFOCATION);
290 } 302 }
291 303
292 /* 304 /*
293 * digest the hero's food 305 * digest the hero's food
294 */ 306 */
295 stomach() 307 void
308 stomach(void)
296 { 309 {
297 register int oldfood, old_hunger, food_use, i; 310 register int oldfood, old_hunger, food_use, i;
298 311
299 /* 312 /*
300 * avoid problems of fainting while eating by just not saying it 313 * avoid problems of fainting while eating by just not saying it
366 wghtchk(); 379 wghtchk();
367 } 380 }
368 /* 381 /*
369 * daemon for curing the diseased 382 * daemon for curing the diseased
370 */ 383 */
371 cure_disease() 384 void
385 cure_disease(void)
372 { 386 {
373 turn_off(player, HASDISEASE); 387 turn_off(player, HASDISEASE);
374 if (off (player, HASINFEST)) 388 if (off (player, HASINFEST))
375 msg(terse ? "You feel yourself improving" 389 msg(terse ? "You feel yourself improving"
376 : "You begin to feel yourself improving again"); 390 : "You begin to feel yourself improving again");
378 392
379 /* 393 /*
380 * appear: 394 * appear:
381 * Become visible again 395 * Become visible again
382 */ 396 */
383 appear() 397 void
398 appear(void)
384 { 399 {
385 turn_off(player, ISINVIS); 400 turn_off(player, ISINVIS);
386 PLAYER = VPLAYER; 401 PLAYER = VPLAYER;
387 msg("The tingling feeling leaves your body"); 402 msg("The tingling feeling leaves your body");
388 light(&hero); 403 light(&hero);
389 } 404 }
390 /* 405 /*
391 * dust_appear: 406 * dust_appear:
392 * dust of disappearance wears off 407 * dust of disappearance wears off
393 */ 408 */
394 dust_appear() 409 void
410 dust_appear(void)
395 { 411 {
396 turn_off(player, ISINVIS); 412 turn_off(player, ISINVIS);
397 PLAYER = VPLAYER; 413 PLAYER = VPLAYER;
398 msg("You become visible again"); 414 msg("You become visible again");
399 light(&hero); 415 light(&hero);
400 } 416 }
401 /* 417 /*
402 * unchoke: 418 * unchoke:
403 * the effects of "dust of choking and sneezing" wear off 419 * the effects of "dust of choking and sneezing" wear off
404 */ 420 */
405 unchoke() 421 void
422 unchoke(void)
406 { 423 {
407 if (!find_slot(unconfuse)) 424 if (!find_slot(unconfuse))
408 turn_off(player, ISHUH); 425 turn_off(player, ISHUH);
409 if (!find_slot(sight)) 426 if (!find_slot(sight))
410 turn_off(player, ISBLIND); 427 turn_off(player, ISBLIND);
412 msg("Your throat and eyes return to normal"); 429 msg("Your throat and eyes return to normal");
413 } 430 }
414 /* 431 /*
415 * make some potion for the guy in the Alchemy jug 432 * make some potion for the guy in the Alchemy jug
416 */ 433 */
417 alchemy(obj) 434 void
418 register struct object *obj; 435 alchemy(struct object *obj)
419 { 436 {
420 register struct object *tobj = NULL; 437 register struct object *tobj = NULL;
421 register struct linked_list *item; 438 register struct linked_list *item;
422 439
423 /* 440 /*
462 } 479 }
463 /* 480 /*
464 * otto's irresistable dance wears off 481 * otto's irresistable dance wears off
465 */ 482 */
466 483
467 undance() 484 void
485 undance(void)
468 { 486 {
469 turn_off(player, ISDANCE); 487 turn_off(player, ISDANCE);
470 msg ("Your feet take a break.....whew!"); 488 msg ("Your feet take a break.....whew!");
471 } 489 }
472 490
473 /* 491 /*
474 * if he has our favorite necklace of strangulation then take damage every turn 492 * if he has our favorite necklace of strangulation then take damage every turn
475 */ 493 */
476 strangle() 494 void
495 strangle(void)
477 { 496 {
478 if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE); 497 if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE);
479 } 498 }
480 /* 499 /*
481 * if he has on the gauntlets of fumbling he might drop his weapon each turn 500 * if he has on the gauntlets of fumbling he might drop his weapon each turn
482 */ 501 */
483 fumble() 502 void
503 fumble(void)
484 { 504 {
485 register struct linked_list *item; 505 register struct linked_list *item;
486 506
487 if (cur_weapon!=NULL && 507 if (cur_weapon!=NULL &&
488 !(cur_weapon->o_flags & ISCURSED) && 508 !(cur_weapon->o_flags & ISCURSED) &&
517 } 537 }
518 } 538 }
519 /* 539 /*
520 * this is called each turn the hero has the ring of searching on 540 * this is called each turn the hero has the ring of searching on
521 */ 541 */
522 ring_search() 542 void
543 ring_search(void)
523 { 544 {
524 search(FALSE, FALSE); 545 search(FALSE, FALSE);
525 } 546 }
526 /* 547 /*
527 * this is called each turn the hero has the ring of teleportation on 548 * this is called each turn the hero has the ring of teleportation on
528 */ 549 */
529 ring_teleport() 550 void
551 ring_teleport(void)
530 { 552 {
531 if (rnd(100) < 2) teleport(); 553 if (rnd(100) < 2) teleport();
532 } 554 }
533 /* 555 /*
534 * this is called to charge up the quill of Nagrom 556 * this is called to charge up the quill of Nagrom
535 */ 557 */
536 quill_charge() 558 void
559 quill_charge(void)
537 { 560 {
538 register struct object *tobj = NULL; 561 register struct object *tobj = NULL;
539 register struct linked_list *item; 562 register struct linked_list *item;
540 563
541 /* 564 /*
554 fuse (quill_charge, 0, player.t_ctype == C_MAGICIAN ? 4 : 8, AFTER); 577 fuse (quill_charge, 0, player.t_ctype == C_MAGICIAN ? 4 : 8, AFTER);
555 } 578 }
556 /* 579 /*
557 * take the skills away gained (or lost) by the potion of skills 580 * take the skills away gained (or lost) by the potion of skills
558 */ 581 */
559 unskill() 582 void
583 unskill(void)
560 { 584 {
561 if (pstats.s_lvladj != 0) { 585 if (pstats.s_lvladj != 0) {
562 pstats.s_lvl -= pstats.s_lvladj; 586 pstats.s_lvl -= pstats.s_lvladj;
563 pstats.s_lvladj = 0; 587 pstats.s_lvladj = 0;
564 msg("You feel your normal skill level return."); 588 msg("You feel your normal skill level return.");
567 } 591 }
568 /* 592 /*
569 * charge up the cloak of Emori 593 * charge up the cloak of Emori
570 */ 594 */
571 595
572 cloak_charge(obj) 596 void
573 register struct object *obj; 597 cloak_charge(struct object *obj)
574 { 598 {
575 if (obj->o_charges < 1) 599 if (obj->o_charges < 1)
576 obj->o_charges = 1; 600 obj->o_charges = 1;
577 } 601 }
578 602
579 /* 603 /*
580 * nofire: 604 * nofire:
581 * He lost his fire resistance 605 * He lost his fire resistance
582 */ 606 */
583 nofire() 607 void
608 nofire(void)
584 { 609 {
585 if (!ISWEARING(R_FIRE)) { 610 if (!ISWEARING(R_FIRE)) {
586 turn_off(player, NOFIRE); 611 turn_off(player, NOFIRE);
587 msg("Your feeling of fire resistance leaves you"); 612 msg("Your feeling of fire resistance leaves you");
588 } 613 }
590 615
591 /* 616 /*
592 * nocold: 617 * nocold:
593 * He lost his cold resistance 618 * He lost his cold resistance
594 */ 619 */
595 nocold() 620 void
621 nocold(void)
596 { 622 {
597 if (!ISWEARING(R_WARMTH)) { 623 if (!ISWEARING(R_WARMTH)) {
598 turn_off(player, NOCOLD); 624 turn_off(player, NOCOLD);
599 msg("Your feeling of warmth leaves you"); 625 msg("Your feeling of warmth leaves you");
600 } 626 }
602 628
603 /* 629 /*
604 * nobolt: 630 * nobolt:
605 * He lost his protection from lightning 631 * He lost his protection from lightning
606 */ 632 */
607 nobolt() 633 void
634 nobolt(void)
608 { 635 {
609 turn_off(player, NOBOLT); 636 turn_off(player, NOBOLT);
610 msg("Your skin looses its bluish tint"); 637 msg("Your skin looses its bluish tint");
611 } 638 }
612 /* 639 /*
613 * eat_gold: 640 * eat_gold:
614 * an artifact eats gold 641 * an artifact eats gold
615 */ 642 */
616 eat_gold(obj) 643 void
617 register struct object *obj; 644 eat_gold(struct object *obj)
618 { 645 {
619 if (purse == 1) 646 if (purse == 1)
620 msg("%s demand you find more gold", inv_name(obj, FALSE)); 647 msg("%s demand you find more gold", inv_name(obj, FALSE));
621 if (purse == 0) { 648 if (purse == 0) {
622 if (--pstats.s_hpt <= 0) 649 if (--pstats.s_hpt <= 0)
626 purse--; 653 purse--;
627 } 654 }
628 /* 655 /*
629 * give the hero back some spell points 656 * give the hero back some spell points
630 */ 657 */
631 spell_recovery() 658 void
659 spell_recovery(void)
632 { 660 {
633 int time; 661 int time;
634 662
635 time = SPELLTIME - max(17-pstats.s_intel, 0); 663 time = SPELLTIME - max(17-pstats.s_intel, 0);
636 time = max(time, 5); 664 time = max(time, 5);
637 if (spell_power > 0) spell_power--; 665 if (spell_power > 0) spell_power--;
638 fuse(spell_recovery, NULL, time, AFTER); 666 fuse(spell_recovery, 0, time, AFTER);
639 } 667 }
640 /* 668 /*
641 * give the hero back some prayer points 669 * give the hero back some prayer points
642 */ 670 */
643 prayer_recovery() 671 void
672 prayer_recovery(void)
644 { 673 {
645 int time; 674 int time;
646 675
647 time = SPELLTIME - max(17-pstats.s_wisdom, 0); 676 time = SPELLTIME - max(17-pstats.s_wisdom, 0);
648 time = max(time, 5); 677 time = max(time, 5);
649 if (pray_time > 0) pray_time--; 678 if (pray_time > 0) pray_time--;
650 fuse(prayer_recovery, NULL, time, AFTER); 679 fuse(prayer_recovery, 0, time, AFTER);
651 } 680 }
652 /* 681 /*
653 * give the hero back some chant points 682 * give the hero back some chant points
654 */ 683 */
655 chant_recovery() 684 void
685 chant_recovery(void)
656 { 686 {
657 int time; 687 int time;
658 688
659 time = SPELLTIME - max(17-pstats.s_wisdom, 0); 689 time = SPELLTIME - max(17-pstats.s_wisdom, 0);
660 time = max(time, 5); 690 time = max(time, 5);
661 if (chant_time > 0) chant_time--; 691 if (chant_time > 0) chant_time--;
662 fuse(chant_recovery, NULL, time, AFTER); 692 fuse(chant_recovery, 0, time, AFTER);
663 } 693 }