Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function int pow(int x, int y)
- {
- int n = 1;
- while (y-- > 0) { n *= x; }
- return n;
- }
- script 343 (int degrees, int ticsup, int ticsdown) clientside
- {
- degrees = degrees << 16;
- if (degrees < 0) { degrees /= -100; }
- int qCurve, oldPitch, newPitch, pitchDiff, i;
- if (ticsup > 0)
- {
- qCurve = degrees / pow(ticsup, 2);
- newPitch = qCurve * pow(ticsup, 2);
- for (i = 0; i < ticsup; i++)
- {
- oldPitch = newPitch;
- // y = a(x-h)**2 + k
- newPitch = qCurve * pow((i+1)-ticsup, 2);
- pitchDiff = (newPitch - oldPitch) / 360;
- SetActorPitch(0, GetActorPitch(0) + pitchDiff);
- Delay(1);
- }
- }
- else
- {
- SetActorPitch(0, GetActorPitch(0) - (degrees / 360));
- }
- if (ticsdown > 0)
- {
- qCurve = -degrees / pow(ticsdown, 2);
- newPitch = qCurve * pow(ticsdown, 2);
- for (i = 0; i < ticsdown; i++)
- {
- oldPitch = newPitch;
- // y = a(x-h)**2 + k
- newPitch = qCurve * pow((i+1)-ticsdown, 2);
- pitchDiff = (newPitch - oldPitch) / 360;
- SetActorPitch(0, GetActorPitch(0) + pitchDiff);
- Delay(1);
- }
- }
- else
- {
- SetActorPitch(0, GetActorPitch(0) + (degrees / 360));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement