Cube  Check-in [5e7a0895eb]

Overview
Comment:Fix crash when compiled with Clang
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5e7a0895eb30bb141156e3aaecbc9292d6c2d7ba6399470097f26811a672d2e8
User & Date: js on 2024-08-02 11:09:08
Other Links: manifest | tags
Context
2024-08-03
12:44
Enable ARC check-in: 975d7dff02 user: js tags: trunk
2024-08-02
11:09
Fix crash when compiled with Clang check-in: 5e7a0895eb user: js tags: trunk
2024-07-21
12:02
Convert to ObjC++ check-in: 7c2704b3d7 user: js tags: trunk
Changes

Modified src/entities.mm from [498a3c6bc3] to [a95a1806cd].

32
33
34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
52
{
	if (lastmillis > triggertime + 1000)
		triggertime = 0;
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type == MAPMODEL) {
			mapmodelinfo &mmi = getmminfo(e.attr2);
			if (!&mmi)
				continue;
			rendermodel(mmi.name, 0, 1, e.attr4, (float)mmi.rad,

			    e.x, (float)S(e.x, e.y)->floor + mmi.zoff + e.attr3,
			    e.y, (float)((e.attr1 + 7) - (e.attr1 + 7) % 15), 0,
			    false, 1.0f, 10.0f, mmi.snap);
		} else {
			if (OUTBORD(e.x, e.y))
				continue;
			if (e.type != CARROT) {
				if (!e.spawned && e.type != TELEPORT)
					continue;
				if (e.type < I_SHELLS || e.type > TELEPORT)







|
|

|
>
|

|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
	if (lastmillis > triggertime + 1000)
		triggertime = 0;
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type == MAPMODEL) {
			mapmodelinfo *mmi = getmminfo(e.attr2);
			if (!mmi)
				continue;
			rendermodel(mmi->name, 0, 1, e.attr4, (float)mmi->rad,
			    e.x,
			    (float)S(e.x, e.y)->floor + mmi->zoff + e.attr3,
			    e.y, (float)((e.attr1 + 7) - (e.attr1 + 7) % 15), 0,
			    false, 1.0f, 10.0f, mmi->snap);
		} else {
			if (OUTBORD(e.x, e.y))
				continue;
			if (e.type != CARROT) {
				if (!e.spawned && e.type != TELEPORT)
					continue;
				if (e.type < I_SHELLS || e.type > TELEPORT)

Modified src/physics.mm from [e446a76dd7] to [864d2d9b42].

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
mmcollide(dynent *d, float &hi, float &lo) // collide with a mapmodel
{
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type != MAPMODEL)
			continue;
		mapmodelinfo &mmi = getmminfo(e.attr2);
		if (!&mmi || !mmi.h)
			continue;
		const float r = mmi.rad + d->radius;
		if (fabs(e.x - d->o.x) < r && fabs(e.y - d->o.y) < r) {
			float mmz =
			    (float)(S(e.x, e.y)->floor + mmi.zoff + e.attr3);
			if (d->o.z - d->eyeheight < mmz) {
				if (mmz < hi)
					hi = mmz;
			} else if (mmz + mmi.h > lo)
				lo = mmz + mmi.h;
		};
	};
};

// all collision happens here
// spawn is a dirty side effect used in spawning
// drop & rise are supplied by the physics below to indicate gravity/push for







|
|

|


|



|
|







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
mmcollide(dynent *d, float &hi, float &lo) // collide with a mapmodel
{
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type != MAPMODEL)
			continue;
		mapmodelinfo *mmi = getmminfo(e.attr2);
		if (!mmi || !mmi->h)
			continue;
		const float r = mmi->rad + d->radius;
		if (fabs(e.x - d->o.x) < r && fabs(e.y - d->o.y) < r) {
			float mmz =
			    (float)(S(e.x, e.y)->floor + mmi->zoff + e.attr3);
			if (d->o.z - d->eyeheight < mmz) {
				if (mmz < hi)
					hi = mmz;
			} else if (mmz + mmi->h > lo)
				lo = mmz + mmi->h;
		};
	};
};

// all collision happens here
// spawn is a dirty side effect used in spawning
// drop & rise are supplied by the physics below to indicate gravity/push for

Modified src/protos.h from [194437db01] to [1ced1650a0].

203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
extern void initsound();
extern void cleansound();

// rendermd2
extern void rendermodel(char *mdl, int frame, int range, int tex, float rad,
    float x, float y, float z, float yaw, float pitch, bool teammate,
    float scale, float speed, int snap = 0, int basetime = 0);
extern mapmodelinfo &getmminfo(int i);

// server
extern void initserver(bool dedicated, int uprate, char *sdesc, char *ip,
    char *master, char *passwd, int maxcl);
extern void cleanupserver();
extern void localconnect();
extern void localdisconnect();







|







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
extern void initsound();
extern void cleansound();

// rendermd2
extern void rendermodel(char *mdl, int frame, int range, int tex, float rad,
    float x, float y, float z, float yaw, float pitch, bool teammate,
    float scale, float speed, int snap = 0, int basetime = 0);
extern mapmodelinfo *getmminfo(int i);

// server
extern void initserver(bool dedicated, int uprate, char *sdesc, char *ip,
    char *master, char *passwd, int maxcl);
extern void cleanupserver();
extern void localconnect();
extern void localdisconnect();

Modified src/rendermd2.mm from [92185e5e25] to [e791a84317].

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267

void
mapmodelreset()
{
	mapmodels.setsize(0);
};

mapmodelinfo &
getmminfo(int i)
{
	return i < mapmodels.length() ? mapmodels[i]->mmi : *(mapmodelinfo *)0;
};

COMMAND(mapmodel, ARG_5STR);
COMMAND(mapmodelreset, ARG_NONE);

void
rendermodel(char *mdl, int frame, int range, int tex, float rad, float x,







|


|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267

void
mapmodelreset()
{
	mapmodels.setsize(0);
};

mapmodelinfo *
getmminfo(int i)
{
	return i < mapmodels.length() ? &mapmodels[i]->mmi : NULL;
};

COMMAND(mapmodel, ARG_5STR);
COMMAND(mapmodelreset, ARG_NONE);

void
rendermodel(char *mdl, int frame, int range, int tex, float rad, float x,