1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// world.cpp: core map management stuff
#include "cube.h"
extern OFString *entnames[]; // lookup from map entities above to strings
sqr *world = NULL;
int sfactor, ssize, cubicsize, mipsize;
header hdr;
void
settag(int tag, int type) // set all cubes with "tag" to space, if tag is 0 then
// reset ALL tagged cubes according to type
{
int maxx = 0, maxy = 0, minx = ssize, miny = ssize;
loop(x, ssize) loop(y, ssize)
{
sqr *s = S(x, y);
if (s->tag) {
if (tag) {
|
>
>
>
>
|
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// world.cpp: core map management stuff
#include "cube.h"
#import "DynamicEntity.h"
extern OFString *entnames[]; // lookup from map entities above to strings
sqr *world = NULL;
int sfactor, ssize, cubicsize, mipsize;
header hdr;
// set all cubes with "tag" to space, if tag is 0 then reset ALL tagged cubes
// according to type
void
settag(int tag, int type)
{
int maxx = 0, maxy = 0, minx = ssize, miny = ssize;
loop(x, ssize) loop(y, ssize)
{
sqr *s = S(x, y);
if (s->tag) {
if (tag) {
|
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
float bdist = 99999;
loopv(ents)
{
entity &e = ents[i];
if (e.type == NOTUSED)
continue;
OFVector3D v = OFMakeVector3D(e.x, e.y, e.z);
vdist(dist, t, player1->o, v);
if (dist < bdist) {
best = i;
bdist = dist;
}
}
return bdist == 99999 ? -1 : best;
}
|
|
|
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
float bdist = 99999;
loopv(ents)
{
entity &e = ents[i];
if (e.type == NOTUSED)
continue;
OFVector3D v = OFMakeVector3D(e.x, e.y, e.z);
vdist(dist, t, player1.o, v);
if (dist < bdist) {
best = i;
bdist = dist;
}
}
return bdist == 99999 ? -1 : best;
}
|
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
case MAPMODEL:
e.attr4 = e.attr3;
e.attr3 = e.attr2;
case MONSTER:
case TELEDEST:
e.attr2 = (uchar)e.attr1;
case PLAYERSTART:
e.attr1 = (int)player1->yaw;
break;
}
addmsg(1, 10, SV_EDITENT, ents.length(), type, e.x, e.y, e.z, e.attr1,
e.attr2, e.attr3, e.attr4);
ents.add(*((entity *)&e)); // unsafe!
if (type == LIGHT)
calclight();
|
|
|
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
case MAPMODEL:
e.attr4 = e.attr3;
e.attr3 = e.attr2;
case MONSTER:
case TELEDEST:
e.attr2 = (uchar)e.attr1;
case PLAYERSTART:
e.attr1 = (int)player1.yaw;
break;
}
addmsg(1, 10, SV_EDITENT, ents.length(), type, e.x, e.y, e.z, e.attr1,
e.attr2, e.attr3, e.attr4);
ents.add(*((entity *)&e)); // unsafe!
if (type == LIGHT)
calclight();
|