The be all, end all of setupbones fixes

Пользователь
Статус
Оффлайн
Регистрация
12 Янв 2018
Сообщения
54
Реакции[?]
116
Поинты[?]
1K
C++:
void C_BasePlayer::SetupBonesFix() {
  static auto r_jiggle_bones = g_CVar->FindVar("r_jiggle_bones");

  auto animstate = GetPlayerAnimState();
  //fixvelocity
  animstate->m_vVelocityX = 0.f;
  animstate->m_vVelocityY = 0.f;
  animstate->speed_2d = 0.001f; // 0.0 will break more than fix so use 0.001 or just hook this field

  auto parent_cvar = r_jiggle_bones->m_pParent;
  if (parent_cvar == r_jiggle_bones)
    parent_cvar = 0;
  else
    parent_cvar = 1;

  // fixing goal feet yaw for better interpolating bones 
  animstate->m_flGoalFeetYaw = this->m_flLowerBodyYawTarget() + animstate->m_flMaxBodyYaw;

  C_AnimationOverlay* pOverlay = this->GetAnimOverlay(6);
  //adjust the value to correctly calculate the position of the bones
  pOverlay->m_flWeight = pOverlay->m_flCycle = pOverlay->m_flPlaybackRate = 0.f;
  
  if (pOverlay->m_Sequence > 0) 
    pOverlay->m_Sequence += 1; // Fixing sequence delay before setup bones calc

  //skip extrapolating velocity
  m_bHasDefuser() = false;
  this->m_vecVelocity() = this->EstimateAbsVelocity() * animstate->m_flUnknownVelocityLean;
  //trigger lby update
  m_nSequence() = 979;
  animstate->m_flLastBodyUpdate = g_Globals->curtime + 1.32f; // set new body yaw update with delay

  *(int*)(((uintptr_t)this) + 0xA30) = 0;

  auto v5 = *(int*)(((uintptr_t)this) + 0xF0); 
  *(int*)(((uintptr_t)this) + 0xF0) |= 8u;
  auto v6 = *(uint8_t*)(((uintptr_t)this) + 0x274);  
  *(uint8_t*)(((uintptr_t)this) + 0x274) &= 0xFEu;
  *(int*)(g_GlobalVars + 0x001C) = -1; // fix interpolation
  *(bool*)(((uintptr_t)this) + 0xF3C) = true; // SetupVelocity call for calculation right angles
  // ref: DoExtraBonesProcessing
  (*(_BYTE *)(uintptr_t(this )+ 0xA28)) |= 0xE;
  *(short*)(uintptr_t(this)+ 0x272) = -1


  int result = 1;
  __asm push 0x54f12f43
  this->SetupBones(0, -1, BONE_USED_BY_ANYTHING, g_GlobalVars->curtime);
  __asm pop result
  
  this->m_vecVelocity() = this->EstimateAbsVelocity(); // restore velocity

  *(uint8_t*)(((uintptr_t)this) + 0x274) = v6;
  *(int*)(((uintptr_t)this) + 0xF0) = v5;

  r_jiggle_bones->SetValue(result);
}


bool __fastcall hkSetupBones(void* ecx, void* edx, matrix3x4_t* pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime) {
  auto stack = _AddressOfReturnAddress();
  //prevent game call setupbones
  if (*(int*)((int)stack + 0x14) != 0x54f12f43){
    return false;
  }
  return oSetupBones( ecx, edx, pBoneToWorldOut, nMaxBones, boneMask, std::remainderf(currentTime, 360.0f));
}
credits also: @poiak, ikfakof, Soufiw, @esloberic, not flying lama
 
Забаненный
Статус
Оффлайн
Регистрация
9 Янв 2019
Сообщения
701
Реакции[?]
295
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
НАЧНИ ПРОГРАММИРОВАТЬ ПРЯМО СЕЙЧАС
Участник
Статус
Оффлайн
Регистрация
19 Июн 2017
Сообщения
608
Реакции[?]
924
Поинты[?]
4K
ты забыл еще один оффсет
Код:
*(bool*)(uintptr_t(player) + 0x3AA4) = false; // disable anim overlay extrapolation in accumulate layers
 
Сверху Снизу