e_event_entappear.c

Go to the documentation of this file.
00001 
00005 /*
00006 Copyright (C) 2002-2010 UFO: Alien Invasion.
00007 
00008 This program is free software; you can redistribute it and/or
00009 modify it under the terms of the GNU General Public License
00010 as published by the Free Software Foundation; either version 2
00011 of the License, or (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016 
00017 See the GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00023 */
00024 
00025 #include "../../../../client.h"
00026 #include "../../../cl_localentity.h"
00027 #include "e_event_entappear.h"
00028 #include "../../../../../common/grid.h"
00029 
00036 void CL_EntAppear (const eventRegister_t *self, struct dbuffer *msg)
00037 {
00038     le_t    *le;
00039     int     entnum;
00040     entity_type_t type;
00041     pos3_t  pos;
00042 
00043     NET_ReadFormat(msg, self->formatString, &entnum, &type, &pos);
00044 
00045     /* check if the ent is already visible */
00046     le = LE_Get(entnum);
00047     if (!le) {
00048         le = LE_Add(entnum);
00049     } else {
00050         Com_DPrintf(DEBUG_CLIENT, "CL_EntAppear: Entity appearing already visible... overwriting the old one\n");
00051         le->inuse = qtrue;
00052     }
00053 
00054     le->type = type;
00055 
00056     /* the default is invisible - another event will follow which spawns not
00057      * only the le, but also the particle. The visibility is set there, too */
00058     if (le->type == ET_PARTICLE)
00059         le->invis = !cl_leshowinvis->integer;
00060 
00061     VectorCopy(pos, le->pos);
00062     Grid_PosToVec(cl.mapData->map, le->fieldSize, le->pos, le->origin);
00063 }
00064 

Generated by  doxygen 1.6.2