e_event_entperish.c
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
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
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