Mercurial > hg > early-roguelike
comparison arogue7/effects.c @ 238:e1cd27c5464f
arogue7, xrogue: improve the handling of the arguments to fuses.
fuse() now expects a pointer as the argument to a fuse function. If
this is one of the functions that takes int, fuse() follows the pointer
and stores that value in the f_list slot, in the integer field of the
argument union. When the fuse goes off, do_fuses() recognizes the
function and passes it the integer field instead of the pointer.
This has the disadvantage of hard-coding the functions that require int
in daemon.c, but since the int is copied into f_list, it no longer has
to be in static or global memory, which simplifies several files.
author | John "Elwin" Edwards |
---|---|
date | Fri, 11 Mar 2016 17:40:00 -0500 |
parents | f9ef86cf22b2 |
children |
comparison
equal
deleted
inserted
replaced
237:2236ef808bcb | 238:e1cd27c5464f |
---|---|
292 msg("The stench of %s sickens you.", | 292 msg("The stench of %s sickens you.", |
293 prname(attname, FALSE)); | 293 prname(attname, FALSE)); |
294 if (on(player, HASSTINK)) lengthen(unstink, STINKTIME); | 294 if (on(player, HASSTINK)) lengthen(unstink, STINKTIME); |
295 else { | 295 else { |
296 turn_on(player, HASSTINK); | 296 turn_on(player, HASSTINK); |
297 fuse(unstink, 0, STINKTIME, AFTER); | 297 fuse(unstink, NULL, STINKTIME, AFTER); |
298 } | 298 } |
299 } | 299 } |
300 } | 300 } |
301 | 301 |
302 /* | 302 /* |
306 if (on(*att, CANCHILL)) { | 306 if (on(*att, CANCHILL)) { |
307 if (!ISWEARING(R_SUSABILITY) && !save(VS_POISON, def, 0)) { | 307 if (!ISWEARING(R_SUSABILITY) && !save(VS_POISON, def, 0)) { |
308 msg("You cringe at %s's chilling touch.", | 308 msg("You cringe at %s's chilling touch.", |
309 prname(attname, FALSE)); | 309 prname(attname, FALSE)); |
310 chg_str(-1); | 310 chg_str(-1); |
311 if (lost_str++ == 0) | 311 if (lost_str++ == 0) { |
312 fuse(res_strength, 0, CHILLTIME, AFTER); | 312 int fuse_arg = 0; |
313 fuse(res_strength, &fuse_arg, CHILLTIME, AFTER); | |
314 } | |
313 else lengthen(res_strength, CHILLTIME); | 315 else lengthen(res_strength, CHILLTIME); |
314 } | 316 } |
315 } | 317 } |
316 | 318 |
317 /* | 319 /* |
342 player.t_ctype == C_MONK) { | 344 player.t_ctype == C_MONK) { |
343 msg("The wound heals quickly."); | 345 msg("The wound heals quickly."); |
344 } | 346 } |
345 else { | 347 else { |
346 turn_on(*def, HASDISEASE); | 348 turn_on(*def, HASDISEASE); |
347 fuse(cure_disease, 0, roll(HEALTIME,SICKTIME), AFTER); | 349 fuse(cure_disease, NULL, roll(HEALTIME,SICKTIME), AFTER); |
348 msg(terse ? "You have been diseased." | 350 msg(terse ? "You have been diseased." |
349 : "You have contracted a disease!"); | 351 : "You have contracted a disease!"); |
350 } | 352 } |
351 } | 353 } |
352 | 354 |
476 def->t_action != A_FREEZE && | 478 def->t_action != A_FREEZE && |
477 !save(VS_MAGIC, def, -4)) { | 479 !save(VS_MAGIC, def, -4)) { |
478 turn_off(*att, CANDANCE); | 480 turn_off(*att, CANDANCE); |
479 turn_on(*def, ISDANCE); | 481 turn_on(*def, ISDANCE); |
480 msg("You begin to dance uncontrollably!"); | 482 msg("You begin to dance uncontrollably!"); |
481 fuse(undance, 0, roll(2,4), AFTER); | 483 fuse(undance, NULL, roll(2,4), AFTER); |
482 } | 484 } |
483 | 485 |
484 /* | 486 /* |
485 * Suffocating our hero. Monsters don't get suffocated. | 487 * Suffocating our hero. Monsters don't get suffocated. |
486 * That's too hard for now. | 488 * That's too hard for now. |
489 !ISWEARING(R_FREEDOM) && | 491 !ISWEARING(R_FREEDOM) && |
490 rnd(100) < 25 && | 492 rnd(100) < 25 && |
491 (find_slot(suffocate) == 0)) { | 493 (find_slot(suffocate) == 0)) { |
492 turn_on(*att, DIDSUFFOCATE); | 494 turn_on(*att, DIDSUFFOCATE); |
493 msg("%s is beginning to suffocate you.", prname(attname, TRUE)); | 495 msg("%s is beginning to suffocate you.", prname(attname, TRUE)); |
494 fuse(suffocate, 0, roll(9,3), AFTER); | 496 fuse(suffocate, NULL, roll(9,3), AFTER); |
495 } | 497 } |
496 | 498 |
497 /* | 499 /* |
498 * some creatures stops the poor guy from moving. | 500 * some creatures stops the poor guy from moving. |
499 * How can we do this to a monster? | 501 * How can we do this to a monster? |
528 turn_off(*att, CANSMELL); | 530 turn_off(*att, CANSMELL); |
529 if (save(VS_MAGIC, def, 0) || ISWEARING(R_SUSABILITY)) | 531 if (save(VS_MAGIC, def, 0) || ISWEARING(R_SUSABILITY)) |
530 msg("You smell an unpleasant odor."); | 532 msg("You smell an unpleasant odor."); |
531 else { | 533 else { |
532 int odor_str = -(rnd(6)+1); | 534 int odor_str = -(rnd(6)+1); |
533 | 535 int fuse_arg2 = 0; |
534 msg("You are overcome by a foul odor."); | 536 msg("You are overcome by a foul odor."); |
535 if (lost_str == 0) { | 537 if (lost_str == 0) { |
536 chg_str(odor_str); | 538 chg_str(odor_str); |
537 fuse(res_strength, 0, SMELLTIME, AFTER); | 539 fuse(res_strength, &fuse_arg2, SMELLTIME, AFTER); |
538 lost_str -= odor_str; | 540 lost_str -= odor_str; |
539 } | 541 } |
540 else lengthen(res_strength, SMELLTIME); | 542 else lengthen(res_strength, SMELLTIME); |
541 } | 543 } |
542 } | 544 } |