… | |
… | |
1018 | * arrow, move_apply() calls this function, arrow sticks in demon, |
1018 | * arrow, move_apply() calls this function, arrow sticks in demon, |
1019 | * attack_ob_simple() returns, and we've got an arrow that still exists |
1019 | * attack_ob_simple() returns, and we've got an arrow that still exists |
1020 | * but is no longer on the map. Ugh. (Beware: Such things can happen at |
1020 | * but is no longer on the map. Ugh. (Beware: Such things can happen at |
1021 | * other places as well!) |
1021 | * other places as well!) |
1022 | */ |
1022 | */ |
1023 | if (hitter->destroyed () || hitter->env != NULL) |
1023 | if (hitter->destroyed () || hitter->env) |
1024 | { |
1024 | { |
1025 | if (container) |
1025 | if (container) |
1026 | container->destroy (); |
1026 | container->destroy (); |
1027 | |
1027 | |
1028 | return 0; |
1028 | return 0; |
1029 | } |
1029 | } |
1030 | |
1030 | |
1031 | /* Missile hit victim */ |
1031 | /* Missile hit victim */ |
1032 | /* if the speed is > 10, then this is a fast moving arrow, we go straight |
1032 | /* if the speed is >= 10, then this is a fast moving arrow, we go straight |
1033 | * through the target |
1033 | * through the target |
1034 | */ |
1034 | */ |
1035 | if (hit_something && op->speed <= 10.0) |
1035 | if (hit_something) |
|
|
1036 | if (op->speed < 10.0) |
1036 | { |
1037 | { |
1037 | /* Stop arrow */ |
1038 | /* Stop arrow */ |
1038 | if (!container) |
1039 | if (!container) |
1039 | { |
1040 | { |
1040 | hitter = fix_stopped_arrow (hitter); |
1041 | hitter = fix_stopped_arrow (hitter); |
1041 | if (!hitter) |
1042 | if (!hitter) |
1042 | return 0; |
1043 | return 0; |
1043 | } |
1044 | } |
1044 | else |
1045 | else |
1045 | container->destroy (); |
1046 | container->destroy (); |
1046 | |
1047 | |
1047 | /* Try to stick arrow into victim */ |
1048 | /* Try to stick arrow into victim */ |
1048 | if (!victim->destroyed () && stick_arrow (hitter, victim)) |
1049 | if (!victim->destroyed () && stick_arrow (hitter, victim)) |
|
|
1050 | return 0; |
|
|
1051 | |
|
|
1052 | /* Else try to put arrow on victim's map square |
|
|
1053 | * remove check for P_WALL here. If the arrow got to this |
|
|
1054 | * space, that is good enough - with the new movement code, |
|
|
1055 | * there is now the potential for lots of spaces where something |
|
|
1056 | * can fly over but not otherwise move over. What is the correct |
|
|
1057 | * way to handle those otherwise? |
|
|
1058 | */ |
|
|
1059 | if (victim->x != hitter->x || victim->y != hitter->y) |
|
|
1060 | { |
|
|
1061 | if (victim->destroyed ()) |
|
|
1062 | hitter->destroy (); |
|
|
1063 | else |
|
|
1064 | { |
|
|
1065 | hitter->remove (); |
|
|
1066 | hitter->x = victim->x; |
|
|
1067 | hitter->y = victim->y; |
|
|
1068 | insert_ob_in_map (hitter, victim->map, hitter, 0); |
|
|
1069 | } |
|
|
1070 | } |
|
|
1071 | else |
|
|
1072 | /* Else leave arrow where it is */ |
|
|
1073 | merge_ob (hitter, NULL); |
|
|
1074 | |
1049 | return 0; |
1075 | return 0; |
1050 | |
|
|
1051 | /* Else try to put arrow on victim's map square |
|
|
1052 | * remove check for P_WALL here. If the arrow got to this |
|
|
1053 | * space, that is good enough - with the new movement code, |
|
|
1054 | * there is now the potential for lots of spaces where something |
|
|
1055 | * can fly over but not otherwise move over. What is the correct |
|
|
1056 | * way to handle those otherwise? |
|
|
1057 | */ |
|
|
1058 | if (victim->x != hitter->x || victim->y != hitter->y) |
|
|
1059 | { |
|
|
1060 | if (victim->destroyed ()) |
|
|
1061 | hitter->destroy (); |
|
|
1062 | else |
|
|
1063 | { |
|
|
1064 | hitter->remove (); |
|
|
1065 | hitter->x = victim->x; |
|
|
1066 | hitter->y = victim->y; |
|
|
1067 | insert_ob_in_map (hitter, victim->map, hitter, 0); |
|
|
1068 | } |
|
|
1069 | } |
1076 | } |
1070 | else |
1077 | else |
1071 | /* Else leave arrow where it is */ |
|
|
1072 | merge_ob (hitter, NULL); |
|
|
1073 | |
|
|
1074 | return 0; |
|
|
1075 | } |
|
|
1076 | |
|
|
1077 | if (hit_something && op->speed >= 10.0) |
|
|
1078 | op->set_speed (op->speed - 1.f); |
1078 | op->set_speed (op->speed - 1.f); |
1079 | |
1079 | |
1080 | /* Missile missed victim - reassemble missile */ |
1080 | /* Missile missed victim - reassemble missile */ |
1081 | if (container) |
1081 | if (container) |
1082 | { |
1082 | { |
1083 | hitter->remove (); |
1083 | hitter->remove (); |