/*
#include "events.h"
enum m4a1_e
{
M4A1_IDLE1 = 0,
M4A1_SHOOT1,
M4A1_SHOOT2,
M4A1_SHOOT3,
M4A1_RELOAD,
M4A1_DRAW,
M4A1_ADD_SILENCER,
M4A1_IDLE_UNSIL,
M4A1_SHOOT1_UNSIL,
M4A1_SHOOT2_UNSIL,
M4A1_SHOOT3_UNSIL,
M4A1_RELOAD_UNSIL,
M4A1_DRAW_UNSIL,
M4A1_DETACH_SILENCER
};
static const char *SOUNDS_NAME[] =
{
"weapons/m4a1-1.wav",
"weapons/m4a1_unsil-1.wav",
"weapons/m4a1_unsil-2.wav"
};
void EV_FireM4A1( event_args_t *args )
{
vec3_t ShellVelocity;
vec3_t ShellOrigin;
vec3_t vecSrc, vecAiming;
int sequence, idx = args->entindex;
Vector origin( args->origin );
Vector angles(
args->iparam1 / 100.0f + args->angles[0],
args->iparam2 / 100.0f + args->angles[1],
args->angles[2]
);
Vector velocity( args->velocity );
Vector forward, right, up;
AngleVectors( angles, forward, right, up );
if ( EV_IsLocal( idx ) )
{
++g_iShotsFired;
EV_MuzzleFlash();
if( args->bparam1 )
{
sequence = Com_RandomLong( M4A1_SHOOT1, M4A1_SHOOT3 );
}
else
{
sequence = Com_RandomLong( M4A1_SHOOT1_UNSIL, M4A1_SHOOT3_UNSIL );
}
gEngfuncs.pEventAPI->EV_WeaponAnimation(sequence, 2);
if( !gHUD.cl_righthand->value )
{
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, -10.0, 0);
}
else
{
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -8.0, 10.0, 0);
}
}
else
{
EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0);
}
EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], g_iRShell, TE_BOUNCE_SHELL);
PLAY_EVENT_SOUND( args->bparam1 ? SOUNDS_NAME[0] : SOUNDS_NAME[Com_RandomLong( 1, 2 )]);
EV_GetGunPosition( args, vecSrc, origin );
VectorCopy( forward, vecAiming );
Vector vSpread;
vSpread.x = args->fparam1;
vSpread.y = args->fparam2;
EV_HLDM_FireBullets( idx,
forward, right, up,
1, vecSrc, vecAiming,
vSpread, 8192.0, BULLET_PLAYER_556MM,
2 );
}