-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
int32_t iCurrentSimulationTick = TIME_TO_TICKS(simulated_time);
if (iActivityType > ACTIVITY_NONE)
{
bool bIsOnGround = e->m_fFlags() & FL_ONGROUND;
if (iActivityType == ACTIVITY_JUMP)
{
if (iCurrentSimulationTick == iActivityTick - 1)
bIsOnGround = true;
else if (iCurrentSimulationTick == iActivityTick)
{
// reset animation layer
e->get_animlayers()[ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL].m_flCycle = 0.0f;
e->get_animlayers()[ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL].m_nSequence = record->layers[ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL].m_nSequence;
e->get_animlayers()[ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL].m_flPlaybackRate = record->layers[ANIMATION_LAYER_MOVEMENT_JUMP_OR_FALL].m_flPlaybackRate;
// reset player ground state
bIsOnGround = false;
}
}
else if (iActivityType == ACTIVITY_LAND)
{
if (iCurrentSimulationTick == iActivityTick - 1)
bIsOnGround = false;
else if (iCurrentSimulationTick == iActivityTick)
{
// reset animation layer
e->get_animlayers()[ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB].m_flCycle = 0.0f;
e->get_animlayers()[ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB].m_nSequence = record->layers[ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB].m_nSequence;
e->get_animlayers()[ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB].m_flPlaybackRate = record->layers[ANIMATION_LAYER_MOVEMENT_LAND_OR_CLIMB].m_flPlaybackRate;
// reset player ground state
bIsOnGround = true;
}
}
if (bIsOnGround)
e->m_fFlags() |= FL_ONGROUND;
else
e->m_fFlags() &= ~FL_ONGROUND;