Cube  Diff

Differences From Artifact [efc1c2688d]:

To Artifact [f1478ac26e]:


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
blendbox(int x1, int y1, int x2, int y2, bool border)
{
	glDepthMask(GL_FALSE);
	glDisable(GL_TEXTURE_2D);
	glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
	glBegin(GL_QUADS);
	if (border)
		[[OFColor colorWithRed:0.5f
				 green:0.3f
				  blue:0.4f
				 alpha:1.0f] cube_setAsGLColor];
	else
		[OFColor.white cube_setAsGLColor];
	glVertex2i(x1, y1);
	glVertex2i(x2, y1);
	glVertex2i(x2, y2);
	glVertex2i(x1, y2);
	glEnd();
	glDisable(GL_BLEND);
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	glBegin(GL_POLYGON);
	[[OFColor colorWithRed:0.2f
			 green:0.7f
			  blue:0.4f
			 alpha:1.0f] cube_setAsGLColor];
	glVertex2i(x1, y1);
	glVertex2i(x2, y1);
	glVertex2i(x2, y2);
	glVertex2i(x1, y2);
	glEnd();
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	xtraverts += 8;







|
|
|
|










|
|
|
|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
blendbox(int x1, int y1, int x2, int y2, bool border)
{
	glDepthMask(GL_FALSE);
	glDisable(GL_TEXTURE_2D);
	glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
	glBegin(GL_QUADS);
	if (border)
		[[OFColor colorWithRed: 0.5f
				 green: 0.3f
				  blue: 0.4f
				 alpha: 1.0f] cube_setAsGLColor];
	else
		[OFColor.white cube_setAsGLColor];
	glVertex2i(x1, y1);
	glVertex2i(x2, y1);
	glVertex2i(x2, y2);
	glVertex2i(x1, y2);
	glEnd();
	glDisable(GL_BLEND);
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	glBegin(GL_POLYGON);
	[[OFColor colorWithRed: 0.2f
			 green: 0.7f
			  blue: 0.4f
			 alpha: 1.0f] cube_setAsGLColor];
	glVertex2i(x1, y1);
	glVertex2i(x2, y1);
	glVertex2i(x2, y2);
	glVertex2i(x1, y2);
	glEnd();
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	xtraverts += 8;
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	glBindTexture(GL_TEXTURE_2D, 4);

	for (struct sphere *p, **pp = &slist; (p = *pp) != NULL;) {
		glPushMatrix();
		float size = p->size / p->max;
		[[OFColor colorWithRed:1.0f
				 green:1.0f
				  blue:1.0f
				 alpha:1.0f - size] cube_setAsGLColor];
		glTranslatef(p->o.x, p->o.z, p->o.y);
		glRotatef(lastmillis / 5.0f, 1, 1, 1);
		glScalef(p->size, p->size, p->size);
		glCallList(1);
		glScalef(0.8f, 0.8f, 0.8f);
		glCallList(1);
		glPopMatrix();







|
|
|
|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
	glBindTexture(GL_TEXTURE_2D, 4);

	for (struct sphere *p, **pp = &slist; (p = *pp) != NULL;) {
		glPushMatrix();
		float size = p->size / p->max;
		[[OFColor colorWithRed: 1.0f
				 green: 1.0f
				  blue: 1.0f
				 alpha: 1.0f - size] cube_setAsGLColor];
		glTranslatef(p->o.x, p->o.z, p->o.y);
		glRotatef(lastmillis / 5.0f, 1, 1, 1);
		glScalef(p->size, p->size, p->size);
		glCallList(1);
		glScalef(0.8f, 0.8f, 0.8f);
		glCallList(1);
		glPopMatrix();
203
204
205
206
207
208
209
210

211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
		particle_splash(2, 2, 40, OFMakeVector3D(e.x, e.y, e.z));
	}

	int e = closestent();
	if (e >= 0) {
		Entity *c = ents[e];
		closeent =
		    [OFString stringWithFormat:@"closest entity = %@ (%d, %d, "

		                               @"%d, %d), selection = (%d, %d)",
		        entnames[c.type], c.attr1, c.attr2, c.attr3, c.attr4,
		        getvar(@"selxs"), getvar(@"selys")];
	}
}

COMMAND(loadsky, ARG_1STR, (^(OFString *basename) {
	static OFString *lastsky = @"";

	basename = [basename stringByReplacingOccurrencesOfString:@"\\"
	                                               withString:@"/"];

	if ([lastsky isEqual:basename])
		return;

	static const OFString *side[] = { @"ft", @"bk", @"lf", @"rt", @"dn",
		@"up" };
	int texnum = 14;
	for (int i = 0; i < 6; i++) {
		OFString *path = [OFString
		    stringWithFormat:@"packages/%@_%@.jpg", basename, side[i]];

		int xs, ys;
		if (!installtex(texnum + i,
		        [Cube.sharedInstance.gameDataIRI
		            IRIByAppendingPathComponent:path],
		        &xs, &ys, true))
			conoutf(@"could not load sky textures");
	}

	lastsky = basename;
}))

float cursordepth = 0.9f;







|
>
|





|


|
|

|






|
|


|
<
|
<







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

236

237
238
239
240
241
242
243
		particle_splash(2, 2, 40, OFMakeVector3D(e.x, e.y, e.z));
	}

	int e = closestent();
	if (e >= 0) {
		Entity *c = ents[e];
		closeent =
		    [OFString stringWithFormat:
			@"closest entity = %@ (%d, %d, %d, %d), "
			@"selection = (%d, %d)",
		        entnames[c.type], c.attr1, c.attr2, c.attr3, c.attr4,
		        getvar(@"selxs"), getvar(@"selys")];
	}
}

