comparison xrogue/daemons.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 b67b99f6c92b
comparison
equal deleted inserted replaced
219:f9ef86cf22b2 220:f54901b9c39b
22 /* 22 /*
23 * doctor: 23 * doctor:
24 * A healing daemon that restors hit points after rest 24 * A healing daemon that restors hit points after rest
25 */ 25 */
26 26
27 doctor(tp) 27 void
28 register struct thing *tp; 28 doctor(struct thing *tp)
29 { 29 {
30 register int ohp; 30 register int ohp;
31 register int limit, new_points; 31 register int limit, new_points;
32 register struct stats *curp; /* current stats pointer */ 32 register struct stats *curp; /* current stats pointer */
33 register struct stats *maxp; /* max stats pointer */ 33 register struct stats *maxp; /* max stats pointer */
109 /* 109 /*
110 * Swander: 110 * Swander:
111 * Called when it is time to start rolling for wandering monsters 111 * Called when it is time to start rolling for wandering monsters
112 */ 112 */
113 113
114 swander() 114 void
115 swander(void)
115 { 116 {
116 start_daemon(rollwand, (VOID *)NULL, BEFORE); 117 start_daemon(rollwand, (VOID *)NULL, BEFORE);
117 } 118 }
118 119
119 /* 120 /*
121 * Called to roll to see if a wandering monster starts up 122 * Called to roll to see if a wandering monster starts up
122 */ 123 */
123 124
124 int between = 0; 125 int between = 0;
125 126
126 rollwand() 127 void
128 rollwand(void)
127 { 129 {
128 130
129 if (++between >= 4) 131 if (++between >= 4)
130 { 132 {
131 /* Theives may not awaken a monster */ 133 /* Theives may not awaken a monster */
143 145
144 /* 146 /*
145 * this function is a daemon called each turn when the character is a thief 147 * this function is a daemon called each turn when the character is a thief
146 */ 148 */
147 149
148 trap_look() 150 void
151 trap_look(void)
149 { 152 {
150 if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl)) 153 if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl))
151 search(TRUE, FALSE); 154 search(TRUE, FALSE);
152 } 155 }
153 156
154 /* 157 /*
155 * unconfuse: 158 * unconfuse:
156 * Release the poor player from his confusion 159 * Release the poor player from his confusion
157 */ 160 */
158 161
159 unconfuse() 162 void
163 unconfuse(void)
160 { 164 {
161 turn_off(player, ISHUH); 165 turn_off(player, ISHUH);
162 msg("You feel less confused now"); 166 msg("You feel less confused now");
163 } 167 }
164 168
165 /* 169 /*
166 * unsee: 170 * unsee:
167 * He lost his see invisible power 171 * He lost his see invisible power
168 */ 172 */
169 173
170 unsee() 174 void
175 unsee(void)
171 { 176 {
172 if (!ISWEARING(R_SEEINVIS)) { 177 if (!ISWEARING(R_SEEINVIS)) {
173 turn_off(player, CANSEE); 178 turn_off(player, CANSEE);
174 msg("The tingling feeling leaves your eyes"); 179 msg("The tingling feeling leaves your eyes");
175 } 180 }
178 /* 183 /*
179 * unstink: 184 * unstink:
180 * Remove to-hit handicap from player 185 * Remove to-hit handicap from player
181 */ 186 */
182 187
183 unstink() 188 void
189 unstink(void)
184 { 190 {
185 turn_off(player, HASSTINK); 191 turn_off(player, HASSTINK);
186 } 192 }
187 193
188 /* 194 /*
189 * unclrhead: 195 * unclrhead:
190 * Player is no longer immune to confusion 196 * Player is no longer immune to confusion
191 */ 197 */
192 198
193 unclrhead() 199 void
200 unclrhead(void)
194 { 201 {
195 turn_off(player, ISCLEAR); 202 turn_off(player, ISCLEAR);
196 msg("The blue aura about your head fades away."); 203 msg("The blue aura about your head fades away.");
197 } 204 }
198 205
199 /* 206 /*
200 * unphase: 207 * unphase:
201 * Player can no longer walk through walls 208 * Player can no longer walk through walls
202 */ 209 */
203 210
204 unphase() 211 void
212 unphase(void)
205 { 213 {
206 turn_off(player, CANINWALL); 214 turn_off(player, CANINWALL);
207 msg("Your dizzy feeling leaves you."); 215 msg("Your dizzy feeling leaves you.");
208 if (!step_ok(hero.y, hero.x, NOMONST, &player)) 216 if (!step_ok(hero.y, hero.x, NOMONST, &player))
209 msg("You begin to feel weird.. "); 217 msg("You begin to feel weird.. ");
213 * land: 221 * land:
214 * Player can no longer fly 222 * Player can no longer fly
215 */ 223 */
216 224
217 int 225 int
218 land() 226 land(void)
219 { 227 {
220 turn_off(player, ISFLY); 228 turn_off(player, ISFLY);
221 msg("You regain your normal weight"); 229 msg("You regain your normal weight");
222 running = FALSE; 230 running = FALSE;
223 return(0); 231 return(0);
226 /* 234 /*
227 * sight: 235 * sight:
228 * He gets his sight back 236 * He gets his sight back
229 */ 237 */
230 238
231 sight() 239 void
240 sight(void)
232 { 241 {
233 if (on(player, ISBLIND)) 242 if (on(player, ISBLIND))
234 { 243 {
235 extinguish(sight); 244 extinguish(sight);
236 turn_off(player, ISBLIND); 245 turn_off(player, ISBLIND);
243 * res_strength: 252 * res_strength:
244 * Restore player's strength 253 * Restore player's strength
245 */ 254 */
246 255
247 int 256 int
248 res_strength(howmuch) 257 res_strength(long howmuch)
249 long howmuch;
250 { 258 {
251 259
252 /* If lost_str is non-zero, restore that amount of strength, 260 /* If lost_str is non-zero, restore that amount of strength,
253 * else all of it 261 * else all of it
254 */ 262 */
269 /* 277 /*
270 * nohaste: 278 * nohaste:
271 * End the hasting 279 * End the hasting
272 */ 280 */
273 281
274 nohaste() 282 void
283 nohaste(void)
275 { 284 {
276 turn_off(player, ISHASTE); 285 turn_off(player, ISHASTE);
277 msg("You feel yourself slowing down."); 286 msg("You feel yourself slowing down.");
278 } 287 }
279 288
280 /* 289 /*
281 * noslow: 290 * noslow:
282 * End the slowing 291 * End the slowing
283 */ 292 */
284 293
285 noslow() 294 void
295 noslow(void)
286 { 296 {
287 turn_off(player, ISSLOW); 297 turn_off(player, ISSLOW);
288 msg("You feel yourself speeding up."); 298 msg("You feel yourself speeding up.");
289 } 299 }
290 300
291 /* 301 /*
292 * suffocate: 302 * suffocate:
293 * If this gets called, the player has suffocated 303 * If this gets called, the player has suffocated
294 */ 304 */
295 305
296 suffocate() 306 void
307 suffocate(void)
297 { 308 {
298 pstats.s_hpt = -1; 309 pstats.s_hpt = -1;
299 death(D_SUFFOCATION); 310 death(D_SUFFOCATION);
300 } 311 }
301 312
302 /* 313 /*
303 * digest the hero's food 314 * digest the hero's food
304 */ 315 */
305 316
306 stomach() 317 void
318 stomach(void)
307 { 319 {
308 register int oldfood, old_hunger, food_use, i; 320 register int oldfood, old_hunger, food_use, i;
309 321
310 /* 322 /*
311 * avoid problems of fainting while eating by just not saying it 323 * avoid problems of fainting while eating by just not saying it
385 397
386 /* 398 /*
387 * daemon for curing the diseased 399 * daemon for curing the diseased
388 */ 400 */
389 401
390 cure_disease() 402 void
403 cure_disease(void)
391 { 404 {
392 turn_off(player, HASDISEASE); 405 turn_off(player, HASDISEASE);
393 if (off (player, HASINFEST)) 406 if (off (player, HASINFEST))
394 msg(terse ? "You feel yourself improving" 407 msg(terse ? "You feel yourself improving"
395 : "You begin to feel yourself improving again"); 408 : "You begin to feel yourself improving again");
398 /* 411 /*
399 * appear: 412 * appear:
400 * Become visible again 413 * Become visible again
401 */ 414 */
402 415
403 appear() 416 void
417 appear(void)
404 { 418 {
405 turn_off(player, ISINVIS); 419 turn_off(player, ISINVIS);
406 PLAYER = VPLAYER; 420 PLAYER = VPLAYER;
407 msg("The tingling feeling leaves your body"); 421 msg("The tingling feeling leaves your body");
408 light(&hero); 422 light(&hero);
411 /* 425 /*
412 * dust_appear: 426 * dust_appear:
413 * dust of disappearance wears off 427 * dust of disappearance wears off
414 */ 428 */
415 429
416 dust_appear() 430 void
431 dust_appear(void)
417 { 432 {
418 turn_off(player, ISINVIS); 433 turn_off(player, ISINVIS);
419 PLAYER = VPLAYER; 434 PLAYER = VPLAYER;
420 msg("You become visible again"); 435 msg("You become visible again");
421 light(&hero); 436 light(&hero);
424 /* 439 /*
425 * unchoke: 440 * unchoke:
426 * the effects of "dust of choking and sneezing" wear off 441 * the effects of "dust of choking and sneezing" wear off
427 */ 442 */
428 443
429 unchoke() 444 void
445 unchoke(void)
430 { 446 {
431 if (!find_slot(unconfuse)) 447 if (!find_slot(unconfuse))
432 turn_off(player, ISHUH); 448 turn_off(player, ISHUH);
433 if (!find_slot(sight)) 449 if (!find_slot(sight))
434 turn_off(player, ISBLIND); 450 turn_off(player, ISBLIND);
438 454
439 /* 455 /*
440 * make some potion for the guy in the Alchemy jug 456 * make some potion for the guy in the Alchemy jug
441 */ 457 */
442 458
443 alchemy(obj) 459 void
444 register struct object *obj; 460 alchemy(struct object *obj)
445 { 461 {
446 register struct object *tobj = NULL; 462 register struct object *tobj = NULL;
447 register struct linked_list *item; 463 register struct linked_list *item;
448 464
449 /* 465 /*
490 /* 506 /*
491 * otto's irresistable dance wears off 507 * otto's irresistable dance wears off
492 */ 508 */
493 509
494 int 510 int
495 undance() 511 undance(void)
496 { 512 {
497 turn_off(player, ISDANCE); 513 turn_off(player, ISDANCE);
498 msg ("Your feet take a break.....whew!"); 514 msg ("Your feet take a break.....whew!");
499 return(0); 515 return(0);
500 } 516 }
501 517
502 /* 518 /*
503 * if he has our favorite necklace of strangulation then take damage every turn 519 * if he has our favorite necklace of strangulation then take damage every turn
504 */ 520 */
505 521
506 strangle() 522 void
523 strangle(void)
507 { 524 {
508 if ((pstats.s_hpt -= 6) <= 0) { 525 if ((pstats.s_hpt -= 6) <= 0) {
509 pstats.s_hpt = -1; 526 pstats.s_hpt = -1;
510 death(D_STRANGLE); 527 death(D_STRANGLE);
511 } 528 }
513 530
514 /* 531 /*
515 * if he has on the gauntlets of fumbling he might drop his weapon each turn 532 * if he has on the gauntlets of fumbling he might drop his weapon each turn
516 */ 533 */
517 534
518 fumble() 535 void
536 fumble(void)
519 { 537 {
520 register struct linked_list *item; 538 register struct linked_list *item;
521 539
522 if (cur_weapon!=NULL && 540 if (cur_weapon!=NULL &&
523 !(cur_weapon->o_flags & ISCURSED) && 541 !(cur_weapon->o_flags & ISCURSED) &&
555 /* 573 /*
556 * This is called each turn the hero has the ring of searching on 574 * This is called each turn the hero has the ring of searching on
557 * it's a lot like trap_look() 575 * it's a lot like trap_look()
558 */ 576 */
559 577
560 ring_search() 578 void
579 ring_search(void)
561 { 580 {
562 if (rnd(75) < (2*dex_compute() + 5*pstats.s_lvl)) search(TRUE, FALSE); 581 if (rnd(75) < (2*dex_compute() + 5*pstats.s_lvl)) search(TRUE, FALSE);
563 else search(FALSE, FALSE); 582 else search(FALSE, FALSE);
564 } 583 }
565 584
566 /* 585 /*
567 * this is called each turn the hero has the ring of teleportation on 586 * this is called each turn the hero has the ring of teleportation on
568 */ 587 */
569 588
570 ring_teleport() 589 void
590 ring_teleport(void)
571 { 591 {
572 if (rnd(100) < 3) teleport(); 592 if (rnd(100) < 3) teleport();
573 } 593 }
574 594
575 /* 595 /*
576 * this is called to charge up the quill of Nagrom 596 * this is called to charge up the quill of Nagrom
577 */ 597 */
578 598
579 quill_charge() 599 void
600 quill_charge(void)
580 { 601 {
581 register struct object *tobj = NULL; 602 register struct object *tobj = NULL;
582 register struct linked_list *item; 603 register struct linked_list *item;
583 604
584 /* 605 /*
599 620
600 /* 621 /*
601 * take the skills away gained (or lost) by the potion of skills 622 * take the skills away gained (or lost) by the potion of skills
602 */ 623 */
603 624
604 unskill() 625 void
626 unskill(void)
605 { 627 {
606 if (pstats.s_lvladj != 0) { 628 if (pstats.s_lvladj != 0) {
607 pstats.s_lvl -= pstats.s_lvladj; 629 pstats.s_lvl -= pstats.s_lvladj;
608 pstats.s_lvladj = 0; 630 pstats.s_lvladj = 0;
609 msg("You feel your normal skill level return."); 631 msg("You feel your normal skill level return.");
614 /* 636 /*
615 * charge up the cloak of Emori 637 * charge up the cloak of Emori
616 */ 638 */
617 639
618 int 640 int
619 cloak_charge(obj) 641 cloak_charge(struct object *obj)
620 register struct object *obj;
621 { 642 {
622 if (obj->o_charges < 1) 643 if (obj->o_charges < 1)