Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- if (pEnt) {
- pEnt->ClientAnimations(true);
- auto player_animation_state = pEnt->AnimState();
- player_animation_state->m_flLeanAmount = 94;
- player_animation_state->m_flCurrentTorsoYaw += 28;
- pEnt->UpdateClientAnimation();
- pEnt->SetAbsAngles(Vector(0, player_animation_state->m_flGoalFeetYaw, 0));
- pEnt->ClientAnimations(false);
- }
- else {
- auto player_index = pEnt->EntIndex() - 1;
- pEnt->ClientAnimations(true);
- auto old_curtime = g_pGlobalVars->curtime;
- auto old_frametime = g_pGlobalVars->frametime;
- g_pGlobalVars->curtime = pEnt->GetSimulationTime();
- g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
- auto player_animation_state = pEnt->AnimState();
- auto player_model_time = reinterpret_cast<int*>(player_animation_state + 112);
- if (player_animation_state != nullptr && player_model_time != nullptr)
- if (*player_model_time == g_pGlobalVars->framecount)
- * player_model_time = g_pGlobalVars->framecount - 1;
- pEnt->UpdateClientAnimation();
- g_pGlobalVars->curtime = old_curtime;
- g_pGlobalVars->frametime = old_frametime;
- pEnt->SetAbsAngles(Vector(0, player_animation_state->m_flGoalFeetYaw, 0));
- pEnt->ClientAnimations(false);
- }
- }
- float flAngleMod(float flAngle)
- {
- return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
- }
- float ApproachAngle(float target, float value, float speed)
- {
- target = flAngleMod(target);
- value = flAngleMod(value);
- float delta = target - value;
- if (speed < 0)
- speed = -speed;
- #pragma region release nn shit
- #ifdef RELEASE
- if (delta < -180)
- delta += 360;
- else if (delta > 180)
- delta -= 360;
- #endif
- #pragma region debug nn shit
- #ifdef DEBUG
- if (delta > 180)
- delta -= 360;
- else if (delta < 180)
- delta += 360;
- #endif
- if (delta > speed)
- value += speed;
- else if (delta < -speed)
- value -= speed;
- else
- value = target;
- return value;
- }
- void update_state(C_AnimState* state, Vector angles) {
- using Fn = void(__vectorcall*)(void*, void*, float, float, float, void*);
- static auto fn = reinterpret_cast<Fn>(Utils::FindSignature("client_panorama.dll", "55 8B EC 83 E4 F8 83 EC 18 56 57 8B F9 F3 0F 11 54 24"));
- fn(state, nullptr, 0.0f, angles[1], angles[0], nullptr);
- }
- void HandleBackUpResolve(C_BaseEntity* pEnt) {
- if (!g_Menu.Config.Resolvers)
- return;
- const auto player_animation_state = pEnt->AnimState();
- if (!player_animation_state)
- return;
- float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
- auto v48 = 0.f;
- if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
- {
- v48 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 1.0f);
- }
- else
- {
- v48 = 0.0f;
- }
- float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
- float flYawModifier = v49 + 1.0;
- if (player_animation_state->m_fDuckAmount > 0.0)
- {
- float v53 = 0.0f;
- if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
- {
- v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
- }
- else
- {
- v53 = 0.0f;
- }
- }
- float flMaxYawModifier = player_animation_state->pad10[516] * flYawModifier;
- float flMinYawModifier = player_animation_state->pad10[512] * flYawModifier;
- float newFeetYaw = 0.f;
- auto eyeYaw = player_animation_state->m_flEyeYaw;
- auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
- float eye_feet_delta = fabs(eyeYaw - lbyYaw);
- if (eye_feet_delta <= flMaxYawModifier)
- {
- if (flMinYawModifier > eye_feet_delta)
- {
- newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
- }
- }
- else
- {
- newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
- }
- float v136 = fmod(newFeetYaw, 360.0);
- if (v136 > 180.0)
- {
- v136 = v136 - 360.0;
- }
- if (v136 < 180.0)
- {
- v136 = v136 + 360.0;
- }
- player_animation_state->m_flGoalFeetYaw = v136;
- static int stored_yaw = 0;
- if (pEnt->GetVelocity().Length2D() > 0.3f)
- {
- player_animation_state->m_flGoalFeetYaw = ApproachAngle(pEnt->GetLowerBodyYaw(), player_animation_state->m_flGoalFeetYaw, (player_animation_state->m_flStopToFullRunningFraction * 20.0f) + 30.0f * player_animation_state->m_flLastClientSideAnimationUpdateTime);
- }
- else
- {
- player_animation_state->m_flGoalFeetYaw = ApproachAngle(pEnt->GetLowerBodyYaw(), player_animation_state->m_flGoalFeetYaw, (m_flLastClientSideAnimationUpdateTimeDelta * 100.0f));
- }
- }
- void Resolver3::OnCreateMove() // cancer v2
- {
- if (!g_Menu.Config.Resolvers)
- return;
- if (!g::pLocalEntity->IsAlive())
- return;
- if (!g::pLocalEntity->GetActiveWeapon() || g::pLocalEntity->IsKnifeorNade())
- return;
- for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
- {
- C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
- if (!pPlayerEntity
- || !pPlayerEntity->IsAlive()
- || pPlayerEntity->IsDormant()
- || pPlayerEntity == g::pLocalEntity
- || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
- {
- UseFreestandAngle[i] = false;
- continue;
- }
- if (abs(pPlayerEntity->GetVelocity().Length2D()) > 29.f)
- UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
- if (abs(pPlayerEntity->GetVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
- {
- bool Autowalled = false, HitSide1 = false, HitSide2 = false;
- float angToLocal = g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y;
- Vector ViewPoint = g::pLocalEntity->GetOrigin() + Vector(0, 0, 90);
- Vector2D Side1 = { (48 * sin(g_Math.GRD_TO_BOG(angToLocal))),(47 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
- Vector2D Side2 = { (48 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(48 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
- Vector2D Side3 = { (57 * sin(g_Math.GRD_TO_BOG(angToLocal))),(58 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
- Vector2D Side4 = { (58 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(57 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
- Vector Origin = pPlayerEntity->GetOrigin();
- Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
- Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
- for (int side = 0; side < 2; side++)
- {
- Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
- Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
- if (g_Autowall.CanHitFloatingPoint(OriginAutowall, ViewPoint, g::pLocalEntity))
- {
- if (side == 0)
- {
- HitSide1 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = 90;
- }
- else if (side == 1)
- {
- HitSide2 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = -90;
- }
- Autowalled = true;
- }
- else
- {
- for (int side222 = 0; side222 < 2; side222++)
- {
- Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };
- if (g_Autowall.CanHitFloatingPoint(OriginAutowall222, OriginAutowall2, g::pLocalEntity))
- {
- if (side222 == 0)
- {
- HitSide1 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = 90;
- }
- else if (side222 == 1)
- {
- HitSide2 = true;
- FreestandAngle[pPlayerEntity->EntIndex()] = -90;
- }
- Autowalled = true;
- }
- }
- }
- }
- if (Autowalled)
- {
- if (HitSide1 && HitSide2)
- UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
- else
- UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
- }
- }
- }
- }
- void Resolver3::FrameStage(ClientFrameStage_t stage)
- {
- if (!g::pLocalEntity || !g_pEngine->IsInGame())
- return;
- static bool wasDormant[65];
- for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
- {
- C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
- if (!pPlayerEntity
- || !pPlayerEntity->IsAlive())
- continue;
- if (pPlayerEntity->IsDormant())
- {
- wasDormant[i] = true;
- continue;
- }
- if (stage == FRAME_RENDER_START)
- {
- // HandleHits(pPlayerEntity);
- AnimationFix(pPlayerEntity);
- }
- if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
- HandleBackUpResolve(pPlayerEntity);
- }
- if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != g::pLocalEntity)
- {
- auto VarMap = reinterpret_cast<uintptr_t>(pPlayerEntity) + 36;
- auto VarMapSize = *reinterpret_cast<int*>(VarMap + 20);
- for (auto index = 0; index < VarMapSize; index++)
- * reinterpret_cast<uintptr_t*>(*reinterpret_cast<uintptr_t*>(VarMap) + index * 12) = 0;
- }
- wasDormant[i] = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement