--- deliantra/server/socket/image.C 2007/03/15 14:59:43 1.35 +++ deliantra/server/socket/image.C 2007/05/28 21:22:26 1.42 @@ -1,25 +1,25 @@ /* - * CrossFire, A Multiplayer game - * - * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team - * Copyright (C) 2001 Mark Wedel - * Copyright (C) 1992 Frank Tore Johansen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * The author can be reached via e-mail to + * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. + * + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2001,2007 Mark Wedel + * Copyright (©) 1992,2007 Frank Tore Johansen + * + * Crossfire TRT is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * The authors can be reached via e-mail to */ /** \file @@ -257,31 +257,15 @@ faces_sent[facenum] = true; + // if for some reason we let a client without face caching connect, + // we better support that decision here and implement it. if (!facecache) + return send_image (facenum); + + if (fxix) { - send_drawinfo ( - "\n" - "\n" - "***\n" - "*** WARNING:\n" - "*** Your client does not support face/image caching,\n" - "*** or it has been disabled. Face caching is mandatory\n" - "*** so please enable it or use a newer client.\n" - "***\n" - "*** Look at your client preferences:\n" - "***\n" - "*** CFPlus: all known versions automatically enable the facecache.\n" - "*** cfclient: use the -cache commandline option.\n" - "*** cfclient: map will not redraw automatically (bug).\n" - "*** gcfclient: use -cache commandline option, or enable\n" - "*** gcfclient: Client=>Configure=>Map & Image=>Cache Images.\n" - "*** jcrossclient: your client is broken, use CFPlus or gcfclient.\n" - "***\n" - "***\n", - NDI_RED - ); + fxface.push_back (facenum); return; - //return send_image (facenum); } packet sl; @@ -297,17 +281,62 @@ print_facename (sl, *d); send_packet (sl); - faceinfo *f = face_info (facenum); - if (f->smooth && EMI_smooth) + if (EMI_smooth) { - send_face (f->smooth); + faceinfo *f = face_info (facenum); - packet sl ("smooth"); + if (f->smooth) + { + send_face (f->smooth); + + packet sl ("smooth"); - sl << uint16 (facenum) - << uint16 (f->smooth); + sl << uint16 (facenum) + << uint16 (f->smooth); - send_packet (sl); + send_packet (sl); + } + } +} + +void client::flush_fx () +{ + while (!fxface.empty ()) + { + packet fx ("fx"); + packet sx ("sx"); + + do + { + faceidx facenum = fxface.back (); fxface.pop_back (); + + const facedata *d = face_data (facenum, faceset); + + if (d) + { + fx << ber32 (facenum) + << data8 (d->chksum, CHKSUM_SIZE); + + if (smoothing) + { + faceinfo *f = face_info (facenum); + + if (f->smooth) + { + send_face (f->smooth); + sx << ber32 (facenum) + << ber32 (f->smooth) + << ber32 (f->smoothlevel); + } + } + } + } + while (!fxface.empty () + && fx.room () > ber32::size + CHKSUM_SIZE + 1 + && sx.room () > ber32::size * 3); + + send_packet (fx); + if (sx.length () > 3) send_packet (sx); } } @@ -328,6 +357,9 @@ faces_sent[facenum] = true; + if (force_image_newmap) + force_newmap = true; + packet sl; sl << (image2 ? "image2 " : "image ") @@ -374,7 +406,7 @@ * are added in contigous order, so if the number is in the valid * range, it must be a valid animation. */ - if (anim_num < 0 || anim_num > num_animations) + if (anim_num < 0 || anim_num >= animations.size ()) { LOG (llevError, "esrv_send_anim (%d) out of bounds??\n", anim_num); return;