Cube  Check-in [bd82b5a5b1]

Overview
Comment:Fix needing -fpermissive
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bd82b5a5b17fdeacf6b3133104b958a1597e5e16379280cf0bcfef7e7fef1468
User & Date: js on 2024-07-20 21:49:30
Other Links: manifest | tags
Context
2024-07-21
12:02
Convert to ObjC++ check-in: 7c2704b3d7 user: js tags: trunk
2024-07-20
21:49
Fix needing -fpermissive check-in: bd82b5a5b1 user: js tags: trunk
16:45
A few minor fixes check-in: 4391eeb535 user: js tags: trunk
Changes

Modified src/Makefile from [ffd34fa226] to [0d0753c570].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

CPPFLAGS += -I../enet/include	\
	    ${SDL_CFLAGS}	\
	    ${GL_CFLAGS}	\
	    ${GLU_CFLAGS}	\
	    ${X11_CFLAGS}	\
	    ${ZLIB_CFLAGS}
CXXFLAGS += -fpermissive
LIBS += -L../enet -lenet	\
	${SDL_LIBS}		\
	${GL_LIBS}		\
	${GLU_LIBS}		\
	${X11_LIBS}		\
	${ZLIB_LIBS}
LD = ${CXX}







<







38
39
40
41
42
43
44

45
46
47
48
49
50
51

CPPFLAGS += -I../enet/include	\
	    ${SDL_CFLAGS}	\
	    ${GL_CFLAGS}	\
	    ${GLU_CFLAGS}	\
	    ${X11_CFLAGS}	\
	    ${ZLIB_CFLAGS}

LIBS += -L../enet -lenet	\
	${SDL_LIBS}		\
	${GL_LIBS}		\
	${GLU_LIBS}		\
	${X11_LIBS}		\
	${ZLIB_LIBS}
LD = ${CXX}

Modified src/clientextras.cxx from [0c7464b91e] to [1f60f5711b].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

