Cube  Diff

Differences From Artifact [9b1a521652]:

To Artifact [05fab5d192]:


185
186
187
188
189
190
191
192

193
194
195
196
197
198



199
200

201
202
203
204
205
206
207
185
186
187
188
189
190
191

192
193
194
195
196


197
198
199
200

201
202
203
204
205
206
207
208







-
+




-
-
+
+
+

-
+







	block b = { 1, 1, ssize - 2, ssize - 2 };
	postlightarea(b);
	setvar(@"fullbright", 0);
}

VARP(dynlight, 0, 16, 32);

vector<block *> dlights;
static OFMutableData *dlights;

void
cleardlights()
{
	while (!dlights.empty()) {
		block *backup = dlights.pop();
	while (dlights.count > 0) {
		block *backup = *(block **)[dlights lastItem];
		[dlights removeLastItem];
		blockpaste(*backup);
		free(backup);
		OFFreeMemory(backup);
	}
}

void
dodynlight(const OFVector3D &vold, const OFVector3D &v, int reach, int strength,
    DynamicEntity *owner)
{
223
224
225
226
227
228
229




230



231
232
233
234
235
236
237
224
225
226
227
228
229
230
231
232
233
234

235
236
237
238
239
240
241
242
243
244







+
+
+
+
-
+
+
+







	if (b.y < 1)
		b.y = 1;
	if (b.xs + b.x > ssize - 2)
		b.xs = ssize - 2 - b.x;
	if (b.ys + b.y > ssize - 2)
		b.ys = ssize - 2 - b.y;

	if (dlights == nil)
		dlights =
		    [[OFMutableData alloc] initWithItemSize:sizeof(block *)];

	dlights.add(blockcopy(b)); // backup area before rendering in dynlight
	// backup area before rendering in dynlight
	block *copy = blockcopy(b);
	[dlights addItem:&copy];

	persistent_entity l = { (short)v.x, (short)v.y, (short)v.z,
		(short)reach, LIGHT, (uchar)strength, 0, 0 };
	calclightsource(l);
	postlightarea(b);
}