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

Method findradius

game/src/main/java/jake2/game/GameBase.java:116–144  ·  view source on GitHub ↗

Returns entities that have origins within a spherical area.

(EdictIterator from, float[] org,
                                           float rad, GameExportsImpl gameExports)

Source from the content-addressed store, hash-verified

114 * Returns entities that have origins within a spherical area.
115 */
116 public static EdictIterator findradius(EdictIterator from, float[] org,
117 float rad, GameExportsImpl gameExports) {
118 float[] eorg = { 0, 0, 0 };
119 int j;
120
121 if (from == null)
122 from = new EdictIterator(0);
123 else
124 from.i++;
125
126 for (; from.i < gameExports.num_edicts; from.i++) {
127 from.o = gameExports.g_edicts[from.i];
128 if (!from.o.inuse)
129 continue;
130
131 if (from.o.solid == Defines.SOLID_NOT)
132 continue;
133
134 for (j = 0; j < 3; j++)
135 eorg[j] = org[j]
136 - (from.o.s.origin[j] + (from.o.mins[j] + from.o.maxs[j]) * 0.5f);
137
138 if (Math3D.VectorLength(eorg) > rad)
139 continue;
140 return from;
141 }
142
143 return null;
144 }
145
146 /*
147 * Searches all active entities for the next one that holds the matching

Callers 3

T_RadiusDamageMethod · 0.95
thinkMethod · 0.95
medic_FindDeadMonsterMethod · 0.95

Calls 1

VectorLengthMethod · 0.95

Tested by

no test coverage detected