main public enemy
-
Автор темы
- #1
$$ Moneytalk comunity $$$
Тема была создана по фану т.к половина югейма не знает даже как анимки обновить и наконец-то завести все таки этот ваш ресольвер вантапа...Для особо одаренных профорсить m_flGoalFeetYaw = Yaw + 60 вам не достаточно, необходимо обовлять каждый чокнутый тик....
C++:
void C_AnimSync::UpdatePlayerAnimations( C_BasePlayer* pPlayer, C_LagRecord m_LatestRecord, C_LagRecord m_PreviousRecord, int32_t iRotateSide, bool bRotatePlayer )
{
float_t flCurTime = g_GlobalVars->m_flCurTime;
float_t flRealTime = g_GlobalVars->m_flRealTime;
int32_t iFrameCount = g_GlobalVars->m_iFrameCount;
int32_t iTickCount = g_GlobalVars->m_iTickCount;
float_t flFrameTime = g_GlobalVars->m_flFrameTime;
float_t flAbsFrameTime = g_GlobalVars->m_flAbsFrameTime;
float_t flInterpolation = g_GlobalVars->m_flInterpolationAmount;
float_t flDuckAmount = pPlayer->m_flDuckAmount( );
int32_t iEFlags = pPlayer->m_iEFlags( );
QAngle angEyeAngles = pPlayer->GetCSPlayer( )->m_angEyeAngles( );
float_t flLowerBodyYaw = pPlayer->GetCSPlayer( )->m_flLowerBodyYaw( );
float_t flFeetCycle = pPlayer->GetAnimationState( )->m_flFeetCycle;
float_t flFeetWeight = pPlayer->GetAnimationState( )->m_flFeetWeight;
pPlayer->m_iEFlags( ) &= ~EFL_DIRTY_ABSVELOCITY;
pPlayer->m_fFlags( ) = m_LatestRecord.m_Flags;
pPlayer->m_vecVelocity( ) = m_LatestRecord.m_Velocity;
pPlayer->m_vecAbsVelocity( ) = m_LatestRecord.m_Velocity;
pPlayer->SetAbsOrigin( m_LatestRecord.m_Origin );
if ( g_PlayerData[ pPlayer->EntIndex( ) ].m_bHasPreviousRecord )
{
pPlayer->GetAnimationState( )->m_iStrafeSequence = m_PreviousRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_STRAFECHANGE ).m_nSequence;
pPlayer->GetAnimationState( )->m_flStrafeCycle = m_PreviousRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_STRAFECHANGE ).m_flCycle;
pPlayer->GetAnimationState( )->m_flStrafeWeight = m_PreviousRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_STRAFECHANGE ).m_flWeight;
pPlayer->GetAnimationState( )->m_flFeetCycle = m_PreviousRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_MOVE ).m_flCycle;
pPlayer->GetAnimationState( )->m_flFeetWeight = m_PreviousRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_MOVE ).m_flWeight;
pPlayer->GetAnimationState( )->m_flLeanYaw = m_PreviousRecord.m_AnimationLayers.at( ANIMATION_LAYER_LEAN ).m_flWeight;
std::memcpy( pPlayer->GetAnimationLayers( ), m_PreviousRecord.m_AnimationLayers.data( ), sizeof( C_AnimationLayer ) * 13 );
}
else
{
pPlayer->GetAnimationState( )->m_iStrafeSequence = m_LatestRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_STRAFECHANGE ).m_nSequence;
pPlayer->GetAnimationState( )->m_flStrafeCycle = m_LatestRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_STRAFECHANGE ).m_flCycle;
pPlayer->GetAnimationState( )->m_flStrafeWeight = m_LatestRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_STRAFECHANGE ).m_flWeight;
pPlayer->GetAnimationState( )->m_flFeetCycle = m_LatestRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_MOVE ).m_flCycle;
pPlayer->GetAnimationState( )->m_flFeetWeight = m_LatestRecord.m_AnimationLayers.at( ANIMATION_LAYER_MOVEMENT_MOVE ).m_flWeight;
pPlayer->GetAnimationState( )->m_flLeanYaw = m_LatestRecord.m_AnimationLayers.at( ANIMATION_LAYER_LEAN ).m_flWeight;
pPlayer->GetAnimationState( )->m_flLastClientSideAnimationUpdateTime = m_LatestRecord.m_SimulationTime - TICKS_TO_TIME( m_LatestRecord.m_ChokedTicks );
if ( m_LatestRecord.m_Flags & FL_ONGROUND )
{
pPlayer->GetAnimationState( )->m_bOnGround = true;
pPlayer->GetAnimationState( )->m_bInHitGroundAnimation = false;
}
pPlayer->GetAnimationState( )->m_flTotalTimeInAir = 0.0f;
}
if ( m_LatestRecord.m_ChokedTicks <= 1 )
{
g_GlobalVars->m_flCurTime = m_LatestRecord.m_SimulationTime;
g_GlobalVars->m_flRealTime = m_LatestRecord.m_SimulationTime;
g_GlobalVars->m_flFrameTime = g_GlobalVars->m_flIntervalPerTick;
g_GlobalVars->m_flAbsFrameTime = g_GlobalVars->m_flIntervalPerTick;
g_GlobalVars->m_iFrameCount = TIME_TO_TICKS( m_LatestRecord.m_SimulationTime );
g_GlobalVars->m_iTickCount = TIME_TO_TICKS( m_LatestRecord.m_SimulationTime );
g_GlobalVars->m_flInterpolationAmount = 0.0f;
if ( pPlayer->GetAnimationState( )->m_iLastClientSideAnimationUpdateFramecount >= g_GlobalVars->m_iTickCount )
pPlayer->GetAnimationState( )->m_iLastClientSideAnimationUpdateFramecount = g_GlobalVars->m_iFrameCount - 1;
if ( bRotatePlayer )
{
float_t flEyeYaw = 0.0f;
if ( iRotateSide < 0 )
flEyeYaw = m_LatestRecord.m_EyeAngles.yaw - 60.0f;
else if ( iRotateSide > 0 )
flEyeYaw = m_LatestRecord.m_EyeAngles.yaw + 60.0f;
else
flEyeYaw = m_LatestRecord.m_EyeAngles.yaw;
pPlayer->GetAnimationState( )->m_flGoalFeetYaw = Math::NormalizeAngle( flEyeYaw );
}
pPlayer->GetCSPlayer( )->m_angEyeAngles( ) = m_LatestRecord.m_EyeAngles;
pPlayer->GetCSPlayer( )->m_flLowerBodyYaw( ) = m_LatestRecord.m_LowerBodyYaw;
pPlayer->m_flDuckAmount( ) = m_LatestRecord.m_DuckAmount;
for ( int i = 0; i < 13; i++ )
pPlayer->GetAnimationLayers( )[ i ].m_pOwner = pPlayer;
bool bClientSideAnimation = pPlayer->GetBaseAnimating( )->m_bClientSideAnimation( );
g_Globals.m_AnimationData.m_bUpdateClientSideAnimation = pPlayer->GetBaseAnimating( )->m_bClientSideAnimation( ) = true;
( ( void( __thiscall* )( void* ) )( g_Globals.m_AddressList.UpdateClientSideAnimation ) )( pPlayer );
g_Globals.m_AnimationData.m_bUpdateClientSideAnimation = false;
pPlayer->GetBaseAnimating( )->m_bClientSideAnimation( ) = bClientSideAnimation;
g_GlobalVars->m_flCurTime = flCurTime;
g_GlobalVars->m_flRealTime = flRealTime;
g_GlobalVars->m_flFrameTime = flFrameTime;
g_GlobalVars->m_flAbsFrameTime = flAbsFrameTime;
g_GlobalVars->m_iFrameCount = iFrameCount;
g_GlobalVars->m_iTickCount = iTickCount;
g_GlobalVars->m_flInterpolationAmount = flInterpolation;
}
else
{
int32_t iSimulationTick = 1;
do
{
float_t flSimulationTime = pPlayer->m_flOldSimulationTime( ) + TICKS_TO_TIME( iSimulationTick );
if ( g_PlayerData[ pPlayer->EntIndex( ) ].m_bHasPreviousRecord )
flSimulationTime = g_PlayerData[ pPlayer->EntIndex( ) ].m_PreviousRecord.m_SimulationTime + TICKS_TO_TIME( iSimulationTick );
g_GlobalVars->m_flCurTime = flSimulationTime;
g_GlobalVars->m_flRealTime = flSimulationTime;
g_GlobalVars->m_flFrameTime = g_GlobalVars->m_flIntervalPerTick;
g_GlobalVars->m_flAbsFrameTime = g_GlobalVars->m_flIntervalPerTick;
g_GlobalVars->m_iFrameCount = TIME_TO_TICKS( flSimulationTime );
g_GlobalVars->m_iTickCount = TIME_TO_TICKS( flSimulationTime );
g_GlobalVars->m_flInterpolationAmount = 0.0f;
if ( pPlayer->GetAnimationState( )->m_iLastClientSideAnimationUpdateFramecount >= g_GlobalVars->m_iTickCount )
pPlayer->GetAnimationState( )->m_iLastClientSideAnimationUpdateFramecount = g_GlobalVars->m_iFrameCount - 1;
if ( bRotatePlayer )
{
float_t flEyeYaw = 0.0f;
if ( iRotateSide < 0 )
flEyeYaw = m_LatestRecord.m_EyeAngles.yaw - 60.0f;
else if ( iRotateSide > 0 )
flEyeYaw = m_LatestRecord.m_EyeAngles.yaw + 60.0f;
else
flEyeYaw = m_LatestRecord.m_EyeAngles.yaw;
pPlayer->GetAnimationState( )->m_flGoalFeetYaw = Math::NormalizeAngle( flEyeYaw );
}
if ( m_LatestRecord.m_DuckPerTick )
pPlayer->m_flDuckAmount( ) += m_LatestRecord.m_DuckPerTick * iSimulationTick;
for ( int i = 0; i < 13; i++ )
pPlayer->GetAnimationLayers( )[ i ].m_pOwner = pPlayer;
bool bClientSideAnimation = pPlayer->GetBaseAnimating( )->m_bClientSideAnimation( );
g_Globals.m_AnimationData.m_bUpdateClientSideAnimation = pPlayer->GetBaseAnimating( )->m_bClientSideAnimation( ) = true;
( ( void( __thiscall* )( void* ) )( g_Globals.m_AddressList.UpdateClientSideAnimation ) )( pPlayer );
g_Globals.m_AnimationData.m_bUpdateClientSideAnimation = false;
pPlayer->GetBaseAnimating( )->m_bClientSideAnimation( ) = bClientSideAnimation;
g_GlobalVars->m_flCurTime = flCurTime;
g_GlobalVars->m_flRealTime = flRealTime;
g_GlobalVars->m_flFrameTime = flFrameTime;
g_GlobalVars->m_flAbsFrameTime = flAbsFrameTime;
g_GlobalVars->m_iFrameCount = iFrameCount;
g_GlobalVars->m_iTickCount = iTickCount;
g_GlobalVars->m_flInterpolationAmount = flInterpolation;
// increase simulation tick
iSimulationTick++;
}
while ( iSimulationTick <= m_LatestRecord.m_ChokedTicks );
}
g_GlobalVars->m_flCurTime = flCurTime;
g_GlobalVars->m_flRealTime = flRealTime;
g_GlobalVars->m_flFrameTime = flFrameTime;
g_GlobalVars->m_flAbsFrameTime = flAbsFrameTime;
g_GlobalVars->m_iFrameCount = iFrameCount;
g_GlobalVars->m_iTickCount = iTickCount;
g_GlobalVars->m_flInterpolationAmount = flInterpolation;
pPlayer->GetAnimationState( )->m_flFeetCycle = flFeetCycle;
pPlayer->GetAnimationState( )->m_flFeetWeight = flFeetWeight;
pPlayer->GetCSPlayer( )->m_angEyeAngles( ) = angEyeAngles;
pPlayer->GetCSPlayer( )->m_flLowerBodyYaw( ) = flLowerBodyYaw;
pPlayer->m_flDuckAmount( ) = flDuckAmount;
pPlayer->m_iEFlags( ) = iEFlags;
return pPlayer->InvalidatePhysicsRecursive( ANIMATION_CHANGED );
}
C-like:
UpdatePlayerAnimations( pRecord->m_pPlayer, pRecord, pPreviousRecord, 1, true);
// Ваше :
{
std::memcpy( pRecord.ResolverLayers[1], pPlayer->GetAnimationLayers( ), sizeof( C_AnimationLayer ) * 13 );
}
Норм челики это заметили по одной вещи, а остальным соболезную
Последнее редактирование: