Returns entities that have origins within a spherical area.
(EdictIterator from, float[] org,
float rad, GameExportsImpl gameExports)
| 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 |
no test coverage detected