off
-
Автор темы
- #1
Кароче спастил я с flexhack'a скелетоны, и тут ошибки рендера, на что их заменить? Я просто не до конца разобрался CSGOSimple.
void Visuals::Player::RenderSkeleton() {
Vector vHitboxSkeletonArray[18][2];
static matrix3x4_t boneMatrix[MAXSTUDIOBONES];
auto GetHitBoxSkeleton = [](int nHitBoxOne, int nHitBoxTwo, C_BasePlayer* pEntity, Vector* vOut, matrix3x4_t boneMatrix[MAXSTUDIOBONES])
{
auto GetHitboxPosition = [](C_BasePlayer* p, int hitbox, matrix3x4_t MatrixArray[MAXSTUDIOBONES]) {
if (hitbox >= HITBOX_MAX || hitbox < 0)
return Vector(0, 0, 0);
const model_t *model = p->GetModel();
if (!model)
return Vector(0, 0, 0);
studiohdr_t *studioHdr = g_MdlInfo->GetStudiomodel(model);
if (!studioHdr)
return Vector(0, 0, 0);
mstudiobbox_t *studioBox = studioHdr->GetHitboxSet(0)->GetHitbox(hitbox);
if (!studioBox)
return Vector(0, 0, 0);
Vector min, max;
Math::VectorTransform(studioBox->bbmin, MatrixArray[studioBox->bone], min);
Math::VectorTransform(studioBox->bbmax, MatrixArray[studioBox->bone], max);
Vector output = (min + max) * 0.5f;
return output;
};
vOut[0] = GetHitboxPosition(pEntity, nHitBoxOne, boneMatrix);
vOut[1] = GetHitboxPosition(pEntity, nHitBoxTwo, boneMatrix);
};
if (ctx.pl->SetupBones(boneMatrix, MAXSTUDIOBONES, BONE_USED_BY_HITBOX, 0.0f)) {
GetHitBoxSkeleton(HITBOX_NECK, HITBOX_UPPER_CHEST, ctx.pl, vHitboxSkeletonArray[2], boneMatrix);
GetHitBoxSkeleton(HITBOX_UPPER_CHEST, HITBOX_CHEST, ctx.pl, vHitboxSkeletonArray[3], boneMatrix);
GetHitBoxSkeleton(HITBOX_CHEST, HITBOX_LOWER_CHEST, ctx.pl, vHitboxSkeletonArray[4], boneMatrix);
GetHitBoxSkeleton(HITBOX_LOWER_CHEST, HITBOX_STOMACH, ctx.pl, vHitboxSkeletonArray[5], boneMatrix);
GetHitBoxSkeleton(HITBOX_STOMACH, HITBOX_LEFT_THIGH, ctx.pl, vHitboxSkeletonArray[6], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_THIGH, HITBOX_LEFT_CALF, ctx.pl, vHitboxSkeletonArray[7], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_CALF, HITBOX_LEFT_FOOT, ctx.pl, vHitboxSkeletonArray[8], boneMatrix);
GetHitBoxSkeleton(HITBOX_STOMACH, HITBOX_RIGHT_THIGH, ctx.pl, vHitboxSkeletonArray[9], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_THIGH, HITBOX_RIGHT_CALF, ctx.pl, vHitboxSkeletonArray[10], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_CALF, HITBOX_RIGHT_FOOT, ctx.pl, vHitboxSkeletonArray[11], boneMatrix);
GetHitBoxSkeleton(HITBOX_CHEST, HITBOX_LEFT_UPPER_ARM, ctx.pl, vHitboxSkeletonArray[12], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_UPPER_ARM, HITBOX_LEFT_FOREARM, ctx.pl, vHitboxSkeletonArray[13], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_FOREARM, HITBOX_LEFT_HAND, ctx.pl, vHitboxSkeletonArray[14], boneMatrix);
GetHitBoxSkeleton(HITBOX_CHEST, HITBOX_RIGHT_UPPER_ARM, ctx.pl, vHitboxSkeletonArray[15], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_UPPER_ARM, HITBOX_RIGHT_FOREARM, ctx.pl, vHitboxSkeletonArray[16], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_FOREARM, HITBOX_RIGHT_HAND, ctx.pl, vHitboxSkeletonArray[17], boneMatrix);
auto DrawHitBoxLine = [](Vector* vHitBoxArray, Color color)
{
//MUT("ESP::DrawHitBoxLine");
Vector vHitBoxOneScreen;
Vector vHitBoxTwoScreen;
if (!vHitBoxArray[0].IsValid() || !vHitBoxArray[1].IsValid()) {
return;
}
if (!g_DebugOverlay->ScreenPosition(vHitBoxArray[0], vHitBoxOneScreen) && !g_DebugOverlay->ScreenPosition(vHitBoxArray[1], vHitBoxTwoScreen))
{
Render::Get().draw_list_act->AddLine(Vector2D(vHitBoxOneScreen.x, vHitBoxOneScreen.y), Vector2D(vHitBoxTwoScreen.x, vHitBoxTwoScreen.y), color);
}
//END();
};
for (BYTE IndexArray = 0; IndexArray < 18; IndexArray++)
DrawHitBoxLine(vHitboxSkeletonArray[IndexArray], ctx.clr);
}
}
Vector vHitboxSkeletonArray[18][2];
static matrix3x4_t boneMatrix[MAXSTUDIOBONES];
auto GetHitBoxSkeleton = [](int nHitBoxOne, int nHitBoxTwo, C_BasePlayer* pEntity, Vector* vOut, matrix3x4_t boneMatrix[MAXSTUDIOBONES])
{
auto GetHitboxPosition = [](C_BasePlayer* p, int hitbox, matrix3x4_t MatrixArray[MAXSTUDIOBONES]) {
if (hitbox >= HITBOX_MAX || hitbox < 0)
return Vector(0, 0, 0);
const model_t *model = p->GetModel();
if (!model)
return Vector(0, 0, 0);
studiohdr_t *studioHdr = g_MdlInfo->GetStudiomodel(model);
if (!studioHdr)
return Vector(0, 0, 0);
mstudiobbox_t *studioBox = studioHdr->GetHitboxSet(0)->GetHitbox(hitbox);
if (!studioBox)
return Vector(0, 0, 0);
Vector min, max;
Math::VectorTransform(studioBox->bbmin, MatrixArray[studioBox->bone], min);
Math::VectorTransform(studioBox->bbmax, MatrixArray[studioBox->bone], max);
Vector output = (min + max) * 0.5f;
return output;
};
vOut[0] = GetHitboxPosition(pEntity, nHitBoxOne, boneMatrix);
vOut[1] = GetHitboxPosition(pEntity, nHitBoxTwo, boneMatrix);
};
if (ctx.pl->SetupBones(boneMatrix, MAXSTUDIOBONES, BONE_USED_BY_HITBOX, 0.0f)) {
GetHitBoxSkeleton(HITBOX_NECK, HITBOX_UPPER_CHEST, ctx.pl, vHitboxSkeletonArray[2], boneMatrix);
GetHitBoxSkeleton(HITBOX_UPPER_CHEST, HITBOX_CHEST, ctx.pl, vHitboxSkeletonArray[3], boneMatrix);
GetHitBoxSkeleton(HITBOX_CHEST, HITBOX_LOWER_CHEST, ctx.pl, vHitboxSkeletonArray[4], boneMatrix);
GetHitBoxSkeleton(HITBOX_LOWER_CHEST, HITBOX_STOMACH, ctx.pl, vHitboxSkeletonArray[5], boneMatrix);
GetHitBoxSkeleton(HITBOX_STOMACH, HITBOX_LEFT_THIGH, ctx.pl, vHitboxSkeletonArray[6], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_THIGH, HITBOX_LEFT_CALF, ctx.pl, vHitboxSkeletonArray[7], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_CALF, HITBOX_LEFT_FOOT, ctx.pl, vHitboxSkeletonArray[8], boneMatrix);
GetHitBoxSkeleton(HITBOX_STOMACH, HITBOX_RIGHT_THIGH, ctx.pl, vHitboxSkeletonArray[9], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_THIGH, HITBOX_RIGHT_CALF, ctx.pl, vHitboxSkeletonArray[10], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_CALF, HITBOX_RIGHT_FOOT, ctx.pl, vHitboxSkeletonArray[11], boneMatrix);
GetHitBoxSkeleton(HITBOX_CHEST, HITBOX_LEFT_UPPER_ARM, ctx.pl, vHitboxSkeletonArray[12], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_UPPER_ARM, HITBOX_LEFT_FOREARM, ctx.pl, vHitboxSkeletonArray[13], boneMatrix);
GetHitBoxSkeleton(HITBOX_LEFT_FOREARM, HITBOX_LEFT_HAND, ctx.pl, vHitboxSkeletonArray[14], boneMatrix);
GetHitBoxSkeleton(HITBOX_CHEST, HITBOX_RIGHT_UPPER_ARM, ctx.pl, vHitboxSkeletonArray[15], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_UPPER_ARM, HITBOX_RIGHT_FOREARM, ctx.pl, vHitboxSkeletonArray[16], boneMatrix);
GetHitBoxSkeleton(HITBOX_RIGHT_FOREARM, HITBOX_RIGHT_HAND, ctx.pl, vHitboxSkeletonArray[17], boneMatrix);
auto DrawHitBoxLine = [](Vector* vHitBoxArray, Color color)
{
//MUT("ESP::DrawHitBoxLine");
Vector vHitBoxOneScreen;
Vector vHitBoxTwoScreen;
if (!vHitBoxArray[0].IsValid() || !vHitBoxArray[1].IsValid()) {
return;
}
if (!g_DebugOverlay->ScreenPosition(vHitBoxArray[0], vHitBoxOneScreen) && !g_DebugOverlay->ScreenPosition(vHitBoxArray[1], vHitBoxTwoScreen))
{
Render::Get().draw_list_act->AddLine(Vector2D(vHitBoxOneScreen.x, vHitBoxOneScreen.y), Vector2D(vHitBoxTwoScreen.x, vHitBoxTwoScreen.y), color);
}
//END();
};
for (BYTE IndexArray = 0; IndexArray < 18; IndexArray++)
DrawHitBoxLine(vHitboxSkeletonArray[IndexArray], ctx.clr);
}
}