Cube  Check-in [932a90c261]

Overview
Comment:Make more use of OFColor
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 932a90c261ff698efcf7980c8790080622cd79e5e6ae9c7c066c27716af83f28
User & Date: js on 2025-03-29 13:01:06
Other Links: manifest | tags
Context
2025-03-29
14:25
Switch from clang-format to manual formatting check-in: 75e920ae30 user: js tags: trunk
13:01
Make more use of OFColor check-in: 932a90c261 user: js tags: trunk
2025-03-26
21:47
Run newer version of clang-format check-in: cc7ebd7f79 user: js tags: trunk
Changes

Modified src/MD2.m from [a74f6892f8] to [eb988e3999].

1
2
3
4


5
6
7
8
9
10
11
#import "MD2.h"

#include "cube.h"



struct md2_header {
	int magic;
	int version;
	int skinWidth, skinHeight;
	int frameSize;
	int numSkins, numVertices, numTexcoords;
	int numTriangles, numGlCommands, numFrames;




>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
#import "MD2.h"

#include "cube.h"

#import "OFColor+Cube.h"

struct md2_header {
	int magic;
	int version;
	int skinWidth, skinHeight;
	int frameSize;
	int numSkins, numVertices, numTexcoords;
	int numTriangles, numGlCommands, numFrames;
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
			[self scaleWithFrame:frame + i scale:sc snap:sn];

	glPushMatrix();
	glTranslatef(position.x, position.y, position.z);
	glRotatef(yaw + 180, 0, -1, 0);
	glRotatef(pitch, 0, 0, 1);

	float red, green, blue;
	[light getRed:&red green:&green blue:&blue alpha:NULL];
	glColor3f(red, green, blue);

	if (_displaylist && frame == 0 && range == 1) {
		glCallList(_displaylist);
		xtraverts += _displaylistverts;
	} else {
		if (frame == 0 && range == 1) {
			static int displaylistn = 10;







<
<
|







155
156
157
158
159
160
161


162
163
164
165
166
167
168
169
			[self scaleWithFrame:frame + i scale:sc snap:sn];

	glPushMatrix();
	glTranslatef(position.x, position.y, position.z);
	glRotatef(yaw + 180, 0, -1, 0);
	glRotatef(pitch, 0, 0, 1);



	[light cube_setAsGLColor];

	if (_displaylist && frame == 0 && range == 1) {
		glCallList(_displaylist);
		xtraverts += _displaylistverts;
	} else {
		if (frame == 0 && range == 1) {
			static int displaylistn = 10;

Added src/OFColor+Cube.h version [7398d21dd3].

Added src/OFColor+Cube.m version [830e6212b6].

Modified src/editing.m from [03b89b7ddc] to [bc0b6a3e18].

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
245
246
247
248
249
250
251
252
253
254
255
256



257
258
259
260
261
262
263
			if (SOLID(s))
				continue;
			float h1 = sheight(s, s, z);
			float h2 = sheight(s, SWS(s, 1, 0, ssize), z);
			float h3 = sheight(s, SWS(s, 1, 1, ssize), z);
			float h4 = sheight(s, SWS(s, 0, 1, ssize), z);
			if (s->tag)
				linestyle(GRIDW, 0xFF, 0x40, 0x40);



			else if (s->type == FHF || s->type == CHF)
				linestyle(GRIDW, 0x80, 0xFF, 0x80);



			else
				linestyle(GRIDW, 0x80, 0x80, 0x80);
			struct block b = { ix, iy, 1, 1 };
			box(&b, h1, h2, h3, h4);
			linestyle(GRID8, 0x40, 0x40, 0xFF);



			if (!(ix & GRIDM))
				line(ix, iy, h1, ix, iy + 1, h4);
			if (!(ix + 1 & GRIDM))
				line(ix + 1, iy, h2, ix + 1, iy + 1, h3);
			if (!(iy & GRIDM))
				line(ix, iy, h1, ix + 1, iy, h2);
			if (!(iy + 1 & GRIDM))
				line(ix, iy + 1, h4, ix + 1, iy + 1, h3);
		}
	}

	if (!SOLID(s)) {
		float ih = sheight(s, s, z);
		linestyle(GRIDS, 0xFF, 0xFF, 0xFF);
		struct block b = { cx, cy, 1, 1 };
		box(&b, ih, sheight(s, SWS(s, 1, 0, ssize), z),
		    sheight(s, SWS(s, 1, 1, ssize), z),
		    sheight(s, SWS(s, 0, 1, ssize), z));
		linestyle(GRIDS, 0xFF, 0x00, 0x00);
		dot(cx, cy, ih);
		ch = (int)ih;
	}

	if (selset) {
		linestyle(GRIDS, 0xFF, 0x40, 0x40);



		box(&sel, (float)selh, (float)selh, (float)selh, (float)selh);
	}
}

static OFMutableData *undos; // unlimited undo
VARP(undomegs, 0, 1, 10);    // bounded by n megs








|
>
>
>

|
>
>
>

|


|
>
>
>













|




|





|
>
>
>







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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
			if (SOLID(s))
				continue;
			float h1 = sheight(s, s, z);
			float h2 = sheight(s, SWS(s, 1, 0, ssize), z);
			float h3 = sheight(s, SWS(s, 1, 1, ssize), z);
			float h4 = sheight(s, SWS(s, 0, 1, ssize), z);
			if (s->tag)
				linestyle(GRIDW, [OFColor colorWithRed:1.0f
								 green:0.25f
								  blue:0.25f
								 alpha:1.0f]);
			else if (s->type == FHF || s->type == CHF)
				linestyle(GRIDW, [OFColor colorWithRed:0.5f
								 green:1.0f
								  blue:0.5f
								 alpha:1.0f]);
			else
				linestyle(GRIDW, OFColor.gray);
			struct block b = { ix, iy, 1, 1 };
			box(&b, h1, h2, h3, h4);
			linestyle(GRID8, [OFColor colorWithRed:0.25f
							 green:0.25f
							  blue:1.0f
							 alpha:1.0f]);
			if (!(ix & GRIDM))
				line(ix, iy, h1, ix, iy + 1, h4);
			if (!(ix + 1 & GRIDM))
				line(ix + 1, iy, h2, ix + 1, iy + 1, h3);
			if (!(iy & GRIDM))
				line(ix, iy, h1, ix + 1, iy, h2);
			if (!(iy + 1 & GRIDM))
				line(ix, iy + 1, h4, ix + 1, iy + 1, h3);
		}
	}

