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.29 by root, Wed Mar 14 00:07:26 2007 UTC vs.
Revision 1.31 by root, Wed Mar 14 04:12:29 2007 UTC

254 254
255 packet sl; 255 packet sl;
256 256
257 if (facecache && !forced) 257 if (facecache && !forced)
258 { 258 {
259 if (faces_sent[facenum] & NS_FACESENT_FACE) 259 if (faces_sent[facenum])
260 return; 260 return;
261 261
262 faces_sent[facenum] |= NS_FACESENT_FACE; 262 faces_sent[facenum] = true;
263 263
264 if (force_face0) 264 if (force_face0)
265 sl << "face " << uint16 (facenum); 265 sl << "face " << uint16 (facenum);
266 else if (image2) 266 else if (image2)
267 sl << "face2 " << uint16 (facenum) << uint8 (0) << uint32 (force_bad_checksum ? gcfclient_checksum (d) : 0); 267 sl << "face2 " << uint16 (facenum) << uint8 (0) << uint32 (force_bad_checksum ? gcfclient_checksum (d) : 0);
268 else 268 else
269 sl << "face1 " << uint16 (facenum) << uint32 (force_bad_checksum ? gcfclient_checksum (d) : 0); 269 sl << "face1 " << uint16 (facenum) << uint32 (force_bad_checksum ? gcfclient_checksum (d) : 0);
270 270
271 // how lame 271 // how lame
272 print_facename (sl, *d); 272 print_facename (sl, *d);
273 send_packet (sl);
274
275 faceinfo *f = face_info (facenum);
276 if (f->smooth && EMI_smooth)
277 {
278 send_face (f->smooth);
279
280 packet sl ("smooth");
281
282 sl << uint16 (facenum)
283 << uint16 (f->smooth);
284
285 send_packet (sl);
286 }
273 } 287 }
274 else 288 else
275 { 289 {
276 sl << (image2 ? "image2 " : "image ") 290 sl << (image2 ? "image2 " : "image ")
277 << uint32 (facenum); 291 << uint32 (facenum);
279 if (image2) 293 if (image2)
280 sl << uint8 (0); 294 sl << uint8 (0);
281 295
282 sl << uint32 (d->data.size ()) 296 sl << uint32 (d->data.size ())
283 << data (d->data.data (), d->data.size ()); 297 << data (d->data.data (), d->data.size ());
284 }
285 298
286 send_packet (sl); 299 send_packet (sl);
300 }
287} 301}
288 302
289// send all faces of this object to the client 303// send all faces of this object to the client
290// this uses more bandwidth initially, but makes 304// this uses more bandwidth initially, but makes
291// animations look much smoother, and every client 305// animations look much smoother, and every client
300 animation &anim = animations [ob->animation_id]; 314 animation &anim = animations [ob->animation_id];
301 315
302 for (int i = 0; i < anim.num_animations; i++) 316 for (int i = 0; i < anim.num_animations; i++)
303 send_face (anim.faces [i]); 317 send_face (anim.faces [i]);
304 } 318 }
305}
306
307/**
308 * A lot like the old AskSmooth (in fact, now called by AskSmooth).
309 * Basically, it makes no sense to wait for the client to request a
310 * a piece of data from us that we know the client wants. So
311 * if we know the client wants it, might as well push it to the
312 * client.
313 */
314void
315client::send_smooth (faceidx face)
316{
317 faceinfo *f = face_info (face);
318
319 if (!f)
320 return;
321
322 if (faces_sent[face] & NS_FACESENT_SMOOTH)
323 return;
324
325 faces_sent[face] |= NS_FACESENT_SMOOTH;
326
327 /* If we can't find a face, return and set it so we won't try to send this
328 * again.
329 */
330 if (!f->smooth)
331 {
332 LOG (llevError, "could not findsmooth for %d.\n", face);
333 return;
334 }
335
336 send_face (f->smooth);
337
338 packet sl ("smooth");
339
340 sl << uint16 (face)
341 << uint16 (f->smooth);
342
343 send_packet (sl);
344} 319}
345 320
346/** 321/**
347 * Need to send an animation sequence to the client. 322 * Need to send an animation sequence to the client.
348 * We will send appropriate face commands to the client if we haven't 323 * We will send appropriate face commands to the client if we haven't
433 408
434 sl.printf ("replyinfo image_sums %d %d ", start, stop); 409 sl.printf ("replyinfo image_sums %d %d ", start, stop);
435 410
436 for (int i = start; i <= stop && i < faces.size (); i++) 411 for (int i = start; i <= stop && i < faces.size (); i++)
437 { 412 {
438 ns->faces_sent[i] |= NS_FACESENT_FACE; 413 ns->faces_sent[i] = true;
439 414
440 const facedata *d = face_data (i, ns->faceset); 415 const facedata *d = face_data (i, ns->faceset);
441 416
442 if (sl.room () < 2 + 4 + 1 + d->data.size () + 1) 417 if (sl.room () < 2 + 4 + 1 + d->data.size () + 1)
443 break; 418 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines