-
Автор темы
- #1
void build_server_bones(C_BasePlayer* player, matrix3x4_t* pBoneToWorldOut, float currentTime)
{
if (!player)
return;
// get studio hdr.
const auto hdr = player->GetModelPtr();
if (!hdr)
return;
// get renderable entity.
const auto renderable = (C_BasePlayer*)((DWORD)player + 0x4);
if (!renderable)
return;
// initialize variables.
Vector pos[128]{};
quaternion q[128]{};
uint8_t computed[256]{};
// aligned transform matrix.
_declspec(align(16)) matrix3x4_t transform = Math::angle_matrix(
player->GetAbsAngles(), player->m_vecOrigin());
// stop interpolation
player->get_effects() |= 8;
// notify engine we're setting up bones.
*(int*)((DWORD)renderable + 224) |= 8;
// get ik_context.
IKContext* IK_context = player->get_ik_context();
if (IK_context)
{
IK_context->clear_targets();
IK_context->init(hdr, player->GetAbsAngles(), player->m_vecOrigin(),
g_pGlobalVars->curtime, g_pGlobalVars->framecount, 256);
}
// run blending.
player->StandardBlendingRules(hdr, pos, q, g_pGlobalVars->curtime, 256);
// target matrix.
const auto bone_matrix = player->get_bone_array_for_write();
// fix arm jitter.
if (IK_context)
{
player->update_ik_locks(g_pGlobalVars->curtime);
IK_context->update_targets(pos, q, bone_matrix, computed);
player->calculate_ik_locks(g_pGlobalVars->curtime);
IK_context->solve_dependencies(pos, q, bone_matrix, computed);
}
// build bones.
player->BuildTransformations(hdr, pos, q, transform, 256, computed);
// save bones.
memcpy(pBoneToWorldOut, bone_matrix, player->get_bone_cache_count() * sizeof(float) * 12);
// start interpolation again
player->get_effects() &= ~8;
// cleanup.
*(int*)((DWORD)renderable + 224) &= ~(8);
const auto hdr = player->GetModelPtr();
if (!hdr)
return;
auto bone_accessor = player->GetBoneAccessor();
if (!bone_accessor)
return;
const auto backup_matrix = bone_accessor->GetBoneArrayForWrite();
if (!backup_matrix)
return;
ALIGN16 matrix3x4_t parent_transform;
Math::angle_matrix(player->GetAbsAngles(), player->m_vecOrigin(), parent_transform);
ZeroMemory(pos, sizeof(Vector[128]));
ZeroMemory(q, sizeof(quaternion[128]));
player->get_effects() |= 0x008;
IKContext* m_pIk = player->get_ik_context();
if (m_pIk)
{
m_pIk->clear_targets();
m_pIk->init(hdr, player->GetAbsAngles(), player->GetAbsOrigin(), currentTime, g_pGlobalVars->framecount, bone_used_mask);
}
// set bone array for write.
bone_accessor->SetBoneArrayForWrite(pBoneToWorldOut);
// compute and build bones.
player->StandardBlendingRules(hdr, pos, q, g_pGlobalVars->curtime, 256);
ZeroMemory(computed, sizeof(byte[0x20]));
if (m_pIk)
{
player->update_ik_locks(currentTime);
m_pIk->update_targets(pos, q, player->GetBoneAccessor()->GetBoneArrayForWrite(), &computed[0]);
player->calculate_ik_locks(currentTime);
m_pIk->solve_dependencies(pos, q, player->GetBoneAccessor()->GetBoneArrayForWrite(), &computed[0]);
}
player->BuildTransformations(hdr, pos, q, parent_transform, 256, &computed[0]);
// restore old matrix.
bone_accessor->SetBoneArrayForWrite(backup_matrix);
// restore original interpolated entity data.
player->get_effects() &= ~0x008;
return;
}
сама ошибка
const auto hdr = player->GetModelPtr();
if (!hdr)
return;
с2040: hdr "const auto" отличается по уровням косвенного обращения от "studiohdrt_t *const"
{
if (!player)
return;
// get studio hdr.
const auto hdr = player->GetModelPtr();
if (!hdr)
return;
// get renderable entity.
const auto renderable = (C_BasePlayer*)((DWORD)player + 0x4);
if (!renderable)
return;
// initialize variables.
Vector pos[128]{};
quaternion q[128]{};
uint8_t computed[256]{};
// aligned transform matrix.
_declspec(align(16)) matrix3x4_t transform = Math::angle_matrix(
player->GetAbsAngles(), player->m_vecOrigin());
// stop interpolation
player->get_effects() |= 8;
// notify engine we're setting up bones.
*(int*)((DWORD)renderable + 224) |= 8;
// get ik_context.
IKContext* IK_context = player->get_ik_context();
if (IK_context)
{
IK_context->clear_targets();
IK_context->init(hdr, player->GetAbsAngles(), player->m_vecOrigin(),
g_pGlobalVars->curtime, g_pGlobalVars->framecount, 256);
}
// run blending.
player->StandardBlendingRules(hdr, pos, q, g_pGlobalVars->curtime, 256);
// target matrix.
const auto bone_matrix = player->get_bone_array_for_write();
// fix arm jitter.
if (IK_context)
{
player->update_ik_locks(g_pGlobalVars->curtime);
IK_context->update_targets(pos, q, bone_matrix, computed);
player->calculate_ik_locks(g_pGlobalVars->curtime);
IK_context->solve_dependencies(pos, q, bone_matrix, computed);
}
// build bones.
player->BuildTransformations(hdr, pos, q, transform, 256, computed);
// save bones.
memcpy(pBoneToWorldOut, bone_matrix, player->get_bone_cache_count() * sizeof(float) * 12);
// start interpolation again
player->get_effects() &= ~8;
// cleanup.
*(int*)((DWORD)renderable + 224) &= ~(8);
const auto hdr = player->GetModelPtr();
if (!hdr)
return;
auto bone_accessor = player->GetBoneAccessor();
if (!bone_accessor)
return;
const auto backup_matrix = bone_accessor->GetBoneArrayForWrite();
if (!backup_matrix)
return;
ALIGN16 matrix3x4_t parent_transform;
Math::angle_matrix(player->GetAbsAngles(), player->m_vecOrigin(), parent_transform);
ZeroMemory(pos, sizeof(Vector[128]));
ZeroMemory(q, sizeof(quaternion[128]));
player->get_effects() |= 0x008;
IKContext* m_pIk = player->get_ik_context();
if (m_pIk)
{
m_pIk->clear_targets();
m_pIk->init(hdr, player->GetAbsAngles(), player->GetAbsOrigin(), currentTime, g_pGlobalVars->framecount, bone_used_mask);
}
// set bone array for write.
bone_accessor->SetBoneArrayForWrite(pBoneToWorldOut);
// compute and build bones.
player->StandardBlendingRules(hdr, pos, q, g_pGlobalVars->curtime, 256);
ZeroMemory(computed, sizeof(byte[0x20]));
if (m_pIk)
{
player->update_ik_locks(currentTime);
m_pIk->update_targets(pos, q, player->GetBoneAccessor()->GetBoneArrayForWrite(), &computed[0]);
player->calculate_ik_locks(currentTime);
m_pIk->solve_dependencies(pos, q, player->GetBoneAccessor()->GetBoneArrayForWrite(), &computed[0]);
}
player->BuildTransformations(hdr, pos, q, parent_transform, 256, &computed[0]);
// restore old matrix.
bone_accessor->SetBoneArrayForWrite(backup_matrix);
// restore original interpolated entity data.
player->get_effects() &= ~0x008;
return;
}
сама ошибка
const auto hdr = player->GetModelPtr();
if (!hdr)
return;
с2040: hdr "const auto" отличается по уровням косвенного обращения от "studiohdrt_t *const"