void
renderclient(dynent *d, bool team, char *mdlname, bool hellpig, float scale)
{
	int n = 3;
	float speed = 100.0f;
	float mz = d->o.z - d->eyeheight + 1.55f * scale;
	int basetime = -((int)d & 0xFFF);
	if (d->state == CS_DEAD) {
		int r;
		if (hellpig) {
			n = 2;
			r = range[3];
		} else {
			n = (int)d % 3;
			r = range[n];
		};
		basetime = d->lastaction;
		int t = lastmillis - d->lastaction;
		if (t < 0 || t > 20000)
			return;
		if (t > (r - 1) * 100) {







|






|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

void
renderclient(dynent *d, bool team, char *mdlname, bool hellpig, float scale)
{
	int n = 3;
	float speed = 100.0f;
	float mz = d->o.z - d->eyeheight + 1.55f * scale;
	int basetime = -((intptr_t)d & 0xFFF);
	if (d->state == CS_DEAD) {
		int r;
		if (hellpig) {
			n = 2;
			r = range[3];
		} else {
			n = (intptr_t)d % 3;
			r = range[n];
		};
		basetime = d->lastaction;
		int t = lastmillis - d->lastaction;
		if (t < 0 || t > 20000)
			return;
		if (t > (r - 1) * 100) {

Modified src/clients2c.cxx from [1e2dd62755] to [eb9667cf69].

269
270
271
272
273
274
275

276
277
278
279
280
281
282
283
			break;

		case SV_ITEMSPAWN: {
			uint i = getint(p);
			setspawn(i, true);
			if (i >= (uint)ents.length())
				break;

			vec v = {ents[i].x, ents[i].y, ents[i].z};
			playsound(S_ITEMSPAWN, &v);
			break;
		};

		case SV_ITEMACC: // server acknowledges that I picked up this
		                 // item
			realpickup(getint(p), player1);







>
|







269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
			break;

		case SV_ITEMSPAWN: {
			uint i = getint(p);
			setspawn(i, true);
			if (i >= (uint)ents.length())
				break;
			vec v = {(float)ents[i].x, (float)ents[i].y,
			    (float)ents[i].z};
			playsound(S_ITEMSPAWN, &v);
			break;
		};

		case SV_ITEMACC: // server acknowledges that I picked up this
		                 // item
			realpickup(getint(p), player1);

Modified src/console.cxx from [3bc4bc641c] to [ee8378b098].

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
					pasteconsole();
					return;
				};

			default:
				resetcomplete();
				if (cooked) {
					char add[] = {cooked, 0};
					strcat_s(commandbuf, add);
				};
			};
		} else {
			if (code == SDLK_RETURN) {
				if (commandbuf[0]) {
					if (vhistory.empty() ||







|







243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
					pasteconsole();
					return;
				};

			default:
				resetcomplete();
				if (cooked) {
					char add[] = {(char)cooked, 0};
					strcat_s(commandbuf, add);
				};
			};
		} else {
			if (code == SDLK_RETURN) {
				if (commandbuf[0]) {
					if (vhistory.empty() ||

Modified src/entities.cxx from [7b928c8e1c] to [498a3c6bc3].

313
314
315
316
317
318
319

320
321
322
323
324
325
326
327
		entity &e = ents[i];
		if (e.type == NOTUSED)
			continue;
		if (!ents[i].spawned && e.type != TELEPORT && e.type != JUMPPAD)
			continue;
		if (OUTBORD(e.x, e.y))
			continue;

		vec v = {e.x, e.y, S(e.x, e.y)->floor + player1->eyeheight};
		vdist(dist, t, player1->o, v);
		if (dist < (e.type == TELEPORT ? 4 : 2.5))
			pickup(i, player1);
	};
};

void







>
|







313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
		entity &e = ents[i];
		if (e.type == NOTUSED)
			continue;
		if (!ents[i].spawned && e.type != TELEPORT && e.type != JUMPPAD)
			continue;
		if (OUTBORD(e.x, e.y))
			continue;
		vec v = {(float)e.x, (float)e.y,
		    (float)S(e.x, e.y)->floor + player1->eyeheight};
		vdist(dist, t, player1->o, v);
		if (dist < (e.type == TELEPORT ? 4 : 2.5))
			pickup(i, player1);
	};
};

void

Modified src/monster.cxx from [aab23b54fe] to [c901f05b50].

374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
	            // used
	{
		entity &e = ents[i];
		if (e.type != TELEPORT)
			continue;
		if (OUTBORD(e.x, e.y))
			continue;
		vec v = {e.x, e.y, S(e.x, e.y)->floor};
		loopv(monsters) if (monsters[i]->state == CS_DEAD)
		{
			if (lastmillis - monsters[i]->lastaction < 2000) {
				monsters[i]->move = 0;
				moveplayer(monsters[i], 1, false);
			};
		}







|







374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
	            // used
	{
		entity &e = ents[i];
		if (e.type != TELEPORT)
			continue;
		if (OUTBORD(e.x, e.y))
			continue;
		vec v = {(float)e.x, (float)e.y, (float)S(e.x, e.y)->floor};
		loopv(monsters) if (monsters[i]->state == CS_DEAD)
		{
			if (lastmillis - monsters[i]->lastaction < 2000) {
				monsters[i]->move = 0;
				moveplayer(monsters[i], 1, false);
			};
		}

Modified src/renderextras.cxx from [d70403196e] to [6c33874cb2].

180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
	if (!editmode)
		return;
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type == NOTUSED)
			continue;
		vec v = {e.x, e.y, e.z};
		particle_splash(2, 2, 40, v);
	};
	int e = closestent();
	if (e >= 0) {
		entity &c = ents[e];
		sprintf_s(closeent)("closest entity = %s (%d, %d, %d, %d), "
		                    "selection = (%d, %d)",







|







180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
	if (!editmode)
		return;
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type == NOTUSED)
			continue;
		vec v = {(float)e.x, (float)e.y, (float)e.z};
		particle_splash(2, 2, 40, v);
	};
	int e = closestent();
	if (e >= 0) {
		entity &c = ents[e];
		sprintf_s(closeent)("closest entity = %s (%d, %d, %d, %d), "
		                    "selection = (%d, %d)",

Modified src/server.cxx from [1a30414c23] to [d64f08d11a].

456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
			                    : "localhost");
			printf("client connected (%s)\n", c.hostname);
			send_welcome(lastconnect = &c - &clients[0]);
			break;
		}
		case ENET_EVENT_TYPE_RECEIVE:
			brec += event.packet->dataLength;
			process(event.packet, (int)event.peer->data);
			if (event.packet->referenceCount == 0)
				enet_packet_destroy(event.packet);
			break;

		case ENET_EVENT_TYPE_DISCONNECT:
			if ((int)event.peer->data < 0)
				break;
			printf("disconnected client (%s)\n",
			    clients[(int)event.peer->data].hostname);
			clients[(int)event.peer->data].type = ST_EMPTY;
			send2(true, -1, SV_CDIS, (int)event.peer->data);
			event.peer->data = (void *)-1;
			break;
		};

		if (numplayers > maxclients) {
			disconnect_client(lastconnect, "maxclients reached");
		};







|





|


|
|
|







456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
			                    : "localhost");
			printf("client connected (%s)\n", c.hostname);
			send_welcome(lastconnect = &c - &clients[0]);
			break;
		}
		case ENET_EVENT_TYPE_RECEIVE:
			brec += event.packet->dataLength;
			process(event.packet, (intptr_t)event.peer->data);
			if (event.packet->referenceCount == 0)
				enet_packet_destroy(event.packet);
			break;

		case ENET_EVENT_TYPE_DISCONNECT:
			if ((intptr_t)event.peer->data < 0)
				break;
			printf("disconnected client (%s)\n",
			    clients[(intptr_t)event.peer->data].hostname);
			clients[(intptr_t)event.peer->data].type = ST_EMPTY;
			send2(true, -1, SV_CDIS, (intptr_t)event.peer->data);
			event.peer->data = (void *)-1;
			break;
		};

		if (numplayers > maxclients) {
			disconnect_client(lastconnect, "maxclients reached");
		};

