e_event_actorthrow.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 "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
00052 NET_ReadFormat(msg, self->formatString, &dtime, &objIdx, &weapFdsIdx, &fdIdx, &flags, &muzzle, &v0);
00053
00054
00055 obj = INVSH_GetItemByIDX(objIdx);
00056 fd = FIRESH_GetFiredef(obj, weapFdsIdx, fdIdx);
00057
00058
00060 LE_AddGrenade(fd, flags, muzzle, v0, dtime, NULL);
00061
00062
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 }