21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
linestyle(float width, int r, int g, int b)
{
glLineWidth(width);
glColor3ub(r, g, b);
}
void
box(block &b, float z1, float z2, float z3, float z4)
{
glBegin(GL_POLYGON);
glVertex3f((float)b.x, z1, (float)b.y);
glVertex3f((float)b.x + b.xs, z2, (float)b.y);
glVertex3f((float)b.x + b.xs, z3, (float)b.y + b.ys);
glVertex3f((float)b.x, z4, (float)b.y + b.ys);
glEnd();
xtraverts += 4;
}
void
dot(int x, int y, float z)
{
|
|
|
|
|
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
linestyle(float width, int r, int g, int b)
{
glLineWidth(width);
glColor3ub(r, g, b);
}
void
box(const block *b, float z1, float z2, float z3, float z4)
{
glBegin(GL_POLYGON);
glVertex3f((float)b->x, z1, (float)b->y);
glVertex3f((float)b->x + b->xs, z2, (float)b->y);
glVertex3f((float)b->x + b->xs, z3, (float)b->y + b->ys);
glVertex3f((float)b->x, z4, (float)b->y + b->ys);
glEnd();
xtraverts += 4;
}
void
dot(int x, int y, float z)
{
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
int type;
sphere *next;
};
sphere spheres[MAXSPHERES], *slist = NULL, *sempty = NULL;
bool sinit = false;
void
newsphere(const OFVector3D &o, float max, int type)
{
if (!sinit) {
loopi(MAXSPHERES)
{
spheres[i].next = sempty;
sempty = &spheres[i];
}
sinit = true;
}
if (sempty) {
sphere *p = sempty;
sempty = p->next;
p->o = o;
p->max = max;
p->size = 1;
p->type = type;
p->next = slist;
slist = p;
}
}
|
|
|
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
int type;
sphere *next;
};
sphere spheres[MAXSPHERES], *slist = NULL, *sempty = NULL;
bool sinit = false;
void
newsphere(const OFVector3D *o, float max, int type)
{
if (!sinit) {
loopi(MAXSPHERES)
{
spheres[i].next = sempty;
sempty = &spheres[i];
}
sinit = true;
}
if (sempty) {
sphere *p = sempty;
sempty = p->next;
p->o = *o;
p->max = max;
p->size = 1;
p->type = type;
p->next = slist;
slist = p;
}
}
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
return;
for (Entity *e in ents) {
if (e.type == NOTUSED)
continue;
OFVector3D v = OFMakeVector3D(e.x, e.y, e.z);
particle_splash(2, 2, 40, v);
}
int e = closestent();
if (e >= 0) {
Entity *c = ents[e];
closeent =
[OFString stringWithFormat:@"closest entity = %@ (%d, %d, "
|
|
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
return;
for (Entity *e in ents) {
if (e.type == NOTUSED)
continue;
OFVector3D v = OFMakeVector3D(e.x, e.y, e.z);
particle_splash(2, 2, 40, &v);
}
int e = closestent();
if (e >= 0) {
Entity *c = ents[e];
closeent =
[OFString stringWithFormat:@"closest entity = %@ (%d, %d, "
|
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
gluUnProject(w / 2, h / 2, depthcorrect(cursordepth), mm, pm, viewport,
&worldx, &worldz, &worldy);
worldpos.x = (float)worldx;
worldpos.y = (float)worldy;
worldpos.z = (float)worldz;
OFVector3D r = OFMakeVector3D(mm[0], mm[4], mm[8]);
OFVector3D u = OFMakeVector3D(mm[1], mm[5], mm[9]);
setorient(r, u);
}
void
drawicon(float tx, float ty, int x, int y)
{
glBindTexture(GL_TEXTURE_2D, 5);
glBegin(GL_QUADS);
|
|
|
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
gluUnProject(w / 2, h / 2, depthcorrect(cursordepth), mm, pm, viewport,
&worldx, &worldz, &worldy);
worldpos.x = (float)worldx;
worldpos.y = (float)worldy;
worldpos.z = (float)worldz;
OFVector3D r = OFMakeVector3D(mm[0], mm[4], mm[8]);
OFVector3D u = OFMakeVector3D(mm[1], mm[5], mm[9]);
setorient(&r, &u);
}
void
drawicon(float tx, float ty, int x, int y)
{
glBindTexture(GL_TEXTURE_2D, 5);
glBegin(GL_QUADS);
|