Process a collision between a weapon and a wall Returns true if the weapon hits the wall, and false if should keep going though the wall (for breakable glass)
| 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) |
| 1087 | bool collide_weapon_and_wall(object *weapon, fix hitspeed, int hitseg, int hitwall, vector *hitpnt, vector *wall_normal, |
| 1088 | float hit_dot) { |
| 1089 | bool f_forcefield; |
| 1090 | bool f_volatile, f_lava, f_water; |
| 1091 | // mprintf(0, "Weapon hit wall, how nice.\n"); |
| 1092 | |
| 1093 | // #ifndef RELEASE |
| 1094 | if ((stricmp(Weapons[weapon->id].name, "Yellow flare") == 0) && (weapon->parent_handle == Player_object->handle) && |
| 1095 | (KEY_STATE(KEY_LAPOSTRO))) { |
| 1096 | if (ROOMNUM_OUTSIDE(hitseg)) { |
| 1097 | AddHUDMessage("Terrain cell %d", CELLNUM(hitseg)); |
| 1098 | } else { |
| 1099 | AddHUDMessage("Room %d face %d", hitseg, hitwall); |
| 1100 | } |
| 1101 | } |
| 1102 | // #endif |
| 1103 | |
| 1104 | // Check if forcefield |
| 1105 | int tmap; |
| 1106 | if (!ROOMNUM_OUTSIDE(hitseg)) // Make sure we've hit a wall, and not terrain |
| 1107 | { |
| 1108 | tmap = Rooms[hitseg].faces[hitwall].tmap; |
| 1109 | } else { |
| 1110 | tmap = Terrain_tex_seg[Terrain_seg[CELLNUM(hitseg)].texseg_index].tex_index; |
| 1111 | } |
| 1112 | f_forcefield = (GameTextures[tmap].flags & TF_FORCEFIELD) != 0; |
| 1113 | f_volatile = (GameTextures[tmap].flags & TF_VOLATILE) != 0; |
| 1114 | f_lava = (GameTextures[tmap].flags & TF_LAVA) != 0; |
| 1115 | f_water = (GameTextures[tmap].flags & TF_WATER) != 0; |
| 1116 | |
| 1117 | if (f_forcefield && !(Weapons[weapon->id].flags & WF_MATTER_WEAPON)) { |
| 1118 | ain_hear hear; |
| 1119 | hear.f_directly_player = false; |
| 1120 | hear.hostile_level = 0.9f; |
| 1121 | hear.curiosity_level = 0.1f; |
| 1122 | |
| 1123 | if (sound_override_force_field == -1) |
| 1124 | hear.max_dist = Sounds[SOUND_FORCEFIELD_BOUNCE].max_distance; |
| 1125 | else |
| 1126 | hear.max_dist = Sounds[sound_override_force_field].max_distance; |
| 1127 | |
| 1128 | AINotify(weapon, AIN_HEAR_NOISE, (void *)&hear); |
| 1129 | |
| 1130 | if (sound_override_force_field == -1) |
| 1131 | Sound_system.Play3dSound(SOUND_FORCEFIELD_BOUNCE, SND_PRIORITY_HIGH, weapon); |
| 1132 | else |
| 1133 | Sound_system.Play3dSound(sound_override_force_field, SND_PRIORITY_HIGH, weapon); |
| 1134 | |
| 1135 | return true; |
| 1136 | } |
| 1137 | |
| 1138 | // Check for destroyable or breakable face |
| 1139 | if (!ROOMNUM_OUTSIDE(hitseg)) // First, make sure we've hit a wall, and not terrain |
| 1140 | { |
| 1141 | room *rp = &Rooms[hitseg]; |
| 1142 | face *fp = &rp->faces[hitwall]; |
| 1143 | |
| 1144 | // Check for a trigger on this wall |
no test coverage detected