Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only When Shoooting #9

Merged
merged 1 commit into from Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/core/features/recoilCrosshair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
#include "../../includes.hpp"

void Features::RecoilCrosshair::draw() {
if (CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair") || CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair") ) {
if (CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair") ||
CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair")) {
if (Globals::localPlayer) {
if (Interfaces::engine->IsInGame()) {
if (Globals::localPlayer->health() > 0) {
if (Globals::localPlayer->activeWeapon()) {
Weapon* weapon = (Weapon*)Interfaces::entityList->GetClientEntity((uintptr_t)Globals::localPlayer->activeWeapon() & 0xFFF); // GetClientEntityFromHandle is being gay
Weapon *weapon = (Weapon *) Interfaces::entityList->GetClientEntity(
(uintptr_t) Globals::localPlayer->activeWeapon() &
0xFFF); // GetClientEntityFromHandle is being gay
if (weapon) {
float rad;
int x = Globals::screenSizeX / 2;
Expand All @@ -17,16 +20,25 @@ void Features::RecoilCrosshair::draw() {
QAngle punchAngle = Globals::localPlayer->aimPunch();
if (CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair")) {
rad = 5;
x = (int)(x - (dx * punchAngle.y));
y = (int)(y + (dy * punchAngle.x));
x = (int) (x - (dx * punchAngle.y));
y = (int) (y + (dy * punchAngle.x));
}
if (CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair")) {
rad = ((weapon->GetSpread() + weapon->GetInaccuracy()) * Globals::screenSizeY) / 1.5f;
}

if (CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair>Only When Shooting")) {
if (CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair"))
goto drawing;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p100

if (Globals::localPlayer->aimPunch().IsZero())
return;
}
drawing:
//drawing
Globals::drawList->AddCircleFilled(ImVec2(x, y), rad, CONFIGCOL("Visuals>World>Local Player>Crosshair Color"));
Globals::drawList->AddCircle(ImVec2(x, y), rad, CONFIGCOL("Visuals>World>Local Player>Crosshair Border Color"));
Globals::drawList->AddCircleFilled(ImVec2(x, y), rad, CONFIGCOL(
"Visuals>World>Local Player>Crosshair Color"));
Globals::drawList->AddCircle(ImVec2(x, y), rad, CONFIGCOL(
"Visuals>World>Local Player>Crosshair Border Color"));

}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/core/menu/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ namespace Config {
// World {
CONFIGITEM("Visuals>World>Local Player>Spread Crosshair", false),
CONFIGITEM("Visuals>World>Local Player>Recoil Crosshair", false),
CONFIGITEM("Visuals>World>Local Player>Recoil Crosshair>Only When Shooting", false),
CONFIGITEM("Visuals>World>Local Player>Crosshair Color", ImColor(0, 0, 0, 100)),
CONFIGITEM("Visuals>World>Local Player>Crosshair Border Color", ImColor(200, 200, 200, 100)),

Expand Down
12 changes: 9 additions & 3 deletions src/core/menu/tabs/visuals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,20 @@ void Menu::drawVisualsTab() {
ImGui::ColorEdit4("Weapon Overlay Color", (float*)&CONFIGCOL("Visuals>World>Local Player>Weapon Overlay Color"), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_PickerHueWheel);
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() * 0.65f);

ImGui::ColorEdit4("Crosshair Color", (float*)&CONFIGCOL("Visuals>World>Local Player>Crosshair Color"), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_PickerHueWheel);
ImGui::SameLine();
ImGui::ColorEdit4("Crosshair Border Color", (float*)&CONFIGCOL("Visuals>World>Local Player>Crosshair Border Color"), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_PickerHueWheel);
ImGui::SameLine();
ImGui::Checkbox("Spread Crosshair", &CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair"));
ImGui::SameLine();
ImGui::Checkbox("Recoil Crosshair", &CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair"));
if (CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair") || CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair")) {
//make sure they can't both be on at the same time
if (CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair") && !CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair")) {
ImGui::SameLine();
ImGui::ColorEdit4("Crosshair Color", (float*)&CONFIGCOL("Visuals>World>Local Player>Crosshair Color"), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_PickerHueWheel);
ImGui::Checkbox("Only When Shooting", &CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair>Only When Shooting"));
}
if (CONFIGBOOL("Visuals>World>Local Player>Spread Crosshair") || CONFIGBOOL("Visuals>World>Local Player>Recoil Crosshair")) {
ImGui::SameLine();
ImGui::ColorEdit4("Crosshair Border Color", (float*)&CONFIGCOL("Visuals>World>Local Player>Crosshair Border Color"), ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_PickerHueWheel);
}
ImGui::EndChild();
}
Expand Down