--------------
in GLBEGIN
------------
int plindex;
if(pEngstudio->GetCurrentEntity)
p_anentity = pEngstudio->GetCurrentEntity();
if(p_anentity && settings.botactive)
if(p_anentity->player)
{
plindex = GetPlayerByIndex(p_anentity->index);
if(plindex != -1)
if(!vPlayers[plindex].gotbones) //gotbones is a bool which is reset for every player in every Draw() call
{
vPlayers[plindex].gotbones = true;
model_s* pModel = pEngstudio->SetupPlayerModel(plindex/*-1*/);
studiohdr_t* pStudioHeader = (studiohdr_t*)pEngstudio->Mod_Extradata( pModel );
typedef float TransformMatrix[ MAXSTUDIOBONES ][ 3 ][ 4 ];
TransformMatrix* pbonetransform = (TransformMatrix*)pEngstudio->StudioGetBoneTransform();
Con_EchoD(pStudioHeader->name);
drawpoint_t point;
point.w = 2;point.h = 2;point.r = 1.0f;point.g = 1.0f;point.b = 1.0f;point.a = 1.0f;
point.world = true;
int i = settings.selbone;
if( i>=0 && i<pStudioHeader->numbones )
{
point.pos[ 0 ] = (*pbonetransform)[ i ][ 0 ][ 3 ];
point.pos[ 1 ] = (*pbonetransform)[ i ][ 1 ][ 3 ];
point.pos[ 2 ] = (*pbonetransform)[ i ][ 2 ][ 3 ];
DrawPoints.push_back(point);
mstudiobone_t *pbones = (mstudiobone_t *)((byte *)pStudioHeader + pStudioHeader->boneindex);
char tmp[64];sprintf(tmp,"#%d: %s",i,pbones.name);
Con_EchoD(tmp);
strcpy(gHudMessage,tmp);
gHudTimer.countdown(3);
}
}}
-------------------------------------
FOR HITBOX AIMING
------------------------
step 1 -> set up the bone transform matrix as if you were doing normal bone aiming (check lance's guide for this)
step 2 -> use the studio header to get the hitbox data and set up a loop to find the "head" hitbox (hint: the head is always in hitgroup 1)
step 3 -> transform the head hitbox with the bone transformation matrix, since every hitbox is attached rigidly to a bone
step 4 -> use the minimum and maximum bounding box values of the hitbox to calculate the potential target points in the head area, and pick the one that is most likely to result in a hit