COMMAND(loadsky, ARG_1STR, (^ (OFString *basename) {
	static OFString *lastsky = @"";

	basename = [basename stringByReplacingOccurrencesOfString: @"\\"
	                                               withString: @"/"];

	if ([lastsky isEqual: basename])
		return;

	static const OFString *side[] = { @"ft", @"bk", @"lf", @"rt", @"dn",
		@"up" };
	int texnum = 14;
	for (int i = 0; i < 6; i++) {
		OFString *path = [OFString stringWithFormat:
		    @"packages/%@_%@.jpg", basename, side[i]];

		int xs, ys;
		if (!installtex(texnum + i, [Cube.sharedInstance.gameDataIRI

		    IRIByAppendingPathComponent: path], &xs, &ys, true))

			conoutf(@"could not load sky textures");
	}

	lastsky = basename;
}))

float cursordepth = 0.9f;
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379

	glDepthMask(GL_FALSE);

	if (dblend || underwater) {
		glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
		glBegin(GL_QUADS);
		if (dblend)
			[[OFColor colorWithRed:0.0f
					 green:0.9f
					  blue:0.9f
					 alpha:1.0f] cube_setAsGLColor];
		else
			[[OFColor colorWithRed:0.9f
					 green:0.5f
					  blue:0.0f
					 alpha:1.0f] cube_setAsGLColor];
		glVertex2i(0, 0);
		glVertex2i(VIRTW, 0);
		glVertex2i(VIRTW, VIRTH);
		glVertex2i(0, VIRTH);
		glEnd();
		dblend -= curtime / 3;
		if (dblend < 0)







|
|
|
|

|
|
|
|







356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

	glDepthMask(GL_FALSE);

	if (dblend || underwater) {
		glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
		glBegin(GL_QUADS);
		if (dblend)
			[[OFColor colorWithRed: 0.0f
					 green: 0.9f
					  blue: 0.9f
					 alpha: 1.0f] cube_setAsGLColor];
		else
			[[OFColor colorWithRed: 0.9f
					 green: 0.5f
					  blue: 0.0f
					 alpha: 1.0f] cube_setAsGLColor];
		glVertex2i(0, 0);
		glVertex2i(VIRTW, 0);
		glVertex2i(VIRTW, VIRTH);
		glVertex2i(0, VIRTH);
		glEnd();
		dblend -= curtime / 3;
		if (dblend < 0)
400
401
402
403
404
405
406
407
408
409

410
411
412
413
414
415
416
417
		[OFColor.white cube_setAsGLColor];
		if (crosshairfx) {
			if (player1.gunWait)
				[OFColor.gray cube_setAsGLColor];
			else if (player1.health <= 25)
				[OFColor.red cube_setAsGLColor];
			else if (player1.health <= 50)
				[[OFColor colorWithRed:1.0f
						 green:0.5f
						  blue:0.0f

						 alpha:1.0f] cube_setAsGLColor];
		}
		float chsize = (float)crosshairsize;
		glTexCoord2d(0.0, 0.0);
		glVertex2f(VIRTW / 2 - chsize, VIRTH / 2 - chsize);
		glTexCoord2d(1.0, 0.0);
		glVertex2f(VIRTW / 2 + chsize, VIRTH / 2 - chsize);
		glTexCoord2d(1.0, 1.0);







|
|
|
>
|







399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
		[OFColor.white cube_setAsGLColor];
		if (crosshairfx) {
			if (player1.gunWait)
				[OFColor.gray cube_setAsGLColor];
			else if (player1.health <= 25)
				[OFColor.red cube_setAsGLColor];
			else if (player1.health <= 50)
				[[OFColor colorWithRed: 1.0f
						 green: 0.5f
						  blue: 0.0f
						 alpha: 1.0f]
				    cube_setAsGLColor];
		}
		float chsize = (float)crosshairsize;
		glTexCoord2d(0.0, 0.0);
		glVertex2f(VIRTW / 2 - chsize, VIRTH / 2 - chsize);
		glTexCoord2d(1.0, 0.0);
		glVertex2f(VIRTW / 2 + chsize, VIRTH / 2 - chsize);
		glTexCoord2d(1.0, 1.0);