Начинающий
- Статус
- Оффлайн
- Регистрация
- 15 Окт 2019
- Сообщения
- 45
- Реакции
- 8
never seen before!! 
bone builder shouldnt matter for now i guess.
// total bones actually used.
#define MAXSTUDIOBONES 128
+ see files attached.

bone builder shouldnt matter for now i guess.
// total bones actually used.
#define MAXSTUDIOBONES 128
+ see files attached.
SetAngles && UpdateAnimations, still call in FRAME_RENDER_START:
void Client::SetAngles() {
if (!m_local || !m_processing)
return;
// set radar angles.
if (m_input.get()->cam_is_third_person())
m_prediction.get()->set_local_view_angles(m_radar);
}
void Client::UpdateAnimations() {
if (!m_local || !m_processing)
return;
auto pLocal = m_local;
auto pState = pLocal->m_PlayerAnimState();
if (!pState || !pLocal || !g_ServerAnimations.m_pCmd)
return;
// backup pose parameters.
std::memcpy(g_ServerAnimations.m_uVisualAnimations.m_pPoseParameters.data(), pLocal->m_flPoseParameter(), sizeof(float) * 20);
// backup bone matrix.
matrix3x4_t pBackupMatrix[MAXSTUDIOBONES];
std::memcpy(pBackupMatrix, pLocal->m_BoneCache().Base(), pLocal->m_BoneCache().Count() * sizeof(matrix3x4_t));
// backup abs angles.
// ang_t angAbsAngles = pLocal->get_abs_angles();
// backup animstate.
c_animstate pStateBackup{};
std::memcpy(&pStateBackup, pState, sizeof(c_animstate));
// set abs angles to foot yaw.
pLocal->SetAbsAngles(ang_t(0.f, g_ServerAnimations.m_uServerAnimations.m_flFootYaw, 0.f));
// backup animation overlays.
std::array<C_AnimationLayer, 13> pAnimOverlays;
pLocal->GetAnimLayers(pAnimOverlays.data());
// setup ground and flag stuff.
static bool bOnGround = false;
bool bWasOnGround = bOnGround;
bOnGround = (pLocal->m_fFlags() & FL_ONGROUND);
bool leftGroundThisFrame = bWasOnGround && !bOnGround;
if (leftGroundThisFrame && (g_ServerAnimations.m_pCmd->m_buttons & IN_JUMP)) {
auto v94 = &g_ServerAnimations.m_uVisualAnimations.m_pAnimOverlays[4];
int v95 = pState->SelectSequenceFromActivityModifier(985);
v94->m_sequence = v95;
v94->m_playback_rate = pLocal->GetLayerSequenceCycleRate(v94, v95);
v94->m_cycle = 0.0f;
v94->m_weight = 0.0f;
g_ServerAnimations.m_uVisualAnimations.m_pAnimOverlays[4] = *v94;
}
// apply overlays.
pLocal->SetAnimLayers(g_ServerAnimations.m_uVisualAnimations.m_pAnimOverlays.data());
// build visual bones.
// c_bone_builder pVisualBones;
// pVisualBones.store(pLocal, g_ServerAnimations.m_uVisualAnimations.m_pMatrix, 0x7FF00);
// pVisualBones.setup();
// setup bones.
pLocal->SetupBones(g_ServerAnimations.m_uVisualAnimations.m_pMatrix, MAXSTUDIOBONES, 0x7FF00, g_cl.m_local->m_flSimulationTime());
// restore overlays.
pLocal->SetAnimLayers(pAnimOverlays.data());
// remove origin from matrix.
for (int i = 0; i < MAXSTUDIOBONES; ++i)
for (int n = 0; n <= 2; ++n)
g_ServerAnimations.m_uVisualAnimations.m_pMatrix[i].m_flMatVal[n][3] -= pLocal->get_abs_origin()[n];
// restore abs angles.
// pLocal->SetAbsAngles(angAbsAngles);
// Restore animstate
std::memcpy(pState, &pStateBackup, sizeof(c_animstate));
// Restore bone matrix
std::memcpy(pLocal->m_BoneCache().Base(), pBackupMatrix, pLocal->m_BoneCache().Count() * sizeof(matrix3x4_t));
// Restore pose parameters
std::memcpy(pLocal->m_flPoseParameter(), g_ServerAnimations.m_uVisualAnimations.m_pPoseParameters.data(), sizeof(float) * 20);
}
delete some vars from client.h and use these from server_animations:
ang_t m_rotation;
float m_body;
float m_body_pred;
float m_speed;
bool m_ground;
GhettoUpdateClientSideAnimationsEx and hooked UpdateClientSideAnimation:
void Player::GhettoUpdateClientSideAnimationsEx() {
if (!g_hooks.m_UpdateClientSideAnimation) {
return;
}
const auto clientsideanimationBackup = this->m_bClientSideAnimation();
this->m_bClientSideAnimation() = true; // disable CGlobalVarsBase::curtime interpolation
g_cl.m_hltv_bypass = true; // disable velocity and duck amount interpolation.
g_hooks.m_UpdateClientSideAnimation(this); // update anims.
this->m_bClientSideAnimation() = clientsideanimationBackup;
g_cl.m_hltv_bypass = false;
}
void Hooks::UpdateClientSideAnimation() {
// cast thisptr to player ptr.
Player* player = (Player*)this;
if (!player || !player->IsPlayer() || player->IsDead())
return g_hooks.m_UpdateClientSideAnimation(this);
if (!m_updating_animations)
return;
g_hooks.m_UpdateClientSideAnimation(this);
}