Modified src/world.cxx from [293b2c8a10] to [cb52ab13f9].

252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
	int best;
	float bdist = 99999;
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type == NOTUSED)
			continue;
		vec v = {e.x, e.y, e.z};
		vdist(dist, t, player1->o, v);
		if (dist < bdist) {
			best = i;
			bdist = dist;
		};
	};
	return bdist == 99999 ? -1 : best;







|







252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
	int best;
	float bdist = 99999;
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type == NOTUSED)
			continue;
		vec v = {(float)e.x, (float)e.y, (float)e.z};
		vdist(dist, t, player1->o, v);
		if (dist < bdist) {
			best = i;
			bdist = dist;
		};
	};
	return bdist == 99999 ? -1 : best;
312
313
314
315
316
317
318
319

320
321
322
323
324
325
326
	return NOTUSED;
}

entity *
newentity(int x, int y, int z, char *what, int v1, int v2, int v3, int v4)
{
	int type = findtype(what);
	persistent_entity e = {x, y, z, v1, type, v2, v3, v4};

	switch (type) {
	case LIGHT:
		if (v1 > 32)
			v1 = 32;
		if (!v1)
			e.attr1 = 16;
		if (!v2 && !v3 && !v4)







|
>







312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
	return NOTUSED;
}

entity *
newentity(int x, int y, int z, char *what, int v1, int v2, int v3, int v4)
{
	int type = findtype(what);
	persistent_entity e = {(short)x, (short)y, (short)z, (short)v1,
	    (uchar)type, (uchar)v2, (uchar)v3, (uchar)v4};
	switch (type) {
	case LIGHT:
		if (v1 > 32)
			v1 = 32;
		if (!v1)
			e.attr1 = 16;
		if (!v2 && !v3 && !v4)

Modified src/worldlight.cxx from [ef13aa2477] to [73836e692f].

222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
	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;

	dlights.add(blockcopy(b)); // backup area before rendering in dynlight

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

// utility functions also used by editing code

block *







|
|







222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
	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;

	dlights.add(blockcopy(b)); // backup area before rendering in dynlight

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

// utility functions also used by editing code

block *

Modified src/worldocull.cxx from [8094d12fd2] to [cfc9b27041].

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
					l = ma(-(cx + csize - vx), -(cy - vy)) +
					    4;
				} // D
			} else {
				h = ca(cy + csize - vy, -(cx + csize - vx)) + 2;
				l = ca(cy - vy, -(cx - vx)) + 2;
			}; // F
		} else     // BG
		{
			if (cy <= vy) {
				if (cy + csize < vy) {
					h = ma(-(cy + csize - vy), cx - vx) + 6;
					l = ma(-(cy + csize - vy),
					        cx + csize - vx) +
					    6;







|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
					l = ma(-(cx + csize - vx), -(cy - vy)) +
					    4;
				} // D
			} else {
				h = ca(cy + csize - vy, -(cx + csize - vx)) + 2;
				l = ca(cy - vy, -(cx - vx)) + 2;
			}; // F
		} else // BG
		{
			if (cy <= vy) {
				if (cy + csize < vy) {
					h = ma(-(cy + csize - vy), cx - vx) + 6;
					l = ma(-(cy + csize - vy),
					        cx + csize - vx) +
					    6;