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

Method SV_CreateAreaNode

server/src/main/java/jake2/server/SV_WORLD.java:79–111  ·  view source on GitHub ↗
(int depth, float[] mins,
                                                float[] maxs, GameImportsImpl gameImports)

Source from the content-addressed store, hash-verified

77 * ===============
78 */
79 private static areanode_t SV_CreateAreaNode(int depth, float[] mins,
80 float[] maxs, GameImportsImpl gameImports) {
81 areanode_t anode;
82 float[] size = { 0, 0, 0 };
83 float[] mins1 = { 0, 0, 0 }, maxs1 = { 0, 0, 0 }, mins2 = { 0, 0, 0 }, maxs2 = {
84 0, 0, 0 };
85 anode = gameImports.world.sv_areanodes[gameImports.world.sv_numareanodes];
86 // just for debugging (rst)
87// Math3D.VectorCopy(mins, anode.mins_rst);
88// Math3D.VectorCopy(maxs, anode.maxs_rst);
89 gameImports.world.sv_numareanodes++;
90 ClearLink(anode.trigger_edicts);
91 ClearLink(anode.solid_edicts);
92 if (depth == Defines.AREA_DEPTH) {
93 anode.axis = -1;
94 anode.children[0] = anode.children[1] = null;
95 return anode;
96 }
97 Math3D.VectorSubtract(maxs, mins, size);
98 if (size[0] > size[1])
99 anode.axis = 0;
100 else
101 anode.axis = 1;
102 anode.dist = 0.5f * (maxs[anode.axis] + mins[anode.axis]);
103 Math3D.VectorCopy(mins, mins1);
104 Math3D.VectorCopy(mins, mins2);
105 Math3D.VectorCopy(maxs, maxs1);
106 Math3D.VectorCopy(maxs, maxs2);
107 maxs1[anode.axis] = mins2[anode.axis] = anode.dist;
108 anode.children[0] = SV_CreateAreaNode(depth + 1, mins2, maxs2, gameImports);
109 anode.children[1] = SV_CreateAreaNode(depth + 1, mins1, maxs1, gameImports);
110 return anode;
111 }
112
113 /*
114 * =============== SV_ClearWorld

Callers 1

SV_ClearWorldMethod · 0.95

Calls 3

ClearLinkMethod · 0.95
VectorSubtractMethod · 0.95
VectorCopyMethod · 0.95

Tested by

no test coverage detected