Advertisement
ijontichy

tmp.c

Jan 19th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.30 KB | None | 0 0
  1. function int pow(int x, int y)
  2. {
  3.     int n = 1;
  4.     while (y-- > 0) { n *= x; }
  5.     return n;
  6. }
  7.  
  8. script 343 (int degrees, int ticsup, int ticsdown) clientside
  9. {
  10.     degrees = degrees << 16;
  11.     if (degrees < 0) { degrees /= -100; }
  12.  
  13.     int qCurve, oldPitch, newPitch, pitchDiff, i;
  14.  
  15.     if (ticsup > 0)
  16.     {
  17.         qCurve = degrees / pow(ticsup, 2);
  18.         newPitch = qCurve * pow(ticsup, 2);
  19.  
  20.         for (i = 0; i < ticsup; i++)
  21.         {
  22.             oldPitch = newPitch;
  23.             // y = a(x-h)**2 + k
  24.             newPitch = qCurve * pow((i+1)-ticsup, 2);
  25.             pitchDiff = (newPitch - oldPitch) / 360;
  26.  
  27.             SetActorPitch(0, GetActorPitch(0) + pitchDiff);
  28.             Delay(1);
  29.         }
  30.     }
  31.     else
  32.     {
  33.         SetActorPitch(0, GetActorPitch(0) - (degrees / 360));
  34.     }
  35.  
  36.     if (ticsdown > 0)
  37.     {
  38.         qCurve = -degrees / pow(ticsdown, 2);
  39.         newPitch = qCurve * pow(ticsdown, 2);
  40.  
  41.         for (i = 0; i < ticsdown; i++)
  42.         {
  43.             oldPitch = newPitch;
  44.             // y = a(x-h)**2 + k
  45.             newPitch = qCurve * pow((i+1)-ticsdown, 2);
  46.             pitchDiff = (newPitch - oldPitch) / 360;
  47.  
  48.             SetActorPitch(0, GetActorPitch(0) + pitchDiff);
  49.             Delay(1);
  50.         }
  51.     }
  52.     else
  53.     {
  54.         SetActorPitch(0, GetActorPitch(0) + (degrees / 360));
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement