a lot of fixes. pNoZoom!
This commit is contained in:
parent
abd6a7a442
commit
5bdec1a5b1
14
uran/TODO
14
uran/TODO
@ -1,7 +1,6 @@
|
||||
MAX -> MIN priority
|
||||
|
||||
AirStuck FIX
|
||||
FIX Followbot Crash
|
||||
Huntsman autoshoot
|
||||
Aim Stickies
|
||||
Proj Aim Buildings
|
||||
@ -24,7 +23,7 @@ Make hacks respect Mannpower powerups and other conditions when calcuating damag
|
||||
Fake Lag
|
||||
Engine Prediction
|
||||
An option to ignore taunting enemies
|
||||
AutoSticky
|
||||
AutoSticky improve
|
||||
No AutoShoot when disguised
|
||||
Fixing NoZoom flickering
|
||||
Ambassador bodyshotting
|
||||
@ -34,11 +33,20 @@ More projectile weapons aimbot (wrap assassin, wrangler, stickybomb, airstrike)
|
||||
Recalculate rifles' headshot ability (Bazaar + Precision rifles)
|
||||
Auto Uber Flash
|
||||
Auto trigger DR before rockets
|
||||
AutoHeal
|
||||
Building box opacity
|
||||
AutoUber
|
||||
Sticky vischeck
|
||||
AutoBHop (Speed)
|
||||
Airstuck Kick
|
||||
newline nicknames
|
||||
dark building esp
|
||||
Anti Backstab
|
||||
Critical rifles bodyshotting
|
||||
Show spectators
|
||||
Hitbox position cache
|
||||
Spy alert uses angles
|
||||
More esp tweaking
|
||||
carrying esp
|
||||
Tracers/Spy Cam
|
||||
Glow Hack
|
||||
Proper medic followbot AI
|
||||
|
@ -21,5 +21,6 @@
|
||||
#include "relations.h"
|
||||
#include "usercmd.h"
|
||||
#include "trace.h"
|
||||
#include "prediction.h"
|
||||
|
||||
#endif /* COMMON_H_ */
|
||||
|
@ -95,8 +95,8 @@ Color colors::tf_blu(88, 133, 162, 255);
|
||||
Color colors::yellow(255, 255, 0, 255);
|
||||
Color colors::orange(255, 128, 0, 255);
|
||||
Color colors::green(0, 255, 0, 255);
|
||||
Color colors::dk_red(150, 75, 75, 255);
|
||||
Color colors::dk_blu(75, 75, 150, 255);
|
||||
Color colors::dk_red(150, 75, 75, 180);
|
||||
Color colors::dk_blu(75, 75, 150, 180);
|
||||
Color colors::bg_red(64, 32, 32, 255);
|
||||
Color colors::bg_blu(32, 32, 64, 255);
|
||||
Color colors::dbgred(48, 16, 16, 255);
|
||||
@ -180,7 +180,9 @@ void draw::DrawString(int x, int y, Color color, Color background, bool center,
|
||||
x -= (l / 2);
|
||||
}
|
||||
draw::GetStringLength((char*)text, l, h);
|
||||
draw::DrawRect(x, y + 1, l + 2, h - 4, background);
|
||||
Color clr = background;
|
||||
clr._color[3] = (unsigned char)180;
|
||||
draw::DrawRect(x, y + 1, l + 2, h - 4, clr);
|
||||
draw::DrawString(draw::font_handle, x, y, color, string);
|
||||
}
|
||||
|
||||
|
@ -533,8 +533,27 @@ enum weaponmode {
|
||||
weapon_consumable
|
||||
};
|
||||
|
||||
enum hitbox {
|
||||
hb_head = 0
|
||||
enum hitbox_t {
|
||||
hb_head = 0,
|
||||
hb_neck,
|
||||
hb_necklower,
|
||||
hb_pelvis,
|
||||
hb_body,
|
||||
hb_lowerchest,
|
||||
hb_chest,
|
||||
hb_upperchest,
|
||||
hb_rightthigh,
|
||||
hb_leftthigh,
|
||||
hb_rightshin,
|
||||
hb_leftshin,
|
||||
hb_rightfoot,
|
||||
hb_leftfoot,
|
||||
hb_righthand,
|
||||
hb_lefthand,
|
||||
hb_rightupperarm,
|
||||
hb_rightlowerarm,
|
||||
hb_leftupperArm,
|
||||
hb_leftlowerArm
|
||||
};
|
||||
|
||||
enum relation {
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
ConVar* bNoFlinch;
|
||||
ConVar* bSendPackets;
|
||||
ConVar* bShowLogo;
|
||||
ConVar* flDrawingOpacity;
|
||||
};
|
||||
|
||||
extern GlobalSettings g_Settings;
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "common.h"
|
||||
#include "sharedobj.h"
|
||||
#include "hooks.h"
|
||||
#include "netmessage.h"
|
||||
#include "targeting/ITargetSystem.h"
|
||||
#include "profiler.h"
|
||||
|
||||
@ -70,6 +71,31 @@ void hack::Hk_OverrideView(void* thisptr, CViewSetup* setup) {
|
||||
|
||||
void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar);
|
||||
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
|
||||
if (g_phFollowBot->v_bEnabled->GetBool()) {
|
||||
ipc_bot_seg* seg_g = g_phFollowBot->m_pIPC->GetBotCommand(0);
|
||||
ipc_bot_seg* seg_l = g_phFollowBot->m_pIPC->GetBotCommand(g_phFollowBot->m_pIPC->bot_id);
|
||||
|
||||
if (seg_g == 0) {
|
||||
logging::Info("!!! seg_g == 0 !!!");
|
||||
}
|
||||
if (seg_l == 0) {
|
||||
logging::Info("!!! seg_l == 0 !!!");
|
||||
}
|
||||
|
||||
if (seg_g && seg_g->command_number > g_phFollowBot->last_command_global) {
|
||||
logging::Info("Executing `%s`", seg_g->command_buffer);
|
||||
if (g_phFollowBot->last_command_global) interfaces::engineClient->ExecuteClientCmd(seg_g->command_buffer);
|
||||
g_phFollowBot->last_command_global = seg_g->command_number;
|
||||
}
|
||||
if (seg_l && seg_l->command_number > g_phFollowBot->last_command_local) {
|
||||
logging::Info("Executing `%s`", seg_l->command_buffer);
|
||||
if (g_phFollowBot->last_command_local) interfaces::engineClient->ExecuteClientCmd(seg_l->command_buffer);
|
||||
g_phFollowBot->last_command_local = seg_l->command_number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!draw::width || !draw::height) {
|
||||
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
|
||||
}
|
||||
@ -90,7 +116,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
ResetStrings();
|
||||
if (g_Settings.bShowLogo->GetBool()) {
|
||||
AddSideString(colors::green, colors::black, "cathook by d4rkc4t");
|
||||
AddSideString(colors::green, colors::black, "build " __DATE__ " " __TIME__);
|
||||
AddSideString(colors::tf_red, colors::black, "DEVELOPMENT BUILD");
|
||||
}
|
||||
for (IHack* i_hack : hack::hacks) {
|
||||
//PROF_BEGIN();
|
||||
@ -121,7 +147,23 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
|
||||
typedef bool(CanPacket_t)(void* thisptr);
|
||||
bool Hk_CanPacket(void* thisptr) {
|
||||
return false;//g_Settings.bSendPackets->GetBool() && ((CanPacket_t*)hooks::hkNetChannel->GetMethod(hooks::offCanPacket))(thisptr);
|
||||
return g_Settings.bSendPackets->GetBool() && ((CanPacket_t*)hooks::hkNetChannel->GetMethod(hooks::offCanPacket))(thisptr);
|
||||
}
|
||||
|
||||
typedef bool(SendNetMsg_t)(void* thisptr, INetMessage& msg, bool forcereliable, bool voice);
|
||||
bool Hk_SendNetMsg(void* thisptr, INetMessage& msg, bool bForceReliable = false, bool bVoice = false) {
|
||||
//logging::Info("Sending NetMsg! %i", msg.GetType());
|
||||
if (g_phAirstuck->v_bStuck->GetBool()) {
|
||||
switch (msg.GetType()) {
|
||||
case net_NOP:
|
||||
case net_SignonState:
|
||||
case net_StringCmd:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return ((SendNetMsg_t*)hooks::hkNetChannel->GetMethod(hooks::offSendNetMsg))(thisptr, msg, bForceReliable, bVoice);
|
||||
}
|
||||
|
||||
bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
@ -131,17 +173,18 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
if (ch && !hooks::IsHooked(ch)) {
|
||||
logging::Info("NCI not hooked!");
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
if (ch && !hooks::IsHooked((void*)((uintptr_t)ch))) {
|
||||
logging::Info("Hooking INetChannel!");
|
||||
hooks::hkNetChannel = new hooks::VMTHook();
|
||||
hooks::hkNetChannel->Init(ch, 0);
|
||||
hooks::hkNetChannel->HookMethod((void*)Hk_CanPacket, hooks::offCanPacket);
|
||||
hooks::hkNetChannel->HookMethod((void*)Hk_SendNetMsg, hooks::offSendNetMsg);
|
||||
hooks::hkNetChannel->Apply();
|
||||
logging::Info("Applied!");
|
||||
logging::Info("NetChannel Hooked!");
|
||||
}
|
||||
logging::Info("Can packet? %i", ch->CanPacket());*/
|
||||
if (!cmd) return ret;
|
||||
//logging::Info("canpacket: %i", ch->CanPacket());
|
||||
//if (!cmd) return ret;
|
||||
|
||||
g_pPlayerResource->Update();
|
||||
|
||||
@ -202,15 +245,12 @@ void hack::Hk_FrameStageNotify(void* thisptr, int stage) {
|
||||
SetEntityValue<int>(g_pLocalPlayer->weapon, eoffsets.iItemDefinitionIndex, 1006);
|
||||
}
|
||||
}
|
||||
((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage);
|
||||
if (g_Settings.bNoZoom->GetBool()) {
|
||||
if (g_pLocalPlayer->entity) {
|
||||
bool zoomed = (g_pLocalPlayer->cond_0 & cond::zoomed);
|
||||
if (zoomed) {
|
||||
SetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 &~ cond::zoomed);
|
||||
}
|
||||
}
|
||||
}
|
||||
((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage);
|
||||
}
|
||||
|
||||
bool hack::Hk_DispatchUserMessage(void* thisptr, int type, bf_read& buf) {
|
||||
@ -306,28 +346,6 @@ void hack::Initialize() {
|
||||
void hack::Think() {
|
||||
//logging::Info("Hack::Think");
|
||||
// Fucking TODo
|
||||
if (g_phFollowBot->v_bEnabled->GetBool()) {
|
||||
ipc_bot_seg* seg_g = g_phFollowBot->m_pIPC->GetBotCommand(0);
|
||||
ipc_bot_seg* seg_l = g_phFollowBot->m_pIPC->GetBotCommand(g_phFollowBot->m_pIPC->bot_id);
|
||||
|
||||
if (seg_g == 0) {
|
||||
logging::Info("!!! seg_g == 0 !!!");
|
||||
}
|
||||
if (seg_l == 0) {
|
||||
logging::Info("!!! seg_l == 0 !!!");
|
||||
}
|
||||
|
||||
if (seg_g && seg_g->command_number > g_phFollowBot->last_command_global) {
|
||||
logging::Info("Executing `%s`", seg_g->command_buffer);
|
||||
if (g_phFollowBot->last_command_global) interfaces::engineClient->ExecuteClientCmd(seg_g->command_buffer);
|
||||
g_phFollowBot->last_command_global = seg_g->command_number;
|
||||
}
|
||||
if (seg_l && seg_l->command_number > g_phFollowBot->last_command_local) {
|
||||
logging::Info("Executing `%s`", seg_l->command_buffer);
|
||||
if (g_phFollowBot->last_command_local) interfaces::engineClient->ExecuteClientCmd(seg_l->command_buffer);
|
||||
g_phFollowBot->last_command_local = seg_l->command_number;
|
||||
}
|
||||
}
|
||||
usleep(250000);
|
||||
}
|
||||
|
||||
|
@ -120,10 +120,6 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
|
||||
if(cmd->buttons & IN_USE) return true;
|
||||
|
||||
if (g_pLocalPlayer->bIsReloading) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this->v_bStrictAttack->GetBool() ) {
|
||||
cmd->buttons = cmd->buttons &~ IN_ATTACK;
|
||||
}
|
||||
@ -248,6 +244,7 @@ void Aimbot::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
}
|
||||
|
||||
bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
//logging::Info("Should target?");
|
||||
if (!entity) return false;
|
||||
if (entity->IsDormant()) return false;
|
||||
if (IsPlayer(entity)) {
|
||||
@ -260,13 +257,13 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
if (!player) return false;
|
||||
if (v_bRespectCloak->GetBool() && (GetEntityValue<int>(entity, eoffsets.iCond) & cond::cloaked)) return false;
|
||||
int health = GetEntityValue<int>(entity, eoffsets.iHealth);
|
||||
if (this->v_bCharge->GetBool() && (GetEntityValue<int>(player, eoffsets.iClass) == 2)) {
|
||||
/*if (this->v_bCharge->GetBool() && (GetEntityValue<int>(player, eoffsets.iClass) == 2)) {
|
||||
int rifleHandle = GetEntityValue<int>(player, eoffsets.hActiveWeapon);
|
||||
IClientEntity* rifle = interfaces::entityList->GetClientEntity(rifleHandle & 0xFFF);
|
||||
if (!rifle) return false;
|
||||
float bdmg = GetEntityValue<float>(rifle, eoffsets.flChargedDamage);
|
||||
if (health > 150 && (health > (150 + bdmg) || bdmg < 15.0f)) return false;
|
||||
}
|
||||
}*/
|
||||
int team_my = GetEntityValue<int>(player, eoffsets.iTeamNum);
|
||||
if (team == team_my) return false;
|
||||
Vector enemy_pos = entity->GetAbsOrigin();
|
||||
@ -279,8 +276,7 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
if (GetRelation(entity) == relation::FRIEND) return false;
|
||||
Vector resultAim;
|
||||
if (m_bProjectileMode) {
|
||||
resultAim = entity->GetAbsOrigin();
|
||||
if (!PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)m_iHitbox, m_flProjSpeed, m_bProjArc, m_flProjGravity, resultAim)) return false;
|
||||
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, ProjectilePrediction(entity, m_iHitbox, m_flProjSpeed, m_flProjGravity))) return false;
|
||||
} else {
|
||||
if (v_bMachinaPenetration->GetBool()) {
|
||||
if (GetHitboxPosition(entity, m_iHitbox, resultAim)) return false;
|
||||
@ -301,9 +297,11 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
if ((enemy_pos - g_pLocalPlayer->v_Origin).Length() > v_iMinRange->GetInt()) return false;
|
||||
}
|
||||
Vector resultAim;
|
||||
// TODO fix proj buildings
|
||||
if (m_bProjectileMode) {
|
||||
resultAim = entity->GetAbsOrigin();
|
||||
if (!PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)m_iHitbox, m_flProjSpeed, m_bProjArc, m_flProjGravity, resultAim)) return false;
|
||||
return false;
|
||||
//resultAim = entity->GetAbsOrigin();
|
||||
//if (!PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox_t)m_iHitbox, m_flProjSpeed, m_bProjArc, m_flProjGravity, resultAim)) return false;
|
||||
} else {
|
||||
//logging::Info("IsVisible?");
|
||||
if (!IsBuildingVisible(entity)) return false;
|
||||
@ -318,21 +316,17 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void PredictPosition(Vector vec, IClientEntity* ent) {
|
||||
if (!ent) return;
|
||||
Vector vel = GetEntityValue<Vector>(ent, eoffsets.vVelocity);
|
||||
float latency = interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
vec += vel * latency;
|
||||
}
|
||||
|
||||
bool Aimbot::Aim(IClientEntity* entity, CUserCmd* cmd) {
|
||||
//logging::Info("Aiming!");
|
||||
Vector hit;
|
||||
Vector angles;
|
||||
if (!entity) return false;
|
||||
if (IsPlayer(entity)) {
|
||||
//logging::Info("A");
|
||||
GetHitboxPosition(entity, m_iHitbox, hit);
|
||||
PredictPosition(hit, entity);
|
||||
//logging::Info("B");
|
||||
SimpleLatencyPrediction(entity, m_iHitbox);
|
||||
//logging::Info("C");
|
||||
} else if (IsBuilding(entity)) {
|
||||
hit = GetBuildingPosition(entity);
|
||||
}
|
||||
@ -340,9 +334,10 @@ bool Aimbot::Aim(IClientEntity* entity, CUserCmd* cmd) {
|
||||
if (m_bProjectileMode) {
|
||||
if (v_iOverrideProjSpeed->GetBool())
|
||||
m_flProjSpeed = v_iOverrideProjSpeed->GetFloat();
|
||||
PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)m_iHitbox, m_flProjSpeed, m_bProjArc, m_flProjGravity, hit);
|
||||
hit = ProjectilePrediction(entity, m_iHitbox, m_flProjSpeed, m_flProjGravity);
|
||||
}
|
||||
}
|
||||
//logging::Info("ayyming!");
|
||||
IClientEntity* local = interfaces::entityList->GetClientEntity(interfaces::engineClient->GetLocalPlayer());
|
||||
Vector tr = (hit - g_pLocalPlayer->v_Eye);
|
||||
fVectorAngles(tr, angles);
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
class ConVar;
|
||||
class IClientEntity;
|
||||
class Vector;
|
||||
|
||||
class Aimbot : public IHack {
|
||||
public:
|
||||
@ -24,6 +25,7 @@ public:
|
||||
float m_flProjSpeed;
|
||||
float m_flProjGravity;
|
||||
bool m_bProjArc;
|
||||
//Vector m_vPredictedProjTarget;
|
||||
|
||||
int m_iLastTarget;
|
||||
int m_iHitbox;
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "../common.h"
|
||||
#include "../sdk.h"
|
||||
|
||||
#include "../netmessage.h"
|
||||
|
||||
DEFINE_HACK_SINGLETON(Airstuck);
|
||||
|
||||
Airstuck::Airstuck() {
|
||||
@ -28,9 +30,28 @@ bool Airstuck::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (cmd->buttons & (IN_ATTACK | IN_ATTACK2)) {
|
||||
return true;
|
||||
}
|
||||
//cmd->tick_count = 0xFFFFF;
|
||||
//INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
//NET_Tick tick;
|
||||
//ch->SendNetMsg((INetMessage*)&tick);
|
||||
//cmd->tick_count = 0xFFFF;
|
||||
//interfaces::cvar->FindVar("net_fakeloss")->SetValue(99);
|
||||
interfaces::cvar->FindVar("host_timescale")->SetValue(0.001f);
|
||||
//interfaces::cvar->FindVar("net_fakeloss")->SetValue(100.0f);
|
||||
if (interfaces::gvars->tickcount % 60 == 0) {
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
//IClient* client = (IClient*)ch->GetMsgHandler();
|
||||
//IServer* server = client->GetServer();
|
||||
//logging::Info("Client: 0x%08x Server: 0x%08x");
|
||||
NET_NOP packet;
|
||||
//logging::Info("NOP sent!");
|
||||
//NET_SignonState packet(6, 1);
|
||||
//logging::Info("Created!");
|
||||
packet.SetNetChannel(ch);
|
||||
packet.SetReliable(false);
|
||||
//logging::Info("Sending!");
|
||||
ch->SendNetMsg(packet);
|
||||
//packet.WriteToBuffer(buffer);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ float spin = -180;
|
||||
|
||||
bool AntiAim::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (!this->v_bEnabled->GetBool()) return true;
|
||||
if ((cmd->buttons & (IN_ATTACK | IN_ATTACK2 | IN_USE))) return true;
|
||||
if ((cmd->buttons & (IN_ATTACK | IN_USE))) return true;
|
||||
if (g_pLocalPlayer->bAttackLastTick) return true;
|
||||
spin += v_flSpinSpeed->GetFloat();
|
||||
if (spin > 180) spin = -180;
|
||||
|
@ -69,6 +69,7 @@ bool AutoReflect::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
fClampAngle(angles);
|
||||
cmd->viewangles = angles;
|
||||
g_pLocalPlayer->bUseSilentAngles = true;
|
||||
if (!(cmd->buttons & IN_ATTACK))
|
||||
cmd->buttons |= IN_ATTACK2;
|
||||
|
||||
return true;
|
||||
|
@ -84,13 +84,17 @@ void ESP::DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHeig
|
||||
//draw::DrawString((int)so.x, (int)so.y, draw::white, false, "origin");
|
||||
ent->m_ESPOrigin.x = so.x + width / 2 + 1;
|
||||
ent->m_ESPOrigin.y = so.y - height;
|
||||
draw::OutlineRect(so.x - width / 2 - 1, so.y - 1 - height, width + 2, height + 2, draw::black);
|
||||
unsigned char opacity = clr._color[3];
|
||||
Color blacko = draw::black;
|
||||
blacko._color[3] = opacity;
|
||||
draw::OutlineRect(so.x - width / 2 - 1, so.y - 1 - height, width + 2, height + 2, blacko);
|
||||
draw::OutlineRect(so.x - width / 2, so.y - height, width, height, clr);
|
||||
draw::OutlineRect(so.x - width / 2 + 1, so.y + 1 - height, width - 2, height - 2, draw::black);
|
||||
draw::OutlineRect(so.x - width / 2 + 1, so.y + 1 - height, width - 2, height - 2, blacko);
|
||||
if (healthbar) {
|
||||
Color hp = colors::GetHealthColor(health, healthmax);
|
||||
hp._color[3] = opacity;
|
||||
int hbh = (height) * min((float)health / (float)healthmax, 1.0f);
|
||||
draw::DrawRect(so.x - width / 2 - 7, so.y - 1 - height, 6, height + 2, draw::black);
|
||||
draw::DrawRect(so.x - width / 2 - 7, so.y - 1 - height, 6, height + 2, blacko);
|
||||
draw::DrawRect(so.x - width / 2 - 6, so.y - hbh, 5, hbh, hp);
|
||||
}
|
||||
//draw::OutlineRect(min(smin.x, smax.x) - 1, min(smin.y, smax.y) - 1, max(smin.x, smax.x), max(smin.y, smax.y), draw::black);
|
||||
|
@ -114,7 +114,10 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
}
|
||||
}
|
||||
if (!owner_entity) return;
|
||||
|
||||
if (m_iForceHealTicks && m_iForceHealTicks < 20) {
|
||||
m_iForceHealTicks++;
|
||||
cmd->buttons |= IN_ATTACK;
|
||||
} else m_iForceHealTicks = 0;
|
||||
switch (v_iBotPackage->GetInt()) {
|
||||
case botpackage::BOT_FOLLOW: {
|
||||
|
||||
@ -157,6 +160,8 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (v_iBotPackage->GetInt() == botpackage::BOT_DUMMY) return;
|
||||
|
||||
|
||||
if (v_iBotPackage->GetInt() == botpackage::BOT_MEDIC) {
|
||||
IClientEntity* healtr = this->GetBestHealingTarget();
|
||||
@ -197,7 +202,6 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
void FollowBot::ActuallyCreateMove(CUserCmd* cmd) {
|
||||
IClientEntity* tr_follow = interfaces::entityList->GetClientEntity(this->m_hTargetFollowing);
|
||||
QAngle angles = VectorToQAngle(cmd->viewangles);
|
||||
|
||||
if (tr_follow) {
|
||||
AimAtHitbox(tr_follow, 4, cmd);
|
||||
angles = VectorToQAngle(cmd->viewangles);
|
||||
@ -261,7 +265,6 @@ IClientEntity* FollowBot::GetBestHealingTarget() {
|
||||
|
||||
bool FollowBot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (!v_bEnabled->GetBool()) return true;
|
||||
|
||||
Tick(cmd);
|
||||
g_nTick++;
|
||||
this->ActuallyCreateMove(cmd);
|
||||
@ -332,15 +335,24 @@ void CC_SetOwner(const CCommand& args) {
|
||||
g_phFollowBot->m_nOwnerID = id;
|
||||
}
|
||||
|
||||
void CC_HealOwner(const CCommand& args) {
|
||||
g_phFollowBot->m_hTargetHealing = g_phFollowBot->m_nOwnerID;
|
||||
g_phFollowBot->m_iForceHealTicks = 1;
|
||||
}
|
||||
|
||||
void CC_BotCommand(const CCommand& args) {
|
||||
if (args.ArgC() < 2) return;
|
||||
int bot_id = strtol(args.Arg(1), 0, 0);
|
||||
if (!bot_id) {
|
||||
logging::Info("Executing command `%s` on EACH bot.", args.Arg(2));
|
||||
} else {
|
||||
logging::Info("Executing command `%s` on bot %i.", args.Arg(2), bot_id);
|
||||
char* buf = new char[256];
|
||||
for (int i = 2; i < args.ArgC(); i++) {
|
||||
strcat(buf, strfmt("%s ", args.Arg(i)));
|
||||
}
|
||||
g_phFollowBot->m_pIPC->WriteBotCommand(bot_id, (char*)args.Arg(2));
|
||||
if (!bot_id) {
|
||||
logging::Info("Executing command `%s` on EACH bot.", buf);
|
||||
} else {
|
||||
logging::Info("Executing command `%s` on bot %i.", buf, bot_id);
|
||||
}
|
||||
g_phFollowBot->m_pIPC->WriteBotCommand(bot_id, (char*)buf);
|
||||
}
|
||||
|
||||
void CC_IPCList(const CCommand& args) {
|
||||
@ -363,7 +375,7 @@ FollowBot::FollowBot() {
|
||||
c_ResetList = CreateConCommand("u_bot_reset", CC_ResetList, "Resets bot list");
|
||||
c_BotCommand = CreateConCommand("u_bot_command", CC_BotCommand, "Sends bot commands");
|
||||
c_IPCList = CreateConCommand("u_bot_ipclist", CC_IPCList, "Lists IPC status");
|
||||
|
||||
c_HealOwner = CreateConCommand("u_bot_healowner", CC_HealOwner, "Heals owner");
|
||||
m_nOwnerID = 0;
|
||||
|
||||
this->last_command_global = 0;
|
||||
|
@ -21,7 +21,8 @@ void CC_SetOwner(const CCommand& args);
|
||||
enum botpackage {
|
||||
BOT_FOLLOW = 0,
|
||||
BOT_MEDIC,
|
||||
BOT_SNIPER
|
||||
BOT_SNIPER,
|
||||
BOT_DUMMY
|
||||
};
|
||||
|
||||
class FollowBot : public IHack {
|
||||
@ -50,12 +51,13 @@ public:
|
||||
ConCommand* cmd_Status;
|
||||
|
||||
ConVar* v_bEnabled;
|
||||
|
||||
int m_iForceHealTicks;
|
||||
int m_iShouldUbercharge;
|
||||
ConVar* v_iBotPackage;
|
||||
ConCommand* c_AddBotID;
|
||||
ConCommand* c_SetOwner;
|
||||
ConCommand* c_ResetList;
|
||||
ConCommand* c_HealOwner;
|
||||
ConCommand* c_BotCommand;
|
||||
ConCommand* c_IPCList;
|
||||
uint32 m_nOwnerID;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "../hack.h"
|
||||
#include "../common.h"
|
||||
#include "../sdk.h"
|
||||
#include "../netmessage.h"
|
||||
|
||||
DEFINE_HACK_SINGLETON(Misc);
|
||||
|
||||
@ -125,11 +126,36 @@ void LockConCommands(bool lock) {
|
||||
|
||||
ConCommandBase* teamname = 0;
|
||||
|
||||
void CC_SetName(const CCommand& args) {
|
||||
char* name = new char[32];
|
||||
snprintf(name, 32, "%s", args.Arg(1));
|
||||
if (args.ArgC() > 1 && atoi(args.Arg(2))) {
|
||||
for (int i = 0; i < strlen(name); i++) {
|
||||
if (name[i] == '^') name[i] = '\n';
|
||||
}
|
||||
}
|
||||
NET_SetConVar setname("name", (const char*)name);
|
||||
//logging::Info("Created!");
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
setname.SetNetChannel(ch);
|
||||
setname.SetReliable(false);
|
||||
//logging::Info("Sending!");
|
||||
ch->SendNetMsg(setname, false);
|
||||
}
|
||||
|
||||
void CC_Lockee(const CCommand& args) {
|
||||
if (args.ArgC() > 1) {
|
||||
LockConCommands(atoi(args.Arg(1)));
|
||||
}
|
||||
}
|
||||
ConVar* name = interfaces::cvar->FindVar("name");
|
||||
/*name->m_fnChangeCallback = 0;
|
||||
logging::Info("callback: 0x%08x", name->m_fnChangeCallback);
|
||||
name->SetValue(g_phMisc->v_strName->GetString());
|
||||
name->InternalSetValue(g_phMisc->v_strName->GetString());
|
||||
name->m_StringLength = strlen(g_phMisc->v_strName->GetString());
|
||||
name->m_pszString = (char*)g_phMisc->v_strName->GetString();
|
||||
logging::Info("set %s, value: %s", g_phMisc->v_strName->GetString(), name->GetString());
|
||||
*/}
|
||||
|
||||
void CC_Teamname(const CCommand& args) {
|
||||
if (!teamname) {
|
||||
@ -190,7 +216,7 @@ void CC_DumpAttribs(const CCommand& args) {
|
||||
|
||||
Misc::Misc() {
|
||||
v_bDbWeaponInfo = CreateConVar("u_misc_debug_weapon", "0", "Debug info: Weapon");
|
||||
v_strName = CreateConVar("u_name", "", "Crash the game if changed");
|
||||
c_Name = CreateConCommand("u_name", CC_SetName, "Sets custom name");
|
||||
c_DumpItemAttributes = CreateConCommand("u_dump_item_attribs", CC_DumpAttribs, "Dump active weapon attributes");
|
||||
c_SayLine = CreateConCommand("u_say_lines", CC_SayLines, "Uses ^ as a newline character");
|
||||
c_Shutdown = CreateConCommand("u_shutdown", CC_Shutdown, "Stops the hack");
|
||||
@ -204,6 +230,7 @@ Misc::Misc() {
|
||||
c_Disconnect = CreateConCommand("u_disconnect", CC_Disconnect, "Disconnect");
|
||||
c_DisconnectVAC = CreateConCommand("u_disconnect_vac", CC_DisonnectVAC, "Disconnect (VAC)");
|
||||
v_bInfoSpam = CreateConVar("u_info_spam", "0", "Info spam");
|
||||
v_bFakeCrouch = CreateConVar("u_fakecrouch", "0", "Fake crouch");
|
||||
}
|
||||
|
||||
int sa_switch = 0;
|
||||
@ -211,14 +238,24 @@ int sa_switch = 0;
|
||||
|
||||
bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
//SetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 &~ cond::taunting);
|
||||
/*if (v_strName->m_StringLength) {
|
||||
logging::Info("Creating NetMsg!");
|
||||
/*if (false && v_strName->GetString()[0] != '\0') {
|
||||
//logging::Info("Name: %s", v_strName->GetString());
|
||||
NET_SetConVar setname("name", v_strName->GetString());
|
||||
//logging::Info("Created!");
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
setname.SetNetChannel(ch);
|
||||
logging::Info("Sending!");
|
||||
ch->SendNetMsg(*(INetMessage*)&setname);
|
||||
setname.SetReliable(false);
|
||||
//logging::Info("Sending!");
|
||||
ch->SendNetMsg(setname, false);
|
||||
//logging::Info("Sent!");
|
||||
//ch->SendNetMsg(*(INetMessage*)&setname);
|
||||
//setname.WriteToBuffer(0);
|
||||
}*/
|
||||
if (v_bFakeCrouch->GetBool()) {
|
||||
if (interfaces::gvars->tickcount % 2 == 0) {
|
||||
cmd->buttons &= ~IN_DUCK;
|
||||
}
|
||||
}
|
||||
static int curindex = 0;
|
||||
static int lastsay = 0;
|
||||
if (lastsay && lastsay < 200) {
|
||||
@ -267,6 +304,14 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
AddSideString(draw::white, draw::black, "interval_per_tick: %f", interfaces::gvars->interval_per_tick);
|
||||
AddSideString(draw::white, draw::black, "ambassador_can_headshot: %i", (interfaces::gvars->curtime - GetEntityValue<float>(g_pLocalPlayer->weapon, eoffsets.flLastFireTime)) > 0.95);
|
||||
AddSideString(draw::white, draw::black, "WeaponMode: %i", GetWeaponMode(g_pLocalPlayer->entity));
|
||||
AddSideString(draw::white, draw::black, "ToGround: %f", DistanceToGround(g_pLocalPlayer->v_Origin));
|
||||
AddSideString(draw::white, draw::black, "ServerTime: %f", GetEntityValue<float>(g_pLocalPlayer->entity, eoffsets.nTickBase) * interfaces::gvars->interval_per_tick);
|
||||
AddSideString(draw::white, draw::black, "CurTime: %f", interfaces::gvars->curtime);
|
||||
float speed, gravity;
|
||||
bool arc;
|
||||
GetProjectileData(g_pLocalPlayer->weapon, speed, arc, gravity);
|
||||
AddSideString(draw::white, draw::black, "Speed: %f", speed);
|
||||
AddSideString(draw::white, draw::black, "Gravity: %f", gravity);
|
||||
//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);
|
||||
//y += 14;
|
||||
|
@ -19,8 +19,9 @@ public:
|
||||
Misc();
|
||||
//ConVar* v_bNoShootUntilCanHeadshot;
|
||||
ConVar* v_bDbWeaponInfo;
|
||||
ConVar* v_strName;
|
||||
ConCommand* c_Name;
|
||||
ConVar* v_bInfoSpam;
|
||||
ConVar* v_bFakeCrouch;
|
||||
ConCommand* c_DumpItemAttributes;
|
||||
ConCommand* c_SayLine;
|
||||
ConCommand* c_Shutdown;
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "hooks.h"
|
||||
#include "sdk.h"
|
||||
|
||||
|
||||
@ -400,6 +401,7 @@ weaponmode GetWeaponMode(IClientEntity* player) {
|
||||
switch (weapon->GetClientClass()->m_ClassID) {
|
||||
case ClassID::CTFLunchBox:
|
||||
case ClassID::CTFLunchBox_Drink:
|
||||
case ClassID::CTFBuffItem:
|
||||
return weaponmode::weapon_consumable;
|
||||
case ClassID::CTFRocketLauncher_DirectHit:
|
||||
case ClassID::CTFRocketLauncher:
|
||||
@ -441,22 +443,31 @@ bool GetProjectileData(IClientEntity* weapon, float& speed, bool& arc, float& gr
|
||||
//rgrav = 0.5f;
|
||||
break;
|
||||
case ClassID::CTFCompoundBow: {
|
||||
// TODO VMT Stuff!
|
||||
float servertime = (float)GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.nTickBase) * interfaces::gvars->interval_per_tick;
|
||||
float curtime_old = interfaces::gvars->curtime;
|
||||
interfaces::gvars->curtime = servertime;
|
||||
typedef float(GetProjectileData)(IClientEntity*);
|
||||
rspeed = (reinterpret_cast<GetProjectileData*>(*(*(const void ***) weapon + 527)))(weapon);
|
||||
rgrav = ((GetProjectileData*) *(*(const void ***) weapon + 528))(weapon);
|
||||
//logging::Info("%f", ((GetProjectileData*)(hooks::GetVMT(weapon, 0)[457]))(weapon));
|
||||
interfaces::gvars->curtime = curtime_old;
|
||||
// TODO curtime
|
||||
float begincharge = GetEntityValue<float>(weapon, eoffsets.flChargeBeginTime);
|
||||
/*float begincharge = GetEntityValue<float>(weapon, eoffsets.flChargeBeginTime);
|
||||
float charge = 0;
|
||||
if (begincharge != 0) {
|
||||
charge = interfaces::gvars->curtime - begincharge;
|
||||
charge = servertime - begincharge;
|
||||
if (charge > 1.0f) charge = 1.0f;
|
||||
}
|
||||
}*/
|
||||
//rgrav = ( ( ( 1.3 - charge ) / 3 ) * 1000 ) / 800; // F1Public's method
|
||||
/*if (charge <= 0.5f) {
|
||||
rgrav = 0.5 - 0.4 * charge;
|
||||
} else {
|
||||
rgrav = 0.4 - 0.3 * charge;
|
||||
}*/
|
||||
rgrav = 0.5 - 0.4 * (charge);
|
||||
//rgrav = 0.5 - 0.4 * (charge);
|
||||
|
||||
rspeed = 1800 + 800 * charge;
|
||||
//rspeed = 1800 + 800 * charge;
|
||||
rarc = true;
|
||||
} break;
|
||||
case ClassID::CTFBat_Wood:
|
||||
@ -480,6 +491,7 @@ bool GetProjectileData(IClientEntity* weapon, float& speed, bool& arc, float& gr
|
||||
speed = rspeed;
|
||||
arc = rarc;
|
||||
gravity = rgrav;
|
||||
if (!arc) gravity = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -521,7 +533,7 @@ bool IsVectorVisible(Vector origin, Vector target) {
|
||||
return (dist1 <= dist2);
|
||||
}
|
||||
|
||||
bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float speed, bool arc, float gravity, Vector& result) {
|
||||
/*bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox_t hb, float speed, bool arc, float gravity, Vector& result) {
|
||||
if (!target) return false;
|
||||
//logging::Info("PRED PROJ AIM");
|
||||
//logging::Info("ProjSpeed: %f", speed);
|
||||
@ -545,7 +557,7 @@ bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float
|
||||
result = res1;
|
||||
//if (!IsVisible();
|
||||
return IsVectorVisible(origin, res1);
|
||||
}
|
||||
}*/
|
||||
|
||||
relation GetRelation(IClientEntity* ent) {
|
||||
if (!ent) return relation::NEUTRAL;
|
||||
@ -562,6 +574,7 @@ relation GetRelation(IClientEntity* ent) {
|
||||
}
|
||||
|
||||
bool IsSentryBuster(IClientEntity* entity) {
|
||||
// TODO
|
||||
return (entity && entity->GetClientClass()->m_ClassID == ClassID::CTFPlayer && GetEntityValue<int>(entity, eoffsets.iClass) == tf_class::tf_demoman && g_pPlayerResource->GetMaxHealth(entity) == 2500);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ float deg2rad(float deg);
|
||||
const char* MakeInfoString(IClientEntity* player);
|
||||
bool GetProjectileData(IClientEntity* weapon, float& speed, bool& arc, float& gravity);
|
||||
bool IsVectorVisible(Vector a, Vector b);
|
||||
bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float speed, bool arc, float gravity, Vector& result);
|
||||
//bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox_t hb, float speed, bool arc, float gravity, Vector& result);
|
||||
relation GetRelation(IClientEntity* ent);
|
||||
bool IsSentryBuster(IClientEntity* ent);
|
||||
char* strfmt(const char* fmt, ...);
|
||||
|
@ -15,7 +15,8 @@ unsigned int hooks::offCreateMove = 22;
|
||||
unsigned int hooks::offPaintTraverse = 42;
|
||||
unsigned int hooks::offOverrideView = 17;
|
||||
unsigned int hooks::offFrameStageNotify = 35;
|
||||
unsigned int hooks::offCanPacket = 30;
|
||||
unsigned int hooks::offCanPacket = 57;
|
||||
unsigned int hooks::offSendNetMsg = 41;
|
||||
|
||||
// This thing had been copypasted from somewhere, maybe from F1Public.
|
||||
|
||||
|
@ -41,6 +41,7 @@ extern unsigned int offCreateMove;
|
||||
extern unsigned int offOverrideView;
|
||||
extern unsigned int offFrameStageNotify;
|
||||
extern unsigned int offCanPacket;
|
||||
extern unsigned int offSendNetMsg;
|
||||
|
||||
}
|
||||
|
||||
|
@ -6,23 +6,116 @@
|
||||
*/
|
||||
|
||||
#include "netmessage.h"
|
||||
#include "logging.h"
|
||||
|
||||
bool bf_write::WriteString(const char *pStr)
|
||||
{
|
||||
if(pStr)
|
||||
{
|
||||
do
|
||||
{
|
||||
WriteChar( *pStr );
|
||||
++pStr;
|
||||
} while( *(pStr-1) != 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteChar( 0 );
|
||||
}
|
||||
|
||||
return !IsOverflowed();
|
||||
}
|
||||
|
||||
void bf_write::WriteSBitLong( int data, int numbits )
|
||||
{
|
||||
// Do we have a valid # of bits to encode with?
|
||||
|
||||
// Note: it does this wierdness here so it's bit-compatible with regular integer data in the buffer.
|
||||
// (Some old code writes direct integers right into the buffer).
|
||||
if(data < 0)
|
||||
{
|
||||
WriteUBitLong( (unsigned int)(0x80000000 + data), numbits - 1, false );
|
||||
WriteOneBit( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteUBitLong((unsigned int)data, numbits - 1);
|
||||
WriteOneBit( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void bf_write::WriteChar(int val)
|
||||
{
|
||||
WriteSBitLong(val, sizeof(char) << 3);
|
||||
}
|
||||
|
||||
void bf_write::WriteByte(int val)
|
||||
{
|
||||
WriteUBitLong(val, sizeof(unsigned char) << 3);
|
||||
}
|
||||
|
||||
void bf_write::WriteLong(long val)
|
||||
{
|
||||
WriteSBitLong(val, sizeof(long) << 3);
|
||||
}
|
||||
|
||||
bool NET_NOP::WriteToBuffer( bf_write &buffer )
|
||||
{
|
||||
buffer.WriteUBitLong( GetType(), 6 );
|
||||
return !buffer.IsOverflowed();
|
||||
}
|
||||
|
||||
bool NET_NOP::ReadFromBuffer( bf_read &buffer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *NET_NOP::ToString(void) const
|
||||
{
|
||||
return "(null)";
|
||||
}
|
||||
|
||||
|
||||
bool NET_SignonState::WriteToBuffer( bf_write &buffer )
|
||||
{
|
||||
buffer.WriteUBitLong( GetType(), 6 );
|
||||
buffer.WriteByte( m_nSignonState );
|
||||
buffer.WriteLong( m_nSpawnCount );
|
||||
|
||||
return !buffer.IsOverflowed();
|
||||
}
|
||||
|
||||
bool NET_SignonState::ReadFromBuffer( bf_read &buffer )
|
||||
{
|
||||
/*m_nSignonState = buffer.ReadByte();
|
||||
m_nSpawnCount = buffer.ReadLong();
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *NET_SignonState::ToString(void) const
|
||||
{
|
||||
return "(null)";
|
||||
}
|
||||
|
||||
|
||||
bool NET_SetConVar::WriteToBuffer( bf_write &buffer )
|
||||
{
|
||||
buffer.WriteUBitLong( GetType(), 5 );
|
||||
|
||||
int numvars = m_ConVars.Count();
|
||||
|
||||
//logging::Info("Writing to buffer 0x%08x!", buf);
|
||||
buffer.WriteUBitLong( GetType(), 6 );
|
||||
//logging::Info("A");
|
||||
int numvars = 1;//m_ConVars.Count();
|
||||
//logging::Info("B");
|
||||
// Note how many we're sending
|
||||
buffer.WriteByte( numvars );
|
||||
|
||||
for (int i=0; i< numvars; i++ )
|
||||
{
|
||||
cvar_t * cvar = &m_ConVars[i];
|
||||
buffer.WriteString( cvar->name );
|
||||
buffer.WriteString( cvar->value );
|
||||
}
|
||||
|
||||
//logging::Info("C");
|
||||
//for (int i=0; i< numvars; i++ )
|
||||
//{
|
||||
//cvar_t * cvar = &m_ConVars[i];
|
||||
buffer.WriteString( convar.name );
|
||||
buffer.WriteString( convar.value );
|
||||
//}
|
||||
//logging::Info("D");
|
||||
return !buffer.IsOverflowed();
|
||||
}
|
||||
|
||||
@ -30,14 +123,14 @@ bool NET_SetConVar::ReadFromBuffer( bf_read &buffer )
|
||||
{
|
||||
int numvars = buffer.ReadByte();
|
||||
|
||||
m_ConVars.RemoveAll();
|
||||
//m_ConVars.RemoveAll();
|
||||
|
||||
for (int i=0; i< numvars; i++ )
|
||||
{
|
||||
cvar_t cvar;
|
||||
buffer.ReadString( cvar.name, sizeof(cvar.name) );
|
||||
buffer.ReadString( cvar.value, sizeof(cvar.value) );
|
||||
m_ConVars.AddToTail( cvar );
|
||||
//m_ConVars.AddToTail( cvar );
|
||||
|
||||
}
|
||||
return !buffer.IsOverflowed();
|
||||
|
@ -64,8 +64,100 @@ protected:
|
||||
INetChannel *m_NetChannel; // netchannel this message is from/for
|
||||
};
|
||||
|
||||
#define net_SetConVar 5
|
||||
#define MAX_OSPATH 256
|
||||
#define net_NOP 0 // nop command used for padding
|
||||
#define net_Disconnect 1 // disconnect, last message in connection
|
||||
#define net_File 2 // file transmission message request/deny
|
||||
|
||||
#define net_Tick 3 // send last world tick
|
||||
#define net_StringCmd 4 // a string command
|
||||
#define net_SetConVar 5 // sends one/multiple convar settings
|
||||
#define net_SignonState 6 // signals current signon state
|
||||
|
||||
//
|
||||
// server to client
|
||||
//
|
||||
|
||||
#define svc_Print 7 // print text to console
|
||||
#define svc_ServerInfo 8 // first message from server about game, map etc
|
||||
#define svc_SendTable 9 // sends a sendtable description for a game class
|
||||
#define svc_ClassInfo 10 // Info about classes (first byte is a CLASSINFO_ define).
|
||||
#define svc_SetPause 11 // tells client if server paused or unpaused
|
||||
|
||||
|
||||
#define svc_CreateStringTable 12 // inits shared string tables
|
||||
#define svc_UpdateStringTable 13 // updates a string table
|
||||
|
||||
#define svc_VoiceInit 14 // inits used voice codecs & quality
|
||||
#define svc_VoiceData 15 // Voicestream data from the server
|
||||
|
||||
// #define svc_HLTV 16 // HLTV control messages
|
||||
|
||||
#define svc_Sounds 17 // starts playing sound
|
||||
|
||||
#define svc_SetView 18 // sets entity as point of view
|
||||
#define svc_FixAngle 19 // sets/corrects players viewangle
|
||||
#define svc_CrosshairAngle 20 // adjusts crosshair in auto aim mode to lock on traget
|
||||
|
||||
#define svc_BSPDecal 21 // add a static decal to the worl BSP
|
||||
// NOTE: This is now unused!
|
||||
//#define svc_TerrainMod 22 // modification to the terrain/displacement
|
||||
|
||||
// Message from server side to client side entity
|
||||
#define svc_UserMessage 23 // a game specific message
|
||||
#define svc_EntityMessage 24 // a message for an entity
|
||||
#define svc_GameEvent 25 // global game event fired
|
||||
|
||||
#define svc_PacketEntities 26 // non-delta compressed entities
|
||||
|
||||
#define svc_TempEntities 27 // non-reliable event object
|
||||
|
||||
#define svc_Prefetch 28 // only sound indices for now
|
||||
|
||||
#define svc_Menu 29 // display a menu from a plugin
|
||||
|
||||
#define svc_GameEventList 30 // list of known games events and fields
|
||||
|
||||
#define svc_GetCvarValue 31 // Server wants to know the value of a cvar on the client.
|
||||
|
||||
#define SVC_LASTMSG 31 // last known server messages
|
||||
|
||||
//
|
||||
// client to server
|
||||
//
|
||||
|
||||
#define clc_ClientInfo 8 // client info (table CRC etc)
|
||||
#define clc_Move 9 // [CUserCmd]
|
||||
#define clc_VoiceData 10 // Voicestream data from a client
|
||||
#define clc_BaselineAck 11 // client acknowledges a new baseline seqnr
|
||||
#define clc_ListenEvents 12 // client acknowledges a new baseline seqnr
|
||||
#define clc_RespondCvarValue 13 // client is responding to a svc_GetCvarValue message.
|
||||
#define clc_FileCRCCheck 14 // client is sending a file's CRC to the server to be verified.
|
||||
|
||||
#define CLC_LASTMSG 14 // last known client message
|
||||
|
||||
#define MAX_OSPATH 260
|
||||
|
||||
class NET_NOP : public CNetMessage {
|
||||
DECLARE_NET_MESSAGE( NOP );
|
||||
|
||||
int GetGroup() const { return INetChannelInfo::GENERIC; }
|
||||
NET_NOP() {};
|
||||
};
|
||||
|
||||
class NET_SignonState : public CNetMessage
|
||||
{
|
||||
DECLARE_NET_MESSAGE( SignonState );
|
||||
|
||||
int GetGroup() const { return INetChannelInfo::SIGNON; }
|
||||
|
||||
NET_SignonState() {};
|
||||
NET_SignonState( int state, int spawncount ) { m_nSignonState = state; m_nSpawnCount = spawncount; };
|
||||
|
||||
public:
|
||||
int m_nSignonState; // See SIGNONSTATE_ defines
|
||||
int m_nSpawnCount; // server spawn count (session number)
|
||||
};
|
||||
|
||||
|
||||
class NET_SetConVar : public CNetMessage
|
||||
{
|
||||
@ -79,7 +171,7 @@ class NET_SetConVar : public CNetMessage
|
||||
cvar_t cvar;
|
||||
strncpy( cvar.name, name, MAX_OSPATH );
|
||||
strncpy( cvar.value, value, MAX_OSPATH );
|
||||
m_ConVars.AddToTail( cvar );
|
||||
convar = cvar;
|
||||
}
|
||||
|
||||
public:
|
||||
@ -89,8 +181,8 @@ public:
|
||||
char name[MAX_OSPATH];
|
||||
char value[MAX_OSPATH];
|
||||
} cvar_t;
|
||||
|
||||
CUtlVector<cvar_t> m_ConVars;
|
||||
cvar_t convar;
|
||||
//CUtlVector<cvar_t> m_ConVars;
|
||||
};
|
||||
|
||||
#endif /* NETMESSAGE_H_ */
|
||||
|
63
uran/src/prediction.cpp
Normal file
63
uran/src/prediction.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* prediction.cpp
|
||||
*
|
||||
* Created on: Dec 5, 2016
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include "prediction.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "sdk.h"
|
||||
|
||||
Vector SimpleLatencyPrediction(IClientEntity* ent, int hb) {
|
||||
//logging::Info("Simple prediction!");
|
||||
if (!ent) return Vector();
|
||||
Vector result;
|
||||
GetHitboxPosition(ent, hb, result);
|
||||
float latency = interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
result += GetEntityValue<Vector>(ent, eoffsets.vVelocity) * latency;
|
||||
//logging::Info("Returning!");
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector ProjectilePrediction(IClientEntity* ent, int hb, float speed, float gravitymod) {
|
||||
if (!ent) return Vector();
|
||||
Vector result = ent->GetAbsOrigin();
|
||||
float dtg = DistanceToGround(result);
|
||||
GetHitboxPosition(ent, hb, result);
|
||||
Vector vel = GetEntityValue<Vector>(ent, eoffsets.vVelocity);
|
||||
// TODO ProjAim
|
||||
/*float tt = g_pLocalPlayer->v_Eye.DistTo(result) + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING) - 0.20;
|
||||
float besttime = tt + 0.20;
|
||||
float mindelta = -1;
|
||||
for (int steps = 0; steps < 40; steps++, tt += 0.01) {
|
||||
Vector curpos = result;
|
||||
curpos += vel * tt;
|
||||
Vector projpos = v_Eye +
|
||||
}*/
|
||||
float dtt = g_pLocalPlayer->v_Eye.DistTo(result);
|
||||
float ttt = dtt / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
float oz = result.z;
|
||||
int flags = GetEntityValue<int>(ent, eoffsets.iFlags);
|
||||
bool ground = (flags & (1 << 0));
|
||||
if (!ground) result.z -= ttt * ttt * 400;
|
||||
result += vel * ttt;
|
||||
if (oz - result.z > dtg) { result.z = oz - dtg; }
|
||||
result.z += (400 * ttt * ttt * gravitymod);
|
||||
// S = at^2/2 ; t = sqrt(2S/a)
|
||||
return result;
|
||||
}
|
||||
|
||||
float DistanceToGround(Vector origin) {
|
||||
static trace_t* ground_trace = new trace_t();
|
||||
Ray_t ray;
|
||||
Vector endpos = origin;
|
||||
endpos.z -= 8192;
|
||||
ray.Init(origin, endpos);
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, trace::g_pFilterNoPlayer, ground_trace);
|
||||
return ground_trace->startpos.DistTo(ground_trace->endpos);
|
||||
}
|
21
uran/src/prediction.h
Normal file
21
uran/src/prediction.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* prediction.h
|
||||
*
|
||||
* Created on: Dec 5, 2016
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#ifndef PREDICTION_H_
|
||||
#define PREDICTION_H_
|
||||
|
||||
#include "enums.h"
|
||||
|
||||
class IClientEntity;
|
||||
class Vector;
|
||||
|
||||
Vector SimpleLatencyPrediction(IClientEntity* ent, int hb);
|
||||
Vector ProjectilePrediction(IClientEntity* ent, int hb, float speed, float gravitymod);
|
||||
|
||||
float DistanceToGround(Vector origin);
|
||||
|
||||
#endif /* PREDICTION_H_ */
|
@ -32,6 +32,9 @@
|
||||
#include <vgui/ISurface.h>
|
||||
#include <vgui/IPanel.h>
|
||||
#include <mathlib/vmatrix.h>
|
||||
#include <inetmessage.h>
|
||||
#include <iclient.h>
|
||||
#include <iserver.h>
|
||||
#include <view_shared.h>
|
||||
|
||||
#include "sdk/in_buttons.h"
|
||||
|
Reference in New Issue
Block a user