Исходник Semi proper animation fix (sup paste ready)

Начинающий
Статус
Оффлайн
Регистрация
5 Авг 2023
Сообщения
65
Реакции[?]
20
Поинты[?]
20K
credits: llama/phillip/raxer and csgo source leak

anims.cpp:
#include "includes.h"

void anims::mini_update( Player* player ) {

    C_AnimationLayer backup_layers[ 13 ];
    player->GetAnimLayers( backup_layers );

    // backup globalvars
    float curtime = g_csgo.m_globals->m_curtime;
    float frame = g_csgo.m_globals->m_frame;
    float frametime = g_csgo.m_globals->m_frametime;

    // set frametime to ipt just like on the server during simulation
    g_csgo.m_globals->m_curtime   = player->m_flSimulationTime( );
    g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;

    // remove abs velocity
    player->m_iEFlags( ) &= ~0x1000;
    player->SetAbsVelocity( player->m_vecVelocity( ) );

    // update animations
    g_hooks.m_UpdateClientSideAnimation( player );

    // restore layers to networked
    player->SetAnimLayers( backup_layers );

    // restore once we're done
    g_csgo.m_globals->m_frame      = frame;
    g_csgo.m_globals->m_curtime   = curtime;
    g_csgo.m_globals->m_frametime = frametime;
}

void anims::update( Player* player, LagRecord* record, LagRecord* previous ) {

    // get anim state
    CCSGOPlayerAnimState *state = player->m_PlayerAnimState( );

    // backup globalvars
    float curtime = g_csgo.m_globals->m_curtime;
    float frame = g_csgo.m_globals->m_frame;
    float frametime = g_csgo.m_globals->m_frametime;

    // backup stuff that we do not want to fuck with.
    AnimationBackup_t backup;
    backup.store( player );

    // set frametime to ipt just like on the server during simulation
    g_csgo.m_globals->m_curtime   = record->m_anim_time;
    g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;    // frame is server_tick on server simulation
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;

    // fuck origin interpolation
    player->SetAbsOrigin( player->m_vecOrigin( ) );

    // fix our animstate vars when animstate resets
    if( state->m_last_update_time == 0.f || !previous ) {
        state->m_on_ground              = !!( player->m_fFlags( ) & FL_ONGROUND );
        state->m_landing              = false;
        state->m_foot_yaw_last          = state->m_foot_yaw = player->m_flLowerBodyYawTarget( );
        state->m_eye_yaw              = player->m_flLowerBodyYawTarget( );
        state->m_eye_pitch              = record->m_eye_angles.x;
        state->m_primary_cycle          = record->m_layers[ 6 ].m_cycle;
        state->m_move_weight          = record->m_layers[ 6 ].m_weight;
        state->m_strafe_sequence      = record->m_layers[ 7 ].m_sequence;
        state->m_strafe_change_weight = record->m_layers[ 7 ].m_weight;
        state->m_strafe_change_cycle  = record->m_layers[ 7 ].m_cycle;
        state->m_acceleration_weight  = record->m_layers[ 12 ].m_weight;
        player->m_flOldSimulationTime( ) = state->m_last_update_time = record->m_sim_time - g_csgo.m_globals->m_interval;
        state->m_last_update_frame    = g_csgo.m_cl->m_server_tick - 1;
        state->m_duration_in_air      = 0.f;

       record->m_anim_velocity = player->m_vecVelocity( );

        if( state->m_on_ground ) {
            record->m_anim_velocity.z = 0.f;

            if( ( state->m_primary_cycle == 0.f || state->m_move_weight == 0.f ) )
                record->m_anim_velocity = vec3_t( );
        }
    }
    // or fix animstate netvars using networked values
    else if( previous ) {
        player->SetAnimLayers( previous->m_layers );
        player->SetPoseParameters( previous->m_poses );
        state->m_primary_cycle          = previous->m_layers[ 6 ].m_cycle;
        state->m_move_weight          = previous->m_layers[ 6 ].m_weight;
        state->m_strafe_sequence      = previous->m_layers[ 7 ].m_sequence;
        state->m_strafe_change_weight = previous->m_layers[ 7 ].m_weight;
        state->m_strafe_change_cycle  = previous->m_layers[ 7 ].m_cycle;
        state->m_acceleration_weight  = previous->m_layers[ 12 ].m_weight;

        // https://gitlab.com/KittenPopo/csgo-2018-source/-/blob/main/game/client/c_baseplayer.cpp#L1139
        // void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
        record->m_anim_velocity = ( record->m_origin - previous->m_origin ) * ( 1.f / game::TICKS_TO_TIME( record->m_lag ) );

        // fix gravity
        if( ( previous->m_flags & FL_ONGROUND )
            && ( record->m_flags & FL_ONGROUND ) ) {
            record->m_anim_velocity.z = 0.f;

            // fix fakewalk
            if( record->m_layers[ 6 ].m_playback_rate == 0.f )
                record->m_anim_velocity = vec3_t( );
        }

        // task for reader: add proper velocity recalculation
        // hint CCSGOPlayerAnimState::SetUpAliveLoop
    }

    // run our resolver
    if( !previous || ( record->m_lag != 1 || previous->m_lag != 1 ) )
        g_resolver.ResolveAngles( player, record );

    // update animations
    for( int i = 1; i <= record->m_lag; i++ ) {

        const float interp = std::clamp( static_cast< float >( i ) / static_cast< float >( record->m_lag ), 0.f, 1.f );

        // interpolate everything to have an approximative simulation
        if( previous && record->m_lag > 1 ) {
            g_csgo.m_globals->m_curtime = math::Lerp( interp, previous->m_sim_time, record->m_sim_time );

             player->m_vecVelocity( ) = math::Lerp( interp, previous->m_anim_velocity, record->m_anim_velocity );
             player->m_flDuckAmount( ) = math::Lerp( interp, previous->m_duck, record->m_duck );
             // task: fix land by calculating land time with layer 4 and 5
        }
        else
              player->m_vecVelocity( ) = record->m_anim_velocity;

        // remove abs velocity
        player->m_iEFlags( ) &= ~0x1000;
        player->SetAbsVelocity( player->m_vecVelocity( ) );

        // apply our angles
        player->m_angEyeAngles( ) = record->m_eye_angles;

        // update animations
        g_hooks.m_UpdateClientSideAnimation( player );

        // store our abs angles and pose parameters
        record->m_abs_ang = ang_t( 0.f, state->m_foot_yaw, 0.f );
        player->GetPoseParameters( record->m_poses );
    }

    // update player bounds
    player->UpdateCollisionBounds();
    record->m_maxs = player->m_vecMaxs( );
    record->m_mins = player->m_vecMins( );

    // restore our layers to networked and run our setupbones
    player->SetAnimLayers( record->m_layers );
    record->m_setup = player->SetupBones( record->m_bones, 128, BONE_USED_BY_ANYTHING, state->m_last_update_time );

    // restore our animation data
    backup.apply( player );

    // restore once we're done
    g_csgo.m_globals->m_frame      = frame;
    g_csgo.m_globals->m_curtime   = curtime;
    g_csgo.m_globals->m_frametime = frametime;
}