	if (!SOLID(s)) {
		float ih = sheight(s, s, z);
		linestyle(GRIDS, OFColor.white);
		struct block b = { cx, cy, 1, 1 };
		box(&b, ih, sheight(s, SWS(s, 1, 0, ssize), z),
		    sheight(s, SWS(s, 1, 1, ssize), z),
		    sheight(s, SWS(s, 0, 1, ssize), z));
		linestyle(GRIDS, OFColor.red);
		dot(cx, cy, ih);
		ch = (int)ih;
	}

	if (selset) {
		linestyle(GRIDS, [OFColor colorWithRed:1.0f
						 green:0.25f
						  blue:0.25f
						 alpha:1.0f]);
		box(&sel, (float)selh, (float)selh, (float)selh, (float)selh);
	}
}

static OFMutableData *undos; // unlimited undo
VARP(undomegs, 0, 1, 10);    // bounded by n megs

Modified src/meson.build from [fcfe74564e] to [1a1922a166].

10
11
12
13
14
15
16

17
18
19
20
21
22
23
    'Identifier.m',
    'KeyMapping.m',
    'MD2.m',
    'MapModelInfo.m',
    'Menu.m',
    'MenuItem.m',
    'Monster.m',

    'OFString+Cube.m',
    'Player.m',
    'Projectile.m',
    'ResolverResult.m',
    'ResolverThread.m',
    'ServerEntity.m',
    'ServerInfo.m',







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
    'Identifier.m',
    'KeyMapping.m',
    'MD2.m',
    'MapModelInfo.m',
    'Menu.m',
    'MenuItem.m',
    'Monster.m',
    'OFColor+Cube.m',
    'OFString+Cube.m',
    'Player.m',
    'Projectile.m',
    'ResolverResult.m',
    'ResolverThread.m',
    'ServerEntity.m',
    'ServerInfo.m',

Modified src/protos.h from [f47d376175] to [655b6d24d9].

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
extern bool noteditmode();
extern void pruneundos(int maxremain);

// renderextras
extern void line(int x1, int y1, float z1, int x2, int y2, float z2);
extern void box(const struct block *b, float z1, float z2, float z3, float z4);
extern void dot(int x, int y, float z);
extern void linestyle(float width, int r, int g, int b);
extern void newsphere(OFVector3D o, float max, int type);
extern void renderspheres(int time);
extern void gl_drawhud(
    int w, int h, int curfps, int nquads, int curvert, bool underwater);
extern void readdepth(int w, int h);
extern void blendbox(int x1, int y1, int x2, int y2, bool border);
extern void damageblend(int n);







|







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
extern bool noteditmode();
extern void pruneundos(int maxremain);

