actionlib.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef ACTION_LIB_H_
  2. #define ACTION_LIB_H_
  3. /*-------------------------------------------------------------------------
  4. * Function: StopEverything
  5. *-------------------------------------------------------------------------
  6. * Purpose:
  7. * Clear the ship controls
  8. */
  9. extern bool StopEverything(IshipIGC* pShip, Time lastUpdate);
  10. /*-------------------------------------------------------------------------
  11. * Function: StrafeAttackTarget
  12. *-------------------------------------------------------------------------
  13. * Purpose:
  14. * To fly straight at the target, guns blazing, and then pull up at the
  15. * last second.
  16. * Notes:
  17. * This never quite panned out. You can look at bug 1191 for information.
  18. * Basically, using the goto function and trying to create a nice path
  19. * for the drones to come in and then pull up was next to impossible.
  20. * They would either get too much momentum towards their target, and then
  21. * not be able to pull up (especially for stations). First, I was hitting
  22. * this in the DoGotoAction:
  23. * if ((offsetLength2 < (r * r)) && (offsetLength2 > 0.1f))
  24. *
  25. * In otherwords, since we couldn't divide by zero, if we were perfectly
  26. * on path with an obstacle, we would just hit it. That meant that I could
  27. * not just GOTO our target and let the dodge code do it's thing. So I
  28. * played with making a nice arc in at the target, and then up. Once again,
  29. * I either got a lot of good shots in, and then couldn't pull up, or I
  30. * would only get one or two shots in if I was pulling up in enough time.
  31. * I think doing it right would mean NOT using the DoGotoAction function,
  32. * and that was more than I felt I should do in the last week. Too dangerous.
  33. */
  34. /*
  35. extern bool StrafeAttackTarget(IshipIGC* pShip,
  36. ImodelIGC* pTarget,
  37. Time lastUpdate,
  38. float dt,
  39. float shootSkill,
  40. float moveSkill,
  41. float howClose);
  42. */
  43. /*-------------------------------------------------------------------------
  44. * Function: StationaryAttackTarget
  45. *-------------------------------------------------------------------------
  46. * Purpose:
  47. * Don't thrust at all, just rotate your target into position and fire away
  48. */
  49. extern bool StationaryAttackTarget(IshipIGC* pShip,
  50. Time lastUpdate,
  51. ImodelIGC* pTarget,
  52. float dt,
  53. float shootSkill,
  54. float moveSkill,
  55. bool fCareful);
  56. /*-------------------------------------------------------------------------
  57. * Function: DoGotoAction
  58. *-------------------------------------------------------------------------
  59. * Purpose:
  60. * This is the most used function in all of the drone code. It takes the
  61. * ship, the target position, and a slew of other parameters, and does three
  62. * things:
  63. * 1) Dodges immediate impacts
  64. * 2) Evaluates a path around huge static obstacles
  65. * 3) Pulls into the desired radius of the target position, or orbits
  66. */
  67. extern bool DoGotoAction(IshipIGC* pShip,
  68. Time lastUpdate,
  69. ImodelIGC* pTarget,
  70. Vector position,
  71. Vector velocity,
  72. float radius,
  73. float dt,
  74. float skill,
  75. bool bThroughAlephs = false,
  76. bool orbit = false,
  77. bool dodgeBullets = true);
  78. #endif