// task: hook C_BasePlayer::PostDataUpdate() and call this in it
// or use FRAME_NET_UPDATE_POSTDATAUPDATE_START
void anims::player_instance( Player* player ) {

    if( !player )
        return;

    CCSGOPlayerAnimState *state = player->m_PlayerAnimState( );
    if ( !state )
        return;

    AimPlayer* data = &g_aimbot.m_players[ player->index( ) - 1 ];

    if( !player->alive( ) || !g_cl.m_processing ) {

        if( player->m_flSimulationTime( ) != player->m_flOldSimulationTime( ) )
            mini_update( player );

        data->m_records.clear( );
        data->m_clear_next = true;
        return;
    }


    if( player->dormant( ) ) {

        if( data->m_records.empty( ) || !data->m_records[ 0 ]->dormant( ) ) {
            data->m_records.emplace_front( std::make_shared< LagRecord >( player ) );
            LagRecord* current = data->m_records.front( ).get( );
            current->m_dormant = true;
            current->m_setup   = false;
        }


        data->m_clear_next = true;
        return;
    }

    const float new_spawn = player->m_flSpawnTime( );

    // fix
    if( player != data->m_player || data->m_clear_next || data->m_spawn != new_spawn ) {

        // reset animation state and records (they're all invalid)
        game::ResetAnimationState( state );
        data->m_records.clear( );
        data->m_walk_record = LagRecordMove{ };

        // alternative fix
        player->m_flOldSimulationTime( ) = player->m_flSimulationTime( ) - g_csgo.m_globals->m_interval;
    }

    // update our vars
    data->m_player = player;
    data->m_clear_next = false;
    data->m_spawn = new_spawn;

    // player updated
    if( data->m_records.empty( ) || data->m_records[ 0 ]->m_sim_time != player->m_flSimulationTime( ) ) {

        // emplace new record
        data->m_records.emplace_front( std::make_shared< LagRecord >( player ) );

        // get our new record
        LagRecord* current = data->m_records.front( ).get( );
        current->m_dormant = false;

        // update animations
        update( player, current, data->m_records.size( ) > 1 ? data->m_records[ 1 ].get( ) : nullptr );
    }

    // don't store records that are too old
    while( data->m_records.size( ) > 1 ) {

        if( std::abs( g_csgo.m_cl->m_server_tick - data->m_records.back( )->m_tick ) < 256 )
            break;

        data->m_records.pop_back( );
    }
}

anims.h:
#pragma once

namespace anims {
    void mini_update( Player* player );
    void update( Player* player, LagRecord* record, LagRecord* previous );
    void player_instance( Player* player );
}

struct AnimationBackup_t {
    vec3_t           m_origin, m_abs_origin;
    vec3_t           m_velocity, m_abs_velocity;
    int              m_flags, m_eflags;
    float            m_duck, m_body;
    C_AnimationLayer m_layers[ 13 ];



    __forceinline void apply( Player* m_player ) {
        m_player->m_vecOrigin( ) = m_origin;
        m_player->m_vecVelocity( ) = m_velocity;
        m_player->m_vecAbsVelocity( ) = m_abs_velocity;
        m_player->m_fFlags( ) = m_flags;
        m_player->m_iEFlags( ) = m_eflags;
        m_player->m_flDuckAmount( ) = m_duck;
        m_player->m_flLowerBodyYawTarget( ) = m_body;
        m_player->SetAbsOrigin( m_abs_origin );
        m_player->SetAnimLayers( m_layers );
    }

    __forceinline void store( Player* m_player ) {
        m_origin = m_player->m_vecOrigin( );
        m_abs_origin = m_player->GetAbsOrigin( );
        m_velocity = m_player->m_vecVelocity( );
        m_abs_velocity = m_player->m_vecAbsVelocity( );
        m_flags = m_player->m_fFlags( );
        m_eflags = m_player->m_iEFlags( );
        m_duck = m_player->m_flDuckAmount( );
        m_body = m_player->m_flLowerBodyYawTarget( );
        m_player->GetAnimLayers( m_layers );
    }
};
 
Последнее редактирование:
Nickolas Blecha
Пользователь
Статус
Оффлайн
Регистрация
1 Янв 2018
Сообщения
110
Реакции[?]
34
Поинты[?]
0
there's so many things wrong with this i'm starting to doubt it's even anti-paste lmao

you aren't even accounting for silent updates
there's no need to keep 4x the tickrate of most hvh servers for your records; you could cap this to the servers tickrate and have no issue as most of the ticks after that will just be invalid anyways
you don't allow for re-animating as you only correct m_last_update_frame in the !previous control statement

incorrect operator:
state->m_on_ground = !!( player->m_fFlags( ) & FL_ONGROUND );
!! will return true even if the statement evaluates to zero...

your velocity fix is not only missing multiple things but it's also extremely incorrect other than the original calculation
when setting the original value you should be checking if the no interp effect isn't active (you can see it in the exact link you added lmao)
the default supremacy calculation for anim vel & duck amount is better than what you are doing and you can even use what i said below with curtime to correct it for the way you're animating

Код:
// set frametime to ipt just like on the server during simulation
g_csgo.m_globals->m_curtime   = record->m_anim_time;
g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;    // frame is server_tick on server simulation
g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;
since your simulating the player based on their fakelag amount, it would be better if you set the following based off of the fakelag tick you're currently simulating
Код:
for (auto i = 0; i < record->m_lag; i++) {

    auto tickTime = record->m_anim_time - game::TICKS_TO_TIME(currentLagAmount);
    g_csgo.m_globals->m_curtime = tickTime;
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;
    g_csgo.m_globals->m_frame = game::TIME_TO_TICKS(tickTime);
}
there's also probably a lot more, this is just what was oblivious to me when looking at this;
to anyone that wants to use this, you'd be better off rewriting it from scratch to fix most of the issues in the code as there's a lot of them...
 
Начинающий
Статус
Оффлайн
Регистрация
5 Авг 2023
Сообщения
65
Реакции[?]
20
Поинты[?]
20K
there's so many things wrong with this i'm starting to doubt it's even anti-paste lmao

