-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeatures.cpp
More file actions
138 lines (114 loc) · 3.76 KB
/
Copy pathfeatures.cpp
File metadata and controls
138 lines (114 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include "features.h"
// used: draw callbacks
#include "utilities/draw.h"
// used: notify
#include "utilities/notify.h"
// used: cheat variables
#include "core/variables.h"
// used: menu
#include "core/menu.h"
// used: features callbacks
#include "features/visuals.h"
#include "features/misc.h"
#include "features/legitbot.h"
// used: interfaces
#include "core/interfaces.h"
#include "sdk/interfaces/iengineclient.h"
#include "sdk/interfaces/ccsgoinput.h"
#include "sdk/interfaces/cgameentitysystem.h"
#include "sdk/datatypes/usercmd.h"
#include "sdk/interfaces/ienginecvar.h"
#include "sdk/entity.h"
#include "features/ragebot.h"
#include "features/misc/movement.h"
#include "core/convars.h"
#include "core/sdk.h"
#include "features/rage/antiaim.h"
bool F::Setup()
{
if (!VISUALS::Setup())
{
L_PRINT(LOG_ERROR) << CS_XOR("failed to setup visuals");
return false;
}
return true;
}
void F::Destroy()
{
VISUALS::OnDestroy();
}
void F::OnPresent()
{
if (!D::bInitialized)
return;
D::NewFrame();
{
// render watermark
MENU::RenderWatermark();
// main window
ImGui::PushFont(FONT::pMenu[C_GET(int, Vars.nDpiScale)]);
// @note: here you can draw your stuff
MENU::RenderMainWindow();
// render notifications
NOTIFY::Render();
ImGui::PopFont();
}
D::Render();
}
void F::OnFrameStageNotify(int nStage)
{
F::VISUALS::OnFrame(nStage);
}
// movement correction angles
static QAngle_t angCorrectionView = {};
void AutomaticWeapons(CUserCmd* pCmd, CBaseUserCmdPB* pBaseCmd)
{
C_CSWeaponBaseGun* current_weapon = SDK::LocalPawn->GetCurrentWeapon();
if (current_weapon == nullptr)
return;
CCSWeaponBaseVData* vdata = current_weapon->GetWeaponVData();
if (vdata == nullptr)
return;
if (vdata->IsFullAuto())
return;
int wepType = vdata->GetWeaponType();
if (wepType == WEAPONTYPE_GRENADE || wepType == WEAPONTYPE_C4 || wepType == WEAPONTYPE_STACKABLEITEM)
return;
if (!SDK::LocalPawn->CanAttack())
{
pCmd->nButtons.nValue &= ~(IN_ATTACK | IN_SECOND_ATTACK);
pCmd->nButtons.nValueChanged &= ~(IN_ATTACK | IN_SECOND_ATTACK);
pCmd->nButtons.nValueScroll &= ~(IN_ATTACK | IN_SECOND_ATTACK);
}
else
{
pCmd->csgoUserCmd.nAttack1StartHistoryIndex = 0;
pCmd->csgoUserCmd.nAttack3StartHistoryIndex = 0;
}
}
void F::OnCreateMove(CUserCmd* pCmd, CBaseUserCmdPB* pBaseCmd, CCSPlayerController* pLocalController)
{
F::MISC::OnMove(pCmd, pBaseCmd, pLocalController, SDK::LocalPawn);
F::LEGITBOT::OnMove(pCmd, pBaseCmd, pLocalController, SDK::LocalPawn);
F::RAGEBOT::OnMove(pCmd, pBaseCmd, pLocalController, SDK::LocalPawn);
AutomaticWeapons(pCmd, pBaseCmd);
if (const int32_t nMoveType = SDK::LocalPawn->GetMoveType(); nMoveType != MOVETYPE_NOCLIP && nMoveType != MOVETYPE_LADDER && SDK::LocalPawn->GetWaterLevel() < WL_WAIST)
F::RAGEBOT::ANTIAIM::CorrectMovement(pCmd, pBaseCmd, I::Input->vecViewAngle);
if (CONVAR::sv_quantize_movement_input->value.i1)
F::MISC::MOVEMENT::AdjustAnglesForQuantizedMovement(pCmd, pBaseCmd, SDK::LocalPawn, !C_GET(bool, Vars.bAntiUntrusted));
// loop through all tick commands
for (int nSubTick = 0; nSubTick < pCmd->csgoUserCmd.inputHistoryField.pRep->nAllocatedSize; nSubTick++)
{
CCSGOInputHistoryEntryPB* pInputEntry = pCmd->GetInputHistoryEntry(nSubTick);
if (pInputEntry == nullptr)
continue;
// save view angles for movement correction
angCorrectionView = pInputEntry->pViewAngles->angValue;
// movement correction & anti-untrusted
F::MISC::MOVEMENT::ValidateUserCommand(pCmd, pBaseCmd, pInputEntry, angCorrectionView);
}
}
bool F::OnDrawObject(void* pAnimatableSceneObjectDesc, void* pDx11, CMeshData* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2)
{
return VISUALS::OnDrawObject(pAnimatableSceneObjectDesc, pDx11, arrMeshDraw, nDataCount, pSceneView, pSceneLayer, pUnk, pUnk2);
}