PF_inPHS. Also checks portalareas so that doors block sound.
(float[] p1, float[] p2)
| 176 | * Also checks portalareas so that doors block sound. |
| 177 | */ |
| 178 | public boolean PF_inPHS(float[] p1, float[] p2) { |
| 179 | int leafnum; |
| 180 | int cluster; |
| 181 | int area1, area2; |
| 182 | byte mask[]; |
| 183 | |
| 184 | leafnum = gameImports.cm.CM_PointLeafnum(p1); |
| 185 | cluster = gameImports.cm.CM_LeafCluster(leafnum); |
| 186 | area1 = gameImports.cm.CM_LeafArea(leafnum); |
| 187 | mask = gameImports.cm.CM_ClusterPHS(cluster); |
| 188 | |
| 189 | leafnum = gameImports.cm.CM_PointLeafnum(p2); |
| 190 | cluster = gameImports.cm.CM_LeafCluster(leafnum); |
| 191 | area2 = gameImports.cm.CM_LeafArea(leafnum); |
| 192 | |
| 193 | // quake2 bugfix |
| 194 | if (cluster == -1) |
| 195 | return false; |
| 196 | if (mask != null && (0 == (mask[cluster >> 3] & (1 << (cluster & 7))))) |
| 197 | return false; // more than one bounce away |
| 198 | if (!gameImports.cm.CM_AreasConnected(area1, area2)) |
| 199 | return false; // a door blocks hearing |
| 200 | |
| 201 | return true; |
| 202 | } |
| 203 | |
| 204 | public void PF_StartSound(edict_t entity, int channel, |
| 205 | int sound_num, float volume, float attenuation, float timeofs) { |
no test coverage detected