Check for lava, volatile, or water surface. If contact, make special sound & kill the weapon
| 1047 | |
| 1048 | // Check for lava, volatile, or water surface. If contact, make special sound & kill the weapon |
| 1049 | void check_for_special_surface(object *weapon, int surface_tmap, vector *surface_normal, float hit_dot) { |
| 1050 | bool f_forcefield, f_volatile, f_lava, f_water; |
| 1051 | |
| 1052 | f_forcefield = (GameTextures[surface_tmap].flags & TF_FORCEFIELD) != 0; |
| 1053 | f_volatile = (GameTextures[surface_tmap].flags & TF_VOLATILE) != 0; |
| 1054 | f_lava = (GameTextures[surface_tmap].flags & TF_LAVA) != 0; |
| 1055 | f_water = (GameTextures[surface_tmap].flags & TF_WATER) != 0; |
| 1056 | |
| 1057 | // Kill the weapon if the surface is volatile, lava, or water |
| 1058 | if (f_volatile || f_lava || f_water) { |
| 1059 | int snd; |
| 1060 | ain_hear hear; |
| 1061 | hear.f_directly_player = false; |
| 1062 | |
| 1063 | if (f_water) { |
| 1064 | snd = SOUND_WEAPON_HIT_WATER; |
| 1065 | hear.hostile_level = 0.2f; |
| 1066 | hear.curiosity_level = 0.3f; |
| 1067 | } else if (f_volatile || f_lava) { |
| 1068 | snd = SOUND_WEAPON_HIT_LAVA; |
| 1069 | hear.hostile_level = 0.1f; |
| 1070 | hear.curiosity_level = 0.5f; |
| 1071 | } else |
| 1072 | Int3(); |
| 1073 | |
| 1074 | hear.max_dist = Sounds[snd].max_distance; |
| 1075 | Sound_system.Play3dSound(snd, SND_PRIORITY_NORMAL, weapon); |
| 1076 | AINotify(weapon, AIN_HEAR_NOISE, (void *)&hear); |
| 1077 | |
| 1078 | if (!f_water) |
| 1079 | DoWeaponExploded(weapon, surface_normal); |
| 1080 | |
| 1081 | SetObjectDeadFlag(weapon); |
| 1082 | } |
| 1083 | } |
| 1084 | |
| 1085 | // Process a collision between a weapon and a wall |
| 1086 | // Returns true if the weapon hits the wall, and false if should keep going though the wall (for breakable glass) |
no test coverage detected