Cube  Diff

Differences From Artifact [2a4e83496a]:

To Artifact [783cdb6446]:


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extern OFString *toservermap;
extern OFString *clientpassword;

void
neterr(OFString *s)
{
	conoutf(@"illegal network message (%@)", s);
	disconnect();
}

void
changemapserv(OFString *name, int mode) // forced map change from the server
{
	gamemode = mode;
	load_world(name);







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extern OFString *toservermap;
extern OFString *clientpassword;

void
neterr(OFString *s)
{
	conoutf(@"illegal network message (%@)", s);
	disconnect(false, false);
}

void
changemapserv(OFString *name, int mode) // forced map change from the server
{
	gamemode = mode;
	load_world(name);
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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

// processes any updates from the server
void
localservertoclient(uchar *buf, int len)
{
	if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len)
		neterr(@"packet length");
	incomingdemodata(buf, len);

	uchar *end = buf + len;
	uchar *p = buf + 2;
	char text[MAXTRANS];
	int cn = -1, type;
	DynamicEntity *d = nil;
	bool mapchanged = false;

	while (p < end)
		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_VERSION, prot);
				disconnect();
				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!");
				disconnect();
				return;
			}
			if (getint(&p) == 1)
				conoutf(@"server is FULL, disconnecting..");
			break;
		}








|


















|













|







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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

// processes any updates from the server
void
localservertoclient(uchar *buf, int len)
{
	if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len)
		neterr(@"packet length");
	incomingdemodata(buf, len, false);

	uchar *end = buf + len;
	uchar *p = buf + 2;
	char text[MAXTRANS];
	int cn = -1, type;
	DynamicEntity *d = nil;
	bool mapchanged = false;

	while (p < end)
		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_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!");
				disconnect(false, false);
				return;
			}
			if (getint(&p) == 1)
				conoutf(@"server is FULL, disconnecting..");
			break;
		}

217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
			s.y = getint(&p) / DMF;
			s.z = getint(&p) / DMF;
			e.x = getint(&p) / DMF;
			e.y = getint(&p) / DMF;
			e.z = getint(&p) / DMF;
			if (gun == GUN_SG)
				createrays(&s, &e);
			shootv(gun, &s, &e, d);
			break;
		}

		case SV_DAMAGE: {
			int target = getint(&p);
			int damage = getint(&p);
			int ls = getint(&p);







|







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
			s.y = getint(&p) / DMF;
			s.z = getint(&p) / DMF;
			e.x = getint(&p) / DMF;
			e.y = getint(&p) / DMF;
			e.z = getint(&p) / DMF;
			if (gun == GUN_SG)
				createrays(&s, &e);
			shootv(gun, &s, &e, d, false);
			break;
		}

		case SV_DAMAGE: {
			int target = getint(&p);
			int damage = getint(&p);
			int ls = getint(&p);