MCPcopy Create free account
hub / github.com/demoth/jake2 / PF_inPHS

Method PF_inPHS

server/src/main/java/jake2/server/SV_GAME.java:178–202  ·  view source on GitHub ↗

PF_inPHS. Also checks portalareas so that doors block sound.

(float[] p1, float[] p2)

Source from the content-addressed store, hash-verified

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) {

Callers 1

inPHSMethod · 0.80

Calls 5

CM_PointLeafnumMethod · 0.80
CM_LeafClusterMethod · 0.80
CM_LeafAreaMethod · 0.80
CM_ClusterPHSMethod · 0.80
CM_AreasConnectedMethod · 0.80

Tested by

no test coverage detected