// renderextras
extern void line(int x1, int y1, float z1, int x2, int y2, float z2);
extern void box(const struct block *b, float z1, float z2, float z3, float z4);
extern void dot(int x, int y, float z);
extern void linestyle(float width, OFColor *color);
extern void newsphere(OFVector3D o, float max, int type);
extern void renderspheres(int time);
extern void gl_drawhud(
    int w, int h, int curfps, int nquads, int curvert, bool underwater);
extern void readdepth(int w, int h);
extern void blendbox(int x1, int y1, int x2, int y2, bool border);
extern void damageblend(int n);

Modified src/renderextras.m from [d086f388d4] to [efc1c2688d].

1
2
3
4
5
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// renderextras.cpp: misc gl render code and the HUD

#include "cube.h"

#import "Command.h"
#import "Entity.h"

#import "Player.h"
#import "Variable.h"

void
line(int x1, int y1, float z1, int x2, int y2, float z2)
{
	glBegin(GL_POLYGON);
	glVertex3f((float)x1, z1, (float)y1);
	glVertex3f((float)x1, z1, y1 + 0.01f);
	glVertex3f((float)x2, z2, y2 + 0.01f);
	glVertex3f((float)x2, z2, (float)y2);
	glEnd();
	xtraverts += 4;
}

void
linestyle(float width, int r, int g, int b)
{
	glLineWidth(width);
	glColor3ub(r, g, b);
}

void
box(const struct block *b, float z1, float z2, float z3, float z4)
{
	glBegin(GL_POLYGON);
	glVertex3f((float)b->x, z1, (float)b->y);






>
















|


|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// renderextras.cpp: misc gl render code and the HUD

#include "cube.h"

#import "Command.h"
#import "Entity.h"
#import "OFColor+Cube.h"
#import "Player.h"
#import "Variable.h"

void
line(int x1, int y1, float z1, int x2, int y2, float z2)
{
	glBegin(GL_POLYGON);
	glVertex3f((float)x1, z1, (float)y1);
	glVertex3f((float)x1, z1, y1 + 0.01f);
	glVertex3f((float)x2, z2, y2 + 0.01f);
	glVertex3f((float)x2, z2, (float)y2);
	glEnd();
	xtraverts += 4;
}

void
linestyle(float width, OFColor *color)
{
	glLineWidth(width);
	[color cube_setAsGLColor];
}

void
box(const struct block *b, float z1, float z2, float z3, float z4)
{
	glBegin(GL_POLYGON);
	glVertex3f((float)b->x, z1, (float)b->y);
55
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
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)
		glColor3d(0.5, 0.3, 0.4);



	else
		glColor3d(1.0, 1.0, 1.0);
	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);
	glColor3d(0.2, 0.7, 0.4);



	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;
122
123
124
125
126
127
128



129
130
131
132
133
134
135
136
	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;



		glColor4f(1.0f, 1.0f, 1.0f, 1.0f - size);
		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();
347
348
349
350
351
352
353


354

355


356

357
358
359
360
361
362
363

	glDepthMask(GL_FALSE);

	if (dblend || underwater) {
		glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
		glBegin(GL_QUADS);
		if (dblend)


			glColor3d(0.0f, 0.9f, 0.9f);

		else


			glColor3d(0.9f, 0.5f, 0.0f);

		glVertex2i(0, 0);
		glVertex2i(VIRTW, 0);
		glVertex2i(VIRTW, VIRTH);
		glVertex2i(0, VIRTH);
		glEnd();
		dblend -= curtime / 3;
		if (dblend < 0)







>
>
|
>

>
>
|
>







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)
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391



392
393
394
395
396
397
398
		draw_text(player, 20, 1570, 2);

	renderscores();
	if (!rendermenu()) {
		glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
		glBindTexture(GL_TEXTURE_2D, 1);
		glBegin(GL_QUADS);
		glColor3ub(255, 255, 255);
		if (crosshairfx) {
			if (player1.gunWait)
				glColor3ub(128, 128, 128);
			else if (player1.health <= 25)
				glColor3ub(255, 0, 0);
			else if (player1.health <= 50)
				glColor3ub(255, 128, 0);



		}
		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);







|


|

|

