… | |
… | |
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 | |
|
|
264 | faceinfo *f = face_info (facenum); |
|
|
265 | if (f->smooth && EMI_smooth) |
|
|
266 | { |
|
|
267 | send_face (f->smooth); |
|
|
268 | |
|
|
269 | packet sl ("smooth"); |
|
|
270 | |
|
|
271 | sl << uint16 (facenum) |
|
|
272 | << uint16 (f->smooth); |
|
|
273 | |
|
|
274 | send_packet (sl); |
|
|
275 | } |
263 | |
276 | |
264 | if (force_face0) |
277 | if (force_face0) |
265 | sl << "face " << uint16 (facenum); |
278 | sl << "face " << uint16 (facenum); |
266 | else if (image2) |
279 | else if (image2) |
267 | sl << "face2 " << uint16 (facenum) << uint8 (0) << uint32 (force_bad_checksum ? gcfclient_checksum (d) : 0); |
280 | sl << "face2 " << uint16 (facenum) << uint8 (0) << uint32 (force_bad_checksum ? gcfclient_checksum (d) : 0); |
… | |
… | |
271 | // how lame |
284 | // how lame |
272 | print_facename (sl, *d); |
285 | print_facename (sl, *d); |
273 | } |
286 | } |
274 | else |
287 | else |
275 | { |
288 | { |
276 | fprintf (stderr, "image %d\n", facenum);//D |
|
|
277 | sl << (image2 ? "image2 " : "image ") |
289 | sl << (image2 ? "image2 " : "image ") |
278 | << uint32 (facenum); |
290 | << uint32 (facenum); |
279 | |
291 | |
280 | if (image2) |
292 | if (image2) |
281 | sl << uint8 (0); |
293 | sl << uint8 (0); |
… | |
… | |
301 | animation &anim = animations [ob->animation_id]; |
313 | animation &anim = animations [ob->animation_id]; |
302 | |
314 | |
303 | for (int i = 0; i < anim.num_animations; i++) |
315 | for (int i = 0; i < anim.num_animations; i++) |
304 | send_face (anim.faces [i]); |
316 | send_face (anim.faces [i]); |
305 | } |
317 | } |
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 | } |
318 | } |
346 | |
319 | |
347 | /** |
320 | /** |
348 | * Need to send an animation sequence to the client. |
321 | * Need to send an animation sequence to the client. |
349 | * We will send appropriate face commands to the client if we haven't |
322 | * We will send appropriate face commands to the client if we haven't |
… | |
… | |
434 | |
407 | |
435 | sl.printf ("replyinfo image_sums %d %d ", start, stop); |
408 | sl.printf ("replyinfo image_sums %d %d ", start, stop); |
436 | |
409 | |
437 | for (int i = start; i <= stop && i < faces.size (); i++) |
410 | for (int i = start; i <= stop && i < faces.size (); i++) |
438 | { |
411 | { |
439 | ns->faces_sent[i] |= NS_FACESENT_FACE; |
412 | ns->faces_sent[i] = true; |
440 | |
413 | |
441 | const facedata *d = face_data (i, ns->faceset); |
414 | const facedata *d = face_data (i, ns->faceset); |
442 | |
415 | |
443 | if (sl.room () < 2 + 4 + 1 + d->data.size () + 1) |
416 | if (sl.room () < 2 + 4 + 1 + d->data.size () + 1) |
444 | break; |
417 | break; |