you aren't even accounting for silent updates
there's no need to keep 4x the tickrate of most hvh servers for your records; you could cap this to the servers tickrate and have no issue as most of the ticks after that will just be invalid anyways
you don't allow for re-animating as you only correct m_last_update_frame in the !previous control statement

incorrect operator:
state->m_on_ground = !!( player->m_fFlags( ) & FL_ONGROUND );
!! will return true even if the statement evaluates to zero...

your velocity fix is not only missing multiple things but it's also extremely incorrect other than the original calculation
when setting the original value you should be checking if the no interp effect isn't active (you can see it in the exact link you added lmao)
the default supremacy calculation for anim vel & duck amount is better than what you are doing and you can even use what i said below with curtime to correct it for the way you're animating

Код:
// set frametime to ipt just like on the server during simulation
g_csgo.m_globals->m_curtime   = record->m_anim_time;
g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;    // frame is server_tick on server simulation
g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;
since your simulating the player based on their fakelag amount, it would be better if you set the following based off of the fakelag tick you're currently simulating
Код:
for (auto i = 0; i < record->m_lag; i++) {

    auto tickTime = record->m_anim_time - game::TICKS_TO_TIME(currentLagAmount);
    g_csgo.m_globals->m_curtime = tickTime;
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;
    g_csgo.m_globals->m_frame = game::TIME_TO_TICKS(tickTime);
}
there's also probably a lot more, this is just what was oblivious to me when looking at this;
to anyone that wants to use this, you'd be better off rewriting it from scratch to fix most of the issues in the code as there's a lot of them...
incorrect operator:
state->m_on_ground = !!( player->m_fFlags( ) & FL_ONGROUND );
will return the same as ( player->m_fFlags( ) & FL_ONGROUND ) it's a fix for when the animstate resets, look at your favourite p2c sources they all do the same, it works just fine(poc:(no ad)
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

frame fix:
    g_csgo.m_globals->m_frame = game::TIME_TO_TICKS(tickTime);
this is wrong, if you looked at how fake angles animated you'd realize they animate every commands on 1 batch when sending packet, this cause the m_frame to be the same on every ticks and not update any other tick other than the first one
also just realized
Код:
    auto tickTime = record->m_anim_time - game::TICKS_TO_TIME(currentLagAmount);
you can't be more wrong than this since anim_time in supremacy is oldsimtime + interval
if you don't understand, supremacy is achieving the correct animtime by taking last data and manually adding 1 tick to it
and then interpolating velocity and duck amount
my method is basically re-running every commands from last + 1 to current like server does without fixing server frame just like server does

when setting the original value you should be checking if the no interp effect isn't active (you can see it in the exact link you added lmao)
you don't need the interp check because by default the game will run
Пожалуйста, авторизуйтесь для просмотра ссылки.
and every other functions related to interpolation unless you fuck that up

