Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void handlePlayerAngles(CBaseEntity* ent, ResolverRecord& record, ResolverRecord& prevRecord, lowerBodyYaw& lbyinfo)
- {
- // TODO checking if person is breaking lby, if difference between lby & freestanding yaw is > 90 then true, if u cant do freestanding do backward instead.
- int id = ent->GetUserID();
- resolver_modes& mode = ResolverMode[ent->GetUserID()];
- AnimationLayer CurrentLayer, PreviousLayer;
- bool faking_angles = true,
- lby_update = false,
- moving = record.velocity > 0.1f,
- on_ground = (ent->GetFlags() & FL_ONGROUND);
- float ResolvedYaw;
- if (record.simtime != prevRecord.simtime)
- SimulationTimeDelta[id] = record.simtime - prevRecord.simtime;
- faking_angles = TIME_TO_TICKS(SimulationTimeDelta[id] - g_pGlobalVars->intervalPerTick) >= 1.f;
- lbyinfo.lby = record.lby;
- auto lby_related_time = record.simtime + g_pGlobalVars->intervalPerTick;
- if (moving)
- {
- lbyinfo.Update(lby_related_time + 0.22f, true, true, record);
- lbyinfo.origin = ent->GetOrigin();
- }
- if (!moving)
- {
- if (record.lby != prevRecord.lby)
- {
- lbyinfo.Update(lby_related_time + 1.1f, true);
- lbyinfo.origin = ent->GetOrigin();
- lbyinfo.misc.lastUpdateTime = lby_related_time;
- lbyinfo.misc.lby.last_lby = prevRecord.lby;
- lby_update = true;
- //std::string str = "lbj update: " + ent->GetName() + ", time: " + std::to_string(lby_related_time);
- //g_Logs.addLog(log_color::blue, str.c_str(), true);
- }
- else
- lby_update = false;
- if (record.simtime > lbyinfo.nextUpdate && lbyinfo.canPredict)
- {
- lbyinfo.predicted = true;
- //std::string str = "lbj predicted: " + ent->GetName() + ", time: " + std::to_string(lbyinfo.nextUpdate);
- //g_Logs.addLog(lby_update ? log_color::green : log_color::red, str.c_str(), true);
- lbyinfo.origin = ent->GetOrigin();
- lbyinfo.Update(lby_related_time + 1.1f, true);
- }
- else
- lbyinfo.predicted = false;
- }
- else
- {
- lby_update = false;
- lbyinfo.predicted = false;
- }
- if (on_ground)
- {
- if (moving)
- {
- if (IsFakewalking(ent, record) || IsFakewalking(ent, prevRecord))
- {
- lbyinfo.misc.breakingLby = true;
- auto delta = lbyinfo.misc.didMove ? M::NormalizeYaw(record.lby - lbyinfo.misc.lby.last_moving) : M::NormalizeYaw(record.lby - lbyinfo.misc.lby.last_lby);
- mode = resolver_modes::fakewalk;
- ResolvedYaw = M::NormalizeYaw(record.lby + delta);
- if (G::MissedShots[id][mode] > 2)
- ResolvedYaw = M::bruteforce(G::MissedShots[id][mode], ResolvedYaw, 45, 8, 2);
- lbyinfo.misc.didMove = false;
- }
- else
- {
- mode = resolver_modes::lby_move;
- lbyinfo.misc.breakingLby = false;
- ResolvedYaw = record.lby;
- lbyinfo.misc.lby.last_lby = record.lby;
- }
- }
- else
- {
- if (record.simtime - lbyinfo.misc.lastMovingTime < 0.22f && lbyinfo.misc.updatePreLBY)
- {
- lbyinfo.misc.updatePreLBY = false;
- lbyinfo.misc.lby.before_update = record.lby;
- }
- if (lby_update /* || ((record.lby != lbyinfo.misc.lby.before_update) && lbyinfo.misc.didMove)*/)
- {
- lbyinfo.misc.lby.delta = M::NormalizeYaw(record.lby - lbyinfo.misc.lby.last_lby);
- if (fabsf(lbyinfo.misc.lby.delta) > 70.f)
- lbyinfo.misc.breakingLby = true;
- else
- lbyinfo.misc.breakingLby = false;
- if (!lbyinfo.misc.didMove)
- if (!(fabs(record.simtime - lbyinfo.misc.lastUpdateTime) > 1.1f) && !BreakingLBY(ent, record, CurrentLayer, prevRecord, PreviousLayer))
- lbyinfo.misc.breakingLby = false;
- lbyinfo.misc.didMove = false;
- }
- if (lbyinfo.misc.breakingLby)
- {
- mode = resolver_modes::breaking_lby;
- ResolvedYaw = M::NormalizeYaw(record.lby + lbyinfo.misc.lby.delta);
- if (G::MissedShots[id][mode] > 2)
- ResolvedYaw = M::bruteforce(G::MissedShots[id][mode], ResolvedYaw, 45, 8, 2);
- }
- else
- {
- //float bodyeyedelta = fabs(record.eyeAngles.y - record.lby);
- //if (fabs(bodyeyedelta) > 0 && abs(bodyeyedelta) < 35)
- //{
- // mode = resolver_modes::lby_stand_eye_delta;
- // ResolvedYaw = record.lby + bodyeyedelta;
- //}
- //else
- {
- mode = resolver_modes::lby_stand;
- ResolvedYaw = record.lby;
- }
- if (G::MissedShots[id][mode] > 2)
- ResolvedYaw = M::bruteforce(G::MissedShots[id][mode], ResolvedYaw, 45, 8, 2);
- }
- }
- }
- else
- {
- mode = resolver_modes::air;
- ResolvedYaw = record.lby;
- lbyinfo.misc.breakingLby = false;
- if (G::MissedShots[id][mode] > 2)
- ResolvedYaw = M::bruteforce(G::MissedShots[id][mode], ResolvedYaw, 45, 8, 2);
- }
- float freestand = freestandResolver(ent);
- if (freestand != FLT_MAX && !lby_update && !moving)
- {
- mode = resolver_modes::freestand;
- ResolvedYaw = M::NormalizeYaw(freestand);
- if (G::MissedShots[id][mode] > 2)
- ResolvedYaw += M::bruteforce(G::MissedShots[id][mode], freestand, 45, 8, 2);
- }
- float overrideYaw = Override(ent);
- if (overrideYaw != FLT_MAX)
- {
- mode = resolver_modes::override;
- ResolvedYaw = M::NormalizeYaw(overrideYaw);
- }
- if (lby_update)
- {
- mode = resolver_modes::lby_update;
- ResolvedYaw = ent->GetLowerbodyYaw();
- }
- if (lbyinfo.predicted)
- {
- mode = resolver_modes::lby_flick;
- ResolvedYaw = ent->GetLowerbodyYaw();
- }
- if (!faking_angles)
- {
- mode = resolver_modes::legit;
- ResolvedYaw = ent->GetEyeAngles().y;
- lbyinfo.misc.breakingLby = false;
- }
- ent->GetEyeAnglesPointer()->y = ResolvedYaw;
- G::BreakingLBY[id] = lbyinfo.misc.breakingLby;
- G::ResolverPriority[id] = mode;
- G::Resolvermode[id] = getResolverMode(ent, mode);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement