252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
int best;
float bdist = 99999;
loopv(ents)
{
entity &e = ents[i];
if (e.type == NOTUSED)
continue;
vec v = {e.x, e.y, e.z};
vdist(dist, t, player1->o, v);
if (dist < bdist) {
best = i;
bdist = dist;
};
};
return bdist == 99999 ? -1 : best;
|
|
|
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
int best;
float bdist = 99999;
loopv(ents)
{
entity &e = ents[i];
if (e.type == NOTUSED)
continue;
vec v = {(float)e.x, (float)e.y, (float)e.z};
vdist(dist, t, player1->o, v);
if (dist < bdist) {
best = i;
bdist = dist;
};
};
return bdist == 99999 ? -1 : best;
|
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
return NOTUSED;
}
entity *
newentity(int x, int y, int z, char *what, int v1, int v2, int v3, int v4)
{
int type = findtype(what);
persistent_entity e = {x, y, z, v1, type, v2, v3, v4};
switch (type) {
case LIGHT:
if (v1 > 32)
v1 = 32;
if (!v1)
e.attr1 = 16;
if (!v2 && !v3 && !v4)
|
|
>
|
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
return NOTUSED;
}
entity *
newentity(int x, int y, int z, char *what, int v1, int v2, int v3, int v4)
{
int type = findtype(what);
persistent_entity e = {(short)x, (short)y, (short)z, (short)v1,
(uchar)type, (uchar)v2, (uchar)v3, (uchar)v4};
switch (type) {
case LIGHT:
if (v1 > 32)
v1 = 32;
if (!v1)
e.attr1 = 16;
if (!v2 && !v3 && !v4)
|