Cube  Diff

Differences From Artifact [11f87c82e6]:

To Artifact [9597798812]:


41
42
43
44
45
46
47
48

49
50
51
52

53
54

55
56

57
58

59
60
61
62
63
64
65
41
42
43
44
45
46
47

48
49
50
51

52


53
54

55


56
57
58
59
60
61
62
63







-
+



-
+
-
-
+

-
+
-
-
+







	Player *player1 = Player.player1;
	const float r = player1.radius + d.radius;
	const float dx = player1.origin.x - d.origin.x;
	const float dy = player1.origin.y - d.origin.y;
	const float dz = player1.origin.z - d.origin.z;
	const float rz = player1.aboveEye + d.eyeHeight;
	const float fx = (float)fabs(dx), fy = (float)fabs(dy),
	            fz = (float)fabs(dz);
	    fz = (float)fabs(dz);
	if (fx < r && fy < r && fz < rz && d.state != CS_DEAD) {
		if (fx < fy)
			// push aside
			d.origin = OFAddVectors3D(d.origin,
			d.origin = OFAddVectors3D(d.origin, OFMakeVector3D(
			    OFMakeVector3D(
			        0, (dy < 0 ? r - fy : -(r - fy)), 0));
			    0, (dy < 0 ? r - fy : -(r - fy)), 0));
		else
			d.origin = OFAddVectors3D(d.origin,
			d.origin = OFAddVectors3D(d.origin, OFMakeVector3D(
			    OFMakeVector3D(
			        (dx < 0 ? r - fx : -(r - fx)), 0, 0));
			    (dx < 0 ? r - fx : -(r - fx)), 0, 0));
	}
	int lagtime = lastmillis - d.lastUpdate;
	if (lagtime) {
		d.lag = (d.lag * 5 + lagtime) / 6;
		d.lastUpdate = lastmillis;
	}
}
83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

103
104
105
106
107
108
109
110







-
+














-
+







		switch (type = getint(&p)) {
		case SV_INITS2C: // welcome messsage from the server
		{
			cn = getint(&p);
			int prot = getint(&p);
			if (prot != PROTOCOL_VERSION) {
				conoutf(@"you are using a different game "
				        @"protocol (you: %d, server: %d)",
				    @"protocol (you: %d, server: %d)",
				    PROTOCOL_VERSION, prot);
				disconnect(false, false);
				return;
			}
			toservermap = @"";
			clientnum = cn; // we are now fully connected
			if (!getint(&p))
				// we are the first client on this server, set
				// map
				toservermap = getclientmap();
			sgetstr();
			if (text[0] &&
			    strcmp(text, clientpassword.UTF8String)) {
				conoutf(@"you need to set the correct password "
				        @"to join this server!");
				    @"to join this server!");
				disconnect(false, false);
				return;
			}
			if (getint(&p) == 1)
				conoutf(@"server is FULL, disconnecting..");
			break;
		}
261
262
263
264
265
266
267
268
269


270
271
272
273
274
275
276
259
260
261
262
263
264
265


266
267
268
269
270
271
272
273
274







-
-
+
+







				addmsg(1, 2, SV_FRAGS,
				    (Player.player1.frags += frags));
			} else {
				Player *a = getclient(actor);
				if (a != nil) {
					if (isteam(a.team, d.name))
						conoutf(@"%@ fragged his "
						        @"teammate (%@)",
						    a.name, d.name);
						    @"teammate (%@)", a.name,
						    d.name);
					else
						conoutf(@"%@ fragged %@",
						    a.name, d.name);
				}
			}
			OFVector3D loc = d_.origin;
			playsound(S_DIE1 + rnd(2), &loc);
299
300
301
302
303
304
305
306
307



308
309
310
311
312
313
314
297
298
299
300
301
302
303


304
305
306
307
308
309
310
311
312
313







-
-
+
+
+







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

		case SV_EDITH: // coop editing messages, should be extended to
		               // include all possible editing ops
		// coop editing messages, should be extended to include all
		// possible editing ops
		case SV_EDITH:
		case SV_EDITT:
		case SV_EDITS:
		case SV_EDITD:
		case SV_EDITE: {
			int x = getint(&p);
			int y = getint(&p);
			int xs = getint(&p);
363
364
365
366
367
368
369
370

371
372
373
374
375
376
377
378
362
363
364
365
366
367
368

369

370
371
372
373
374
375
376







-
+
-







		case SV_PING:
			getint(&p);
			break;

		case SV_PONG:
			addmsg(0, 2, SV_CLIENTPING,
			    Player.player1.ping = (Player.player1.ping * 5 +
			                              lastmillis - getint(&p)) /
				lastmillis - getint(&p)) / 6);
			        6);
			break;

		case SV_CLIENTPING:
			OFAssert([players[cn] isKindOfClass: Player.class]);
			((Player *)players[cn]).ping = getint(&p);
			break;

397
398
399
400
401
402
403
404
405


406

407
408
409
410
411
412
413
414
415
416
395
396
397
398
399
400
401


402
403

404
405
406
407
408
409
410
411
412
413
414







-
-
+
+
-
+










		}

		case SV_SERVMSG:
			sgetstr();
			conoutf(@"%s", text);
			break;

		case SV_EXT: // so we can messages without breaking previous
		             // clients/servers, if necessary
		// so we can messages without breaking previous
		// clients/servers, if necessary
		{
		case SV_EXT: {
			for (int n = getint(&p); n; n--)
				getint(&p);
			break;
		}

		default:
			neterr(@"type");
			return;
		}
}