FIX thirdperson

This commit is contained in:
nullifiedcat 2016-12-19 13:37:28 +03:00
parent f8d48adb38
commit efa58329db
16 changed files with 164 additions and 10 deletions

View File

@ -90,7 +90,7 @@ Color draw::black(0, 0, 0, 255);
Color colors::white(255, 255, 255, 255);
Color colors::pink (255, 105, 180, 255);
Color colors::pinka(255, 105, 180, 180);
Color colors::pinka(255, 105, 180, 100);
Color colors::bg_blk(0, 0, 0, 180);
Color colors::black(0, 0, 0, 255);
Color colors::tf_red(184, 56, 59, 255);

View File

@ -54,6 +54,8 @@ void EntityVariables::Init() {
this->Rocket_iDeflected = gNetvars.get_offset("DT_TFBaseRocket", "m_iDeflected");
this->Grenade_iDeflected = gNetvars.get_offset("DT_TFWeaponBaseGrenadeProj", "m_iDeflected");
this->bDistributed = gNetvars.get_offset("DT_CurrencyPack", "m_bDistributed");
this->angEyeAngles = gNetvars.get_offset("DT_TFPlayer", "tfnonlocaldata", "m_angEyeAngles[0]");
this->deadflag = gNetvars.get_offset("DT_BasePlayer", "pl", "deadflag");
}
void InitEntityOffsets() {

View File

@ -84,6 +84,9 @@ public:
offset_t Grenade_iDeflected;
offset_t bDistributed;
offset_t angEyeAngles;
offset_t deadflag;
};
extern EntityVariables netvar;

View File

@ -17,6 +17,8 @@ void GlobalSettings::Init() {
this->bSendPackets = CreateConVar(CON_PREFIX "sendpackets", "1", "Send packets");
this->bShowLogo = CreateConVar(CON_PREFIX "logo", "1", "Show logo");
this->sDisconnectMsg = CreateConVar(CON_PREFIX "disconnect_msg", "", "Set custom disconnect message");
this->bShowAntiAim = CreateConVar(CON_PREFIX "show_antiaim", "0", "Real angles in thirdperson");
this->bThirdperson = CreateConVar(CON_PREFIX "thirdpeson", "0", "Thirdperson");
}
GlobalSettings g_Settings;

View File

@ -23,6 +23,8 @@ public:
ConVar* bShowLogo;
ConVar* flDrawingOpacity;
ConVar* sDisconnectMsg;
ConVar* bShowAntiAim;
ConVar* bThirdperson;
};
extern GlobalSettings g_Settings;

View File

@ -153,7 +153,8 @@ void GUIListElement_SubList::KeyEvent(ButtonCode_t key) {
switch (key) {
case ButtonCode_t::KEY_ENTER:
case ButtonCode_t::KEY_SPACE:
m_pList->Move(m_pParentList->x + LIST_WIDTH, m_pParentList->y + VERTICAL_SPACING * m_nIndex);
case ButtonCode_t::KEY_RIGHT:
m_pList->Move(m_pParentList->x + LIST_WIDTH - 1, m_pParentList->y + VERTICAL_SPACING * m_nIndex);
g_pGUI->PushList(m_pList->m_pszListID);
}
}

View File

@ -62,6 +62,8 @@ typedef void(OverrideView_t)(void*, CViewSetup*);
typedef void(FrameStageNotify_t)(void*, int);
typedef bool(DispatchUserMessage_t)(void*, int, bf_read&);
Vector last_angles(0.0f, 0.0f, 0.0f);
bool hack::invalidated = true;
void hack::Hk_OverrideView(void* thisptr, CViewSetup* setup) {
@ -256,8 +258,9 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
float yaw = deg2rad(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
cmd->forwardmove = cos(yaw) * speed;
cmd->sidemove = sin(yaw) * speed;
return false;
ret = false;
}
last_angles = cmd->viewangles;
return ret;
}
@ -270,6 +273,15 @@ void hack::Hk_FrameStageNotify(void* thisptr, int stage) {
SetEntityValue<int>(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex, 1006);
}
}
if (g_Settings.bThirdperson->GetBool()) {
interfaces::iinput->CAM_ToFirstPerson();
}
if (stage == 5 && g_Settings.bShowAntiAim->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) {
if (g_pLocalPlayer->entity) {
SetEntityValue<float>(g_pLocalPlayer->entity, netvar.deadflag + 4, last_angles.x);
SetEntityValue<float>(g_pLocalPlayer->entity, netvar.deadflag + 8, last_angles.y);
}
}
((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage);
if (stage == 5 && g_Settings.bNoFlinch->GetBool()) {
static Vector oldPunchAngles = Vector();

View File

@ -99,13 +99,14 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
case weapon_pda:
case weapon_consumable:
case weapon_throwable:
case weapon_invalid:
return true;
};
if (g_pLocalPlayer->cond_0 & cond::cloaked) return true; // TODO other kinds of cloak
// TODO m_bFeignDeathReady no aim
if (this->v_bActiveOnlyWhenCanShoot->GetBool() && !BulletTime()) return true;
if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID != ClassID::CTFMinigun)
if (this->v_bActiveOnlyWhenCanShoot->GetBool() && !BulletTime()) return true;
if (this->v_bEnabledAttacking->GetBool() && !(cmd->buttons & IN_ATTACK)) {
return true;
@ -118,6 +119,10 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
if (!(cmd->buttons & IN_ATTACK2)) {
return true;
}
if (m_nMinigunFixTicks > 0) {
m_nMinigunFixTicks--;
cmd->buttons |= IN_ATTACK;
}
}
if (IsAmbassador(g_pLocalPlayer->weapon)) {
@ -237,6 +242,8 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
if (target_highest != 0) {
this->m_iLastTarget = target_highest->entindex();
Aim(target_highest, cmd);
if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFMinigun)
m_nMinigunFixTicks = 10;
}
return !this->v_bSilent->GetBool();
}

