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

Method PF_inPVS

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

PF_inPVS Also checks portalareas so that doors block sight.

(float[] p1, float[] p2)

Source from the content-addressed store, hash-verified

144 * Also checks portalareas so that doors block sight.
145 */
146 public boolean PF_inPVS(float[] p1, float[] p2) {
147 int leafnum;
148 int cluster;
149 int area1, area2;
150 byte mask[];
151
152 leafnum = gameImports.cm.CM_PointLeafnum(p1);
153 cluster = gameImports.cm.CM_LeafCluster(leafnum);
154 area1 = gameImports.cm.CM_LeafArea(leafnum);
155 mask = gameImports.cm.CM_ClusterPVS(cluster);
156
157 leafnum = gameImports.cm.CM_PointLeafnum(p2);
158 cluster = gameImports.cm.CM_LeafCluster(leafnum);
159 area2 = gameImports.cm.CM_LeafArea(leafnum);
160
161 // quake2 bugfix
162 if (cluster == -1)
163 return false;
164 if (mask != null && (0 == (mask[cluster >>> 3] & (1 << (cluster & 7)))))
165 return false;
166
167 if (!gameImports.cm.CM_AreasConnected(area1, area2))
168 return false; // a door blocks sight
169
170 return true;
171 }
172
173 /**
174 * PF_inPHS.

Callers

nothing calls this directly

Calls 5

CM_PointLeafnumMethod · 0.80
CM_LeafClusterMethod · 0.80
CM_LeafAreaMethod · 0.80
CM_ClusterPVSMethod · 0.80
CM_AreasConnectedMethod · 0.80

Tested by

no test coverage detected