Mercurial > hg > early-roguelike
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)) { |
