Mercurial > hg > early-roguelike
comparison arogue5/daemons.c @ 218:56e748983fa8
Advanced Rogue 5: convert to ANSI function declarations.
This still leaves over a thousand lines of warning messages, mostly
related to the return types of daemons and fuses.
| author | John "Elwin" Edwards |
|---|---|
| date | Sun, 07 Feb 2016 14:39:21 -0500 |
| parents | f2951c4e28d9 |
| children |
comparison
equal
deleted
inserted
replaced
| 217:94a0d9dd5ce1 | 218:56e748983fa8 |
|---|---|
| 20 /* | 20 /* |
| 21 * doctor: | 21 * doctor: |
| 22 * A healing daemon that restors hit points after rest | 22 * A healing daemon that restors hit points after rest |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 doctor(tp) | 25 void |
| 26 register struct thing *tp; | 26 doctor(struct thing *tp) |
| 27 { | 27 { |
| 28 register int ohp; | 28 register int ohp; |
| 29 register int limit, new_points; | 29 register int limit, new_points; |
| 30 register struct stats *curp; /* current stats pointer */ | 30 register struct stats *curp; /* current stats pointer */ |
| 31 register struct stats *maxp; /* max stats pointer */ | 31 register struct stats *maxp; /* max stats pointer */ |
| 98 /* | 98 /* |
| 99 * Swander: | 99 * Swander: |
| 100 * Called when it is time to start rolling for wandering monsters | 100 * Called when it is time to start rolling for wandering monsters |
| 101 */ | 101 */ |
| 102 | 102 |
| 103 swander() | 103 void |
| 104 swander(void) | |
| 104 { | 105 { |
| 105 start_daemon(rollwand, 0, BEFORE); | 106 start_daemon(rollwand, 0, BEFORE); |
| 106 } | 107 } |
| 107 | 108 |
| 108 /* | 109 /* |
| 109 * rollwand: | 110 * rollwand: |
| 110 * Called to roll to see if a wandering monster starts up | 111 * Called to roll to see if a wandering monster starts up |
| 111 */ | 112 */ |
| 112 | 113 |
| 113 rollwand() | 114 void |
| 115 rollwand(void) | |
| 114 { | 116 { |
| 115 if (++between >= 4) | 117 if (++between >= 4) |
| 116 { | 118 { |
| 117 /* Theives may not awaken a monster */ | 119 /* Theives may not awaken a monster */ |
| 118 if ((roll(1, 6) == 4) && | 120 if ((roll(1, 6) == 4) && |
| 126 } | 128 } |
| 127 } | 129 } |
| 128 /* | 130 /* |
| 129 * this function is a daemon called each turn when the character is a thief | 131 * this function is a daemon called each turn when the character is a thief |
| 130 */ | 132 */ |
| 131 trap_look() | 133 void |
| 134 trap_look(void) | |
| 132 { | 135 { |
| 133 if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl)) | 136 if (rnd(100) < (2*dex_compute() + 5*pstats.s_lvl)) |
| 134 search(TRUE, FALSE); | 137 search(TRUE, FALSE); |
| 135 } | 138 } |
| 136 | 139 |
| 137 /* | 140 /* |
| 138 * unconfuse: | 141 * unconfuse: |
| 139 * Release the poor player from his confusion | 142 * Release the poor player from his confusion |
| 140 */ | 143 */ |
| 141 | 144 |
| 142 unconfuse() | 145 void |
| 146 unconfuse(void) | |
| 143 { | 147 { |
| 144 turn_off(player, ISHUH); | 148 turn_off(player, ISHUH); |
| 145 msg("You feel less confused now"); | 149 msg("You feel less confused now"); |
| 146 } | 150 } |
| 147 | 151 |
| 149 /* | 153 /* |
| 150 * unsee: | 154 * unsee: |
| 151 * He lost his see invisible power | 155 * He lost his see invisible power |
| 152 */ | 156 */ |
| 153 | 157 |
| 154 unsee() | 158 void |
| 159 unsee(void) | |
| 155 { | 160 { |
| 156 if (!ISWEARING(R_SEEINVIS)) { | 161 if (!ISWEARING(R_SEEINVIS)) { |
| 157 turn_off(player, CANSEE); | 162 turn_off(player, CANSEE); |
| 158 msg("The tingling feeling leaves your eyes"); | 163 msg("The tingling feeling leaves your eyes"); |
| 159 } | 164 } |
| 162 /* | 167 /* |
| 163 * unstink: | 168 * unstink: |
| 164 * Remove to-hit handicap from player | 169 * Remove to-hit handicap from player |
| 165 */ | 170 */ |
| 166 | 171 |
| 167 unstink() | 172 void |
| 173 unstink(void) | |
| 168 { | 174 { |
| 169 turn_off(player, HASSTINK); | 175 turn_off(player, HASSTINK); |
| 170 } | 176 } |
| 171 | 177 |
| 172 /* | 178 /* |
| 173 * unclrhead: | 179 * unclrhead: |
| 174 * Player is no longer immune to confusion | 180 * Player is no longer immune to confusion |
| 175 */ | 181 */ |
| 176 | 182 |
| 177 unclrhead() | 183 void |
| 184 unclrhead(void) | |
| 178 { | 185 { |
| 179 turn_off(player, ISCLEAR); | 186 turn_off(player, ISCLEAR); |
| 180 msg("The blue aura about your head fades away."); | 187 msg("The blue aura about your head fades away."); |
| 181 } | 188 } |
| 182 | 189 |
| 183 /* | 190 /* |
| 184 * unphase: | 191 * unphase: |
| 185 * Player can no longer walk through walls | 192 * Player can no longer walk through walls |
| 186 */ | 193 */ |
| 187 | 194 |
| 188 unphase() | 195 void |
| 196 unphase(void) | |
| 189 { | 197 { |
| 190 turn_off(player, CANINWALL); | 198 turn_off(player, CANINWALL); |
| 191 msg("Your dizzy feeling leaves you."); | 199 msg("Your dizzy feeling leaves you."); |
| 192 if (!step_ok(hero.y, hero.x, NOMONST, &player)) death(D_PETRIFY); | 200 if (!step_ok(hero.y, hero.x, NOMONST, &player)) death(D_PETRIFY); |
| 193 } | 201 } |
| 195 /* | 203 /* |
| 196 * land: | 204 * land: |
| 197 * Player can no longer fly | 205 * Player can no longer fly |
| 198 */ | 206 */ |
| 199 | 207 |
| 200 land() | 208 void |
| 209 land(void) | |
| 201 { | 210 { |
| 202 turn_off(player, ISFLY); | 211 turn_off(player, ISFLY); |
| 203 msg("You regain your normal weight"); | 212 msg("You regain your normal weight"); |
| 204 running = FALSE; | 213 running = FALSE; |
| 205 } | 214 } |
| 207 /* | 216 /* |
| 208 * sight: | 217 * sight: |
| 209 * He gets his sight back | 218 * He gets his sight back |
| 210 */ | 219 */ |
| 211 | 220 |
| 212 sight() | 221 void |
| 222 sight(void) | |
| 213 { | 223 { |
| 214 if (on(player, ISBLIND)) | 224 if (on(player, ISBLIND)) |
| 215 { | 225 { |
| 216 extinguish(sight); | 226 extinguish(sight); |
| 217 turn_off(player, ISBLIND); | 227 turn_off(player, ISBLIND); |
| 223 /* | 233 /* |
| 224 * res_strength: | 234 * res_strength: |
| 225 * Restore player's strength | 235 * Restore player's strength |
| 226 */ | 236 */ |
| 227 | 237 |
| 228 res_strength() | 238 void |
| 239 res_strength(void) | |
| 229 { | 240 { |
| 230 | 241 |
| 231 /* If lost_str is non-zero, restore that amount of strength, | 242 /* If lost_str is non-zero, restore that amount of strength, |
| 232 * else all of it | 243 * else all of it |
| 233 */ | 244 */ |
| 247 /* | 258 /* |
| 248 * nohaste: | 259 * nohaste: |
| 249 * End the hasting | 260 * End the hasting |
| 250 */ | 261 */ |
| 251 | 262 |
| 252 nohaste() | 263 void |
| 264 nohaste(void) | |
| 253 { | 265 { |
| 254 turn_off(player, ISHASTE); | 266 turn_off(player, ISHASTE); |
| 255 msg("You feel yourself slowing down."); | 267 msg("You feel yourself slowing down."); |
| 256 } | 268 } |
| 257 | 269 |
| 258 /* | 270 /* |
| 259 * noslow: | 271 * noslow: |
| 260 * End the slowing | 272 * End the slowing |
| 261 */ | 273 */ |
| 262 | 274 |
| 263 noslow() | 275 void |
| 276 noslow(void) | |
| 264 { | 277 { |
| 265 turn_off(player, ISSLOW); | 278 turn_off(player, ISSLOW); |
| 266 msg("You feel yourself speeding up."); | 279 msg("You feel yourself speeding up."); |
| 267 } | 280 } |
| 268 | 281 |
| 269 /* | 282 /* |
| 270 * suffocate: | 283 * suffocate: |
| 271 * If this gets called, the player has suffocated | 284 * If this gets called, the player has suffocated |
| 272 */ | 285 */ |
| 273 | 286 |
| 274 suffocate() | 287 void |
| 288 suffocate(void) | |
| 275 { | 289 { |
| 276 death(D_SUFFOCATION); | 290 death(D_SUFFOCATION); |
| 277 } | 291 } |
| 278 | 292 |
| 279 /* | 293 /* |
| 280 * digest the hero's food | 294 * digest the hero's food |
| 281 */ | 295 */ |
| 282 stomach() | 296 void |
| 297 stomach(void) | |
| 283 { | 298 { |
| 284 register int oldfood, old_hunger, food_use, i; | 299 register int oldfood, old_hunger, food_use, i; |
| 285 | 300 |
| 286 old_hunger = hungry_state; | 301 old_hunger = hungry_state; |
| 287 if (food_left <= 0) | 302 if (food_left <= 0) |
| 333 wghtchk(); | 348 wghtchk(); |
| 334 } | 349 } |
| 335 /* | 350 /* |
| 336 * daemon for curing the diseased | 351 * daemon for curing the diseased |
| 337 */ | 352 */ |
| 338 cure_disease() | 353 void |
| 354 cure_disease(void) | |
| 339 { | 355 { |
| 340 turn_off(player, HASDISEASE); | 356 turn_off(player, HASDISEASE); |
| 341 if (off (player, HASINFEST)) | 357 if (off (player, HASINFEST)) |
| 342 msg(terse ? "You feel yourself improving" | 358 msg(terse ? "You feel yourself improving" |
| 343 : "You begin to feel yourself improving again"); | 359 : "You begin to feel yourself improving again"); |
| 344 } | 360 } |
| 345 | 361 |
| 346 /* | 362 /* |
| 347 * daemon for adding back dexterity | 363 * daemon for adding back dexterity |
| 348 */ | 364 */ |
| 349 un_itch() | 365 void |
| 366 un_itch(void) | |
| 350 { | 367 { |
| 351 if (--lost_dext < 1) { | 368 if (--lost_dext < 1) { |
| 352 lost_dext = 0; | 369 lost_dext = 0; |
| 353 turn_off(player, HASITCH); | 370 turn_off(player, HASITCH); |
| 354 } | 371 } |
| 356 } | 373 } |
| 357 /* | 374 /* |
| 358 * appear: | 375 * appear: |
| 359 * Become visible again | 376 * Become visible again |
| 360 */ | 377 */ |
| 361 appear() | 378 void |
| 379 appear(void) | |
| 362 { | 380 { |
| 363 turn_off(player, ISINVIS); | 381 turn_off(player, ISINVIS); |
| 364 PLAYER = VPLAYER; | 382 PLAYER = VPLAYER; |
| 365 msg("The tingling feeling leaves your body"); | 383 msg("The tingling feeling leaves your body"); |
| 366 light(&hero); | 384 light(&hero); |
| 367 } | 385 } |
| 368 /* | 386 /* |
| 369 * dust_appear: | 387 * dust_appear: |
| 370 * dust of disappearance wears off | 388 * dust of disappearance wears off |
| 371 */ | 389 */ |
| 372 dust_appear() | 390 void |
| 391 dust_appear(void) | |
| 373 { | 392 { |
| 374 turn_off(player, ISINVIS); | 393 turn_off(player, ISINVIS); |
| 375 PLAYER = VPLAYER; | 394 PLAYER = VPLAYER; |
| 376 msg("You become visible again"); | 395 msg("You become visible again"); |
| 377 light(&hero); | 396 light(&hero); |
| 378 } | 397 } |
| 379 /* | 398 /* |
| 380 * unchoke: | 399 * unchoke: |
| 381 * the effects of "dust of choking and sneezing" wear off | 400 * the effects of "dust of choking and sneezing" wear off |
| 382 */ | 401 */ |
| 383 unchoke() | 402 void |
| 403 unchoke(void) | |
| 384 { | 404 { |
| 385 if (!find_slot(unconfuse)) | 405 if (!find_slot(unconfuse)) |
| 386 turn_off(player, ISHUH); | 406 turn_off(player, ISHUH); |
| 387 if (!find_slot(sight)) | 407 if (!find_slot(sight)) |
| 388 turn_off(player, ISBLIND); | 408 turn_off(player, ISBLIND); |
| 390 msg("Your throat and eyes return to normal"); | 410 msg("Your throat and eyes return to normal"); |
| 391 } | 411 } |
| 392 /* | 412 /* |
| 393 * make some potion for the guy in the Alchemy jug | 413 * make some potion for the guy in the Alchemy jug |
| 394 */ | 414 */ |
| 395 alchemy(obj) | 415 void |
| 396 register struct object *obj; | 416 alchemy(struct object *obj) |
| 397 { | 417 { |
| 398 register struct object *tobj = NULL; | 418 register struct object *tobj = NULL; |
| 399 register struct linked_list *item; | 419 register struct linked_list *item; |
| 400 | 420 |
| 401 /* | 421 /* |
| 438 } | 458 } |
| 439 /* | 459 /* |
| 440 * otto's irresistable dance wears off | 460 * otto's irresistable dance wears off |
| 441 */ | 461 */ |
| 442 | 462 |
| 443 undance() | 463 void |
| 464 undance(void) | |
| 444 { | 465 { |
| 445 turn_off(player, ISDANCE); | 466 turn_off(player, ISDANCE); |
| 446 msg ("Your feet take a break.....whew!"); | 467 msg ("Your feet take a break.....whew!"); |
| 447 } | 468 } |
| 448 | 469 |
| 449 /* | 470 /* |
| 450 * if he has our favorite necklace of strangulation then take damage every turn | 471 * if he has our favorite necklace of strangulation then take damage every turn |
| 451 */ | 472 */ |
| 452 strangle() | 473 void |
| 474 strangle(void) | |
| 453 { | 475 { |
| 454 if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE); | 476 if ((pstats.s_hpt -= 6) <= 0) death(D_STRANGLE); |
| 455 } | 477 } |
| 456 /* | 478 /* |
| 457 * if he has on the gauntlets of fumbling he might drop his weapon each turn | 479 * if he has on the gauntlets of fumbling he might drop his weapon each turn |
| 458 */ | 480 */ |
| 459 fumble() | 481 void |
| 482 fumble(void) | |
| 460 { | 483 { |
| 461 register struct linked_list *item; | 484 register struct linked_list *item; |
| 462 | 485 |
| 463 if(cur_weapon!=NULL && cur_weapon->o_type!=RELIC && rnd(100)<3) { | 486 if(cur_weapon!=NULL && cur_weapon->o_type!=RELIC && rnd(100)<3) { |
| 464 for (item = pack; item != NULL; item = next(item)) { | 487 for (item = pack; item != NULL; item = next(item)) { |
| 472 } | 495 } |
| 473 } | 496 } |
| 474 /* | 497 /* |
| 475 * this is called each turn the hero has the ring of searching on | 498 * this is called each turn the hero has the ring of searching on |
| 476 */ | 499 */ |
| 477 ring_search() | 500 void |
| 501 ring_search(void) | |
| 478 { | 502 { |
| 479 search(FALSE, FALSE); | 503 search(FALSE, FALSE); |
| 480 } | 504 } |
| 481 /* | 505 /* |
| 482 * this is called each turn the hero has the ring of teleportation on | 506 * this is called each turn the hero has the ring of teleportation on |
| 483 */ | 507 */ |
| 484 ring_teleport() | 508 void |
| 509 ring_teleport(void) | |
| 485 { | 510 { |
| 486 if (rnd(100) < 2) teleport(); | 511 if (rnd(100) < 2) teleport(); |
| 487 } | 512 } |