|
>
>
>







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
		draw_text(player, 20, 1570, 2);

	renderscores();
	if (!rendermenu()) {
		glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
		glBindTexture(GL_TEXTURE_2D, 1);
		glBegin(GL_QUADS);
		[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);

Modified src/rendergl.m from [a437681d0a] to [a52bf36780].

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
// rendergl.cpp: core opengl rendering stuff

#define gamma math_gamma

#include "cube.h"

#import "Command.h"
#import "Monster.h"

#import "OFString+Cube.h"
#import "Player.h"
#import "Variable.h"

#ifdef DARWIN
# define GL_COMBINE_EXT GL_COMBINE_ARB
# define GL_COMBINE_RGB_EXT GL_COMBINE_RGB_ARB








>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// rendergl.cpp: core opengl rendering stuff

#define gamma math_gamma

#include "cube.h"

#import "Command.h"
#import "Monster.h"
#import "OFColor+Cube.h"
#import "OFString+Cube.h"
#import "Player.h"
#import "Variable.h"

#ifdef DARWIN
# define GL_COMBINE_EXT GL_COMBINE_ARB
# define GL_COMBINE_RGB_EXT GL_COMBINE_RGB_ARB
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481

	renderstripssky();

	glLoadIdentity();
	glRotated(player1.pitch, -1.0, 0.0, 0.0);
	glRotated(player1.yaw, 0.0, 1.0, 0.0);
	glRotated(90.0, 1.0, 0.0, 0.0);
	glColor3f(1.0f, 1.0f, 1.0f);
	glDisable(GL_FOG);
	glDepthFunc(GL_GREATER);
	draw_envbox(14, fog * 4 / 3);
	glDepthFunc(GL_LESS);
	glEnable(GL_FOG);

	transplayer();







|







468
469
470
471
472
473
474
475
476
477
478
479
480
481
482

	renderstripssky();

	glLoadIdentity();
	glRotated(player1.pitch, -1.0, 0.0, 0.0);
	glRotated(player1.yaw, 0.0, 1.0, 0.0);
	glRotated(90.0, 1.0, 0.0, 0.0);
	[OFColor.white cube_setAsGLColor];
	glDisable(GL_FOG);
	glDepthFunc(GL_GREATER);
	draw_envbox(14, fog * 4 / 3);
	glDepthFunc(GL_LESS);
	glEnable(GL_FOG);

	transplayer();

Modified src/rendertext.m from [4a2a0ee6d3] to [da461b7a90].

1
2
3


4
5
6
7
8
9
10
// rendertext.cpp: based on Don's gl_text.cpp

#include "cube.h"



short char_coords[96][4] = {
	{ 0, 0, 25, 64 },       //!
	{ 25, 0, 54, 64 },      //"
	{ 54, 0, 107, 64 },     // #
	{ 107, 0, 148, 64 },    //$
	{ 148, 0, 217, 64 },    //%



>
>







1
2
3
4
5
6
7
8
9
10
11
12
// rendertext.cpp: based on Don's gl_text.cpp

#include "cube.h"

#import "OFColor+Cube.h"

short char_coords[96][4] = {
	{ 0, 0, 25, 64 },       //!
	{ 25, 0, 54, 64 },      //"
	{ 54, 0, 107, 64 },     // #
	{ 107, 0, 148, 64 },    //$
	{ 148, 0, 217, 64 },    //%
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171



172
173
174
175
176
177
178
}

void
draw_text(OFString *string, int left, int top, int gl_num)
{
	glBlendFunc(GL_ONE, GL_ONE);
	glBindTexture(GL_TEXTURE_2D, gl_num);
	glColor3ub(255, 255, 255);

	int x = left;
	int y = top;

	int i;
	float in_left, in_top, in_right, in_bottom;
	int in_width, in_height;

	const char *str = string.UTF8String;
	size_t len = string.UTF8StringLength;
	for (i = 0; i < len; i++) {
		int c = str[i];

		if (c == '\t') {
			x = (x - left + PIXELTAB) / PIXELTAB * PIXELTAB + left;
			continue;
		}

		if (c == '\f') {
			glColor3ub(64, 255, 128);



			continue;
		}

		if (c == ' ') {
			x += FONTH / 2;
			continue;
		}







|



















|
>
>
>







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
}

void
draw_text(OFString *string, int left, int top, int gl_num)
{
	glBlendFunc(GL_ONE, GL_ONE);
	glBindTexture(GL_TEXTURE_2D, gl_num);
	[OFColor.white cube_setAsGLColor];

	int x = left;
	int y = top;

	int i;
	float in_left, in_top, in_right, in_bottom;
	int in_width, in_height;

	const char *str = string.UTF8String;
	size_t len = string.UTF8StringLength;
	for (i = 0; i < len; i++) {
		int c = str[i];

		if (c == '\t') {
			x = (x - left + PIXELTAB) / PIXELTAB * PIXELTAB + left;
			continue;
		}

		if (c == '\f') {
			[[OFColor colorWithRed:0.25f
					 green:1.0f
					  blue:0.5f
					 alpha:1.0f] cube_setAsGLColor];
			continue;
		}

		if (c == ' ') {
			x += FONTH / 2;
			continue;
		}