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_actor.h" 00028 #include "e_event_actorstats.h" 00029 00036 void CL_ActorStats (const eventRegister_t *self, struct dbuffer *msg) 00037 { 00038 le_t *le; 00039 int entnum, oldTUs = 0; 00040 00041 entnum = NET_ReadShort(msg); 00042 le = LE_Get(entnum); 00043 if (!le) 00044 LE_NotFoundError(entnum); 00045 00046 switch (le->type) { 00047 case ET_ACTORHIDDEN: 00048 case ET_ACTOR: 00049 case ET_ACTOR2x2: 00050 break; 00051 default: 00052 Com_Printf("CL_ActorStats: LE (%i) not an actor (type: %i)\n", entnum, le->type); 00053 return; 00054 } 00055 00056 if (le->selected) 00057 oldTUs = le->TU; 00058 00059 NET_ReadFormat(msg, self->formatString, &le->TU, &le->HP, &le->STUN, &le->morale); 00060 00061 if (le->TU > le->maxTU) 00062 le->maxTU = le->TU; 00063 if (le->HP > le->maxHP) 00064 le->maxHP = le->HP; 00065 if (le->morale > le->maxMorale) 00066 le->maxMorale = le->morale; 00067 00068 /* if selActor's timeunits have changed, update movelength */ 00069 if (le->TU != oldTUs && le->selected) 00070 CL_ActorResetMoveLength(le); 00071 }