e_event_actorrevitalised.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_actor.h"
00027 #include "../../../cl_hud.h"
00028 #include "../../../../renderer/r_mesh_anim.h"
00029 #include "e_event_actorrevitalised.h"
00030 
00037 void CL_ActorRevitalised (const eventRegister_t *self, struct dbuffer *msg)
00038 {
00039     le_t *le, *floor;
00040     int entnum, state;
00041 
00042     NET_ReadFormat(msg, self->formatString, &entnum, &state);
00043 
00044     /* get les */
00045     le = LE_Get(entnum);
00046 
00047     if (!le)
00048         LE_NotFoundError(entnum);
00049 
00050     if (!LE_IsStunned(le) && !LE_IsLivingActor(le))
00051         Com_Error(ERR_DROP, "CL_ActorRevitalised: Can't revitalise, LE is not a dead or stunned actor");
00052 
00053     LE_Lock(le);
00054 
00055     /* link any floor container into the actor temp floor container */
00056     floor = LE_Find(ET_ITEM, le->pos);
00057     if (floor)
00058         FLOOR(le) = FLOOR(floor);
00059 
00060     le->state = state;
00061 
00062     /* play animation */
00063     LE_SetThink(le, LET_StartIdle);
00064 
00065     /* Print some info about the death or stun. */
00066     if (le->team == cls.team) {
00067         const character_t *chr = CL_ActorGetChr(le);
00068         if (chr) {
00069             char tmpbuf[128];
00070             Com_sprintf(tmpbuf, lengthof(tmpbuf), _("%s was revitalised\n"), chr->name);
00071             HUD_DisplayMessage(tmpbuf);
00072         }
00073     } else {
00074         switch (le->team) {
00075         case (TEAM_CIVILIAN):
00076             HUD_DisplayMessage(_("A civilian was revitalised.\n"));
00077             break;
00078         case (TEAM_ALIEN):
00079             HUD_DisplayMessage(_("An alien was revitalised.\n"));
00080             break;
00081         case (TEAM_PHALANX):
00082             HUD_DisplayMessage(_("A soldier was revitalised.\n"));
00083             break;
00084         default:
00085             HUD_DisplayMessage(va(_("A member of team %i was revitalised.\n"), le->team));
00086             break;
00087         }
00088     }
00089 
00090     VectorCopy(player_maxs, le->maxs);
00091 
00092     /* add team members to the actor list */
00093     CL_ActorAddToTeamList(le);
00094 
00095     /* update pathing as we maybe not can walk onto this actor anymore */
00096     CL_ActorConditionalMoveCalc(selActor);
00097     LE_Unlock(le);
00098 }

Generated by  doxygen 1.6.2