e_event_actorthrow.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 "e_event_actorthrow.h"
00028 
00029 int CL_ActorDoThrowTime (const eventRegister_t *self, struct dbuffer *msg, const int dt)
00030 {
00031     const int t = NET_ReadShort(msg);
00032     return cl.time + t;
00033 }
00034 
00040 void CL_ActorDoThrow (const eventRegister_t *self, struct dbuffer *msg)
00041 {
00042     const fireDef_t *fd;
00043     vec3_t muzzle, v0;
00044     int flags;
00045     int dtime;
00046     int objIdx;
00047     const objDef_t *obj;
00048     weaponFireDefIndex_t weapFdsIdx;
00049     fireDefIndex_t fdIdx;
00050 
00051     /* read data */
00052     NET_ReadFormat(msg, self->formatString, &dtime, &objIdx, &weapFdsIdx, &fdIdx, &flags, &muzzle, &v0);
00053 
00054     /* get the fire def */
00055     obj = INVSH_GetItemByIDX(objIdx);
00056     fd = FIRESH_GetFiredef(obj, weapFdsIdx, fdIdx);
00057 
00058     /* add effect le (local entity) */
00060     LE_AddGrenade(fd, flags, muzzle, v0, dtime, NULL);
00061 
00062     /* start the sound */
00063     if (fd->fireSound[0] && !(flags & SF_BOUNCED)) {
00064         s_sample_t *sample = S_LoadSample(fd->fireSound);
00065         S_PlaySample(muzzle, sample, SOUND_ATTN_IDLE, SND_VOLUME_DEFAULT);
00066     }
00067 }

Generated by  doxygen 1.6.2