Skip to content

Commit

Permalink
fixed compiling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
me committed Sep 10, 2023
1 parent 25e6074 commit 48dbe9f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 229 deletions.
141 changes: 0 additions & 141 deletions src/hacks/hitchance.cpp

This file was deleted.

9 changes: 0 additions & 9 deletions src/hacks/hitchance.h

This file was deleted.

41 changes: 0 additions & 41 deletions src/valve/centity.cody.h

This file was deleted.

38 changes: 0 additions & 38 deletions src/valve/centity.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,43 +206,5 @@ class CEntity
{
return memory::Call<float>(this, 439);
}

CVector CalculateSpread(int seed, float inaccuracy, float spread) {

CEntity* activeWeapon = globals::localPlayer->GetActiveWeapon();

float recoil_index, r1, r2, r3, r4, s1, c1, s2, c2;

auto randomSeedFn = reinterpret_cast<void(__cdecl*)(int)>(interfaces::randomSeed);
auto randomFloatFn = reinterpret_cast<float(__cdecl*)(float, float)>(interfaces::randomFloat);

if (!activeWeapon) {
return {};
}

int weaponType = activeWeapon->GetWeaponType();

// Seed random
randomSeedFn(seed & 0xff);

float inaccuracy = activeWeapon->GetInaccuracy();
float spread = activeWeapon->GetSpread();

float r1 = randomFloatFn(0.0f, 1.0f);
float r2 = randomFloatFn(0.0f, 3.1415926535897932384f * 2);

// get needed sine / cosine values.
c1 = std::cos(r2);
c2 = std::cos(r4);
s1 = std::sin(r2);
s2 = std::sin(r4);

// calculate spread vector.
return {
(c1 * (r1 * inaccuracy)) + (c2 * (r3 * spread)),
(s1 * (r1 * inaccuracy)) + (s2 * (r3 * spread)),
0.f
};
}

};

0 comments on commit 48dbe9f

Please sign in to comment.