View File

@ -39,6 +39,7 @@ public:
int m_iLastTarget;
int m_iHitbox;
bool m_bAimKeySwitch;
int m_nMinigunFixTicks;
ConVar* v_iAimKey;
ConVar* v_iAimKeyMode;
ConVar* v_bMinigunFix;

View File

@ -230,7 +230,7 @@ void CC_SetValue(const CCommand& args) {
}
Misc::Misc() {
v_bDbWeaponInfo = CreateConVar(CON_PREFIX "misc_debug_weapon", "0", "Debug info: Weapon");
v_bDebugInfo = CreateConVar(CON_PREFIX "misc_debug", "0", "Debug info");
c_Name = CreateConCommand(CON_PREFIX "name", CC_SetName, "Sets custom name");
c_DumpItemAttributes = CreateConCommand(CON_PREFIX "dump_item_attribs", CC_DumpAttribs, "Dump active weapon attributes");
c_SayLine = CreateConCommand(CON_PREFIX "say_lines", CC_SayLines, "Uses ^ as a newline character");
@ -299,7 +299,7 @@ bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
void Misc::PaintTraverse(void*, unsigned int, bool, bool) {
if (!v_bDbWeaponInfo->GetBool())return;
if (!v_bDebugInfo->GetBool())return;
/*if (!interfaces::input->IsButtonDown(ButtonCode_t::KEY_F)) {
interfaces::baseClient->IN_ActivateMouse();
} else {
@ -328,6 +328,7 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) {
AddSideString(draw::white, draw::black, "Speed: %f", speed);
AddSideString(draw::white, draw::black, "Gravity: %f", gravity);
AddSideString(draw::white, draw::black, "IsZoomed: %i", g_pLocalPlayer->bWasZoomed);
AddSideString(draw::white, draw::black, "IsThirdPerson: %i", interfaces::iinput->CAM_IsThirdPerson());
//AddSideString(draw::white, draw::black, "???: %f", GetEntityValue<float>(g_pLocalPlayer->entity, netvar.test));
//AddSideString(draw::white, draw::black, "VecPunchAngle: %f %f %f", pa.x, pa.y, pa.z);
//draw::DrawString(10, y, draw::white, draw::black, false, "VecPunchAngleVel: %f %f %f", pav.x, pav.y, pav.z);

View File

@ -18,7 +18,7 @@ public:
DECLARE_HACK_METHODS();
Misc();
//ConVar* v_bNoShootUntilCanHeadshot;
ConVar* v_bDbWeaponInfo;
ConVar* v_bDebugInfo;
ConCommand* c_Name;
ConVar* v_bInfoSpam;
ConVar* v_bFakeCrouch;

View File

@ -455,7 +455,8 @@ bool GetProjectileData(IClientEntity* weapon, float& speed, float& gravity) {
rspeed = 1100.0f;
break;
case ClassID::CTFGrenadeLauncher:
rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 528))(weapon);
rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 527))(weapon);
rgrav = 0.5f;
break;
case ClassID::CTFCompoundBow: {
float servertime = (float)GetEntityValue<int>(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;

View File

@ -30,6 +30,7 @@ ICvar* interfaces::cvar = 0;
CGlobalVarsBase* interfaces::gvars = 0;
IPrediction* interfaces::prediction = 0;
IGameMovement* interfaces::gamemovement = 0;
IInput* interfaces::iinput = 0;
void interfaces::CreateInterfaces() {
interfaces::centerPrint = reinterpret_cast<ICenterPrint*>(sharedobj::client->fptr("VCENTERPRINT002", nullptr));
@ -54,6 +55,6 @@ void interfaces::CreateInterfaces() {
//interfaces::gvars = *reinterpret_cast<CGlobalVarsBase**>(hudupdate + 13 + *reinterpret_cast<uint32_t*>(hudupdate + 13 + 3) + 7);
interfaces::prediction = reinterpret_cast<IPrediction*>(sharedobj::client->CreateInterface("VClientPrediction001"));
interfaces::gamemovement = reinterpret_cast<IGameMovement*>(sharedobj::client->CreateInterface("GameMovement001"));
interfaces::iinput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
}

View File

@ -29,6 +29,7 @@ class IClient;
class CGlobalVarsBase;
class IPrediction;
class IGameMovement;
class IInput;
namespace interfaces {
@ -48,6 +49,7 @@ extern IInputSystem* input;
extern CGlobalVarsBase* gvars;
extern IPrediction* prediction;
extern IGameMovement* gamemovement;
extern IInput* iinput;
void CreateInterfaces();

View File

@ -38,5 +38,6 @@
#include <view_shared.h>
#include "sdk/in_buttons.h"
#include "sdk/iinput.h"
#endif /* SDK_H_ */

118
cathook/src/sdk/iinput.h Normal file
View File

@ -0,0 +1,118 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#if !defined( IINPUT_H )
#define IINPUT_H
#ifdef _WIN32
#pragma once
#endif
class bf_write;
class bf_read;
class CUserCmd;
class C_BaseCombatWeapon;
struct kbutton_t;
struct CameraThirdData_t
{
float m_flPitch;
float m_flYaw;
float m_flDist;
float m_flLag;
Vector m_vecHullMin;
Vector m_vecHullMax;
};
class IInput
{
public:
// Initialization/shutdown of the subsystem
virtual void Init_All( void ) = 0;
virtual void Shutdown_All( void ) = 0;
// Latching button states
virtual int GetButtonBits( int ) = 0;
// Create movement command
virtual void CreateMove ( int sequence_number, float input_sample_frametime, bool active ) = 0;
virtual void ExtraMouseSample( float frametime, bool active ) = 0;
virtual bool WriteUsercmdDeltaToBuffer( bf_write *buf, int from, int to, bool isnewcommand ) = 0;
virtual void EncodeUserCmdToBuffer( bf_write& buf, int slot ) = 0;
virtual void DecodeUserCmdFromBuffer( bf_read& buf, int slot ) = 0;
virtual CUserCmd *GetUserCmd( int sequence_number ) = 0;
virtual void MakeWeaponSelection( C_BaseCombatWeapon *weapon ) = 0;
// Retrieve key state
virtual float KeyState ( kbutton_t *key ) = 0;
// Issue key event
virtual int KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszCurrentBinding ) = 0;
// Look for key
virtual kbutton_t *FindKey( const char *name ) = 0;
// Issue commands from controllers
virtual void ControllerCommands( void ) = 0;
// Extra initialization for some joysticks
virtual void Joystick_Advanced( void ) = 0;
virtual void Joystick_SetSampleTime( float frametime ) = 0;
virtual void IN_SetSampleTime( float frametime ) = 0;
// Accumulate mouse delta
virtual void AccumulateMouse( void ) = 0;
// Activate/deactivate mouse
virtual void ActivateMouse( void ) = 0;
virtual void DeactivateMouse( void ) = 0;
// Clear mouse state data
virtual void ClearStates( void ) = 0;
// Retrieve lookspring setting
virtual float GetLookSpring( void ) = 0;
// Retrieve mouse position
virtual void GetFullscreenMousePos( int *mx, int *my, int *unclampedx = 0, int *unclampedy = 0 ) = 0;
virtual void SetFullscreenMousePos( int mx, int my ) = 0;
virtual void ResetMouse( void ) = 0;
virtual float GetLastForwardMove( void ) = 0;
virtual float Joystick_GetForward( void ) = 0;
virtual float Joystick_GetSide( void ) = 0;
virtual float Joystick_GetPitch( void ) = 0;
virtual float Joystick_GetYaw( void ) = 0;
// Third Person camera ( TODO/FIXME: Move this to a separate interface? )
virtual void CAM_Think( void ) = 0;
virtual int CAM_IsThirdPerson( void ) = 0;
virtual void CAM_ToThirdPerson(void) = 0;
virtual void CAM_ToFirstPerson(void) = 0;
virtual void CAM_StartMouseMove(void) = 0;
virtual void CAM_EndMouseMove(void) = 0;
virtual void CAM_StartDistance(void) = 0;
virtual void CAM_EndDistance(void) = 0;
virtual int CAM_InterceptingMouse( void ) = 0;
// orthographic camera info ( TODO/FIXME: Move this to a separate interface? )
virtual void CAM_ToOrthographic() = 0;
virtual bool CAM_IsOrthographic() const = 0;
virtual void CAM_OrthographicSize( float& w, float& h ) const = 0;
#if defined( HL2_CLIENT_DLL )
// IK back channel info
virtual void AddIKGroundContactInfo( int entindex, float minheight, float maxheight ) = 0;
#endif
virtual void LevelInit( void ) = 0;
// Causes an input to have to be re-pressed to become active
virtual void ClearInputButton( int bits ) = 0;
virtual void CAM_SetCameraThirdData( CameraThirdData_t *pCameraData, const QAngle &vecCameraOffset ) = 0;
virtual void CAM_CameraThirdThink( void ) = 0;
virtual bool EnableJoystickMode() = 0;
};
//extern ::IInput *input;
#endif // IINPUT_H