e_event_actorstartshoot.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 "../../../../renderer/r_mesh_anim.h"
00028 #include "e_event_actorstartshoot.h"
00029 
00030 int CL_ActorStartShootTime (const eventRegister_t *self, struct dbuffer *msg, const int dt)
00031 {
00032 #if 0
00033     nextTime += 300;
00034     shootTime = nextTime;
00035 #else
00036     return cl.time;
00037 #endif
00038 }
00039 
00050 void CL_ActorStartShoot (const eventRegister_t *self, struct dbuffer *msg)
00051 {
00052     le_t *le;
00053     pos3_t from, target;
00054     int entnum;
00055     shoot_types_t shootType;
00056 
00057     NET_ReadFormat(msg, self->formatString, &entnum, &shootType, &from, &target);
00058 
00059     /* shooting actor */
00060     le = LE_Get(entnum);
00061 
00062     /* center view (if wanted) */
00063     if (cl.actTeam != cls.team)
00064         CL_CameraRoute(from, target);
00065 
00066     /* actor dependent stuff following */
00067     if (!le)
00068         /* it's OK, the actor is not visible */
00069         return;
00070 
00071     if (!LE_IsLivingActor(le) || LE_IsStunned(le)) {
00072         Com_Printf("CL_ActorStartShoot: LE (%i) not a living actor (type: %i)\n", entnum, le->type);
00073         return;
00074     }
00075 
00076     /* ET_ACTORHIDDEN actors don't have a model yet */
00077     if (le->type == ET_ACTORHIDDEN)
00078         return;
00079 
00080     /* Animate - we have to check if it is right or left weapon usage. */
00081     if (IS_SHOT_RIGHT(shootType)) {
00082         R_AnimChange(&le->as, le->model1, LE_GetAnim("move", le->right, le->left, le->state));
00083     } else if (IS_SHOT_LEFT(shootType)) {
00084         R_AnimChange(&le->as, le->model1, LE_GetAnim("move", le->left, le->right, le->state));
00085     } else if (!IS_SHOT_HEADGEAR(shootType)) {
00086         /* no animation for headgear (yet) */
00087         Com_Error(ERR_DROP, "CL_ActorStartShoot: Invalid shootType given (entnum: %i, shootType: %i).\n", shootType, entnum);
00088     }
00089 }

Generated by  doxygen 1.6.2