Cube  Diff

Differences From Artifact [d11e243f24]:

To Artifact [138c74a711]:


9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37







-
+













-
+







//              D    D    D    D'   D    D    D    D'   A   A'  P   P'  I   I'
//              R,  R'  E    L    J   J'
int frame[] = {178, 184, 190, 137, 183, 189, 197, 164, 46, 51, 54, 32, 0, 0, 40,
    1, 162, 162, 67, 168};
int range[] = {6, 6, 8, 28, 1, 1, 1, 1, 8, 19, 4, 18, 40, 1, 6, 15, 1, 1, 1, 1};

void
renderclient(dynent *d, bool team, char *mdlname, bool hellpig, float scale)
renderclient(dynent *d, bool team, OFString *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) {
			n += 4;
			if (t > (r + 10) * 100) {
57
58
59
60
61
62
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
57
58
59
60
61
62
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







-
+




-
+


-
+









-
-
+
+
-
+







	} else if (!d->onfloor && d->timeinair > 100) {
		n = 18;
	} else {
		n = 14;
		speed = 1200 / d->maxspeed * scale;
		if (hellpig)
			speed = 300 / d->maxspeed;
	};
	}
	if (hellpig) {
		n++;
		scale *= 32;
		mz -= 1.9f;
	};
	}
	rendermodel(mdlname, frame[n], range[n], 0, 1.5f, d->o.x, mz, d->o.y,
	    d->yaw + 90, d->pitch / 2, team, scale, speed, 0, basetime);
};
}

extern int democlientnum;

void
renderclients()
{
	dynent *d;
	loopv(players) if ((d = players[i]) &&
	                   (!demoplayback || i != democlientnum))
	    renderclient(
	        d, isteam(player1->team, d->team), "monster/ogro", false, 1.0f);
	    renderclient(d, isteam(player1->team, d->team), @"monster/ogro",
	        false, 1.0f);
};
}

// creation of scoreboard pseudo-menu

bool scoreson = false;

void
showscores(bool on)
157
158
159
160
161
162
163
164

165
166
167

168
169
170


171
172

173
174
175
176
177
178
179
180

181
182

183

184
185
186
187
188
189
190
191
192
193
194

195
196
197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216

217
157
158
159
160
161
162
163

164
165
166

167
168


169
170
171

172
173
174
175
176
177
178
179

180
181
182
183

184
185
186
187
188
189
190
191
192
193
194

195
196
197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216

217
218







-
+


-
+

-
-
+
+

-
+







-
+


+
-
+










-
+


-
+


















-
+

		menumanual(0, scorelines.length() + 1, teamscores);
	};
};

// sendmap/getmap commands, should be replaced by more intuitive map downloading

void
sendmap(const char *mapname)
sendmap(OFString *mapname)
{
	@autoreleasepool {
		if (*mapname)
		if (mapname.length > 0)
			save_world(mapname);
		changemap(@(mapname));
		mapname = getclientmap().UTF8String;
		changemap(mapname);
		mapname = getclientmap();
		int mapsize;
		uchar *mapdata = readmap(mapname, &mapsize);
		uchar *mapdata = readmap(mapname.UTF8String, &mapsize);
		if (!mapdata)
			return;
		ENetPacket *packet = enet_packet_create(
		    NULL, MAXTRANS + mapsize, ENET_PACKET_FLAG_RELIABLE);
		uchar *start = packet->data;
		uchar *p = start + 2;
		putint(p, SV_SENDMAP);
		sendstring(mapname, p);
		sendstring(mapname.UTF8String, p);
		putint(p, mapsize);
		if (65535 - (p - start) < mapsize) {
			conoutf(
			conoutf(@"map %s is too large to send", mapname);
			    @"map %s is too large to send", mapname.UTF8String);
			free(mapdata);
			enet_packet_destroy(packet);
			return;
		};
		memcpy(p, mapdata, mapsize);
		p += mapsize;
		free(mapdata);
		*(ushort *)start = ENET_HOST_TO_NET_16(p - start);
		enet_packet_resize(packet, p - start);
		sendpackettoserv(packet);
		conoutf(@"sending map %s to server...", mapname);
		conoutf(@"sending map %s to server...", mapname.UTF8String);
		sprintf_sd(msg)(
		    "[map %s uploaded to server, \"getmap\" to receive it]",
		    mapname);
		    mapname.UTF8String);
		toserver(msg);
	}
}

void
getmap()
{
	ENetPacket *packet =
	    enet_packet_create(NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
	uchar *start = packet->data;
	uchar *p = start + 2;
	putint(p, SV_RECVMAP);
	*(ushort *)start = ENET_HOST_TO_NET_16(p - start);
	enet_packet_resize(packet, p - start);
	sendpackettoserv(packet);
	conoutf(@"requesting map from server...");
}

COMMAND(sendmap, ARG_1CSTR)
COMMAND(sendmap, ARG_1STR)
COMMAND(getmap, ARG_NONE)