edit:
little explanation from uc:
So as you at this point from looking at the code might have realized, is that, while the CGlobalVarsBase::curtime does advance between executing all the delayed user-commands in a batch, we are still in the same server frame, so CGlobalVarsBase::frametime is still the same as the previous user-command we tried to animate.
(Source: (no ad)
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

edit2:
silent updates are also a different thing and that's your job to create a fix for it, this animfix wasnt made to be 100% proper as you paste it in it's made for you to use it and improve it by actually trying to code something, but giving how aggressive you are and how much ego you're giving me i doubt this post was targetted for someone like you (not to mention silent updates are easy to detect as the method is literally public from the 53929 pastes that can be found online, sorry to not give 100% paste ready perfect code)

in end you could have just not commented and make drama for nothing
 
Последнее редактирование:
Участник
Статус
Оффлайн
Регистрация
19 Апр 2020
Сообщения
1,180
Реакции[?]
314
Поинты[?]
152K
Блять какой год… и дальше паблик код сливаете
 
Начинающий
Статус
Оффлайн
Регистрация
5 Авг 2023
Сообщения
65
Реакции[?]
20
Поинты[?]
20K
Новичок
Статус
Оффлайн
Регистрация
1 Мар 2022
Сообщения
1
Реакции[?]
0
Поинты[?]
0
credits: llama/phillip/raxer and csgo source leak

anims.cpp:
#include "includes.h"

void anims::mini_update( Player* player ) {

    C_AnimationLayer backup_layers[ 13 ];
    player->GetAnimLayers( backup_layers );

    // backup globalvars
    float curtime = g_csgo.m_globals->m_curtime;
    float frame = g_csgo.m_globals->m_frame;
    float frametime = g_csgo.m_globals->m_frametime;

    // set frametime to ipt just like on the server during simulation
    g_csgo.m_globals->m_curtime   = player->m_flSimulationTime( );
    g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;

    // remove abs velocity
    player->m_iEFlags( ) &= ~0x1000;
    player->SetAbsVelocity( player->m_vecVelocity( ) );

    // update animations
    g_hooks.m_UpdateClientSideAnimation( player );

    // restore layers to networked
    player->SetAnimLayers( backup_layers );

    // restore once we're done
    g_csgo.m_globals->m_frame      = frame;
    g_csgo.m_globals->m_curtime   = curtime;
    g_csgo.m_globals->m_frametime = frametime;
}

void anims::update( Player* player, LagRecord* record, LagRecord* previous ) {

    // get anim state
    CCSGOPlayerAnimState *state = player->m_PlayerAnimState( );

    // backup globalvars
    float curtime = g_csgo.m_globals->m_curtime;
    float frame = g_csgo.m_globals->m_frame;
    float frametime = g_csgo.m_globals->m_frametime;

    // backup stuff that we do not want to fuck with.
    AnimationBackup_t backup;
    backup.store( player );

    // set frametime to ipt just like on the server during simulation
    g_csgo.m_globals->m_curtime   = record->m_anim_time;
    g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;    // frame is server_tick on server simulation
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;

    // fuck origin interpolation
    player->SetAbsOrigin( player->m_vecOrigin( ) );

    // fix our animstate vars when animstate resets
    if( state->m_last_update_time == 0.f || !previous ) {
        state->m_on_ground              = !!( player->m_fFlags( ) & FL_ONGROUND );
        state->m_landing              = false;
        state->m_foot_yaw_last          = state->m_foot_yaw = player->m_flLowerBodyYawTarget( );
        state->m_eye_yaw              = player->m_flLowerBodyYawTarget( );
        state->m_eye_pitch              = record->m_eye_angles.x;
        state->m_primary_cycle          = record->m_layers[ 6 ].m_cycle;
        state->m_move_weight          = record->m_layers[ 6 ].m_weight;
        state->m_strafe_sequence      = record->m_layers[ 7 ].m_sequence;
        state->m_strafe_change_weight = record->m_layers[ 7 ].m_weight;
        state->m_strafe_change_cycle  = record->m_layers[ 7 ].m_cycle;
        state->m_acceleration_weight  = record->m_layers[ 12 ].m_weight;
        player->m_flOldSimulationTime( ) = state->m_last_update_time = record->m_sim_time - g_csgo.m_globals->m_interval;
        state->m_last_update_frame    = g_csgo.m_cl->m_server_tick - 1;
        state->m_duration_in_air      = 0.f;

       record->m_anim_velocity = player->m_vecVelocity( );

        if( state->m_on_ground ) {
            record->m_anim_velocity.z = 0.f;

            if( ( state->m_primary_cycle == 0.f || state->m_move_weight == 0.f ) )
                record->m_anim_velocity = vec3_t( );
        }
    }
    // or fix animstate netvars using networked values
    else if( previous ) {
        player->SetAnimLayers( previous->m_layers );
        player->SetPoseParameters( previous->m_poses );
        state->m_primary_cycle          = previous->m_layers[ 6 ].m_cycle;
        state->m_move_weight          = previous->m_layers[ 6 ].m_weight;
        state->m_strafe_sequence      = previous->m_layers[ 7 ].m_sequence;
        state->m_strafe_change_weight = previous->m_layers[ 7 ].m_weight;
        state->m_strafe_change_cycle  = previous->m_layers[ 7 ].m_cycle;
        state->m_acceleration_weight  = previous->m_layers[ 12 ].m_weight;

        // https://gitlab.com/KittenPopo/csgo-2018-source/-/blob/main/game/client/c_baseplayer.cpp#L1139
        // void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
        record->m_anim_velocity = ( record->m_origin - previous->m_origin ) * ( 1.f / game::TICKS_TO_TIME( record->m_lag ) );

        // fix gravity
        if( ( previous->m_flags & FL_ONGROUND )
            && ( record->m_flags & FL_ONGROUND ) ) {
            record->m_anim_velocity.z = 0.f;

            // fix fakewalk
            if( record->m_layers[ 6 ].m_playback_rate == 0.f )
                record->m_anim_velocity = vec3_t( );
        }

        // task for reader: add proper velocity recalculation
        // hint CCSGOPlayerAnimState::SetUpAliveLoop
    }

    // run our resolver
    if( !previous || ( record->m_lag != 1 || previous->m_lag != 1 ) )
        g_resolver.ResolveAngles( player, record );

    // update animations
    for( int i = 1; i <= record->m_lag; i++ ) {

        const float interp = std::clamp( static_cast< float >( i ) / static_cast< float >( record->m_lag ), 0.f, 1.f );

        // interpolate everything to have an approximative simulation
        if( previous && record->m_lag > 1 ) {
            g_csgo.m_globals->m_curtime = math::Lerp( interp, previous->m_sim_time, record->m_sim_time );

             player->m_vecVelocity( ) = math::Lerp( interp, previous->m_anim_velocity, record->m_anim_velocity );
             player->m_flDuckAmount( ) = math::Lerp( interp, previous->m_duck, record->m_duck );
             // task: fix land by calculating land time with layer 4 and 5
        }
        else
              player->m_vecVelocity( ) = record->m_anim_velocity;

        // remove abs velocity
        player->m_iEFlags( ) &= ~0x1000;
        player->SetAbsVelocity( player->m_vecVelocity( ) );

        // apply our angles
        player->m_angEyeAngles( ) = record->m_eye_angles;

        // update animations
        g_hooks.m_UpdateClientSideAnimation( player );

        // store our abs angles and pose parameters
        record->m_abs_ang = ang_t( 0.f, state->m_foot_yaw, 0.f );
        player->GetPoseParameters( record->m_poses );
    }

    // update player bounds
    player->UpdateCollisionBounds();
    record->m_maxs = player->m_vecMaxs( );
    record->m_mins = player->m_vecMins( );

    // restore our layers to networked and run our setupbones
    player->SetAnimLayers( record->m_layers );
    record->m_setup = player->SetupBones( record->m_bones, 128, BONE_USED_BY_ANYTHING, state->m_last_update_time );

    // restore our animation data
    backup.apply( player );

    // restore once we're done
    g_csgo.m_globals->m_frame      = frame;
    g_csgo.m_globals->m_curtime   = curtime;
    g_csgo.m_globals->m_frametime = frametime;
}

// task: hook C_BasePlayer::PostDataUpdate() and call this in it
// or use FRAME_NET_UPDATE_POSTDATAUPDATE_START
void anims::player_instance( Player* player ) {

    if( !player )
        return;

    CCSGOPlayerAnimState *state = player->m_PlayerAnimState( );
    if ( !state )
        return;

    AimPlayer* data = &g_aimbot.m_players[ player->index( ) - 1 ];

    if( !player->alive( ) || !g_cl.m_processing ) {

        if( player->m_flSimulationTime( ) != player->m_flOldSimulationTime( ) )
            mini_update( player );

        data->m_records.clear( );
        data->m_clear_next = true;
        return;
    }


    if( player->dormant( ) ) {

        if( data->m_records.empty( ) || !data->m_records[ 0 ]->dormant( ) ) {
            data->m_records.emplace_front( std::make_shared< LagRecord >( player ) );
            LagRecord* current = data->m_records.front( ).get( );
            current->m_dormant = true;
            current->m_setup   = false;
        }


        data->m_clear_next = true;
        return;
    }

    const float new_spawn = player->m_flSpawnTime( );

    // fix
    if( player != data->m_player || data->m_clear_next || data->m_spawn != new_spawn ) {

        // reset animation state and records (they're all invalid)
        game::ResetAnimationState( state );
        data->m_records.clear( );
        data->m_walk_record = LagRecordMove{ };

        // alternative fix
        player->m_flOldSimulationTime( ) = player->m_flSimulationTime( ) - g_csgo.m_globals->m_interval;
    }

    // update our vars
    data->m_player = player;
    data->m_clear_next = false;
    data->m_spawn = new_spawn;

    // player updated
    if( data->m_records.empty( ) || data->m_records[ 0 ]->m_sim_time != player->m_flSimulationTime( ) ) {

        // emplace new record
        data->m_records.emplace_front( std::make_shared< LagRecord >( player ) );

        // get our new record
        LagRecord* current = data->m_records.front( ).get( );
        current->m_dormant = false;

        // update animations
        update( player, current, data->m_records.size( ) > 1 ? data->m_records[ 1 ].get( ) : nullptr );
    }

    // don't store records that are too old
    while( data->m_records.size( ) > 1 ) {

        if( std::abs( g_csgo.m_cl->m_server_tick - data->m_records.back( )->m_tick ) < 256 )
            break;

        data->m_records.pop_back( );
    }
}

anims.h:
#pragma once

namespace anims {
    void mini_update( Player* player );
    void update( Player* player, LagRecord* record, LagRecord* previous );
    void player_instance( Player* player );
}

struct AnimationBackup_t {
    vec3_t           m_origin, m_abs_origin;
    vec3_t           m_velocity, m_abs_velocity;
    int              m_flags, m_eflags;
    float            m_duck, m_body;
    C_AnimationLayer m_layers[ 13 ];



    __forceinline void apply( Player* m_player ) {
        m_player->m_vecOrigin( ) = m_origin;
        m_player->m_vecVelocity( ) = m_velocity;
        m_player->m_vecAbsVelocity( ) = m_abs_velocity;
        m_player->m_fFlags( ) = m_flags;
        m_player->m_iEFlags( ) = m_eflags;
        m_player->m_flDuckAmount( ) = m_duck;
        m_player->m_flLowerBodyYawTarget( ) = m_body;
        m_player->SetAbsOrigin( m_abs_origin );
        m_player->SetAnimLayers( m_layers );
    }

    __forceinline void store( Player* m_player ) {
        m_origin = m_player->m_vecOrigin( );
        m_abs_origin = m_player->GetAbsOrigin( );
        m_velocity = m_player->m_vecVelocity( );
        m_abs_velocity = m_player->m_vecAbsVelocity( );
        m_flags = m_player->m_fFlags( );
        m_eflags = m_player->m_iEFlags( );
        m_duck = m_player->m_flDuckAmount( );
        m_body = m_player->m_flLowerBodyYawTarget( );
        m_player->GetAnimLayers( m_layers );
    }
};
why do you update animations in FRAME_NET_UPDATE_POSTDATAUPDATE_START as opposed to FRAME_NET_UPDATE_END where you will have information on the player before the client has fucked with anything yet (correct me if i am wrong)
 
Nickolas Blecha
Пользователь
Статус
Оффлайн
Регистрация
1 Янв 2018
Сообщения
110
Реакции[?]
34
Поинты[?]
0
not a leak, more of an informative thread because 99% of people have no clue on how it works and just blindly paste
i was wrong, sorry daddy :3 I love you! thanks for the informative posts! I'm a dumb paster anyways i dont rly know what i'm talking about haha.
mmmh daddy
sorry for crying in the replies :(
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
5 Авг 2023
Сообщения
65
Реакции[?]
20
Поинты[?]
20K
why do you update animations in FRAME_NET_UPDATE_POSTDATAUPDATE_START as opposed to FRAME_NET_UPDATE_END where you will have information on the player before the client has fucked with anything yet (correct me if i am wrong)
other way around net_update_end is after netvar compression and EVERYTHING related to interp, but if you want to do this properly you either want to hook C_BaseEntity::PostDataUpdate or C_BasePlayer or C_BaseAnimating, they all technically work and it's up to you to check which one is better by doing your own research

also about net_update_end, you actually get data later than postdataupdate_start, while postdataupdate start is in the same call as C_BasePlayer::PostDataUpdate
 
Забаненный
Статус
Оффлайн
Регистрация
6 Авг 2024
Сообщения
17
Реакции[?]
3
Поинты[?]
5K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
credits: llama/phillip/raxer and csgo source leak

anims.cpp:
#include "includes.h"

void anims::mini_update( Player* player ) {

    C_AnimationLayer backup_layers[ 13 ];
    player->GetAnimLayers( backup_layers );

    // backup globalvars
    float curtime = g_csgo.m_globals->m_curtime;
    float frame = g_csgo.m_globals->m_frame;
    float frametime = g_csgo.m_globals->m_frametime;

    // set frametime to ipt just like on the server during simulation
    g_csgo.m_globals->m_curtime   = player->m_flSimulationTime( );
    g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;

    // remove abs velocity
    player->m_iEFlags( ) &= ~0x1000;
    player->SetAbsVelocity( player->m_vecVelocity( ) );

    // update animations
    g_hooks.m_UpdateClientSideAnimation( player );

    // restore layers to networked
    player->SetAnimLayers( backup_layers );

    // restore once we're done
    g_csgo.m_globals->m_frame      = frame;
    g_csgo.m_globals->m_curtime   = curtime;
    g_csgo.m_globals->m_frametime = frametime;
}

void anims::update( Player* player, LagRecord* record, LagRecord* previous ) {

    // get anim state
    CCSGOPlayerAnimState *state = player->m_PlayerAnimState( );

    // backup globalvars
    float curtime = g_csgo.m_globals->m_curtime;
    float frame = g_csgo.m_globals->m_frame;
    float frametime = g_csgo.m_globals->m_frametime;

    // backup stuff that we do not want to fuck with.
    AnimationBackup_t backup;
    backup.store( player );

    // set frametime to ipt just like on the server during simulation
    g_csgo.m_globals->m_curtime   = record->m_anim_time;
    g_csgo.m_globals->m_frame     = g_csgo.m_cl->m_server_tick;    // frame is server_tick on server simulation
    g_csgo.m_globals->m_frametime = g_csgo.m_globals->m_interval;

    // fuck origin interpolation
    player->SetAbsOrigin( player->m_vecOrigin( ) );

    // fix our animstate vars when animstate resets
    if( state->m_last_update_time == 0.f || !previous ) {
        state->m_on_ground              = !!( player->m_fFlags( ) & FL_ONGROUND );
        state->m_landing              = false;
        state->m_foot_yaw_last          = state->m_foot_yaw = player->m_flLowerBodyYawTarget( );
        state->m_eye_yaw              = player->m_flLowerBodyYawTarget( );
        state->m_eye_pitch              = record->m_eye_angles.x;
        state->m_primary_cycle          = record->m_layers[ 6 ].m_cycle;
        state->m_move_weight          = record->m_layers[ 6 ].m_weight;
        state->m_strafe_sequence      = record->m_layers[ 7 ].m_sequence;
        state->m_strafe_change_weight = record->m_layers[ 7 ].m_weight;
        state->m_strafe_change_cycle  = record->m_layers[ 7 ].m_cycle;
        state->m_acceleration_weight  = record->m_layers[ 12 ].m_weight;
        player->m_flOldSimulationTime( ) = state->m_last_update_time = record->m_sim_time - g_csgo.m_globals->m_interval;
        state->m_last_update_frame    = g_csgo.m_cl->m_server_tick - 1;
        state->m_duration_in_air      = 0.f;

       record->m_anim_velocity = player->m_vecVelocity( );

        if( state->m_on_ground ) {
            record->m_anim_velocity.z = 0.f;

            if( ( state->m_primary_cycle == 0.f || state->m_move_weight == 0.f ) )
                record->m_anim_velocity = vec3_t( );
        }
    }
    // or fix animstate netvars using networked values
    else if( previous ) {
        player->SetAnimLayers( previous->m_layers );
        player->SetPoseParameters( previous->m_poses );
        state->m_primary_cycle          = previous->m_layers[ 6 ].m_cycle;
        state->m_move_weight          = previous->m_layers[ 6 ].m_weight;
        state->m_strafe_sequence      = previous->m_layers[ 7 ].m_sequence;
        state->m_strafe_change_weight = previous->m_layers[ 7 ].m_weight;
        state->m_strafe_change_cycle  = previous->m_layers[ 7 ].m_cycle;
        state->m_acceleration_weight  = previous->m_layers[ 12 ].m_weight;

        // https://gitlab.com/KittenPopo/csgo-2018-source/-/blob/main/game/client/c_baseplayer.cpp#L1139
        // void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
        record->m_anim_velocity = ( record->m_origin - previous->m_origin ) * ( 1.f / game::TICKS_TO_TIME( record->m_lag ) );

        // fix gravity
        if( ( previous->m_flags & FL_ONGROUND )
            && ( record->m_flags & FL_ONGROUND ) ) {
            record->m_anim_velocity.z = 0.f;

            // fix fakewalk
            if( record->m_layers[ 6 ].m_playback_rate == 0.f )
                record->m_anim_velocity = vec3_t( );
        }

        // task for reader: add proper velocity recalculation
        // hint CCSGOPlayerAnimState::SetUpAliveLoop
    }

    // run our resolver
    if( !previous || ( record->m_lag != 1 || previous->m_lag != 1 ) )
        g_resolver.ResolveAngles( player, record );

    // update animations
    for( int i = 1; i <= record->m_lag; i++ ) {

        const float interp = std::clamp( static_cast< float >( i ) / static_cast< float >( record->m_lag ), 0.f, 1.f );

        // interpolate everything to have an approximative simulation
        if( previous && record->m_lag > 1 ) {
            g_csgo.m_globals->m_curtime = math::Lerp( interp, previous->m_sim_time, record->m_sim_time );

             player->m_vecVelocity( ) = math::Lerp( interp, previous->m_anim_velocity, record->m_anim_velocity );
             player->m_flDuckAmount( ) = math::Lerp( interp, previous->m_duck, record->m_duck );
             // task: fix land by calculating land time with layer 4 and 5
        }
        else
              player->m_vecVelocity( ) = record->m_anim_velocity;

        // remove abs velocity
        player->m_iEFlags( ) &= ~0x1000;
        player->SetAbsVelocity( player->m_vecVelocity( ) );

        // apply our angles
        player->m_angEyeAngles( ) = record->m_eye_angles;

        // update animations
        g_hooks.m_UpdateClientSideAnimation( player );

        // store our abs angles and pose parameters
        record->m_abs_ang = ang_t( 0.f, state->m_foot_yaw, 0.f );
        player->GetPoseParameters( record->m_poses );
    }

    // update player bounds
    player->UpdateCollisionBounds();
    record->m_maxs = player->m_vecMaxs( );
    record->m_mins = player->m_vecMins( );

    // restore our layers to networked and run our setupbones
    player->SetAnimLayers( record->m_layers );
    record->m_setup = player->SetupBones( record->m_bones, 128, BONE_USED_BY_ANYTHING, state->m_last_update_time );

    // restore our animation data
    backup.apply( player );

    // restore once we're done
    g_csgo.m_globals->m_frame      = frame;
    g_csgo.m_globals->m_curtime   = curtime;
    g_csgo.m_globals->m_frametime = frametime;
}

// task: hook C_BasePlayer::PostDataUpdate() and call this in it
// or use FRAME_NET_UPDATE_POSTDATAUPDATE_START
void anims::player_instance( Player* player ) {

    if( !player )
        return;

    CCSGOPlayerAnimState *state = player->m_PlayerAnimState( );
    if ( !state )
        return;

    AimPlayer* data = &g_aimbot.m_players[ player->index( ) - 1 ];

    if( !player->alive( ) || !g_cl.m_processing ) {

        if( player->m_flSimulationTime( ) != player->m_flOldSimulationTime( ) )
            mini_update( player );

        data->m_records.clear( );
        data->m_clear_next = true;
        return;
    }


    if( player->dormant( ) ) {

        if( data->m_records.empty( ) || !data->m_records[ 0 ]->dormant( ) ) {
            data->m_records.emplace_front( std::make_shared< LagRecord >( player ) );
            LagRecord* current = data->m_records.front( ).get( );
            current->m_dormant = true;
            current->m_setup   = false;
        }


        data->m_clear_next = true;
        return;
    }

    const float new_spawn = player->m_flSpawnTime( );

    // fix
    if( player != data->m_player || data->m_clear_next || data->m_spawn != new_spawn ) {

        // reset animation state and records (they're all invalid)
        game::ResetAnimationState( state );
        data->m_records.clear( );
        data->m_walk_record = LagRecordMove{ };

        // alternative fix
        player->m_flOldSimulationTime( ) = player->m_flSimulationTime( ) - g_csgo.m_globals->m_interval;
    }

    // update our vars
    data->m_player = player;
    data->m_clear_next = false;
    data->m_spawn = new_spawn;

    // player updated
    if( data->m_records.empty( ) || data->m_records[ 0 ]->m_sim_time != player->m_flSimulationTime( ) ) {

        // emplace new record
        data->m_records.emplace_front( std::make_shared< LagRecord >( player ) );

        // get our new record
        LagRecord* current = data->m_records.front( ).get( );
        current->m_dormant = false;

        // update animations
        update( player, current, data->m_records.size( ) > 1 ? data->m_records[ 1 ].get( ) : nullptr );
    }

    // don't store records that are too old
    while( data->m_records.size( ) > 1 ) {

        if( std::abs( g_csgo.m_cl->m_server_tick - data->m_records.back( )->m_tick ) < 256 )
            break;

        data->m_records.pop_back( );
    }
}

anims.h:
#pragma once

namespace anims {
    void mini_update( Player* player );
    void update( Player* player, LagRecord* record, LagRecord* previous );
    void player_instance( Player* player );
}

struct AnimationBackup_t {
    vec3_t           m_origin, m_abs_origin;
    vec3_t           m_velocity, m_abs_velocity;
    int              m_flags, m_eflags;
    float            m_duck, m_body;
    C_AnimationLayer m_layers[ 13 ];



    __forceinline void apply( Player* m_player ) {
        m_player->m_vecOrigin( ) = m_origin;
        m_player->m_vecVelocity( ) = m_velocity;
        m_player->m_vecAbsVelocity( ) = m_abs_velocity;
        m_player->m_fFlags( ) = m_flags;
        m_player->m_iEFlags( ) = m_eflags;
        m_player->m_flDuckAmount( ) = m_duck;
        m_player->m_flLowerBodyYawTarget( ) = m_body;
        m_player->SetAbsOrigin( m_abs_origin );
        m_player->SetAnimLayers( m_layers );
    }

    __forceinline void store( Player* m_player ) {
        m_origin = m_player->m_vecOrigin( );
        m_abs_origin = m_player->GetAbsOrigin( );
        m_velocity = m_player->m_vecVelocity( );
        m_abs_velocity = m_player->m_vecAbsVelocity( );
        m_flags = m_player->m_fFlags( );
        m_eflags = m_player->m_iEFlags( );
        m_duck = m_player->m_flDuckAmount( );
        m_body = m_player->m_flLowerBodyYawTarget( );
        m_player->GetAnimLayers( m_layers );
    }
};
thanks for shit

first where some checks for estimate velocity for non local players?
something like this:
&& !( IsEffectActive(EF_NOINTERP) || bForceEFNoInterp )
second: why u hint only SetupAliveLoop? i rn can recalculate my velocity via 6th layer aka SetupMovement

about this part:
C++:
   // don't store records that are too old
 while( data->m_records.size( ) > 1 ) {
        if( std::abs( g_csgo.m_cl->m_server_tick - data->m_records.back( )->m_tick ) < 256 )
            break;

        data->m_records.pop_back( );
    }
useless check on server tick - previous server tick < 256 and pop back if size > 1?( right solution its tickrate )
why dont u use erase fuck pop back btw?

idk why r u reference on interpolate func
if u dont know just set varmap->needs_to_interp to false at all(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

about urself reset vars for animstate?
just use game::ResetAnimState( state ) it is the same(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

max bones amt its 256 and bone_used_by_anything ur mask too wrong(
Пожалуйста, авторизуйтесь для просмотра ссылки.
|
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

idk why u SetAbsVelocioty to vecVelocity if u have in ur lagrecord struct m_anim_velocity........ use him
for ur knowledge SetAbsVelocioty function already have
C++:
player->m_iEFlags( ) &= ~0x1000;
(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

but call SetAbsVelocioty its too wrong... due to the fact that the game causes
C++:
InvalidatePhysicsRecursive( VELOCITY_CHANGED );
(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)
and just rebuilt that function...

FRAME_NET_UPDATE_POSTDATAUPDATE_START???? HAHAHAHAH
the game processes animations for the client every frame when an update arrives for a player, u update it urself(FRAME_NET_UPDATE)

first, figure out how the game works...
have a nice day
 
Начинающий
Статус
Оффлайн
Регистрация
5 Авг 2023
Сообщения
65
Реакции[?]
20
Поинты[?]
20K
thanks for shit

first where some checks for estimate velocity for non local players?
something like this:
&& !( IsEffectActive(EF_NOINTERP) || bForceEFNoInterp )
second: why u hint only SetupAliveLoop? i rn can recalculate my velocity via 6th layer aka SetupMovement

about this part:
C++:
   // don't store records that are too old
while( data->m_records.size( ) > 1 ) {
        if( std::abs( g_csgo.m_cl->m_server_tick - data->m_records.back( )->m_tick ) < 256 )
            break;

        data->m_records.pop_back( );
    }
useless check on server tick - previous server tick < 256 and pop back if size > 1?( right solution its tickrate )
why dont u use erase fuck pop back btw?

idk why r u reference on interpolate func
if u dont know just set varmap->needs_to_interp to false at all(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

about urself reset vars for animstate?
just use game::ResetAnimState( state ) it is the same(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

max bones amt its 256 and bone_used_by_anything ur mask too wrong(
Пожалуйста, авторизуйтесь для просмотра ссылки.
|
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

idk why u SetAbsVelocioty to vecVelocity if u have in ur lagrecord struct m_anim_velocity........ use him
for ur knowledge SetAbsVelocioty function already have
C++:
player->m_iEFlags( ) &= ~0x1000;
(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)

but call SetAbsVelocioty its too wrong... due to the fact that the game causes
C++:
InvalidatePhysicsRecursive( VELOCITY_CHANGED );
(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)
and just rebuilt that function...

FRAME_NET_UPDATE_POSTDATAUPDATE_START???? HAHAHAHAH
the game processes animations for the client every frame when an update arrives for a player, u update it urself(FRAME_NET_UPDATE)

first, figure out how the game works...
have a nice day
SetupAliveLoop is way more accurate than layer 6 because layer 6 has a lot of modifiers based on the direction and land weight + most of your favourite p2c use aliveloop(
Пожалуйста, авторизуйтесь для просмотра ссылки.
)
Also disabling the interpolation the proper way (not using varmap) is better if you want your visual models to not get fucked by those too
SetAbsVelocity doesn't even matter as long as you strip 0x1000 from the eflags the client will calc CalcAbsVelocity which will set it to m_vecVelocity and also set VELOCITY_CHANGED

+ the proper way to update anims is using Player::PostDataUpdate, FRAME_NET_UPDATE_POSTDATAUPDATE_START is just the easy way if you just wanna c+p it into your supremacy paste since it's called before var interpolation

+ when setting up bones not actual 256 or 128 bones are setup, only the ones that are used in models are, aka like 98 bones
this is verifiable by printing bonecache size, you could use -1(will force the game to calc how much bones the player has), 128 or 256 as long as it's more than the bonecache needs it will work(note: the reason for that is because of the ( mask & BONE_USED_BY_HITBOX ) & !( mask & BONE_USED_BY_ATTACHMENTS ), it only setup the matrices for those bones)

also animstate::reset doesnt get called on pvs and respawn (e.g in warmup), my fix is just a simple yet effective fix for that + it fixes old simulation time
i also chose to use 256 instead of tickrate for the only reason that supremacy breaks if you .pop_back a record currently in use in their shot system, using 256 is a safe way to clear records without them being used anywhere in the cheat
 
Последнее редактирование:
Забаненный
Статус
Оффлайн
Регистрация
6 Авг 2024
Сообщения
17
Реакции[?]
3
Поинты[?]
5K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
SetupAliveLoop is way more accurate than layer 6 because layer 6 has a lot of modifiers based on the direction and land weight + most of your favourite p2c use aliveloop
Also disabling the interpolation the proper way (not using varmap) is better if you want your visual models to not get fucked by those too
SetAbsVelocity doesn't even matter as long as you strip 0x1000 from the eflags the client will calc CalcAbsVelocity which will set it to m_vecVelocity and also set VELOCITY_CHANGED

+ the proper way to update anims is using Player::PostDataUpdate, FRAME_NET_UPDATE_POSTDATAUPDATE_START is just the easy way if you just wanna c+p it into your supremacy paste since it's called before var interpolation

+ when setting up bones not actual 256 or 128 bones are setup, only the ones that are used in models are, aka like 98 bones
this is verifiable by printing bonecache size, you could use -1(will force the game to calc how much bones the player has), 128 or 256 as long as it's more than the bonecache needs it will work(note: the reason for that is because of the ( mask & BONE_USED_BY_HITBOX ) & !( mask & BONE_USED_BY_ATTACHMENTS ), it only setup the matrices for those bones)

also animstate::reset doesnt get called on pvs and respawn (e.g in warmup), my fix is just a simple yet effective fix for that + it fixes old simulation time
i also chose to use 256 instead of tickrate for the only reason that supremacy breaks if you .pop_back a record currently in use in their shot system, using 256 is a safe way to clear records without them being used anywhere in the cheat
my favourite p2c like skeet use 6th layer for recalculate velocity yep( onetap does same too )
u can urself reset our vars on respawn

game usage -1 for non-setupped stuff

about setabsvelocity its function from the client module yup

right solution is


C++:
player->eflags( ).remove( 0x1000u );
player->abs_velocity( ) = player->velocity( ) = record->m_velocity;
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
5 Авг 2023
Сообщения
65
Реакции[?]
20
Поинты[?]
20K
my favourite p2c like skeet use 6th layer for recalculate velocity yep( onetap does same too )
u can urself reset our vars on respawn

game usage -1 for non-setupped stuff

about setabsvelocity its function from the client module yup

right solution is


C++:
player->eflags( ).remove( 0x1000u );
player->abs_velocity( ) = player->velocity( ) = record->m_velocity;
skeet uses 6th layer when previous is invalid and layer 11 when previous is valid
 
Забаненный
Статус
Оффлайн
Регистрация
6 Авг 2024
Сообщения
17
Реакции[?]
3
Поинты[?]
5K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
skeet uses 6th layer when previous is invalid and layer 11 when previous is valid
C++:
f ( current->m_anim_layers.at ( 6 ).m_weight >= 0.1f ) {
    const auto weight = current->m_anim_layers.at ( 6 ).m_weight;
    const auto prev_weight = previous->m_anim_layers.at ( 6 ).m_weight;
    const auto loop_weight = current->m_anim_layers.at ( 11 ).m_weight;

    const auto length_2d = current->m_velocity.length_2d ( );
    const auto max_spd = player->get_active_weapon ( ) ? std::max ( player->get_max_player_speed ( ), 0.001f ) : 260.f;
    if ( ( loop_weight <= 0.f || loop_weight >= 1.f ) && length_2d >= 0.1f ) {
                    bool valid_6th_layer = weight > 0.f && weight < 1.f && ( weight >= prev_weight );

                    if ( valid_6th_layer ) {
                        auto closest_speed_to_minimal = max_spd * 0.34f;
                        auto spd_multiplier = std::fmaxf ( 0.f, ( max_spd * 0.52f ) - ( max_spd * 0.34f ) );

                        auto v208 = 1.f - current->m_duck_amt;

                        auto speed_via_6th_layer = ( ( ( v208 * spd_multiplier ) + closest_speed_to_minimal ) * weight ) / length_2d;

                        current->m_velocity.x *= speed_via_6th_layer;
                        current->m_velocity.y *= speed_via_6th_layer;

                    }
                }

}
ye but anyway usage 6th layter for calculate shit
 
Начинающий
Статус
Оффлайн
Регистрация
5 Авг 2023
Сообщения
65
Реакции[?]
20
Поинты[?]
20K
C++:
f ( current->m_anim_layers.at ( 6 ).m_weight >= 0.1f ) {
    const auto weight = current->m_anim_layers.at ( 6 ).m_weight;
    const auto prev_weight = previous->m_anim_layers.at ( 6 ).m_weight;
    const auto loop_weight = current->m_anim_layers.at ( 11 ).m_weight;

    const auto length_2d = current->m_velocity.length_2d ( );
    const auto max_spd = player->get_active_weapon ( ) ? std::max ( player->get_max_player_speed ( ), 0.001f ) : 260.f;
    if ( ( loop_weight <= 0.f || loop_weight >= 1.f ) && length_2d >= 0.1f ) {
                    bool valid_6th_layer = weight > 0.f && weight < 1.f && ( weight >= prev_weight );

                    if ( valid_6th_layer ) {
                        auto closest_speed_to_minimal = max_spd * 0.34f;
                        auto spd_multiplier = std::fmaxf ( 0.f, ( max_spd * 0.52f ) - ( max_spd * 0.34f ) );

                        auto v208 = 1.f - current->m_duck_amt;

                        auto speed_via_6th_layer = ( ( ( v208 * spd_multiplier ) + closest_speed_to_minimal ) * weight ) / length_2d;

                        current->m_velocity.x *= speed_via_6th_layer;
                        current->m_velocity.y *= speed_via_6th_layer;

                    }
                }

}
ye but anyway usage 6th layter for calculate shit
layer 11 is way more accurate because it contains raw velocity data thru m_flSpeedAsPortionOfRunTopSpeed
 
Забаненный
Статус
Оффлайн
Регистрация
6 Авг 2024
Сообщения
17
Реакции[?]
3
Поинты[?]
5K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
layer 11 is way more accurate because it contains raw velocity data thru m_flSpeedAsPortionOfRunTopSpeed
m_flSpeedAsPortionOfRunTopSpeed apply in SetUpVelocity btw SetUpAliveLoop use m_flSpeedAsPortionOfRunTopSpeed for self calculates
btw m_flSpeedAsPortionOfRunTopSpeed its std::clamp< float >( velocity / max_spd, 0.f, 1.f );
u CALCULATE WEIGHT BY m_flSpeedAsPortionOfRunTopSpeed AND SOME CONST VARS LIKE 0.34 ETC
 
Сверху Снизу