void EV_FireXM1014(event_args_s *args) { int idx; vec3_t origin; vec3_t angles; vec3_t velocity; vec3_t ShellVelocity; vec3_t ShellOrigin; int shell; vec3_t vecSrc, vecAiming; vec3_t up, right, forward; idx = args->entindex; VectorCopy( args->origin, origin ); angles.x = (long double)args->iparam1 / 100 + args->angles[0]; angles.y = (long double)args->iparam2 / 100 + args->angles[1]; angles.z = args->angles[2]; VectorCopy( args->velocity, velocity ); AngleVectors( angles, forward, right, up ); if ( EV_IsLocal( idx ) ) { ++g_iShotsFired; EV_MuzzleFlash(); gEngfuncs.pEventAPI->EV_WeaponAnimation(gEngfuncs.pfnRandomLong(XM1014_FIRE1, XM1014_FIRE2), 2); if( !cl_righthand->value ) { EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 22.0, -9.0, -11.0, 0); } else { EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 22.0, -9.0, 11.0, 0); } } else { EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 20.0, -12.0, 4.0, 0); } shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/shotgunshell.mdl"); EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL); gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/xm1014-1.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); EV_GetGunPosition( args, vecSrc, origin ); VectorCopy( forward, vecAiming ); Vector vSpread; int tracerCount; vSpread.x = 0.0725; vSpread.y = 0.0725; EV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, vSpread, 8192.0, BULLET_PLAYER_BUCKSHOT, 0, &tracerCount, 1 ); }
void EV_FireGALIL( event_args_t *args ) { vec3_t ShellVelocity; vec3_t ShellOrigin; vec3_t vecSrc, vecAiming; int 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(); gEngfuncs.pEventAPI->EV_WeaponAnimation(GALIL_SHOOT1 + Com_RandomLong(0,2), 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( SOUNDS_NAME[Com_RandomLong( 0, 1 )] ); 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 ); }
void EV_FireGALIL( event_args_t *args ) { int idx; vec3_t origin; vec3_t angles; vec3_t velocity; vec3_t ShellVelocity; vec3_t ShellOrigin; int shell; vec3_t vecSrc, vecAiming; vec3_t up, right, forward; float flSpread = 0.01; idx = args->entindex; VectorCopy( args->origin, origin ); VectorCopy( args->angles, angles ); VectorCopy( args->velocity, velocity ); AngleVectors( angles, forward, right, up ); if ( EV_IsLocal( idx ) ) { EV_MuzzleFlash(); gEngfuncs.pEventAPI->EV_WeaponAnimation(GALIL_SHOOT1 + gEngfuncs.pfnRandomLong(0,2), 2); gHUD.RealSize += 150; //V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) ); } shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/rshell.mdl"); EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, -right, up, 12, -10, -7 ); EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL); gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/galil-1.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); EV_GetGunPosition( args, vecSrc, origin ); VectorCopy( forward, vecAiming ); EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, 0, 0, 0, args->fparam1, args->fparam2 ); }
void EV_FireXM1014(event_args_s *args) { int idx; vec3_t origin; vec3_t angles; vec3_t velocity; vec3_t ShellVelocity; vec3_t ShellOrigin; int shell; vec3_t vecSrc, vecAiming; vec3_t up, right, forward; float flSpread = 0.01; idx = args->entindex; VectorCopy( args->origin, origin ); VectorCopy( args->angles, angles ); VectorCopy( args->velocity, velocity ); AngleVectors( angles, forward, right, up ); if ( EV_IsLocal( idx ) ) { ++g_iShotsFired; EV_MuzzleFlash(); gEngfuncs.pEventAPI->EV_WeaponAnimation(gEngfuncs.pfnRandomLong(XM1014_FIRE1, XM1014_FIRE2), 2); } shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/shotgunshell.mdl"); EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, -right, up, 12, -10, -7 ); EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL); gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/xm1014-1.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); EV_GetGunPosition( args, vecSrc, origin ); VectorCopy( forward, vecAiming ); EV_HLDM_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, 8192, 0, 0, 0, args->fparam1, args->fparam2 ); }
void EV_FireMAC10(event_args_s *args) { vec3_t origin, angles, velocity; vec3_t ShellVelocity, ShellOrigin; vec3_t vecSrc, vecAiming; vec3_t up, right, forward; float flSpread = 0.01; const char *szSoundName; int sequence, shell, idx; idx = args->entindex; VectorCopy( args->origin, origin ); VectorCopy( args->angles, angles ); VectorCopy( args->velocity, velocity ); AngleVectors( angles, forward, right, up ); if ( EV_IsLocal( args->entindex ) ) { gEngfuncs.pEventAPI->EV_WeaponAnimation(gEngfuncs.pfnRandomLong(MAC10_SHOOT1, MAC10_SHOOT3), 2); EV_MuzzleFlash(); } shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/rshell.mdl"); EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, -right, up, 12, -10, -7 ); EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL); gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/mac10-1.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); EV_GetGunPosition( args, vecSrc, origin ); VectorCopy( forward, vecAiming ); EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, 0, 0, 0, args->fparam1, args->fparam2 ); }
int CHudAmmo::MsgFunc_Brass( const char *pszName, int iSize, void *pbuf ) { BEGIN_READ( pbuf, iSize ); READ_BYTE(); Vector start, velocity; start.x = READ_COORD(); start.y = READ_COORD(); start.z = READ_COORD(); READ_COORD(); READ_COORD(); // unused data READ_COORD(); velocity.x = READ_COORD(); velocity.y = READ_COORD(); velocity.z = READ_COORD(); float Rotation = M_PI * READ_ANGLE() / 180.0f; int ModelIndex = READ_SHORT(); int BounceSoundType = READ_BYTE(); int Life = READ_BYTE(); READ_BYTE(); float sin, cos, x, y; sincosf( Rotation, &sin, &cos ); x = -9.0 * sin; y = 9.0 * cos; if( cl_righthand->value != 0.0f ) { velocity.x += sin * -120.0; velocity.y += cos * 120.0; x = 9.0 * sin; y = -9.0 * cos; } start.x += x; start.y += y; EV_EjectBrass( start, velocity, Rotation, ModelIndex, BounceSoundType, Life ); return 1; }
void EV_FireUSP( event_args_t *args ) { int idx; vec3_t origin; vec3_t angles; vec3_t velocity; vec3_t ShellVelocity; vec3_t ShellOrigin; int shell; vec3_t vecSrc, vecAiming; vec3_t up, right, forward; float flSpread = 0.01; const char *szSoundName; idx = args->entindex; VectorCopy( args->origin, origin ); VectorCopy( args->angles, angles ); VectorCopy( args->velocity, velocity ); AngleVectors( angles, forward, right, up ); if ( EV_IsLocal( idx ) ) { EV_MuzzleFlash(); if( args->bparam2 ) gEngfuncs.pEventAPI->EV_WeaponAnimation(gEngfuncs.pfnRandomLong(USP_SHOOT1,USP_SHOOT3), 2); else gEngfuncs.pEventAPI->EV_WeaponAnimation(gEngfuncs.pfnRandomLong(USP_UNSIL_SHOOT1, USP_UNSIL_SHOOT3), 2); } shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/pshell.mdl"); EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, -right, up, 12, -10, -7 ); EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL); if( args->bparam2 ) { szSoundName = gEngfuncs.pfnRandomLong( 0, 1 ) ? "weapons/usp1.wav" : "weapons/usp2.wav"; } else { szSoundName = "weapons/usp_unsil-1.wav"; } gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, szSoundName, 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); EV_GetGunPosition( args, vecSrc, origin ); VectorCopy( forward, vecAiming ); EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, 0, 0, 0, args->fparam1, args->fparam2 ); }
void EV_FireUSP( event_args_t *args ) { vec3_t ShellVelocity; vec3_t ShellOrigin; vec3_t vecSrc, vecAiming; bool silencer_on = !args->bparam2; bool empty = !args->bparam1; int 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; int seq; if( g_bHoldingShield ) { if( !empty ) seq = Com_RandomLong(USP_SHIELD_SHOOT1, USP_SHIELD_SHOOT2); else seq = USP_SHIELD_SHOOT_EMPTY; } else if ( silencer_on ) { if( !empty ) seq = Com_RandomLong(USP_UNSIL_SHOOT1, USP_UNSIL_SHOOT3); else seq = USP_UNSIL_SHOOT_EMPTY; } else { EV_MuzzleFlash(); if( !empty ) seq = Com_RandomLong(USP_SHOOT1, USP_SHOOT3); else seq = USP_SHOOT_EMPTY; } gEngfuncs.pEventAPI->EV_WeaponAnimation(seq, 2); if( !gHUD.cl_righthand->value ) { EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, -14.0, 0); } else { EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, 14.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_iPShell, TE_BOUNCE_SHELL); PLAY_EVENT_SOUND( silencer_on? SOUNDS_NAME[2] : SOUNDS_NAME[Com_RandomLong(0, 1)] ); EV_GetGunPosition( args, vecSrc, origin ); VectorCopy( forward, vecAiming ); Vector vSpread; int tracerCount; vSpread.x = args->fparam1; vSpread.y = args->fparam2; EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, vSpread, 8192.0, BULLET_PLAYER_45ACP, 0, &tracerCount, 2 ); }
void EV_Fireglock18( event_args_t *args ) { vec3_t ShellVelocity; vec3_t ShellOrigin; vec3_t vecSrc, vecAiming; int 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(); int seq; if( args->bparam1 ) { if( g_bHoldingShield ) seq = GLOCK18_SHIELD_SHOOT; else seq = (g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE) != 0 || g_bGlockBurstMode? GLOCK18_SHOOT1: GLOCK18_SHOOT3; } else { if( g_bHoldingShield ) seq = GLOCK18_SHIELD_SHOOT_EMPTY; else seq = GLOCK18_SHOOT_EMPTY; } gEngfuncs.pEventAPI->EV_WeaponAnimation(seq, 2); if( !gHUD.cl_righthand->value ) { EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, -14.0, 0); } else { EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, right, up, 36.0, -14.0, 14.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_iPShell, TE_BOUNCE_SHELL); PLAY_EVENT_SOUND( ((g_iWeaponFlags & WPNSTATE_GLOCK18_BURST_MODE) != 0 || g_bGlockBurstMode ) && !g_bHoldingShield ? SOUNDS_NAME[0] : SOUNDS_NAME[1] ); 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, 4096.0, BULLET_PLAYER_9MM, 2 ); }
void EV_FireP228(event_args_s *args) { int idx; vec3_t origin; vec3_t angles; vec3_t velocity; vec3_t ShellVelocity; vec3_t ShellOrigin; int shell; vec3_t vecSrc, vecAiming; vec3_t up, right, forward; float flSpread = 0.01; idx = args->entindex; VectorCopy( args->origin, origin ); VectorCopy( args->angles, angles ); VectorCopy( args->velocity, velocity ); AngleVectors( angles, forward, right, up ); if ( EV_IsLocal( idx ) ) { ++g_iShotsFired; EV_MuzzleFlash(); int seq; if( args->bparam1 ) { if( g_bHoldingShield ) seq = gEngfuncs.pfnRandomLong(P228_SHIELD_SHOOT1, P228_SHIELD_SHOOT2); else seq = gEngfuncs.pfnRandomLong(P228_SHOOT1, P228_SHOOT3); } else { seq = g_bHoldingShield ? (int)P228_SHIELD_SHOOT_EMPTY : (int)P228_SHOOT_EMPTY; } gEngfuncs.pEventAPI->EV_WeaponAnimation(seq, 2); } shell = gEngfuncs.pEventAPI->EV_FindModelIndex ("models/pshell.mdl"); EV_GetDefaultShellInfo( args, origin, velocity, ShellVelocity, ShellOrigin, forward, -right, up, 12, -10, -7 ); EV_EjectBrass(ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL); gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/p228-1.wav", 1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ) ); EV_GetGunPosition( args, vecSrc, origin ); VectorCopy( forward, vecAiming ); EV_HLDM_FireBullets( idx, forward, right, up, 1, vecSrc, vecAiming, 8192, 0, 0, 0, args->fparam1, args->fparam2 ); }