Hitbox
Hitbox
//*** in aimbot.cpp ***//
//*** in aimbot.cpp ***//
//*** in aimbot.cpp ***//
above void OriginAimbot::FindTarget()
Code:
add static bool hitboxloaded = false;
then in void OriginAimbot::FindTarget()
add
Code:
if(hitboxloaded)
{
cmd.exec("avclear;avadd 0 0 0 0;avadd 1 0 0 0;avadd 2 0 0 0");
}
then find void OriginAimbot::CalcVec_MeToTarget(float *view)
replace it with this
Code:
void OriginAimbot::CalcVec_MeToTarget(float *view)
{
float EntViewOrg[3];
CalcTargetSpot(EntViewOrg);
if(cvar.hitbox)
{
VectorCopy(vPlayers[target].vPlayerHead,EntViewOrg);
hitboxloaded=true;
} else {
VectorCopy(EntViewOrg, aim_spot);
hitboxloaded=false;
}
view[0] = EntViewOrg[0] - me.pmEyePos[0];
view[1] = EntViewOrg[1] - me.pmEyePos[1];
view[2] = EntViewOrg[2] - me.pmEyePos[2];
}
//*** in client.cpp ***//
//*** in client.cpp ***//
//*** in client.cpp ***//
int ( *OrigStudioDrawPlayer )( int flags, struct entity_state_s *pplayer );
under that put
Code:
void VectorTransform (float *in1, float in2[3][4], float *out)
{
out[0] = DotProduct(in1, in2[0]) + in2[0][3];
out[1] = DotProduct(in1, in2[1]) + in2[1][3];
out[2] = DotProduct(in1, in2[2]) + in2[2][3];
}
void GetHeadPosition(cl_entity_t *pEnt)
{
typedef float BoneMatrix_t[MAXSTUDIOBONES][3][4];
model_t *pModel;
studiohdr_t *pStudioHeader;
BoneMatrix_t *pBoneMatrix;
Vector vBBMin = Vector(0, 0, 0);
Vector vBBMax = Vector(0, 0, 0);
mstudiobbox_t *pHitbox;
int i;
local_player_info playerdata[32];
if(!vPlayers[pEnt->index].bGotHead)
{
pModel = IEngineStudio.SetupPlayerModel(pEnt->index);
pStudioHeader = (studiohdr_t*)IEngineStudio.Mod_Extradata(pModel);
pBoneMatrix = (BoneMatrix_t*)IEngineStudio.StudioGetBoneTransform();
pHitbox = (mstudiobbox_t*)((byte*)pStudioHeader + pStudioHeader->hitboxindex);
int iGroup = cvar.hitbox;
if (cvar.hitbox > 20) {cvar.hitbox = 11;}
i = cvar.hitbox;
if(i)
{
Vector vCubePoints[8];
Vector vCubePointsTrans[8];
Vector testvec;
Vector vNew;
Vector vOffset;
VectorTransform(pHitbox.bbmin, (*pBoneMatrix)[pHitbox.bone], vBBMin);
VectorTransform(pHitbox.bbmax, (*pBoneMatrix)[pHitbox.bone], vBBMax);
if(i)
{
vPlayers[pEnt->index].vPlayerHead = (vBBMax + vBBMin)*0.5f;
vPlayers[pEnt->index].bGotHead = true;
vPlayers[pEnt->index].vPlayerHead - vPlayers[pEnt->index].getEnt()->origin;
Vector vLog = (vPlayers[pEnt->index].vPlayerHead - pEnt->origin);
}
vCubePoints[0] = (pHitbox.bbmin);
vCubePoints[1] = Vector(pHitbox.bbmin.x, pHitbox.bbmax.y, pHitbox.bbmin.z);
vCubePoints[2] = Vector(pHitbox.bbmax.x, pHitbox.bbmax.y, pHitbox.bbmin.z);
vCubePoints[3] = Vector(pHitbox.bbmax.x, pHitbox.bbmin.y, pHitbox.bbmin.z);
vCubePoints[4] = (pHitbox.bbmax);
vCubePoints[5] = Vector(pHitbox.bbmin.x, pHitbox.bbmax.y, pHitbox.bbmax.z);
vCubePoints[6] = Vector(pHitbox.bbmin.x, pHitbox.bbmin.y, pHitbox.bbmax.z);
vCubePoints[7] = Vector(pHitbox.bbmax.x, pHitbox.bbmin.y, pHitbox.bbmax.z);
int iColor = pHitbox.group;
if (cvar.drawhitbox)
{
for(int j = 0; j < 8; j++) { VectorTransform(vCubePoints[j], (*pBoneMatrix)[pHitbox.bone], vCubePointsTrans[j]); }
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLineWidth(1.5f);
glBegin(GL_LINE_LOOP);
glColor4f(1.2f, 0.2f, 0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[0]);
glColor4f(0.2f, 1.2f, 0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[1]);
glColor4f(0.2f, 0.2f, 1.2f, 1.0f);
glVertex3fv(vCubePointsTrans[2]);
glColor4f(0.2f, 1.2f, 1.2f, 1.0f);
glVertex3fv(vCubePointsTrans[3]);
glEnd();
glBegin(GL_LINE_LOOP);
glColor4f(1.2f, 0.2f, 0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[4]);
glColor4f(0.2f, 1.2f, 0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[5]);
glColor4f(0.2f, 0.2f, 1.2f, 1.0f);
glVertex3fv(vCubePointsTrans[6]);
glColor4f(0.2f, 1.2f, 1.2f, 1.0f);
glVertex3fv(vCubePointsTrans[7]);
glEnd();
glBegin(GL_LINES);
glVertex3fv(vCubePointsTrans[0]);
glColor4f(1.2f, 0.2f,0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[6]);
glColor4f(0.2f, 1.2f, 0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[1]);
glColor4f(0.2f, 0.2f, 1.2f, 1.0f);
glVertex3fv(vCubePointsTrans[5]);
glColor4f(0.2f, 1.2f, 1.2f, 1.0f);
glVertex3fv(vCubePointsTrans[2]);
glColor4f(1.2f, 0.2f, 0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[4]);
glColor4f(0.2f, 1.2f, 0.2f, 1.0f);
glVertex3fv(vCubePointsTrans[3]);
glColor4f(0.2f, 0.2f, 1.2f, 1.0f);
glVertex3fv(vCubePointsTrans[7]);
glEnd();
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
}
}
}
}
in void PreV_CalcRefdef (struct ref_params_s *pparams)
under for (int ax=0;ax<vPlayers.size();ax++)
add
Code:
vPlayers[ax].bGotHead = false;
//*** in client.h ***//
//*** in client.h ***//
//*** in client.h ***//
At the top add
Code:
#include "engine/cl_entity.h"
under class PlayerInfo in public add
Code:
bool bGotHead;
Vector vPlayerHead;
Then at the very button add
Code:
extern void GetHeadPosition(cl_entity_t *pEnt);
//*** in opengl.cpp ***//
//*** in opengl.cpp ***//
//*** in opengl.cpp ***//
at the top add this
Code:
#include "engine/cl_entity.h"
then under typedef void (APIENTRY *TglRectiFunc) (GLint x, GLint y, GLint x2, GLint y2);
add
Code:
typedef void (APIENTRY *xglPopMatrix) (GLvoid);
then under TglRectiFunc oglRecti = NULL; add
Code:
xglPopMatrix oglPopMatrix=NULL;
above void CheckForOpenGlHook(FARPROC* pProc,LPCTSTR lpProcName)
add
Code:
extern engine_studio_api_s *pstudio;
void APIENTRY pglPopMatrix (GLvoid)
{
cl_entity_t * pEnt;
pEnt = pstudio->GetCurrentEntity();
if(pEnt && pEnt->player)
GetHeadPosition(pEnt);
glPopMatrix( );
}
FINALLY LAST STEP!
then at the button of void CheckForOpenGlHook(FARPROC* pProc,LPCTSTR lpProcName)
add
Code:
else
if (!strcmp(lpProcName,"glPopMatrix"))
{
oglPopMatrix = (xglPopMatrix)*pProc;
*pProc = (FARPROC)&pglPopMatrix;
}