Cube  Diff

Differences From Artifact [d117eaf6b5]:

To Artifact [4a2a0ee6d3]:


98
99
100
101
102
103
104
105
106
107


108
109
110
111
112
113
114
115







116
117
118


119
120
121
122
123




124
125
126
127



128
129
130
131



132
133

134
135
136
137
138
139
140
141
142
143
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
179
180




181
182
183
184
185




186
187
188
189



190
191
192
193
194




195
196
197


198
199
200
201
202
203
204
205
206
207
208










209
210
211


212
213
214
215
216
217
218
219
98
99
100
101
102
103
104



105
106
107







108
109
110
111
112
113
114
115


116
117
118




119
120
121
122
123



124
125
126
127



128
129
130
131

132

133
134
135
136
137







138
139
140
141
142
143

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
179



180
181
182
183




184
185
186
187
188


189
190
191










192
193
194
195
196
197
198
199
200
201
202


203
204

205
206
207
208
209
210
211







-
-
-
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
+
+

-
-
-
-
+
+
+
+

-
-
-
+
+
+

-
-
-
+
+
+

-
+
-





-
-
-
-
-
-
-
+
+
+
+
+
+
-





-
-
-
-
+
+
+

-
-
+
+

-
-
-
+
+
+

-
-
-
-
+
+
+
+

-
-
+
+
-
-
-
-
+
+

-
-
-
-
+
+
+
+

-
-
-
-
+
+
+
+

-
-
-
+
+
+

-
-
-
-
+
+
+
+

-
-
+
+

-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+

-
-
+
+
-







	{ 270, 448, 310, 512 }, //}
	{ 310, 448, 363, 512 }, //~
};

int
text_width(OFString *string)
{
	@autoreleasepool {
		const char *str = string.UTF8String;
		size_t len = string.UTF8StringLength;
	const char *str = string.UTF8String;
	size_t len = string.UTF8StringLength;

		int x = 0;
		for (int i = 0; i < len; i++) {
			int c = str[i];
			if (c == '\t') {
				x = (x + PIXELTAB) / PIXELTAB * PIXELTAB;
				continue;
			}
	int x = 0;
	for (int i = 0; i < len; i++) {
		int c = str[i];
		if (c == '\t') {
			x = (x + PIXELTAB) / PIXELTAB * PIXELTAB;
			continue;
		}

			if (c == '\f')
				continue;
		if (c == '\f')
			continue;

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

			c -= 33;
			if (c < 0 || c >= 95)
				continue;
		c -= 33;
		if (c < 0 || c >= 95)
			continue;

			int in_width = char_coords[c][2] - char_coords[c][0];
			x += in_width + 1;
		}
		int in_width = char_coords[c][2] - char_coords[c][0];
		x += in_width + 1;
	}

		return x;
	return x;
	}
}

void
draw_textf(OFConstantString *format, int left, int top, int gl_num, ...)
{
	@autoreleasepool {
		va_list arguments;
		va_start(arguments, gl_num);
		OFString *str = [[OFString alloc] initWithFormat:format
		                                       arguments:arguments];
		va_end(arguments);
		draw_text(str, left, top, gl_num);
	va_list arguments;
	va_start(arguments, gl_num);
	OFString *str = [[OFString alloc] initWithFormat:format
	                                       arguments:arguments];
	va_end(arguments);
	draw_text(str, left, top, gl_num);
	}
}

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

		int x = left;
		int y = top;
	int x = left;
	int y = top;

		int i;
		float in_left, in_top, in_right, in_bottom;
		int in_width, in_height;
	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];
	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 *
		if (c == '\t') {
			x = (x - left + PIXELTAB) / PIXELTAB * PIXELTAB + left;
				        PIXELTAB +
				    left;
				continue;
			}
			continue;
		}

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

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

			c -= 33;
			if (c < 0 || c >= 95)
				continue;
		c -= 33;
		if (c < 0 || c >= 95)
			continue;

			in_left = ((float)char_coords[c][0]) / 512.0f;
			in_top = ((float)char_coords[c][1] + 2) / 512.0f;
			in_right = ((float)char_coords[c][2]) / 512.0f;
			in_bottom = ((float)char_coords[c][3] - 2) / 512.0f;
		in_left = ((float)char_coords[c][0]) / 512.0f;
		in_top = ((float)char_coords[c][1] + 2) / 512.0f;
		in_right = ((float)char_coords[c][2]) / 512.0f;
		in_bottom = ((float)char_coords[c][3] - 2) / 512.0f;

			in_width = char_coords[c][2] - char_coords[c][0];
			in_height = char_coords[c][3] - char_coords[c][1];
		in_width = char_coords[c][2] - char_coords[c][0];
		in_height = char_coords[c][3] - char_coords[c][1];

			glBegin(GL_QUADS);
			glTexCoord2f(in_left, in_top);
			glVertex2i(x, y);
			glTexCoord2f(in_right, in_top);
			glVertex2i(x + in_width, y);
			glTexCoord2f(in_right, in_bottom);
			glVertex2i(x + in_width, y + in_height);
			glTexCoord2f(in_left, in_bottom);
			glVertex2i(x, y + in_height);
			glEnd();
		glBegin(GL_QUADS);
		glTexCoord2f(in_left, in_top);
		glVertex2i(x, y);
		glTexCoord2f(in_right, in_top);
		glVertex2i(x + in_width, y);
		glTexCoord2f(in_right, in_bottom);
		glVertex2i(x + in_width, y + in_height);
		glTexCoord2f(in_left, in_bottom);
		glVertex2i(x, y + in_height);
		glEnd();

			xtraverts += 4;
			x += in_width + 1;
		xtraverts += 4;
		x += in_width + 1;
		}
	}
}

// also Don's code, so goes in here too :)

void
draw_envbox_aux(float s0, float t0, int x0, int y0, int z0, float s1, float t1,