| 2154 | } |
| 2155 | |
| 2156 | void collide_generic_and_weapon(object *robotobj, object *weapon, vector *collision_point, vector *collision_normal, |
| 2157 | bool f_reverse_normal, fvi_info *hit_info) { |
| 2158 | object *parent_obj; |
| 2159 | float damage_to_apply; |
| 2160 | uint8_t electrical = (Weapons[weapon->id].flags & WF_ELECTRICAL) ? 1 : 0; |
| 2161 | bool f_stick = ((weapon->mtype.phys_info.flags & PF_STICK) != 0); |
| 2162 | bool f_energy = ((Weapons[weapon->id].flags & WF_MATTER_WEAPON) == 0); |
| 2163 | int damage_type; |
| 2164 | |
| 2165 | // Check for lava & volatile surfaces on an object |
| 2166 | if ((robotobj->type == OBJ_BUILDING) && hit_info) { |
| 2167 | poly_model *pm = GetPolymodelPointer(robotobj->rtype.pobj_info.model_num); |
| 2168 | int tmap = pm->textures[pm->submodel[hit_info->hit_subobject[0]].faces[hit_info->hit_face[0]].texnum]; |
| 2169 | vector *normal = &hit_info->hit_wallnorm[0]; |
| 2170 | |
| 2171 | DoWallEffects(weapon, tmap); |
| 2172 | |
| 2173 | check_for_special_surface(weapon, tmap, normal, 1.0); |
| 2174 | |
| 2175 | // If object died, stop processing |
| 2176 | if (weapon->flags & OF_DEAD) |
| 2177 | return; |
| 2178 | } |
| 2179 | |
| 2180 | if (Weapons[weapon->id].flags & WF_NAPALM) |
| 2181 | damage_type = GD_FIRE; |
| 2182 | else if (Weapons[weapon->id].flags & WF_MATTER_WEAPON) |
| 2183 | damage_type = GD_MATTER; |
| 2184 | else if (Weapons[weapon->id].flags & WF_ELECTRICAL) |
| 2185 | damage_type = GD_ELECTRIC; |
| 2186 | else |
| 2187 | damage_type = GD_ENERGY; |
| 2188 | |
| 2189 | if (f_reverse_normal) |
| 2190 | *collision_normal *= -1.0f; |
| 2191 | |
| 2192 | if (robotobj->flags & OF_DYING) |
| 2193 | robotobj->ctype.dying_info.delay_time *= 0.975f; |
| 2194 | |
| 2195 | if (Weapons[weapon->id].sounds[WSI_IMPACT_WALL] != SOUND_NONE_INDEX) { |
| 2196 | Sound_system.Play3dSound(Weapons[weapon->id].sounds[WSI_IMPACT_WALL], SND_PRIORITY_HIGH, weapon); |
| 2197 | |
| 2198 | ain_hear hear; |
| 2199 | hear.f_directly_player = false; |
| 2200 | if (robotobj->control_type == CT_AI) { |
| 2201 | hear.hostile_level = 1.0f; |
| 2202 | hear.curiosity_level = 0.1f; |
| 2203 | } else if (robotobj->type == OBJ_DOOR) { |
| 2204 | hear.hostile_level = 0.5f; |
| 2205 | hear.curiosity_level = 1.0f; |
| 2206 | } else { |
| 2207 | hear.hostile_level = .9f; |
| 2208 | hear.curiosity_level = 0.5f; |
| 2209 | } |
| 2210 | |
| 2211 | hear.max_dist = Sounds[Weapons[weapon->id].sounds[WSI_IMPACT_WALL]].max_distance; |
| 2212 | AINotify(weapon, AIN_HEAR_NOISE, (void *)&hear); |
| 2213 | } |
no test coverage detected