ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/image.C
(Generate patch)

Comparing deliantra/server/socket/image.C (file contents):
Revision 1.34 by root, Wed Mar 14 18:25:18 2007 UTC vs.
Revision 1.42 by root, Mon May 28 21:22:26 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game 2 * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game.
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5 * Copyright (C) 2001 Mark Wedel 5 * Copyright (©) 2001,2007 Mark Wedel
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * Crossfire TRT is free software; you can redistribute it and/or modify it
9 * it under the terms of the GNU General Public License as published by 9 * under the terms of the GNU General Public License as published by the Free
10 * the Free Software Foundation; either version 2 of the License, or 10 * Software Foundation; either version 2 of the License, or (at your option)
11 * (at your option) any later version. 11 * any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful, but
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * GNU General Public License for more details. 16 * for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License along
19 * along with this program; if not, write to the Free Software 19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 21 *
22 * The author can be reached via e-mail to <crossfire@schmorp.de> 22 * The authors can be reached via e-mail to <crossfire@schmorp.de>
23 */ 23 */
24 24
25/** \file 25/** \file
26 * Image related communication 26 * Image related communication
27 * 27 *
255 if (faces_sent[facenum]) 255 if (faces_sent[facenum])
256 return; 256 return;
257 257
258 faces_sent[facenum] = true; 258 faces_sent[facenum] = true;
259 259
260 // if for some reason we let a client without face caching connect,
261 // we better support that decision here and implement it.
260 if (!facecache) 262 if (!facecache)
261 {
262 send_drawinfo (
263 "*** Please enable image/face caching in preferences or use a client that supports it.\n",
264 NDI_RED
265 );
266 return send_image (facenum); 263 return send_image (facenum);
264
265 if (fxix)
266 {
267 fxface.push_back (facenum);
268 return;
267 } 269 }
268 270
269 packet sl; 271 packet sl;
270 272
271 if (force_face0) 273 if (force_face0)
277 279
278 // how lame 280 // how lame
279 print_facename (sl, *d); 281 print_facename (sl, *d);
280 send_packet (sl); 282 send_packet (sl);
281 283
284 if (EMI_smooth)
285 {
282 faceinfo *f = face_info (facenum); 286 faceinfo *f = face_info (facenum);
283 if (f->smooth && EMI_smooth) 287
284 { 288 if (f->smooth)
289 {
285 send_face (f->smooth); 290 send_face (f->smooth);
286 291
287 packet sl ("smooth"); 292 packet sl ("smooth");
288 293
289 sl << uint16 (facenum) 294 sl << uint16 (facenum)
290 << uint16 (f->smooth); 295 << uint16 (f->smooth);
291 296
292 send_packet (sl); 297 send_packet (sl);
298 }
299 }
300}
301
302void client::flush_fx ()
303{
304 while (!fxface.empty ())
305 {
306 packet fx ("fx");
307 packet sx ("sx");
308
309 do
310 {
311 faceidx facenum = fxface.back (); fxface.pop_back ();
312
313 const facedata *d = face_data (facenum, faceset);
314
315 if (d)
316 {
317 fx << ber32 (facenum)
318 << data8 (d->chksum, CHKSUM_SIZE);
319
320 if (smoothing)
321 {
322 faceinfo *f = face_info (facenum);
323
324 if (f->smooth)
325 {
326 send_face (f->smooth);
327 sx << ber32 (facenum)
328 << ber32 (f->smooth)
329 << ber32 (f->smoothlevel);
330 }
331 }
332 }
333 }
334 while (!fxface.empty ()
335 && fx.room () > ber32::size + CHKSUM_SIZE + 1
336 && sx.room () > ber32::size * 3);
337
338 send_packet (fx);
339 if (sx.length () > 3) send_packet (sx);
293 } 340 }
294} 341}
295 342
296void 343void
297client::send_image (faceidx facenum) 344client::send_image (faceidx facenum)
307 LOG (llevError, "client::send_image (%d) out of bounds??\n", facenum); 354 LOG (llevError, "client::send_image (%d) out of bounds??\n", facenum);
308 return; 355 return;
309 } 356 }
310 357
311 faces_sent[facenum] = true; 358 faces_sent[facenum] = true;
359
360 if (force_image_newmap)
361 force_newmap = true;
312 362
313 packet sl; 363 packet sl;
314 364
315 sl << (image2 ? "image2 " : "image ") 365 sl << (image2 ? "image2 " : "image ")
316 << uint32 (facenum); 366 << uint32 (facenum);
354{ 404{
355 /* Do some checking on the anim_num we got. Note that the animations 405 /* Do some checking on the anim_num we got. Note that the animations
356 * are added in contigous order, so if the number is in the valid 406 * are added in contigous order, so if the number is in the valid
357 * range, it must be a valid animation. 407 * range, it must be a valid animation.
358 */ 408 */
359 if (anim_num < 0 || anim_num > num_animations) 409 if (anim_num < 0 || anim_num >= animations.size ())
360 { 410 {
361 LOG (llevError, "esrv_send_anim (%d) out of bounds??\n", anim_num); 411 LOG (llevError, "esrv_send_anim (%d) out of bounds??\n", anim_num);
362 return; 412 return;
363 } 413 }
364 414

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines