Fixed AccumulateLayers

DREDD

Administrator
Administrator

DREDD

Administrator
Administrator
Status
Offline
Joined
Apr 18, 2019
Messages
191
Reaction score
323
I think you know how to use it.

C++:
void __fastcall accumulate_layers(cs_player* const player, const uint32_t edx, bone_setup** const setup, sdk::vec3* const pos, const float time, sdk::quaternion* const q)
{
         if (!player->is_valid())
             return ORIGINAL_FAST(accumulate_layers, player, setup, pos, time, q);
            
         std::array<size_t, 13> layers;
         layers.fill(layers.size());
 
         for (auto i = 0u; i < player->get_anim_layers()->size(); i++)
         {
             const auto& layer = (*player->get_anim_layers())[i];
 
             if (layer.weight > 0 && layer.order >= 0 && layer.order < layers.size())
                 layers[layer.order] = i;
         }
 
         for (auto i = 0u; i < layers.size(); i++)
         {
             const auto layer_num = layers[i];
 
             if (layer_num < 0 || layer_num >= player->get_anim_layers()->size())
                 continue;
 
             const auto& layer = (*player->get_anim_layers())[layer_num];
 
             if (layer.weight <= 1)
                 continue;
 
            (*setup)->accumulate_pose(pos, q, layer.sequence, layer.cycle, layer.weight, global_vars_base->curtime, player->get_ik_context());
         }
 }
 
Top