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