e_event_entperish.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 "../../../cl_particle.h"
00028 #include "e_event_entperish.h"
00029 
00034 void CL_EntPerish (const eventRegister_t *self, struct dbuffer *msg)
00035 {
00036     int     entnum;
00037     le_t    *le, *actor;
00038 
00039     NET_ReadFormat(msg, self->formatString, &entnum);
00040 
00041     le = LE_Get(entnum);
00042 
00043     if (!le)
00044         LE_NotFoundError(entnum);
00045 
00046     /* decrease the count of spotted aliens (also stunned) */
00047     if (LE_IsLivingAndVisibleActor(le) && le->team != cls.team && le->team != TEAM_CIVILIAN)
00048         cl.numAliensSpotted--;
00049 
00050     switch (le->type) {
00051     case ET_ITEM:
00052         cls.i.EmptyContainer(&cls.i, &le->i, INVDEF(csi.idFloor));
00053 
00054         /* search owners (there can be many, some of them dead) */
00055         actor = NULL;
00056         while ((actor = LE_GetNextInUse(actor))) {
00057             if ((actor->type == ET_ACTOR || actor->type == ET_ACTOR2x2)
00058              && VectorCompare(actor->pos, le->pos)) {
00059                 Com_DPrintf(DEBUG_CLIENT, "CL_EntPerish: le of type ET_ITEM hidden\n");
00060                 FLOOR(actor) = NULL;
00061             }
00062         }
00063         break;
00064     case ET_ACTOR:
00065     case ET_ACTOR2x2:
00066         cls.i.DestroyInventory(&cls.i, &le->i);
00067         break;
00068 #ifdef DEBUG
00069     case ET_ACTORHIDDEN:
00070         Com_DPrintf(DEBUG_CLIENT, "CL_EntPerish: It should not happen that we perish an hidden actor\n");
00071         return;
00072 #endif
00073     case ET_PARTICLE:
00074         CL_ParticleFree(le->ptl);
00075         le->ptl = NULL;
00076         break;
00077     case ET_BREAKABLE:
00078     case ET_DOOR:
00079         break;
00080     default:
00081         break;
00082     }
00083 
00084     le->invis = qtrue;
00085 }
00086 

Generated by  doxygen 1.6.2