Cube  Diff

Differences From Artifact [1114a27a28]:

To Artifact [b510debdf2]:


1
2
3
4

5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
9
10
11
12




+







// clientextras.cpp: stuff that didn't fit in client.cpp or clientgame.cpp :)

#include "cube.h"

#import "Command.h"
#import "DynamicEntity.h"
#import "Monster.h"

// render players & monsters
// very messy ad-hoc handling of animation frames, should be made more
// configurable

173
174
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189
174
175
176
177
178
179
180


181

182
183
184
185
186
187
188







-
-
+
-







		menumanual(0, scoreLines.count, @"");
		menumanual(0, scoreLines.count + 1, teamScores);
	}
}

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

void
sendmap(OFString *mapname)
COMMAND(sendmap, ARG_1STR, (^(OFString *mapname) {
{
	if (mapname.length > 0)
		save_world(mapname);
	changemap(mapname);
	mapname = getclientmap();
	OFData *mapdata = readmap(mapname);
	if (mapdata == nil)
		return;
206
207
208
209
210
211
212
213

214
215
216

217
218
219
220
221
222
223
224
225
226
227

228
229
230
205
206
207
208
209
210
211

212
213


214

215
216
217
218
219
220
221
222
223

224










-
+

-
-
+
-









-
+
-
-
-
	sendpackettoserv(packet);
	conoutf(@"sending map %@ to server...", mapname);
	OFString *msg =
	    [OFString stringWithFormat:@"[map %@ uploaded to server, "
	                               @"\"getmap\" to receive it]",
	              mapname];
	toserver(msg);
}
}))

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

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