Advertisement
Guest User

Lmafoware Resolver

a guest
Nov 13th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.83 KB | None | 0 0
  1. {
  2. if (pEnt) {
  3. pEnt->ClientAnimations(true);
  4. auto player_animation_state = pEnt->AnimState();
  5. player_animation_state->m_flLeanAmount = 94;
  6. player_animation_state->m_flCurrentTorsoYaw += 28;
  7. pEnt->UpdateClientAnimation();
  8. pEnt->SetAbsAngles(Vector(0, player_animation_state->m_flGoalFeetYaw, 0));
  9. pEnt->ClientAnimations(false);
  10. }
  11. else {
  12. auto player_index = pEnt->EntIndex() - 1;
  13.  
  14. pEnt->ClientAnimations(true);
  15.  
  16. auto old_curtime = g_pGlobalVars->curtime;
  17. auto old_frametime = g_pGlobalVars->frametime;
  18.  
  19. g_pGlobalVars->curtime = pEnt->GetSimulationTime();
  20. g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
  21.  
  22. auto player_animation_state = pEnt->AnimState();
  23. auto player_model_time = reinterpret_cast<int*>(player_animation_state + 112);
  24. if (player_animation_state != nullptr && player_model_time != nullptr)
  25. if (*player_model_time == g_pGlobalVars->framecount)
  26. * player_model_time = g_pGlobalVars->framecount - 1;
  27.  
  28.  
  29. pEnt->UpdateClientAnimation();
  30.  
  31. g_pGlobalVars->curtime = old_curtime;
  32. g_pGlobalVars->frametime = old_frametime;
  33.  
  34. pEnt->SetAbsAngles(Vector(0, player_animation_state->m_flGoalFeetYaw, 0));
  35.  
  36. pEnt->ClientAnimations(false);
  37. }
  38.  
  39. }
  40. float flAngleMod(float flAngle)
  41. {
  42. return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
  43. }
  44. float ApproachAngle(float target, float value, float speed)
  45. {
  46. target = flAngleMod(target);
  47. value = flAngleMod(value);
  48.  
  49. float delta = target - value;
  50. if (speed < 0)
  51. speed = -speed;
  52.  
  53. #pragma region release nn shit
  54. #ifdef RELEASE
  55. if (delta < -180)
  56. delta += 360;
  57. else if (delta > 180)
  58. delta -= 360;
  59. #endif
  60.  
  61. #pragma region debug nn shit
  62. #ifdef DEBUG
  63. if (delta > 180)
  64. delta -= 360;
  65. else if (delta < 180)
  66. delta += 360;
  67. #endif
  68.  
  69. if (delta > speed)
  70. value += speed;
  71. else if (delta < -speed)
  72. value -= speed;
  73. else
  74. value = target;
  75.  
  76. return value;
  77. }
  78.  
  79. void update_state(C_AnimState* state, Vector angles) {
  80. using Fn = void(__vectorcall*)(void*, void*, float, float, float, void*);
  81. 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"));
  82.  
  83.  
  84.  
  85. fn(state, nullptr, 0.0f, angles[1], angles[0], nullptr);
  86. }
  87.  
  88. void HandleBackUpResolve(C_BaseEntity* pEnt) {
  89.  
  90. if (!g_Menu.Config.Resolvers)
  91. return;
  92.  
  93. const auto player_animation_state = pEnt->AnimState();
  94.  
  95. if (!player_animation_state)
  96. return;
  97.  
  98. float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
  99.  
  100. auto v48 = 0.f;
  101.  
  102. if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  103. {
  104. v48 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 1.0f);
  105. }
  106. else
  107. {
  108. v48 = 0.0f;
  109. }
  110.  
  111. float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
  112.  
  113. float flYawModifier = v49 + 1.0;
  114.  
  115. if (player_animation_state->m_fDuckAmount > 0.0)
  116. {
  117. float v53 = 0.0f;
  118.  
  119. if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  120. {
  121. v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  122. }
  123. else
  124. {
  125. v53 = 0.0f;
  126. }
  127. }
  128.  
  129. float flMaxYawModifier = player_animation_state->pad10[516] * flYawModifier;
  130. float flMinYawModifier = player_animation_state->pad10[512] * flYawModifier;
  131.  
  132. float newFeetYaw = 0.f;
  133.  
  134. auto eyeYaw = player_animation_state->m_flEyeYaw;
  135.  
  136. auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
  137.  
  138. float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  139.  
  140. if (eye_feet_delta <= flMaxYawModifier)
  141. {
  142. if (flMinYawModifier > eye_feet_delta)
  143. {
  144. newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  145. }
  146. }
  147. else
  148. {
  149. newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  150. }
  151.  
  152. float v136 = fmod(newFeetYaw, 360.0);
  153.  
  154. if (v136 > 180.0)
  155. {
  156. v136 = v136 - 360.0;
  157. }
  158.  
  159. if (v136 < 180.0)
  160. {
  161. v136 = v136 + 360.0;
  162. }
  163.  
  164. player_animation_state->m_flGoalFeetYaw = v136;
  165.  
  166. static int stored_yaw = 0;
  167.  
  168. if (pEnt->GetVelocity().Length2D() > 0.3f)
  169. {
  170. 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);
  171. }
  172. else
  173. {
  174. player_animation_state->m_flGoalFeetYaw = ApproachAngle(pEnt->GetLowerBodyYaw(), player_animation_state->m_flGoalFeetYaw, (m_flLastClientSideAnimationUpdateTimeDelta * 100.0f));
  175. }
  176. }
  177.  
  178. void Resolver3::OnCreateMove() // cancer v2
  179. {
  180.  
  181. if (!g_Menu.Config.Resolvers)
  182. return;
  183.  
  184. if (!g::pLocalEntity->IsAlive())
  185. return;
  186.  
  187. if (!g::pLocalEntity->GetActiveWeapon() || g::pLocalEntity->IsKnifeorNade())
  188. return;
  189.  
  190.  
  191. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  192. {
  193. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  194.  
  195. if (!pPlayerEntity
  196. || !pPlayerEntity->IsAlive()
  197. || pPlayerEntity->IsDormant()
  198. || pPlayerEntity == g::pLocalEntity
  199. || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
  200. {
  201. UseFreestandAngle[i] = false;
  202. continue;
  203. }
  204.  
  205. if (abs(pPlayerEntity->GetVelocity().Length2D()) > 29.f)
  206. UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
  207.  
  208. if (abs(pPlayerEntity->GetVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
  209. {
  210. bool Autowalled = false, HitSide1 = false, HitSide2 = false;
  211.  
  212. float angToLocal = g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y;
  213. Vector ViewPoint = g::pLocalEntity->GetOrigin() + Vector(0, 0, 90);
  214.  
  215. Vector2D Side1 = { (48 * sin(g_Math.GRD_TO_BOG(angToLocal))),(47 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  216. Vector2D Side2 = { (48 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(48 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  217.  
  218. Vector2D Side3 = { (57 * sin(g_Math.GRD_TO_BOG(angToLocal))),(58 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  219. Vector2D Side4 = { (58 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(57 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  220.  
  221. Vector Origin = pPlayerEntity->GetOrigin();
  222.  
  223. Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
  224.  
  225. Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
  226.  
  227. for (int side = 0; side < 2; side++)
  228. {
  229. Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
  230. Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
  231.  
  232. if (g_Autowall.CanHitFloatingPoint(OriginAutowall, ViewPoint, g::pLocalEntity))
  233. {
  234. if (side == 0)
  235. {
  236. HitSide1 = true;
  237. FreestandAngle[pPlayerEntity->EntIndex()] = 90;
  238. }
  239. else if (side == 1)
  240. {
  241. HitSide2 = true;
  242. FreestandAngle[pPlayerEntity->EntIndex()] = -90;
  243. }
  244.  
  245. Autowalled = true;
  246. }
  247. else
  248. {
  249. for (int side222 = 0; side222 < 2; side222++)
  250. {
  251. Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };
  252.  
  253. if (g_Autowall.CanHitFloatingPoint(OriginAutowall222, OriginAutowall2, g::pLocalEntity))
  254. {
  255. if (side222 == 0)
  256. {
  257. HitSide1 = true;
  258. FreestandAngle[pPlayerEntity->EntIndex()] = 90;
  259. }
  260. else if (side222 == 1)
  261. {
  262. HitSide2 = true;
  263. FreestandAngle[pPlayerEntity->EntIndex()] = -90;
  264. }
  265.  
  266. Autowalled = true;
  267. }
  268. }
  269. }
  270. }
  271.  
  272. if (Autowalled)
  273. {
  274. if (HitSide1 && HitSide2)
  275. UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
  276. else
  277. UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
  278. }
  279. }
  280. }
  281. }
  282.  
  283. void Resolver3::FrameStage(ClientFrameStage_t stage)
  284. {
  285. if (!g::pLocalEntity || !g_pEngine->IsInGame())
  286. return;
  287.  
  288. static bool wasDormant[65];
  289.  
  290. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  291. {
  292. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  293.  
  294. if (!pPlayerEntity
  295. || !pPlayerEntity->IsAlive())
  296. continue;
  297. if (pPlayerEntity->IsDormant())
  298. {
  299. wasDormant[i] = true;
  300. continue;
  301. }
  302.  
  303. if (stage == FRAME_RENDER_START)
  304. {
  305. // HandleHits(pPlayerEntity);
  306. AnimationFix(pPlayerEntity);
  307.  
  308.  
  309. }
  310.  
  311. if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
  312. HandleBackUpResolve(pPlayerEntity);
  313. }
  314.  
  315. if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != g::pLocalEntity)
  316. {
  317. auto VarMap = reinterpret_cast<uintptr_t>(pPlayerEntity) + 36;
  318. auto VarMapSize = *reinterpret_cast<int*>(VarMap + 20);
  319.  
  320. for (auto index = 0; index < VarMapSize; index++)
  321. * reinterpret_cast<uintptr_t*>(*reinterpret_cast<uintptr_t*>(VarMap) + index * 12) = 0;
  322. }
  323.  
  324. wasDormant[i] = false;
  325. }
  326. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement