Skip to content

Instantly share code, notes, and snippets.

@leoetlino
Created December 21, 2022 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leoetlino/26a4eeb1c63c50c04f314f792329f68d to your computer and use it in GitHub Desktop.
Save leoetlino/26a4eeb1c63c50c04f314f792329f68d to your computer and use it in GitHub Desktop.
ksys::phys::RagdollController::recalculateEffectiveBoneWeight
int __fastcall ksys::phys::RagdollController::recalculateEffectiveBoneWeight(int this, unsigned int a2)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
v2 = *(this + 76);
v3 = *(this + 60);
v4 = *(this + 64);
if ( v2 == 0.0 )
{
if ( a2 < v3 )
v4 += a2;
v5 = *(this + 72);
if ( a2 < *(this + 68) )
v5 += a2;
v6 = *(this + 56);
if ( a2 < *(this + 52) )
v6 += a2;
*v4 = *v5 * *v6;
}
else if ( v2 >= 0.0 )
{
if ( a2 < v3 )
v4 += a2;
v9 = *(this + 72);
if ( a2 < *(this + 68) )
v9 += a2;
v10 = *(this + 56);
if ( a2 < *(this + 52) )
v10 += a2;
*v4 = *v9 * (((1.0 - *v10) * *(this + 76)) + *v10);
}
else
{
if ( a2 < v3 )
v4 += a2;
v7 = *(this + 72);
if ( a2 < *(this + 68) )
v7 += a2;
v8 = *(this + 56);
if ( a2 < *(this + 52) )
v8 += a2;
*v4 = *v7 * -((*v8 * -v2) - *v8);
}
return this;
}
void __fastcall sub_7101123384(ksys::phys::RagdollController *this, unsigned int a2)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
_78 = this->_78;
if ( _78 == 0.0 )
{
if ( this->_68.mSize <= a2 )
mBuffer = this->_68.mBuffer;
else
mBuffer = &this->_68.mBuffer[a2];
v4 = *mBuffer;
if ( this->mConfiguredBoneWeights.mSize <= a2 )
v5 = this->mConfiguredBoneWeights.mBuffer;
else
v5 = &this->mConfiguredBoneWeights.mBuffer[a2];
v6 = v4 * *v5;
if ( this->mBoneWeights.mSize <= a2 )
v7 = this->mBoneWeights.mBuffer;
else
v7 = &this->mBoneWeights.mBuffer[a2];
*v7 = v6;
}
else
{
if ( this->_68.mSize <= a2 )
v8 = this->_68.mBuffer;
else
v8 = &this->_68.mBuffer[a2];
v9 = *v8;
if ( this->mConfiguredBoneWeights.mSize <= a2 )
v10 = this->mConfiguredBoneWeights.mBuffer;
else
v10 = &this->mConfiguredBoneWeights.mBuffer[a2];
v11 = *v10;
if ( _78 >= 0.0 )
v12 = v11 + (float)(_78 * (float)(1.0 - v11));
else
v12 = v11 - (float)(_78 * (float)(0.0 - v11));
v13 = v9 * v12;
v14 = &this->mBoneWeights.mBuffer[a2];
if ( this->mBoneWeights.mSize <= a2 )
v14 = this->mBoneWeights.mBuffer;
*v14 = v13;
}
}
// local variable allocation has failed, the output may be wrong!
void __fastcall ksys::phys::RagdollController::recalculateEffectiveBoneWeight(ksys::phys::RagdollController *this, int a2)
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
_78 = this->_78;
mBuffer = this->_68.mBuffer;
mSize = this->_68.mSize;
v5 = this->mConfiguredBoneWeights.mSize;
v6 = this->mConfiguredBoneWeights.mBuffer;
v7 = (__int64)(*(_QWORD *)&a2 << 0x20) >> 0x1E;
if ( _78 == 0.0 )
{
if ( mSize > a2 )
mBuffer = (float *)((char *)mBuffer + v7);
if ( v5 > a2 )
v6 = (float *)((char *)v6 + v7);
v8 = *v6;
if ( this->mBoneWeights.mSize <= (unsigned int)a2 )
v9 = this->mBoneWeights.mBuffer;
else
v9 = (float *)((char *)this->mBoneWeights.mBuffer + v7);
*v9 = *mBuffer * v8;
}
else
{
if ( mSize > a2 )
mBuffer = (float *)((char *)mBuffer + v7);
if ( v5 > a2 )
v6 = (float *)((char *)v6 + v7);
v10 = 1.0;
v11 = *v6;
if ( _78 < 0.0 )
v10 = 0.0;
if ( _78 < 0.0 )
_78 = -_78;
if ( this->mBoneWeights.mSize <= (unsigned int)a2 )
v12 = this->mBoneWeights.mBuffer;
else
v12 = (float *)((char *)this->mBoneWeights.mBuffer + v7);
*v12 = *mBuffer * (float)(v11 + (float)(_78 * (float)(v10 - v11)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment