Advertisement
ijontichy

<stdin>

Mar 16th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. script 461 (int tx, int ty, int tz) clientside
  2. {
  3. if (ConsolePlayerNumber() == -1) { terminate; }
  4.  
  5. int pln = PlayerNumber();
  6. int i, k;
  7. int x, y, z;
  8. int vx, vy, vz, mag, magI;
  9. int hx, hy, hz;
  10.  
  11. if (PlayerCoords[pln][3] == Timer())
  12. {
  13. x = PlayerCoords[pln][0];
  14. y = PlayerCoords[pln][1];
  15. z = PlayerCoords[pln][2];
  16. }
  17. else
  18. {
  19. x = GetActorX(0);
  20. y = GetActorY(0);
  21. z = GetActorZ(0);
  22. }
  23.  
  24. z += BFG_ZOFF;
  25.  
  26. vx = tx-x; vy = ty-y; vz = tz-z; mag = magnitudeThree_f(vx, vy, vz);
  27. vx = FixedDiv(vx, mag); vy = FixedDiv(vy, mag); vz = FixedDiv(vz, mag);
  28. magI = ftoi(mag);
  29.  
  30. int angle = VectorAngle(vx, vy);
  31. int pitch = -VectorAngle(magnitudeTwo_f(vx, vy), vz);
  32.  
  33. // Precalculate matrix multipliers
  34. // look at helix.txt for how I got to what I did
  35.  
  36. int mx_x = FixedMul(cos(angle), cos(pitch));
  37. int mx_y = -sin(angle);
  38. int mx_z = FixedMul(cos(angle), sin(pitch));
  39.  
  40. int my_x = FixedMul(sin(angle), cos(pitch));
  41. int my_y = cos(angle);
  42. int my_z = FixedMul(sin(angle), sin(pitch));
  43.  
  44. int mz_x = -sin(pitch);
  45. int mz_z = cos(pitch);
  46.  
  47. for (i = 48; i < magI; i += 16)
  48. {
  49. Spawn("DakkaBFGBeam_Client", x+(vx*i), y+(vy*i), z+(vz*i));
  50. }
  51.  
  52. int wait;
  53. int last = BFG_HELIX_START;
  54.  
  55. for (i = BFG_HELIX_START; i < magI; i += BFG_HELIX_STEP)
  56. {
  57. k = itof(i) / 1024;
  58. hx = itof(i);
  59. hy = FixedMul(sin(k), BFG_HELIXRADIUS_X);
  60. hz = FixedMul(cos(k), BFG_HELIXRADIUS_Y);
  61.  
  62. Spawn("DakkaBFGBeam_Helix", x + FixedMul(hx, mx_x) + FixedMul(hy, mx_y) + FixedMul(hz, mx_z),
  63. y + FixedMul(hx, my_x) + FixedMul(hy, my_y) + FixedMul(hz, my_z),
  64. z + FixedMul(hx, mz_x) + FixedMul(hz, mz_z));
  65.  
  66. Spawn("DakkaBFGBeam_HelixCenter", x+(vx*i), y+(vy*i), z+(vz*i));
  67.  
  68. wait += (i - last);
  69. Delay(wait / BFG_HELIX_SPEED);
  70. wait %= BFG_HELIX_SPEED;
  71.  
  72. last = i;
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement