

typedef struct
{
int servertime; //0x0000
int buttons; //0x0004
int viewangles[3]; //0x0008 // below here is some usefull stuffs
char lol[0x18];.
}usercmd_t;//Size=0x002C
typedef struct
{
usercmd_t usercmds[128];
int currentCmdNum; // 0x16E8
usercmd_t *GetUserCmd(int cmdNum)
{
int id = cmdNum & 0x7F;
return &usercmds[id];
}
}input_t;
void ( __cdecl* R_WeaponSpread )( cg_t* cg, int weapon, float*BaseSpread, float*MaxSpread ) = ( void( __cdecl* )( cg_t*, int, float*, float* ) )0x4D3820;
int ( __cdecl* R_GetCurrentWeapon )( cg_t* cg ) = ( int( __cdecl* )( cg_t* ) )0x4ABCF0;
void GetRandomSpread(int iSeed, float* flSpreadRight,float* flSpreadUp )
{
DWORD dwCall = 0x5AAB80;
int iSpreadSeed = 214013 * (214013 * (214013 * (214013 * iSeed + 2531011) + 2531011) + 2531011) + 2531011;
__asm
{
lea eax, dword ptr ds: [ flSpreadUp ];
push [ eax ];
lea ecx, dword ptr ds: [ flSpreadRight ];
push [ ecx ];
lea esi, dword ptr ds: [ iSpreadSeed ];
call dword ptr ds:[ dwCall ];
add esp, 0x8
}
}
void GetWeaponSpread( float*Spread )
{
float SpreadMultiplier = *(float*)0xA03D48 / 255.0f;
float MaxSpread = 0.0f;
float BaseSpread = 0.0f;
int iLocalWeapon = R_GetCurrentWeapon( cg );
R_WeaponSpread( cg, iLocalWeapon, &BaseSpread, &MaxSpread );
*Spread = BaseSpread + ( ( MaxSpread - BaseSpread ) * SpreadMultiplier );
}
double Radians(float Degrees)
{
return 0.01745329238474369 * Degrees;
}
VOID ApplyNoSpread( )
{
input_t * input = ( input_t* )0x1063CA4;
usercmd_t * pAntiAimCmd = input->GetUserCmd( input->currentCmdNum );
antiAim( pAntiAimCmd );
int iSeed = *( int* )0x96A60C;
float flSpread, flSpreadX, flSpreadY;
float flDistance = 8192.f;
Vector3 ForwardVec, RightVec, UpVec, CalculatedSpreadView, SpreadView, DestinationVec, BulletAnglesVec, FinalVecAngles;
//BulletAnglesVec[ 0 ] = *( float* )0x976560; these are working ones too
//BulletAnglesVec[ 1 ] = *( float* )0x976564;
//BulletAnglesVec[ 2 ] = *( float* )0x976568;
BulletAnglesVec[ 0 ] = refAngles[ 0 ];
BulletAnglesVec[ 1 ] = refAngles[ 1 ];
BulletAnglesVec[ 2 ] = refAngles[ 2 ];
gMath.AngleVectors( BulletAnglesVec, ForwardVec, RightVec, UpVec );
GetWeaponSpread( &flSpread );
flSpread = tan( Radians( flSpread ) ) * flDistance;
GetRandomSpread(iSeed, &flSpreadX, &flSpreadY );
flSpreadX *= flSpread;
flSpreadY *= flSpread;
SpreadView[ 0 ] = refDef->vOrigin[ 0 ] + ForwardVec[ 0 ] * flDistance + RightVec[ 0 ] * flSpreadX + UpVec[ 0 ] * flSpreadY;
SpreadView[ 1 ] = refDef->vOrigin[ 1 ] + ForwardVec[ 1 ] * flDistance + RightVec[ 1 ] * flSpreadX + UpVec[ 1 ] * flSpreadY;
SpreadView[ 2 ] = refDef->vOrigin[ 2 ] + ForwardVec[ 2 ] * flDistance + RightVec[ 2 ] * flSpreadX + UpVec[ 2 ] * flSpreadY;
VectorSubtract( SpreadView, refDef->vOrigin, CalculatedSpreadView );
gMath.VectorAngles( CalculatedSpreadView , DestinationVec );
FinalVecAngles[ 0 ] = BulletAnglesVec[ 0 ] - DestinationVec[ 0 ];
FinalVecAngles[ 1 ] = BulletAnglesVec[ 1 ] - DestinationVec[ 1 ];
FinalVecAngles[ 2 ] = BulletAnglesVec[ 2 ] - DestinationVec[ 2 ];
float* ViewAngleY = (float*)0x1063C98;
Vector3 CalculatedFinalVecAngles = { ViewAngleY[ 0 ], ViewAngleY[ 1 ], 0 };
CalculatedFinalVecAngles[ 0 ] += FinalVecAngles[ 0 ];
CalculatedFinalVecAngles[ 1 ] += FinalVecAngles[ 1 ];
CalculatedFinalVecAngles[ 2 ] = 0;
if( gCvar.bSilentAim && isTargeting )
{
if( !clientinfo[cg->clientNum].isZoomed )
{
CalculatedFinalVecAngles[ 0 ] += SilentAngles[ 0 ];
CalculatedFinalVecAngles[ 1 ] += SilentAngles[ 1 ];
CalculatedFinalVecAngles[ 2 ] += SilentAngles[ 2 ];
}
else
{
pAntiAimCmd->viewangles[ 0 ] += ANGLE2SHORT( SilentAngles[ 0 ] );
pAntiAimCmd->viewangles[ 1 ] += ANGLE2SHORT( SilentAngles[ 1 ] );
pAntiAimCmd->viewangles[ 2 ] = 0;
}
}
if( !clientinfo[cg->clientNum].isZoomed )
{
pAntiAimCmd->viewangles[ 0 ] = ANGLE2SHORT( CalculatedFinalVecAngles[ 0 ] );
pAntiAimCmd->viewangles[ 1 ] = ANGLE2SHORT( CalculatedFinalVecAngles[ 1 ] );
pAntiAimCmd->viewangles[ 2 ] = 0;
}
}