Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. static void do_movements(playerinfo_t &plrinfo, bool unduckable_onto_ground)
  2. {
  3. // If we are going to unduck onto ground, set the position type correctly
  4. // so that the strafing stuff later will be correct.
  5. if (unduckable_onto_ground && plrinfo.postype == PositionAir &&
  6. !(p_in_duck->state & 1) && duck_action != 1 && jump_action != 1)
  7. plrinfo.postype = PositionGround;
  8.  
  9. // If we are going to ducktap
  10. if (get_duckstate() == 1 && duck_action != 1 && !(p_in_duck->state & 1) &&
  11. is_unduckable(plrinfo))
  12. plrinfo.postype = PositionAir;
  13.  
  14. // If we are going to jump
  15. if ((jump_action == 1 || p_in_jump->state & 1) &&
  16. !is_jump_in_oldbuttons() && plrinfo.postype == PositionGround) {
  17. plrinfo.postype = PositionAir;
  18. if (tas_dwj) {
  19. tas_dwj--;
  20. duck_action = 1;
  21. }
  22. }
  23.  
  24. if (do_tas_s2y.do_it) {
  25. convert_s2y_to_sba(plrinfo);
  26. do_tas_s2y.do_it = false;
  27. do_tas_sba.do_it = true;
  28. }
  29.  
  30. if (do_tas_sba.do_it) {
  31. double speed = std::hypot(plrinfo.vel[0], plrinfo.vel[1]);
  32. if (speed < 0.1) {
  33. prev_unitvel[0] = std::cos(plrinfo.viewangles[1] * M_PI / 180);
  34. prev_unitvel[1] = std::sin(plrinfo.viewangles[1] * M_PI / 180);
  35. } else {
  36. prev_unitvel[0] = plrinfo.vel[0] / speed;
  37. prev_unitvel[1] = plrinfo.vel[1] / speed;
  38. }
  39.  
  40. // The strafe by angle functionality remains active. Setting do_it to
  41. // false simply means we will not update prev_unitvel here for the
  42. // subsequent frames.
  43. do_tas_sba.do_it = false;
  44. }
  45.  
  46. load_player_movevars(plrinfo);
  47. add_correct_gravity(plrinfo);
  48.  
  49. if (g_moveaction == StrafeNone)
  50. do_strafe_none(plrinfo);
  51. else
  52. do_strafe_tas(plrinfo);
  53.  
  54. orig_SetViewAngles(plrinfo.viewangles);
  55. update_position(plrinfo);
  56. do_tassba(plrinfo);
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement