… | |
… | |
390 | |
390 | |
391 | /* put in a few special messages for some of the common attacktypes |
391 | /* put in a few special messages for some of the common attacktypes |
392 | * a player might have. For example, fire, electric, cold, etc |
392 | * a player might have. For example, fire, electric, cold, etc |
393 | * [garbled 20010919] |
393 | * [garbled 20010919] |
394 | */ |
394 | */ |
395 | |
|
|
396 | if (dam == 9998 && op->type == DOOR) |
395 | if (dam == 9998 && op->type == DOOR) |
397 | { |
396 | { |
398 | sprintf (buf1, "unlock %s", &op->name); |
397 | sprintf (buf1, "unlock %s", &op->name); |
399 | sprintf (buf2, " unlocks"); |
398 | sprintf (buf2, " unlocks"); |
400 | found++; |
399 | found++; |
401 | } |
400 | } |
402 | if (dam < 0) |
401 | else if (dam < 0) |
403 | { |
402 | { |
404 | sprintf (buf1, "hit %s", &op->name); |
403 | sprintf (buf1, "hit %s", &op->name); |
405 | sprintf (buf2, " hits"); |
404 | sprintf (buf2, " hits"); |
406 | found++; |
405 | found++; |
407 | } |
406 | } |
… | |
… | |
529 | strcpy (buf2, attack_mess[ATM_FIRE][i].buf3); |
528 | strcpy (buf2, attack_mess[ATM_FIRE][i].buf3); |
530 | found++; |
529 | found++; |
531 | break; |
530 | break; |
532 | } |
531 | } |
533 | } |
532 | } |
534 | else if (hitter->current_weapon != NULL) |
533 | else if (hitter->current_weapon) |
535 | { |
534 | { |
536 | int mtype; |
535 | int mtype; |
537 | |
536 | |
538 | switch (hitter->current_weapon->weapontype) |
537 | switch (hitter->current_weapon->weapontype) |
539 | { |
538 | { |
… | |
… | |
677 | op->play_sound (sound_find ("player_hits4")); |
676 | op->play_sound (sound_find ("player_hits4")); |
678 | new_draw_info (NDI_BLACK, 0, hitter->owner, buf); |
677 | new_draw_info (NDI_BLACK, 0, hitter->owner, buf); |
679 | } |
678 | } |
680 | } |
679 | } |
681 | |
680 | |
682 | |
|
|
683 | static int |
681 | static int |
684 | get_attack_mode (object **target, object **hitter, int *simple_attack) |
682 | get_attack_mode (object **target, object **hitter, int *simple_attack) |
685 | { |
683 | { |
686 | if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED)) |
684 | if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED)) |
687 | { |
685 | { |
688 | LOG (llevError, "BUG: get_attack_mode(): freed object\n"); |
686 | LOG (llevError, "BUG: get_attack_mode(): freed object\n"); |
689 | return 1; |
687 | return 1; |
690 | } |
688 | } |
691 | |
689 | |
692 | if ((*target)->head) |
|
|
693 | *target = (*target)->head; |
690 | *target = (*target)->head_ (); |
694 | |
|
|
695 | if ((*hitter)->head) |
|
|
696 | *hitter = (*hitter)->head; |
691 | *hitter = (*hitter)->head_ (); |
697 | |
692 | |
698 | if ((*target)->type == LOCKED_DOOR) |
693 | if ((*target)->type == LOCKED_DOOR) |
699 | return 1; // locked doors cannot be hit |
694 | return 1; // locked doors cannot be hit |
700 | |
695 | |
701 | if ((*hitter)->env || (*target)->env) |
696 | if ((*hitter)->env || (*target)->env) |
… | |
… | |
719 | } |
714 | } |
720 | |
715 | |
721 | static int |
716 | static int |
722 | abort_attack (object *target, object *hitter, int simple_attack) |
717 | abort_attack (object *target, object *hitter, int simple_attack) |
723 | { |
718 | { |
724 | |
|
|
725 | /* Check if target and hitter are still in a relation similar to the one |
719 | /* Check if target and hitter are still in a relation similar to the one |
726 | * determined by get_attack_mode(). Returns true if the relation has changed. |
720 | * determined by get_attack_mode(). Returns true if the relation has changed. |
727 | */ |
721 | */ |
728 | int new_mode; |
722 | int new_mode; |
729 | |
723 | |
730 | if (hitter->env == target || target->env == hitter) |
724 | if (hitter->env == target || target->env == hitter) |
731 | new_mode = 1; |
725 | new_mode = 1; |
732 | else if (QUERY_FLAG (hitter, FLAG_REMOVED) || QUERY_FLAG (target, FLAG_REMOVED) || hitter->map == NULL || !on_same_map (hitter, target)) |
726 | else if (QUERY_FLAG (hitter, FLAG_REMOVED) || QUERY_FLAG (target, FLAG_REMOVED) |
|
|
727 | || hitter->map == NULL || !on_same_map (hitter, target)) |
733 | return 1; |
728 | return 1; |
734 | else |
729 | else |
735 | new_mode = 0; |
730 | new_mode = 0; |
|
|
731 | |
736 | return new_mode != simple_attack; |
732 | return new_mode != simple_attack; |
737 | } |
733 | } |
738 | |
734 | |
739 | static void thrown_item_effect (object *, object *); |
735 | static void thrown_item_effect (object *, object *); |
740 | |
736 | |